3	public class SameSumBlocks {  public static void main(String[] args) throws Exception {   FastScanner sc = new FastScanner();   PrintWriter out = new PrintWriter(System.out);   int N = sc.nextInt();   int[] pre = new int[N + 1];   var ansMap = new HashMap<Integer, ArrayDeque<Pair>>();   for (int j = 1; j <= N; j++) {    pre[j] = pre[j - 1] + sc.nextInt();    for (int i = j; i >= 1; i--) {     int sum = pre[j] - pre[i - 1];         if (!ansMap.containsKey(sum) || ansMap.get(sum).getLast().r < i) {      var dq = ansMap.computeIfAbsent(sum, val -> new ArrayDeque<>());      dq.add(new Pair(i, j, sum));     }    }   }   var ans = new ArrayDeque<Pair>();   for (var group : ansMap.values()) {    if (group.size() > ans.size()) {     ans = group;    }   }   out.println(ans.size());   for (Pair p : ans) {    out.println(p);   }   out.close();  }  static class Pair {   int l, r, sum;   public Pair(int ll, int rr, int ss) {    l = ll; r = rr; sum = ss;   }   public String toString() {    return l + " " + r;   }  }  static class FastScanner {   private int BS = 1<<16;   private char NC = (char)0;   private byte[] buf = new byte[BS];   private int bId = 0, size = 0;   private char c = NC;   private double cnt = 1;   private BufferedInputStream in;   public FastScanner() {    in = new BufferedInputStream(System.in, BS);   }   public FastScanner(String s) {    try {     in = new BufferedInputStream(new FileInputStream(new File(s)), BS);    }    catch (Exception e) {     in = new BufferedInputStream(System.in, BS);    }   }   private char getChar(){    while(bId==size) {     try {      size = in.read(buf);     }catch(Exception e) {      return NC;     }     if(size==-1)return NC;     bId=0;    }    return (char)buf[bId++];   }   public int nextInt() {    return (int)nextLong();   }   public int[] nextInts(int N) {    int[] res = new int[N];    for (int i = 0; i < N; i++) {     res[i] = (int) nextLong();    }    return res;   }   public long[] nextLongs(int N) {    long[] res = new long[N];    for (int i = 0; i < N; i++) {     res[i] = nextLong();    }    return res;   }   public long nextLong() {    cnt=1;    boolean neg = false;    if(c==NC)c=getChar();    for(;(c<'0' || c>'9'); c = getChar()) {     if(c=='-')neg=true;    }    long res = 0;    for(; c>='0' && c <='9'; c=getChar()) {     res = (res<<3)+(res<<1)+c-'0';     cnt*=10;    }    return neg?-res:res;   }   public double nextDouble() {    double cur = nextLong();    return c!='.' ? cur:cur+nextLong()/cnt;   }   public String next() {    StringBuilder res = new StringBuilder();    while(c<=32)c=getChar();    while(c>32) {     res.append(c);     c=getChar();    }    return res.toString();   }   public String nextLine() {    StringBuilder res = new StringBuilder();    while(c<=32)c=getChar();    while(c!='\n') {     res.append(c);     c=getChar();    }    return res.toString();   }   public boolean hasNext() {    if(c>32)return true;    while(true) {     c=getChar();     if(c==NC)return false;     else if(c>32)return true;    }   }  } }
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();  } }
4	public class A {  static int dx[] = { 1, -1, 0, 0 }; static int dy[] = { 0, 0, 1, -1 };  public static void main(String args[]) throws Exception {  Scanner sc = new Scanner("input.txt");  PrintWriter out = new PrintWriter("output.txt");  int n = sc.nextInt(), m = sc.nextInt();  int[][] grid = new int[n][m];  for (int[] i : grid)  Arrays.fill(i, -1);  Queue<Pair> q = new LinkedList<>();  int k = sc.nextInt();  for (int i = 0; i < k; i++) {  int x = sc.nextInt() - 1, y = sc.nextInt() - 1;  grid[x][y] = 0;  q.add(new Pair(x, y));  }  Pair p = new Pair(-1, -1);  while (!q.isEmpty()) {  p = q.poll();  for (int i = 0; i < dx.length; i++) {   int tx = p.x + dx[i], ty = p.y + dy[i];   if (tx >= 0 && tx < n && ty >= 0 && ty < m && grid[tx][ty] == -1) {   grid[tx][ty] = grid[p.x][p.y] + 1;   q.add(new Pair(tx, ty));   }  }  }  out.println(p);  out.flush();  out.close(); }  static class Pair {  int x, y;  public Pair(int a, int b) {  x = a;  y = b;  }  public String toString() {  return x + 1 + " " + (y + 1);  } }  static class Scanner {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s));  }  public Scanner(String r) throws FileNotFoundException {  br = new BufferedReader(new FileReader(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 boolean ready() throws IOException {  return br.ready();  } } }
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 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);   BPhoenixAndPuzzle solver = new BPhoenixAndPuzzle();   int testCount = Integer.parseInt(in.next());   for (int i = 1; i <= testCount; i++)    solver.solve(i, in, out);   out.close();  }  static class BPhoenixAndPuzzle {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    if (n % 2 == 1) {     out.println("NO");     return;    }    n /= 2;    if (n == 1 || (int) Math.sqrt(n) * (int) (Math.sqrt(n)) == n) {     out.println("YES");    } else {     if (n % 2 == 0) {      n /= 2;      if ((int) Math.sqrt(n) * (int) (Math.sqrt(n)) == n) {       out.println("YES");       return;      }     }     out.println("NO");    }   }  }  static 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) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }   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();   }  } }
1	public class Main {  public static void main(String[] args) throws IOException {   Scan scan = new Scan();   int n = scan.scanInt();   long d = scan.scanLong();   long a[]=new long[n];   for(int i=0;i<n;i++){    a[i]=scan.scanLong();   }   Arrays.sort(a);   int count=0;   for(int i=0;i<n-1;i++){    if((a[i+1]-d)>(a[i]+d)){     count+=2;    }else if((a[i+1]-d)==(a[i]+d)){     count++;    }   }   count+=2;   System.out.println(count);  }   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 char scanchar()throws IOException   {    int n=scan();    while(isWhiteSpace(n))     n=scan();    return (char)n;         }   public long scanLong()throws IOException   {    long lng=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')     {      lng*=10;      lng+=n-'0';      n=scan();     }     else throw new InputMismatchException();    }    if(n=='.')    {     n=scan();     long temp=1;     while(!isWhiteSpace(n))     {      if(n>='0'&&n<='9')      {       temp/=10;       lng+=(n-'0')*temp;       n=scan();      }      else throw new InputMismatchException();     }    }    return neg*lng;   }   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;   }  } }
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);   F2SameSumBlocksHard solver = new F2SameSumBlocksHard();   solver.solve(1, in, out);   out.close();  }  static class F2SameSumBlocksHard {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    long[] a = in.nextLongArray(n);    long[] p = in.calculatePrefixSum(a);    Map<Long, Integer> map = new HashMap<>();    for (int i = 0; i < n; i++) {     long sum = 0;     for (int j = i; j < n; j++) {      sum += a[j];      map.merge(sum, 1, (x, y) -> x + y);     }    }    List<sum> sums = new ArrayList<>();    for (long sum : map.keySet()) {     sums.add(new sum(sum, map.get(sum)));    }    sums.sort((x, y) -> y.c - x.c);    int ans = -1;    int[] fca = null;    long mxsum = -1;    for (int i = 0; i < sums.size(); i++) {     sum cs = sums.get(i);     long sum = cs.sum;     long c = cs.c;     if (c < ans) {      continue;     }     Map<Long, Integer> lm = new HashMap<>();     int[] ca = new int[n];     lm.put(0l, -1);     for (int j = 0; j < n; j++) {      long val = p[j];      if (j > 0) {       ca[j] = ca[j - 1];      }      long req = val - sum;      if (lm.containsKey(req)) {       int li = lm.get(req);       if (li == -1)        ca[j] = Math.max(1, ca[j]);       else        ca[j] = Math.max(1 + ca[li], ca[j]);      }      lm.put(val, j);     }     if (ca[n - 1] > ans) {      ans = ca[n - 1];      mxsum = sum;      fca = ca;     }    }    List<Integer> al = new ArrayList<>();    long sum = 0;    for (int i = n - 1; i >= 0; i--) {     if (i > 0 && fca[i] != fca[i - 1]) {      sum = 0;      al.add(i + 1);      do {       sum += a[i];       i--;      } while (i >= 0 && sum != mxsum);      i++;      al.add(i + 1);     } else if (i == 0) {      if (a[i] == mxsum) {       al.add(i + 1);       al.add(i + 1);      }     }    }    out.println(al.size() / 2);    for (int i = al.size() - 1; i >= 0; i -= 2) {     out.println(al.get(i) + " " + al.get(i - 1));    }   }   class sum {    long sum;    int c;    public sum(long sum, int c) {     this.sum = sum;     this.c = c;    }   }  }  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 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 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 boolean isSpaceChar(int c) {    if (filter != null) {     return filter.isSpaceChar(c);    }    return isWhitespace(c);   }   public long[] nextLongArray(int n) {    long[] array = new long[n];    for (int i = 0; i < n; ++i) array[i] = nextLong();    return array;   }   public long[] calculatePrefixSum(long[] a) {    int n = a.length;    long[] prefixSum = new long[n];    prefixSum[0] = a[0];    for (int i = 1; i < n; i++) {     prefixSum[i] = prefixSum[i - 1] + a[i];    }    return prefixSum;   }   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 println(Object... objects) {    print(objects);    writer.println();   }   public void close() {    writer.close();   }   public void println(int i) {    writer.println(i);   }  } }
0	public class MAIN { public static void main(String args[]) {  Scanner sn=new Scanner(System.in);  int n,n1,n2,n3;  int arr[]={0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811,514229,832040,1346269,2178309,3524578,5702887,9227465,14930352,24157817,39088169,63245986,102334155,165580141,267914296,433494437,701408733,1134903170};  n=sn.nextInt();   if(n==2)  {  n1=n2=1;  n3=0;  }  else if(n==1)  {  n3=n2=0;  n1=1;  }  else if(n==0)  {  n1=n2=n3=0;  }  else if(n==3)  {  n1=n2=n3=1;  }  else  {  int index=bsearch(arr,0,arr.length-1,n);  n1=arr[index-1];  n2=arr[index-3];  n3=arr[index-4];  }  System.out.println(n3+" "+n2+" "+n1);  }  static int bsearch(int arr[],int l,int h,int n) {  if(l>h)  return -1;  int mid=(l+h)/2;  if(n==arr[mid])  return mid;  else if(n>arr[mid])  return(bsearch(arr,mid+1,h,n));  else  return(bsearch(arr,l,mid-1,n)); } }
2	public class Dummy { private static long mod = 1000000007; public static void main(String[] args) throws IOException {  BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  String[] strs = reader.readLine().split(" ");  long x = Long.parseLong(strs[0]);  long k = Long.parseLong(strs[1]);  long twoPK = modPow(2, k);  long twoPK_1 = (twoPK * 2) % mod;  long res = ((twoPK_1 * (x % mod)) % mod - (twoPK - 1) + mod) % mod;  System.out.println(x == 0? x: res); }  private static long modPow(long base, long pow) {  long res = 1;  while(pow != 0) {  if((pow & 1) != 0) {   res = (res % mod * base % mod)%mod;  }  base = (base % mod * base % mod) % mod;  pow >>= 1;  }  return res; } }
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);   }  } }
5	public class Main {   Scanner in;  PrintWriter out;   static class House implements Comparable <House>{   int len;   int pos;     House(Scanner in){    pos = in.nextInt() * 2;    len = in.nextInt() * 2;     }     public int compareTo(House arg0) {    return this.pos-arg0.pos;   }    }     void solve(){   int n = in.nextInt();   int size = in.nextInt();   House []h = new House[n];   for (int i = 0; i < h.length; i++){    h[i] = new House(in);   }   Arrays.sort(h);   int ans = 2;   for (int i = 0; i < h.length - 1; i++){    int next = i + 1;    int sz = h[next].pos - h[i].pos - (h[next].len + h[i].len) / 2;    if (sz == size * 2) {     ans ++;    } else if (sz > size * 2) {     ans += 2;    }   }   out.println(ans);  }   public void run(){   in = new Scanner(System.in);   out = new PrintWriter(System.out);     try {    solve();   } finally {    out.close();   }  }   void asserT(boolean e){   if (!e){    throw new Error();   }  }  public static void main(String[] args) {   new Main().run();  } }
1	public class _1004_A {  public static void main(String[] args) throws IOException {  int N = readInt(), D = readInt(); long arr[] = new long[N+2]; arr[0] = -3000000000L; arr[N+1] = -arr[0];  for(int i = 1; i<=N; i++) arr[i] = readInt();  int cnt = 1; if(Math.abs(arr[2]-(arr[1] + D)) >= D) cnt++; for(int i = 2; i<=N; i++) {  if(Math.abs(arr[i-1]-(arr[i] - D)) > D) cnt++;  if(Math.abs(arr[i+1]-(arr[i] + D)) >= D) cnt++;  }  println(cnt); exit(); }  final private static int BUFFER_SIZE = 1 << 16; private static DataInputStream din = new DataInputStream(System.in); private static byte[] buffer = new byte[BUFFER_SIZE]; private static int bufferPointer = 0, bytesRead = 0; static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  public static 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 static String read() throws IOException {  byte[] ret = new byte[1024];  int idx = 0;  byte c = Read();  while (c <= ' ') {  c = Read();  }  do {  ret[idx++] = c;  c = Read();  } while (c != -1 && c != ' ' && c != '\n' && c != '\r');  return new String(ret, 0, idx); }  public static int readInt() 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 static long readLong() 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 static double readDouble() 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 static void fillBuffer() throws IOException {  bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);  if (bytesRead == -1)  buffer[0] = -1; }  private static byte Read() throws IOException {  if (bufferPointer == bytesRead)  fillBuffer();  return buffer[bufferPointer++]; }  static void print(Object o) {  pr.print(o); }  static void println(Object o) {  pr.println(o); }  static void flush() {  pr.flush(); }  static void println() {  pr.println(); }  static void exit() throws IOException {  din.close();  pr.close();  System.exit(0); } }
0	public class HexTheorem {  public static void main(String[] args) throws NumberFormatException, IOException {   BufferedReader read = new BufferedReader(new InputStreamReader(System.in));   int x = Integer.parseInt(read.readLine());   System.out.println("0 0 "+x);  } }
6	public class Main{  static long N = 100;  static long CNT = 62;  static long INF = 1 << 62;   static long parsenum(long j, long l) {   String k = "";   long cur = 0;   for (int i = (int) j; i <= l; ++i) {    cur *= 10;    cur += k.charAt(i) - '0';   }   return cur;  }  static long gcd(long a, long b) {   if (b == 0) {    return a;   } else {    return gcd(b, a % b);   }  }  static boolean pri(int k) {   if (k == 1) return false;   for (int i = 2; i * i <= k; i++) {    if (k % i == 0) return false;   }   return true;  }  static int[] calcz(String s) {   int l = 0;   int r = 0;   int n = s.length();   int z[] = new int[n];   for (int i = 1; i < n; i++) {    if (i <= r) {     z[i] = Math.min(z[i - l], r - i + 1);    }    while (i + z[i] < n && s.charAt(z[i]) == s.charAt(i + z[i])) z[i]++;    if (i + z[i] - 1 > r) {     l = i;     r = i + z[i] - 1;    }   }   return z;  }  static int[] calcpref(String s) {   int p[] = new int[s.length() + 1];   int n = s.length();   p[0] = 0;   for (int i = 2; i <= n; i++) {    p[i] = p[i - 1];    while (p[i] > 0 && s.charAt(p[i]) != s.charAt(i - 1)) p[i] = p[p[i]];    if (s.charAt(p[i]) == s.charAt(i - 1)) p[i]++;   }   return p;  }  static long MOD = 1000000007;  static long binpow (long a, long n)  {   if (n == 0)    return 1;   if (n % 2 == 1)    return binpow (a % MOD, (n-1) % MOD ) * a % MOD;   else {    long b = binpow(a % MOD, n/2 % MOD) % MOD;    return (b * b) % MOD;   }  } static int maxnum=105; static int a[][] = new int[maxnum][maxnum]; static boolean used[] = new boolean[maxnum];  static int curr , cnt ,n ,m;  static void dfs(int i)  {   int j;   boolean flag;   if(i > n)   {    cnt = curr;    return ;   }   flag=true;   for(j = 1 ; j < i; j++)   {    if (used[j] && a[j][i] == 0)    {     flag = false;     break;    }   }   if(flag)   {    curr++;    used[i]=true;    dfs(i+1);    curr--;   }   if(curr + n - i > cnt)   {    used[i]=false;    dfs(i+1);   }  }   public static void main(String[] args) throws Exception  {    Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter((System.out));   n = in.nextInt();   m = in.nextInt();     for(int i = 1 ; i <= n ; i++)    {     for (int j = 1; j <= n; j++)     {      a[i][j] = in.nextInt();     }    }    dfs(1);    out.printf( "%.10f", (double) m * m * (cnt-1) / (2 * cnt ));    out.println();   out.close();   return;  } }
4	public class Main {    public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   String s = sc.next(),c;   int n = s.length(),a,b;     for(int sz = n ; sz >= 1 ; sz--) {    for(int i = 0 ; i+sz <= n ; i++) {     c = s.substring(i, i+sz);     a = s.indexOf(c,0);     if(a < 0) continue;     b = s.indexOf(c,a+1);     if(b < 0) continue;     System.out.println(sz);     return;        }   }   System.out.println(0);  } }
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();   }  } }
1	public class CodehorsesT_shirts {  public static void main(String[] args) throws Exception {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(reader.readLine());   HashMap<String, Integer> map = new HashMap<String, Integer>();   String input;   for (int i = 0; i < n; i++) {    input = reader.readLine();    if (map.containsKey(input)) {     map.put(input, map.get(input) + 1);    } else {     map.put(input, 1);    }   }   int change = 0;   for (int i = 0; i < n; i++) {    input = reader.readLine();    if (map.containsKey(input)) {     map.put(input, map.get(input) - 1);    } else {     map.put(input, -1);    }   }   for (int x : map.values()) {    change += Math.abs(x);   }   System.out.println(change/2);  } }
1	public class _G14 {  public static void main(String[] args) {   MyScanner sc = new MyScanner();   PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));   int t = sc.nextInt();   Set<Long> square = new HashSet<>();   for (long i = 1; i <= (long) 1e5; i++) square.add(i * i);   while (t-- > 0) {    long n = sc.nextLong();    if ((n % 2 ==0 && square.contains(n / 2))|| (n % 4 == 0 &&square.contains(n / 4))) {     out.println("YES");    } else {     out.println("NO");    }   }   out.close();  }   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;   }   } }
3	public class D {  static class FastWriter {   private final BufferedWriter bw;   public FastWriter() {    this.bw = new BufferedWriter(new OutputStreamWriter(System.out));   }   public void print(Object object) throws IOException {    bw.append("" + object);   }   public void println(Object object) throws IOException {    print(object);    bw.append("\n");   }   public void close() throws IOException {    bw.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;   }   BigInteger nextBigInteger() {    try {     return new BigInteger(nextLine());    } catch (NumberFormatException e) {     throw new InputMismatchException();    }   }  }  public static void main(String[] args) throws IOException {   FastReader fr = new FastReader();   FastWriter fw = new FastWriter();   int n = fr.nextInt();   int m = fr.nextInt();   for (int r = 0; r < n / 2; r++) {    for (int c = 0; c < m; c++) {     fw.println((r + 1) + " " + (c + 1));     fw.println((n - r) + " " + (m - c));    }   }   if (n % 2 != 0) {    int r = n / 2;    for (int c = 0; c < m / 2; c++) {     fw.println((r + 1) + " " + (c + 1));     fw.println((r + 1) + " " + (m - c));    }    if (m % 2 != 0) fw.println((r + 1) + " " + (m / 2 + 1));   }   fw.close();  } }
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);   F2SameSumBlocksHard solver = new F2SameSumBlocksHard();   solver.solve(1, in, out);   out.close();  }  static class F2SameSumBlocksHard {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    long[] a = in.nextLongArray(n);    long[] p = in.calculatePrefixSum(a);    Map<Long, Integer> map = new HashMap<>();    for (int i = 0; i < n; i++) {     long sum = 0;     for (int j = i; j < n; j++) {      sum += a[j];      map.merge(sum, 1, (x, y) -> x + y);     }    }     List<sum> sums = new ArrayList<>();    for (long sum : map.keySet()) {     sums.add(new sum(sum, map.get(sum)));    }    sums.sort((x, y) -> y.c - x.c);    int ans = -1;    int[] fca = null;    long mxsum = -1;    for (int i = 0; i < sums.size(); i++) {     sum cs = sums.get(i);     long sum = cs.sum;     long c = cs.c;     if (c < ans) {      continue;     }     Map<Long, Integer> lm = new HashMap<>();     int[] ca = new int[n];     lm.put(0l, -1);     for (int j = 0; j < n; j++) {      long val = p[j];      if (j > 0) {       ca[j] = ca[j - 1];      }      long req = val - sum;      if (lm.containsKey(req)) {       int li = lm.get(req);       if (li == -1)        ca[j] = Math.max(1, ca[j]);       else        ca[j] = Math.max(1 + ca[li], ca[j]);      }      lm.put(val, j);     }     if (ca[n - 1] > ans) {      ans = ca[n - 1];      mxsum = sum;      fca = ca;     }    }    List<Integer> al = new ArrayList<>();    long sum = 0;    for (int i = n - 1; i >= 0; i--) {     if (i > 0 && fca[i] != fca[i - 1]) {      sum = 0;      al.add(i + 1);      do {       sum += a[i];       i--;      } while (i >= 0 && sum != mxsum);      i++;      al.add(i + 1);     } else if (i == 0) {      if (a[i] == mxsum) {       al.add(i + 1);       al.add(i + 1);      }     }    }    out.println(al.size() / 2);    for (int i = al.size() - 1; i >= 0; i -= 2) {     out.println(al.get(i) + " " + al.get(i - 1));    }   }   class sum {    long sum;    int c;    public sum(long sum, int c) {     this.sum = sum;     this.c = c;    }   }  }  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 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 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 boolean isSpaceChar(int c) {    if (filter != null) {     return filter.isSpaceChar(c);    }    return isWhitespace(c);   }   public long[] nextLongArray(int n) {    long[] array = new long[n];    for (int i = 0; i < n; ++i) array[i] = nextLong();    return array;   }   public long[] calculatePrefixSum(long[] a) {    int n = a.length;    long[] prefixSum = new long[n];    prefixSum[0] = a[0];    for (int i = 1; i < n; i++) {     prefixSum[i] = prefixSum[i - 1] + a[i];    }    return prefixSum;   }   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 println(Object... objects) {    print(objects);    writer.println();   }   public void close() {    writer.close();   }   public void println(int i) {    writer.println(i);   }  } }
3	public class Problem_A {  public static void main(String[] args) {  MyScanner scan = new MyScanner();  int n = scan.nextInt();  int[] elements = new int[n];  for (int i = 0; i < n; i++)  elements[i] = scan.nextInt();   int x = 0;   Arrays.sort(elements);  while(n > 0) {  x++;  int[] temp = new int[n];  int j = 0;  int size = n;  int min = elements[0];  n--;  for (int i = 1; i < size; i++) {   if (elements[i]%min == 0) {   n--;   }   else {   temp[j++] = elements[i];   }  }    elements = temp;  }   out.println(x);  out.close(); }  public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static class MyScanner {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st;  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  {  public static void main(String args[]) throws IOException   {   Scanner c=new Scanner(System.in);   PrintWriter out=new PrintWriter(System.out);   long N=c.nextLong()-1;   long K=c.nextLong()-1;   long tot=(K*(K+1))/2;     if(N>tot)    {    System.out.println(-1);    return;    }   long lo=1;   long hi=K;   while(hi-lo>=10)    {    long mid=(hi+lo)/2;       long sum=(mid*(mid-1))/2;    long left=mid*K-sum;    if(left>=N)     hi=mid+1;    else     lo=mid-1;    }   for(int num=(int)lo-1000;num<lo+1000;num++)    {    if(num>=0)     {     long sum=((long)num*(num-1))/2;     long left=(long)num*K-sum;     if(left>=N)      {      System.out.println(num);      return;      }     }    }   out.close();   }  } 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 isWhitespace(c);   }  public static boolean isWhitespace(int c)   {   return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;   }  public char readCharacter()   {   int c=read();   while (isSpaceChar(c))    c=read();   return (char) c;   }  public interface SpaceCharFilter   {   public boolean isSpaceChar(int ch);   }  }
1	public class Round42CC {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = Integer.parseInt(sc.nextLine());   String s = sc.nextLine();   int k = 0;   for (int i = 0; i < n; i++) {    if (s.charAt(i) == 'H') {     k++;    }   }   s = s + s.substring(0, k);   String ss = "";   int max = 0;   for (int i = 0; i < s.length() - k; i++) {    ss = s.substring(i, i + k);    int count = 0;    for (int j = 0; j < ss.length(); j++) {     if (ss.charAt(j) == 'H') {      count++;     }    }    if (count > max) {     max = count;    }   }     System.out.println(k - max);  } }
5	public class A {  public static void main(String[] args) {   new A().solve();  }   public void solve() {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int t = sc.nextInt();   float[] left = new float[n];   float[] right = new float[n];   for (int i=0; i<n; ++i) {    int c = sc.nextInt();    int w = sc.nextInt();    left[i] = (float) (c - (float) w * 1.0 / 2);    right[i] = (float) (c + (float) w * 1.0 / 2);   }   for (int i=0; i<n; ++i)    for (int j=i+1; j<n; ++j)     if (left[j] < left[i]) {      float tmp = left[i];      left[i] = left[j];      left[j] = tmp;      tmp = right[i];      right[i] = right[j];      right[j] = tmp;     }   int res = 2;   for (int i=1; i<n; ++i) {    float dis = left[i] - right[i-1];    if (Math.abs(dis - t) < 0.000001)     res ++;    if ((dis - t) > 0.000001)     res += 2;   }   System.out.println(res);  } }
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 A25 {   public void run() {  try {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(in.readLine().trim());  String[] toks = in.readLine().trim().split("[ ]+");  int counter = 0;  boolean even = true;  int e = -1, o = -1;  int ec = 0, oc = 0;  for (int i = 0; i < toks.length; i++) {   int x = Integer.parseInt(toks[i]);   if (x % 2 == 0) {   ec ++;   if (e == -1) {    e = i+1;   }   }   else {   oc ++;   if (o == -1) {    o = i+1;   }   }  }  if (ec == 1) {   System.out.println(e);  }  else if (oc == 1) {   System.out.println(o);  }  } catch (Exception e) {  e.printStackTrace();  } }   public static void main(String[] args) {  new A25().run(); } }
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(); } }
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);  }   }
2	public class TaskB {  void run() {   FastReader in = new FastReader(System.in);   PrintWriter out = new PrintWriter(System.out);    long n = in.nextLong();   long k = in.nextLong();   long a = 1;   long b = -(2 * n + 3);   long c = n * n + n - 2 * k;   long d = b * b - 4 * a * c;   long ans1 = (-b + (long) Math.sqrt(d)) / 2;   long ans2 = (-b - (long) Math.sqrt(d)) / 2;   if (ans1 >= 0 && ans1 <= n) {    out.println(ans1);   } else {    out.println(ans2);   }    out.close();  }  class FastReader {   BufferedReader br;   StringTokenizer st;   FastReader(InputStream is) {    br = new BufferedReader(new InputStreamReader(is));   }   Integer 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 s = "";    try {     s = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return s;   }  }   public static void main(String[] args) {   new TaskB().run();  } }
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; } }
5	public class Main {  static Long[] a = new Long[205000];  static Long[] postfix=new Long[205000];  static HashMap<Long,Long> check=new HashMap<Long,Long>();  public static void main(String args[]) {   Scanner cin = new Scanner(System.in);   long k, j, p,sum,equal,bigone,lessone,cnt;   BigInteger ans;   int i,n;   while (cin.hasNext()) {    n=cin.nextInt();    check.clear();    for(i=1;i<=n;i++)    {     a[i]=cin.nextLong();    }    postfix[n+1]=0L;    for(i=n;i>=1;i--) {     postfix[i] = postfix[i + 1] + a[i];     if (check.containsKey(a[i]) == true) {      Long v = check.get(a[i]);      v += 1;      check.put(a[i], v);     }     else      check.put(a[i],1L);    }    ans=BigInteger.ZERO;    for(i=1;i<n;i++){     Long v=check.get(a[i]);     v--;     check.put(a[i],v);     equal=check.get(a[i]);     bigone=0L;     lessone=0L;     if(check.containsKey(a[i]+1L)==true)     bigone=check.get(a[i]+1L);     if(check.containsKey(a[i]-1L)==true)     lessone=check.get(a[i]-1L);     sum=postfix[i]-bigone*(a[i]+1L)-lessone*(a[i]-1L)-equal*a[i]-a[i];     cnt=n-i-bigone-lessone-equal;     ans=ans.add(BigInteger.valueOf(a[i]*cnt).subtract(BigInteger.valueOf(sum)));    }    System.out.println(ans.multiply(BigInteger.valueOf(-1)));   }  } }
1	public class B { InputStream is; FastWriter out; String INPUT = "";  void solve() {  for(int T = ni();T > 0;T--)go(); }  void go() {  int n = ni();  if(n % 2 == 0){  int u = (int)Math.sqrt(n/2);  if(u*u == n/2){   out.println("YES");   return;  }  }  if(n % 4 == 0){  int u = (int)Math.sqrt(n/4);  if(u*u == n/4){   out.println("YES");   return;  }  }  out.println("NO"); }  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 B().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)); } }
1	public class A {  public static void main(String args[])  {   Scanner scan = new Scanner(System.in);   int n = scan.nextInt();      int odd = -1;   int even = -1;   int oc = 0;   int ec = 0;     for(int i=0;i < n;i++)   {    if(scan.nextInt() % 2 == 0)    {     ec++;     even = i+1;    }    else    {     oc++;     odd = i+1;    }   }     if(ec == 1)    System.out.println(even);   else    System.out.println(odd);  } }
3	public class Tt {  public static void main(String[] args) throws IOException {  FastScanner fs=new FastScanner(System.in);  int j = fs.nextInt();  ArrayList<Integer> a =new ArrayList<Integer>();  for(int i=0;i<j;i++) {  a.add(fs.nextInt());  }  Collections.sort(a);  Collections.reverse(a);  int c=0;  while(a.size()!=0) {  int f=a.get(a.size()-1);  c+=1;  for(int q=a.size()-1;q>-1;q--)  if(a.get(q)%f==0) {   a.remove(q);  }  }  System.out.println(c);  } static class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner(InputStream i){   br = new BufferedReader(new InputStreamReader(i));   st = new StringTokenizer("");  }  public String next() throws IOException{   if(st.hasMoreTokens()) return st.nextToken();   else st = new StringTokenizer(br.readLine());   return next();  }  public long nextLong() throws IOException{ return Long.parseLong(next()); }  public int nextInt() throws IOException { return Integer.parseInt(next()); }  public double nextDouble() throws IOException { return Double.parseDouble(next()); }  public String nextLine() throws IOException {   if(!st.hasMoreTokens())     return br.readLine();   String ret = st.nextToken();   while(st.hasMoreTokens())     ret += " " + st.nextToken();   return ret;  } }}
3	public class Main {  public static void main(String args[]) {   InputReader in = new InputReader(System.in);   PrintWriter out = new PrintWriter(System.out);   IntStream.range(0, 1).forEach(tc -> {    new Solver(tc, in, out).solve();    out.flush();   });   out.close();  } } class InputReader {  BufferedReader reader;  StringTokenizer tokenizer;  InputReader(InputStream in) {   reader = new BufferedReader(new InputStreamReader(in));  }  String next() {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    try {     tokenizer = new StringTokenizer(reader.readLine());    } catch (Exception e) {     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }  int nextInt() {   return Integer.valueOf(next());  }  double nextDouble() {   return Double.valueOf(next());  }  String nextLine() {   try {    return reader.readLine();   } catch (Exception e) {    throw new RuntimeException(e);   }  } } class Solver {  private InputReader in;  private PrintWriter out;  private Integer tc;  Solver(Integer tc, InputReader in, PrintWriter out) {   this.in = in;   this.out = out;   this.tc = tc;  }  void solve() {   Integer n = in.nextInt();   TreeSet<Integer> list = IntStream.range(0, n)     .map(i -> in.nextInt())     .boxed()     .collect(Collectors.toCollection(TreeSet::new));   Integer answer = 0;   while (!list.isEmpty()) {    Integer x = list.pollFirst();    list = list.stream().filter(y -> y % x != 0).collect(Collectors.toCollection(TreeSet::new));    answer++;   }   out.println(answer);  } }
1	public class Test5 {  public static void main(String[] z){   StreamTokenizer st = new StreamTokenizer(new InputStreamReader(System.in));   PrintWriter pw = new PrintWriter(System.out);   Scanner s = new Scanner(System.in);   int a = s.nextInt(), o=0;   String i = "";   ArrayList<String> l1 = new ArrayList<>(), l2 = new ArrayList<>();   for(int q=0; q<a; q++){    l1.add(s.next());   }   for(int q=0; q<a; q++){    i = s.next();    if(l1.contains(i)) l1.remove(i);    else l2.add(i);   }   Collections.sort(l1);   Collections.sort(l2);   for(int q=0; q<l1.size(); q++){    if(l1.get(q).charAt(l1.get(q).length()-1)!=l2.get(q).charAt(l2.get(q).length()-1)) o++;   }   System.out.println(o);   pw.flush();  }  static class PyraSort {   private static int heapSize;   public static void sort(int[] a) {    buildHeap(a);    while (heapSize > 1) {     swap(a, 0, heapSize - 1);     heapSize--;     heapify(a, 0);    }   }   private static void buildHeap(int[] a) {    heapSize = a.length;    for (int i = a.length / 2; i >= 0; i--) {     heapify(a, i);    }   }   private static void heapify(int[] a, int i) {    int l = 2 * i + 2;    int r = 2 * i + 1;    int largest = i;    if (l < heapSize && a[i] < a[l]) {     largest = l;    }    if (r < heapSize && a[largest] < a[r]) {     largest = r;    }    if (i != largest) {     swap(a, i, largest);     heapify(a, largest);    }   }   private static void swap(int[] a, int i, int j) {    a[i] ^= a[j] ^= a[i];    a[j] ^= a[i];   }  } }
0	public class Sub { public static void main(String[] args) {  Scanner scan=new Scanner(System.in);  int noOfPairs=scan.nextInt();  while(noOfPairs-->0)  {  int x=scan.nextInt();  int y=scan.nextInt();  int res=0;  while(x!=0&&y!=0)  {   if(x>y)    {   res+=x/y;   x=x%y;   }   else    {   res+=y/x;   y=y%x;   }  }  System.out.println(res);  }  scan.close(); } }
2	public class con67 {     public static void main(String[] args) throws IOException  {  long x=l(); long k=l(); if(x!=0) { long f=x%1000000007; long s=(f*power(2,k+1,1000000007))%1000000007;  long e= (power(2,k,1000000007)-1)%1000000007;  long ans=(s-e+1000000007)%1000000007;  out.println(ans);  } else { out.println(0); } out.close(); }   static long power(long x, long y, long p)  {     long res = 1;            x = x % p;     while (y > 0)   {           if((y & 1)==1)     res = (res * x) % p;             y = y >> 1;    x = (x * x) % p;   }   return res;  }   static InputReader in = new InputReader(System.in);  static OutputWriter out = new OutputWriter(System.out);    static int i()  {   return in.readInt();  }    static long l()  {   return in.readLong();  }    static double d()  {   return in.readDouble();  }    static String s()  {   return in.readString();  }    static void Iarr( int[] array, int no )  {   for( int i=0 ; i<no ; i++ )   {   array[i] = i();   }  }    static void Larr( long[] array, int no )  {   for( int i=0 ; i<no ; i++ )   {   array[i] = l();   }  }    static void Darr( double[] array, int no )  {   for( int i=0 ; i<no ; i++ )   {   array[i] = d();   }  }    static void Sarr( String[] array, int no )  {   for( int i=0 ; i<no ; i++ )   {   array[i] = s();   }  }    private 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 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();    StringBuilder res = new StringBuilder();    do    {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   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 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 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);   }  }    private 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 CF_1515_B{   void pre() throws Exception{}  void solve(int TC) throws Exception{   long N = nl();   if(N%2 == 1){    pn("NO");    return;   }   N /= 2;   boolean yes = ps(N);   if(N%2 == 0)yes |= ps(N/2);   pn(yes?"YES":"NO");  }  boolean ps(long N){   long T = (long)Math.sqrt(N);   while(T*T > N)T--;   while (T*T < N)T++;   return (T*T == N);  }   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_1515_B().run();}catch(Exception e){e.printStackTrace();System.exit(1);}}}, "1", 1 << 28).start();   else new CF_1515_B().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;   }  } }
1	public class Q3a {  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  in.nextLine();  String s = in.nextLine();  HashMap<Integer, Integer> seen = new HashMap<>();  for (int i = 0; i < n; i++) {  Character c = s.charAt(i);  int ci = (int) c.charValue();    seen.put(ci, seen.get(ci) == null ? 1 : seen.get(ci) + 1);  }  HashMap<Integer, Integer> sub = new HashMap<Integer, Integer>();  int start = 0;  int min = 10000000;  for (int i = 0; i < n; i++) {  Character c = s.charAt(i);  int ci = (int) c.charValue();   sub.put(ci, sub.get(ci) == null ? 1 : sub.get(ci) + 1);    while(sub.size() == seen.size()) {   min = Math.min(min, i - start + 1);   c = s.charAt(start);   start ++;   ci = (int) c.charValue();   if( sub.get(ci) == 1)    sub.remove(ci);   else   sub.put(ci, sub.get(ci) - 1);  }  }  System.out.print(min);    in.close(); } }
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));    }   }  } }
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(),i,sum=0;   int a[]=new int[n];   for(i=0;i<n;i++) {    a[i]=in.nextInt();    sum+=a[i];   }   Arrays.sort(a);   int s=0,c=0;   for(i=n-1;i>=0;i--)   {    if(s>sum)     break;    s+=a[i];    sum-=a[i];          c++;   }   out.println(c); } }
3	public class Main { public static void main(String[] args) throws IOException {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  PrintWriter out = new PrintWriter(outputStream);  InputReader in = new InputReader(inputStream);       Task t = new Task();  t.solve(in, out);  out.close();   }   static class Task {  public void solve(InputReader in, PrintWriter out) throws IOException {    int n = in.nextInt();  int arr[] = in.readIntArray(n);  int v[][] = new int[n][n];  int c=0;  HashMap<Integer,Integer> mp = new HashMap<Integer,Integer>();  for(int i=0;i<n;i++) {   for(int j=i;j<n;j++) {   v[i][j] = arr[j];   if(j>i) v[i][j] += v[i][j-1];    if(!mp.containsKey(v[i][j])) mp.put(v[i][j], c++);   }  }  ArrayList<seg>[] all = new ArrayList[c];  for(int i=0;i<c;i++) all[i] = new ArrayList<seg>();  for(int i=0;i<n;i++) {   for(int j=i;j<n;j++) {   int idx = mp.get(v[i][j]);   all[idx].add(new seg(i,j,v[i][j]));   }  }  for(int i=0;i<c;i++) Collections.sort(all[i]);  int max = Integer.MIN_VALUE;  int val = -1;  for(int i=0;i<c;i++) {   if(all[i].size()==0) continue;   int num=1;   int p=0;int q=p+1;   while(q<all[i].size()) {   if(all[i].get(q).s>all[i].get(p).e) {    p=q;    num++;   }   q++;   }   if(num>max) {   max=num;   val = i;   }  }  out.println(max);  StringBuilder sb = new StringBuilder();  int p=0;int q=p+1;   sb.append(all[val].get(0).toString());  while(q<all[val].size()) {   if(all[val].get(q).s>all[val].get(p).e) {   sb.append(all[val].get(q).toString());   p=q;   }   q++;  }  out.println(sb.toString());  }  public class seg implements Comparable<seg>{  int s; int e; int val;  public seg(int a, int b, int c) {   s=a;e=b;val=c;  }  @Override  public int compareTo(seg t) {   if(this.e==t.e) return this.s-t.s;     return this.e-t.e;  }  public String toString() {   return (s+1)+" "+(e+1)+"\n";  }  }  public int GCD(int a, int b) {   if (b==0) return a;   return GCD(b,a%b);  } }    static class ArrayUtils {   static final long seed = System.nanoTime();   static final Random rand = new Random(seed);   public static void sort(int[] a) {    shuffle(a);    Arrays.sort(a);   }   public static void shuffle(int[] a) {    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;    }   }  }  static class BIT{  int arr[];  int n;  public BIT(int a) {  n=a;  arr = new int[n];  }  int sum(int p) {  int s=0;  while(p>0) {   s+=arr[p];   p-=p&(-p);  }  return s;  }  void add(int p, int v) {  while(p<n) {   arr[p]+=v;   p+=p&(-p);  }  } } static class DSU{  int[] arr;  int[] sz;  public DSU(int n) {  arr = new int[n];  sz = new int[n];  for(int i=0;i<n;i++) arr[i] = i;  Arrays.fill(sz, 1);  }  public int find(int a) {  if(arr[a]!=a) arr[a] = find(arr[a]);  return arr[a];  }  public void union(int a, int b) {  int x = find(a);  int y = find(b);  if(x==y) return;  arr[x] = y;  sz[y] += sz[x];  }  public int size(int x) {  return sz[find(x)];  } }  static class MinHeap<Key> implements Iterable<Key> {  private int maxN;  private int n;  private int[] pq;  private int[] qp;  private Key[] keys;  private Comparator<Key> comparator;   public MinHeap(int capacity){  if (capacity < 0) throw new IllegalArgumentException();  this.maxN = capacity;  n=0;  pq = new int[maxN+1];  qp = new int[maxN+1];  keys = (Key[]) new Object[capacity+1];  Arrays.fill(qp, -1);  }   public MinHeap(int capacity, Comparator<Key> c){  if (capacity < 0) throw new IllegalArgumentException();  this.maxN = capacity;  n=0;  pq = new int[maxN+1];  qp = new int[maxN+1];  keys = (Key[]) new Object[capacity+1];  Arrays.fill(qp, -1);  comparator = c;  }   public boolean isEmpty() { return n==0; }  public int size()  { return n; }  public boolean contains(int i) {   if (i < 0 || i >= maxN) throw new IllegalArgumentException();   return qp[i] != -1;  }  public int peekIdx() {   if (n == 0) throw new NoSuchElementException("Priority queue underflow");   return pq[1];   }  public Key peek(){  if(isEmpty()) throw new NoSuchElementException("Priority queue underflow");  return keys[pq[1]];  }  public int poll(){  if(isEmpty()) throw new NoSuchElementException("Priority queue underflow");  int min = pq[1];  exch(1,n--);  down(1);  assert min==pq[n+1];  qp[min] = -1;  keys[min] = null;   pq[n+1] = -1;  return min;  }  public void update(int i, Key key) {   if (i < 0 || i >= maxN) throw new IllegalArgumentException();   if (!contains(i)) {    this.add(i, key);   }else {    keys[i] = key;    up(qp[i]);    down(qp[i]);   }  }  private void add(int i, Key x){   if (i < 0 || i >= maxN) throw new IllegalArgumentException();   if (contains(i)) throw new IllegalArgumentException("index is already in the priority queue");   n++;   qp[i] = n;   pq[n] = i;   keys[i] = x;   up(n);  }  private void up(int k){  while(k>1&&less(k,k/2)){   exch(k,k/2);   k/=2;  }  }  private void down(int k){  while(2*k<=n){   int j=2*k;   if(j<n&&less(j+1,j)) j++;   if(less(k,j)) break;   exch(k,j);   k=j;  }  }   public boolean less(int i, int j){   if (comparator == null) {    return ((Comparable<Key>) keys[pq[i]]).compareTo(keys[pq[j]]) < 0;   }   else {    return comparator.compare(keys[pq[i]], keys[pq[j]]) < 0;   }  }  public void exch(int i, int j){   int swap = pq[i];   pq[i] = pq[j];   pq[j] = swap;   qp[pq[i]] = i;   qp[pq[j]] = j;  }  @Override  public Iterator<Key> iterator() {    return null;  } }   private static class InputReader  {   private InputStream stream;   private byte[] buf = new byte[1024];   private int zcurChar;   private int znumChars;   private SpaceCharFilter filter;   public InputReader(InputStream stream)   {    this.stream = stream;   }   public int read()   {    if (znumChars == -1)     throw new InputMismatchException();    if (zcurChar >= znumChars)    {    zcurChar = 0;     try     {      znumChars = stream.read(buf);     } catch (IOException e)     {      throw new InputMismatchException();     }     if (znumChars <= 0)      return -1;    }    return buf[zcurChar++];   }   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 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 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 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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public String next()   {    return nextString();   }   public interface SpaceCharFilter   {    public boolean isSpaceChar(int ch);   }   public int[] readIntArray(int n) {    int[] ret = new int[n];    for (int i = 0; i < n; i++) {     ret[i] = nextInt();    }    return ret;   }    }   static class Dumper {  static void print_int_arr(int[] arr) {  for (int i = 0; i < arr.length; i++) {   System.out.print(arr[i] + " ");  }  System.out.println();  System.out.println("---------------------");  }  static void print_char_arr(char[] arr) {  for (int i = 0; i < arr.length; i++) {   System.out.print(arr[i] + " ");  }  System.out.println();  System.out.println("---------------------");  }  static void print_double_arr(double[] arr) {  for (int i = 0; i < arr.length; i++) {   System.out.print(arr[i] + " ");  }  System.out.println();  System.out.println("---------------------");  }  static void print_2d_arr(int[][] arr, int x, int y) {  for (int i = 0; i < x; i++) {   for (int j = 0; j < y; j++) {   System.out.print(arr[i][j] + " ");   }   System.out.println();  }  System.out.println();  System.out.println("---------------------");  }  static void print_2d_arr(boolean[][] arr, int x, int y) {  for (int i = 0; i < x; i++) {   for (int j = 0; j < y; j++) {   System.out.print(arr[i][j] + " ");   }   System.out.println();  }  System.out.println();  System.out.println("---------------------");  }  static void print(Object o) {  System.out.println(o.toString());  }  static void getc() {  System.out.println("here");  } } }
1	public class C46 {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int number = in.nextInt();   String s = in.next();   int cH = 0;   int n = s.length();   for (int i = 0 ; i < n ; i++)    if (s.charAt(i) == 'H') cH++;   String ss = "";   for (int i = 0 ; i < cH ; i++)    ss += "H";   for (int i = 0 ; i < n - cH ; i++)    ss += "T";   int res = Integer.MAX_VALUE;   for (int i = 0 ; i < n ; i++) {    int cur = countDifference(ss , s);    res = Math.min(res , cur);    ss = ss.substring(1) + ss.charAt(0);   }   System.out.println(res);  }  public static int countDifference(String ss, String s) {   int cnt = 0;   for (int i = 0 ; i < ss.length() ; i++)    if (ss.charAt(i) != s.charAt(i)) cnt++;   return cnt / 2;  } }
1	public class A {  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   int n = sc.nextInt();   int d = sc.nextInt();   int[] arr = new int[n];   for (int i = 0; i < arr.length; i++) {    arr[i] = sc.nextInt();   }   HashSet<Integer> set = new HashSet<>();   for (int i = 0; i < arr.length; i++) {    set.add(arr[i]+d);    set.add(arr[i]-d);   }   int cnt = 0;   for (int loc: set) {    int minDist = (int)2e9;    for (int i = 0; i < n; i++) {     minDist = Math.min(minDist, Math.abs(arr[i]-loc));    }    if(minDist == d)     cnt++;   }   pw.println(cnt);   pw.flush();   pw.close();  }   static int[][] packD(int n, int[] from, int[] to) {   int[][] g = new int[n][];   int[] p = new int[n];   for (int f : from) if(f != -1) p[f]++;   for (int i = 0; i < n; i++) g[i] = new int[p[i]];   for (int i = 0; i < from.length; i++) if(from[i] != -1) {g[from[i]][--p[from[i]]] = to[i];}   return g;  }  static 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;   }  }  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 boolean ready() throws IOException {return br.ready();}  } }
6	public class Main implements Runnable { private void solution() throws IOException {  int n = in.nextInt();  int m = in.nextInt();  boolean[][] adj = new boolean[n][n];  long res = 0;  for (int i = 0; i < m; ++i) {  int x = in.nextInt();  int y = in.nextInt();  adj[x - 1][y - 1] = true;  adj[y - 1][x - 1] = true;  }  final long[][] dp = new long[1 << n][n];  for (int i = 0; i < n; ++i) {  int Limit = 1 << (n - i);  int nn = n - i;  for (int mask = 0; mask < Limit; ++mask) {   for (int j = 0; j < nn; ++j) {   dp[mask][j] = 0;   }  }  dp[0][0] = 1;  for (int mask = 0; mask < Limit; ++mask) {   for (int j = 0; j < nn; ++j) {   if (dp[mask][j] != 0) {    long am = dp[mask][j];    for (int k = 0; k < nn; ++k) {    if (((mask >> k) & 1) == 0 && adj[j + i][k + i]) {     dp[mask | (1 << k)][k] += am;    }    }   }   }   if (((mask >> 0) & 1) != 0) {   res += dp[mask][0];   }  }  }  out.println((res - m) / 2); }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  private class Scanner {  BufferedReader reader;  StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  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 int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
1	public class CF364C {  public static void main(String[] args) throws Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   PrintWriter pw = new PrintWriter(System.out);   int n=Integer.parseInt(br.readLine());   String input=br.readLine();   Set<Character> set = new HashSet<Character>();   for(int i=0;i<input.length();i++){    set.add(input.charAt(i));   }   StringBuilder sb= new StringBuilder(); for(char x:set){  sb.append(x); }   String substring1=sb.toString();                 System.out.println(solve(input,substring1).length());   pw.close();   br.close();  }  public static boolean isEmpty(int[] a){   for(int i=0;i<a.length;i++){    if(a[i]!=0){     return false;    }   } return true;  }  public static String solve(String S, String T) {   HashMap<Character, Integer> D = new HashMap<>();   HashMap<Character, Integer> GET = new HashMap<>();   int B,E;   for (int i=0; i<T.length();i++) {    char c=T.charAt(i);    if (!D.containsKey(c))    {     D.put(c, 1);    }    else    {     D.put(c, D.get(c) + 1);    }   }   int ccc = 0;   B=0; E=0;   int min = Integer.MAX_VALUE;      String RESULT = "";   while (E < S.length()) {    char c = S.charAt(E);    if (D.containsKey(c)) {     if (GET.containsKey(c)) {      if (GET.get(c) < D.get(c))       ccc++;           GET.put(c, GET.get(c) + 1);     } else {      GET.put(c, 1);      ccc++;          }    }    if (ccc == T.length()) {         char test = S.charAt(B);     while (!GET.containsKey(test) ||       GET.get(test) > D.get(test)) {      if (GET.containsKey(test)        && GET.get(test) >        D.get(test))             GET.put(test, GET.get(test) - 1);           B++;      test = S.charAt(B);           }     if (E - B + 1 < min) {      RESULT = S.substring(B, E + 1);      min = E - B + 1;     }        }    E++;   }     return RESULT;  }  }
3	public class Q6 {  public static void main(String[] args) {   InputReader s = new InputReader(System.in);   PrintWriter out = new PrintWriter(System.out);   int t = 1;   nexttest:   while (t-- > 0) {    int n = s.nextInt();    int a[] = s.nextIntArray(n);    HashMap<Integer, List<Pair>> sets = new HashMap<>();    int pre[] = new int[n + 1];    for (int i = 1; i <= n; i++) {     pre[i] = a[i - 1] + pre[i - 1];    }    for (int i = 1; i <= n; i++) {     for (int j = i; j <= n; j++) {      final Integer key = pre[j] - pre[i - 1];      if (!sets.containsKey(key)) {       sets.put(key, new ArrayList<>());      }      sets.get(key).add(new Pair(i, j));     }    }    int ans = 0;    List<Pair> answer = new ArrayList<>();    int[] ansNextPos = new int[1];    boolean[] ansTaken = new boolean[1];    for (List<Pair> intervals : sets.values()) {     Collections.sort(intervals);     int[] nextPos = new int[intervals.size()];     boolean[] taken = new boolean[intervals.size()];     int[] dp = new int[intervals.size()];     dp[intervals.size() - 1] = 1;     taken[intervals.size() - 1] = true;     nextPos[intervals.size() - 1] = -1;     for (int i = intervals.size() - 2; i >= 0; i--) {      dp[i] = dp[i + 1];      taken[i] = false;      nextPos[i] = i + 1;      int ll = i + 1;      int rr = intervals.size();      while (ll < rr) {       int mid = ll + rr;       mid /= 2;       if (intervals.get(mid).x > intervals.get(i).y) {        rr = mid;       } else {        ll = mid + 1;       }      }      if (ll < intervals.size()) {       if (dp[i] < 1 + dp[ll]) {        dp[i] = Math.max(dp[i], 1 + dp[ll]);        taken[i] = true;        nextPos[i] = ll;       }      }     }     if (dp[0] > ans) {      ans = dp[0];      answer = intervals;      ansNextPos = nextPos;      ansTaken = taken;     }    }     out.println(ans);    int cur = 0;    while (cur != -1) {     if (ansTaken[cur]) {      out.println(answer.get(cur));     }     cur = ansNextPos[cur];    }   }   out.close();  }  static class Pair implements Comparable<Pair> {   int x;   int y;   @Override   public String toString() {    return x + " " + y;   }   public Pair(final int x, final int y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(final Pair o) {    return this.x - o.x;   }  }  static class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar, snumChars;   private InputReader.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);   }  } }
5	public class Main {  static PrintWriter out; static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}  public static void main(String[] args) throws Exception {  out = new PrintWriter(System.out);  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  int n = next();  int t = 2*next();  int[] x = new int[n];  int[] a = new int[n];  for (int i = 0; i < n; i++) {  x[i] = 2* next() + 2000;  a[i] = next();  }  int[] srt = new int[n];  for (int i = 0; i < n; i++) srt[i] = 10000 * x[i] + a[i];  Arrays.sort(srt);  for (int i = 0; i < n; i++) {  x[i] = srt[i] / 10000;  a[i] = srt[i] % 10000;  }  int answ = 2;  for (int i = 0; i < n - 1; i++) {  if (x[i + 1] - x[i] > a[i] + a[i + 1] + t) answ++;  if (x[i + 1] - x[i] >= a[i] + a[i + 1] + t) answ++;  }  out.println(answ);  out.close(); } }
1	public class EhabAndAComponentChoosingProblem {   long INF = (long) 1e18;   int n;  int[] a;   int[][] G;   void solve() {   n = in.nextInt();   a = new int[n];   for (int i = 0; i < n; i++) a[i] = in.nextInt();   int[] fr = new int[n - 1], to = new int[n - 1];   for (int i = 0; i < n - 1; i++) {    fr[i] = in.nextInt() - 1;    to[i] = in.nextInt() - 1;   }   G = build_graph(n, fr, to);     int[][] ret = bfs(G, 0);   int[] par = ret[0], ord = ret[2];     long best = -INF;   long[] dp = new long[n];   for (int i = n - 1; i >= 0; i--) {    int u = ord[i];    dp[u] = a[u];    for (int v : G[u]) {     if (v != par[u]) {      if (dp[v] > 0) dp[u] += dp[v];     }    }    best = Math.max(best, dp[u]);   }     int k = 0;   for (int i = n - 1; i >= 0; i--) {    int u = ord[i];    dp[u] = a[u];    for (int v : G[u]) {     if (v != par[u]) {      if (dp[v] > 0) dp[u] += dp[v];     }    }    if (dp[u] == best) {     dp[u] = -INF;     k++;    }   }     out.printf("%d %d%n", best * k, k);  }   int[][] bfs(int[][] G, int root) {   int n = G.length;     int[] par = new int[n];   Arrays.fill(par, -1);     int[] dep = new int[n];   dep[root] = 0;     int[] qu = new int[n];   qu[0] = root;   for (int l = 0, r = 1; l < r; l++) {    int u = qu[l];    for (int v : G[u]) {     if (v != par[u]) {      qu[r++] = v;      par[v] = u;      dep[v] = dep[u] + 1;     }    }   }     return new int[][]{par, dep, qu};  }   int[][] build_graph(int n, int[] from, int[] to) {   int[][] G = new int[n][];   int[] cnt = new int[n];   for (int i = 0; i < from.length; i++) {    cnt[from[i]]++;    cnt[to[i]]++;   }   for (int i = 0; i < n; i++) G[i] = new int[cnt[i]];   for (int i = 0; i < from.length; i++) {    G[from[i]][--cnt[from[i]]] = to[i];    G[to[i]][--cnt[to[i]]] = from[i];   }   return G;  }   public static void main(String[] args) {   in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));   out = new PrintWriter(System.out);   new EhabAndAComponentChoosingProblem().solve();   out.close();  }   static FastScanner in;  static PrintWriter out;   static class FastScanner {   BufferedReader in;   StringTokenizer st;     public FastScanner(BufferedReader in) {    this.in = in;   }     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());   }     public long nextLong() {    return Long.parseLong(nextToken());   }     public double nextDouble() {    return Double.parseDouble(nextToken());   }  } }
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());  } }
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);  } }
4	public class Solution{  static int[] dx = {1,-1,0,0};  static int[] dy = {0,0,1,-1};  static Queue<Pair> q ;  static boolean[][] visited ;  static Pair result = new Pair(0,0);  static int n,m,k;  public static void main(String[] args){   try(BufferedReader in = new BufferedReader(new FileReader("input.txt"));     BufferedWriter out = new BufferedWriter(new FileWriter("output.txt")))   {    StringTokenizer s = new StringTokenizer(in.readLine());    n = Integer.parseInt(s.nextToken());    m = Integer.parseInt(s.nextToken());    k = Integer.parseInt(in.readLine());    visited = new boolean[n][m];    q = new LinkedList <>();    s = new StringTokenizer(in.readLine());    for(int i=0;i<k;i++){     int x = Integer.parseInt(s.nextToken());     int y = Integer.parseInt(s.nextToken());     q.add(new Pair(--x,--y));    }    bfs();    String ans = "" + (result.x+1) +" "+ (result.y+1);    out.write(ans);   }catch(IOException e){   }  }  static void bfs(){   while(!q.isEmpty()){    Pair temp = q.poll();    if(visited[temp.x][temp.y]) continue;    visited[temp.x][temp.y] = true;    result.x = temp.x;    result.y= temp.y;    for(int i=0;i<4;i++){     int x = temp.x + dx[i];     int y = temp.y + dy[i];     if(x>=0 && x<n && y>=0 && y<m && !visited[x][y])      q.add(new Pair(x,y));    }      }  }  } class Pair{  int x,y;  public Pair(int x,int y){   this.x=x;   this.y=y;  } }
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;   }  } }
3	public class Main {  public static void main(String[] args) throws IOException {   new Main().run();  }   private void run() throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(reader.readLine());   int[] arr = new int[n];   String[] line = reader.readLine().split("\\s");   for (int i = 0; i < n; i++) {    arr[i] = Integer.parseInt(line[i]);   }   Arrays.sort(arr);   Set<Integer> numbers = new HashSet<>();   for (int i = 0; i < arr.length; i++) {    Iterator<Integer> iter = numbers.iterator();    boolean contains = false;    while (iter.hasNext()){     int elem = iter.next();     if(gcd(elem, arr[i]) == elem){      contains = true;     }    }    if(!contains)     numbers.add(arr[i]);   }    System.out.println(numbers.size());  }  private int gcd(int a, int b){   while (a != b){    if(a > b)     a -= b;    else     b -= a;   }   return a;  }  }
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;  } } }
5	public class c { public static void main(String[] args)  throws IOException {  BufferedReader r =   new BufferedReader(new InputStreamReader(System.in), 1);  String s = r.readLine();  int n = Integer.parseInt(s);  String s2 = r.readLine();  StringTokenizer st = new StringTokenizer(s2," ");  int a[] = new int[n];  for (int i = 0; i < n; i++)  a[i] = Integer.parseInt(st.nextToken());  Arrays.sort(a);  if (a[n - 1] == 1) a[n - 1] = 2;  else {a[n - 1] = 1; Arrays.sort(a);}  for (int i = 0; i < n; i++)  System.out.println(a[i]); } }
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; } }
1	public class Main { static Scanner sc = new Scanner (System.in);  public static void main(String[] args) {  int n = sc.nextInt();  int k = sc.nextInt();  char str[][] = new char[5][n];   for(int i = 0;i < 4;i ++){   for(int j = 0;j < n;j ++)     str[i][j] = '.';   }   if(k % 2 == 0){    k /= 2;    for(int i = 1;i <= 2;i++){     for(int j = 1;j <= k;j++)      str[i][j] = '#';    }   }   else{    str[1][n / 2] = '#';    if(k != 1){     int tmp = n / 2;     if(k <= n - 2){      for(int i = 1;i<= (k - 1) / 2;i++){       str[1][i] = '#';       str[1][n - 1 - i] = '#';      }     }     else{      for(int i = 1;i <= n - 2;i++) str[1][i] = '#';      k -= n - 2;      for(int i = 1;i <= k/2;i++){       str[2][i] = '#';       str[2][n - 1 - i]='#';      }     }      }   }   System.out.println("YES");   for(int i = 0;i < 4;i ++){   System.out.println(str[i]);   }  } }
2	public class Main {  static int inf = (int) 1e9;  public static void main(String[] args) throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));   pw = new PrintWriter(System.out);   int n = nextInt();   int k = nextInt();   long l = -1;   long r = 100000;   while(l != r - 1) {    long mid = (l + r) / 2;    if (mid * (mid + 1) / 2 - (n - mid) > k) r = mid;    else l = mid;   }   pw.println(n - l);   pw.close();  }  static BufferedReader br;  static StringTokenizer st = new StringTokenizer("");  static PrintWriter pw;  static String next() throws IOException {   while (!st.hasMoreTokens()) st = new StringTokenizer(br.readLine());   return st.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());  } }
0	public class Subtractions {  public static void main(String[] args) {  Scanner kb = new Scanner(System.in);  int count = kb.nextInt();  while(count > 0) {  int smaller = kb.nextInt();  int larger = kb.nextInt();  int ops = 0;    while(smaller > 0 && larger > 0) {   if(smaller > larger) {   int temp = smaller;   smaller = larger;   larger = temp;   }      ops += larger/smaller;   larger = larger % smaller;  }  System.out.println(ops);  count--;  }  } }
4	public class A23 {  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   String s = br.readLine();   for(int length = s.length(); length > 0; length--)  {    for(int start = 0; start + length <= s.length(); start++)  {     String test = s.substring(start, start+length);     if(s.indexOf(test) != s.lastIndexOf(test)) {      System.out.println(length);      return;     }    }   }   System.out.println(0);  } }
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 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 place = in.readInt() - 1;  final int[] points = new int[count];  final int[] time = new int[count];  IOUtils.readIntArrays(in, points, time);  Comparator<Integer> comparator = new Comparator<Integer>() {  public int compare(Integer o1, Integer o2) {   if (points[o1] != points[o2])   return points[o2] - points[o1];   return time[o1] - time[o2];  }  };  Integer[] order = ArrayUtils.order(count, comparator);  int answer = 0;  for (int i = 0; i < count; i++) {  if (comparator.compare(order[place], order[i]) == 0)   answer++;  }  out.printLine(answer); } } 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 static boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  } class OutputWriter { private final PrintWriter writer;  public OutputWriter(OutputStream outputStream) {  writer = new PrintWriter(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();  } }  } class ArrayUtils { public static Integer[] generateOrder(int size) {  Integer[] order = new Integer[size];  for (int i = 0; i < size; i++)  order[i] = i;  return order; }  public static Integer[] order(int size, Comparator<Integer> comparator) {  Integer[] order = generateOrder(size);  Arrays.sort(order, comparator);  return order; }  }
0	public class A {  public static void main(String[] args) throws FileNotFoundException {   Scanner s = new Scanner(System.in);   int T = s.nextInt();   System.out.println("0 0 "+T);    } }
4	public class Pjar {  static int a[][];  public static void main(String[] args) throws FileNotFoundException {   Scanner in = new Scanner(new File("input.txt"));   PrintWriter out = new PrintWriter("output.txt");   int N = in.nextInt();   int M = in.nextInt();   a = new int[N][M];   for (int i = 0; i < N; i++) {    for (int j = 0; j < M; j++) {     a[i][j] = Integer.MAX_VALUE;    }   }   int k = in.nextInt();   in.nextLine();   for (int i = 0; i < k; i++) {    int x = in.nextInt();    int y = in.nextInt();    a[x - 1][y - 1] = 1;    burn(x - 1, y - 1);   }   int max = Integer.MIN_VALUE;   int x = 0;   int y = 0;   for (int i = 0; i < N; i++) {    for (int j = 0; j < M; j++) {     if(a[i][j]>max){      max = a[i][j];      x = i+1;      y = j+1;     }    }   }   out.printf("%d %d",x,y);   out.close();   in.close();  }  static void burn(int i, int j) {   for(int k = 0;k<a.length;k++){    for(int l=0;l<a[k].length;l++){     if(a[k][l]>Math.abs(k-i) + Math.abs(l-j)){      a[k][l]=Math.abs(k-i) + Math.abs(l-j);     }    }   }  } }
1	public class Main { public static void main(String[] args) throws IOException {  new Thread(null, new Runnable() {  public void run() {   try {   try {    if (new File("input.txt").exists())    System.setIn(new FileInputStream("input.txt"));   } catch (SecurityException e) {}   new Main().run();   } catch (IOException e) {   e.printStackTrace();   }  }  }, "1", 1L << 24).start();  }  BufferedReader in; PrintWriter out; StringTokenizer st = new StringTokenizer("");  int N; int[] a; int[] b; int[] c;  int T, H;  void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   N = nextInt();  char[] s = nextToken().toCharArray();  a = new int [N];   H = 0;  T = 0;   for (int i = 0; i < s.length; i++) {  a[i] = s[i] == 'T' ? 1 : 0;  if (s[i] == 'T')   T++;  else   H++;  }   if (T == 1 || H == 1) {  out.println(0);  out.close();  return;  }   b = Arrays.copyOf(a, a.length);  c = Arrays.copyOf(a, a.length);  sort(c);   int ans = 100000000;  for (int o = 0; o < N; o++) {  for (int i = 0; i < N; i++)   b[(i + o) % N] = a[i];  int cur = 0;  for (int i = 0; i < N; i++)   if (b[i] != c[i])   cur++;  ans = min(ans, cur / 2);  }   out.println(ans);   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 {  public static void main(String[] args) throws Exception {   int n = nextInt();  String nn = Integer.toString(n);  if(n >= 0){  println(n);  } else {  println(Math.max(Integer.parseInt(nn.substring(0,nn.length() - 1)), Integer.parseInt(nn.substring(0, nn.length() - 2) + nn.charAt(nn.length() - 1))));  } }  private static PrintWriter out = new PrintWriter(System.out); private static BufferedReader inB = new BufferedReader(new InputStreamReader(System.in));  private static StreamTokenizer in = new StreamTokenizer(inB);  private static void exit(Object o) throws Exception {  out.println(o);  out.flush();  System.exit(0); } private static void println(Object o) throws Exception{  out.println(o);  out.flush(); } private static void print(Object o) throws Exception{  out.print(o);  out.flush(); } private static long nextLong() throws Exception {  in.nextToken();  return (long)in.nval; }  private static int nextInt() throws Exception {  in.nextToken();  return (int)in.nval; }  private static String nextString() throws Exception {  in.nextToken();  return in.sval;   }  }
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);   }  } } }
4	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());  int len=s.length();  int ans=0;  for (int i=0;i<len-1;i++) {  for (int j=i+1;j<len;j++) {   int score=0;   boolean flag=true;   for (int k=0;k+j<len && flag;k++) {   if (s.charAt(i+k)==s.charAt(j+k)) {    score++;   } else {    flag=false;   }   }   if (score>ans) {   ans=score;   }  }  }  System.out.println(ans); } }
4	public class Practice { public static long mod = (long) Math.pow(10, 9) + 7; public static long[][][]dp; public static void main(String[] args) throws Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter pw = new PrintWriter(System.out);     String[] s2 = br.readLine().split(" ");  int n = Integer.parseInt(s2[0]);  int m = Integer.parseInt(s2[1]);  int k = Integer.parseInt(s2[2]);  dp=new long[n][m][k+1];  int[][] hori = new int[n][m - 1];  int[][] verti = new int[n - 1][m];  for (int i = 0; i < n; i++) {  String str = (br.readLine());  String[] s1 = str.split(" ");  for (int j = 0; j < m - 1; j++) {   hori[i][j] = Integer.parseInt(s1[j]);  }  }  for (int i = 0; i < n - 1; i++) {  String str = (br.readLine());  String[] s1 = str.split(" ");  for (int j = 0; j < m; j++) {   verti[i][j] = Integer.parseInt(s1[j]);  }  }  long[][]ans=new long[n][m];  if(k%2!=0) {  for(int i=0;i<n;i++) {   for(int j=0;j<m;j++) {   ans[i][j]=-1;   }  }  }else {  for(int i=0;i<n;i++) {   for(int j=0;j<m;j++) {   ans[i][j]=findAns(i,j,k,hori,verti,n,m,Integer.MAX_VALUE);   }  }  }  for(int i=0;i<n;i++) {  StringBuilder str=new StringBuilder();  for(int j=0;j<m;j++) {   str.append(ans[i][j]+" ");  }pw.println(str.toString());  }    pw.close(); }  private static long findAns(int i, int j, int k, int[][] hori, int[][] verti, int n, int m, int last) {   if(k==0) {  return 0;  }  if(i<n&&j<m&&i>=0&&j>=0) {    }else {  return 100000000;  }   if(dp[i][j][k]!=0) {  return dp[i][j][k];  }  long ans=k*((long)last);  if(j>0) {  long curr=2*hori[i][j-1];  curr+=findAns(i, j-1, k-2, hori, verti, n, m, hori[i][j-1]);  ans=Math.min(ans, curr);  }   if(j<m-1) {  long curr=2*hori[i][j];  curr+=findAns(i, j+1, k-2, hori, verti, n, m, hori[i][j]);  ans=Math.min(ans, curr);  }   if(i>0) {  long curr=2*verti[i-1][j];  curr+=findAns(i-1, j, k-2, hori, verti, n, m, verti[i-1][j]);  ans=Math.min(ans, curr);  }   if(i<n-1) {  long curr=2*verti[i][j];  curr+=findAns(i+1, j, k-2, hori, verti, n, m, verti[i][j]);  ans=Math.min(ans, curr);  }   dp[i][j][k]=ans;  return ans; } }
5	public class D {  public static void main(String[] args){  FastScanner scan = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int n = scan.nextInt();  long[] a = scan.nextLongArray(n);  BigInteger res = BigInteger.ZERO;  for (int i = n-1; i >= 0; i--) res = res.add(BigInteger.valueOf(i*a[i] - (n-1-i)*a[i]));  HashMap<Long, Long> map = new HashMap<>();  for(int i = 0; i < n; i++) {  res = res.subtract(BigInteger.valueOf(map.getOrDefault(a[i]-1, 0L)));  res = res.add(BigInteger.valueOf(map.getOrDefault(a[i]+1, 0L)));  map.put(a[i], map.getOrDefault(a[i], 0L)+1);  }  out.println(res);  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;  } }  }
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;   }  }  }
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);   Task547F solver = new Task547F();   solver.solve(1, in, out);   out.close();  }  static class Task547F {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    long arr[] = in.nextLongArray(n);    long cur = 0;    int i, j;    Map<Long, List<Pair>> hm = new HashMap<>();    for (i = 0; i < n; i++) {     cur = 0;     for (j = i; j < n; j++) {      cur += arr[j];      if (!hm.containsKey(cur)) {       List<Pair> al = new LinkedList<>();       al.add(new Pair(i + 1, j + 1));       hm.put(cur, al);      } else {       List<Pair> al = hm.get(cur);       al.add(new Pair(i + 1, j + 1));       hm.put(cur, al);      }     }    }       long max = arr[0];    int msize = 0;    for (long key : hm.keySet()) {     List<Pair> al = hm.get(key);     if (al.size() < hm.get(max).size())      continue;     Collections.sort(al, new Comparator<Pair>() {      public int compare(Pair o1, Pair o2) {       if (o1.b != o2.b)        return o1.b - o2.b;       return o1.a - o2.a;      }     });         List<Pair> all = new LinkedList<>();     int prev = -1;     for (Pair p : al) {      if (p.a > prev) {       all.add(p);       prev = p.b;      }     }          hm.put(key, all);         if (all.size() > msize) {           msize = all.size();      max = key;     }    }        List<Pair> al = hm.get(max);    out.println(al.size());    for (Pair p : al) {     out.println(p.a + " " + p.b);    }   }   class Pair {    int a;    int b;    public Pair(int a, int b) {     this.a = a;     this.b = b;    }    public String toString() {     return "(" + a + ", " + b + ")";    }   }  }  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 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 long[] nextLongArray(int n) {    long[] array = new long[n];    for (int i = 0; i < n; ++i) array[i] = nextLong();    return array;   }   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 println(Object... objects) {    print(objects);    writer.println();   }   public void close() {    writer.close();   }   public void println(int i) {    writer.println(i);   }  } }
0	public class Subtractions {  public static void main(String args[]) {   Scanner scan = new Scanner(System.in);   int t = scan.nextInt();   while (t-- > 0) {    int a = scan.nextInt();    int b = scan.nextInt();    int res = 0;    while (a != 0 && b != 0) {     if (a > b) {      res += (a / b);      a %= b;     } else {      res += (b / a);      b %= a;     }    }    System.out.println(res);   }  } }
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();  } }
3	public class cf573 {  public static void main(String[] args){   Scanner scan=new Scanner(System.in);   int n=0;   if(scan.hasNext())    n=scan.nextInt();   TreeSet<Integer> set=new TreeSet<>();   for(int i=0;i<n;i++){    if(scan.hasNext())     set.add(scan.nextInt());   }   int[] arr=new int[set.size()];   Iterator<Integer> it=set.iterator();   int j=0;   while(it.hasNext()){    arr[j++]=it.next();   }   int tot=1,flag;   for(int i=1;i<arr.length;i++){    flag=0;    for(int k=0;k<i;k++){     if(arr[i]%arr[k]==0){      flag=1;      break;     }    }    if(flag==0){     tot++;    }   }   System.out.println(tot);  } }
2	@SuppressWarnings("unused") public class round176B {  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 {   long n = parseLong(next());   long k = parseLong(next());   if(n == 1){    System.out.println(0);    return;   }   if (n <= k) {    System.out.println(1);    return;   }   if ((((k * (k + 1)) / 2) - 1) - (k - 2) < n) {    System.out.println(-1);   } else {    long lo = 1;    long hi = k + 1;    int best = Integer.MAX_VALUE;    while (lo < hi) {     long mid = lo + ((hi - lo) / 2);     long first = ((mid * (2 + (2 + (mid - 1)))) / 2) - (mid - 1);     long last = ((mid * (k - mid + 1 + k)) / 2) - (mid - 1);         if (n < first) {      hi = mid;     } else {      if (n >= first && n <= last) {       hi = mid;       best = min(best, (int) mid);      } else       lo = mid + 1;     }    }    System.out.println(best);   }  } }
1	public class C {  void solve(){   int n = readInt();   int q = readInt();   int max = 0;   int[] a = new int[n];   Deque<Integer> deque = new ArrayDeque<>();   for(int i = 0;i<n;i++){    a[i] = readInt();    deque.addLast(a[i]);    max = Math.max(max, a[i]);   }   List<String> ans = new ArrayList<>();   while(deque.peekFirst() != max){    int one = deque.pollFirst();    int two = deque.pollFirst();    ans.add(one + " " + two);    deque.addFirst(one > two ? one : two);    deque.addLast(one > two ? two : one);    if(one == max) break;   }   for(int i = 0;i<n;i++){    a[i] = deque.pollFirst();   }   for(int i = 0;i<q;i++){   long x = readLong();    if(x <= ans.size()){     out.println(ans.get((int)x - 1));     continue;    }    x -= ans.size();    int y =(int) (x%(n - 1) - 1%(n - 1) + (n - 1)) % (n - 1) + 1;    out.println(max + " " + a[y]);   }  }  public static void main(String[] args) {   new C().run();  }  void run(){   init();   solve();   out.close();  }  BufferedReader in;  PrintWriter out;  StringTokenizer tok = new StringTokenizer("");  void init(){   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);  }  String readLine(){   try{    return in.readLine();   }catch(Exception ex){    throw new RuntimeException(ex);   }  }  String readString(){   while(!tok.hasMoreTokens()){    String nextLine = readLine();    if(nextLine == null) return null;    tok = new StringTokenizer(nextLine);   }   return tok.nextToken();  }  int readInt(){   return Integer.parseInt(readString());  }  long readLong(){   return Long.parseLong(readString());  }  double readDouble(){   return Double.parseDouble(readString());  } }
6	public class Main {  static FastScanner fs=new FastScanner();  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();   }   int Int() {    return Integer.parseInt(next());   }   long Long() {    return Long.parseLong(next());   }   String Str(){    return next();   }  }   public static void main (String[] args) throws java.lang.Exception {   PrintWriter out = new PrintWriter(System.out);    int T=1;   for(int t=0;t<T;t++){    int n=Int();int m=Int();    int A[][]=new int[n][m];    for(int i=0;i<n;i++){     for(int j=0;j<m;j++){      A[i][j]=Int();     }    }    Sol sol=new Sol();    sol.solution(out,A);   }   out.flush();  }  public static int Int(){   return fs.Int();  }  public static long Long(){   return fs.Long();  }  public static String Str(){   return fs.Str();  } }  class Sol{  int dif[][];  int dp[][][];  public void solution(PrintWriter out,int A[][]){   int n=A.length;int m=A[0].length;   int res=0;   dif=new int[n][n];   for(int i=0;i<n;i++){    for(int j=i+1;j<A.length;j++){     int mn=Integer.MAX_VALUE;     for(int k=0;k<m;k++){      mn=Math.min(mn,Math.abs(A[i][k]-A[j][k]));     }     dif[i][j]=mn;     dif[j][i]=mn;        }   }   int state=(1<<n)-1;   dp=new int[state+5][n+1][n+1];   for(int i=0;i<dp.length;i++){    for(int j=0;j<dp[0].length;j++){     Arrays.fill(dp[i][j],-1);    }   }   for(int i=0;i<n;i++){    res=Math.max(res,dfs(A,state^(1<<i),i,i));   }   out.println(res);  }  public int dfs(int A[][],int state,int pre,int start){   if(state==0){    int mn=Integer.MAX_VALUE;    for(int i=1;i<A[0].length;i++){     mn=Math.min(mn,Math.abs(A[start][i]-A[pre][i-1]));    }    return mn;   }    if(dp[state][pre][start]!=-1){    return dp[state][pre][start];   }   int res=0;   for(int i=0;i<A.length;i++){    if((state&(1<<i))!=0){     int di=dif[pre][i];     res=Math.max(res,Math.min(di,dfs(A,state^(1<<i),i,start)));    }   }      dp[state][pre][start]=res;   return res;  }     }
6	public class Main { static int a[][],n; static boolean isClique[]; static int maxClique[]; static void DFS1(int p,int n,int S) {  if(p>n)  {  isClique[S]=true;  return ;  }  DFS1(p+1,n,S);  boolean mark=true;  for(int i=1;i<p;++i)  if((S>>(i-1)&1)==1&&a[p][i]==0)   mark=false;  if(mark)  DFS1(p+1,n,1<<(p-1)|S); } static void DFS2(int p,int n,int m,int S) {  if(p>n)  {  int cnt=0;  for(int i=m;i<=n;++i)   if((S>>(i-m)&1)==1)   ++cnt;  maxClique[S]=cnt;  return ;  }  DFS2(p+1,n,m,S);  boolean mark=true;  for(int i=m;i<p;++i)  if((S>>(i-m)&1)==1&&a[p][i]==0)   mark=false;  if(mark)  DFS2(p+1,n,m,1<<(p-m)|S); } public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  n=Integer.parseInt(sc.next());  a=new int [n+10][n+10];  int cap=Integer.parseInt(sc.next());  for(int i=1;i<=n;++i)  for(int j=1;j<=n;++j)   a[i][j]=Integer.parseInt(sc.next());  int m=(n+1)>>1;  isClique=new boolean [1<<m];  Arrays.fill(isClique,false);  DFS1(1,m,0);  maxClique=new int [1<<(n-m)];  Arrays.fill(maxClique,0);  DFS2(m+1,n,m+1,0);  for(int i=1;i<1<<(n-m);++i)  for(int j=m+1;j<=n;++j)   if((i>>(j-m-1)&1)==1)   maxClique[i]=Math.max(maxClique[i],maxClique[i-(1<<(j-m-1))]);  int ans=0,tmp[]=new int [m+10];  for(int i=0;i<1<<m;++i)  if(isClique[i])  {   int mask=0,cnt=0;   for(int j=1;j<=m;++j)   if((i>>(j-1)&1)==1)    tmp[++cnt]=j;   for(int j=m+1;j<=n;++j)   {   boolean mark=true;   for(int k=1;k<=cnt;++k)    if(a[j][tmp[k]]==0)    mark=false;   if(mark)    mask|=1<<(j-m-1);   }   ans=Math.max(ans,cnt+maxClique[mask]);  }  System.out.printf("%.9f\n",cap*cap*(ans-1)/2.0/ans); } }
3	public class Main6{ static class Pair {  int x;  int y;  int z;  public Pair(int x,int y,int z)  {   this.x= x;   this.y= y;  this.z=z;  }    @Override  public int hashCode()   {   final int temp = 14;   int ans = 1;   ans =x*31+y*13;   return ans;   }        @Override  public boolean equals(Object o)  {   if (this == o) {   return true;   }   if (o == null) {   return false;   }   if (this.getClass() != o.getClass()) {   return false;   }   Pair other = (Pair)o;   if (this.x != other.x || this.y!=other.y) {   return false;   }   return true;  }    }  static class Pair1 {  String x;  int y;  int z;   } static class Compare {  static void compare(Pair arr[], int n)  {      }   }   public static long pow(long a, long b) {  long result=1;  while(b>0)  {  if (b % 2 != 0)  {   result=(result*a)%998244353;   b--;  }   a=(a*a)%998244353;  b /= 2;  }   return result; } public static long fact(long num) {   long value=1;   int i=0;   for(i=2;i<num;i++)   {   value=((value%mod)*i%mod)%mod;   }   return value;  }  public static int gcd(int a, int b)  {   if (a == 0)   return b;   return gcd(b%a, a);  }    public static long sum(int h)  {   return (h*(h+1)/2);  }  public static void dfs(int parent,boolean[] visited,int[] dp)  {   ArrayList<Integer> arr=new ArrayList<Integer>();   arr=graph.get(parent);   visited[parent]=true;   for(int i=0;i<arr.size();i++)   {   int num=(int)arr.get(i);   if(visited[num]==false)   {    dfs(num,visited,dp);   }   dp[parent]=Math.max(dp[num]+1,dp[parent]);   }  }    static int[] dis;  static int mod=1000000007;  static ArrayList<ArrayList<Integer>> graph;    public static void bfs(int num,int size)  {   boolean[] visited=new boolean[size+1];   Queue<Integer> q=new LinkedList<>();   q.add(num);   ans[num]=1;   visited[num]=true;   while(!q.isEmpty())   {   int x=q.poll();   ArrayList<Integer> al=graph.get(x);   for(int i=0;i<al.size();i++)   {    int y=al.get(i);    if(visited[y]==false)    {    q.add(y);    ans[y]=ans[x]+1;    visited[y]=true;    }   }   }  }  static int[] ans;                      public static int[] sort(int[] a)  {   int n=a.length;   ArrayList<Integer> ar=new ArrayList<>();   for(int i=0;i<a.length;i++)   {   ar.add(a[i]);   }   Collections.sort(ar);   for(int i=0;i<n;i++)   {   a[i]=ar.get(i);   }   return a;  }  static public void main(String args[])throws IOException  {   int n=i();   int[] a=new int[n];   for(int i=0;i<n;i++)   {   a[i]=i();   }   Arrays.sort(a);   boolean[] flag=new boolean[n];   int ans=0;   for(int i=0;i<n;i++)   {   if(flag[i]==false)   {    ans++;    for(int j=0;j<n;j++)    {    if(a[j]%a[i]==0 && flag[j]==false)    {     flag[j]=true;    }    }   }   }   pln(ans+"");  }          static InputReader in=new InputReader(System.in);   static OutputWriter out=new OutputWriter(System.out);   public static long l()   {   String s=in.String();   return Long.parseLong(s);   }   public static void pln(String value)   {   System.out.println(value);   }   public static int i()   {   return in.Int();   }   public static String s()   {   return in.String();   } }                                              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 Int() {   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 String() {   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 String();  }    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();  }    public void flush() {   writer.flush();  }    }    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.Int();   return array;  }    }
1	public class Main {  InputStreamReader inp = new InputStreamReader(System.in); BufferedReader in = new BufferedReader(inp); boolean test = false;  String[] inData = { "9", "HTHTHTHHT",  };  static int id = -1; public String readLine() throws IOException {  id++;  if(test)  return inData[id];  else  return in.readLine(); }   public Main() throws Throwable {   int animalNr = Integer.valueOf(readLine());  String animals = readLine();   boolean[] state = new boolean[animalNr];  int tigerCount = 0;  for (int i = 0; i < animals.length(); i++) {  if('T' == animals.charAt(i)){   state[i] = true;   tigerCount++;  }  }  int best = Integer.MAX_VALUE;  for (int i = 0; i < state.length; i++) {  int swaps = 0;  for (int j = i; j < i+tigerCount; j++) {   if(state[j %animalNr] == false){   swaps ++;   }  }  if(swaps < best){   best = swaps;  }  }   System.out.println(best);   }   public static void main(String[] args) throws Throwable {  new Main(); } }
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()){    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 Thread(null, new A(), "", 256 * (1L << 20)).start();  }   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{   int n = readInt();   int[] a = new int[n];   for (int i = 0; i < n; i++){    a[i] = readInt();   }   Arrays.sort(a);   a[n-1] = a[n-1] == 1? 2:1;   Arrays.sort(a);   for (int i = 0; i < n; i++){    out.print(a[i] + " ");   }  } }
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(); } }
6	public class CF {  void realSolve() {  int n = in.nextInt();  int m = in.nextInt();  boolean[][] f = new boolean[n][n];  for (int i = 0; i < m; i++) {  int fr = in.nextInt() - 1;  int to = in.nextInt() - 1;  f[fr][to] = f[to][fr] = true;  }  long[][] dp = new long[n][1 << n];  for (int i = 0; i < n; i++)  dp[i][1 << i] = 1;  long res = 0;  int[] len = new int[n + 1];  for (int st = 0; st < 1 << n; st++) {  int from = Integer.lowestOneBit(st);  for (int i =0; i < n;i++)   if (((1<<i) & st) != 0) {   from =i;   break;   }  for (int to = 0; to < n; to++)   if (dp[to][st] != 0)   for (int next = from; next < n; next++)    if (f[to][next]     && ((((1 << next) & st) == 0) || next == from))    if (next == from) {     if (Integer.bitCount(st) > 2) {     res += dp[to][st];     len[Integer.bitCount(st)] += dp[to][st];     }    } else {     dp[next][st | (1 << next)] += dp[to][st];    }  }  out.println(res / 2); }  private class InputReader {  StringTokenizer st;  BufferedReader br;  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));  }  String next() {  while (st == null || !st.hasMoreElements()) {   String s;   try {   s = br.readLine();   } catch (IOException e) {   return null;   }   if (s == null)   return null;   st = new StringTokenizer(s);  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  boolean hasMoreElements() {  while (st == null || !st.hasMoreElements()) {   String s;   try {   s = br.readLine();   } catch (IOException e) {   return false;   }   st = new StringTokenizer(s);  }  return st.hasMoreElements();  }  long nextLong() {  return Long.parseLong(next());  } }  InputReader in; PrintWriter out;  void solve() {  in = new InputReader(new File("object.in"));  try {  out = new PrintWriter(new File("object.out"));  } catch (FileNotFoundException e) {  e.printStackTrace();  }  realSolve();  out.close(); }  void solveIO() {  in = new InputReader(System.in);  out = new PrintWriter(System.out);  realSolve();  out.close();  }  public static void main(String[] args) {  new CF().solveIO(); } }
5	public class A {  void run(){   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[] a = new int[n];   boolean dif = false;   for(int i=0;i<n;i++)a[i]=sc.nextInt();   Arrays.sort(a);   if(n==1){    System.out.println(a[0]==1?2:1);return;   }   int[] m = new int[n];   for(int i=1;i<n;i++)if(a[i]!=a[i-1])dif=true;   m[0] = 1;   for(int i=1;i<n;i++)m[i]=a[i-1];   if(!dif&&a[0]==1)m[n-1]++;     for(int i=0;i<n;i++)System.out.print(m[i]+(i==n-1?"\n":" "));  }   public static void main(String[] args) {   new A().run();  } }
4	public class Problem implements Runnable {  private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  private BufferedReader in;  private PrintWriter out;  private StringTokenizer tok = new StringTokenizer("");  private void init() throws FileNotFoundException {   Locale.setDefault(Locale.US);   String fileName = "";       in = new BufferedReader(new FileReader("input.txt"));     out = new PrintWriter("output.txt");     }   String readString() {   while (!tok.hasMoreTokens()) {    try {     tok = new StringTokenizer(in.readLine());    } catch (Exception e) {     return null;    }   }   return tok.nextToken();  }  int readInt() {   return Integer.parseInt(readString());  }  long readLong() {   return Long.parseLong(readString());  }  double readDouble() {   return Double.parseDouble(readString());  }  int[] readIntArray(int size) {   int[] a = new int[size];   for (int i = 0; i < size; i++) {    a[i] = readInt();   }   return a;  }  public static void main(String[] args) {     new Problem().run();  }  long timeBegin, timeEnd;  void time() {   timeEnd = System.currentTimeMillis();   System.err.println("Time = " + (timeEnd - timeBegin));  }  @Override  public void run() {   try {    timeBegin = System.currentTimeMillis();    init();    solve();    out.close();    time();   } catch (Exception e) {    e.printStackTrace();    System.exit(-1);   }  }   int[][] dist;  int n, m;  P v;  ArrayDeque<P> q = new ArrayDeque<>();  private void solve() throws IOException {   n = readInt();   m = readInt();   int k = readInt();   dist = new int[n][m];   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     dist[i][j] = -1;   for (int i = 0; i < k; i++) {    int x = readInt() - 1, y = readInt() - 1;    dist[x][y] = 0;    q.add(new P(x, y));   }   bfs();   out.println(v.x + 1 + " " + (v.y + 1));  }  public void bfs() {   int[] dx = {0, 1, 0, -1};   int[] dy = {1, 0, -1, 0};   while (!q.isEmpty()) {    v = q.poll();    for (int i = 0; i < 4; i++) {     int nx = v.x + dx[i];     int ny = v.y + dy[i];     if (inside(nx, ny) && dist[nx][ny] == -1) {      q.add(new P(nx, ny));      dist[nx][ny] = dist[v.x][v.y] + 1;     }    }   }  }  public boolean inside(int x, int y) {   if (x < n && y < m && x >= 0 && y >= 0) {    return true;   }   return false;  } } class P {  int x, y;  public P(int x, int y) {   this.x = x;   this.y = y;  } }
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;    }   }  }  }
5	public class CFD {  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();   long[] arr = nextLongArr(n);   long[] diff = new long[n];   long presum = 0;   for (int i = n - 1; i >= 0; i--) {    diff[i] = presum - (n - i - 1) * arr[i];    presum += arr[i];   }   BigInteger pairs = new BigInteger("0");   for (long s : diff) {    pairs = pairs.add(new BigInteger(Long.toString(s)));   }   BigInteger need = new BigInteger("0");   Map<Long, Long> hm = new HashMap<>();   for (int i = n - 1; i >= 0; i--) {    long v1 = hm.getOrDefault(arr[i] - 1, 0L) * (-1);    need = need.add(new BigInteger(Long.toString(v1)));    long v2 = hm.getOrDefault(arr[i] + 1, 0L);    need = need.add(new BigInteger(Long.toString(v2)));    hm.put(arr[i], hm.getOrDefault(arr[i], 0L) + 1);   }   BigInteger res = pairs.subtract(need);   out(res.toString());  }  void shuffle(long[] a) {   int n = a.length;   for(int i = 0; i < n; i++) {    int r = i + (int) (Math.random() * (n - i));    long tmp = a[i];    a[i] = a[r];    a[r] = tmp;   }  }  private void outln(Object o) {   out.println(o);  }  private void out(Object o) {   out.print(o);  }  public CFD() 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 CFD();  }  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 A {  public static void main(String[] args)throws Throwable {   MyScanner sc=new MyScanner();   PrintWriter pw=new PrintWriter(System.out);   int n=sc.nextInt();   String [] s={"M","L","S","XL","XS","XXL","XXS","XXXL","XXXS"};   int [] cnt=new int [9];   for(int i=0;i<n;i++){    String t=sc.next();    for(int j=0;j<9;j++)     if(t.equals(s[j]))      cnt[j]++;   }   for(int i=0;i<n;i++){    String t=sc.next();    for(int j=0;j<9;j++)     if(t.equals(s[j]))      cnt[j]--;   }   for(int i=0;i<9;i++)    cnt[i]=Math.abs(cnt[i]);   int ans=0;   for(int i=0;i<9;i++)    ans+=cnt[i];   pw.println(ans/2);   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;}  } }
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(); } }
0	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int in = sc.nextInt();   if(     in%4==0||     in%7==0||     in%44==0||     in%47==0||     in%74==0||     in%77==0||     in%444==0||     in%447==0||     in%474==0||     in%477==0||     in%744==0||     in%747==0||     in%774==0||     in%777==0       )    System.out.println("YES");   else System.out.println("NO");  } }
4	public class QA {     static long MOD = 1000000007;   static boolean b[], b1[], check;   static ArrayList<Integer>[] amp, pa;   static ArrayList<Pair>[] amp1;   static ArrayList<Pair>[][] damp;   static int left[],right[],end[],sum[],dist[],cnt[],start[],color[],parent[],prime[],size[];   static int ans = 0,k;   static int p = 0;   static FasterScanner sc = new FasterScanner(System.in);     static BufferedWriter log;   static HashSet<Pair> hs;   static HashMap<Pair,Integer> hm;   static PriorityQueue<Integer> pri[];   static ArrayList<Integer>[] level;   static Stack<Integer> st;   static boolean boo[][];   static Pair prr[];   static long parent1[],parent2[],size1[],size2[],arr1[],SUM[],lev[], fibo[];   static int arr[], ver[][];   static private PrintWriter out = new PrintWriter(System.out);   public static void main(String[] args) throws Exception {    new Thread(null, new Runnable() {    public void run() {    try {   soln();    } catch (Exception e) {     System.out.println(e);    }    }   }, "1", 1 << 26).start();      }   private static boolean oj = System.getProperty("ONLINE_JUDGE") != null;   private static void tr(Object... o) {   if (!oj)    System.out.println(Arrays.deepToString(o));   }   static int dp[][];   static int N,K,T,A,B;   static long time;   static int cost[][];   static boolean b11[];   static HashMap<Integer,Integer> h = new HashMap<>();   static HashSet<Pair> chec;   static long ans1; static long ans2;   static int BLOCK, MAX = 1000001;   static double pi = Math.PI;   static int Arr[], Brr[], pow[], M;   static long fact[] = new long[100000+1];   static HashMap<Integer,Long> hm1;   static HashSet<Integer> hs1[], hs2[];   static String[] str2;   static char[] ch1, ch2;   static int[] s,f,D;   static int tf,ts;   static int see[][] = new int[2050][2050];   static boolean bee[][] = new boolean[2050][2050];   static Queue<Pair> q = new LinkedList<>();     public static void soln() throws IOException {         FasterScanner sc = new FasterScanner(new FileInputStream("input.txt"));      PrintWriter log = new PrintWriter("output.txt");      int n = sc.nextInt() , m = sc.nextInt();   int k = sc.nextInt();   for(int i = 1; i <= n ; i++) for(int j =1;j<=m;j++) see[i][j]= 100000000;   for(int i = 0; i < k; i++){    int x = sc.nextInt(), y = sc.nextInt();    bee[x][y] = true;    see[x][y] = 0;    q.add(new Pair(x,y));   }   while(!q.isEmpty()){       int x = q.peek().u, y = q.poll().v;    if(x>1){    see[x-1][y] = min(see[x][y]+1,see[x-1][y]);    if(!bee[x-1][y]) q.add(new Pair(x-1,y));    bee[x-1][y] = true;    }    if(x<n){    see[x+1][y] = min(see[x][y]+1,see[x+1][y]);    if(!bee[x+1][y]) q.add(new Pair(x+1,y));    bee[x+1][y] = true;    }    if(y>1){    see[x][y-1] = min(see[x][y]+1,see[x][y-1]);    if(!bee[x][y-1]) q.add(new Pair(x,y-1));    bee[x][y-1] = true;    }    if(y<m){    see[x][y+1] = min(see[x][y]+1,see[x][y+1]);    if(!bee[x][y+1]) q.add(new Pair(x,y+1));    bee[x][y+1] = true;    }   }   int ans = -1;   Pair temp = null;   for(int i = 1;i<=n;i++){    for(int j = 1;j<=m;j++){    if(see[i][j]>ans) {     ans = see[i][j];     temp = new Pair(i,j);    }    }   }   log.write(temp.u+" "+temp.v);   log.close();   }   static int min(int a, int b){   if(a>b) return b;   return a;   }   private static double dfs(int cur,int prev){   double r=0,n=0;   for(int i : amp[cur]){    if(i!=prev){    r+=(1+dfs(i,cur));    n++;    }   }   if(n!=0){    r=r/n;   }   return r;   }   static double fa1 = 0;   static int fa = -1;   static long nCr1(int n, int r){   if(n<r) return 0;   return (((fact[n] * modInverse(fact[n-r], MOD))%MOD)*modInverse(fact[r], MOD))%MOD;   }   static class Node{   Node arr[] = new Node[2];    int cnt[] = new int[2];   }   public static class Trie{   Node root;   public Trie(){    root = new Node();   }   public void insert(String x){    Node n = root;    for(int i = 0;i < x.length() ;i++){    int a1 = x.charAt(i)-'0';    if(n.arr[a1]!=null){     n.cnt[a1]++;     n = n.arr[a1];     continue;    }    n.arr[a1] = new Node();    n.cnt[a1]++;    n = n.arr[a1];    }   }   public void delete(String x){    Node n = root;    for(int i = 0;i < x.length() ;i++){    int a1 = x.charAt(i)-'0';    if(n.cnt[a1]==1){     n.arr[a1] = null;     return;    }    else {     n.cnt[a1]--;     n = n.arr[a1];    }    }   }   public long get(String x){    Node n = root;    long ans = 0;    for(int i = 0;i < x.length() ;i++){    int a1 = '1' - x.charAt(i);    if(n.arr[a1]!=null){     ans += Math.pow(2, 30-i);     n = n.arr[a1];    }    else n = n.arr[1-a1];       }    return ans;   }   }   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;    }   }   static double power(double x, long y)   {    if (y == 0)     return 1;    double p = power(x, y/2);    p = (p * p);       return (y%2 == 0)? p : (x * p);   }   static int Dfs(int x, int val){   b[x] = true;   for(int p:hs2[x]){    if(!b[p]){    if(!hs1[x].contains(p)) val++;    val += Dfs(p,0);    }   }   return val;   }   static long nCr(int n, int r){   if(n<r) return 0;   else return (((fact[n]*modInverse(fact[r], MOD))%MOD)*modInverse(fact[n-r], MOD))%MOD;   }   static void dfs1(int x, int p){   arr1[x] += lev[x];   for(int v:amp[x]){    if(v!=p){    dfs1(v,x);    }   }   }     static void bfs(int x){      }   public static void seive(int n){   b = new boolean[(n+1)];   Arrays.fill(b, true);   b[1] = true;   for(int i = 2;i*i<=n;i++){    if(b[i]){    for(int p = 2*i;p<=n;p+=i){     b[p] = false;    }    }   }      }     static class Graph{   int vertex;   int weight;   Graph(int v, int w){    vertex = v;    weight = w;   }   }   static class Pair implements Comparable<Pair> {   int u;   int v;   int ans;   public Pair(){    u = 0;    v = 0;   }   public 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 && ans == other.ans));   }      public int compareTo(Pair other) {       return Long.compare(u, other.u);    }      public String toString() {    return "[u=" + u + ", v=" + v + "]";   }   }     public static void buildGraph(int n){   for(int i =0;i<n;i++){    int x = sc.nextInt()-1, y = sc.nextInt()-1;    amp[x].add(y);    amp[y].add(x);   }   }        public static int getParent(long x){   while(parent[(int) x]!=x){    parent[ (int) x] = parent[(int) parent[ (int) x]];    x = parent[ (int) x];   }   return (int) x;   }   static long min(long a, long b, long c){   if(a<b && a<c) return a;   if(b<c) return b;   return c;   }      static void KMPSearch(String pat, String txt)    {     int M = pat.length();     int N = txt.length();                 int lps[] = new int[M];     int j = 0;                 computeLPSArray(pat,M,lps);        int i = 0;     while (i < N)     {      if (pat.charAt(j) == txt.charAt(i))      {       j++;       i++;      }      if (j == M)      {             j = lps[j-1];      }              else if (i < N && pat.charAt(j) != txt.charAt(i))      {                    if (j != 0)        j = lps[j-1];       else        i = i+1;      }     }    }   static void computeLPSArray(String pat, int M, int lps[])    {         int len = 0;     int i = 1;     lps[0] = 0;             while (i < M)     {      if (pat.charAt(i) == pat.charAt(len))      {       len++;       lps[i] = len;       i++;      }      else      {                          if (len != 0)       {        len = lps[len-1];                         }       else       {        lps[i] = len;        i++;       }      }     }    }   private static void permutation(String prefix, String str) {    int n = str.length();    if (n == 0);    else {     for (int i = 0; i < n; i++)      permutation(prefix + str.charAt(i), str.substring(0, i) + str.substring(i+1, n));    }   }     public static void buildTree(int n){   int arr[] = sc.nextIntArray(n);   for(int i = 0;i<n;i++){    int x = arr[i]-1;    amp[i+1].add(x);    amp[x].add(i+1);   }   }     static class SegmentTree {   boolean st[];   boolean lazy[];     SegmentTree(int n) {    int size = 4 * n;    st = new boolean[size];    Arrays.fill(st, true);    lazy = new boolean[size];    Arrays.fill(lazy, true);       }           void update(int si, int ss, int se, int idx, long x) {    if (ss == se) {        st[si]=false;    }    else {    int mid = (ss + se) / 2;    if(ss <= idx && idx <= mid)     {       update(2*si, ss, mid, idx, x);     }     else     { update(2*si+1, mid+1, se, idx, x);     }    st[si] = st[2*si]|st[2*si+1];    }   }      void updateRange(int node, int start, int end, int l, int r, boolean val)   {    if(!lazy[node])    {           st[node] = lazy[node];      if(start != end)     {      lazy[node*2] = lazy[node];           lazy[node*2+1] = lazy[node];         }     lazy[node] = true;             }    if(start > end || start > r || end < l)         return;    if(start >= l && end <= r)    {          st[node] = val;     if(start != end)     {            lazy[node*2] = val;      lazy[node*2+1] = val;     }     return;    }    int mid = (start + end) / 2;    updateRange(node*2, start, mid, l, r, val);      updateRange(node*2 + 1, mid + 1, end, l, r, val);     st[node] = st[node*2] | st[node*2+1];     }     boolean queryRange(int node, int start, int end, int l, int r)   {    if(start > end || start > r || end < l)     return false;       if(!lazy[node])    {          st[node] = lazy[node];        if(start != end)     {      lazy[node*2] = lazy[node];         lazy[node*2+1] = lazy[node];      }     lazy[node] = true;         }    if(start >= l && end <= r)         return st[node];    int mid = (start + end) / 2;    boolean p1 = queryRange(node*2, start, mid, l, r);       boolean b = queryRange(node*2 + 1, mid + 1, end, l, r);     return (p1 | b);   }   void print() {    for (int i = 0; i < st.length; i++) {    System.out.print(st[i]+" ");    }    System.out.println();   }   }   static int convert(int x){   int cnt = 0;   String str = Integer.toBinaryString(x);      for(int i = 0;i<str.length();i++){    if(str.charAt(i)=='1'){    cnt++;    }   }   int ans = (int) Math.pow(3, 6-cnt);   return ans;   }   static class Node2{   Node2 left = null;   Node2 right = null;   Node2 parent = null;   int data;   }   static boolean check(char ch[][], int i, int j){   if(ch[i][j]=='O') return false;   char c = ch[i][j];   ch[i][j] = 'X';   if(c=='X'){   if(i>=4){    int x = 0;    int l = 0;    for(x = 0;x<=4;x++){    if(ch[i-x][j]!='X'){ if(ch[i-x][j]!='.') break;else l++;}    }    if(x==5 && l<=1) return true;    l = 0;    if(j>=4){    for(x = 0;x<=4;x++){     if(ch[i-x][j-x]!='X'){ if(ch[i-x][j-x]!='.') break; else l++;}    }    if(x==5 && l<=1) return true;     l =0;    for(x = 0;x<=4;x++){     if(ch[i][j-x]!='X'){ if(ch[i][j-x]!='.') break; else l++;}    }    if(x==5 && l<=1) return true;    }    if(j<=5){    l = 0;    for(x = 0;x<=4;x++){     if(ch[i][j+x]!='X'){ if(ch[i][j+x]!='.') break; else l++;}    }    if(x==5 && l<=1) return true;    l = 0;    for(x = 0;x<=4;x++){     if(ch[i-x][j+x]!='X'){ if(ch[i-x][j+x]!='.') break; else l++;}    }    if(x==5 && l<=1) return true;    }   }   if(i<=5){    int x = 0;    int l = 0;    for(x = 0;x<=4;x++){    if(ch[i+x][j]!='X'){ if(ch[i+x][j]!='.') break; else l++;}    }    if(x==5 && l<=1) return true;    l = 0;    if(j>=4){    for(x = 0;x<=4;x++){     if(ch[i+x][j-x]!='X'){ if(ch[i+x][j-x]!='.') break; else l++;}    }    if(x==5 && l<=1) return true;     l =0;    for(x = 0;x<=4;x++){     if(ch[i][j-x]!='X'){ if(ch[i][j-x]!='.') break; else l++;}    }    if(x==5 && l<=1) return true;    }    if(j<=5){    l = 0;    for(x = 0;x<=4;x++){     if(ch[i][j+x]!='X'){ if(ch[i][j+x]!='.') break; else l++;}    }    if(x==5 && l<=1) return true;    l = 0;    for(x = 0;x<=4;x++){     if(ch[i+x][j+x]!='X'){ if(ch[i+x][j+x]!='.') break; else l++;}    }    if(x==5 && l<=1) return true;    }   }   }   else{    if(i>=4){    int x = 0;    int l = 0;    for(x = 0;x<=4;x++){     if(ch[i-x][j]!='X'){ if(ch[i-x][j]!='.') break;else l++;}    }    if(x==5 && l<=0) return true;    l = 0;    if(j>=4){     for(x = 0;x<=4;x++){     if(ch[i-x][j-x]!='X'){ if(ch[i-x][j-x]!='.') break; else l++;}     }     if(x==5 && l<=0) return true;     l =0;     for(x = 0;x<=4;x++){     if(ch[i][j-x]!='X'){ if(ch[i][j-x]!='.') break; else l++;}     }     if(x==5 && l<=0) return true;    }    if(j<=5){     l = 0;     for(x = 0;x<=4;x++){     if(ch[i][j+x]!='X'){ if(ch[i][j+x]!='.') break; else l++;}     }     if(x==5 && l<=0) return true;     l = 0;     for(x = 0;x<=4;x++){     if(ch[i-x][j+x]!='X'){ if(ch[i-x][j+x]!='.') break; else l++;}     }     if(x==5 && l<=0) return true;    }    }    if(i<=5){    int x = 0;    int l = 0;    for(x = 0;x<=4;x++){     if(ch[i+x][j]!='X'){ if(ch[i+x][j]!='.') break; else l++;}    }    if(x==5 && l<=0) return true;    l = 0;    if(j>=4){     for(x = 0;x<=4;x++){     if(ch[i+x][j-x]!='X'){ if(ch[i+x][j-x]!='.') break; else l++;}     }     if(x==5 && l<=0) return true;     l =0;     for(x = 0;x<=4;x++){     if(ch[i][j-x]!='X'){ if(ch[i][j-x]!='.') break; else l++;}     }     if(x==5 && l<=0) return true;    }    if(j<=5){     l = 0;     for(x = 0;x<=4;x++){     if(ch[i][j+x]!='X'){ if(ch[i][j+x]!='.') break; else l++;}     }     if(x==5 && l<=0) return true;     l = 0;     for(x = 0;x<=4;x++){     if(ch[i+x][j+x]!='X'){ if(ch[i+x][j+x]!='.') break; else l++;}     }     if(x==5 && l<=0) return true;    }    }   }   ch[i][j] = c;      return false;   }   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,temb = null;    while(temp!=null){     temb = temp;     if(x>temp.data) temp = temp.right;     else temp = temp.left;    }    if(x>temb.data) temb.right = n;    else temb.left = n;    n.parent = temb;    parent.add(temb.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;   }   }   static long findDiff(long[] arr, long[] brr, int m){   int i = 0, j = 0;   long fa = 1000000000000L;   while(i<m && j<m){    long x = arr[i]-brr[j];    if(x>=0){    if(x<fa) fa = x;    j++;    }    else{    if((-x)<fa) fa = -x;    i++;    }   }   return fa;   }   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 long modInverse(long a, long mOD2){      return power(a, mOD2-2, mOD2);   }   static 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;   }   static long d,x,y;   public static void extendedEuclidian(long a, long b){   if(b == 0) {     d = a;     x = 1;     y = 0;    }    else {     extendedEuclidian(b, a%b);     int temp = (int) x;     x = y;     y = temp - (a/b)*y;    }   }     public static long gcd(long n, long m){   if(m!=0) return gcd(m,n%m);   else return n;   }     static BufferedReader reader;   static StringTokenizer tokenizer;   static PrintWriter writer;          static class FasterScanner {     private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar, snumChars;   private SpaceCharFilter filter;     public FasterScanner(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);   }   }  }
2	public class Main {  FastScanner in;  PrintWriter out;  private void solve() throws IOException {   solveB();  }  private void solveA() throws IOException {   int n = in.nextInt(), k = in.nextInt();   int[] cnt = new int[k];   for (int i = 0; i < n; i++)    cnt[in.nextInt() - 1] ^= 1;   int ans = 0;   for (int i = 0; i < k; i++)    ans += cnt[i];   out.println(n - ans + (ans + 1) / 2);  }  private void solveB() throws IOException {   long n = in.nextLong();   long c = (n + in.nextLong()) * 2;   long l = 0, r = (long) 1e9;   while (l + 1 < r) {    long m = (l + r) / 2;    if (m * m + 3 * m >= c)     r = m;    else     l = m;   }   out.println(n-r);  }  private void solveC() throws IOException {  }  private void solveD() throws IOException {  }  private void solveE() throws IOException {  }  class FastScanner {   StringTokenizer st;   BufferedReader br;   FastScanner(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }   String next() throws IOException {    while (st == null || !st.hasMoreTokens())     st = new StringTokenizer(br.readLine());    return st.nextToken();   }   boolean hasNext() throws IOException {    return br.ready() || (st != null && st.hasMoreTokens());   }   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 {    return br.readLine();   }   boolean hasNextLine() throws IOException {    return br.ready();   }  }  private void run() throws IOException {   in = new FastScanner(System.in);   out = new PrintWriter(System.out);    for (int t = 1; t-- > 0; )    solve();   out.flush();   out.close();  }  public static void main(String[] args) throws IOException {   new Main().run();  } }
0	public class Main {   public static void main(String[] args) {   Scanner scanner = new Scanner(System.in);   long n = scanner.nextLong();   long x = scanner.nextLong(), y = scanner.nextLong();   long whiteSteps, blackSteps;   if(x == 1 || y == 1){    whiteSteps = (x - 1) + (y - 1);   } else {    whiteSteps = Math.min((x - 1) + Math.abs(y - x), (y - 1) + Math.abs(y - x));   }   if(x == n || y == n){    blackSteps = (n - x) + (n - y);   } else {    blackSteps = Math.min((n - x) + Math.abs(y - x), (n - y) + Math.abs(y - x));   }   if (whiteSteps <= blackSteps){    System.out.println("White");   } else {    System.out.println("Black");   }  } }
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 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"); } }
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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   int n;   ArrayList<Integer>[] adj;   long[] mem;   long cycles(int cur, int start, int visited) {    if (cur == start && visited > 0) {     return Integer.bitCount(visited) >= 3 ? 1 : 0;    }    int index = n * visited + cur;    if (mem[index] != -1) return mem[index];    long res = 0;    int newvisited = visited | (1 << cur);    for (int nxt : adj[cur]) {     if (nxt >= start && (nxt == start || ((visited >> nxt) & 1) == 0)) {      res += cycles(nxt, start, newvisited);     }    }    return mem[index] = res;   }   public void solve(int testNumber, InputReader in, OutputWriter out) {    n = in.readInt();    int m = in.readInt();    adj = new ArrayList[n];    mem = new long[n * (1 << n)];    for (int i = 0; i < adj.length; i++) adj[i] = new ArrayList<>();    for (int i = 0; i < m; i++) {     int a = in.readInt() - 1, b = in.readInt() - 1;     adj[a].add(b);     adj[b].add(a);    }    long res = 0;    for (int start = 0; start < n; start++) {     Arrays.fill(mem, -1);     res += cycles(start, start, 0) / 2;    }    out.printLine(res);   }  }  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 close() {    writer.close();   }   public void printLine(long 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 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);   }  } }
1	public class Solution {  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++) {    pw.println(solve(sc,pw));      }        pw.close();  }       public static String solve(FastScanner sc, PrintWriter pw) {   int n = sc.ni();   long cur1 = 2;   long cur2 = 4;   long block = 2;   long block2 = 4;   int tmp = 3;   while(cur1<=n||cur2<=n){    if(cur1==n||cur2==n){     return "YES";    }    if(cur1<n){     cur1+=block*tmp;    }    if(cur2<n){     cur2+=block2*tmp;    }    tmp+=2;   }   return "NO";      }                                   public static void printArr(PrintWriter pw,int[] a){   for(int i = 0;i<a.length;i++){    pw.print(a[i]);    if(i!=a.length-1){     pw.print(" ");    }   }   pw.println();  }  public static void print2d(PrintWriter pw,int[][] a){   for(int j=0;j<a.length;j++){    for(int i = 0;i<a[j].length;i++){     pw.print(a[j][i]);     if(i!=a[j].length-1){      pw.print(" ");     }    }    pw.println(" ");   }   pw.println();  }  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);  }  public static int stoi(String s){   return Integer.parseInt(s);  } } 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;  }  int[][] to2di(int m, int n){   int[][] ans = new int[m][n];   for(int i = 0;i<m;i++){    String[] r = nextLine().split("[ ]");    for(int j = 0;j<n;j++){     ans[i][j] = Integer.parseInt(r[j]);    }   }   return ans;  }  long[][] to2dl(int m, int n){   long[][] ans = new long[m][n];   for(int i = 0;i<m;i++){    String[] r = nextLine().split("[ ]");    for(int j = 0;j<n;j++){     ans[i][j] = Long.parseLong(r[j]);    }   }   return ans;  }   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;  } }
6	public class Template implements Runnable {  BufferedReader in;  PrintWriter out;  StringTokenizer tok = new StringTokenizer("");  void init() throws FileNotFoundException {   try {    in = new BufferedReader(new FileReader("input.txt"));    out = new PrintWriter("output.txt");   } catch (Exception e) {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);   }  }  class GraphBuilder {   int n, m;   int[] x, y;   int index;   int[] size;    GraphBuilder(int n, int m) {    this.n = n;    this.m = m;    x = new int[m];    y = new int[m];    size = new int[n];   }   void add(int u, int v) {    x[index] = u;    y[index] = v;    size[u]++;    size[v]++;    index++;   }   int[][] build() {    int[][] graph = new int[n][];    for (int i = 0; i < n; i++) {     graph[i] = new int[size[i]];    }    for (int i = index - 1; i >= 0; i--) {     int u = x[i];     int v = y[i];     graph[u][--size[u]] = v;     graph[v][--size[v]] = u;    }    return graph;   }  }  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());  }  int[] readIntArray(int size) throws IOException {   int[] res = new int[size];   for (int i = 0; i < size; i++) {    res[i] = readInt();   }   return res;  }  long[] readLongArray(int size) throws IOException {   long[] res = new long[size];   for (int i = 0; i < size; i++) {    res[i] = readLong();   }   return res;  }  long readLong() throws IOException {   return Long.parseLong(readString());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  <T> List<T>[] createGraphList(int size) {   List<T>[] list = new List[size];   for (int i = 0; i < size; i++) {    list[i] = new ArrayList<>();   }   return list;  }  public static void main(String[] args) {   new Template().run();    }  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");  }  public void run() {   try {    timeBegin = System.currentTimeMillis();    memoryTotal = Runtime.getRuntime().freeMemory();    init();    solve();    out.close();    if (System.getProperty("ONLINE_JUDGE") == null) {     time();     memory();    }   } catch (Exception e) {    e.printStackTrace();    System.exit(-1);   }  }  void solve() throws IOException {   int n = readInt();   int m = readInt();   int max = 1 << n;   long[][] dp = new long[n][max];   for (int i = 0; i < n; i++) {    dp[i][1 << i] = 1;   }   GraphBuilder gb = new GraphBuilder(n, m);   for (int i = 0; i < m; i++) {    gb.add(readInt() - 1, readInt() - 1);   }   int[][] graph = gb.build();   for (int mask = 1; mask < max; mask++) {    int firstBit = -1;    for (int i = 0; i < n; i++) {     if (hasBit(mask, i)) {      firstBit = i;      break;     }    }    for (int last = 0; last < n; last++) {     if (dp[last][mask] == 0) continue;     for (int y : graph[last]) {      if (!hasBit(mask, y) && y > firstBit) {       dp[y][mask | (1 << y)] += dp[last][mask];      }     }    }   }   long answer = 0;   for (int i = 1; i < max; i++) {    if (Integer.bitCount(i) < 3) continue;    int firstBit = -1;    for (int j = 0; j < n; j++) {     if (hasBit(i, j)) {      firstBit = j;      break;     }    }    for (int y : graph[firstBit]) {     answer += dp[y][i];    }   }   out.println(answer / 2);  }  boolean hasBit(int mask, int bit) {   return (mask & (1 << bit)) != 0;  } }
4	public class SolutionD extends Thread {  static class FastReader {   BufferedReader br;   StringTokenizer st;   public FastReader() {    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 parseInt(next());   }   long nextLong() {    return parseLong(next());   }   double nextDouble() {    return parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  }  private static final FastReader scanner = new FastReader();  private static final PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) {   solve();   out.close();  }  private static void solve() {   int n = scanner.nextInt();   int m = scanner.nextInt();   int k = scanner.nextInt();   int[][] hori = new int[n][m-1];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m-1; j++) {     int xij = scanner.nextInt();     hori[i][j] = xij;    }   }   int[][] vert = new int[n-1][m];   for (int i = 0; i < n-1; i++) {    for (int j = 0; j < m; j++) {     int xij = scanner.nextInt();     vert[i][j] = xij;    }   }   if (k % 2 != 0) {    for (int i = 0; i < n; i++) {     StringBuilder s = new StringBuilder();     for (int j = 0; j < m; j++) {      s.append("-1 ");     }     out.println(s);    }    return;   }   k /= 2;   long[][][] dp = new long[n][m][k+1];   for (int kTmp = 1; kTmp <= k; kTmp++) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      dp[i][j][kTmp] = Integer.MAX_VALUE;      if (i > 0) {       dp[i][j][kTmp] = Math.min(dp[i][j][kTmp], dp[i-1][j][kTmp-1] + 2L * vert[i - 1][j]);      }      if (j > 0) {       dp[i][j][kTmp] = Math.min(dp[i][j][kTmp], dp[i][j-1][kTmp-1] + 2L * hori[i][j - 1]);      }      if (i + 1 < n) {       dp[i][j][kTmp] = Math.min(dp[i][j][kTmp], dp[i+1][j][kTmp-1] + 2L * vert[i][j]);      }      if (j + 1 < m) {       dp[i][j][kTmp] = Math.min(dp[i][j][kTmp], dp[i][j+1][kTmp-1] + 2L * hori[i][j]);      }     }    }   }   for (int i = 0; i < n; i++) {    StringBuilder s = new StringBuilder();    for (int j = 0; j < m; j++) {     s.append(dp[i][j][k]).append(" ");    }    out.println(s);   }  } }
3	public class Solution{   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 sc = new FastReader();   int n = sc.nextInt();   int m = sc.nextInt();   int[] arr = new int[105];     for(int i=0;i<m;i++){    int a = sc.nextInt();    arr[a]++;   }     for(int i=1;i<=1000;i++){    int sum=0;       for(int a:arr){     if(a!=0){      sum+=(a/i);     }    }           if(sum<n){     System.out.println(i-1);     return;    }      }  } }
5	public class Main {  public static void main(String[] args) throws Exception {   MyScanner scan = new MyScanner();   out = new PrintWriter(new BufferedOutputStream(System.out));   int n = scan.nextInt();   int[] vals = new int[n];   for (int i = 0; i < n; i++) {    vals[i] = scan.nextInt();   }   for (int i = 0; i < n; i++) {    if (solve(i, vals)) {     out.print('A');    } else {     out.print('B');    }   }   out.close();  }  static HashMap<Integer, Boolean> dpResult = new HashMap<>();  private static boolean solve(int pos, int[] vals) {   if (dpResult.containsKey(pos)) return dpResult.get(pos);   int val = vals[pos];   boolean hasLose = false;   for (int i = pos; i < vals.length; i += val) {    if (i == pos) continue;    if (vals[i] <= vals[pos]) continue;    if (hasLose) break;    if (!solve(i, vals)) {     hasLose = true;    }   }   for (int i = pos; i >= 0; i -= val) {    if (i == pos) continue;    if (vals[i] <= vals[pos]) continue;    if (hasLose) break;    if (!solve(i, vals)) {     hasLose = true;    }   }   dpResult.put(pos, hasLose);   return hasLose;  }    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 A {    public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   HashSet<Integer> set = new HashSet<Integer>();     for ( int i = 0 ; i < n ; ++i ) {    set.add(sc.nextInt());   }      ArrayList<Integer> list = new ArrayList<Integer>(set);   Collections.sort(list);   if(list.size() > 1)   System.out.println(list.get(1));   else    System.out.println("NO");  } }
0	public class N1_CF_199A {  public static void main(String[] args) {  int n = new Scanner(System.in).nextInt();  if( n == 0)  {   System.out.println(0);   System.out.println(0);   System.out.println(0);   return;  }  int i = 0 , j = 1;  while(true)  {   int t = i + j;   if( t == n)   break;   i = j;   j = t;  }  System.out.println(i);  System.out.println(j);  System.out.println(0);  } }
5	public class Village { static Scanner in = new Scanner( new BufferedReader( new InputStreamReader( System.in ) ) );  public static void main( String[] args ) {  int n = in.nextInt(), t = 2*in.nextInt(), h[][] = new int[n][2], ans = 2;  for( int i = 0; i < n; i++ )  {  h[i][0] = 2*in.nextInt();  h[i][1] = in.nextInt();  }  Arrays.sort( h, new Comp() );  for( int i = 1; i < n; i++ )  {  int d = (h[i][0]-h[i][1])-(h[i-1][0]+h[i-1][1]);  if( d>t ) ans += 2;  if( d==t ) ans++;  }  System.out.println( ans ); }  static class Comp implements Comparator<int[]> {  public int compare( int[] a, int[] b ) { return a[0]-b[0]; } } }
5	public class Main implements Runnable { public void solution() throws IOException {  int n = in.nextInt();  int[] a = new int[n];  int min = Integer.MAX_VALUE;  for (int i = 0; i < n; ++i) {  a[i] = in.nextInt();  if (a[i] < min) {   min = a[i];  }  }  int res = Integer.MAX_VALUE;  for (int i = 0; i < n; ++i) {  if (a[i] != min && a[i] < res) {   res = a[i];  }  }  if (res == Integer.MAX_VALUE) {  out.println("NO");  } else {  out.println(res);  } }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Throwable e) {  e.printStackTrace();  System.exit(1);  } }  private class Scanner {  private BufferedReader reader;  private StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  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 int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
3	public class Paint {  public static void main (String srgs[] ){     Scanner sc=new Scanner(System.in);   int n=sc.nextInt();   TreeSet<Integer> ts=new TreeSet<>();   for(int i=0;i<n;++i){    ts.add(sc.nextInt());   }   int x=0;   int a[]=new int[ts.size()];   for(int y:ts){    a[x++]=y;   }   for(int i=0;i<ts.size()-1;++i){    for(int j=i+1;j<ts.size();++j){     if((a[i]!=-1)&&(a[j]!=-1)&&(a[j]%a[i]==0)){      a[j]=-1;     }    }   }   int c=0;   for(int z:a){    if(z!=-1)++c;   }   System.out.print(c);  } }
3	public class CF1003E{  public static void main(String args[]) throws IOException{   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   String[] s = br.readLine().split(" ");   int n = Integer.parseInt(s[0]);   int d = Integer.parseInt(s[1]);   int k = Integer.parseInt(s[2]);   StringBuffer sb = new StringBuffer();   int[] rem = new int[n];   int[] deg = new int[n];   int i = 0;   if(k == 1){    if(n <= 2){    }else{     System.out.println("NO");     return;    }   }   for(i=0;i<d;i++){    if(i>=n-1){     System.out.println("NO");     return;    }    sb.append((i+1) +" " + (i+2)+"\n");    rem[i] = Math.min(i, d-i);    deg[i]++;    if(i+1<n)    deg[i+1]++;   }   if(i<n){    rem[i] = 0;    deg[i] = 1;   }   i++;   int j = 0;   for(;i<n;i++){       while(true){     if(j>=n){      System.out.println("NO");      return;     }     if(rem[j] > 0 && deg[j]<k){      deg[j]++;      rem[i] = rem[j] - 1;      sb.append((j+1)+" "+(i+1)+"\n");      deg[i]++;      break;     }else{      j++;     }    }   }   System.out.println("YES");   System.out.println(sb);  } }
0	public class A {  private static BufferedReader in;  private static StringTokenizer st;  private static PrintWriter out;   public static void main(String[] args) throws NumberFormatException, IOException {   in = new BufferedReader(new InputStreamReader(System.in));   st = new StringTokenizer("");   out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   int n = nextInt();   int max = n;   max = Math.max(max, n / 10);   max = Math.max(max, (n / 100) * 10 + n % 10);   System.out.println(max);  }    static String next() throws IOException{   while(!st.hasMoreTokens()){    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  static int nextInt() throws NumberFormatException, IOException{   return Integer.parseInt(next());  }  static long nextLong() throws NumberFormatException, IOException{   return Long.parseLong(next());  }   static double nextDouble() throws NumberFormatException, IOException{   return Double.parseDouble(next());  } }
4	public class ProblemD {  static int n;  static int m;  static boolean[][] fire;   public static void main(String[] args) throws FileNotFoundException {   Scanner sc = new Scanner(new File("input.txt"));   n = sc.nextInt();   m = sc.nextInt();   int k = sc.nextInt();   fire = new boolean[n][m];   Queue<Pos> q = new LinkedList<Pos>();   for (int i = 0; i < k; i++) {    int x = sc.nextInt();    int y = sc.nextInt();    q.add(new Pos(x - 1, y - 1));    fire[x - 1][y - 1] = true;   }   int[] di = new int[] { 1, -1, 0, 0 };   int[] dj = new int[] { 0, 0, 1, -1};   Pos last = null;   while (q.size() > 0) {    Pos pos = q.poll();    last = pos;    for (int kk = 0; kk < 4; kk++) {     int ni = pos.i + di[kk];     int nj = pos.j + dj[kk];     if (ni >= 0 && nj >= 0 && ni < n && nj < m) {      if (!fire[ni][nj]) {       fire[ni][nj] = true;       q.add(new Pos(ni, nj));      }     }    }   }   PrintWriter out = new PrintWriter(new File("output.txt"));   out.println((last.i + 1) + " " + (last.j + 1));   out.flush();   out.close();  }   } class Pos {   int i, j;  public Pos(int i, int j) {   super();   this.i = i;   this.j = j;  }  @Override  public int hashCode() {   final int prime = 31;   int result = 1;   result = prime * result + i;   result = prime * result + j;   return result;  }  @Override  public boolean equals(Object obj) {   if (this == obj)    return true;   if (obj == null)    return false;   if (getClass() != obj.getClass())    return false;   Pos other = (Pos) obj;   if (i != other.i)    return false;   if (j != other.j)    return false;   return true;  }    };
6	public class Songs {  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[1000000];    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 int findPos(int x, int ar[]){   for(int i=0;i<ar.length;i++){    if(ar[i]==x)     return (i+1);   }   return -20;  }  public static void main(String args[])throws IOException{   Reader sc=new Reader();   PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   int i,j;   int n=sc.nextInt();   int tt=sc.nextInt();   int t[]=new int[n];   int g[]=new int[n];   int last=0;   int M=1000000007;   long sum=0;   for(i=0;i<n;i++){    t[i]=sc.nextInt();    g[i]=sc.nextInt()-1;   }   int d[][]=new int[1<<n][4];   d[0][3]=1;   for(i=0;i<(1<<n);i++){    for(last=0;last<4;last++){     for(j=0;j<n;j++){      if(g[j]!=last&&((i&(1<<j)))==0){       d[i^(1<<j)][g[j]]=(d[i^(1<<j)][g[j]]+d[i][last])%M;            }     }    }    int dur=0;    for(j=0;j<n;j++){     if((i&(1<<j))>0){      dur+=t[j];     }    }    if(dur==tt){         sum=(sum+d[i][0]+d[i][1]+d[i][2])%M;    }   }   pw.println(sum);   pw.close();  } }
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;  } } }
6	public class Main implements Runnable { private void solution() throws IOException {  int n = in.nextInt();  int m = in.nextInt();  boolean[][] adj = new boolean[n][n];  long res = 0;  for (int i = 0; i < m; ++i) {  int x = in.nextInt();  int y = in.nextInt();  adj[x - 1][y - 1] = true;  adj[y - 1][x - 1] = true;  }  for (int i = 0; i < n; ++i) {  for (int j = i + 1; j < n; ++j) {   if (adj[i][j]) {   --res;   }  }  }  for (int i = 0; i < n; ++i) {  long[][] dp = new long[1 << (n - i)][n - i];  dp[0][0] = 1;  for (int mask = 0; mask < (1 << (n - i)); ++mask) {   for (int j = 0; j < n - i; ++j) {   if (dp[mask][j] != 0) {    for (int k = 0; k < n - i; ++k) {    if (((mask >> k) & 1) == 0 && adj[j + i][k + i]) {     dp[mask | (1 << k)][k] += dp[mask][j];    }    }   }   }   if (((mask >> 0) & 1) != 0) {   res += dp[mask][0];   }  }  }  out.println(res / 2); }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  private class Scanner {  BufferedReader reader;  StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  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 int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
6	public class T { static Scanner in = new Scanner(); static PrintWriter out = new PrintWriter(System.out); static boolean adj[][]; static int n, m, from; static long memo[][]; static long Num_Cycle;  public static void main(String[] args) throws IOException {  n = in.nextInt();  m = in.nextInt();  adj = new boolean[n][n];  memo = new long[n][1 << n];  for (int i = 0; i < m; i++) {  int u = in.nextInt() - 1;  int v = in.nextInt() - 1;  adj[u][v] = adj[v][u] = true;  }  for (long arr[] : memo) {  Arrays.fill(arr, -1);  }  Num_Cycle = 0L;  for (int i = 0; i < n; i++) {  from = i;  Num_Cycle += dp(from, (1 << i));  }  out.println(Num_Cycle / 2);  out.flush();  out.close(); }  static long dp(int start, int mask) {  if (memo[start][mask] != -1) {  return (memo[start][mask]);  }  long ans = 0L;  if (adj[start][from] && Integer.bitCount(mask) >= 3) {                            ans++;  }  for (int i = from + 1; i < n; i++) {  if (adj[start][i] && ((mask & (1 << i)) == 0)) {   ans += dp(i, mask | (1 << i));  }  }  return memo[start][mask] = ans; }  static class Scanner {  BufferedReader br;  StringTokenizer st;  Scanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  Scanner(String file) throws FileNotFoundException {  br = new BufferedReader(new FileReader(file));  }  String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(next());  }  String nextLine() throws IOException {  return br.readLine();  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  } }
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();  }  } }
3	public class Main {  static PrintWriter out; static InputReader ir;  static void solve() {  int n = ir.nextInt();  int[] a = ir.nextIntArray(n);  Arrays.sort(a);  boolean[] used = new boolean[n];  int ct = 0;  for (int i = 0; i < n; i++) {  if (used[i])   continue;  for (int j = i + 1; j < n; j++) {   if (a[j] % a[i] == 0)   used[j] = true;  }  ct++;  }  out.println(ct); }  public static void main(String[] args) {  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;  } }  static void tr(Object... o) {  out.println(Arrays.deepToString(o)); } }
6	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(); }  int findLSB(long n)  {   long value=-n&n;   return map.get(value);  } void findMaxClique(long mask,int size)  {   if(mask==0)   {    if(size>maxClique)     maxClique=size;    return;    }   while(mask>0)   {    if(Long.bitCount(mask)+size<=maxClique)     return;    int lsb=findLSB(mask);    mask=mask^((long)1<<lsb);    findMaxClique(mask&edges[lsb],size+1);   }  }  long edges[];  HashMap<Long,Integer> map=new HashMap<>();  int maxClique; public void run() {  InputReader sc= new InputReader(System.in);  PrintWriter w= new PrintWriter(System.out);   long value=1;   for(int i=0;i<45;i++)   {    map.put(value,i);    value*=2;   }   int n=sc.nextInt();  int k=sc.nextInt();   edges=new long[n];   for(int i=0;i<n;i++)   {    for(int j=0;j<n;j++)    {     long connect=sc.nextLong();     if(j>i&&connect==1)      edges[i]|=(connect<<j);    }   }   findMaxClique(((long)1<<n)-1,0);     double size=(double)maxClique;   double perCastle=(double)k/size;   double ans=perCastle*perCastle*(size*(size-1))/2;   w.print(ans);  w.close();  } }
4	public class A_GENERAL {     static StringBuilder sb = new StringBuilder(); static long seive_size = (long) 1e6; static String alpha = "abcdefghijklmnopqrstuvwxyz";  static ArrayList<Integer> primes = new ArrayList<>();  static boolean[] seive_set = new boolean[(int) seive_size+1];  static int n, m, k;  static ArrayList<Integer>[] adj;  static boolean[] vis;  static ArrayDeque<Integer> q = new ArrayDeque<>();  static final long MOD = 998244353;  static int[] dx = new int[] {1, 0, -1, 0, 1, -1, 1, -1};  static int[] dy = new int[] {0, 1, 0, -1, -1, 1, 1, -1};  static long[][] arr;  static int[] rank;  static int[] parent;  static int[] s;  static long[] a;  public static void main(String[] args) throws FileNotFoundException {   Scanner sc = new Scanner(new File("input.txt"));  PrintWriter out = new PrintWriter("output.txt");  n = sc.nextInt();  m = sc.nextInt();  k = sc.nextInt();  ArrayDeque<iPair> qq = new ArrayDeque<>();  boolean[][] vis = new boolean[n+1][m+1];  for(int i = 0; i < k; i++) {  int u = sc.nextInt();  int v = sc.nextInt();  qq.add(new iPair(u, v));  vis[u][v] = true;  }  iPair last = null;  while(!qq.isEmpty()) {  iPair pp = qq.poll();  int i = pp.f;  int j = pp.s;  if(isValid(i-1, j) && !vis[i-1][j]) {   qq.add(new iPair(i-1, j));   vis[i-1][j] = true;  }  if(isValid(i+1, j) && !vis[i+1][j]) {   qq.add(new iPair(i+1, j));   vis[i+1][j] = true;  }  if(isValid(i, j-1) && !vis[i][j-1]) {   qq.add(new iPair(i, j-1));   vis[i][j-1] = true;  }  if(isValid(i, j+1) && !vis[i][j+1]) {   qq.add(new iPair(i, j+1));   vis[i][j+1] = true;  }  last = pp;  }  out.println(last.f + " " + last.s);  sc.close();  out.close(); }  public static boolean isValid(int i, int j) {  if(i < 1 || i > n || j < 1 || j > m) return false;  return true;  }  public static class Triplet implements Comparable<Triplet> {  int x;  int y;  int z;  Triplet(int x, int y, int z) {   this.x = x;   this.y = y;   this.z = z;  }  public int compareTo(Triplet o) {   return Integer.compare(this.x, o.x);  }  }  public static class iPair implements Comparable<iPair> {  int f;  int s;  iPair(int f, int s) {   this.f = f;   this.s = s;  }  public int compareTo(iPair o) {   return Integer.compare(this.f, o.f);  }  }   public static class Pair implements Comparable<Pair>{  long f;  long s;  Pair(long f, long s) {  this.f = f;  this.s = s;  }  public int compareTo(Pair o) {  return Long.compare(this.f, o.f);  } } public static void init(int n) {  adj = new ArrayList[n+1];  vis = new boolean[n+1];  parent = new int[n+1];  rank = new int[n+1];  for(int i = 0; i <= n; i++) {   adj[i] = new ArrayList<>();   parent[i] = i;  rank[i] = 0;  }  }   public static String mp(String s, int times) {  return String.valueOf(new char[times]).replace("\0", s); }   public static long log2(long k) {  return 63-Long.numberOfLeadingZeros(k);  }    public static void lambdaSort() {   Arrays.sort(arr, (a, b) -> Double.compare(a[0], b[0]));  }     public static long choose(long n, long k) {  return (k == 0) ? 1 : (n*choose(n-1, k-1))/k;  }    public static long gcd(long a, long b) {  return (a == 0) ? b : gcd(b%a, a);  }   public static long max(long... as) {   long max = Long.MIN_VALUE;   for (long a : as) max = Math.max(a, max);   return max;  }  public static long min(int... as) {   long min = Long.MAX_VALUE;   for (long a : as) min = Math.min(a, min);   return min;  }   public static long modpow(long x, long n, long mod) {  if(n == 0) return 1%mod;  long u = modpow(x, n/2, mod);  u = (u*u)%mod;  if(n%2 == 1) u = (u*x)%mod;  return u;  }   public static int lowerBound(long[] a, int x) {  int lo = 0;  int hi = a.length-1;  int ans = -1;  while(lo <= hi) {   int mid = (lo+hi)/2;   if(x < a[mid]) {   hi = mid-1;   } else if(x > a[mid]) {   lo = mid+1;   } else if(lo != hi) {    hi = mid-1;     ans = mid;   } else {   return mid;   }  }  return ans; }  public static int upperBound(long[] a, long x) {  int lo = 0;  int hi = a.length-1;  int ans = -1;  while(lo <= hi) {  int mid = (lo+hi)/2;  if(x < a[mid]) {   hi = mid-1;  } else if(x > a[mid]) {   lo = mid+1;  } else if(lo != hi) {   lo = mid+1;    ans = mid;  } else {   return mid;  }  }  return ans; }     public static void generatePrimes() {     Arrays.fill(seive_set, true);  seive_set[0] = false;  seive_set[1] = false;  for(int i = 2; i <= seive_size; i++) {  if(seive_set[i]) {   for(long j = (long) i*i; j <= seive_size; j+=i)    seive_set[(int)j] = false;   primes.add(i);  }  } }  public static boolean isPrime(long N) {  if(N <= seive_size) return seive_set[(int)N];  for (int i = 0; i < (int)primes.size(); i++)  if (N % primes.get(i) == 0) return false;  return true; }     public static void permute(String str) {  permute(str, 0, str.length()-1);  }  public static void permute(String str, int l, int r)  {   if (l == r)    System.out.println(str);   else   {    for (int i = l; i <= r; i++)    {     str = swap(str,l,i);     permute(str, l+1, r);     str = swap(str,l,i);    }   }  } public static String swap(String a, int i, int j)  {   char temp;   char[] charArray = a.toCharArray();   temp = charArray[i] ;   charArray[i] = charArray[j];   charArray[j] = temp;   return String.valueOf(charArray);  }        public static int find(int u) {  if(parent[u] == u) return u;  int v = find(parent[u]);  parent[u] = v;  return v;  } public static boolean connected(int u, int v) {  return find(u) == find(v); } public static void Union(int u, int v) {  int x = find(u);    int y = find(v);    if(x == y) return;  if(rank[x] == rank[y]) {  parent[y] = x;  rank[x]++;  }  else if(rank[x] > rank[y]) {  parent[y] = x;  }  else {  parent[x] = y;  }  }               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;}  int[] nextIntArray(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }   int[] nextIntArray(int n, int delta) {    int[] a = new int[n];    for (int i = 0; i < n; i++)     a[i] = nextInt() + delta;    return a;   }   long[] nextLongArray(int n) {    long[] a = new long[n];    for (int i = 0; i < n; i++)     a[i] = nextLong();    return a;   } } }
0	public class RationalResistance { static long n = 0;  static void R(long a, long b) {  n += a / b;  a %= b;  if (a == 0) {  return;  }  R(b, a); }  public static void main(String[] args) {  Scanner cin = new Scanner(System.in);  long a = cin.nextLong();  long b = cin.nextLong();  cin.close();  R(a, b);  System.out.println(n); } }
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();  } }
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))); }
3	public class Main{  int[] ints; int[] prefix;  public static void main(String[] args) {  new Main().run(); }  public void run() {  Scanner file = new Scanner(System.in);  int N = file.nextInt();  ints = new int[N];  for(int i = 0;i<N;i++)  ints[i] = file.nextInt();  prefix = new int[N];  prefix[0] = ints[0];  for(int i =1;i<prefix.length;i++)  prefix[i] = prefix[i-1]+ints[i];  HashMap<Integer,Integer> ending = new HashMap<>();  HashMap<Integer,Integer> amount = new HashMap<>();  for(int end = 0;end<prefix.length;end++)  {  for(int start = 0;start<=end;start++)  {   int sum = sum(start,end);   if(!ending.containsKey(sum))   ending.put(sum, -1);   if(!amount.containsKey(sum))   amount.put(sum,0);   if(ending.get(sum)<start)   {   amount.put(sum,amount.get(sum)+1);   ending.put(sum,end);   }  }  }  int max = 0;  int maxnum = -1;  for(int x:amount.keySet())  {  if(amount.get(x)>max)  {   max = amount.get(x);   maxnum = x;  }  }  System.out.println(max);  HashMap<Integer,Integer> occurrence = new HashMap<Integer,Integer>();  occurrence.put(0,0);  for(int i = 0;i<prefix.length;i++)  {  if(occurrence.containsKey(prefix[i]-maxnum))  {   System.out.println(occurrence.get(prefix[i]-maxnum)+1+" "+(i+1));   occurrence.clear();  }  occurrence.put(prefix[i],i+1);  } }  public int sum(int L, int R) {  return prefix[R] - prefix[L] + ints[L]; }  }
6	public class ASimpleTask {  public static void main(String args[]) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[][] d = new int[n][n];   for (int i = 0, m = sc.nextInt(); i < m; i++) {    int a = sc.nextInt() - 1, b = sc.nextInt() - 1;    d[a][b] = 1;    d[b][a] = 1;   }   long[][] dp = new long[1 << n][n];      for (int mask = 1; mask < 1 << n; mask++) {    int start = numberOfTrailingZeros(mask);    if (bitCount(mask) == 1) {     dp[mask][start] = 1;     continue;    }    for (int i = 0; i < n; i++) {     if ((mask & (1 << i)) > 0 && i != start) {      int xmask = mask ^ (1 << i);      for (int j = 0; j < n; j++) {       if (d[j][i] > 0) {        dp[mask][i] += dp[xmask][j];       }      }     }    }   }      long sum = 0;   for (int mask = 1; mask < 1 << n; mask++) {    if (bitCount(mask) >= 3) {     for (int i = 0; i < n; i++) {      if (d[numberOfTrailingZeros(mask)][i] > 0) {       sum += dp[mask][i];      }     }    }   }   out.print(sum / 2);  } }
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);  } }
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);   F1BlokiRavnoiSummiProstayaRedakciya solver = new F1BlokiRavnoiSummiProstayaRedakciya();   solver.solve(1, in, out);   out.close();  }  static class F1BlokiRavnoiSummiProstayaRedakciya  {   InputReader in;   Map<Long, List<F1BlokiRavnoiSummiProstayaRedakciya.Block>> sums;   public void solve(int testNumber, InputReader in, PrintWriter out)   {    this.in = in;    int n = ni();    long[] a = nla(n);    sums = new HashMap<>();    for (int i = 0; i < n; i++)    {     long sum = 0;     for (int j = i; j < n; j++)     {      sum += a[j];      sums.computeIfAbsent(sum, k -> new ArrayList<>()).add(          new F1BlokiRavnoiSummiProstayaRedakciya.Block(i, j, sum));     }    }    for (Map.Entry<Long, List<F1BlokiRavnoiSummiProstayaRedakciya.Block>> e : sums.entrySet())    {     Collections.sort(e.getValue());    }    List<F1BlokiRavnoiSummiProstayaRedakciya.Block> res = Collections.emptyList();    for (Map.Entry<Long, List<F1BlokiRavnoiSummiProstayaRedakciya.Block>> e : sums.entrySet())    {     List<F1BlokiRavnoiSummiProstayaRedakciya.Block> blocks = e.getValue();     List<F1BlokiRavnoiSummiProstayaRedakciya.Block> updated = new ArrayList<>();     for (F1BlokiRavnoiSummiProstayaRedakciya.Block next : blocks)     {      if (updated.size() == 0)       updated.add(next);      else      {       F1BlokiRavnoiSummiProstayaRedakciya.Block prev = updated.get(updated.size() - 1);       if (next.l > prev.r)        updated.add(next);      }     }     if (updated.size() > res.size())      res = updated;    }    StringBuilder resS = new StringBuilder();    resS.append(res.size()).append('\n');    for (F1BlokiRavnoiSummiProstayaRedakciya.Block block : res)     resS.append(block.l + 1).append(' ').append(block.r + 1).append('\n');    out.println(resS);   }   private long[] nla(int size)   {    return in.nextLongArray(size);   }   private int ni()   {    return in.nextInt();   }   static class Block implements Comparable<F1BlokiRavnoiSummiProstayaRedakciya.Block>   {    int l;    int r;    long sum;    public Block(int l, int r, long sum)    {     this.l = l;     this.r = r;     this.sum = sum;    }    public int compareTo(F1BlokiRavnoiSummiProstayaRedakciya.Block o)    {     int res = Integer.compare(r, o.r);     if (res == 0)      res = Integer.compare(l, o.l);     return res;    }   }  }  static class InputReader  {   private final BufferedReader reader;   private StringTokenizer tokenizer;   public InputReader(InputStream in)   {    reader = new BufferedReader(new InputStreamReader(in));   }   public long[] nextLongArray(int size)   {    long[] array = new long[size];    for (int i = 0; i < size; ++i)    {     array[i] = nextLong();    }    return array;   }   public int nextInt()   {    return Integer.parseInt(next());   }   public long nextLong()   {    return Long.parseLong(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 a111 {  public static void debug(Object... obs) {   System.out.println(Arrays.deepToString(obs));  }  public static void main(String[] args) throws Exception {   Scanner sc = new Scanner(System.in);     int n=sc.nextInt();   int[]a=new int[n];     int su=0;   for(int i=0;i<n;i++)   {    a[i]=-sc.nextInt();    su+=-1*a[i];   }   Arrays.sort(a);        int ss=0;   for(int i=0;i<n;i++)   {    ss+=-1*a[i];    su-=-1*a[i];    if(ss > su)    {     System.out.println(i+1);     return;    }   }    } }
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);   C909 solver = new C909();   solver.solve(1, in, out);   out.close();  }  static class C909 {   int N;   long MOD = 1_000_000_007;   boolean[] type;   long[][] memo;   long dp(int cmd, int dep) {       if (dep < 0) return 0;    if (cmd == N) return 1;    if (memo[cmd][dep] != -1) return memo[cmd][dep];    boolean safe = cmd == 0 ? true : !type[cmd - 1];    int d = type[cmd] ? 1 : 0;    long ways = 0;    if (!safe) {         ways += dp(cmd + 1, dep + d);     ways %= MOD;    } else {     ways += dp(cmd + 1, dep + d);     ways %= MOD;     ways += dp(cmd, dep - 1);     ways %= MOD;    }    return memo[cmd][dep] = ways;   }   public void solve(int testNumber, FastScanner s, PrintWriter out) {    N = s.nextInt();    type = new boolean[N];    for (int i = 0; i < N; i++) {     type[i] = s.next().charAt(0) == 'f';    }    memo = new long[N][N + 1];    for (long[] a : memo)     Arrays.fill(a, -1);    out.println(dp(0, 0));   }  }  static class FastScanner {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   public FastScanner(InputStream stream) {    this.stream = stream;   }   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++];   }   boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public int nextInt() {    return Integer.parseInt(next());   }   public String next() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }  } }
6	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   MyInput in = new MyInput(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskE solver = new TaskE();   solver.solve(1, in, out);   out.close();  }  static class TaskE {   int n;   int k;   long[] neigibor;   Random random = new Random();   long maxClique;   public void solve(int testNumber, MyInput in, PrintWriter out) {    n = in.nextInt();    k = in.nextInt();    neigibor = new long[n];    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      neigibor[i] |= in.nextLong() << j;     }    }    long maxClique = bronKerbosch();    long a = Long.bitCount(maxClique);    dump(a);    out.printf("%.12f\n", a * (a - 1.0) / 2 * k / a * k / a);   }   static void dump(Object... o) {    System.err.println(Arrays.deepToString(o));   }   long bronKerbosch() {    maxClique = 0;    bronKerbosch2(0, (1L << n) - 1, 0);    return maxClique;   }   void bronKerbosch2(long r, long p, long x) {    long px = p | x;    if (px == 0) {     if (Long.bitCount(maxClique) < Long.bitCount(r)) {      maxClique = r;     }     return;    }    int cnt = Long.bitCount(px);    int choice = random.nextInt(cnt);    int u;    for (int i = 0; ; i++) {     if ((px >>> i & 1) != 0 && choice-- == 0) {      u = i;      break;     }    }    long ne = p & ~neigibor[u];    for (int v = 0; v < n; v++)     if ((ne >>> v & 1) != 0) {      bronKerbosch2(r | 1L << v, p & neigibor[v], x & neigibor[v]);      p &= ~(1L << v);      x |= 1L << v;     }   }  }  static class MyInput {   private final BufferedReader in;   private static int pos;   private static int readLen;   private static final char[] buffer = new char[1024 * 8];   private static char[] str = new char[500 * 8 * 2];   private static boolean[] isDigit = new boolean[256];   private static boolean[] isSpace = new boolean[256];   private static boolean[] isLineSep = 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;    isLineSep['\r'] = isLineSep['\n'] = true;   }   public MyInput(InputStream is) {    in = new BufferedReader(new InputStreamReader(is));   }   public int read() {    if (pos >= readLen) {     pos = 0;     try {      readLen = in.read(buffer);     } catch (IOException e) {      throw new RuntimeException();     }     if (readLen <= 0) {      throw new MyInput.EndOfFileRuntimeException();     }    }    return buffer[pos++];   }   public int nextInt() {    int len = 0;    str[len++] = nextChar();    len = reads(len, isSpace);    int i = 0;    int ret = 0;    if (str[0] == '-') {     i = 1;    }    for (; i < len; i++) ret = ret * 10 + str[i] - '0';    if (str[0] == '-') {     ret = -ret;    }    return ret;   }   public long nextLong() {    int len = 0;    str[len++] = nextChar();    len = reads(len, isSpace);    int i = 0;    long ret = 0;    if (str[0] == '-') {     i = 1;    }    for (; i < len; i++) ret = ret * 10 + str[i] - '0';    if (str[0] == '-') {     ret = -ret;    }    return ret;   }   public char nextChar() {    while (true) {     final int c = read();     if (!isSpace[c]) {      return (char) c;     }    }   }   int reads(int len, boolean[] accept) {    try {     while (true) {      final int c = read();      if (accept[c]) {       break;      }      if (str.length == len) {       char[] rep = new char[str.length * 3 / 2];       System.arraycopy(str, 0, rep, 0, str.length);       str = rep;      }      str[len++] = (char) c;     }    } catch (MyInput.EndOfFileRuntimeException e) {    }    return len;   }   static class EndOfFileRuntimeException extends RuntimeException {   }  } }
1	public class Main {  private FastScanner scanner = new FastScanner();  public static void main(String[] args) {   new Main().solve();  }   private void solve() {   int n = scanner.nextInt();   Map<Integer, Integer> cnt = new HashMap<>();   for (int i = 0; i < n; i++) {    String s = scanner.nextLine();    LinkedList<Character> st = new LinkedList<>();    for (char c : s.toCharArray()) {     if (c == ')' && !st.isEmpty() && st.getLast() == '(') {      st.pollLast();      continue;     }     st.addLast(c);    }    int t = st.size();    Set<Character> set = new HashSet<>(st);    if (set.size() > 1) {     continue;    }    if (set.isEmpty()) {     cnt.put(0, cnt.getOrDefault(0, 0) + 1);     continue;    }    if (st.getLast() == '(') {     cnt.put(t, cnt.getOrDefault(t, 0) + 1);    } else {     cnt.put(-t, cnt.getOrDefault(-t, 0) + 1);    }   }   long ans = 0;   for (int next : cnt.keySet()) {    if (next == 0) {     ans += (long) cnt.get(next) * (cnt.get(next) - 1) + cnt.get(next);    } else if (next > 0) {     int t = next * -1;     if (cnt.containsKey(t)) {      ans += (long) cnt.get(next) * cnt.get(t);     }    }   }   System.out.print(ans);  }  class FastScanner {   BufferedReader reader;   StringTokenizer tokenizer;   FastScanner() {    reader = new BufferedReader(new InputStreamReader(System.in), 32768);    tokenizer = null;   }   String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }   int nextInt() {    return Integer.parseInt(next());   }   Integer[] nextA(int n) {    Integer a[] = new Integer[n];    for (int i = 0; i < n; i++) {     a[i] = scanner.nextInt();    }    return a;   }   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);    }   }  } }
0	public class StrangeAddition {  public static void main(String[] args) throws IOException {  PrintWriter out = new PrintWriter(System.out);  sc = new StringTokenizer(br.readLine());  int tc = nxtInt();  while (tc-- > 0) {  int a = nxtInt();  int b = nxtInt();  int ans = 0;  while (a != b) {   if (a == 0 || b == 0)   break;   if (a > b) {   int div = a / b;   a -= b * div;   ans += div;   } else {   int div = b / a;   b -= a * div;   ans += div;   }  }  out.println(ans + (a == b ? 1 : 0));  }  br.close();  out.close(); }  static BufferedReader br = new BufferedReader(new InputStreamReader(  System.in));  static StringTokenizer sc;  static String nxtTok() throws IOException {  while (!sc.hasMoreTokens()) {  String s = br.readLine();  if (s == null)   return null;  sc = new StringTokenizer(s.trim());  }  return sc.nextToken(); }  static int nxtInt() throws IOException {  return Integer.parseInt(nxtTok()); }  static long nxtLng() throws IOException {  return Long.parseLong(nxtTok()); } }
2	public class B { public static void main(String[] args) {  MScanner sc = new MScanner();  PrintWriter out = new PrintWriter(System.out);  long N = sc.nextLong();  long X = sc.nextLong();  long Y = sc.nextLong();  long C = sc.nextLong();  long low = 0;  long high = N*2;  long mid = 0;  long ans = 0;  while (low <= high) {  mid = (low + high) >> 1;  long painted = F(mid, X-1, Y-1, N);  if (painted < C) {   low = mid + 1;  } else {   ans = mid;   high = mid - 1;  }  }  out.println(ans);  out.close();  }  private static long F(long mid, long x, long y, long n) {  long base = 2 * mid * (mid + 1) + 1;  base -= excess(mid - x);  base -= excess(mid - y);  base -= excess(mid - (n-1-x));  base -= excess(mid - (n-1-y));  base += corner(mid - (x + y + 1));  base += corner(mid - (x + (n - y - 1) + 1));  base += corner(mid - ((n - x - 1) + y + 1));  base += corner(mid - (1 + (n - 1 - y) + (n - 1 - x)));  return base; }  private static long corner(long a) {  if (a < 0)return 0;  return (a * a + a) >> 1; }  private static long excess(long thing) {  if(thing<0)return 0;  return thing * thing; }  static class MScanner {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  public MScanner() {  stream = System.in;    }  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++];  }  boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  boolean isEndline(int c) {  return c == '\n' || c == '\r' || c == -1;  }  int nextInt() {  return Integer.parseInt(next());  }  int[] nextInt(int N) {  int[] ret = new int[N];  for (int a = 0; a < N; a++)   ret[a] = nextInt();  return ret;  }  int[][] nextInt(int N, int M) {  int[][] ret = new int[N][M];  for (int a = 0; a < N; a++)   ret[a] = nextInt(M);  return ret;  }  long nextLong() {  return Long.parseLong(next());  }  long[] nextLong(int N) {  long[] ret = new long[N];  for (int a = 0; a < N; a++)   ret[a] = nextLong();  return ret;  }  double nextDouble() {  return Double.parseDouble(next());  }  double[] nextDouble(int N) {  double[] ret = new double[N];  for (int a = 0; a < N; a++)   ret[a] = nextDouble();  return ret;  }  String next() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  String[] next(int N) {  String[] ret = new String[N];  for (int a = 0; a < N; a++)   ret[a] = next();  return ret;  }  String nextLine() {  int c = read();  while (isEndline(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isEndline(c));  return res.toString();  }  String[] nextLine(int N) {  String[] ret = new String[N];  for (int a = 0; a < N; a++)   ret[a] = nextLine();  return ret;  }  } }
5	public class A2 { static Scanner in; static int next() throws Exception {return in.nextInt();};  static PrintWriter out;  public static void main(String[] args) throws Exception {  in = new Scanner(System.in);   out = new PrintWriter(System.out);   int n = next(), a = next(), b = next();   int h[] = new int[n];   for (int i = 0;i < n;i++) h[i] = next();   Arrays.sort(h);   int res = h[b] - h[b-1];   out.println(res);   out.println();  out.close(); } }
4	public class givenstring { public static void main(String[] args){  Scanner reader = new Scanner(System.in);  String in = reader.next();   int max = 0;   for(int i = 0; i < in.length(); i++){  for(int j = i+1; j < in.length(); j++){     String consider = in.substring(i, j);   for(int k = i+1; k < in.length(); k++){   if(k + consider.length() > in.length())    break;   else if(in.substring(k, k+consider.length()).equals(consider))    max = Math.max(max, consider.length());   }  }  }   System.out.println(max); } }
3	public class A { FastScanner in; PrintWriter out; boolean systemIO = true;  public class Fenvik {  int[] sum;  public Fenvik(int n) {  sum = new int[n];  }  public void add(int x) {  for (; x < sum.length; x = (x | (x + 1))) {   sum[x]++;  }  }  public int sum(int r) {  int ans = 0;  for (; r >= 0; r = (r & (r + 1)) - 1) {   ans += sum[r];  }  return ans;  } }  public int gcd(int x, int y) {  if (y == 0) {  return x;  }  if (x == 0) {  return y;  }  return gcd(y, x % y); }   public class Edge {  int to;  long s;  public Edge(int to, long s) {  this.to = to;  this.s = s;  } }  public long dfs(int v, int prev, long sumth, long minsum, long s) {  tin[v] = timer;  timer++;  up[v][0] = new Edge(prev, s);  for (int i = 1; i <= l; i++) {  Edge e = up[v][i - 1];  up[v][i] = new Edge(up[e.to][i - 1].to, up[e.to][i - 1].s + e.s);  }  minsum = Math.min(minsum, sumth);  maxup[v] = sumth - minsum;  long mxdown = sumth;  for (Edge e : list[v]) {  if (e.to != prev) {   mxdown = Math.max(mxdown, dfs(e.to, v, sumth + e.s, minsum, e.s));  }  }  tout[v] = timer;  timer++;  maxdown[v] = mxdown - sumth;  return mxdown; }  public boolean upper(int a1, int b1) {  return tin[a1] <= tin[b1] && tout[a1] >= tout[b1]; }  public Edge lca(int a, int b) {  if (a == b) {  return new Edge(a, 0);  }  int v = -1;  int a1 = a;  int b1 = b;  if (tin[a] <= tin[b] && tout[a] >= tout[b]) {  v = b;  long lenb = 0;  for (int i = l; i >= 0; i--) {   a1 = up[v][i].to;   b1 = a;   if (!(tin[a1] <= tin[b1] && tout[a1] >= tout[b1])) {   lenb += up[v][i].s;   v = up[v][i].to;   }  }  lenb += up[v][0].s;  v = up[v][0].to;  return new Edge(v, lenb);  }  if (upper(b, a)) {  v = a;  long lena = 0;  for (int i = l; i >= 0; i--) {   a1 = up[v][i].to;   b1 = b;   if (!(tin[a1] <= tin[b1] && tout[a1] >= tout[b1])) {   lena += up[v][i].s;   v = up[v][i].to;   }  }  lena += up[v][0].s;  v = up[v][0].to;  return new Edge(v, lena);  }  v = a;  long lena = 0;  for (int i = l; i >= 0; i--) {  a1 = up[v][i].to;  b1 = b;  if (!(tin[a1] <= tin[b1] && tout[a1] >= tout[b1])) {   lena += up[v][i].s;   v = up[v][i].to;  }  }  lena += up[v][0].s;  v = up[v][0].to;  v = b;  long lenb = 0;  for (int i = l; i >= 0; i--) {  a1 = up[v][i].to;  b1 = a;  if (!(tin[a1] <= tin[b1] && tout[a1] >= tout[b1])) {   lenb += up[v][i].s;   v = up[v][i].to;  }  }  lenb += up[v][0].s;  v = up[v][0].to;  return new Edge(v, lena + lenb); }  int n; int l; int[] tin; int[] tout; int timer = 0; long[] maxup; long[] maxdown; Edge[][] up; ArrayList<Edge>[] list;  public void solve() {  int n = in.nextInt();  int[] a = new int[n];  for (int i = 0; i < a.length; i++) {  a[i] = in.nextInt();  }  Arrays.sort(a);  int ans = 0;  boolean[] used = new boolean[n];  for (int i = 0; i < used.length; i++) {  if (!used[i]) {   ans++;   for (int j = i; j < used.length; j++) {   if (a[j] % a[i] == 0) {    used[j] = true;   }   }  }  }  out.print(ans); }  public void run() {  try {  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();  } 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 A().run(); } }
4	public class x35C  {  public static void main(String hi[]) throws Exception  {   BufferedReader infile = new BufferedReader(new FileReader("input.txt"));   StringTokenizer st = new StringTokenizer(infile.readLine());   int N = Integer.parseInt(st.nextToken());   int M = Integer.parseInt(st.nextToken());   int K = Integer.parseInt(infile.readLine());   int[][] grid = new int[N][M];   for(int i=0; i < N; i++)    Arrays.fill(grid[i], -1);   ArrayDeque<Integer> q = new ArrayDeque<Integer>();   st = new StringTokenizer(infile.readLine());   while(K-->0)   {    int a = Integer.parseInt(st.nextToken())-1;    int b = Integer.parseInt(st.nextToken())-1;    grid[a][b] = 0;    q.add(a); q.add(b);   }   while(q.size() > 0)   {    int x = q.poll();    int y = q.poll();    if(x > 0 && grid[x-1][y] == -1)    {     grid[x-1][y] = grid[x][y]+1;     q.add(x-1); q.add(y);    }    if(y > 0 && grid[x][y-1] == -1)    {     grid[x][y-1] = grid[x][y]+1;     q.add(x); q.add(y-1);    }    if(x+1 < N && grid[x+1][y] == -1)    {     grid[x+1][y] = grid[x][y]+1;     q.add(x+1); q.add(y);    }    if(y+1 < M && grid[x][y+1] == -1)    {     grid[x][y+1] = grid[x][y]+1;     q.add(x); q.add(y+1);    }   }   int r = 0;   int c = 0;   for(int i=0; i < N; i++)    for(int j=0; j < M; j++)     if(grid[r][c] < grid[i][j])     {     r = i;     c = j;     }   r++; c++;   System.setOut(new PrintStream(new File("output.txt")));   System.out.println(r+" "+c);  }  }
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 Solution { static PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) throws Exception{  StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  in.nextToken();  int n = (int)in.nval;  in.nextToken();  String st = in.sval;  char[] a = new char[n];  for (int i = 0; i<n; i++)  a[i] = st.charAt(i);  int kH = 0;  int kT = 0;  for (int i =0; i<n; i++)  if (a[i] == 'T') kT++;  else kH++;  int kol = 0;  int min = Integer.MAX_VALUE;  int poz;   for (int i=0; i<n; i++)  {  kol = 0;  if (a[i] == 'T') {   for (int j = 0; j<kT; j++){   poz = (i+j)%n;   if (a[poz] == 'H') kol++;   }   if (kol < min) min = kol;  }  else {   for (int j = 0; j<kH; j++){   poz = (i+j)%n;   if (a[poz] == 'T') kol++;   }   if (kol < min) min = kol;  }  }  out.print(min);  out.flush(); } }
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 + " ");   }  } }
2	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);   Nas solver = new Nas();   solver.solve(1, in, out);   out.close();  }  static class Nas {   public void solve(int testNumber, FastReader in, PrintWriter out) {    long x = in.nextLong();    if (x == 0) {     out.println(0);     return;    }    BigInteger n1 = BigInteger.valueOf(x);    BigInteger n2 = BigInteger.valueOf(in.nextLong());    BigInteger mod = BigInteger.valueOf(1000000007);    BigInteger a = BigInteger.valueOf(2).modPow(n2.add(BigInteger.ONE), mod);    a = a.multiply(n1);    a = a.mod(mod);    BigInteger b = BigInteger.valueOf(2).modPow(n2, mod).subtract(BigInteger.ONE);    a = a.subtract(b);    a = a.add(mod);    a = a.mod(mod);    out.println(a);   }  }  static class FastReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private FastReader.SpaceCharFilter filter;   public FastReader(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);   }  } }
6	public class B {  static int n,t[],g[],MOD=(int)1e9+7; static int [][]memo; static int dp(int msk,int rem,int lastG) {  if(rem==0)  return 1;  if(memo[lastG][msk]!=-1)  return memo[lastG][msk];  int ans=0;  for(int i=0;i<n;i++) {  if((msk & (1<<i))==0 && rem>=t[i] && g[i]!=lastG)   ans+=dp(msk|1<<i,rem-t[i],g[i]);   if(ans>=MOD)   ans-=MOD;  }  return memo[lastG][msk]=ans; } public static void main(String[] args) throws IOException {  Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out);  n=sc.nextInt();  int T=sc.nextInt();  t=new int [n];  g=new int [n];   for(int i=0;i<n;i++) {  t[i]=sc.nextInt();  g[i]=sc.nextInt()-1;  }  memo=new int [4][1<<n];  for(int []x:memo)  Arrays.fill(x, -1);  out.println(dp(0, T, 3));  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();  }  } }
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);   }  } }
5	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[] b = a.clone();    b = Arrays.copyOf(b, a.length + 2);    b[a.length] = 0;    b[a.length + 1] = (int) 2e9;    ArrayUtils.sort(b);    b = ArrayUtils.uniqueArray(b);    SegmentTreeSumL segmentTreeSumL = new SegmentTreeSumL(b.length + 1);    SegmentTreeSumL size = new SegmentTreeSumL(b.length + 1);    for (int i = 0; i < n; ++i) {     segmentTreeSumL.update(Arrays.binarySearch(b, a[i]), a[i]);     size.update(Arrays.binarySearch(b, a[i]), 1);    }    Debug debug = new Debug(out);    BigInteger sum = new BigInteger("0");    for (int i = 0; i < n; ++i) {     segmentTreeSumL.update(Arrays.binarySearch(b, a[i]), -a[i]);     size.update(Arrays.binarySearch(b, a[i]), -1);     int indG = ArrayUtils.LowerBound(b, a[i] + 2);     indG = Math.min(indG, b.length);     long s1 = size.getRangeSum(indG, b.length);     long sum1 = segmentTreeSumL.getRangeSum(indG, b.length);         sum = sum.add(BigInteger.valueOf(sum1 - s1 * a[i]));     int indL = ArrayUtils.LowerBound(b, a[i] - 1) - 1;     indL = Math.max(0, indL);     long s2 = size.getRangeSum(0, indL);     long sum2 = segmentTreeSumL.getRangeSum(0, indL);         sum = sum.add(BigInteger.valueOf(sum2 - s2 * a[i]));    }    out.println(sum.toString());   }  }  static class ArrayUtils {   public static int LowerBound(int[] a, int v) {    int high = a.length;    int low = -1;    while (high - low > 1) {     int mid = (high + low) >>> 1;     if (a[mid] >= v) {      high = mid;     } else {      low = mid;     }    }    return high;   }   public static int[] sort(int[] a) {    a = shuffle(a, new SplittableRandom());    Arrays.sort(a);    return a;   }   public static int[] shuffle(int[] a, SplittableRandom 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;   }   public static int[] uniqueArray(int[] a) {    int n = a.length;    int p = 0;    for (int i = 0; i < n; i++) {     if (i == 0 || a[i] != a[i - 1]) a[p++] = a[i];    }    return Arrays.copyOf(a, p);   }  }  static class FastReader {   private InputStream stream;   private byte[] buf = new byte[8192];   private int curChar;   private int pnumChars;   private FastReader.SpaceCharFilter filter;   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) {    if (filter != null) {     return filter.isSpaceChar(c);    }    return isWhitespace(c);   }   private static boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   private interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  static class SegmentTreeSumL {   long[] lazy;   long[] seg;   long[] a;   int size;   int N;   public SegmentTreeSumL(long[] a) {    this.N = a.length;    size = 4 * N;    seg = new long[size];    lazy = new long[size];    this.a = a;    build(0, N - 1, 0);   }   public SegmentTreeSumL(int n) {    this.N = n;    size = 4 * N;    seg = new long[size];    lazy = new long[size];   }   private void build(int s, int e, int c) {    if (s == e) {     seg[c] = a[s];     return;    }    int m = (s + e) >>> 1;    build(s, m, 2 * c + 1);    build(m + 1, e, 2 * c + 2);    seg[c] = seg[2 * c + 1] + seg[2 * c + 2];   }   public void update(int index, int value) {    update(0, N - 1, 0, index, value);   }   private void update(int s, int e, int c, int index, int value) {    if (s == e) {     seg[c] += value;     return;    }    int m = (s + e) >>> 1;    if (index <= m) {     update(s, m, 2 * c + 1, index, value);    } else {     update(m + 1, e, 2 * c + 2, index, value);    }    seg[c] = seg[2 * c + 1] + seg[2 * c + 2];   }   public long getRangeSum(int l, int r) {    return getRangeSum(0, N - 1, 0, l, r);   }   private long getRangeSum(int s, int e, int c, int l, int r) {    if (s > e || l > r || l > e || r < s) return 0;    if (lazy[c] != 0) {     if (s != e) {      lazy[2 * c + 1] += lazy[c];      lazy[2 * c + 2] += lazy[c];     }     seg[c] += (e - s + 1) * (1L) * lazy[c];     lazy[c] = 0;    }    if (s == e) {     return seg[c];    }    if (s >= l && e <= r) {     return seg[c];    }    int m = (s + e) >>> 1;    return getRangeSum(s, m, 2 * c + 1, l, r)      + getRangeSum(m + 1, e, 2 * c + 2, l, r);   }  }  static class Debug {   PrintWriter out;   boolean oj;   public Debug(PrintWriter out) {    oj = System.getProperty("ONLINE_JUDGE") != null;    this.out = out;   }  } }
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();  }   } }
1	public class Main {  FastScanner in;  PrintWriter out;  static final String FILE = "";  public void solve() {   int n = in.nextInt();   TreeMap<Character, Integer> map = new TreeMap<>();   ArrayList<Integer> list = new ArrayList<>();   String s = in.next();   for (int i = 0; i < n; i++) {    char ch = s.charAt(i);    if (!map.containsKey(ch))     map.put(ch, map.size());    list.add(map.get(ch));   }   int l = 0;   int ans = Integer.MAX_VALUE;   int nad = map.size();   int cnt[] = new int[n];   for (int i = 0; i < list.size(); i++) {    if (cnt[list.get(i)] == 0)     nad--;    cnt[list.get(i)]++;    if (nad == 0) {     ans = min(ans, i - l + 1);     while (true) {      if (cnt[list.get(l)] == 1) {       ans = min(ans, i - l + 1);       cnt[list.get(l)]--;       l++;       nad++;       break;      } else {       cnt[list.get(l)]--;       l++;      }     }    }   }   out.print(ans);  }  public void run() {   if (FILE.equals("")) {    in = new FastScanner(System.in);    out = new PrintWriter(System.out);   } else {    try {     in = new FastScanner(new FileInputStream(FILE +       ".in"));     out = new PrintWriter(new FileOutputStream(FILE +       ".out"));    } catch (FileNotFoundException e) {     e.printStackTrace();    }   }   solve();   out.close();  }  public static void main(String[] args) {   (new Main()).run();  }  class FastScanner {   BufferedReader br;   StringTokenizer st;   public FastScanner(InputStream is) {    br = new BufferedReader(new InputStreamReader(is));   }   public String next() {    while (st == null || !st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   public String nextLine() {    st = null;    try {     return br.readLine();    } catch (IOException e) {     e.printStackTrace();     return "";    }   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public float nextFloat() {    return Float.parseFloat(next());   }  }  class Pair<A extends Comparable<A>, B extends Comparable<B>>    implements Comparable<Pair<A, B>> {   public A a;   public B b;   public Pair(A a, B b) {    this.a = a;    this.b = b;   }   @Override   public int compareTo(Pair<A, B> o) {    if (o == null || o.getClass() != getClass())     return 1;    int cmp = a.compareTo(o.a);    if (cmp == 0)     return b.compareTo(o.b);    return cmp;   }   @Override   public boolean equals(Object o) {    if (this == o) return true;    if (o == null || getClass() != o.getClass()) return false;    Pair<?, ?> pair = (Pair<?, ?>) o;    if (a != null ? !a.equals(pair.a) : pair.a != null) return      false;    return !(b != null ? !b.equals(pair.b) : pair.b != null);   }  }  class PairInt extends Pair<Integer, Integer> {   public PairInt(Integer u, Integer v) {    super(u, v);   }  }  class PairLong extends Pair<Long, Long> {   public PairLong(Long u, Long v) {    super(u, v);   }  } }
4	public class C2 {  public static void main(String[] args) throws IOException{   Scanner sc = new Scanner(new File("input.txt"));   PrintWriter pw = new PrintWriter(new File("output.txt"));   int n = sc.nextInt();   int m = sc.nextInt();   int k = sc.nextInt();   int[]x = new int[k+1], y = new int[k+1];   for (int i = 1; i <= k; i++) {    y[i] = sc.nextInt();    x[i] = sc.nextInt();   }   int max = -1, y0 = 0, x0 = 0;   for (int i = 1; i <= n; i++) {    for (int j = 1; j <= m; j++) {     int min = n+m+2;     for (int j2 = 1; j2 <= k; j2++) {      min = Math.min(min, Math.abs(i-y[j2])+Math.abs(j-x[j2]));     }     if (min > max) {      max = min;      y0 = i;      x0 = j;     }    }   }   pw.println(y0+" "+x0);   pw.close();  } }
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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   int n;   ArrayList<Integer>[] adj;   long[] mem;   int start;   long cycles(int cur, int visited) {    if (cur == start && visited > 0) {     return Integer.bitCount(visited) >= 3 ? 1 : 0;    }    int index = visited * n + cur;    if (mem[index] != -1) return mem[index];    long res = 0;    int newvisited = visited | (1 << cur);    for (int nxt : adj[cur]) {     if (nxt >= start && (nxt == start || ((visited >> nxt) & 1) == 0)) {      res += cycles(nxt, newvisited);     }    }    return mem[index] = res;   }   public void solve(int testNumber, InputReader in, OutputWriter out) {    n = in.readInt();    int m = in.readInt();    adj = new ArrayList[n];    mem = new long[n * (1 << n)];    for (int i = 0; i < adj.length; i++) adj[i] = new ArrayList<>();    for (int i = 0; i < m; i++) {     int a = in.readInt() - 1, b = in.readInt() - 1;     adj[a].add(b);     adj[b].add(a);    }    long res = 0;    for (int start = 0; start < n; start++) {     Arrays.fill(mem, -1);     this.start = start;     res += cycles(start, 0) / 2;    }    out.printLine(res);   }  }  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 close() {    writer.close();   }   public void printLine(long 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 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);   }  } }
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;  } } }
3	public class Main {  public static void main(String[] args) {   Scanner scn = new Scanner(System.in);   int n = scn.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) a[i] = scn.nextInt();   scn.close();   Arrays.sort(a);   ArrayList<Integer> cyka = new ArrayList<>();   for (int i = 0; i < n; i++) {    for (int j = 0; j < n; j++) {     if (a[j] % a[i] == 0) {      boolean add = true;      for (int k : cyka) {       if (a[i] % k == 0) {        add = false;        break;       }      }      if (add) {       cyka.add(a[i]);      }     }    }   }   System.out.println(cyka.size());  } }
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;   }  } }
0	public class A { static Scanner scan = new Scanner (System.in); static PrintStream out = System.out;  static void go (int n) {  if (n == 0) {  System.out.println (0 + " " + 0 + " " + 0);  return;  }  int a = 0, b = 1;  int c = a + b;  while (n > c) {  a = b;  b = c;  c = a + b;  }  System.out.println (0 + " " + a + " " + b); }  public static void main (String[] args) {  int n = scan.nextInt();  go (n);  }    }
1	public class SpreadSheet {  public void run() {   try {    Scanner s = new Scanner(System.in);    int tests = s.nextInt();    for (int i = 0; i < tests; i++) {     String line = s.next();     String regex = "R[\\d]+C[\\d]+";     Pattern pattern = Pattern.compile(regex);     Matcher matcher = pattern.matcher(line);         if (matcher.matches()){      int r = Integer.parseInt(line.substring(1, line.indexOf("C")));      int c = Integer.parseInt(line.substring(line.indexOf("C") +1));      System.out.println(toFormula(r, c));     }     else {      int index = -1;      for (int j = 0; j < line.length(); j++) {       if (line.charAt(j) >= '0' && line.charAt(j) <= '9') {        index = j;        break;       }      }      String c = line.substring(0, index);      int r = Integer.parseInt(line.substring(index));      System.out.println(fromFormula(c, r));     }    }   } catch (Exception e) {    e.printStackTrace();   }  }   private String toFormula(int r, int c) {   StringBuffer buff = new StringBuffer();   char ch;   while (c != 0) {    int m = c%26;    if(m==0)    {     ch = 'Z';     c = c/26 - 1;    }    else    {     ch = (char)(m+'A'-1);     c /= 26;    }    buff.append(ch);      }   return buff.reverse().toString() + r;  }   private String fromFormula(String c, int r) {   int ret = 0;   int power = 1;   for (int i = c.length()-1; i >= 0; i--) {    ret += ((c.charAt(i) - 'A' + 1) * power);    power *= 26;   }   return "R" + r + "C" + ret;  }   public static void main(String[] args) {   new SpreadSheet().run();  } }
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);   }  } }
0	public class BankAccount {   public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  String s = in.readLine();  int n = Integer.parseInt(s);  if (s.charAt(0) == '-')  if (Integer.parseInt(s.substring(0, s.length()-1))>Integer.parseInt(s.substring(0, s.length()-2)+s.charAt(s.length()-1)))   s=s.substring(0, s.length()-1);  else   s=s.substring(0, s.length()-2)+s.charAt(s.length()-1);  System.out.println(Integer.parseInt(s));  in.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  @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;   }  } }
0	public class CF125D2A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   System.out.println("0 0 " + sc.nextInt());  } }
1	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 out = new PrintWriter(System.out);   int n=sc.nextInt();   String a[]=new String[n];   String b[]=new String[n];   int freaa[][]=new int[5][4];   for (int i = 0; i <n ; i++) {    a[i]=sc.next();    int ll=a[i].length();    for (int j = 0; j <a[i].length() ; j++) {     if(a[i].charAt(j)=='X')      freaa[ll][0]++;     if(a[i].charAt(j)=='L')      freaa[ll][1]++;     if(a[i].charAt(j)=='M')      freaa[ll][2]++;     if(a[i].charAt(j)=='S')      freaa[ll][3]++;    }   }   int frebb[][]=new int[5][4];   for (int i = 0; i <n ; i++) {    b[i]=sc.next();    int ll=b[i].length();    for (int j = 0; j <b[i].length() ; j++) {     if(b[i].charAt(j)=='X')      frebb[ll][0]++;     if(b[i].charAt(j)=='L')      frebb[ll][1]++;     if(b[i].charAt(j)=='M')      frebb[ll][2]++;     if(b[i].charAt(j)=='S')      frebb[ll][3]++;    }   }   int ans=0;   for (int i = 1; i <5 ; i++) {    for (int j = 0; j <4 ; j++) {     if(freaa[i][j]<frebb[i][j]){      ans+=frebb[i][j]-freaa[i][j];     }    }   }   out.println(ans);   out.close();  }  }
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; }  }
5	public class WCS {  public static class Vector implements Comparable <Vector> {  long x, y;  int position;  Vector first, second;  boolean toReverse;   public Vector(long xx, long yy, int p) {  x = xx;  y = yy;  position = p;  first = null;  second = null;  toReverse = false;  }   public Vector negate() {  Vector vv = new Vector(-x, -y, position);  vv.first = first;  vv.second = second;  vv.toReverse = !toReverse;  return vv;  }   public Vector add(Vector v) {  Vector sum = new Vector(this.x + v.x, this.y + v.y, position);  sum.first = this;  sum.second = v;  return sum;  }   public Vector subtract(Vector v) {  return this.add(v.negate());  }   public double euclideanNorm() {  return Math.sqrt(x * x + y * y);  }   @Override  public int compareTo(Vector v) {  double thisa = Math.atan2(this.y, this.x);  double va = Math.atan2(v.y, v.x);  if(thisa < 0)   thisa += 2 * Math.PI;  if(va < 0)   va += 2 * Math.PI;  if(thisa < va)   return -1;  if(thisa > va)   return 1;  return Integer.compare(this.position, v.position);  }   @Override  public String toString() {  return x + " " + y;  } }  public static void dfs(Vector curr, int[] ans) {  if(curr.first == null) {  ans[curr.position] = curr.toReverse ? -1 : 1;  return;  }  curr.first.toReverse ^= curr.toReverse;  curr.second.toReverse ^= curr.toReverse;  dfs(curr.first, ans);  dfs(curr.second, ans); }  public static boolean ok(Vector v1, Vector v2) {  return v1.add(v2).euclideanNorm() <= Math.max(v1.euclideanNorm(), v2.euclideanNorm()); }  public static void stop(long k) {  long time = System.currentTimeMillis();  while(System.currentTimeMillis() - time < k); }  public static void main(String[] args) throws IOException {  int n = in.nextInt();  TreeSet <Vector> vectors = new TreeSet <> ();  for(int i = 0; i < n; i ++) {  Vector v = new Vector(in.nextLong(), in.nextLong(), i);  vectors.add(v);  }  while(vectors.size() > 2) {        TreeSet <Vector> support = new TreeSet <> ();    while(vectors.size() > 0) {   Vector curr = vectors.pollFirst();   Vector next1 = vectors.higher(curr);   Vector next2 = vectors.lower(curr.negate());   Vector next3 = vectors.higher(curr.negate());   Vector next4 = vectors.lower(curr);          if(next1 != null) {   if(ok(curr, next1)) {    support.add(curr.add(next1));    vectors.remove(next1);    continue;   }   }   if(next1 != null) {   if(ok(curr, next1.negate())) {    support.add(curr.subtract(next1));    vectors.remove(next1);    continue;   }   }   if(next2 != null) {   if(ok(curr, next2)) {    support.add(curr.add(next2));    vectors.remove(next2);    continue;   }   }   if(next2 != null) {   if(ok(curr, next2.negate())) {    support.add(curr.subtract(next2));    vectors.remove(next2);    continue;   }   }   if(next3 != null) {   if(ok(curr, next3)) {    support.add(curr.add(next3));    vectors.remove(next3);    continue;   }   }   if(next3 != null) {   if(ok(curr, next3.negate())) {    support.add(curr.subtract(next3));    vectors.remove(next3);    continue;   }   }   if(next4 != null) {   if(ok(curr, next4)) {    support.add(curr.add(next4));    vectors.remove(next4);    continue;   }   }   if(next4 != null) {   if(ok(curr, next4.negate())) {    support.add(curr.subtract(next4));    vectors.remove(next4);    continue;   }   }     support.add(curr);  }    vectors = support;  }   if(vectors.size() == 2) {  Vector curr = vectors.pollFirst();  Vector next = vectors.pollFirst();  Vector add = curr.add(next);  Vector sub = curr.subtract(next);  if(sub.euclideanNorm() <= add.euclideanNorm())   vectors.add(sub);  else   vectors.add(add);  }      StringBuilder buffer = new StringBuilder();  int[] ans = new int[n];  dfs(vectors.pollFirst(), ans);  for(int i = 0; i < n; i ++)  buffer.append(ans[i] + " ");  System.out.println(buffer); }   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();   }    BigInteger nextBigInteger() {   return new BigInteger(in.next());   }     int nextInt() {    return Integer.parseInt(next());   }     char nextChar() {    return in.next().charAt(0);   }    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 in = new FastReader();  static OutputStream out = new BufferedOutputStream(System.out);   public static byte[] toByte(Object o) {   return String.valueOf(o).getBytes();  }   public static void sop(Object o) {   System.out.print(o);  } }
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);   }  } }
4	public class C_Round_35_Div2 {  public static long MOD = 1000000007;  static int[] X = {0, 1, 0, -1};  static int[] Y = {1, 0, -1, 0};  static int[][][] dp;  public static void main(String[] args) throws FileNotFoundException {   PrintWriter out = new PrintWriter(new FileOutputStream(new File(     "output.txt")));     Scanner in = new Scanner();   int n = in.nextInt();   int m = in.nextInt();   int k = in.nextInt();   int[][] map = new int[n][m];   LinkedList<Point> q = new LinkedList();   int reX = -1;   int reY = -1;   for (int i = 0; i < k; i++) {    int x = in.nextInt() - 1;    int y = in.nextInt() - 1;    reX = x;    reY = y;    map[x][y] = 1;    q.add(new Point(x, y));   }   while (!q.isEmpty()) {    Point p = q.poll();       for (int i = 0; i < 4; i++) {     int x = p.x + X[i];     int y = p.y + Y[i];     if (x >= 0 && y >= 0 && x < n && y < m && map[x][y] == 0) {      map[x][y] = 1 + map[p.x][p.y];      if (map[x][y] > map[reX][reY]) {       reX = x;       reY = y;      }      q.add(new Point(x, y));     }    }   }   out.println((reX + 1) + " " + (reY + 1));   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 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) {   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 * a % MOD) % MOD;    }  }  static class Scanner {   BufferedReader br;   StringTokenizer st;   public Scanner() throws FileNotFoundException {           br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("input.txt"))));   }   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();    }   }  } }
0	public class Division {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int l = sc.nextInt();  String c = String.valueOf(l);  if (String.valueOf(c).contains("0") || String.valueOf(c).contains("1")   || String.valueOf(c).contains("2")   || String.valueOf(c).contains("3")   || String.valueOf(c).contains("5")   || String.valueOf(c).contains("6")   || String.valueOf(c).contains("8")   || String.valueOf(c).contains("9"))  if (l % 777 == 0 || l % 774 == 0 || l % 747 == 0 || l % 744 == 0   || l % 477 == 0 || l % 474 == 0 || l % 447 == 0   || l % 444 == 0 || l % 77 == 0 || l % 74 == 0   || l % 47 == 0 || l % 44 == 0 || l % 7 == 0 || l % 4 == 0)   System.out.println("YES");  else   System.out.println("NO");  else  System.out.println("YES"); } }
5	public class A {  public A () throws IOException {  String input = r.readLine();  int N = Integer.parseInt(input);  int [] A = new int [N];  input = r.readLine();  String [] S = input.split(" ");  for (int i = 0; i < N; ++i)  A[i] = Integer.parseInt(S[i]);  solve(N, A); }  public void solve (int N, int [] A) {  t = millis();  Arrays.sort(A);  if (A[N-1] > 1) A[N-1] = 1;  else A[N-1] = 2;  Arrays.sort(A);  System.out.print(A[0]);  for (int i = 1; i < N; ++i)  System.out.print(" " + A[i]);  System.out.println(); }   static BufferedReader r; static long t;  static void print2 (Object o) {  System.out.println(o); }  static void print (Object o) {  print2(o);   System.exit(0); }  static void run () throws IOException {  r = new BufferedReader(new InputStreamReader(System.in));  new A(); }  public static void main(String[] args) throws IOException {  run(); }  static long millis() {  return System.currentTimeMillis(); } }
0	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) {   long a = in.nextLong();   long b = in.nextLong();   if (a < b) {    long t = a;    a = b;    b = t;   }   long ans = 0;   while (b > 0) {    ans += a / b;    long t = a % b;    a = b;    b = t;   }   out.println(ans);  } } 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 long nextLong() {   return Long.parseLong(next());  }  public String readLine() {   try {    return super.readLine();   } catch (IOException e) {    return null;   }  }  } class FastPrinter extends PrintWriter {  public FastPrinter(OutputStream out) {   super(out);  }  public FastPrinter(Writer out) {   super(out);  }  }
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();  } }
3	public class PythonIndentation { public static void main(String args[]) {  Scanner sc=new Scanner(System.in);  int t=sc.nextInt();  int a[]=new int[t];  int c=0;  a[0]=1;  long mod=(long) (1e9+7);  sc.nextLine();  for(int i=0;i<t;i++)  {  String s=sc.nextLine();  if(s.equals("f"))   c++;  else  {   for(int j=1;j<=c;j++)   {   a[j]=(int) (((a[j]%mod)+(a[j-1]%mod))%mod);   }  }  }   System.out.println(a[c]);  sc.close();   } }
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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    int[] a = in.readIntArray(n);    ArrayUtils.radixSort(a);    int answer = 0;    boolean[] used = new boolean[a.length];    for (int i = 0; i < a.length; ++i) {     if (used[i]) continue;     used[i] = true;     answer++;     for (int j = i + 1; j < a.length; ++j)      if (a[j] % a[i] == 0)       used[j] = true;    }    out.println(answer);   }  }  static class ArrayUtils {   public static void radixSort(int[] array) {    int[] ordered = new int[array.length];    {     int[] freq = new int[0xFFFF + 2];     for (int i = 0; i < array.length; ++i) freq[(array[i] & 0xFFFF) + 1]++;     for (int i = 1; i < freq.length; ++i) freq[i] += freq[i - 1];     for (int i = 0; i < array.length; ++i)      ordered[freq[array[i] & 0xFFFF]++] = array[i];     for (int i = 0; i < array.length; ++i)      array[i] = ordered[i];    }    {     int[] freq = new int[0xFFFF + 2];     for (int i = 0; i < array.length; ++i) freq[(array[i] >>> 16) + 1]++;     for (int i = 1; i < freq.length; ++i) freq[i] += freq[i - 1];     for (int i = 0; i < array.length; ++i)      ordered[freq[array[i] >>> 16]++] = array[i];     int indexOfFirstNegative = freq[0x7FFF];     int index = 0;     for (int i = indexOfFirstNegative; i < ordered.length; ++i, ++index)      array[index] = ordered[i];     for (int i = 0; i < indexOfFirstNegative; ++i, ++index)      array[index] = ordered[i];    }   }  }  static class OutputWriter extends PrintWriter {   public OutputWriter(OutputStream outputStream) {    super(outputStream);   }   public OutputWriter(Writer writer) {    super(writer);   }   public OutputWriter(String filename) throws FileNotFoundException {    super(filename);   }   public void close() {    super.close();   }  }  static class InputReader extends BufferedReader {   StringTokenizer tokenizer;   public InputReader(InputStream inputStream) {    super(new InputStreamReader(inputStream), 32768);   }   public InputReader(String filename) {    super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));   }   public String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(readLine());     } catch (IOException e) {      throw new RuntimeException();     }    }    return tokenizer.nextToken();   }   public Integer nextInt() {    return Integer.valueOf(next());   }   public int[] readIntArray(int size) {    int[] array = new int[size];    for (int i = 0; i < size; i++)     array[i] = nextInt();    return array;   }  } }
6	public class q5 { static NoD[] arr; static int index,count,zc; static ArrayList<NoD> pos,neg; static long[][][][] dp;  static long solve(int a,int b, int c,int d, long mod) {  long[][][][] a2=dp;  int p=-1;  if(a==0 && b==0 && c==0) return 1;  if(dp[a][b][c][d]!=-1) return dp[a][b][c][d];  long tr=0;  if(a>0 && d!=1) {  tr=+a*solve(a-1,b,c,1,mod);  tr%=mod;  }  if(b >0 && d!=2) {  tr+=b*solve(a,b-1,c,2,mod);  tr%=mod;  }  if(c>0 && d!=3) {  tr+=c*solve(a,b,c-1,3,mod);  tr%=mod;  }  tr%=mod;  return dp[a][b][c][d]=tr;   }   public static void main(String[] args) throws IOException {   Reader.init(System.in);  PrintWriter out=new PrintWriter(System.out);  int n=Reader.nextInt(),t=Reader.nextInt();  long mod=(long)1e9+7,fact[]=new long[16];  dp=new long[16][16][16][4];  for(int i=0;i<16;i++) {  for(int j=0;j<16;j++) {   for(int k=0;k<16;k++)   Arrays.fill(dp[i][j][k], -1);  }  }  fact[0]=1;  for(int i=1;i<=15;i++) {  fact[i]=i*fact[i-1];  fact[i]%=mod;  }  NoD[] arr=new NoD[n];  for(int i=0;i<n;i++) {  int a=Reader.nextInt(),b=Reader.nextInt();  arr[i]=new NoD(a,b);    }  long ans=0;  for(int i=0;i<(1<<n);i++) {  int time=0;  int prev=-1;  int t1=0,t2=0,t3=0;  long[] c= {i};  BitSet b=BitSet.valueOf(c);  for(int j=0;j<n;j++) {   if(b.get(j)) {   time+=arr[j].val;    prev=arr[j].index;    if(arr[j].index==1) t1++;    else if(arr[j].index==2) t2++;    else t3++;   }  }  if(time==t) {   long v=1;   long v2=1;   v*=solve(t1,t2,t3,0,mod);   v%=mod;   ans+=v;   ans%=mod;  }  }  out.println(ans);  out.flush();   } } class NoD{ int val, index; NoD(int v,int i){  val=v;index=i; } } class Pair{ NoD a, b; Pair(NoD aa,NoD bb){  a=aa;b=bb; } }  class Reader {  static BufferedReader reader;  static StringTokenizer tokenizer;   static void init(InputStream input) {   reader = new BufferedReader(      new InputStreamReader(input) );   tokenizer = new StringTokenizer("");  }   static String nextLine() throws IOException{  return reader.readLine();  }  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() );  } }
6	public class D {  static boolean[][] adj;  static int n;  static int first;  public static void main(String[] args) throws IOException {   InputReader in = new InputReader();   n = in.nextInt();   int m = in.nextInt();   adj = new boolean[n][n];     dp = new long[1 << n][n];   for (int i = 0; i < m; i++) {    int f = in.nextInt() - 1;    int t = in.nextInt() - 1;    adj[f][t] = adj[t][f] = true;   }   boolean[] v = new boolean[1 << n];   long res = 0;   for (int f = 0; f < n; f++) {    first = f;    int cnt;    for (int i = 0; i < 1 << n; i+=(1<<first))     if ((i & (1 << first)) == 0)      for (int j = 0; j < n; j++)       dp[i][j] = -1;       for (int i = 0; i < 1 << n; i+= (1<<first)) {     cnt = Integer.bitCount(i);     if ((i & (1 << first)) == 0 && !v[i | (1 << first)] && cnt > 1) {      v[i | (1 << first)] = true;      res += solve(i, first, cnt);     }    }   }   System.out.println(res / 2);  }  static long[][] dp;  public static long solve(int msk, int lst, int cnt) {   if (cnt == 0)    return (adj[lst][first]) ? 1 : 0;   if (dp[msk][lst] != -1)    return dp[msk][lst];   long res = 0;   for (int i = 0; i < n; i++)    if (adj[lst][i] && (msk & (1 << i)) > 0)     res += solve(msk ^ (1 << i), i, cnt - 1);   return dp[msk][lst] = res;  }  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());   }  } }
2	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 MOD = (int) 1e9 + 7;   long power(long a, long k) {    long res = 1;    while (k > 0) {     if ((k & 1) != 0) {      res = res * a % MOD;     }     a = a * a % MOD;     k /= 2;    }    return res;   }   public void solve(int testNumber, InputReader in, OutputWriter out) {    long x = in.nextLong(), k = in.nextLong();    if (x == 0) {     out.println(0);     return;    }    long res = ((power(2, k + 1) % MOD) * (x % MOD)) % MOD;    long temp = power(2, k);    res = res - temp + 1;    while (res < 0) res += MOD;    out.println(res);   }  }  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 close() {    writer.close();   }   public void println(long i) {    writer.println(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 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);   }  } }
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();  }      public static void solve() {     int t=1;   u:while(t-->0){    int n=s(0);    int m=s(0);    int k=s(0);       long [][][]arr=new long [n][m][4];    for(int i=0;i<n;i++){     for(int j=0;j<m-1;j++){      long v=s(0l);      arr[i][j][0]=v;      arr[i][j+1][2]=v;     }    }    for(int i=0;i<n-1;i++){     for(int j=0;j<m;j++){      long v=s(0l);      arr[i][j][1]=v;      arr[i+1][j][3]=v;     }    }    Long [][][]dp=new Long [n][m][k+1];    for(int i=0;i<n;i++){     for(int j=0;j<m;j++)      for(int p=1;p<=k;p++)       helper(i,j,p,dp,arr,n,m);    }    for(int i=0;i<n;i++){     for(int j=0;j<m;j++)      p(dp[i][j][k]+" ");     pln("");    }   }     }    static int [][]dir=new int [][]{{0,1},{1,0},{0,-1},{-1,0}};  public static long helper(int i, int j, int k, Long [][][]dp, long [][][]arr, int n, int m){   if(k<0)    return -1;   if(k==0)    return 0;   if(dp[i][j][k]!=null)    return dp[i][j][k];   int x, y;   long ans=Long.MAX_VALUE,val;   for(int d=0;d<4;d++){    x=i+dir[d][0];    y=j+dir[d][1];    if(x<0||x>=n||y<0||y>=m)     continue;    val=helper(x,y,k-2,dp,arr,n,m);    if(val!=-1)     ans=Math.min(ans,val+2*arr[i][j][d]);   }   return dp[i][j][k]=(ans==Long.MAX_VALUE?-1:ans);    }  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){   System.out.println(l);   System.out.flush();   return sc.nextInt();  }  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{   int v,w;   Pair(int V, int W){    v=V;    w=W;   }    }   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());   }  } }
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); } }
3	public class A {  public static void main(String[] args) throws Exception {  new A().run(); }  public void run() throws Exception {  FastIO file = new FastIO();  int n = file.nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) a[i] = file.nextInt();  Arrays.sort(a);  boolean[] used = new boolean[n];  int count = 0;  for (int i = 0; i < n; i++) {  if (!used[i]) {   count++;   for (int j = i; j < n; j++) {   if (a[j] % a[i] == 0) {    used[j] = true;   }   }  }  }  System.out.println(count); }  public static class FastIO {  BufferedReader br;  StringTokenizer st;  public FastIO() {  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 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 - 1) / 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 - 1) / 2);  temp = (temp * temp);  return (temp * n);  } }  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; } }
3	public class CFContest {  public static void main(String[] args) throws Exception {   boolean local = System.getProperty("ONLINE_JUDGE") == null;   boolean async = true;   Charset charset = Charset.forName("ascii");   FastIO io = local ? new FastIO(new FileInputStream("D:\\DATABASE\\TESTCASE\\Code.in"), System.out, charset) : new FastIO(System.in, System.out, charset);   Task task = new Task(io, new Debug(local));   if (async) {    Thread t = new Thread(null, task, "dalt", 1 << 27);    t.setPriority(Thread.MAX_PRIORITY);    t.start();    t.join();   } else {    task.run();   }   if (local) {    io.cache.append("\n\n--memory -- \n" + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20) + "M");   }   io.flush();  }  public static class Task implements Runnable {   final FastIO io;   final Debug debug;   int inf = (int) 1e8;   long lInf = (long) 1e18;   public Task(FastIO io, Debug debug) {    this.io = io;    this.debug = debug;   }   @Override   public void run() {    solve();   }   public void solve() {    int n = io.readInt();    int[] data = new int[n];    for (int i = 0; i < n; i++) {     data[i] = io.readInt();    }    Arrays.sort(data);    boolean[] paint = new boolean[n];    int cnt = 0;    for (int i = 0; i < n; i++) {     if (paint[i]) {      continue;     }     cnt++;     for (int j = i; j < n; j++) {      if (data[j] % data[i] == 0) {       paint[j] = true;      }     }    }    io.cache.append(cnt);   }  }   public static class FastIO {   public final StringBuilder cache = new StringBuilder(20 << 20);   private final InputStream is;   private final OutputStream os;   private final Charset charset;   private StringBuilder defaultStringBuf = new StringBuilder(1 << 8);   private byte[] buf = new byte[1 << 20];   private int bufLen;   private int bufOffset;   private int next;   public FastIO(InputStream is, OutputStream os, Charset charset) {    this.is = is;    this.os = os;    this.charset = charset;   }   public FastIO(InputStream is, OutputStream os) {    this(is, os, Charset.forName("ascii"));   }   private int read() {    while (bufLen == bufOffset) {     bufOffset = 0;     try {      bufLen = is.read(buf);     } catch (IOException e) {      throw new RuntimeException(e);     }     if (bufLen == -1) {      return -1;     }    }    return buf[bufOffset++];   }   public void skipBlank() {    while (next >= 0 && next <= 32) {     next = read();    }   }   public int readInt() {    int sign = 1;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+' ? 1 : -1;     next = read();    }    int val = 0;    if (sign == 1) {     while (next >= '0' && next <= '9') {      val = val * 10 + next - '0';      next = read();     }    } else {     while (next >= '0' && next <= '9') {      val = val * 10 - next + '0';      next = read();     }    }    return val;   }   public long readLong() {    int sign = 1;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+' ? 1 : -1;     next = read();    }    long val = 0;    if (sign == 1) {     while (next >= '0' && next <= '9') {      val = val * 10 + next - '0';      next = read();     }    } else {     while (next >= '0' && next <= '9') {      val = val * 10 - next + '0';      next = read();     }    }    return val;   }   public double readDouble() {    boolean sign = true;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+';     next = read();    }    long val = 0;    while (next >= '0' && next <= '9') {     val = val * 10 + next - '0';     next = read();    }    if (next != '.') {     return sign ? val : -val;    }    next = read();    long radix = 1;    long point = 0;    while (next >= '0' && next <= '9') {     point = point * 10 + next - '0';     radix = radix * 10;     next = read();    }    double result = val + (double) point / radix;    return sign ? result : -result;   }   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);   }   public int readLine(char[] data, int offset) {    int originalOffset = offset;    while (next != -1 && next != '\n') {     data[offset++] = (char) next;     next = read();    }    return offset - originalOffset;   }   public int readString(char[] data, int offset) {    skipBlank();    int originalOffset = offset;    while (next > 32) {     data[offset++] = (char) next;     next = read();    }    return offset - originalOffset;   }   public int readString(byte[] data, int offset) {    skipBlank();    int originalOffset = offset;    while (next > 32) {     data[offset++] = (byte) next;     next = read();    }    return offset - originalOffset;   }   public char readChar() {    skipBlank();    char c = (char) next;    next = read();    return c;   }   public void flush() {    try {     os.write(cache.toString().getBytes(charset));     os.flush();     cache.setLength(0);    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public boolean hasMore() {    skipBlank();    return next != -1;   }  }  public static class Debug {   private boolean allowDebug;   public Debug(boolean allowDebug) {    this.allowDebug = allowDebug;   }   public void assertTrue(boolean flag) {    if (!allowDebug) {     return;    }    if (!flag) {     fail();    }   }   public void fail() {    throw new RuntimeException();   }   public void assertFalse(boolean flag) {    if (!allowDebug) {     return;    }    if (flag) {     fail();    }   }   private void outputName(String name) {    System.out.print(name + " = ");   }   public void debug(String name, int x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, long x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, double x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, int[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, long[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, double[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, Object x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, Object... x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.deepToString(x));   }  } }
3	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();  }  static class TaskA {   public void solve(int testNumber, Scanner in, PrintWriter out) {    int n = in.nextInt();    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = in.nextInt();    }    Arrays.sort(a);    int nc = 0;    for (int i = 0; i < n; i++) {     boolean divs = false;     for (int j = 0; j < i; j++) {      if (a[i] % a[j] == 0) {       divs = true;       break;      }     }     if (!divs) {      nc++;     }    }    out.println(nc);   }  } }
5	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]);  }  Map memo=new HashMap();  int[] f=new int[n];  for(int i=0;i<n;i++){  if(!memo.containsKey(A[i])){   memo.put(A[i],1);  }  else{   int ct=(int)memo.get(A[i]);   memo.put(A[i],ct+1);  }  int tot=0;  if(memo.containsKey(A[i]-1)){   tot+=(int)memo.get(A[i]-1);  }  if(memo.containsKey(A[i]+1)){   tot+=(int)memo.get(A[i]+1);  }  tot+=(int)memo.get(A[i]);  f[i]=tot;  }  BigInteger res=new BigInteger("0");  for(int i=0;i<n;i++){  int tot1=i+1-f[i];  int tot2=0;  if(memo.containsKey(A[i]-1)){   tot2+=(int)memo.get(A[i]-1);  }  if(memo.containsKey(A[i]+1)){   tot2+=(int)memo.get(A[i]+1);  }  tot2+=(int)memo.get(A[i]);  tot2=n-i-1-(tot2-f[i]);    res=res.add(BigInteger.valueOf((long)(tot1-tot2)*(long)A[i]));  }  System.out.println(res); } }
0	public class taskA {  void solve() throws IOException {  long a = nextLong();  long b = nextLong();  long ans = 0;  while (a != 0 && b != 0) {  if (a > b) {   ans += a / b;   a %= b;  } else {   long c = b % a;   ans += b / a;   b = a;   a = c;  }  }  out.println(ans); }  BufferedReader br; StringTokenizer st; PrintWriter out;  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 taskA().run(); }  String nextToken() throws IOException {  while ((st == null) || !st.hasMoreTokens())  st = new StringTokenizer(br.readLine());  return st.nextToken(); }  int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(nextToken()); }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(nextToken()); }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(nextToken()); } }
0	public class HexadecimalTheorem {  public static void main(String[] args) {   Scanner read = new Scanner(System.in);   int num = read.nextInt();   int zero, one, two, three;   zero = 0;   one = 1;   two = 1;   three = 2;   if(num == 0)    System.out.println("0 0 0");   else if(num == 1)    System.out.println("0 0 1");   else{    while(num != three){     zero = one;     one = two;     two = three;     three = three + one;    }    System.out.println(zero + " " + one + " " + one);   }  } }
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); } }
3	public class Main {  static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  static long mod=(long)1e9+7;  static long mod1=998244353;  static boolean sieve[];  static ArrayList<Integer> primes;  static ArrayList<Long> factorial;  static HashSet<Integer> graph[];  public static void main (String[] args) throws Exception {   String st[]=br.readLine().split(" ");   int n=Integer.parseInt(st[0]);   long input[]=new long[n];   st=br.readLine().split(" ");   for(int i=0;i<n;i++){    input[i]=Long.parseLong(st[i]);   }   HashMap<Long,ArrayList<Pair>> map=new HashMap<>();   long pref[]=new long[n+1];   pref[1]=input[0];   for(int i=1;i<n;i++){    pref[i+1]=pref[i]+input[i];   }   for(int i=0;i<n;i++){    for(int j=i;j<n;j++){     long sum=pref[j+1]-pref[i];     if(!map.containsKey(sum)){      ArrayList<Pair> list=new ArrayList<>();      list.add(new Pair(i,j));      map.put(sum,list);     }     else{      ArrayList<Pair> list=map.get(sum);      list.add(new Pair(i,j));     }    }   }   ArrayList<Pair> ans=new ArrayList<>();     for(long keys:map.keySet()){    ArrayList<Pair> list=map.get(keys);    Collections.sort(list,new PairComp());    int nn=list.size();    for(int j=0;j<=0;j++){     ArrayList<Pair> cur=new ArrayList<>();     cur.add(list.get(j));     int lim=list.get(j).v;     int i=j;     while(i<nn){      if(list.get(i).u<=lim){       i++;      }      else{       cur.add(list.get(i));       lim=list.get(i).v;       i++;      }     }     if(ans.size()<cur.size()){      ans=cur;     }    }   }   out.println(ans.size());   for(Pair p:ans){    out.println(++p.u+" "+ ++p.v);   }   out.flush();   out.close();  }   static void printPrecision(double d){   DecimalFormat ft = new DecimalFormat("0.00000000000000000");   out.println(ft.format(d));  }  static void Makegraph(int n){   graph=new HashSet[n];   for(int i=0;i<n;i++){    graph[i]=new HashSet<>();   }  }  static void addEdge(int a,int b){   graph[a].add(b);  }   static class PairComp implements Comparator<Pair>{   public int compare(Pair p1,Pair p2){    if(p1.v>p2.v){     return 1;    }    else if(p1.v<p2.v){     return -1;    }    else{     return p1.u-p2.u;    }   }  }  static class Pair implements Comparable<Pair> {   int u;   int v;   int index=-1;   public Pair(int u, int v) {    this.u = u;    this.v = v;   }    public int hashCode() {    int hu = (int) (u ^ (u >>> 32));    int hv = (int) (v ^ (v >>> 32));    return 31 * hu + hv;   }    public boolean equals(Object o) {    Pair other = (Pair) o;    return u == other.u && v == other.v;   }    public int compareTo(Pair other) {    if(index!=other.index)     return Long.compare(index, other.index);    return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);   }    public String toString() {    return "[u=" + u + ", v=" + v + "]";   }  }  static class PairCompL implements Comparator<Pairl>{   public int compare(Pairl p1,Pairl p2){    if(p1.v>p2.v){     return -1;    }    else if(p1.v<p2.v){     return 1;    }    else{     return 0;    }   }  }  static class Pairl implements Comparable<Pair> {    long u;    long v;    int index=-1;    public Pairl(long u, long v) {     this.u = u;     this.v = v;    }     public int hashCode() {     int hu = (int) (u ^ (u >>> 32));     int hv = (int) (v ^ (v >>> 32));     return 31 * hu + hv;    }     public boolean equals(Object o) {     Pair other = (Pair) o;     return u == other.u && v == other.v;    }     public int compareTo(Pair other) {     if(index!=other.index)      return Long.compare(index, other.index);     return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);    }     public String toString() {     return "[u=" + u + ", v=" + v + "]";    }   }  public static void debug(Object... o) {   System.out.println(Arrays.deepToString(o));  }  static long modulo(long a,long b,long c) {   long x=1;   long y=a;   while(b > 0){    if(b%2 == 1){     x=(x*y)%c;    }    y = (y*y)%c;    b /= 2;   }   return x%c;  }  static long gcd(long x, long y)  {   if(x==0)    return y;   if(y==0)    return x;   long r=0, a, b;   a = (x > y) ? x : y;   b = (x < y) ? x : y;   r = b;   while(a % b != 0)   {    r = a % b;    a = b;    b = r;   }   return r;  }  static void sieveMake(int n){   sieve=new boolean[n];   Arrays.fill(sieve,true);   sieve[0]=false;   sieve[1]=false;   for(int i=2;i*i<n;i++){    if(sieve[i]){     for(int j=i*i;j<n;j+=i){      sieve[j]=false;     }    }   }   primes=new ArrayList<Integer>();   for(int i=0;i<n;i++){    if(sieve[i]){     primes.add(i);    }   }    } }
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();  } }
5	public class ayyyyyy { public static void main(String[] args) { new ayyyyyy(); } Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out);  int t, n; int[] a;  ayyyyyy() {  t = in.nextInt();  while (t --> 0)  {  a = new int[n = in.nextInt()];  for (int i = 0; i < n; i++)   a[i] = in.nextInt();  shuffle(a);  Arrays.sort(a);  out.println(Math.min(n-2, a[n-2]-1));  }   out.close(); }  void shuffle(int[] x) {  for (int i = 0; i < n; i++)  {  int swp = (int)(n*Math.random());  int tmp = x[swp];  x[swp] = x[i];  x[i] = tmp;  } } }
1	public class B {  public static void main(String[] args) {  FastScanner sc = new FastScanner();  int T = sc.nextInt();  while(T-->0) {  int n = sc.nextInt();  if(n % 2 == 0 && issq(n/2)) {   System.out.println("YES");  }  else if(n % 4 == 0 && issq(n/4)) {   System.out.println("YES");  }  else {   System.out.println("NO");  }  }  }  static boolean issq(long x) {  long rx = (long)Math.sqrt(x);  return rx * rx == x; }  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);  }  } } }
0	public class Main { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  if (((n % 4) == 0) || ((n % 7) == 0) || ((n % 44) == 0) || ((n % 47) == 0) || ((n % 74) == 0) || ((n % 77) == 0) || ((n % 444) == 0) || ((n % 447) == 0) || ((n % 474) == 0) || ((n % 477) == 0) || ((n % 744) == 0) || ((n % 747) == 0) || ((n % 774) == 0) || ((n % 777) == 0))  System.out.print("YES");  else  System.out.print("NO");  in.close(); } }
1	public class Solution {  static class FastReader {   BufferedReader br;   StringTokenizer st;   public FastReader(String s) {    try {     br = new BufferedReader(new FileReader(s));    } catch (FileNotFoundException e) {         e.printStackTrace();    }   }   public FastReader() {    br = new BufferedReader(new InputStreamReader(System.in));   }   String nextToken() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {           e.printStackTrace();     }    }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(nextToken());   }   String nextLine() throws IOException {    return br.readLine();   }   long nextLong() {    return Long.parseLong(nextToken());   }   double nextDouble() {    return Double.parseDouble(nextToken());   }   float nextFloat() {    return Float.parseFloat(nextToken());   }  }   static FastReader f = new FastReader();  static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  static StringTokenizer st;  static StringBuilder sb = new StringBuilder();  static long[] fact;  static int[] inputArray(int n) throws IOException {   int[] a = new int[n];   for(int i = 0 ; i < n ; i++) {    a[i] = f.nextInt();   }   return a;  }  static long[] inputLongArray(int n) throws IOException {   long[] a = new long[n];   for(int i = 0 ; i < n ; i++) {    a[i] = f.nextLong();   }   return a;  }  static long gcd(long a , long b) {   if(a == 0 || b == 0) {    return Math.max(a , b);   }     if(a % b == 0) {    return b;   }   return gcd(b , a % b);  }  static void initializeFact() {   fact = new long[MAX_N];   for(int i = 0 ; i < fact.length ; i++) {    if(i == 0) {     fact[i] = 1;    }    else {     fact[i] = fact[i-1] * i % mod;    }   }  }  static long longModulus(long x , long m) {   if(x < m) {    return x;   }   long d = x / m;   return x - d * m;  }   static BitSet sieveOfEratosthenes(int n)  {   BitSet isPrime = new BitSet(n+1);   isPrime.set(0, n + 1);   isPrime.set(0);   isPrime.set(1);   for(int i = 2; i * i <= n ; i++)   {    if(isPrime.get(i))     for(int j = i * i ; j <= n; j += i)      isPrime.clear(j);   }   return isPrime;  }  static long moduloInversePrime(long a) {     return modPow(a , mod - 2);  }  static long mult(long a, long b)  {   return (a * b % mod);  }  static long modPow(long a, int step)  {   long ans = 1;   while(step != 0)   {    if((step & 1) != 0)     ans = mult(ans , a);    a = mult(a , a);    step >>= 1;   }   return ans;  }  static int query(int l , int r) {   System.out.println("? " + l + " " + r);   System.out.flush();   return f.nextInt();  }  static int sum(int n) {   return n * (n + 1) / 2;  }  private static final int mod = (int) (1e9 + 7);  static int MAX_N = (int) Math.sqrt(1e9);   public static void main(String[] args) throws IOException {   int test = f.nextInt();    TreeSet<Integer> set = new TreeSet<>();   for(int i = 1 ; i <= MAX_N ; i++) {    set.add(i*i*2);    set.add(i*i*4);   }    for(int t = 1 ; t <= test ; t++) {    int n = f.nextInt();    if(set.contains(n)) {     sb.append("YES").append("\n");    }    else {     sb.append("NO").append("\n");    }   }   System.out.println(sb);  }  }
1	public class Main {     public static void main(String[] args) {        Scanner in=new Scanner(System.in);   int n=in.nextInt();      if(n>=3&&n<=100)   {   int num[]=new int[n];   for(int i=0;i<n;i++)   {    num[i]=in.nextInt();   }   int even=0,odd=0,ceven=0,codd=0;   for(int i=0;i<n;i++)   {    if(num[i]%2==0)    {     even++;     ceven=i+1;        }    else    {     odd++;     codd=i+1;    }   }   if(odd==1)   {    System.out.println(""+codd);   }   else   {    System.out.println(""+ceven);   }   }  } }
2	public class Main {  public static long power(long a, long b, long c){  if(b == 0){  return 1;  }  a %= c;  if(b % 2 == 0){  return power((a % c * a % c) % c, b / 2, c);  }else{  return (a % c * power((a % c * a % c) % c, b / 2, c) % c) % c;  } }  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  long x = s.nextLong(), k = s.nextLong() + 1, mod = (long)Math.pow(10, 9) + 7;  long ans;  if(x == 0){  System.out.println(0);  return;  }   ans = ((power(2, k % (mod - 1), mod) % mod) * (x % mod)) % mod;  ans = (ans - power(2, (k - 1) % (mod - 1), mod) % mod + 2 * mod) % mod;  System.out.println((ans + 1) % mod);  } }
4	public class test {   static boolean isOK(String str, int len)  { HashSet<String> hs=new HashSet<String>();  for(int i=0;i<=str.length()-len;i++) {  String s=str.substring(i,len+i);  if(hs.contains(s))  return true;  else  hs.add(s); }  return false;  }  public static void main(String[] args)  {   Scanner in=new Scanner(System.in);   String str=in.next();     int i;   for(i=str.length()-1;i>=1;i--)    if(isOK(str,i))    {   break;    }     System.out.println(i);  } }
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 fi, PrintWriter out) {  long n, k;  n = fi.nextLong();  k = fi.nextLong();  long ans = 2 * n;  long mod = (long) Math.pow(10, 9) + 7;   if (k > 0) {   ans = (modulus(modulus(pow(2, k + 1, mod), mod) * modulus(n, mod), mod));   long temp = modulus(pow(2, k, mod) - 1, mod);   ans = modulus(modulus(ans, mod) - modulus(temp, mod), mod);   }  if (n == 0) {   ans = 0;  }  ans=ans%mod;  out.println(ans);  }  static long pow(long x, long y, long mod) {  if (y == 0) return 1 % mod;  if (y == 1) return x % mod;  long res = 1;  x = x % mod;  while (y > 0) {   if ((y % 2) != 0) {   res = (res * x) % mod;   }   y = y / 2;   x = (x * x) % mod;  }  return res;  }  static long modulus(long a, long mod) {  return (a % mod + mod) % mod;  }  }  static class InputReader {  private InputStream stream;  private byte[] buf = new byte[8192];  private int curChar;  private int snumChars;  private InputReader.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 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 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);  }  } }
6	public class e1 {  static int n; static int m; static int[][] mat;  public static void main(String[] args){  JS scan = new JS();  PrintWriter out = new PrintWriter(System.out);  int t = scan.nextInt();  for(int q = 1; q <= t; q++){  ans = 0;  n = scan.nextInt();  m = scan.nextInt();  mat = new int[n][m];  for(int i = 0; i < n; i++){   for(int j = 0; j < m; j++){   mat[i][j] = scan.nextInt();   }  }  int[] max = new int[m];  PriorityQueue<Item> pq = new PriorityQueue<Item>();  for(int i = 0; i < m; i++){   for(int j = 0; j < n; j++){   max[i] = Math.max(max[i], mat[j][i]);   }   pq.add(new Item(i, max[i]));  }  ArrayList<Item> guys = new ArrayList<Item>();  while(!pq.isEmpty() && guys.size() < 8){   Item tt = pq.poll();   guys.add(tt);  }  perm(guys, 0, new int[guys.size()]);  out.println(ans);  }  out.flush(); }  static int ans = 0;  static void perm(ArrayList<Item> guys, int me, int[] shift){  if(me == guys.size()){    int res = 0;  int[] best = new int[n];  for(int j = 0; j < guys.size(); j++){   Item g = guys.get(j);   int pp = g.a;   for(int i = 0; i < n; i++){   best[(i+shift[j])%n] = Math.max(best[(i+shift[j])%n], mat[i][pp]);   }  }  for(int i = 0; i < n; i++) res += best[i];  ans = Math.max(res, ans);  return;  }  for(int i = 0; i < n; i++){  shift[me] = i;  perm(guys, me+1, shift);  } }  static class Item implements Comparable<Item>{  int a;  int b;  public Item(int a, int b){  this.a = a;  this.b = b;  }  public int compareTo(Item o){  return o.b-this.b;  } }  static class JS{  public int BS = 1<<16;  public char NC = (char)0;  byte[] buf = new byte[BS];  int bId = 0, size = 0;  char c = NC;  double num = 1;  BufferedInputStream in;   public JS() {  in = new BufferedInputStream(System.in, BS);  }   public JS(String s) throws FileNotFoundException {  in = new BufferedInputStream(new FileInputStream(new File(s)), BS);  }   public char nextChar(){  while(bId==size) {   try {   size = in.read(buf);   }catch(Exception e) {   return NC;   }     if(size==-1)return NC;   bId=0;  }  return (char)buf[bId++];  }   public int nextInt() {  return (int)nextLong();  }   public long nextLong() {  num=1;  boolean neg = false;  if(c==NC)c=nextChar();  for(;(c<'0' || c>'9'); c = nextChar()) {   if(c=='-')neg=true;  }  long res = 0;  for(; c>='0' && c <='9'; c=nextChar()) {   res = (res<<3)+(res<<1)+c-'0';   num*=10;  }  return neg?-res:res;  }   public double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }   public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }   public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }   public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  } } }
5	public class CF903D {  public static void main(String[] args) throws Exception {   FastReader in = new FastReader(System.in);   PrintWriter pw = new PrintWriter(System.out);   int n = in.nextInt();   int a[] = new int[n+1];   int b[] = new int[n+1];   TreeSet<Integer> set = new TreeSet<>();   for(int i = 1; i <= n; i++){    a[i] = in.nextInt();    set.add(a[i]);   }   int k = 0;   HashMap<Integer, Integer> map = new HashMap<>();   int last = set.first();   for(int i : set){    if(i - last > 1) k += 2;    else k += 1;    map.put(i, k);    last = i;   }   for(int i = 1; i <= n; i++){    b[i] = map.get(a[i]);   }   BinaryIndexTree bit = new BinaryIndexTree(k);   BinaryIndexTree freq = new BinaryIndexTree(k);    BigInteger res = BigInteger.ZERO;   for(int i = n; i >= 1; i--){    long l = bit.query(1, b[i]-2), r = bit.query(b[i]+2, k);    long lf = freq.query(1, b[i]-2), rf = freq.query(b[i]+2, k);    res = res.add(BigInteger.valueOf(r));    res = res.add(BigInteger.valueOf(l));    res = res.subtract(BigInteger.valueOf(rf*a[i]));    res = res.subtract(BigInteger.valueOf(lf*a[i]));       bit.add(b[i], a[i]);    freq.add(b[i], 1);   }   pw.println(res);   pw.close();  }  static class BinaryIndexTree{   public long bit[];   int n, len;   public BinaryIndexTree(int nn){    n = nn;    bit = new long[n+1];    len = bit.length;   }   public void add(int index, long value){    for(; index < len;index = index + ( index & -index)){     bit[index] += value;    }   }   public long sum(int index){    if(index <= 0) return 0;    long sum = 0;    for(; index > 0;index = index - (index & -index)){     sum += bit[index];    }    return sum;   }   public long query(int i, int j){    if(j < i) return 0;    return sum(j) - sum(i-1);   }   }   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);   }     } }
3	public class A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int count = sc.nextInt();   HashSet<Integer> set = new HashSet<>();   for (int i = 0; i < count; i++) {    set.add(sc.nextInt());   }   ArrayList<Integer> list = new ArrayList<>(set);   Collections.sort(list);   for (int i = 0; i < list.size(); i++) {    for (int j = i + 1; j < list.size(); j++) {     if (list.get(i) % list.get(j) == 0 ||       list.get(j) % list.get(i) == 0) {      list.remove(j);      j--;     }    }   }   System.out.println(list.size());  } }
3	public class Main {  public static void main(String[] args) throws Exception {   new Main().run();}                                                                                                       static long mul(long a, long b, long p)  {   long res=0,base=a;   while(b>0)   {    if((b&1L)>0)     res=(res+base)%p;    base=(base+base)%p;    b>>=1;   }   return res;  }  static long mod_pow(long k,long n,long p){   long res = 1L;   long temp = k;   while(n!=0L){    if((n&1L)==1L){     res = (res*temp)%p;    }    temp = (temp*temp)%p;    n = n>>1L;   }   return res%p;  }  int ct = 0;  int f[] =new int[200001];  int b[] =new int[200001];  int str[] =new int[200001];  void go(int rt,List<Integer> g[]){   str[ct] = rt;   f[rt] = ct;   for(int cd:g[rt]){    ct++;    go(cd,g);   }   b[rt] = ct;  }  int add =0;  void go(int rt,int sd,int k,List<Integer> g[],int n){   if(add>n) {    return;   }   Queue<Integer> q =new LinkedList<>();   q.offer(rt);   for(int i=1;i<=sd;++i){    int sz =q.size();    if(sz==0) break;    int f = (i==1?2:1);    while(sz-->0){     int cur = q.poll();     for(int j=0;j<k-f;++j){      q.offer(add);      g[cur].add(add);add++;      if(add==n+1){       return;      }     }    }   }   }   void solve() {   int n = ni();   long s[] = new long[n+1];   for(int i=0;i<n;++i){    s[i+1] = s[i] + ni();   }   Map<Long,List<int[]>> mp = new HashMap<>();   for(int i=0;i<n;++i) {    for (int j = i; j>=0; --j) {     long v = s[i+1]-s[j];     if(!mp.containsKey(v)){      mp.put(v, new ArrayList<>());     }     mp.get(v).add(new int[]{j,i});    }   }   int all = 0;long vv = -1;   for(long v:mp.keySet()){    List<int[]> r = mp.get(v);    int sz = r.size();int c = 0;    int ri = -2000000000;    for(int j=0;j<sz;++j){     if(r.get(j)[0]>ri){      ri = r.get(j)[1];c++;     }    }    if(c>all){     all = c;     vv = v;    }   }   println(all);   List<int[]> r = mp.get(vv);   int sz = r.size();int c = 0;   int ri = -2000000000;   for(int j=0;j<sz;++j){    if(r.get(j)[0]>ri){     ri = r.get(j)[1];println((1+r.get(j)[0])+" "+(1+r.get(j)[1]));    }   }                                                                                                                                                }       long t1[];   void update(long[] t,int i,long v){   for(;i<t.length;i+=(i&-i)){    t[i] += v;   }  }  long get(long[] t,int i){   long s = 0;   for(;i>0;i-=(i&-i)){    s += t[i];   }   return s;  }  int equal_bigger(long t[],long v){   int s=0,p=0;   for(int i=Integer.numberOfTrailingZeros(Integer.highestOneBit(t.length));i>=0;--i) {    if(p+(1<<i)< t.length && s + t[p+(1<<i)] < v){     v -= t[p+(1<<i)];     p |= 1<<i;    }   }   return p+1;  }      static class S{   int l = 0;   int r = 0 ;   long le = 0;   long ri = 0;   long tot = 0;   long all = 0;   public S(int l,int r) {    this.l = l;    this.r = r;   }  }  static S a[];  static int[] o;  static void init(int[] f){   o = f;   int len = o.length;   a = new S[len*4];   build(1,0,len-1);  }  static void build(int num,int l,int r){   S cur = new S(l,r);   if(l==r){    a[num] = cur;    return;   }else{    int m = (l+r)>>1;    int le = num<<1;    int ri = le|1;    build(le, l,m);    build(ri, m+1,r);    a[num] = cur;    pushup(num, le, ri);   }  }                static long dd = 10007;  static void update(int num,int l,long v){   if(a[num].l==a[num].r){    a[num].le = v%dd;    a[num].ri = v%dd;    a[num].all = v%dd;    a[num].tot = v%dd;   }else{    int m = (a[num].l+a[num].r)>>1;    int le = num<<1;    int ri = le|1;    pushdown(num, le, ri);    if(l<=m){     update(le,l,v);    }    if(l>m){     update(ri,l,v);    }    pushup(num,le,ri);   }  }  static void pushup(int num,int le,int ri){   a[num].all = (a[le].all*a[ri].all)%dd;   a[num].le = (a[le].le + a[le].all*a[ri].le)%dd;   a[num].ri = (a[ri].ri + a[ri].all*a[le].ri)%dd;   a[num].tot = (a[le].tot + a[ri].tot + a[le].ri*a[ri].le)%dd;     }  static void pushdown(int num,int le,int ri){  }   int gcd(int a,int b){ return b==0?a: gcd(b,a%b);}  InputStream is;PrintWriter out;  void run() throws Exception {is = System.in;out = new PrintWriter(System.out);solve();out.flush();}  private byte[] inbuf = new byte[2];  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 char ncc() {int b;while((b = readByte()) != -1 && !(b >= 32 && b <= 126));return (char)b;}  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 String nline() {int b = skip();StringBuilder sb = new StringBuilder();   while (!isSpaceChar(b) || b == ' ') { sb.appendCodePoint(b);b = readByte(); }   return sb.toString();}  private char[][] nm(int n, int m) {char[][] a = new char[n][];for (int i = 0; i < n; i++) a[i] = ns(m);return a;}  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 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 << 3) + (num << 1) + (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();}}  void print(Object obj){out.print(obj);}  void println(Object obj){out.println(obj);}  void println(){out.println();} }
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 A { String line;  void run()throws IOException{  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));   line = bf.readLine();  int i, j, len = line.length(), max=0;  for(i=0; i<len; i++){  for(j=i; j<len; j++){   if(line.indexOf(line.substring(i,j+1), i+1)>0){   if(j-i+1>max) max = j-i+1;   }  }  }  System.out.println(max); }  public static void main(String[] args)throws IOException {  new A().run(); } }
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 int x,y;  public static void main(String[] args){   FastScanner in = new FastScanner();   FastWriter out = new FastWriter();   int n=in.nextInt();   int m=in.nextInt();   int k=in.nextInt();   int[][] right=new int[n][m-1];   int[][] down=new int[n-1][m];   for (int i = 0; i < n; i++) {    right[i]=in.nextArray(m-1);   }   for (int i = 0; i < n - 1; i++) {    down[i]=in.nextArray(m);   }   if(k%2!=0){    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      out.print("-1 ");     }     out.println();    }   }else {    int[][] dp=new int[n][m];    int[][] dp1=new int[n][m];    for (int i = 0; i < k / 2; i++) {     for (int j = 0; j < n; j++) {      for (int l = 0; l < m; l++) {       int ans=Integer.MAX_VALUE;       if(j>0){        ans=Math.min(ans,dp[j-1][l]+down[j-1][l]);       }       if(l>0){        ans=Math.min(ans,dp[j][l-1]+right[j][l-1]);       }       if(j!=n-1){        ans=Math.min(ans,dp[j+1][l]+down[j][l]);       }       if(l!=m-1){        ans=Math.min(ans,dp[j][l+1]+right[j][l]);       }       dp1[j][l]=ans;      }     }     dp=dp1;     dp1=new int[n][m];    }    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      out.println((2*dp[i][j])+" ");     }     out.println();    }   }   out.close();  } }
5	public class A {  public static void main(String[] args) throws IOException {   new A().solveProblem();   out.close(); }  static Scanner in = new Scanner(new InputStreamReader(System.in));  static PrintStream out = new PrintStream(new BufferedOutputStream(System.out));   public void solveProblem() {   int n = in.nextInt() ;  E[] get = new E[n] ;  for( int i = 0 ; i < n ; i++ ){  get[i] = new E(i,in.nextInt()) ;  }   sort(get) ;    if( get[n-1].g == 1){  get[n-1].g = 2 ;  }else{  get[n-1].g = 1 ;    }  sort(get) ;  for( int i = 0 ; i < n - 1 ; i++ )  out.print(get[i].g +" " ) ;  out.println(get[n-1].g) ;   }  class E implements Comparable<E>{  int g ;  int index ;   public E( int index, int g){  this.g = g ;  this.index = index ;  }   public int compareTo( E e){  return g - e.g ;  } }  static int[] readGet( int n ){  int[] get = new int[n] ;  for( int i = 0 ; i < n ; i++ )   get[i] = in.nextInt();  return get ; }    }
4	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();  }  static class TaskD {   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 m = in.nextInt();    int k = in.nextInt();    int[][][] dis = new int[n][m][4];    int[][] dir = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};    int tmp;    final int M = (int) (1e8);    Algo.fill(dis, M);    for (int i = 0; i < n; i++) {     for (int j = 0; j < m - 1; j++) {      tmp = in.nextInt();      dis[i][j][0] = tmp;      dis[i][j + 1][1] = tmp;     }    }    for (int i = 0; i < n - 1; i++) {     for (int j = 0; j < m; j++) {      tmp = in.nextInt();      dis[i][j][2] = tmp;      dis[i + 1][j][3] = tmp;     }    }    int[][] ans = new int[n][m];    if (k % 2 == 1) {     Algo.fill(ans, -1);    } else {     int halfK = k / 2;     int[][][] dp = new int[halfK + 1][n][m];     Algo.fill(dp, M);     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       dp[0][i][j] = 0;      }     }     for (int step = 1; step <= halfK; step++) {      for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {        for (int d = 0; d < dir.length; d++) {         int toX = i + dir[d][0];         int toY = j + dir[d][1];         if (toX < 0 || toY < 0 || toX >= n || toY >= m) continue;         dp[step][i][j] = Math.min(dp[step - 1][toX][toY] + 2 * dis[i][j][d], dp[step][i][j]);        }       }      }     }     ans = dp[halfK];    }     for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      out.print(ans[i][j]);      out.print(' ');     }     out.println("");    }    }  }  static class Algo {   public static void fill(int[][] iss, int v) {    for (int[] is : iss) Arrays.fill(is, v);   }   public static void fill(int[][][] isss, int v) {    for (int[][] iss : isss) Algo.fill(iss, v);   }  }  static 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());   }  } }
1	public class CF1027D { public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  StringTokenizer st = new StringTokenizer(br.readLine());  int[] cc = new int[n];  for (int i = 0; i < n; i++)  cc[i] = Integer.parseInt(st.nextToken());  st = new StringTokenizer(br.readLine());  int[] aa = new int[n];  for (int i = 0; i < n; i++)  aa[i] = Integer.parseInt(st.nextToken()) - 1;  int[] used = new int[n];  int ans = 0;  for (int i = 0; i < n; i++) {  if (used[i] == 2)   continue;  int j = i;  while (used[j] == 0) {   used[j] = 1;   j = aa[j];  }  if (used[j] == 1) {   int c = cc[j];   while (used[j] == 1) {   used[j] = 2;   c = Math.min(c, cc[j]);   j = aa[j];   }   ans += c;  }  j = i;  while (used[j] == 1) {   used[j] = 2;   j = aa[j];  }  }  System.out.println(ans); } }
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 ");          } }
2	public class Main {  public static void main (String[] argv)  {  new Main(); }       boolean test = false;  int n;  long mod = 1000000007; public Main() {  FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));    long x = in.nextLong();  long k = in.nextLong();    if (x == 0) {   System.out.println(0);   return;  }    if (k == 0) {   x %= mod;   System.out.println((2*x%mod));   return;  }    x %= mod;    long f = pow(2, k);  long ans = ((2 * f * x % mod - f + 1) % mod + mod) % mod;    System.out.println(ans);   }  private long pow(long x, long y) {  long ans = 1;  while (y > 0) {   if (y % 2 == 1)     ans = ans * x % mod;   x = x * x % mod;   y /= 2;  }  return ans; }  private long gcd(long x, long y) {  if (y == 0) return x;  return gcd(y, x % y); } private int max(int a, int b) {  return a > b ? a : b; }  private int min(int a, int b) {  return a > b ? b : a; }   static class FastReader  {   BufferedReader br;   StringTokenizer st;    public FastReader(BufferedReader in)   {       br = in;   }    String next()   {    while (st == null || !st.hasMoreElements())    {     try     {      String line = br.readLine();      if (line == null || line.length() == 0) return "";      st = new StringTokenizer(line);     }     catch (IOException e)     {      return "";          }    }    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)    {     return "";        }    return str;   }  } }
4	public class A {  static Scanner sc = new Scanner(System.in);  public static void main(String[] args) {   String s = sc.next();   for (int l = s.length(); l > 0; --l) {    HashSet<String> set = new HashSet<String>();    for (int i = 0; i < s.length() - l + 1; ++i)     if (set.contains(s.substring(i, i + l))) {      System.out.println(l);      return;     } else {      set.add(s.substring(i, i + l));     }   }   System.out.println(0);  } }
2	public class B { public static BufferedReader in; public static PrintWriter out;  public static void main(String[] args) throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  boolean showLineError = true;  if (showLineError) {  solve();  out.close();  } else {  try {   solve();  } catch (Exception e) {  } finally {   out.close();  }  }  }  static void debug(Object... os) {  out.println(Arrays.deepToString(os)); }  private static void solve() throws IOException {  String[] line = in.readLine().split(" ");  long n = Long.parseLong(line[0]) - 1;  long k = Long.parseLong(line[1]) - 1;  if (f(1, k) < n) {  out.println(-1);  return;  }  if (n == 0) {  out.println(0);  return;  }  long lo = 0l;  long hi = k;  while (lo + 1l < hi) {  long m = (lo + hi) / 2l;  long f = f(k - m + 1, k);  if (f < n) {   lo = m;  } else {   hi = m;  }  }  out.println(hi);  }  private static long f(long lo, long hi) {  return (lo + hi) * (hi - lo + 1l) / 2l; } }
5	public class p1096f {  static long MOD = 998244353;  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   BIT invert = new BIT(n+5);   BIT neg = new BIT(n+5);   long res = 0;   int[] arr = new int[n];   boolean[] has = new boolean[n+1];   long num1 = 0;   for(int i = 0; i < n; i++) {    arr[i] = in.nextInt();    if(arr[i] != -1) {     res += invert.read(n+5)-invert.read(arr[i]);     res %= MOD;     invert.update(arr[i], 1);     has[arr[i]] = true;    } else num1++;   }   if(num1 == 0) {    System.out.println(res);    return;   }   for(int i = 1; i <= n; i++) if(!has[i]) neg.update(i, 1);   long invertNum1 = modInv(num1, MOD);   res += ((num1*(num1-1))%MOD)*modInv(4, MOD);   res %= MOD;   long cnt = 0;   for(int i = 0; i < n; i++) {    if(arr[i] == -1) {     cnt++;     continue;    }    res += (((neg.read(n+5)-neg.read(arr[i]))*cnt)%MOD)*invertNum1;    res %= MOD;   }   cnt = 0;   for(int i = n-1; i >= 0; i--) {    if(arr[i] == -1) {     cnt++;     continue;    }    res += (((neg.read(arr[i]))*cnt)%MOD)*invertNum1;    res %= MOD;   }   System.out.println(res);  }     static class BIT {    int n;    int[] tree;    public BIT(int n) {      this.n = n;      tree = new int[n + 1];    }    int read(int i) {      int sum = 0;      while (i > 0) {        sum += tree[i];        i -= i & -i;      }      return sum;    }    void update(int i, int val) {      while (i <= n) {        tree[i] += val;        i += i & -i;      }    }     }          static long modInv(long x, long mod) {   return (BigInteger.valueOf(x).modInverse(BigInteger.valueOf(mod))).longValue();  }  static long modInv(long a, long b, long y0, long y1, long q0, long q1) {    long y2 = y0 - y1*q0;    return b == 0 ? y2 : modInv(b, a % b, y1, y2, q1, a / b);  }     static long gcd(long a, long b) { return b == 0 ? a : gcd(b, a % b); }  static long lcm(long a, long b) { return a / gcd(a, b) * b; }  }
2	public class C { FastScanner in; PrintWriter out; boolean systemIO = true;  public static void quickSort(int[] a, int from, int to) {  if (to - from <= 1) {  return;  }  int i = from;  int j = to - 1;  int x = a[from + (new Random()).nextInt(to - from)];  while (i <= j) {  while (a[i] < x) {   i++;  }  while (a[j] > x) {   j--;  }  if (i <= j) {   int t = a[i];   a[i] = a[j];   a[j] = t;   i++;   j--;  }  }  quickSort(a, from, j + 1);  quickSort(a, j + 1, to); }  long mod = 1000000007;  public long pow(long k) {  if (k == 0) {  return 1L;  }  if (k == 1) {  return 2L;  }  if (k % 2 == 1) {  return (2L * pow(k - 1)) % mod;  }  long x = pow(k / 2);  return (x * x) % mod; }  public void solve() {  long x = in.nextLong();  if (x == 0) {  out.println(0);  return;  }  x %= mod;  long k = in.nextLong();  long pow = pow(k);  long ans = 1;  ans = (ans - pow + mod) % mod;  ans = (ans + (((2 * pow) % mod) * x) % mod) % mod;  out.println(ans); }  public void run() {  try {  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();  } 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[] args) {  new C().run(); } }
5	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(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, ScanReader in, PrintWriter out) {    int n = in.scanInt();    BigInteger ans = new BigInteger("0");    long val, index, index1, index2;    long sum[] = new long[n];    val = in.scanInt();    HashMap<Long, Integer> hs = new HashMap<>();    hs.put(val, 1);    sum[0] = val;    for (int i = 1; i < n; i++) {     val = in.scanInt();     sum[i] += sum[i - 1];     sum[i] += val;     if (!hs.containsKey(val)) hs.put(val, 0);     hs.put(val, hs.get(val) + 1);     ans = ans.add(BigInteger.valueOf(((i + 1) * val) - sum[i]));     index = (hs.containsKey(val + 1)) ? hs.get(val + 1) : 0;     index1 = (hs.containsKey(val - 1)) ? hs.get(val - 1) : 0;     index2 = (hs.containsKey(val)) ? hs.get(val) : 0;     ans = ans.subtract(BigInteger.valueOf(((index + index1 + index2) * val) - ((index * (val + 1)) + (index1 * (val - 1)) + (index2 * (val)))));    }    out.println(ans);    }  }  static class ScanReader {   private byte[] buf = new byte[4 * 1024];   private int index;   private BufferedInputStream in;   private int total;   public ScanReader(InputStream inputStream) {    in = new BufferedInputStream(inputStream);   }   private int scan() {    if (index >= total) {     index = 0;     try {      total = in.read(buf);     } catch (Exception e) {      e.printStackTrace();     }     if (total <= 0) return -1;    }    return buf[index++];   }   public int scanInt() {    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();     }    }    return neg * integer;   }   private boolean isWhiteSpace(int n) {    if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;    else 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);   }  } }
4	public class Main {  static Scanner in = new Scanner(System.in);  public static  void main(String[] args)  {   String s = in.nextLine();   int k, ans = 0;   for(int i = 0; i < s.length(); i++)    for(int j = i + 1; j < s.length(); j++)    {     for(k = 0; j + k < s.length(); k++)     {      if(s.charAt(i + k) != s.charAt(j + k)) break;     }     if(ans < k) ans = k;    }   System.out.println(ans);  } }
2	public class BBi implements Runnable { public static void main(String[] args) {  new Thread(new BBi()).run(); }  BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer in; PrintWriter out = new PrintWriter(System.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 long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  int n, x, y;  public long count(long z) {  long total = 0;  long[][] c = new long[][] { { x, y }, { y, n - x + 1 },   { n - x + 1, n - y + 1 }, { n - y + 1, x } };  for (int i = 0; i < c.length; i++) {  long inside = z;   for (int j = 0; j < c[i].length; j++) {   if (z > c[i][j]) {   total += Math.min(z - c[i][j], c[i][1 - j]) * c[i][j];   inside -= (z - c[i][j]);   }  }   if (z > c[i][0] && z > c[i][1]) {   total -= Math.min(z - c[i][0], c[i][1])    * Math.min(z - c[i][1], c[i][0]);  }   if (inside > 0)   total += inside * (inside + 1) / 2;  }  for (int i = 0; i < c.length; i++) {  total -= Math.min(z, c[i][0]);  }  return total + 1; }  public long solve(int n, int x, int y, long c) throws IOException {  this.n = n;  this.x = x;  this.y = y;   long l = 0;  long r = 2L * n + 2;  while (r - l > 1) {  long z = (l + r) / 2;   if (c <= count(z)) {   r = z;  } else {   l = z;  }  }  return r - 1; }  public void run() {  try {  out.println(solve(nextInt(), nextInt(), nextInt(), nextLong()));  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } } }
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);  } } }
4	public class p1 {    public static void main(String[] args) {   new p1().run();  }  private void run() {   try {       Scanner scanner = new Scanner(System.in);    String in = scanner.next();       Hashtable<String, Boolean> tmp = new Hashtable<String, Boolean>();    int sol = 0;    for (int i = 0; i < in.length(); i++) {     for (int j = i + 1; j <= in.length(); j++) {      String str = in.substring(i, j);      if (tmp.containsKey(str)) {       if (tmp.get(str)) {        if(str.length() > sol) sol=str.length();        boolean tmp1 = tmp.remove(str);        tmp.put(str, false);       }      } else {       tmp.put(str, Boolean.TRUE);      }     }    }    System.out.println(sol);   } catch (Exception ex) {   }  }   }
5	public class Cottage {   public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int t = sc.nextInt();   List<Point> houses = new ArrayList<Point>();   for (int i = 0; i < n; i++) {    int x = sc.nextInt();    int a = sc.nextInt();    houses.add(new Point(x, a));   }   Collections.sort(houses, new Comparator<Point>() {       @Override    public int compare(Point o1, Point o2) {     return ((Integer) o1.x).compareTo(o2.x);    }   });   int pos = 2;   for (int i = 0; i < n - 1; i++) {    double end = houses.get(i).x + (houses.get(i).y+0.0)/2;    double start = houses.get(i+1).x - (houses.get(i+1).y+0.0)/2;       double diff = start-end;       if (Math.abs(diff-t) < 0.0000001) {     pos++;    }    if (diff > t) {     pos += 2;    }   }   System.out.println(pos);  } }
5	public class Main  {  public static void main(String[] args)  {  Scanner keyboard = new Scanner(System.in);  int size = Integer.parseInt(keyboard.nextLine());  int[] arr = new int[size];  int i = 0;  while( size != 0 )  {   arr[i] = keyboard.nextInt();   size--;   i++;  }    if( arr.length == 1 )  {   System.out.println("NO");  }  else  {   Arrays.sort(arr);   boolean val = false;   int ans = 0;   for ( i = 0; i< arr.length-1 ; i++ )   {   if( arr[i] != arr[i+1] )   {   val = true;   ans = arr[i+1];   System.out.println(ans);   i = arr.length;   }   else if( i == arr.length-2 )  {   System.out.println("NO");   }   }  } } }
2	public class C extends PrintWriter {  final long mod = 1_000_000_007;  long pow(long n, long p) {   long r = 1;   while (p > 0) {    if (p % 2 == 1) {     r = (r * n) % mod;    }    n = (n * n) % mod;    p /= 2;   }   return r;  }  long solve(long n, long k) {   if (k == 0) {    return (2 * n) % mod;   }   if (n == 0) {    return 0;   }   long m = pow(2, k);   long a = 2;   a = (a * n) % mod;   a = (a * m) % mod;   long b = (m + mod - 1) % mod;   return ((a - b + mod) % mod);  }  void run() {   long n = nextLong();   long k = nextLong();   println(solve(n, k));  }  boolean skip() {   while (hasNext()) {    next();   }   return true;  }  int[][] nextMatrix(int n, int m) {   int[][] matrix = new int[n][m];   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     matrix[i][j] = nextInt();   return matrix;  }  String next() {   while (!tokenizer.hasMoreTokens())    tokenizer = new StringTokenizer(nextLine());   return tokenizer.nextToken();  }  boolean hasNext() {   while (!tokenizer.hasMoreTokens()) {    String line = nextLine();    if (line == null) {     return false;    }    tokenizer = new StringTokenizer(line);   }   return true;  }  int[] nextArray(int n) {   int[] array = new int[n];   for (int i = 0; i < n; i++) {    array[i] = nextInt();   }   return array;  }  int nextInt() {   return Integer.parseInt(next());  }  long nextLong() {   return Long.parseLong(next());  }  double nextDouble() {   return Double.parseDouble(next());  }  String nextLine() {   try {    return reader.readLine();   } catch (IOException err) {    return null;   }  }  public C(OutputStream outputStream) {   super(outputStream);  }  static BufferedReader reader;  static StringTokenizer tokenizer = new StringTokenizer("");  static Random rnd = new Random();  static boolean OJ;  public static void main(String[] args) throws IOException {   OJ = System.getProperty("ONLINE_JUDGE") != null;   C solution = new C(System.out);   if (OJ) {    reader = new BufferedReader(new InputStreamReader(System.in));    solution.run();   } else {    reader = new BufferedReader(new FileReader(new File(C.class.getName() + ".txt")));    long timeout = System.currentTimeMillis();    while (solution.hasNext()) {     solution.run();     solution.println();     solution.println("----------------------------------");    }    solution.println("time: " + (System.currentTimeMillis() - timeout));   }   solution.close();   reader.close();  } }
5	public class Main {  FastScanner in = new FastScanner(System.in);    PrintWriter out = new PrintWriter(System.out);  public static void main (String[]args) {   Main task = new Main();   task.solve();   task.close();  }  public void close () {   in.close();   out.close();  }   public void solve() {   int n = in.nextInt();   int k = in.nextInt();     Team[]teams = new Team[n];     for (int i = 0; i < n; i++) {    Team t = new Team();    t.tasks = in.nextInt();    t.penalty = in.nextInt();    teams[i] = t;   }     Arrays.sort(teams);     Team t = teams[k - 1];   int ans = 0;   for (int i = 0; i < teams.length; i++) {    if (teams[i].equals(t)) ans++;   }      System.out.println(ans);        }  class Team implements Comparable<Team>{   int tasks;   int penalty;   @Override   public int hashCode() {    final int prime = 31;    int result = 1;    result = prime * result + getOuterType().hashCode();    result = prime * result + penalty;    result = prime * result + tasks;    return result;   }   @Override   public boolean equals(Object obj) {    if (this == obj)     return true;    if (obj == null)     return false;    if (getClass() != obj.getClass())     return false;    Team other = (Team) obj;    if (!getOuterType().equals(other.getOuterType()))     return false;    if (penalty != other.penalty)     return false;    if (tasks != other.tasks)     return false;    return true;   }   @Override   public int compareTo(Team o) {    if (this.tasks > o.tasks) return -1;    else if (this.tasks == o.tasks) {     if (this.penalty <= o.penalty) return -1;     else return 1;    }    else return 1;   }   private Main getOuterType() {    return Main.this;   }    }   public int max (int a, int b) {   if (a > b) return a;   else return b;  }    }  class Algebra {   public static int phi(int n) {   int result = n;   for (int i = 2; i*i <= n; ++i) {    if (n % i == 0) {     while (n % i == 0) {      n /= i;     }     result -= result / i;    }   }   if (n > 1) {    result -= result / n;   }   return result;  }    public static int binpow (int a, int n) {   int res = 1;   while (n != 0) {    if ((n & 1) == 1)     res *= a;    a *= a;    n >>= 1;   }   return res;  }    public static int gcd (int a, int b) {   return (b != 0) ? gcd (b, a % b) : a;  }    public static int lcm (int a, int b) {   return a / gcd (a, b) * b;  }    public static boolean[] sieveOfEratosthenes (int n) {   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]) {     if (i * 1L * i <= n) {      for (int j=i*i; j<=n; j+=i) {       prime[j] = false;      }     }    }   }   return prime;  }  } class FastScanner {  BufferedReader br;  StringTokenizer st;   FastScanner(File f) {   try {    br = new BufferedReader(new FileReader(f));   } catch (FileNotFoundException e) {    e.printStackTrace();   }  }   FastScanner(InputStream in) {   br = new BufferedReader(new InputStreamReader(in));  }   String next() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (IOException e) {     System.err.println(e);     return "";    }   }   return st.nextToken();  }  int nextInt() {   return Integer.parseInt(next());  }  long nextLong() {   return Long.parseLong(next());  }  double nextDouble() {   return Double.parseDouble(next());  }  float nextFloat() {   return Float.parseFloat(next());  }  BigInteger nextBigInt() {   return new BigInteger(next());  }  void close() {   try {    br.close();   }   catch (IOException e) {   }  } }
3	public class F547 {  public static void main(String[] args) {  FastScanner in = new FastScanner(System.in);   int N = in.nextInt();  int[] arr = new int[N];  for(int i = 0; i < N; i++)  arr[i] = in.nextInt();   long[] sum = new long[arr.length + 1];  for(int i = 1; i < sum.length; i++)  sum[i] = sum[i-1] + arr[i-1];   HashMap<Long, ArrayList<Pair>> map = new HashMap<>();   for(int i = 0; i < sum.length; i++) {  for(int j = i+1; j < sum.length; j++) {   long diff = sum[j] - sum[i];     if(!map.containsKey(diff))   map.put(diff, new ArrayList<>());     ArrayList<Pair> list = map.get(diff);   list.add(new Pair(i, j));  }  }   for(long key : map.keySet()) {  ArrayList<Pair> list1 = map.get(key);  Collections.sort(list1);    ArrayList<Pair> list2 = new ArrayList<>();    int end = 0;  for(Pair p : list1) {   if(end <= p.a) {   list2.add(p);   end = p.b;   }  }    map.put(key, list2);  }   long maxKey = -1;  int max = -1;  for(long key : map.keySet()) {  if(map.get(key).size() > max) {   max = map.get(key).size();   maxKey = key;  }  }   ArrayList<Pair> list = map.get(maxKey);  StringBuilder sb = new StringBuilder();  sb.append(list.size());  sb.append("\n");   for(Pair p : list) {  sb.append((1 + p.a) + " " + p.b);  sb.append("\n");  }   System.out.println(sb.toString()); }  static class Pair implements Comparable<Pair> {  int a, b;   public Pair(int x, int y) {  a = x;  b = y;  }   public int compareTo(Pair other) {  if(b != other.b) {   return b - other.b;  }  return other.a - a;  }   public String toString() {  return "(" + a + ", " + b + ")";  } }   static class FastScanner {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int chars;  public FastScanner(InputStream stream) {  this.stream = stream;  }  int read() {  if (chars == -1)   throw new InputMismatchException();  if (curChar >= chars) {   curChar = 0;   try {   chars = stream.read(buf);   } catch (IOException e) {   throw new InputMismatchException();   }   if (chars <= 0)   return -1;  }  return buf[curChar++];  }  boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  boolean isEndline(int c) {  return c == '\n' || c == '\r' || c == -1;  }  public int nextInt() {  return Integer.parseInt(next());  }  public long nextLong() {  return Long.parseLong(next());  }  public double nextDouble() {  return Double.parseDouble(next());  }  public String next() {  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 (isEndline(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isEndline(c));  return res.toString();  } } }
3	public class Codeforces455Div2C { 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]);  char[] list = new char[n];  for (int i = 0; i < n; i++) {  sp = br.readLine().split(" ");  list[i] = sp[0].charAt(0);  }   int[] list2 = new int[n];  int counter = 0;  for (int i = 0; i < n; i++) {  if (list[i] == 's') {   counter++;  }  else {   list2[counter]++;  }  }   int[][] dp = new int[counter][n-counter+1];  int[][] dpsum = new int[counter][n-counter+1];  int[] count = new int[counter];  count[0] = list2[0];  for (int i = 1; i < counter; i++) {  count[i] = count[i-1] + list2[i];  }   for (int i = 0; i <= count[0]; i++) {  dp[0][i] = 1;  dpsum[0][i] = i+1;  }  for (int i = 1; i < counter; i++) {  for (int j = 0; j <= count[i]; j++) {   dp[i][j] = dpsum[i-1][Math.min(j, count[i-1])];  }  dpsum[i][0] = dp[i][0];  for (int j = 1; j <= count[i]; j++) {   dpsum[i][j] = (dpsum[i][j-1]+dp[i][j])%1000000007;  }  }   System.out.println(dp[counter-1][n-counter]); } }
4	public class CF23A implements Runnable{    public static void main(String args[]){   new CF23A().run();  }   @Override  public void run(){   try{    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    tok = null;    solve();    in.close();    out.close();      }   catch(IOException e){    e.printStackTrace();    System.exit(0);   }  }   int nextInt()throws IOException{   return Integer.parseInt(nextToken());  }    double nextDouble()throws IOException{   return Double.parseDouble(nextToken());  }   long nextLong() throws IOException{   return Long.parseLong(nextToken());  }   String nextToken()throws IOException{   while(tok == null || !tok.hasMoreTokens()){    tok = new StringTokenizer(in.readLine());   }   return tok.nextToken();  }   BufferedReader in;  PrintWriter out;  StringTokenizer tok;     private void solve()throws IOException{   String s = nextToken();   int l = s.length();   int ans = 0;   for(int i = 0; i < l - 1; i++){    for(int j = i + 1; j < l; j++){     String now = s.substring(i, j);     if(s.substring(i + 1).indexOf(now) >= 0){     ans = Math.max(ans, j - i);        }    }   }     out.println(ans);  } }
1	public class Main { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter; private PrintWriter pw; private long mod = 998244353;  private StringBuilder ans_sb; private int sqrt; private void soln() {  int n = nextInt();  int d = nextInt();  int[] arr = nextIntArray(n);  int cnt = 2;  for(int i=0;i<n-1;i++) {  int a1 = arr[i];  int a2 = arr[i+1];  a1 += d;  a2 -= d;  if(a1 < a2) {   cnt+=2;  }else if(a1==a2)   cnt++;  }  pw.println(cnt); } private class Pair implements Comparable<Pair>{  int x,i;  public Pair(int a, int b) {  x = a;  i = b;  }  @Override  public int compareTo(   Pair o)  {  return this.x - o.x;  } } private int cc = 0; private void dfs(int c, int p, LinkedList<Integer>[] tree, int[] t, int[] tin, int[] tout, int[] arr) {  t[cc] = arr[c]; tin[c] = cc++; Iterator<Integer> it = tree[c].listIterator(); while(it.hasNext()) {  int x = it.next();  if(x != p) {  dfs(x, c, tree,t,tin,tout,arr);  } } tout[c] = cc; } public class Segment {  private Node[] tree;  private int[] lazy;  private int size;  private int n;  private int[] base;  private class Node  {  private int on;  private int off;  }  public Segment(int n, int[] arr)  {  this.base=arr;  int x = (int) (Math.ceil(Math.log(n) / Math.log(2)));  size = 2 * (int) Math.pow(2, x) - 1;  tree = new Node[size];  lazy = new int[size];  this.n = n;    build(0, 0, n - 1);  }  public void build(int id, int l, int r)  {  if (l == r)  {   tree[id] = new Node();   if(base[l] == 1)   tree[id].on++;   else   tree[id].off++;   return;  }  int mid = ((l + r)>>1);  build((id<<1)|1, l, mid);  build((id<<1)+2, mid + 1, r);  tree[id] = merge(tree[(id<<1)|1], tree[(id<<1)+2]);    }  public Node merge(Node n1, Node n2) {  Node ret = new Node();  if(n1 == null && n2 == null)   return null;  else if(n1 == null) {   ret.on = n2.on;   ret.off = n2.off;  }  else if(n2 == null) {   ret.on = n1.on;   ret.off = n1.off;  }  else {   ret.on = n1.on+n2.on;   ret.off = n2.off + n1.off;  }  return ret;  }  public int query(int l, int r)  {  Node ret = queryUtil(l, r, 0, 0, n - 1);  if(ret == null) {   return 0;  }  else   return ret.on;  }  private Node queryUtil(int x, int y, int id, int l, int r)  {  if (l > y || x > r)   return null;  if (x <= l && r <= y)  {     return tree[id];  }  int mid = ((l + r)>>1);  shift(id,l,r);  Node q1 = queryUtil(x, y, (id<<1)|1, l, mid);  Node q2 = queryUtil(x, y, (id<<1)+2, mid + 1, r);  return merge(q1, q2);  }   public void update(int x, int y, int c) {  update1(x, y, c, 0, 0, n-1);  }   private void update1(int x, int y, int colour, int id, int l, int r)  {    if (x > r || y < l)   return;  if (x <= l && r <= y)  {   lazy[id]++;   switchNode(tree[id]);   return;  }  int mid = ((l + r)>>1);    if(y<=mid)   update1(x, y, colour, (id<<1)|1, l, mid);  else if(x>mid)   update1(x, y, colour, (id<<1)+2, mid + 1, r);  else {   update1(x, y, colour, (id<<1)|1, l, mid);   update1(x, y, colour, (id<<1)+2, mid + 1, r);  }  tree[id] = merge(tree[(id<<1)|1], tree[(id<<1)+2]);  }  private void shift(int id,int l, int r)  {  lazy[id] %= 2;  if(lazy[id] != 0) {   if(l != r) {   lazy[(id<<1)|1] += lazy[id];   lazy[(id<<1)+2] += lazy[id];   switchNode(tree[(id<<1)+2]);   switchNode(tree[(id<<1)|1]);   }     lazy[id] = 0;  }  }  private void switchNode(Node d) {  d.on ^= d.off;  d.off ^= d.on;  d.on ^= d.off;  } }  private void debug(Object... o) {  System.out.println(Arrays.deepToString(o)); } private long pow(long a, long b, long c) {  if (b == 0)  return 1;  long p = pow(a, b / 2, c);  p = (p * p) % c;  return (b % 2 == 0) ? p : (a * p) % c; }  private long gcd(long n, long l) {  if (l == 0)  return n;  return gcd(l, n % l); }  public static void main(String[] args) throws Exception {  new Thread(null, new Runnable() {  @Override  public void run() {   new Main().solve();  }  }, "1", 1 << 26).start();   }  public StringBuilder solve() {  InputReader(System.in);   pw = new PrintWriter(System.out);   soln();  pw.close();   return ans_sb; }  public void InputReader(InputStream stream1) {  stream = stream1; }  private boolean isWhitespace(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  private boolean isEndOfLine(int c) {  return c == '\n' || c == '\r' || c == -1; }  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++]; }  private 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 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 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 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 int[] nextIntArray(int n) {  int[] arr = new int[n];  for (int i = 0; i < n; i++) {  arr[i] = nextInt();  }  return arr; }  private long[] nextLongArray(int n) {  long[] arr = new long[n];  for (int i = 0; i < n; i++) {  arr[i] = nextLong();  }  return arr; }  private void pArray(int[] arr) {  for (int i = 0; i < arr.length; i++) {  System.out.print(arr[i] + " ");  }  System.out.println();  return; }  private void pArray(long[] arr) {  for (int i = 0; i < arr.length; i++) {  System.out.print(arr[i] + " ");  }  System.out.println();  return; }  private boolean isSpaceChar(int c) {  if (filter != null)  return filter.isSpaceChar(c);  return isWhitespace(c); }  private char nextChar() {  int c = read();  while (isSpaceChar(c))  c = read();  char c1 = (char) c;  while (!isSpaceChar(c))  c = read();  return c1; }  private interface SpaceCharFilter {  public boolean isSpaceChar(int ch); } }
1	public class B {  static long sqr(long a) {  return a * a; }  static void solve() throws Exception {  int tests = scanInt();  for (int test = 0; test < tests; test++) {  int n = scanInt();  out.println(n == 2 * sqr(round(sqrt(n / 2))) || n == 4 * sqr(round(sqrt(n / 4))) ? "YES" : "NO");  } }  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 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 side = in.readInt();  int row = in.readInt() - 1;  int column = in.readInt() - 1;  int required = in.readInt();  long left = 0;  long right = 2 * side - 2;  while (left < right) {  long current = (left + right) / 2;  long result = calculate(row, column, current) + calculate(column, side - row - 1, current) +   calculate(side - row - 1, side - column - 1, current) + calculate(side - column - 1, row, current) + 1;  if (result >= required)   right = current;  else   left = current + 1;  }  out.printLine(left); }  private long calculate(int row, int column, long current) {  column++;  long total = 0;  long mn = Math.min(row, column);  long mx = Math.max(row, column);  if (current <= mn)  return current * (current + 1) / 2;  total += mn * (mn + 1) / 2;  current -= mn;  mx -= mn;  if (current <= mx)  return total + mn * current;  total += mn * mx;  current -= mx;  if (current < mn)  return total + (mn - 1) * mn / 2 - (mn - current - 1) * (mn - current) / 2;  return total + (mn - 1) * mn / 2; } } 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 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); } } 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 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 int mod = (int) Math.pow(10, 9) + 7;   public void solve(int testNumber, InputReader in, PrintWriter out) {       int n = in.readInt();    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = in.readString().charAt(0) == 'f' ? 1 : 0;    }    long[][] ans = new long[n][n + 2];    ans[0][0] = 1;    int indent = 0;    if (a[0] == 1) indent++;    for (int i = 1; i < n; i++) {     if (a[i - 1] == 1) {      for (int j = indent - 1; j >= 1; j--) {       ans[i][j] = ans[i - 1][j - 1];      }      ans[i][indent] = 1;     } else {      for (int j = indent; j >= 0; j--) {       ans[i][j] = (ans[i][j + 1] + ans[i - 1][j]) % mod;      }     }     indent += a[i];    }    long aa = 0;    for (int i = 0; i < n + 2; i++) {     aa = (aa + ans[n - 1][i]) % mod;    }    out.println(aa);   }  }  static 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() {    try {     if (curChar >= numChars) {      curChar = 0;      numChars = stream.read(buf);      if (numChars <= 0)       return -1;     }    } catch (IOException e) {     throw new RuntimeException(e);    }    return buf[curChar++];   }   public int readInt() {    return (int) readLong();   }   public long readLong() {    int c = read();    while (isSpaceChar(c)) {     c = read();     if (c == -1) throw new RuntimeException();    }    boolean negative = false;    if (c == '-') {     negative = true;     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 negative ? (-res) : (res);   }   public String readString() {    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;   }  } }
4	public class Main {  static BufferedReader br;  static PrintWriter out;  static StringTokenizer st;   static int[][] moves = new int[][]{{0, 1}, {1, 0}, {-1, 0}, {0, -1}};   static boolean correct(int x, int y, int n, int m) {   return (x >= 0 && x < n && y >= 0 && y < m);  }   static void solve() throws Exception {   int n = nextInt();   int m = nextInt();   int k = nextInt();   int[][] order = new int[n][m];   boolean[][] used = new boolean[n][m];   Queue<Integer[]> q = new LinkedList<>();   Set<String> set = new HashSet<String>();   for(int i = 0; i < k; i++) {    int x = nextInt() - 1;    int y = nextInt() - 1;    order[x][y] = 1;    used[x][y] = true;    q.add(new Integer[] {x, y});    set.add(x + "" + y);   }   while(!q.isEmpty()) {    Integer[] v = q.remove();    for(int[] move : moves) {     int x = v[0] + move[0];     int y = v[1] + move[1];      if(correct(x, y, n, m) && !used[x][y]) {      q.add(new Integer[] {x, y});      used[x][y] = true;      order[x][y] = order[v[0]][v[1]] + 1;     }    }   }   int max = Integer.MIN_VALUE;   int maxI = -1;   int maxJ = -1;   for(int i = 0; i < n; i++) {    for(int j = 0; j < m; j++) {     if(order[i][j] > max) {      max = order[i][j];      maxI = i;      maxJ = j;     }    }   }   maxI++;   maxJ++;   out.println(maxI + " " + maxJ);  }    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());  }  static String next() throws IOException {   while (st == null || !st.hasMoreTokens()) {    String line = br.readLine();    if (line == null) {     return null;    }    st = new StringTokenizer(line);   }   return st.nextToken();  }  public static void main(String[] args) {   try {    InputStream input = System.in;    OutputStream output = System.out;    br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("input.txt"))));    out = new PrintWriter(new PrintStream(new File("output.txt")));    solve();    out.close();    br.close();   } catch (Throwable t) {    t.printStackTrace();   }  } }
4	public class E { FastScanner in; PrintWriter out; boolean systemIO = true;  public class DSU {  int[] sz;  int[] p;  public DSU(int n) {  sz = new int[n];  p = new int[n];  for (int i = 0; i < p.length; i++) {   p[i] = i;   sz[i] = 1;  }  }  public int get(int x) {  if (x == p[x]) {   return x;  }  int par = get(p[x]);  p[x] = par;  return par;  }  public boolean unite(int a, int b) {  int pa = get(a);  int pb = get(b);  if (pa == pb) {   return false;  }  if (sz[pa] < sz[pb]) {   p[pa] = pb;   sz[pb] += sz[pa];  } else {   p[pb] = pa;   sz[pa] += sz[pb];  }  return true;  } }  public class SegmentTreeAdd {  int pow;  long[] min;  long[] delta;  boolean[] flag;  public SegmentTreeAdd(long[] a) {  pow = 1;  while (pow < a.length) {   pow *= 2;  }  flag = new boolean[2 * pow];  min = new long[2 * pow];  delta = new long[2 * pow];  for (int i = 0; i < min.length; i++) {   min[i] = Long.MAX_VALUE / 2;  }  for (int i = 0; i < a.length; i++) {   min[pow + i] = a[i];  }  for (int i = pow - 1; i > 0; i--) {   min[i] = f(min[2 * i], min[2 * i + 1]);  }  }  public long get(int l, int r) {  return get(1, 0, pow, l, r);  }  private long get(int v, int tl, int tr, int l, int r) {  push(v, tl, tr);  if (l >= tr || r <= tl) {   return Long.MAX_VALUE / 2;  }  if (l <= tl && r >= tr) {   return min[v];  }  int tm = (tl + tr) / 2;  return f(get(2 * v, tl, tm, l, r), get(2 * v + 1, tm, tr, l, r));  }  public void set(int l, int r, long x) {  set(1, 0, pow, l, r, x);  }  private void set(int v, int tl, int tr, int l, int r, long x) {  push(v, tl, tr);  if (l >= tr || r <= tl) {   return;  }  if (l <= tl && r >= tr) {   delta[v] += x;   flag[v] = true;   push(v, tl, tr);   return;  }  int tm = (tl + tr) / 2;  set(2 * v, tl, tm, l, r, x);  set(2 * v + 1, tm, tr, l, r, x);  min[v] = f(min[2 * v], min[2 * v + 1]);  }  public void push(int v, int tl, int tr) {  if (flag[v]) {   if (v < pow) {   flag[2 * v] = true;   flag[2 * v + 1] = true;   delta[2 * v] += delta[v];   delta[2 * v + 1] += delta[v];   }   flag[v] = false;   min[v] += delta[v];   delta[v] = 0;  }  }  public long f(long a, long b) {  return Math.min(a, b);  } }  public class SegmentTreeSet {  int pow;  int[] sum;  int[] delta;  boolean[] flag;  public SegmentTreeSet(int[] a) {  pow = 1;  while (pow < a.length) {   pow *= 2;  }  flag = new boolean[2 * pow];  sum = new int[2 * pow];  delta = new int[2 * pow];  for (int i = 0; i < a.length; i++) {   sum[pow + i] = a[i];  }  }  public int get(int v, int tl, int tr, int l, int r) {  push(v, tl, tr);  if (l > r) {   return 0;  }  if (l == tl && r == tr) {   return sum[v];  }  int tm = (tl + tr) / 2;  return f(get(2 * v, tl, tm, l, Math.min(r, tm)), get(2 * v + 1, tm + 1, tr, Math.max(l, tm + 1), r));  }  public void set(int v, int tl, int tr, int l, int r, int x) {  push(v, tl, tr);  if (l > tr || r < tl) {   return;  }  if (l <= tl && r >= tr) {   delta[v] = x;   flag[v] = true;   push(v, tl, tr);   return;  }  int tm = (tl + tr) / 2;  set(2 * v, tl, tm, l, r, x);  set(2 * v + 1, tm + 1, tr, l, r, x);  sum[v] = f(sum[2 * v], sum[2 * v + 1]);  }  public void push(int v, int tl, int tr) {  if (flag[v]) {   if (v < pow) {   flag[2 * v] = true;   flag[2 * v + 1] = true;   delta[2 * v] = delta[v];   delta[2 * v + 1] = delta[v];   }   flag[v] = false;   sum[v] = delta[v] * (tr - tl + 1);  }  }  public int f(int a, int b) {  return a + b;  } }  Random random = new Random();  public void shuffle(Pair[] a) {  for (int i = 0; i < a.length; i++) {  int x = random.nextInt(i + 1);  Pair t = a[x];  a[x] = a[i];  a[i] = t;  } }  public void sort(int[][] a) {  for (int i = 0; i < a.length; i++) {  Arrays.sort(a[i]);  } }  public void add(HashMap<Long, Integer> map, long l) {  if (map.containsKey(l)) {  map.put(l, map.get(l) + 1);  } else {  map.put(l, 1);  } }  public void remove(TreeMap<Integer, Integer> map, Integer s) {  if (map.get(s) > 1) {  map.put(s, map.get(s) - 1);  } else {  map.remove(s);  } }  double eps = 1e-10;  public int signum(double x) {  if (x > eps) {  return 1;  }  if (x < -eps) {  return -1;  }  return 0; }  public long abs(long x) {  return x < 0 ? -x : x; }  public long min(long x, long y) {  return x < y ? x : y; }  public long max(long x, long y) {  return x > y ? x : y; }  public long gcd(long x, long y) {  while (y > 0) {  long c = y;  y = x % y;  x = c;  }  return x; }                                                                                                                                                                                                   public class Rect {  long x1;  long x2;  long y1;  long y2;  int number;  public Rect(long x1, long x2, long y1, long y2, int number) {  this.x1 = x1;  this.x2 = x2;  this.y1 = y1;  this.y2 = y2;  this.number = number;  } }  public static class Fenvik {  int[] t;  public Fenvik(int n) {  t = new int[n];  }  public void add(int x, int delta) {  for (int i = x; i < t.length; i = (i | (i + 1))) {   t[i] += delta;  }  }  private int sum(int r) {  int ans = 0;  int x = r;  while (x >= 0) {   ans += t[x];   x = (x & (x + 1)) - 1;  }  return ans;  }  public int sum(int l, int r) {  return sum(r) - sum(l - 1);  } }  public class SegmentTreeMaxSum {  int pow;  int[] sum;  int[] maxPrefSum;  int[] maxSufSum;  int[] maxSum;  public SegmentTreeMaxSum(int[] a) {  pow = 1;  while (pow < a.length) {   pow *= 2;  }  sum = new int[2 * pow];  maxPrefSum = new int[2 * pow];  maxSum = new int[2 * pow];  maxSufSum = new int[2 * pow];  for (int i = 0; i < a.length; i++) {   sum[pow + i] = a[i];   maxSum[pow + i] = Math.max(a[i], 0);   maxPrefSum[pow + i] = maxSum[pow + i];   maxSufSum[pow + i] = maxSum[pow + i];  }  for (int i = pow - 1; i > 0; i--) {   update(i);  }  }  public int[] get(int v, int tl, int tr, int l, int r) {  if (r <= tl || l >= tr) {   int[] ans = { 0, 0, 0, 0 };   return ans;  }  if (l <= tl && r >= tr) {   int[] ans = { maxPrefSum[v], maxSum[v], maxSufSum[v], sum[v] };   return ans;  }  int tm = (tl + tr) / 2;  int[] left = get(2 * v, tl, tm, l, r);  int[] right = get(2 * v + 1, tm, tr, l, r);  int[] ans = { Math.max(left[0], right[0] + left[3]),   Math.max(left[1], Math.max(right[1], left[2] + right[0])), Math.max(right[2], left[2] + right[3]),   left[3] + right[3] };  return ans;  }  public void set(int v, int tl, int tr, int x, int value) {  if (v >= pow) {   sum[v] = value;   maxSum[v] = Math.max(value, 0);   maxPrefSum[v] = maxSum[v];   maxSufSum[v] = maxSum[v];   return;  }  int tm = (tl + tr) / 2;  if (x < tm) {   set(2 * v, tl, tm, x, value);  } else {   set(2 * v + 1, tm, tr, x, value);  }  update(v);  }  public void update(int i) {  sum[i] = f(sum[2 * i], sum[2 * i + 1]);  maxSum[i] = Math.max(maxSum[2 * i], Math.max(maxSum[2 * i + 1], maxSufSum[2 * i] + maxPrefSum[2 * i + 1]));  maxPrefSum[i] = Math.max(maxPrefSum[2 * i], maxPrefSum[2 * i + 1] + sum[2 * i]);  maxSufSum[i] = Math.max(maxSufSum[2 * i + 1], maxSufSum[2 * i] + sum[2 * i + 1]);  }  public int f(int a, int b) {  return a + b;  } }  public class Fraction implements Comparable<Fraction> {  long x;  long y;  public Fraction(long x, long y, boolean needNorm) {  this.x = x;  this.y = y;  if (y < 0) {   this.x *= -1;   this.y *= -1;  }  if (needNorm) {   long gcd = gcd(this.x, this.y);   this.x /= gcd;   this.y /= gcd;  }  }  public Fraction clone() {  return new Fraction(x, y, false);  }  public String toString() {  return x + "/" + y;  }  @Override  public int compareTo(Fraction o) {  long res = x * o.y - y * o.x;  if (res > 0) {   return 1;  }  if (res < 0) {   return -1;  }  return 0;  } }  public class Event implements Comparable<Event> {  Fraction f;  int type;  public Event(Fraction f, int type) {  this.f = f;  this.type = type;  }  @Override  public int compareTo(Event o) {  int c = f.compareTo(o.f);  if (c != 0) {   return c;  }  return type - o.type;  }  }  public double sq(double x) {  return x * x; }  public long sq(long x) {  return x * x; }  public double hypot2(double x, double y) {  return sq(x) + sq(y); }  public long hypot2(long x, long y) {  return sq(x) + sq(y); }  public boolean kuhn(int v, int[][] edge, boolean[] used, int[] mt) {  used[v] = true;  for (int u : edge[v]) {  if (mt[u] < 0 || (!used[mt[u]] && kuhn(mt[u], edge, used, mt))) {   mt[u] = v;   return true;  }  }  return false; }  public int matching(int[][] edge) {  int n = edge.length;  int[] mt = new int[n];  Arrays.fill(mt, -1);  boolean[] used = new boolean[n];  int ans = 0;  for (int i = 0; i < n; i++) {  if (!used[i] && kuhn(i, edge, used, mt)) {   Arrays.fill(used, false);   ans++;  }  }  return ans; }  double sq2 = Math.sqrt(2);  public class MyStack {  int[] st;  int sz;  public MyStack(int n) {  this.st = new int[n];  sz = 0;  }  public boolean isEmpty() {  return sz == 0;  }  public int peek() {  return st[sz - 1];  }  public int pop() {  sz--;  return st[sz];  }  public void clear() {  sz = 0;  }  public void add(int x) {  st[sz++] = x;  }  public int get(int x) {  return st[x];  } }  public int[][] readGraph(int n, int m) {  int[][] to = new int[n][];  int[] sz = new int[n];  int[] x = new int[m];  int[] y = new int[m];  for (int i = 0; i < m; i++) {  x[i] = in.nextInt() - 1;  y[i] = in.nextInt() - 1;  sz[x[i]]++;  sz[y[i]]++;  }  for (int i = 0; i < to.length; i++) {  to[i] = new int[sz[i]];  sz[i] = 0;  }  for (int i = 0; i < x.length; i++) {  to[x[i]][sz[x[i]]++] = y[i];  to[y[i]][sz[y[i]]++] = x[i];  }  return to; }  public class Pol {  double[] coeff;  public Pol(double[] coeff) {  this.coeff = coeff;  }  public Pol mult(Pol p) {  double[] ans = new double[coeff.length + p.coeff.length - 1];  for (int i = 0; i < ans.length; i++) {   for (int j = Math.max(0, i - p.coeff.length + 1); j < coeff.length && j <= i; j++) {   ans[i] += coeff[j] * p.coeff[i - j];   }  }  return new Pol(ans);  }  public String toString() {  String ans = "";  for (int i = 0; i < coeff.length; i++) {   ans += coeff[i] + " ";  }  return ans;  }  public double value(double x) {  double ans = 0;  double p = 1;  for (int i = 0; i < coeff.length; i++) {   ans += coeff[i] * p;   p *= x;  }  return ans;  }  public double integrate(double r) {  Pol p = new Pol(new double[coeff.length + 1]);  for (int i = 0; i < coeff.length; i++) {   p.coeff[i + 1] = coeff[i] / fact[i + 1];  }  return p.value(r);  }  public double integrate(double l, double r) {  return integrate(r) - integrate(l);  } }  int mod = 1000000007;  public int sum(int a, int b) {  if (a + b >= mod) {  return a + b - mod;  }  return a + b; }  public int diff(int a, int b) {  if (a < b) {  return a + mod - b;  }  return a - b; }  public int mult(int a, int b) {  return (int) ((a * 1L * b) % (1L * mod)); }  public int pow(int x, int p) {  if (p <= 0) {  return 1;  }  int ans = pow(x, p / 2);  ans = mult(ans, ans);  if (p % 2 == 1) {  ans = mult(ans, x);  }  return ans; }  public int modInv(int x) {  return pow(x, mod - 2); }  public int c_n_k(int n, int k) {  if (n < 0 || k < 0 || n - k < 0) {  return 0;  }  return mult(fact[n], mult(factInv[k], factInv[n - k])); }  public class LinAl01 {  public class Vector {  BitSet vec;  BitSet swtch;   public Vector(BitSet vec, BitSet swtch) {   this.vec = vec;   this.swtch = swtch;  }   public String toString() {   String s = "";   for (int i = 0; i < basis.length; i++) {   s += (vec.get(i) ? 1 : 0);   }   s += " ";   for (int i = 0; i < basis.length; i++) {   s += (swtch.get(i) ? 1 : 0);   }   return s;  }  }  int n;  Vector[] basis;  public void update(Vector v) {  for (int i = 0; i < n; i++) {   if (v.vec.get(i)) {   if (basis[i] == null) {    basis[i] = v;    break;   }   v.vec.xor(basis[i].vec);   v.swtch.xor(basis[i].swtch);   }  }  }  public void diagonalize() {  for (int i = 0; i < n; i++) {   if (basis[i] == null) {   continue;   }   for (int j = 0; j < i; j++) {   if (basis[j] != null && basis[j].vec.get(i)) {    basis[j].vec.xor(basis[i].vec);    basis[j].swtch.xor(basis[i].swtch);   }   }  }  }  }  public class Point implements Comparable<Point> {  double x;  double y;  public Point() {  x = 0;  y = 0;  }  public Point(double x, double y) {  this.x = x;  this.y = y;  }  public String toString() {  return x + " " + y;  }  public boolean equals(Point p) {  return x == p.x && y == p.y;  }  public double dist2() {  return x * x + y * y;  }  public Point add(Point v) {  return new Point(x + v.x, y + v.y);  }  public Point subtract(Point v) {  return new Point(x - v.x, y - v.y);  }  @Override  public int compareTo(Point o) {  int z = signum(x + y - o.x - o.y);  if (z != 0) {   return z;  }  return signum(x - o.x) != 0 ? signum(x - o.x) : signum(y - o.y);  } }  public class Circle {  Point p;  long r;  public Circle(Point p, long r) {  this.p = p;  this.r = r;  }  public boolean intersect(Line l) {  return Math.abs(l.a * p.x + l.b * p.y + l.c) / Math.hypot(l.a, l.b) < r;  }  public boolean inside(Point p) {  return hypot2(p.x - this.p.x, p.y - this.p.y) <= sq(r);  } }  public class Line {  long a;  long b;  long c;  public Line(long a, long b, long c) {  if (a < 0 || (a == 0 && b < 0)) {   a = -a;   b = -b;   c = -c;   long gcd = gcd(a, Math.abs(b));   a /= gcd;   b /= gcd;  }  this.a = a;  this.b = b;  this.c = c;  }  public String toString() {  return a + " " + b + " " + c;  }    }                         public long sqr(long a) {  return a * a; }                   int[] fact = new int[1000001]; int[] factInv = new int[1000001];  public int[] intersect(int y, int xdown, int ydown, int xup, int yup) {  if (yup < y || ydown > y || (ydown == yup)) {  return null;  }  long p = xup * 1L * (y - ydown) + xdown * 1L * (yup - y);  if (p < 0) {  int[] ans = { -1, 0 };  return ans;  }  long q = 2 * (yup - ydown);  int[] ans = { (int) (p / q), (int) ((p + q - 1) / q) };  return ans; }  public void I(int[][] a) {  for (int i = 0; i < a.length; i++) {  int[] b = new int[a.length];  for (int j = 0; j < b.length; j++) {   b[a[i][j]] = j;  }  a[i] = b;  } }  public void C(int[][] a) {  for (int i = 0; i < a.length; i++) {  int[] b = new int[a.length];  for (int j = 0; j < b.length; j++) {   b[a[j][i]] = j;  }  for (int j = 0; j < b.length; j++) {   a[j][i] = b[j];  }  } }  public class SegmentTree {  int pow;  Pair[] min;  public SegmentTree(int[] a) {  pow = 1;  while (pow < a.length) {   pow *= 2;  }  min = new Pair[2 * pow];  for (int i = 0; i < a.length; i++) {   min[pow + i] = new Pair(a[i], i);  }  for (int i = a.length; i < pow; i++) {   min[pow + i] = new Pair(Integer.MAX_VALUE / 2, -1);  }  for (int i = pow - 1; i > 0; i--) {   min[i] = f(min[2 * i], min[2 * i + 1]);  }  }  public Pair get(int l, int r) {  return get(1, 0, pow, l, r);  }  private Pair get(int v, int tl, int tr, int l, int r) {  if (l >= tr || r <= tl) {   return new Pair(Integer.MAX_VALUE / 2, -1);  }  if (l <= tl && r >= tr) {   return min[v];  }  int tm = (tl + tr) / 2;  return f(get(2 * v, tl, tm, l, r), get(2 * v + 1, tm, tr, l, r));  }  public void set(int x, int value) {  set(1, 0, pow, x, value);  }  private void set(int v, int tl, int tr, int x, int value) {  if (x >= tr || x < tl) {   return;  }  if (v >= pow) {   min[v] = new Pair(value, -1);   return;  }  int tm = (tl + tr) / 2;  set(2 * v, tl, tm, x, value);  set(2 * v + 1, tm, tr, x, value);  min[v] = f(min[2 * v], min[2 * v + 1]);  }  public Pair f(Pair a, Pair b) {  if (a.compareTo(b) <= 0) {   return a.clone();  }  return b.clone();  } }  public boolean nextPermutation(int[] a) {  int n = a.length;  for (int i = n - 2; i >= 0; i--) {  if (a[i] < a[i + 1]) {   for (int d = 1; d <= (n - 1 - i) / 2; d++) {   a[i + d] ^= a[n - d];   a[n - d] = a[i + d] ^ a[n - d];   a[i + d] = a[i + d] ^ a[n - d];   }   for (int j = i + 1; j < n; j++) {   if (a[j] > a[i]) {    a[i] ^= a[j];    a[j] = a[i] ^ a[j];    a[i] = a[i] ^ a[j];    return true;   }   }  }  }  return false; }  public class Pair implements Comparable<Pair> {  int x;  int y;  public Pair(int x, int y) {  this.x = x;  this.y = y;  }  public Pair add(Pair p) {  return new Pair(x + p.x, y + p.y);  }  public Pair clone() {  return new Pair(x, y);  }  public String toString() {  return x + " " + y;  }  @Override  public int compareTo(Pair o) {  if (x < o.x) {   return -1;  }  if (x > o.x) {   return 1;  }  if (y > o.y) {   return 1;  }  if (y < o.y) {   return -1;  }  return 0;  } }  public double intersection(Pair p1, Pair p2) {  return (p2.y - p1.y) * 1.0 / (p1.x - p2.x); }  HashMap<Integer, Integer> even = new HashMap<>(); HashMap<Integer, Integer> odd = new HashMap<>();  public void addOdd(int key, int value) {  if (odd.containsKey(key)) {  odd.put(key, Math.min(odd.get(key), value));  } else {  odd.put(key, value);  } }  public void addEven(int key, int value) {  if (even.containsKey(key)) {  even.put(key, Math.min(even.get(key), value));  } else {  even.put(key, value);  } }  public void solve() {  int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();   if (k % 2 == 1) {  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   out.print(-1 + " ");   }   out.println();  }  return;  }  k /= 2;  int[][] hor = new int[n][m - 1];  for (int i = 0; i < hor.length; i++) {  for (int j = 0; j < hor[0].length; j++) {   hor[i][j] = in.nextInt() * 2;   }  }  int[][] vert = new int[n - 1][m];  for (int i = 0; i < vert.length; i++) {  for (int j = 0; j < vert[0].length; j++) {   vert[i][j] = in.nextInt() * 2;   }  }  long time = System.currentTimeMillis();  int[][][] ans = new int[k + 1][n][m];  for (int l = 1; l <= k; l++) {  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   ans[l][i][j] = Integer.MAX_VALUE;   if (i > 0) {    ans[l][i][j] = Math.min(ans[l][i][j], ans[l - 1][i - 1][j] + vert[i - 1][j]);   }   if (j > 0) {    ans[l][i][j] = Math.min(ans[l][i][j], ans[l - 1][i][j - 1] + hor[i][j - 1]);   }   if (i < n - 1) {    ans[l][i][j] = Math.min(ans[l][i][j], ans[l - 1][i + 1][j] + vert[i][j]);   }   if (j < m - 1) {    ans[l][i][j] = Math.min(ans[l][i][j], ans[l - 1][i][j + 1] + hor[i][j]);   }   }  }  }                               for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   out.print(ans[k][i][j] + " ");  }  out.println();  }  System.err.println(System.currentTimeMillis() - time); }  public void add(HashMap<Integer, Integer> map, int x) {  if (map.containsKey(x)) {  map.put(x, map.get(x) + 1);  } else {  map.put(x, 1);  } }  public void run() {  try {  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();  } 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 E().run(); } }
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());   }  } }
4	public class A {  private BufferedReader in;  private StringTokenizer st;  private PrintWriter out;  private void solve() throws IOException {   String s = next();   for (int length = s.length() - 1; length > 0; --length) {    Set<String> h = new HashSet<String>();    int count = 0;    for (int i = 0; i + length <= s.length(); ++i) {     h.add(s.substring(i, i + length));     ++count;    }    if (count != h.size()) {     out.println(length);     return;    }   }   out.println(0);  }  public void run() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   eat("");   solve();   out.close();   in.close();  }  private void eat(String s) {   st = new StringTokenizer(s);  }  private String next() throws IOException {   while (!st.hasMoreTokens()) {    String line = in.readLine();    if (line == null) {     return null;    }    eat(line);   }   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());  }  private BigInteger nextBigInteger() throws IOException {   return new BigInteger(next());  }  public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);   new A().run();  } }
4	public class A023 { public static void main(String[] args) {  System.out.println(f()); }  static int f() {  Scanner in = new Scanner(System.in);  String line = in.next();  for (int length = line.length(); length > 0; length--) {  for (int start = 0; start + length <= line.length(); start++) {   if(line.indexOf(line.substring(start,start+length),start+1)>=0) {   return length;   }  }  }  return 0; } }
6	public class F  {  public static void main(String hi[]) throws Exception  {   BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));    StringTokenizer st = new StringTokenizer(infile.readLine());   int N = Integer.parseInt(st.nextToken());   int M = Integer.parseInt(st.nextToken());   int[][] grid = new int[N][M];   for(int i=0; i < N; i++)    grid[i] = readArr(M, infile, st);   int[][] mindiff = new int[N][N];   for(int a=0; a < N; a++)    for(int b=a+1; b < N; b++)    {     int val = Integer.MAX_VALUE;     for(int i=0; i < M; i++)     val = Math.min(val, Math.abs(grid[a][i]-grid[b][i]));     mindiff[a][b] = mindiff[b][a] = val;    }   int res = 0;   for(int start=0; start < N; start++)   {    int[][] dp = new int[1<<N][N];    Arrays.fill(dp[0], Integer.MAX_VALUE);    for(int mask=0; mask < (1<<N); mask++)    {     if(Integer.bitCount(mask) == 1 && mask != (1<<start))     continue;     for(int prev=0; prev < N; prev++)     if((mask&(1<<prev)) > 0 || mask == 0)     {      for(int b=0; b < N; b++)       if((mask&(1<<b)) == 0)       {        int submask = mask|(1<<b);        if(mask == 0)        dp[submask][b] = Integer.MAX_VALUE;        else        dp[submask][b] = Math.max(dp[submask][b], Math.min(dp[mask][prev], mindiff[prev][b]));       }     }    }    for(int b=0; b < N; b++)    {     int temp = dp[(1<<N)-1][b];     for(int i=0; i < M-1; i++)     temp = Math.min(temp, Math.abs(grid[b][i]-grid[start][i+1]));     res = Math.max(res, temp);    }   }   System.out.println(res);  }  public static int[] readArr(int N, BufferedReader infile, StringTokenizer st) throws Exception  {   int[] arr = new int[N];   st = new StringTokenizer(infile.readLine());   for(int i=0; i < N; i++)    arr[i] = Integer.parseInt(st.nextToken());   return arr;  }  }
6	public class G extends PrintWriter {  void run() {   long mod = 1_000_000_000 + 7;   int n = nextInt();   int m = nextInt();   int[] t = new int[n];   int[] g = new int[n];   for (int i = 0; i < n; i++) {    t[i] = nextInt();    g[i] = nextInt() - 1;   }   int k = 1 << n;   long[][] dp = new long[k][n];   for (int i = 0; i < n; i++) {    dp[1 << i][i] = 1;   }   for (int mask = 0; mask < k; mask++) {    if (Integer.bitCount(mask) <= 1) {     continue;    }    for (int i = 0; i < n; i++) {     if ((mask & (1 << i)) != 0) {      for (int j = 0; j < n; j++) {       if ((mask & (1 << j)) == 0 || g[i] == g[j]) {        continue;       }       dp[mask][i] = (dp[mask][i] + dp[mask ^ (1 << i)][j]) % mod;      }     }    }   }   long ans = 0;   for (int mask = 0; mask < k; mask++) {    int sum = 0;    for (int i = 0; i < n; i++) {     if ((mask & (1 << i)) != 0) {      sum += t[i];     }    }    if (sum == m) {     for (int i = 0; i < n; i++) {      if ((mask & (1 << i)) != 0) {       ans = (ans + dp[mask][i]) % mod;      }     }    }   }   println(ans);  }  boolean skip() {   while (hasNext()) {    next();   }   return true;  }  int[][] nextMatrix(int n, int m) {   int[][] matrix = new int[n][m];   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     matrix[i][j] = nextInt();   return matrix;  }  String next() {   while (!tokenizer.hasMoreTokens())    tokenizer = new StringTokenizer(nextLine());   return tokenizer.nextToken();  }  boolean hasNext() {   while (!tokenizer.hasMoreTokens()) {    String line = nextLine();    if (line == null) {     return false;    }    tokenizer = new StringTokenizer(line);   }   return true;  }  int[] nextArray(int n) {   int[] array = new int[n];   for (int i = 0; i < n; i++) {    array[i] = nextInt();   }   return array;  }  long[] nextLongArray(int n) {   long[] array = new long[n];   for (int i = 0; i < n; i++) {    array[i] = nextLong();   }   return array;  }  int nextInt() {   return Integer.parseInt(next());  }  long nextLong() {   return Long.parseLong(next());  }  double nextDouble() {   return Double.parseDouble(next());  }  String nextLine() {   try {    return reader.readLine();   } catch (IOException err) {    return null;   }  }  public G(OutputStream outputStream) {   super(outputStream);  }  static BufferedReader reader;  static StringTokenizer tokenizer = new StringTokenizer("");  static Random rnd = new Random();  static boolean OJ;  public static void main(String[] args) throws IOException {   OJ = System.getProperty("ONLINE_JUDGE") != null;   G solution = new G(System.out);   if (OJ) {    reader = new BufferedReader(new InputStreamReader(System.in));    solution.run();   } else {    reader = new BufferedReader(new FileReader(new File(G.class.getName() + ".txt")));    long timeout = System.currentTimeMillis();    while (solution.hasNext()) {     solution.run();     solution.println();     solution.println("----------------------------------");    }    solution.println("time: " + (System.currentTimeMillis() - timeout));   }   solution.close();   reader.close();  } }
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);  } }
4	public class ProblemA_23 {   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());  }   public static void main(String[] args){   new ProblemA_23().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{   String s = readString();   for (int length = s.length() - 1; length > 0; length--){    for (int i = 0; i < s.length() - length; i++){     if (s.lastIndexOf(s.substring(i, i + length)) > i){      out.print(length);      return;     }    }   }   out.print(0);  } }
2	public class A {  public static void main(String[] args) {   FastScanner scanner = new FastScanner();   long x = scanner.nextLong();   long k = scanner.nextLong();   if (x==0) {    System.out.println("0");    return;   }   BigInteger M = BigInteger.valueOf(1000_000_000L+7);   BigInteger modus = BigInteger.valueOf(x).multiply(BigInteger.valueOf(2)).subtract(BigInteger.ONE).mod(M);   BigInteger operandi = BigInteger.valueOf(2).modPow(BigInteger.valueOf(k), M);   BigInteger result = modus.multiply(operandi).mod(M).add(BigInteger.ONE).mod(M);   System.out.println(result);  }  public static long gcd(long a, long b) {   if (b == 0) return a;   return gcd(b, a % b);  }  public static long lcm(long a, long b, long gcd) {   return a * (b / gcd);  }   public static class FastScanner {   BufferedReader br;   StringTokenizer st;   public FastScanner() {    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;   }  } }
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()); } }
0	public class Main { public static void main(String args[]) throws IOException {  BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));  String line = stdin.readLine();  int n = Integer.parseInt(line);   if (n >= 0) {  System.out.println(n);  } else if (n > -10) {  System.out.println(0);  } else {  String sa = line.substring(0, line.length() - 1);  int a = Integer.parseInt(sa);  String sb = line.substring(0, line.length() - 2) + line.charAt(line.length() - 1);  int b = Integer.parseInt(sb);  System.out.println(Math.max(a, b));  } } }
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[] ar = new int[n];    for (int i = 0; i < n; i++)     ar[i] = in.nextInt();    Arrays.sort(ar);    boolean[] u = new boolean[n];    int ans = 0;    for (int i = 0; i < n; i++) {     if (!u[i]) {      u[i] = true;      ans++;      for (int j = 0; j < n; j++) {       if (!u[j] && ar[j] % ar[i] == 0) {        u[j] = true;       }      }     }    }    out.println(ans);   }  }  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());   }  } }
1	public class Main { public static void main (String [] args) throws IOException {  BufferedReader br = new BufferedReader (new InputStreamReader (System.in));  do {  int n = Integer.parseInt (br.readLine ());    int [] ns = new int [(args = br.readLine ().split (" ")).length];  int evenCount = 0, oddCount = 0, evI = 1, oddI = 1;  for (int i = 0; i < ns.length; i++) {   if ((ns [i] = Integer.parseInt (args [i])) % 2 == 0) {   evenCount ++;   evI = i;      } else {   oddCount ++;   oddI = i;   }  }  if (evenCount == 1) System.out.println (evI + 1);  else System.out.println (oddI + 1);  } while (br.ready ()); } }
6	public class cf1102f {  public static void main(String[] args) throws IOException {   int n = rni(), m = ni(), a[][] = new int[n][];   for (int i = 0; i < n; ++i) {    a[i] = ria(m);   }   int delta[][] = new int[n][n], end_delta[][] = new int[n][n], dp[][][] = new int[n][1 << n][n];   for (int i = 0; i < n; ++i) {    fill(delta[i], IBIG);    fill(end_delta[i], IBIG);    delta[i][i] = 0;   }   for (int i = 0; i < n - 1; ++i) {    for (int j = i + 1; j < n; ++j) {     for (int k = 0; k < m; ++k) {      delta[i][j] = delta[j][i] = min(delta[i][j], abs(a[i][k] - a[j][k]));     }    }   }   for (int i = 0; i < n; ++i) {    for (int j = 0; j < n; ++j) {     for (int k = 1; k < m; ++k) {      end_delta[i][j] = min(end_delta[i][j], abs(a[j][k] - a[i][k - 1]));     }    }   }   for (int[][] layer : dp) {    for (int[] row : layer) {     fill(row, IBIG);    }   }   for (int i = 1; i < 1 << n; ++i) {    boolean one_bit = Integer.bitCount(i) == 1;    for (int j = 0; j < n; ++j) {     if ((i & (1 << j)) > 0) {      for (int l = 0; l < n; ++l) {       if ((i & (1 << l)) == 0) {        int max = 0;        for (int k = 0; k < n; ++k) {         if ((one_bit || j != k) && (i & (1 << k)) > 0) {          max = max(max, min(dp[j][i][k], delta[k][l]));         }        }                              dp[j][i | (1 << l)][l] = max;       }      }     }    }   }   int ans = 0;   for (int i = 0; i < n; ++i) {    for (int j = 0; j < n; ++j) {     if (i != j) {           ans = max(ans, min(dp[i][(1 << n) - 1][j], end_delta[j][i]));     }    }   }   if (n == 1) {    ans = maxof(end_delta[0]);   }   prln(ans);   close();  }  static BufferedReader __in = new BufferedReader(new InputStreamReader(System.in));  static PrintWriter __out = new PrintWriter(new OutputStreamWriter(System.out));  static StringTokenizer input;  static Random __rand = new Random();          static final int IBIG = 1000000007;  static final int IMAX = 2147483647;  static final int IMIN = -2147483648;  static final long LMAX = 9223372036854775807L;  static final long LMIN = -9223372036854775808L;   static int minof(int a, int b, int c) {return min(a, min(b, c));}  static int minof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); int min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static long minof(long a, long b, long c) {return min(a, min(b, c));}  static long minof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); long min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static int maxof(int a, int b, int c) {return max(a, max(b, c));}  static int maxof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); int max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static long maxof(long a, long b, long c) {return max(a, max(b, c));}  static long maxof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); long max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static int powi(int a, int b) {if (a == 0) return 0; int ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static long powl(long a, int b) {if (a == 0) return 0; long ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static int fli(double d) {return (int) d;}  static int cei(double d) {return (int) ceil(d);}  static long fll(double d) {return (long) d;}  static long cel(double d) {return (long) ceil(d);}  static int gcf(int a, int b) {return b == 0 ? a : gcf(b, a % b);}  static long gcf(long a, long b) {return b == 0 ? a : gcf(b, a % b);}  static int lcm(int a, int b) {return a * b / gcf(a, b);}  static long lcm(long a, long b) {return a * b / gcf(a, b);}  static int randInt(int min, int max) {return __rand.nextInt(max - min + 1) + min;}  static long mix(long x) {x += 0x9e3779b97f4a7c15L; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9L; x = (x ^ (x >> 27)) * 0x94d049bb133111ebL; return x ^ (x >> 31);}   static void reverse(int[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {int swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(long[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {long swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(double[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {double swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(char[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {char swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void shuffle(int[] a) {int n = a.length - 1; for (int i = 0; i < n; ++i) {int ind = randInt(i, n); int swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}  static void shuffle(long[] a) {int n = a.length - 1; for (int i = 0; i < n; ++i) {int ind = randInt(i, n); long swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}  static void shuffle(double[] a) {int n = a.length - 1; for (int i = 0; i < n; ++i) {int ind = randInt(i, n); double swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}  static void rsort(int[] a) {shuffle(a); sort(a);}  static void rsort(long[] a) {shuffle(a); sort(a);}  static void rsort(double[] a) {shuffle(a); sort(a);}  static int[] copy(int[] a) {int[] ans = new int[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static long[] copy(long[] a) {long[] ans = new long[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static double[] copy(double[] a) {double[] ans = new double[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static char[] copy(char[] a) {char[] ans = new char[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}   static void r() throws IOException {input = new StringTokenizer(rline());}  static int ri() throws IOException {return Integer.parseInt(rline());}  static long rl() throws IOException {return Long.parseLong(rline());}  static double rd() throws IOException {return Double.parseDouble(rline());}  static int[] ria(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni(); return a;}  static int[] riam1(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni() - 1; return a;}  static long[] rla(int n) throws IOException {long[] a = new long[n]; r(); for (int i = 0; i < n; ++i) a[i] = nl(); return a;}  static double[] rda(int n) throws IOException {double[] a = new double[n]; r(); for (int i = 0; i < n; ++i) a[i] = nd(); return a;}  static char[] rcha() throws IOException {return rline().toCharArray();}  static String rline() throws IOException {return __in.readLine();}  static String n() {return input.nextToken();}  static int rni() throws IOException {r(); return ni();}  static int ni() {return Integer.parseInt(n());}  static long rnl() throws IOException {r(); return nl();}  static long nl() {return Long.parseLong(n());}  static double rnd() throws IOException {r(); return nd();}  static double nd() {return Double.parseDouble(n());}   static void pr(int i) {__out.print(i);}  static void prln(int i) {__out.println(i);}  static void pr(long l) {__out.print(l);}  static void prln(long l) {__out.println(l);}  static void pr(double d) {__out.print(d);}  static void prln(double d) {__out.println(d);}  static void pr(char c) {__out.print(c);}  static void prln(char c) {__out.println(c);}  static void pr(char[] s) {__out.print(new String(s));}  static void prln(char[] s) {__out.println(new String(s));}  static void pr(String s) {__out.print(s);}  static void prln(String s) {__out.println(s);}  static void pr(Object o) {__out.print(o);}  static void prln(Object o) {__out.println(o);}  static void prln() {__out.println();}  static void pryes() {prln("yes");}  static void pry() {prln("Yes");}  static void prY() {prln("YES");}  static void prno() {prln("no");}  static void prn() {prln("No");}  static void prN() {prln("NO");}  static boolean pryesno(boolean b) {prln(b ? "yes" : "no"); return b;};  static boolean pryn(boolean b) {prln(b ? "Yes" : "No"); return b;}  static boolean prYN(boolean b) {prln(b ? "YES" : "NO"); return b;}  static void prln(int... a) {for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i); if (a.length > 0) prln(a[a.length - 1]); else prln();}  static void prln(long... a) {for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i); if (a.length > 0) prln(a[a.length - 1]); else prln();}  static void prln(double... a) {for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i); if (a.length > 0) prln(a[a.length - 1]); else prln();}  static <T> void prln(Collection<T> c) {int n = c.size() - 1; Iterator<T> iter = c.iterator(); for (int i = 0; i < n; pr(iter.next()), pr(' '), ++i); if (n >= 0) prln(iter.next()); else prln();}  static void h() {prln("hlfd"); flush();}  static void flush() {__out.flush();}  static void close() {__out.close();} }
1	public class Main {   public static void main(String[] args) throws NumberFormatException, IOException {   Scanner sc = new Scanner(new InputStreamReader(System.in));   int n = sc.nextInt(),even = 0,odd = 0,evI = 0,OdI = 0;    for (int i = 0; i < n; i++) {    if(sc.nextInt()%2 == 1){     odd++;     OdI = i+1;    }else{     even++;     evI = i+1;    }   }   if(even < odd)    System.out.println(evI);   else    System.out.println(OdI);    } }
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();  } }
6	public class A {  FastScanner in;  PrintWriter out;  void solve() {   int tc = in.nextInt();   for (int t = 0; t < tc; t++) {    int n = in.nextInt();    int m = in.nextInt();    O[] a = new O[n * m];    int[][] cols = new int[m][n + n];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      cols[j][i] = cols[j][i + n] = in.nextInt();      a[i * m + j] = new O(i, j, cols[j][i]);     }    }    Arrays.sort(a);    boolean[] used = new boolean[m];    int cntUsed = 0;    for (O o : a) {     if (!used[o.y]) {      used[o.y] = true;      cntUsed++;      if (cntUsed == n) {       break;      }     }    }    int[] dp = new int[1 << n];    int[] ndp = new int[1 << n];    int[] maxndp = new int[1 << n];    for (int col = 0; col < m; col++) {     if (!used[col]) {      continue;     }     int[] curColumn = cols[col];     for (int shift = 0; shift < n; shift++) {      System.arraycopy(dp, 0, ndp, 0, ndp.length);      for (int mask = 0; mask < 1 << n; mask++) {       for (int bit = 0; bit < n; bit++) {        if (((1 << bit) & mask) == 0) {         int nmask = mask | (1 << bit);         ndp[nmask] = Math.max(ndp[nmask], ndp[mask] + curColumn[bit + shift]);        }       }      }      for (int i = 0; i < ndp.length; i++) {       maxndp[i] = Math.max(maxndp[i], ndp[i]);      }     }     int[] tmp = dp;     dp = maxndp;     maxndp = tmp;    }    out.println(dp[dp.length - 1]);   }  }  class O implements Comparable<O> {   int x, y, value;   public O(int x, int y, int value) {    this.x = x;    this.y = y;    this.value = value;   }   @Override   public int compareTo(O o) {    return -Integer.compare(value, o.value);   }  }   void run() {   try {    in = new FastScanner(new File("A.in"));    out = new PrintWriter(new File("A.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 A().runIO();  } }
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);    }   }
5	public class A { static Comparator<Point> cmp = new Comparator<Point>() {  public int compare(Point a, Point b)  {  if(a.x < b.x)   return -1;  else if(a.x > b.x)   return 1;   return 0;  } };  public static void main(String args[]) {  Scanner scan = new Scanner(System.in);  while(scan.hasNextInt())  {  int n = scan.nextInt();  int k = scan.nextInt();  Point[] a = new Point[n];  for(int i=0;i < n;i++)  {  a[i] = new Point();  a[i].x = scan.nextInt();  a[i].y = scan.nextInt();  }  Arrays.sort(a, cmp);  int rtn = 0;  ArrayList<Double> ans = new ArrayList<Double>();  for(int i=0;i < n;i++)  {    double lb = a[i].x - (a[i].y / 2.0) - k;  double pos = lb + (k/2.0);  boolean good = true;   for(int j=0;j < ans.size();j++)   if(Math.abs(ans.get(j) - pos) < 0.0000001)   good = false;   if(good && (i == 0 || a[i-1].x + (a[i-1].y / 2.0) <= lb))  {   rtn++;   ans.add(pos);  }   double rb = a[i].x + (a[i].y / 2.0) + k;  pos = rb - (k/2.0);  good = true;   for(int j=0;j < ans.size();j++)   if(Math.abs(ans.get(j) - pos) < 0.0000001)   good = false;   if(good && (i == n-1 || a[i+1].x - (a[i+1].y / 2.0) >= rb))  {   rtn++;   ans.add(pos);  }  }  System.out.println(rtn);  } } }
3	public class A{ InputStream is; PrintWriter out; String INPUT = "";  public void solve(){  int n=ni();  char[] arr=new char[n];  for(int i=0;i<n;i++){  arr[i]=ns().charAt(0);  }  long mod=1000000007;  long[][] memo=new long[n][n];  memo[0][0]=1L;  int k=0;  for(int i=1; i<n; i++){  if( (arr[i]=='f' && arr[i-1]=='s') || (arr[i]=='s' && arr[i-1]=='s') ){   long sum=0;   for(int j=k; j>=0; j--){   sum=(sum+(memo[i-1][j]%mod))%mod;   memo[i][j]=sum;   }  }  else{   k+=1;   for(int j=1; j<=k; j++){   memo[i][j] = memo[i-1][j-1] % mod;   }  }  }   long sum=0;  for(int i=0;i<=k;i++){  sum=(sum+(memo[n-1][i])%mod)%mod;  }  out.println(sum); } 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+")";  }  }  }
5	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(); }  class House {  int x, t;  public House(int x, int t) {  this.x = x;  this.t = t;  }  }  void solve() {  int n = nextInt();  int t = nextInt();  House[] h = new House[n];  for (int i = 0; i < n; i++) {  h[i] = new House(nextInt(), nextInt());  }  Arrays.sort(h, new Comparator<House>() {  @Override  public int compare(House o1, House o2) {   return o1.x < o2.x ? -1 : o1.x > o2.x ? 1 : 0;  }  });  int ans = 0;  for (int i = 0; i < n; i++) {  if (i == 0   || (h[i].x - h[i - 1].x) * 2 - h[i].t - h[i - 1].t >= 2 * t) {   ++ans;  }  if (i == n - 1   || (h[i + 1].x - h[i].x) * 2 - h[i + 1].t - h[i].t > 2 * t) {   ++ans;  }  }  out.println(ans); } }
6	public class f{  public static void main(String[] args) {  MyScanner sc = new MyScanner();  out = new PrintWriter(new BufferedOutputStream(System.out));    int n = sc.nextInt();  int m = sc.nextInt();  int[][] arr = new int[n][m];  for(int i=0; i<n; i++) {   for(int j=0; j<m; j++) {    arr[i][j] = sc.nextInt();   }  }  if(n==1) {   int min = Integer.MAX_VALUE;   for(int i=0; i<m-1; i++) {    min = Math.min(min, Math.abs(arr[0][i]-arr[0][i+1]));   }   out.println(min);   out.close();  }  int[][] adj = new int[n][n];  int[][] edgeadj = new int[n][n];  for(int i=0; i<n; i++) {   for(int j=i+1; j<n; j++) {    int min = Integer.MAX_VALUE;    for(int k=0; k<m; k++) {     min = Math.min(min, Math.abs(arr[i][k]-arr[j][k]));    }    adj[i][j]=min;    adj[j][i]=min;    int min1 = Integer.MAX_VALUE;    int min2 = Integer.MAX_VALUE;    for(int k=0; k<m-1; k++) {     min1 = Math.min(min1, Math.abs(arr[i][k]-arr[j][k+1]));     min2 = Math.min(min2, Math.abs(arr[i][k+1]-arr[j][k]));    }    edgeadj[i][j]=min1;    edgeadj[j][i]=min2;   }  }  int power = (int)Math.pow(2,n);  int[][][] dp = new int[power][n][n];  for(int i=0; i<n; i++) {   dp[(int)Math.pow(2,i)][i][i] = Integer.MAX_VALUE;  }  for(int bit=0; bit<power; bit++) {   for(int j=0; j<n; j++) {    for(int k=0; k<n; k++) {     if((bit & (1<<j))>0 && (bit & (1<<k))>0 && j!=k) {      int temp = bit;      temp &= ~(1<<k);      int ans = 0;      for(int l=0; l<n; l++) {       if((temp & (1<<l))>0) {        int min = Math.min(dp[temp][j][l], adj[l][k]);        ans = Math.max(ans, min);       }      }      if(j!=k) {       dp[bit][j][k] = ans;      }           }    }   }  }  int answer = 0;  for(int i=0; i<n; i++) {   for(int j=0; j<n; j++) {    if(i!=j) {     int ans = Math.min(dp[power-1][i][j], edgeadj[i][j]);     answer = Math.max(answer, ans);    }   }  }          out.println(answer);            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 Testt {  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 Testt().run();  }  public static void mergeSort(int[] a) {   mergeSort(a, 0, a.length - 1);  }  private static void mergeSort(int[] a, int leftIndex, int rightIndex) {   final int MAGIC_VALUE = 50;   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 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;   }  }  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);   }  }   public void solve() throws IOException {     int n = readInt();   int [] a = new int [n];   for (int i = 0; i < n; i++){    a[i] = readInt();   }   mergeSort(a);     int sum = 0;   for (int i = 0; i <n; i++){    sum+=a[i];   }   int sum2 = 0;   int ans = 0;   for (int i = n-1; i >=0; i-- ){    sum2+=a[i];    sum-=a[i];    ans++;    if (sum2>sum){     break;    }   }     out.print(ans);  } }
6	public class D implements Runnable { public static void main(String[] args) {  new D().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(); }  void solve() {   int n = nextInt();  int m = nextInt();  boolean[][] edges = new boolean[n][n];  boolean[] edge = new boolean[(n << 5) | n];  for (int i = 0; i < m; i++) {  int x = nextInt() - 1;  int y = nextInt() - 1;  edges[x][y] = edges[y][x] = true;  edge[(x << 5) | y] = edge[(y << 5) | x] = true;  }  long[][] dp = new long[n][1 << n];  long ans = 0;  for (int i = 0; i < n; i++) {  for (int mask2 = 1; mask2 < 1 << (n - i - 1); ++mask2) {   for (int j = i + 1; j < n; j++) {   dp[j][mask2 << i << 1] = 0;   }  }  for (int j = i + 1; j < n; j++) {   if (edges[i][j]) {   dp[j][1 << j] = 1;   }  }  for (int mask2 = 1; mask2 < 1 << (n - i - 1); ++mask2) {   int mask = (mask2 << i << 1);   if ((mask & (mask - 1)) == 0) {   continue;   }   for (int j = i + 1; j < n; j++) {   if (((mask >> j) & 1) == 0) {    continue;   }   dp[j][mask] = 0;   for (int k = i + 1; k < n; k++) {    if (((mask >> k) & 1) == 0 || !edge[(j << 5) | k]) {    continue;    }    dp[j][mask] += dp[k][mask & ~(1 << j)];   }   if (edge[(i << 5) | j]) {    ans += dp[j][mask];   }   }  }  }     out.println(ans / 2);            } }
1	public class Main{  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);   int t=sc.nextInt();   while(t-->0)   {    int n=sc.nextInt();    if(n%2==1)    {     System.out.println("NO");     continue;    }       int num=n/2;    int root = (int)Math.sqrt(num);    if(root*root==num)    {     System.out.println("YES");     continue;    }       if(n%4!=0)    {     System.out.println("NO");     continue;    }    num = n/4;    root = (int) Math.sqrt(num);    if(root*root==num)    {     System.out.println("YES");    }    else    {     System.out.println("NO");    }   }  } }
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();  }  }
1	public class Main {  public static void main(String[] args) throws Exception {  int n=ni();  Map<String, Integer> hola=new HashMap<String,Integer>();  hola.put("S", 0);  hola.put("XS", 0);  hola.put("XXS", 0);  hola.put("XXXS", 0);  hola.put("M", 0);  hola.put("L", 0);  hola.put("XL", 0);  hola.put("XXL", 0);  hola.put("XXXL", 0);  for(int i=0; i<n; i++)  {  String te=ns();  hola.put(te,hola.get(te)+1);  }  for(int i=0; i<n; i++)  {  String te=ns();  hola.put(te,hola.get(te)-1);  }  int ans=0;  for(int te:hola.values())  {  ans+=max(te,0);  }  pr(ans);  System.out.print(output); }    static int pow(int a, int b) {  int c=1;  while(b>0)  {  if(b%2!=0)   c*=a;  a*=a;  }  return c; } static class pair {  int a, b;  pair(){}  pair(int c,int d){a=c;b=d;} } static interface combiner {  public long combine(long a,long b); } static final long mod=1000000007; static final double eps=1e-9; static final long inf=100000000000000000L; static Reader in=new Reader(); static StringBuilder output=new StringBuilder(); static Random rn=new Random(); static void reverse(int[]a){for(int i=0; i<a.length/2; i++){a[i]^=a[a.length-i-1];a[a.length-i-1]^=a[i];a[i]^=a[a.length-i-1];}} static void sort(int[]a) {  int te;  for(int i=0; i<a.length; i+=2)  {  te=rn.nextInt(a.length);  if(i!=te)  {   a[i]^=a[te];   a[te]^=a[i];   a[i]^=a[te];  }  }  Arrays.sort(a); } static void sort(long[]a) {  int te;  for(int i=0; i<a.length; i+=2)  {  te=rn.nextInt(a.length);  if(i!=te)  {  a[i]^=a[te];  a[te]^=a[i];  a[i]^=a[te];  }  }  Arrays.sort(a); } static void sort(double[]a) {  int te;  double te1;  for(int i=0; i<a.length; i+=2)  {  te=rn.nextInt(a.length);  if(i!=te)  {  te1=a[te];  a[te]=a[i];  a[i]=te1;  }  }  Arrays.sort(a); } static void sort(int[][]a) {  Arrays.sort(a, new Comparator<int[]>()  {  public int compare(int[]a,int[]b)  {   if(a[0]>b[0])   return -1;   if(b[0]>a[0])   return 1;   return 0;  }  }); } static void sort(pair[]a) {  Arrays.sort(a,new Comparator<pair>()   {  @Override  public int compare(pair a,pair b)  {   if(a.a>b.a)   return 1;   if(b.a>a.a)   return -1;   return 0;  }   }); } static int log2n(long a) {  int te=0;  while(a>0)  {  a>>=1;  ++te;  }  return te; } static class vectorl implements Iterable<Long> {  long a[];  int size;  vectorl(){a=new long[10];size=0;}  vectorl(int n){a=new long[n];size=0;}  public void add(long b){if(++size==a.length)a=Arrays.copyOf(a, 2*size);a[size-1]=b;}  public void sort(){Arrays.sort(a, 0, size);}  public void sort(int l, int r){Arrays.sort(a, l, r);}  @Override  public Iterator<Long> iterator() {  Iterator<Long> hola=new Iterator<Long>()   {   int cur=0;    @Override    public boolean hasNext() {    return cur<size;    }    @Override    public Long next() {    return a[cur++];    }     };  return hola;  } } static class vector implements Iterable<Integer> {  int a[],size;  vector(){a=new int[10];size=0;}  vector(int n){a=new int[n];size=0;}  public void add(int b){if(++size==a.length)a=Arrays.copyOf(a, 2*size);a[size-1]=b;}  public void sort(){Arrays.sort(a, 0, size);}  public void sort(int l, int r){Arrays.sort(a, l, r);}  @Override  public Iterator<Integer> iterator() {  Iterator<Integer> hola=new Iterator<Integer>()   {   int cur=0;    @Override    public boolean hasNext() {    return cur<size;    }    @Override    public Integer next() {    return a[cur++];    }     };  return hola;  } }  static void pr(Object a){output.append(a+"\n");} static void pr(){output.append("\n");} static void p(Object a){output.append(a);} static void pra(int[]a){for(int i:a)output.append(i+" ");output.append("\n");} static void pra(long[]a){for(long i:a)output.append(i+" ");output.append("\n");} static void pra(String[]a){for(String i:a)output.append(i+" ");output.append("\n");} static void pra(double[]a){for(double i:a)output.append(i+" ");output.append("\n");} static void sop(Object a){System.out.println(a);} static void flush(){System.out.println(output);output=new StringBuilder();}   static int ni(){return Integer.parseInt(in.next());} static long nl(){return Long.parseLong(in.next());} static String ns(){return in.next();} static double nd(){return Double.parseDouble(in.next());} static int[] nia(int n){int a[]=new int[n];for(int i=0; i<n; i++)a[i]=ni();return a;} static int[] pnia(int n){int a[]=new int[n+1];for(int i=1; i<=n; i++)a[i]=ni();return a;} static long[] nla(int n){long a[]=new long[n];for(int i=0; i<n; i++)a[i]=nl();return a;} static String[] nsa(int n){String a[]=new String[n];for(int i=0; i<n; i++)a[i]=ns();return a;} static double[] nda(int n){double a[]=new double[n];for(int i=0; i<n; i++)a[i]=nd();return a;}   static void exit(){System.out.print(output);System.exit(0);} static int min(int... a){int min=a[0];for(int i:a)min=Math.min(min, i);return min;} static int max(int... a){int max=a[0];for(int i:a)max=Math.max(max, i);return max;}  static int gcd(int... a){int gcd=a[0];for(int i:a)gcd=gcd(gcd, i);return gcd;}  static long min(long... a){long min=a[0];for(long i:a)min=Math.min(min, i);return min;} static long max(long... a){long max=a[0];for(long i:a)max=Math.max(max, i);return max;}  static long gcd(long... a){long gcd=a[0];for(long i:a)gcd=gcd(gcd, i);return gcd;}  static String pr(String a, long b){String c="";while(b>0){if(b%2==1)c=c.concat(a);a=a.concat(a);b>>=1;}return c;} static long powm(long a, long b, long m){long an=1;long c=a;while(b>0){if(b%2==1)an=(an*c)%m;c=(c*c)%m;b>>=1;}return an;} 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 class Reader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public Reader() {    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();   }  } }
1	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n;   n = sc.nextInt();   int[] arr = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = sc.nextInt();   }   int min = 1000000000, temp;   for (int i = 0; i < n; i++) {    temp = arr[i] / Math.max(i, n - 1 - i);    if (temp < min)     min = temp;   }   System.out.println(min);  } }
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");  } }
3	public class ProblemA { public static void main (String args[]) throws IOException{  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  int n=Integer.parseInt(br.readLine());  String s1=br.readLine();  String[] s=s1.split(" ");  int a[] = new int[n];  for(int i = 0;i<n;i++)  {  a[i]=Integer.parseInt(s[i]);  }  Arrays.sort(a);  System.out.println(findColour(a,n)); } public static int findColour(int [] a , int n) {  Map <Integer,Integer> mp = new HashMap<Integer,Integer>();  int f=0;  for(int i = 0; i<n;i++)  {  f=0;  for (Map.Entry<Integer,Integer> entry : mp.entrySet())   {   if(a[i] % entry.getKey()==0)   {   f=1;   break;   }  }  if(f==0)  {   mp.put(a[i],1);  }    }  return mp.size(); } }
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));  } }
5	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 t = nextInt();     double[] d = new double[2*n];   for (int i = 0; i < n; ++i) {    double x = nextDouble();    double a = nextDouble();    d[2*i] = x-a/2;    d[2*i+1] = x+a/2;   }     Arrays.sort(d);   int res = 2;   for (int i = 1; i < 2*n-1; i+=2) {    if (d[i+1] - d[i] >= t) {     ++res;    }    if (d[i+1] - d[i] > t) {     ++res;    }   }     out.println(res);   out.flush();  } }
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;  } }
3	public class Main3 {  static PrintWriter pr;  static Scanner scan;  static BufferedReader br;  static StringTokenizer st;  public static void main(String args[]) throws Exception {   pr = new PrintWriter(System.out);   scan = new Scanner(System.in);   br = new BufferedReader(new InputStreamReader(System.in));   int n = inputInt();     int[] a = new int[n];   int[] b = new int[n];   st = new StringTokenizer(br.readLine());   for(int i=0;i<n;i++){    a[i]=Integer.parseInt(st.nextToken());      }   Arrays.sort(a);   int ans=0;   for(int i=0;i<n;i++){    if(b[i]!=1){     ans++;     for(int j=i;j<n;j++){      if(a[j]%a[i]==0){       b[j]=1;      }     }    }   }   System.out.println(ans);  }   public static int inputInt() throws IOException{   return Integer.parseInt(br.readLine());  }  public static long inputLong() throws IOException{   return Long.parseLong(br.readLine());  }  public static String inputString() throws IOException{   return br.readLine();  }  public static int[] intArray(int n) throws IOException{   int a[] = new int[n];   st = new StringTokenizer(br.readLine());   for(int i=0;i<n;i++){    a[i] = Integer.parseInt(st.nextToken());   }   return a;  }  public static long[] longArray(int n) throws IOException{   long a[] = new long[n];   st = new StringTokenizer(br.readLine());   for(int i=0;i<n;i++){    a[i] = Long.parseLong(st.nextToken());   }   return a;  }  public static String[] stringArray(int n) throws IOException{   String a[] = new String[n];   st = new StringTokenizer(br.readLine());   for(int i=0;i<n;i++){    a[i] = st.nextToken();   }   return a;  }  public static long gcd(long a,long b){   if(b==0){    return a;   }   else{    return gcd(b,a%b);   }  }  public long max(long a,long b,long c){   return Math.max(a,Math.max(b,c));  } }
1	public class Watermelon {  static class Passengers {   public int floor ;  public int time;      public Passengers( int floor , int time){   this.floor =floor;   this.time =time;  }   }     public static void main(String[] args) {        Scanner in = new Scanner(System.in);     int x = in.nextInt() , y = in.nextInt();     ArrayList<Passengers> list = new ArrayList<>();     for(int i = 1 ; i <= x ; ++i){    list.add(new Passengers(in.nextInt(), in.nextInt()));   }     int sum = 0 ;   for(int i = list.size() - 1 ; i >= 0 ; --i)   {   int s = y - list.get(i).floor;   sum = sum + s ;       if(sum < list.get(i).time)   {    sum = sum + ( list.get(i).time - sum);   }      y = list.get(i).floor;   }        if( list.get(list.size() - 1).floor != 0){    sum = sum + (list.get(0).floor);   }   System.out.println(sum);  }  }
0	public class CF267A {  public static void main(String[] args) {  int n=0, a, b;  BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));  try {  n = Integer.parseInt(stdin.readLine());  } catch (IOException e) {  }  while(n-->0){  String[] row = null;  try {   row = stdin.readLine().split(" ");  } catch (IOException e) {     e.printStackTrace();  }  a = Integer.parseInt(row[0]);  b = Integer.parseInt(row[1]);  if(a<b) System.out.println(calc(a,b));  else System.out.println(calc(b,a));  } }  static int calc(int a, int b){  if(a==0) return 0;  if(a==b) return 1;  if(a==1) return b;  else return b/a+calc(b%a, a); } }
5	public class A {   static class team implements Comparable<team> {  int problems;  int penalty;  public team(int problems,int penalty)  {  this.penalty=penalty;  this.problems=problems;  }  public int compareTo(team a) {  if (a.problems==this.problems)   return this.penalty - a.penalty;  return a.problems - this.problems;  }   public boolean igual(team a)  {  if (this.problems!=a.problems)   return false;  return (this.penalty==a.penalty);  } }  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  {  if (!tk.hasMoreTokens())  {   tk=new StringTokenizer(rd.readLine());   return tk.nextToken();  }  return tk.nextToken();  }  public int nextInt() throws NumberFormatException, IOException  {  return Integer.valueOf(this.next());  } }   static team[] array=new team[100]; static int N,K;  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]=new team(sc.nextInt(),sc.nextInt());  }  Arrays.sort(array,0,N);     int shared=0;  for(int i=K-1;i>=0 && array[K-1].igual(array[i]);i--,shared++);  for(int i=K;i<N && array[K-1].igual(array[i]);i++,shared++);  System.out.println(shared); } }
5	public class Village { private class House implements Comparable<House>{  Double Coordinate;  Double Sidelength;  public House(double coordinate, double sidelength) {  Coordinate = coordinate;  Sidelength = sidelength;  }  public int compareTo(House o) {  return Coordinate.compareTo(o.Coordinate);  } }   public static void main(String args[]) {  Village v = new Village();  v.solve(); } public void solve() { Scanner in = new Scanner(System.in); int numhouse = in.nextInt(); double requireside = in.nextDouble();   ArrayList<House> coordinate = new ArrayList<House>(); ArrayList<Double> sidelength = new ArrayList<Double>();  while (in.hasNext()) {  double coo = in.nextDouble();  double side = in.nextDouble();     coordinate.add(new House(coo,side));  sidelength.add(side);  } Collections.sort(coordinate); ArrayList<Double> edges = new ArrayList<Double>(); int count = 2; for (int i = 0; i < coordinate.size();i++) {  edges.add(coordinate.get(i).Coordinate - (double)coordinate.get(i).Sidelength/(double)2);  edges.add(coordinate.get(i).Coordinate + (double)coordinate.get(i).Sidelength/(double)2); } ArrayList<Double> difference = new ArrayList<Double>(); for (int i = 1; i < edges.size() - 1; i++) {  difference.add(Math.abs(edges.get(i) - edges.get(i+1))); } for (int i = 0; i < difference.size(); i+=2) {  if (difference.get(i) == requireside) count++;  else if (difference.get(i) > requireside) count+=2; } System.out.println(count); } }
1	public class main {  public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  public static PrintWriter pw = new PrintWriter(System.out);  public static String line;  public static StringTokenizer st;  public static ArrayList<ArrayList<Integer>> adjList;  public static int[] dr = {-1, 0, 1, 0, -1, 1, 1, -1};  public static int[] dc = {0, 1, 0, -1, 1, 1, -1, -1};  public static void main(String[] args) throws Exception{   int N = Integer.parseInt(br.readLine());   char[] A = br.readLine().toCharArray();   HashSet<Character> cndD = new HashSet<Character>();   for(int i = 0; i < N; i++){    cndD.add(A[i]);   }   int cnt = cndD.size();   int a = 0;   int b = 0;   int ans = (1 << 30);   HashMap<Character, Integer> d = new HashMap<Character, Integer>();   while(b < N){    if(d.containsKey(A[b])){     if(A[a] == A[b]){      a++;      while(d.get(A[a]) > 1){       d.put(A[a], d.get(A[a])-1);       a++;      }     } else{      d.put(A[b], d.get(A[b])+1);     }    } else{     d.put(A[b], 1);    }    if(d.size() == cnt){     ans = Math.min(b-a+1, ans);    }    b++;   }   pw.print(ans + "\n");   pw.close();   br.close();  } } class Pair implements Comparable<Pair>{  public int a, b;  Pair(int a, int b){   this.a = a;   this.b = b;  }  @Override  public int compareTo(Pair P){   if(P.b != this.b){    return b - P.b;   } else if(P.a == this.a){    return a - P.a;   } else{    return 0;   }  }  public String toString(){   return a + " " + b;  } }
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));   }  } }
3	public class paintNumbers { public static int minIndex(List<Integer> list) {  int min = list.get(0);  int minIndex = 0;  for (int i = 0; i < list.size(); i++) {  if (list.get(i) < min) {   min = list.get(i);   minIndex = i;  }  }  return minIndex; }  public static void main(String[] args) throws IOException {   FastScanner sc = new FastScanner(System.in);   PrintWriter pw = new PrintWriter(System.out);     int n = sc.nextInt();   List<Integer> list = new ArrayList<Integer>();   for (int i = 0; i < n; i++) {   list.add(sc.nextInt());   }   int count = 0;   while (list.size() > 0) {   count++;   int temp = list.get(minIndex(list));    for (int j = 0; j < list.size(); j++) {    if (list.get(j) % temp == 0) {     list.remove(j);    j--;    }   }    }   pw.println(count);     pw.close();  }  static class FastScanner {  private boolean finished = false;   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private SpaceCharFilter filter;   public FastScanner(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 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 String nextString() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     if (Character.isValidCodePoint(c)) {      res.appendCodePoint(c);     }     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   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;   }   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(nextString());    } catch (NumberFormatException e) {     throw new InputMismatchException();    }   }   public char nextCharacter() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    return (char) c;   }   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 boolean isExhausted() {    int value;    while (isSpaceChar(value = peek()) && value != -1) {     read();    }    return value == -1;   }  public String next() {    return nextString();   }   public SpaceCharFilter getFilter() {    return filter;   }   public void setFilter(SpaceCharFilter filter) {    this.filter = filter;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }   public int[] nextIntArray(int n){    int[] array=new int[n];    for(int i=0;i<n;++i)array[i]=nextInt();    return array;   }   public int[] nextSortedIntArray(int n){    int array[]=nextIntArray(n);    PriorityQueue<Integer> pq = new PriorityQueue<Integer>();    for(int i = 0; i < n; i++){     pq.add(array[i]);    }    int[] out = new int[n];    for(int i = 0; i < n; i++){     out[i] = pq.poll();    }    return out;   }   public int[] nextSumIntArray(int n){    int[] array=new int[n];    array[0]=nextInt();    for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();    return array;   }   public ArrayList<Integer>[] nextGraph(int n, int m){    ArrayList<Integer>[] adj = new ArrayList[n];    for(int i = 0; i < n; i++){     adj[i] = new ArrayList<Integer>();    }    for(int i = 0; i < m; i++){     int u = nextInt(); int v = nextInt();     u--; v--;     adj[u].add(v); adj[v].add(u);    }    return adj;   }   public ArrayList<Integer>[] nextTree(int n){    return nextGraph(n, n-1);   }   public long[] nextLongArray(int n){    long[] array=new long[n];    for(int i=0;i<n;++i)array[i]=nextLong();    return array;   }   public long[] nextSumLongArray(int n){    long[] array=new long[n];    array[0]=nextInt();    for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();    return array;   }   public long[] nextSortedLongArray(int n){    long array[]=nextLongArray(n);    Arrays.sort(array);    return array;   }  } }
4	public class BetaRound23_A implements Runnable {  final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer("");  void init() 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");  } }  String readString() throws IOException {  while (!tok.hasMoreTokens()) {  tok = new StringTokenizer(in.readLine());  }  return tok.nextToken(); }  int readInt() throws IOException {  return Integer.parseInt(readString()); }  @Override 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);  } }  public static void main(String[] args) {  new Thread(new BetaRound23_A()).start(); }  void solve() throws IOException {  char[] s = in.readLine().toCharArray();  int n = s.length;  for (int ans = n - 1; ans >= 1; ans--) {  for (int i = 0; i < n - ans + 1; i++) {   for (int j = i + 1; j < n - ans + 1; j++) {   int count = 0;   for (int k = 0; k < ans; k++) {    if (s[i + k] == s[j + k]) count++;    else break;   }   if (count == ans) {    out.print(ans);    return;   }   }  }  }  out.print(0); }  }
0	public class Main{ public static void main(String[]args){ Scanner input=new Scanner(System.in); int x=input.nextInt(); if(x%4==0||x%7==0||x%47==0||x%74==0||x%744==0||x%474==0||x%447==0||x%477==0||x%474==0) System.out.println("YES"); else System.out.println("NO"); } }
6	public class ElongatedMatrix { static int[][][] memo; static int mn1[][]; static int mn2[][]; static int r, c;  static int dp(int mask, int first, int lastvisited) {  if (memo[first][lastvisited][mask] != -1)  return memo[first][lastvisited][mask];  int ans = 0;  for (int i = 0; i < r; i++) {  if ((mask & (1 << i)) == 0) {   if (Integer.bitCount(mask) != r - 1) {   ans = Math.max(ans, Math.min(mn1[lastvisited][i], dp(((mask) | (1 << i)), first, i)));   } else   ans = Math.max(ans, Math.min(mn2[first][i], mn1[lastvisited][i]));  }  }   return memo[first][lastvisited][mask] = ans; }  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);  r = Integer.parseInt(st.nextToken());   c = Integer.parseInt(st.nextToken());  int[][] arr = new int[r][c];  memo = new int[r][r][1 << r];  mn1 = new int[r][r];  mn2 = new int[r][r];  for(int i=0;i<r;i++) {  st=new StringTokenizer(br.readLine());  for(int j=0;j<c;j++) {   arr[i][j]=Integer.parseInt(st.nextToken());  }  }  for (int i = 0; i < r; i++) {  Arrays.fill(mn1[i], (int)1e9);  Arrays.fill(mn2[i], (int)1e9);  }   for (int i = 0; i < r; i++) {  for (int j = 0; j < r; j++) {   Arrays.fill(memo[i][j], -1);  }  }  for (int i = 0; i < r; i++) {  for (int j = 0; j < r; j++) {   for (int k = 0; k < c; k++) {      mn1[i][j] = Math.min(mn1[i][j], Math.abs(arr[i][k] - arr[j][k]));      }  }  }  for (int i = 0; i < r; i++) {  for (int j = 0; j < r; j++) {   for (int k = 0; k < c-1; k++) {      mn2[i][j] = Math.min(mn2[i][j], Math.abs(arr[j][k] - arr[i][k + 1]));      }  }  }   int ans = 0;  for (int i = 0; i < r; i++) {  ans=Math.max(ans, dp(1<<i,i,i));  }  if(r==1)  ans=mn2[0][0];  out.println(ans);  out.flush(); } }
5	public class _P015A{  Scanner sc=new Scanner(System.in);  int INF=1<<28;  double EPS=1e-9;  int n, t;  int[][] a;  void run(){   n=sc.nextInt();   t=sc.nextInt();   a=new int[n][2];   for(int i=0; i<n; i++){    a[i][0]=sc.nextInt();    a[i][1]=sc.nextInt();   }   solve();  }  void solve(){   sort(a, new Comparator<int[]>(){    @Override    public int compare(int[] a0, int[] a1){     return a0[0]-a1[0];    }   });   int ans=2;   for(int i=0; i<n-1; i++){    int s=(a[i+1][0]*2-a[i+1][1])-(a[i][0]*2+a[i][1]);    if(s>t*2){     ans+=2;    }else if(s==t*2){     ans++;    }   }   println(ans+"");  }  void println(String s){   System.out.println(s);  }  void print(String s){   System.out.print(s);  }  void debug(Object... os){   System.err.println(Arrays.deepToString(os));  }  public static void main(String[] args){   new _P015A().run();  } }
0	public class Main {  public static void main(String[] args) {   Scanner r = new Scanner(System.in);     int N = r.nextInt();     System.out.println(N + " " + 0 + " " + 0);  } }
1	public class R025A { int n; int[] nums; public R025A() {  Scanner scanner = new Scanner(System.in);  n = scanner.nextInt();  nums = new int[n];  for(int i=0; i<n; i++) {  nums[i] = scanner.nextInt();  } }  private void process() {  int odd = 0;  int even = 0;  int lastOdd = 0;  int lastEven = 0;  for(int i=0; i<n; i++) {  if(nums[i] % 2 == 0) {   even++;   lastEven = i+1;  } else {   odd++;   lastOdd = i+ 1;  }  }  if(odd == 1) System.out.println(lastOdd);  else System.out.println(lastEven); }  public static void main(String[] args) {  new R025A().process(); } }
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));   }  } }
0	public class n122A {  Scanner in;  PrintWriter out;  void solve() {   int n = in.nextInt();   boolean good = false;   if (n % 4 == 0) {    good = true;   }   if (n % 7 == 0) {    good = true;   }   if (n % 44 == 0) {    good = true;   }   if (n % 47 == 0) {    good = true;   }   if (n % 74 == 0) {    good = true;   }   if (n % 77 == 0) {    good = true;   }   if (n % 444 == 0) {    good = true;   }   if (n % 447 == 0) {    good = true;   }   if (n % 474 == 0) {    good = true;   }   if (n % 477 == 0) {    good = true;   }   if (n % 744 == 0) {    good = true;   }   if (n % 747 == 0) {    good = true;   }   if (n % 774 == 0) {    good = true;   }   if (n % 777 == 0) {    good = true;   }   if (good) {    out.println("YES");   } else {    out.println("NO");   }  }  void run() {   in = new Scanner(System.in);   out = new PrintWriter(System.out);   try {    solve();   } finally {    out.close();   }  }  public static void main(String[] args) {   new n122A().run();  } }
1	public class TaskA { public static void main(String[] args) {  new TaskA(System.in, System.out); }  static class Solver implements Runnable {  int n, d;  long[] arr;  InputReader in;  PrintWriter out;  void solve() throws IOException  {  n = in.nextInt();  d = in.nextInt();  arr = in.nextLongArray(n);   Set<Long> set = new HashSet<>();   for (int i = 0; i < n; i++)  {   if (i == 0)   set.add(arr[i] - d);   else   {   long left = arr[i] - d;    if (left - arr[i - 1] >= d)    set.add(left);   }   if (i == n - 1)   set.add(arr[i] + d);   else   {   long right = arr[i] + d;    if (arr[i + 1] - right >= d)    set.add(right);   }  }   out.println(set.size());  }  void debug(Object... o)  {  System.err.println(Arrays.deepToString(o));  }   public Solver(InputReader in, PrintWriter out)  {  this.in = in;  this.out = out;  }  @Override  public void run()  {  try  {   solve();  }  catch (IOException e)  {   e.printStackTrace();  }  }  }  static class InputReader {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  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 int[] nextIntArray(int arraySize)  {  int array[] = new int[arraySize];   for (int i = 0; i < arraySize; i++)   array[i] = nextInt();   return array;  }  public long nextLong()  {  int c = read();   while (isSpaceChar(c))   c = read();   int sign = 1;   if (c == '-')  {   sign = -1;   c = read();  }   long result = 0;   do  {   if (c < '0' || c > '9')   throw new InputMismatchException();   result *= 10;   result += c & 15;   c = read();  } while (!isSpaceChar(c));   return result * sign;  }  public long[] nextLongArray(int arraySize)  {  long array[] = new long[arraySize];   for (int i = 0; i < arraySize; i++)   array[i] = nextLong();   return array;  }  public float nextFloat()  {  float result, div;  byte c;   result = 0;  div = 1;  c = (byte) read();   while (c <= ' ')   c = (byte) read();   boolean isNegative = (c == '-');   if (isNegative)   c = (byte) read();   do  {   result = result * 10 + c - '0';  } while ((c = (byte) read()) >= '0' && c <= '9');   if (c == '.')   while ((c = (byte) read()) >= '0' && c <= '9')   result += (c - '0') / (div *= 10);   if (isNegative)   return -result;   return result;  }  public double nextDouble()  {  double ret = 0, div = 1;  byte c = (byte) read();   while (c <= ' ')   c = (byte) read();   boolean neg = (c == '-');   if (neg)   c = (byte) read();   do  {   ret = ret * 10 + c - '0';  } while ((c = (byte) read()) >= '0' && c <= '9');   if (c == '.')   while ((c = (byte) read()) >= '0' && c <= '9')   ret += (c - '0') / (div *= 10);   if (neg)   return -ret;   return ret;  }  public String next()  {  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();   StringBuilder result = new StringBuilder();   do  {   result.appendCodePoint(c);   c = read();  } while (!isNewLine(c));   return result.toString();  }  public boolean isNewLine(int c)  {  return c == '\n';  }  public boolean isSpaceChar(int c)  {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  public void close()  {  try  {   stream.close();  }  catch (IOException e)  {   e.printStackTrace();  }  }  public InputReader(InputStream stream)  {  this.stream = stream;  }  }  static class CMath {  static long power(long number, long power)  {  if (number == 1 || number == 0 || power == 0)   return 1;   if (power == 1)   return number;   if (power % 2 == 0)   return power(number * number, power / 2);  else   return power(number * number, power / 2) * number;  }  static long modPower(long number, long power, long mod)  {  if (number == 1 || number == 0 || power == 0)   return 1;   number = mod(number, mod);   if (power == 1)   return number;   long square = mod(number * number, mod);   if (power % 2 == 0)   return modPower(square, power / 2, mod);  else   return mod(modPower(square, power / 2, mod) * number, mod);  }  static long moduloInverse(long number, long mod)  {  return modPower(number, mod - 2, mod);  }  static long mod(long number, long mod)  {  return number - (number / mod) * mod;  }  static int gcd(int a, int b)  {  if (b == 0)   return a;  else   return gcd(b, a % b);  }  static long min(long... arr)  {  long min = arr[0];   for (int i = 1; i < arr.length; i++)   min = Math.min(min, arr[i]);   return min;  }  static long max(long... arr)  {  long max = arr[0];   for (int i = 1; i < arr.length; i++)   max = Math.max(max, arr[i]);   return max;  }  static int min(int... arr)  {  int min = arr[0];   for (int i = 1; i < arr.length; i++)   min = Math.min(min, arr[i]);   return min;  }  static int max(int... arr)  {  int max = arr[0];   for (int i = 1; i < arr.length; i++)   max = Math.max(max, arr[i]);   return max;  }  }  static class Utils {  static boolean nextPermutation(int[] arr)  {  for (int a = arr.length - 2; a >= 0; --a)  {   if (arr[a] < arr[a + 1])   {   for (int b = arr.length - 1; ; --b)   {    if (arr[b] > arr[a])    {    int t = arr[a];     arr[a] = arr[b];    arr[b] = t;     for (++a, b = arr.length - 1; a < b; ++a, --b)    {     t = arr[a];     arr[a] = arr[b];     arr[b] = t;    }     return true;    }   }   }  }   return false;  }  }  public TaskA(InputStream inputStream, OutputStream outputStream) {   InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  Thread thread = new Thread(null, new Solver(in, out), "TaskA", 1 << 29);  try  {  thread.start();  thread.join();  }  catch (InterruptedException e)  {  e.printStackTrace();  }  finally  {  in.close();  out.flush();  out.close();  } } }
5	public class Chores { public static void main(String args[])throws IOException  {  InputStreamReader isr = new InputStreamReader(System.in);  BufferedReader br = new BufferedReader(isr);  String[] line = br.readLine().split("\\W");  int n = Integer.parseInt(line[0]);  int a = Integer.parseInt(line[1]);  int b = Integer.parseInt(line[2]);  int[] num = new int[n];  line = br.readLine().split("\\W");  for(int i=0;i<n;i++) num[i] = Integer.parseInt(line[i]);  Arrays.sort(num);   System.out.println(num[b]-num[b-1]); } }
1	public class Main { public static void main(String[] args) throws NumberFormatException, IOException {  BufferedReader r = new BufferedReader(new InputStreamReader(System.in));   int size= Integer.parseInt(r.readLine());  String line = r.readLine();   int counter =0;  for (int i = 0; i < line.length(); i++) {  if(line.charAt(i)=='H')counter++;  }   int minimum = Integer.MAX_VALUE;  for (int i = 0; i < line.length(); i++) {  if(line.charAt(i)=='H'){   int current = 0;   for (int j = i; j < i+counter; j++) {   if(line.charAt(j%line.length())=='T')current++;   }   minimum = Math.min(current, minimum);  }  }   System.out.println(minimum);   } }
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();  } }
2	public class A{   private InputStream inputStream ; private OutputStream outputStream ; private FastReader in ; private PrintWriter out ;  private final int BUFFER = 100005; private final long mod = 1000000000+7; private final int INF = Integer.MAX_VALUE; private final long INF_L = Long.MAX_VALUE / 10;  public A(){} public A(boolean stdIO)throws FileNotFoundException{   if(stdIO){  inputStream = System.in;  outputStream = System.out;  }else{  inputStream = new FileInputStream("input.txt");  outputStream = new FileOutputStream("output.txt");  }  in = new FastReader(inputStream);  out = new PrintWriter(outputStream); }  void run()throws Exception{  long x = l(); long k = l();  if(x == 0){  out.write("0");  return;  }  x %= mod;  long a = (x * pow(2L, k, mod) + mod)%mod;  long b = (a - pow(2L, k, mod) + 1 + mod)%mod;  long res = (a + b + mod )%mod;  out.write(""+res+"\n"); }  long gcd(long a, long b){  if(b == 0)return a;  return gcd(b, a % b); }  long lcm(long a, long b){  if(a == 0 || b == 0)return 0;  return (a * b)/gcd(a, b); }  long mulMod(long a, long b, long mod){  if(a == 0 || b == 0)return 0;  if(b == 1)return a;  long ans = mulMod(a, b/2, mod);  ans = (ans * 2) % mod;  if(b % 2 == 1)ans = (a + ans)% mod;  return ans; }  long pow(long a, long b, long mod){  if(b == 0)return 1;  if(b == 1)return a;  long ans = pow(a, b/2, mod);  ans = (ans * ans);  if(ans >= mod)ans %= mod;  if(b % 2 == 1)ans = (a * ans);  if(ans >= mod)ans %= mod;  return ans; }   long[][] ncrTable(){  long ncr[][] = new long[21][21];  for(int i = 0; i <= 20; i++){  ncr[i][0] = ncr[i][i] = 1L;  }  for(int j = 0; j <= 20; j++){  for(int i = j + 1; i <= 20; i++){   ncr[i][j] = ncr[i-1][j] + ncr[i-1][j-1];  }  }  return ncr; }  int i()throws Exception{  return in.nextInt(); }  long l()throws Exception{  return in.nextLong(); }  double d()throws Exception{  return in.nextDouble(); }  char c()throws Exception{  return in.nextCharacter(); }  String s()throws Exception{  return in.nextLine(); }  BigInteger bi()throws Exception{  return in.nextBigInteger(); }  private void closeResources(){  out.flush();  out.close();  return; }      public static void main(String[] args) throws java.lang.Exception{   A driver = new A(true);  driver.run();  driver.closeResources(); } } class FastReader{  private boolean finished = false;  private InputStream stream; private byte[] buf = new byte[4 * 1024]; private int curChar; private int numChars; private SpaceCharFilter filter;  public FastReader(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 nextInt(){  int c = read ();  while (isSpaceChar (c))  c = read ();  int sgn = 1;  if (c == '-'){  sgn = -1;  c = read ();  }  int res = 0;  do{  if(c==','){   c = read();  }  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 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 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; }  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 nextLine(){  String s = readLine0 ();  while (s.trim ().length () == 0)  s = readLine0 ();  return s; }  public String nextLine(boolean ignoreEmptyLines){  if (ignoreEmptyLines){  return nextLine ();  }else{  return readLine0 ();  } }  public BigInteger nextBigInteger(){  try{  return new BigInteger (nextString ());  } catch (NumberFormatException e){  throw new InputMismatchException ();  } }  public char nextCharacter(){  int c = read ();  while (isSpaceChar (c))  c = read ();  return (char) c; }  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 boolean isExhausted(){  int value;  while (isSpaceChar (value = peek ()) && value != -1)  read ();  return value == -1; }  public String next(){  return nextString (); }  public SpaceCharFilter getFilter(){  return filter; }  public void setFilter(SpaceCharFilter filter){  this.filter = filter; }  public interface SpaceCharFilter{  public boolean isSpaceChar(int ch); } } class Pair implements Comparable<Pair>{ public int a; public int b; public int c;  public Pair(){  this.a = 0;  this.b = 0;  this.c = 0; }  public Pair(int a,int b, int c){  this.a = a;  this.b = b;  this.c = c; }  public int compareTo(Pair p){  return this.c - p.c;  }  @Override public String toString(){  return "a = " + this.a + " b = " + this.b + " c = "+this.c; } }
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);  } } }
4	public class Main { static final FastReader FR = new FastReader(); static final PrintWriter PW = new PrintWriter(new OutputStreamWriter(System.out));  public static void main(String[] args) {  StringBuilder solution = new StringBuilder();  int rows = FR.nextInt();  int cols = FR.nextInt();  int moves = FR.nextInt();  List<List<Integer>> horizontalEdgeWeights = new ArrayList<List<Integer>>(rows);  for (int r = 0; r < rows; r++) {  horizontalEdgeWeights.add(new ArrayList<Integer>(cols-1));   for (int c = 0; c < cols - 1; c++) {   horizontalEdgeWeights.get(r).add(FR.nextInt());  }  }  List<List<Integer>> verticalEdgeWeights = new ArrayList<List<Integer>>(rows-1);  for (int r = 0; r < rows - 1; r++) {  verticalEdgeWeights.add(new ArrayList<Integer>(cols));   for (int c = 0; c < cols; c++) {   verticalEdgeWeights.get(r).add(FR.nextInt());  }  }   List<List<Integer>> result = getResult(rows, cols, moves, horizontalEdgeWeights, verticalEdgeWeights);  for (int r = 0; r < rows; r++) {  for (int c = 0; c < cols; c++) {   int value = (result != null ? result.get(r).get(c) : -1);   solution.append(value + " ");  }  solution.append("\n");  }  PW.print(solution.toString());  PW.close(); }  static List<List<Integer>> getResult(int rows, int cols, int moves, List<List<Integer>> horizontalEdgeWeights, List<List<Integer>> verticalEdgeWeights) {  if ((moves & 1) == 1) {  return null;  }  int mid = moves >> 1;  List<List<List<Integer>>> minForDistance = new ArrayList<List<List<Integer>>>(rows);  for (int r = 0; r < rows; r++) {  minForDistance.add(new ArrayList<List<Integer>>(cols));   for (int c = 0; c < cols; c++) {   minForDistance.get(r).add(new ArrayList<Integer>(Collections.nCopies(mid+1, Integer.MAX_VALUE)));   minForDistance.get(r).get(c).set(0, 0);  }  }  for (int m = 1; m <= mid; m++) {  for (int r = 0; r < rows; r++) {   for (int c = 0; c < cols; c++) {   int minBoredom = minForDistance.get(r).get(c).get(m);    if (r > 0) {    if (minForDistance.get(r-1).get(c).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r-1).get(c).get(m-1) + verticalEdgeWeights.get(r-1).get(c);    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }    if (c > 0) {    if (minForDistance.get(r).get(c-1).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r).get(c-1).get(m-1) + horizontalEdgeWeights.get(r).get(c-1);    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }      if (r + 1 < rows) {    if (minForDistance.get(r+1).get(c).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r+1).get(c).get(m-1) + verticalEdgeWeights.get(r).get(c);    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }     if (c + 1 < cols) {    if (minForDistance.get(r).get(c+1).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r).get(c+1).get(m-1) + horizontalEdgeWeights.get(r).get(c);    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }    minForDistance.get(r).get(c).set(m, minBoredom);   }  }  }  List<List<Integer>> result = new ArrayList<List<Integer>>(rows);  for (int r = 0; r < rows; r++) {  result.add(new ArrayList<Integer>(cols));   for (int c = 0; c < cols; c++) {   result.get(r).add(minForDistance.get(r).get(c).get(mid) << 1);  }  }  return result; }  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;  } } }
1	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);  BPhoenixAndPuzzle solver = new BPhoenixAndPuzzle();  int testCount = Integer.parseInt(in.next());  for (int i = 1; i <= testCount; i++)  solver.solve(i, in, out);  out.close(); }  static class BPhoenixAndPuzzle {  public static MyScanner sc;  public static PrintWriter out;  public void solve(int testNumber, MyScanner sc, PrintWriter out) {  BPhoenixAndPuzzle.sc = sc;  BPhoenixAndPuzzle.out = out;  long n = sc.nextLong();  boolean can = true;  if (n % 2 != 0) can = false;  n /= 2;  while (n > 1 && n % 2 == 0) n /= 2;  long sq = Math.round(Math.pow(n, 0.5));  if (sq * sq != n) can = false;   out.println(can ? "YES" : "NO");  }  }  static class MyScanner {  private BufferedReader br;  private StringTokenizer tokenizer;  public MyScanner(InputStream is) {  br = new BufferedReader(new InputStreamReader(is));  }  public String next() {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {   try {   tokenizer = new StringTokenizer(br.readLine());   } catch (IOException e) {   throw new RuntimeException(e);   }  }  return tokenizer.nextToken();  }  public long nextLong() {  return Long.parseLong(next());  }  } }
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();   }  }  }
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 {   long mod = (long) 1e9 + 7;   public void solve(int testNumber, InputReader in, PrintWriter out) {    long x = in.nextLong();    long k = in.nextLong();    if (x == 0) {     out.print(0);     return;    }    long n = pow(2, k);    long l = (n * ((x % mod)) % mod);    l = l % mod;    long ans = 2 * l - n + 1;    ans = ans % mod;    if (ans < 0)     ans += mod;    out.print(ans);   }   long pow(long a, long val) {    if (val == 0) {     return 1;    }    if (val % 2 == 0) {     long ans = pow(a, val / 2);     return (ans * ans) % mod;    }    return ((a % mod) * (pow(a, val - 1))) % mod;   }  }  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 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 B {  public static void main(String[] args) {   FastScanner in = new FastScanner();   PrintWriter out = new PrintWriter(System.out);   int t = in.nextInt(), tt = 0;   while(t-->0) {    int n = in.nextInt();   if(n%2!=0) out.println("NO");   else{    n/=2;    if(Math.sqrt(n)==Math.ceil(Math.sqrt(n))) out.println("YES");    else{    if(n%2!=0) out.println("NO");    else{     n/=2;     if(Math.sqrt(n)==Math.ceil(Math.sqrt(n))) out.println("YES");     else out.println("NO");    }    }   }     }   out.flush(); }  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) {}  return st.nextToken();  }   String nextLine(){  try{ return br.readLine(); }   catch(IOException e) { } return "";  }   int nextInt() {  return Integer.parseInt(next());  }   long nextLong() {  return Long.parseLong(next());  }   int[] readArray(int n) {  int a[] = new int[n];  for(int i=0;i<n;i++) a[i] = nextInt();  return a;  } }  static final Random random = new Random();  static void ruffleSort(int[] a){  int n = a.length;  for(int i=0;i<n;i++){  int j = random.nextInt(n), temp = a[j];  a[j] = a[i]; a[i] = temp;  }  Arrays.sort(a);  } }
4	public class FireAgain {  public static void main(String[] args) throws IOException {  BufferedReader readData = new BufferedReader(new FileReader("input.txt"));  PrintWriter writer = new PrintWriter(new File("output.txt"));  String line = readData.readLine();  String[] temp = line.split(" ");  int n = Integer.valueOf(temp[0]);  int m = Integer.valueOf(temp[1]);  int x = 0, y = 0;  line = readData.readLine();  int k = Integer.valueOf(line);  boolean[][] visited = new boolean[n + 1][m + 1];  Queue<Integer> qX = new LinkedList<Integer>();  Queue<Integer> qY = new LinkedList<Integer>();  line = readData.readLine();  String[] temp2 = line.split(" ");  for (int i = 0; i < temp2.length - 1; i+=2) {  x = Integer.valueOf(temp2[i]);  y = Integer.valueOf(temp2[i + 1]);  visited[x][y] = true;  qX.add(x);  qY.add(y);  }  while (!qX.isEmpty()) {  x = qX.poll();  y = qY.poll();  if (x >= 2 && !visited[x - 1][y]) {   visited[x - 1][y] = true;   qX.add(x - 1);   qY.add(y);  }  if (x + 1 <= n && !visited[x + 1][y]) {   visited[x + 1][y] = true;   qX.add(x + 1);   qY.add(y);  }  if (y >= 2 && !visited[x][y - 1]) {   visited[x][y - 1] = true;   qX.add(x);   qY.add(y - 1);  }  if (y + 1 <= m && !visited[x][y + 1]) {   visited[x][y + 1] = true;   qX.add(x);   qY.add(y + 1);  }  }  writer.write(x + " ");  writer.write(y + " ");  writer.close(); } }
6	public class Main { public static void main(String args[]) {new Main().run();}  FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){  int q=in.nextInt();  for(int i=0;i<q;i++) {  out.println(work());  }  out.flush(); } long mod=1000000007; long gcd(long a,long b) {  return b==0?a:gcd(b,a%b); } int id[]; long work() {  int n=in.nextInt();  int m=in.nextInt();  long ret=0;  PriorityQueue<int[]> pq=new PriorityQueue<>(new Comparator<int[]>() {  public int compare(int[] arr1,int[] arr2) {   return arr1[2]-arr2[2];  }  });  long sum=0;  for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   int v=in.nextInt();   pq.add(new int[] {i,j,v});   sum+=v;   if(pq.size()>6)pq.poll();  }  }  if(m==1)return sum;  if(n<=3) {  while(pq.size()>0) {   int[] p=pq.poll();   if(pq.size()<n) {   ret+=p[2];   }  }  return ret;  }  int[][] A=new int[6][];  for(int i=0;pq.size()>0;i++) {  A[i]=pq.poll();  }   for(int i=0;i<6;i++) {  for(int j=i+1;j<6;j++) {   for(int k=j+1;k<6;k++) {   out:   for(int p=k+1;p<6;p++) {    int s=A[i][2]+A[j][2]+A[k][2]+A[p][2];    HashMap<Integer,ArrayList<Integer>> map=new HashMap<>();    if(map.get(A[i][1])==null) {    map.put(A[i][1],new ArrayList<>());    }    if(map.get(A[j][1])==null) {    map.put(A[j][1],new ArrayList<>());    }    if(map.get(A[k][1])==null) {    map.put(A[k][1],new ArrayList<>());    }    if(map.get(A[p][1])==null) {    map.put(A[p][1],new ArrayList<>());    }    map.get(A[i][1]).add(A[i][0]);    map.get(A[j][1]).add(A[j][0]);    map.get(A[k][1]).add(A[k][0]);    map.get(A[p][1]).add(A[p][0]);    if(map.size()!=2) {    ret=Math.max(ret, s);    continue;    }    Integer l1=null,l2=null,r1=null,r2=null;    for(int key:map.keySet()) {    ArrayList<Integer> list=map.get(key);    if(map.get(key).size()!=2) {     ret=Math.max(ret, s);     continue out;    }    if(l1==null) {     l1=list.get(0);     l2=list.get(1);    }else {     r1=list.get(0);     r2=list.get(1);    }    }    if((Math.abs(l1-l2)==2&&Math.abs(r1-r2)==2)||(Math.abs(l1-l2)!=2&&Math.abs(r1-r2)!=2)) {    ret=Math.max(ret, s);    }   }   }  }  }   return ret; } }  class FastReader { BufferedReader br; StringTokenizer st;  public FastReader() {  br=new BufferedReader(new InputStreamReader(System.in)); }  public String next()  {  if(st==null || !st.hasMoreElements())  {  try {   st = new StringTokenizer(br.readLine());  } catch (IOException e) {   e.printStackTrace();  }  }  return st.nextToken(); }  public int nextInt()  {  return Integer.parseInt(next()); }  public long nextLong() {  return Long.parseLong(next()); } }
2	public class NitsLocal {  static ArrayList<String> s1;  static boolean[] prime;  static int n = (int)1e7;  static void sieve() { Arrays.fill(prime , true); prime[0] = prime[1] = false; for(int i = 2 ; i * i <= n ; ++i) { if(prime[i]) { for(int k = i * i; k<= n ; k+=i) { prime[k] = false; } } } }  public static void main(String[] args) {   InputReader sc = new InputReader(System.in);      prime = new boolean[n + 1]; sieve();     prime[1] = false;          long n = sc.nl();    long k = sc.nl();    long b = 2*n + 3;    long c = n*n - 2*k + n;    long q1 = (b + (long)Math.sqrt(b*b - 4*c))/2;    long q2 = (b - (long)Math.sqrt(b*b - 4*c))/2;    if(q1 >= q2 && q1 <= n)     w.println(q1);    else     w.println(q2);                   w.close();    }  static int nextPowerOf2(int n)  {   int count = 0;            if (n > 0 && (n & (n - 1)) == 0)    return n;    while(n != 0)   {    n >>= 1;    count += 1;   }    return 1 << count;  }    static long sum1(int t1,int t2,int x,int []t)  {   int mid = (t2-t1+1)/2; if(t1==t2)  return 0;   else  return sum1(t1,mid-1,x,t) + sum1(mid,t2,x,t);     }    static String replace(String s,int a,int n)  {   char []c = s.toCharArray();   for(int i=1;i<n;i+=2)   {    int num = (int) (c[i] - 48);    num += a;    num%=10;    c[i] = (char) (num+48);   }   return new String(c);  }  static String move(String s,int h,int n)  {   h%=n;   char []c = s.toCharArray();   char []temp = new char[n];   for(int i=0;i<n;i++)   {    temp[(i+h)%n] = c[i];   }   return new String(temp);  }    public static int ip(String s){ return Integer.parseInt(s); }  static class multipliers implements Comparator<Long>{     public int compare(Long a,Long b) {  if(a<b)  return 1;  else if(b<a)  return -1;  else  return 0; } }  static class multipliers1 implements Comparator<Student>{  public int compare(Student a,Student b) {  if(a.y<b.y)  return 1;  else if(b.y<a.y)  return -1;  else  {   if(a.id < b.id)    return 1;   else if(b.id<a.id)    return -1;   else    return 0;       } } }         static 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 ni() { 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 nl() { 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[] nia(int n) { int a[] = new int[n]; for (int i = 0; i < n; i++) { a[i] = ni(); } return a; }  public String rs() { 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; }  }     static PrintWriter w = new PrintWriter(System.out);     static class Student  {   int id;        int y;        Student(int id,int y)   {    this.id = id;           this.y = y;                 }    } }
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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    int[] cnt = new int[10];    Arrays.fill(cnt, 0);    List<String> a = new ArrayList<>();    for (int i = 0; i < n; i++) {     a.add(in.readLine());    }    List<String> b = new ArrayList<>();    for (int i = 0; i < n; i++) {     String temp = in.readLine();     if (a.contains(temp)) {      a.remove(temp);     } else      b.add(temp);    }    int[] cnta = new int[10];    for (int i = 0; i < a.size(); i++) {     cnta[a.get(i).length()]++;    }    int[] cntb = new int[10];    Arrays.fill(cnta, 0);    Arrays.fill(cntb, 0);    for (int i = 0; i < b.size(); i++) {     cntb[a.get(i).length()]++;    }    int ans = 0;    for (int i = 0; i < 10; i++) {     ans += Math.abs(cnta[i] - cntb[i]);    }    out.println(ans);   }  }  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;   }   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 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 close() {    writer.close();   }   public void println(int i) {    writer.println(i);   }  } }
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();  } }
2	public class Main {  public static void main(String[] args) {  Scanner s=new Scanner(System.in);   double n=s.nextLong();  double k=s.nextLong();   double num=(-3+Math.sqrt(9+8*(n+k)))/2;   System.out.println((long)(n-num));   }  }
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();  } }
0	public class Solution implements Runnable {  public long gcd(long a, long b) {  long tmp;  while (b > 0) {  a %= b;  tmp = a;  a = b;  b = tmp;  }  return a; }  public void solve() throws Exception {  long a = sc.nextLong();  long b = sc.nextLong();  long ans = 0;  long k = 0;  if (a == 1 || b == 1) {  out.println(max(a, b));  return;  }  while (a > 1 && b > 1) {  if (a > b) {   k = a / b;   ans += k;   a -= (k * b);    } else {   k = b / a;   ans += k;   b -= (k * a);  }  k = gcd(a, b);  a /= k;  b /= k;  }  if (a == 1)  ans += b;  else  ans += a;  out.println(ans); }  static Throwable throwable;  BufferedReader in; PrintWriter out; FastScanner sc;  public static void main(String[] args) throws Throwable {  Thread thread = new Thread(null, new Solution(), "", (1 << 26));  thread.start();  thread.join();  if (throwable != null) {  throw throwable;  } }  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  sc = new FastScanner(in);  solve();  } catch (Throwable throwable) {  this.throwable = throwable;   } finally {  out.close();  }  } } class FastScanner { BufferedReader reader; StringTokenizer strTok;  public FastScanner(BufferedReader reader) {  this.reader = reader; }  public String nextToken() throws Exception {  while (strTok == null || !strTok.hasMoreTokens()) {  strTok = new StringTokenizer(reader.readLine());  }  return strTok.nextToken(); }  public int nextInt() throws Exception {  return Integer.parseInt(nextToken()); }  public long nextLong() throws Exception {  return Long.parseLong(nextToken()); }  public double nextDouble() throws Exception {  return Double.parseDouble(nextToken()); } }
4	public class P023A {  public static void main(String[] args)  {   Scanner in = new Scanner(System.in);   String line = in.next();     HashSet<String> hash = new HashSet<String>();     int ans = 0;   for (int len = line.length()-1; len > 0; --len)   {    for (int i = 0; i + len <= line.length(); ++i)    {     String sub = line.substring(i, i+len);     if (hash.contains(sub))     {      ans = Math.max(ans, sub.length());     }         hash.add(sub);    }   }     System.out.println(ans);  } }
6	public class MaeDosDragoes { public static PrintWriter saida = new PrintWriter(System.out, false); public static class Escanear {   BufferedReader reader;   StringTokenizer tokenizer;  public Escanear() {    this(new InputStreamReader(System.in));   }  public Escanear(Reader in) {    reader = new BufferedReader(in);   }   String proximo() {    if (tokenizer == null || !tokenizer.hasMoreElements()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return tokenizer.nextToken();   }     int proximoNum() {    return Integer.parseInt(proximo());   }  }  public static void main(String[] args) {  Escanear escanear = new Escanear();  int proximoInt = escanear.proximoNum();   long[] aux = new long[proximoInt];   double proximoDouble = escanear.proximoNum();   for(Integer i = 0; i < proximoInt; i++) {    for(Integer j =0; j < proximoInt; j++) {     Integer val = escanear.proximoNum();     if (val.equals(1) || i.equals(j)) {   aux[i] |= 1L << j;   }    }   }   int esquerda = proximoInt/2;   int direita = proximoInt - esquerda;  int maiorMascara = 1 << esquerda;  int[] depois = new int[1 << esquerda];  Integer mascara = 1;  while (mascara < maiorMascara) {  int mascaraAtual = mascara;    for(int j = 0; j < esquerda; j++) {     if (((1 << j) & mascara) > 0) {      mascaraAtual &= aux[j + direita] >> direita;      depois[mascara] = Math.max(depois[mascara], depois[mascara ^ (1 << j)]);     }    }    if (mascara == mascaraAtual) {     depois[mascara] = Math.max(depois[mascara],Integer.bitCount(mascara));  }  mascara++;  }                                 int auxiliar = 0;   int mascaraMaxima = 1 << direita;   for(int masc = 0; masc < mascaraMaxima; masc++) {    int mascaraCorrente = masc;    int mascaraValor = maiorMascara -1;    for(int j = 0; j < direita; j++) {     if (((1 << j) & masc) > 0) {      mascaraCorrente &= (aux[j] & (mascaraMaxima-1));      mascaraValor &= aux[j] >> direita;     }    }    if (mascaraCorrente != masc) continue;    auxiliar = Math.max(auxiliar, Integer.bitCount(masc) + depois[mascaraValor]);   }   proximoDouble/=auxiliar;   saida.println(proximoDouble * proximoDouble * (auxiliar * (auxiliar-1))/2);   saida.flush();  } }
4	public class CodeForces {  public static void main(String[] args) throws FileNotFoundException {   FastIO io = new FastIO();   int width = io.nextInt();   int height = io.nextInt();   int initials = io.nextInt();   boolean[][] visited = new boolean[width][height];   Queue<Coordinate> q = new ArrayDeque<>();   for (int i = 0; i < initials; i++) {    q.add(new Coordinate(io.nextInt() - 1, io.nextInt() - 1));   }   Coordinate oneOfLast = null;   while (!q.isEmpty()) {    int len = q.size();    for (int times = 0; times < len; times++) {     Coordinate c = q.poll();     if (visited[c.x][c.y]) {      continue;     }     oneOfLast = c;     visited[c.x][c.y] = true;     int[][] deltas = new int[][]{       {-1, 0}, {0, -1}, {1, 0}, {0, 1}     };     for (int[] delta : deltas) {      int ci = c.y + delta[0];      int cj = c.x + delta[1];      if (ci >= 0 && cj >= 0 && ci < height && cj < width) {       q.add(new Coordinate(cj, ci));      }     }    }   }   io.println((oneOfLast.x + 1) + " " + (oneOfLast.y + 1));   io.close();  }  static class Coordinate {   int x;   int y;   public Coordinate(int x, int y) {    this.x = x;    this.y = y;   }  }  static class FastIO extends PrintWriter {   BufferedReader br;   StringTokenizer st;   public FastIO() throws FileNotFoundException {    super(new BufferedOutputStream(new FileOutputStream("output.txt")));    br = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));   }   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 nextToken() {    while (st == null || !st.hasMoreElements()) {     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 "";   }  } }
2	public class A992{  long mod = 1000000007L;  private void solve() throws Exception {  long x = nextLong();  long k = nextLong();  if(x == 0) {  out.println(0);  return;  }  x = x%mod;  long res = (((x*pow(2,k+1))%mod + (mod-pow(2,k))%mod)%mod+1)%mod;   out.println(res); }  long pow(long m, long n){  long res = 1;  while(n > 0){   if(n % 2 == 1)res = (res*m)%mod;   m = (m*m)%mod;   n = n/2;  }  return res; }   public static void main(String[] args) {  (new A992()).run(); }  private BufferedReader in; private PrintWriter out; private StringTokenizer tokenizer;  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  tokenizer = null;  out = new PrintWriter(System.out);  solve();  in.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  private int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  private long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  private float nextFloat() throws IOException {  return Float.parseFloat(nextToken()); }  private String nextLine() throws IOException {  return new String(in.readLine()); }  private String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  tokenizer = new StringTokenizer(in.readLine());  }  return tokenizer.nextToken(); }  }
4	public class Main { static final FastReader FR = new FastReader(); static final BufferedWriter BW = new BufferedWriter(new OutputStreamWriter(System.out));  public static void main(String[] args) throws IOException {  StringBuilder solution = new StringBuilder();  int rows = FR.nextInt();  int cols = FR.nextInt();  int moves = FR.nextInt();  Map<Integer, Integer> horizontalEdgeWeights = new HashMap<Integer, Integer>();  for (int r = 0; r < rows; r++) {  for (int c = 0; c < cols - 1; c++) {   int hash = getHash(r, c);   horizontalEdgeWeights.put(hash, FR.nextInt());  }  }  Map<Integer, Integer> verticalEdgeWeights = new HashMap<Integer, Integer>();  for (int r = 0; r < rows - 1; r++) {  for (int c = 0; c < cols; c++) {   int hash = getHash(r, c);   verticalEdgeWeights.put(hash, FR.nextInt());  }  }   List<List<Integer>> result = getResult(rows, cols, moves, horizontalEdgeWeights, verticalEdgeWeights);  for (int r = 0; r < rows; r++) {  for (int c = 0; c < cols; c++) {   int value = (result != null ? result.get(r).get(c) : -1);   solution.append(value + " ");  }  solution.append("\n");  }  BW.write(solution.toString());  BW.close(); }  static List<List<Integer>> getResult(int rows, int cols, int moves, Map<Integer, Integer> horizontalEdgeWeights, Map<Integer, Integer> verticalEdgeWeights) {  if ((moves & 1) == 1) {  return null;  }  int mid = moves >> 1;  List<List<List<Integer>>> minForDistance = new ArrayList<List<List<Integer>>>(rows);  for (int r = 0; r < rows; r++) {  minForDistance.add(new ArrayList<List<Integer>>(cols));   for (int c = 0; c < cols; c++) {   minForDistance.get(r).add(new ArrayList<Integer>(Collections.nCopies(mid+1, Integer.MAX_VALUE)));   minForDistance.get(r).get(c).set(0, 0);  }  }  for (int m = 1; m <= mid; m++) {  for (int r = 0; r < rows; r++) {   for (int c = 0; c < cols; c++) {   int minBoredom = minForDistance.get(r).get(c).get(m);   int hash = getHash(r, c);    if (r > 0) {    if (minForDistance.get(r-1).get(c).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r-1).get(c).get(m-1) + verticalEdgeWeights.get(getHash(r-1, c));    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }    if (c > 0) {    if (minForDistance.get(r).get(c-1).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r).get(c-1).get(m-1) + horizontalEdgeWeights.get(getHash(r, c-1));    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }      if (r + 1 < rows) {    if (minForDistance.get(r+1).get(c).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r+1).get(c).get(m-1) + verticalEdgeWeights.get(hash);    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }     if (c + 1 < cols) {    if (minForDistance.get(r).get(c+1).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r).get(c+1).get(m-1) + horizontalEdgeWeights.get(hash);    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }    minForDistance.get(r).get(c).set(m, minBoredom);   }  }  }  List<List<Integer>> result = new ArrayList<List<Integer>>(rows);  for (int r = 0; r < rows; r++) {  result.add(new ArrayList<Integer>(cols));   for (int c = 0; c < cols; c++) {   result.get(r).add(minForDistance.get(r).get(c).get(mid) << 1);  }  }  return result; }  static int getHash(int row, int col) {  return (row * 1000 + col); } static int getRow(int hash) {  return hash / 1000; } static int getCol(int hash) {  return hash % 1000; }  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;  } } }
6	public class Main{  static long dp[][][][]=new long [16][16][16][4];  static void ini() {  for(int i=0;i<16;i++) {   for(int j=0;j<16;j++) {   for(int k=0;k<16;k++) {    for(int l=0;l<4;l++) {    dp[i][j][k][l]=-1L;    }   }   }  }  }  static int chk(long i) {  if(i==0L)   return 1;  else   return 0;  }  static long f(long a,long b,long c,int taken) {  int got=(int) (a+b+c);  int have=chk(a)+chk(b)+chk(c);  if(have==2) {  if(got==1)   return 1L;  else   return 0L;  }  if(dp[(int) a][(int) b][(int) c][taken]!=-1) {  return dp[(int) a][(int) b][(int) c][taken];  }  long ans=0L;  if(taken == 0) {   if(a!=0)   ans+=(a*f(a-1,b,c,1))%mod; ans%=mod;   if(b!=0)   ans+=(b*f(a,b-1,c,2))%mod; ans%=mod;   if(c!=0)   ans+=(c*f(a,b,c-1,3))%mod; ans%=mod;  }  else {   ans+=((taken==1 || a==0)?0L:(a*f(a-1,b,c,1))%mod)%mod; ans%=mod;   ans+=((taken==2 || b==0)?0L:(b*f(a,b-1,c,2))%mod)%mod; ans%=mod;   ans+=((taken==3 || c==0)?0L:(c*f(a,b,c-1,3))%mod)%mod; ans%=mod;  }  dp[(int) a][(int) b][(int) c][taken]=ans;  return ans;  } public static void main(String[] args)  {   InputReader in=new InputReader(System.in);   PrintWriter pw = new PrintWriter(System.out);   int n=in.nextInt();   int total=in.nextInt();   int t[]=new int[n];   int g[]=new int[n];   for(int i=0;i<n;i++) {   t[i]=in.nextInt();   g[i]=in.nextInt();   }   long ans=0L;   for(int i=0;i<(1<<n);i++) {   int sum=0;   int a[]=new int[4];   for(int j=0;j<n;j++) {       if(((i>>j)&1)==1) {    sum+=t[j];    a[g[j]]++;    }   }   if(sum==total) {    ini();    ans=(ans+f(a[1],a[2],a[3],0))%mod;   }   }   pw.println(ans);   pw.flush();   pw.close();        }   private 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;   }   static class tri implements Comparable<tri> {    int p, c, l;     tri(int p, int c, int l) {     this.p = p;     this.c = c;     this.l = l;    }     public int compareTo(tri o) {     return Integer.compare(l, o.l);    }   }    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 static int[] suffle(int[] a,Random gen)   {    int n = a.length;    for(int i=0;i<n;i++)    {     int ind = gen.nextInt(n-i)+i;     int 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 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);   }     public static long GCD(long a,long b)   {    if(b==0)     return a;    else     return GCD(b,a%b);   }     public static void extendedEuclid(int A,int B)   {    if(B==0)    {     d = A;     p = 1 ;     q = 0;    }    else    {     extendedEuclid(B, A%B);     int temp = p;     p = q;     q = temp - (A/B)*q;    }   }     public static long LCM(long a,long b)   {    return (a*b)/GCD(a,b);   }     public static int LCM(int a,int b)   {    return (a*b)/GCD(a,b);   }     public static int binaryExponentiation(int x,int n)   {    int result=1;    while(n>0)    {     if(n % 2 ==1)      result=result * x;     x=x*x;     n=n/2;    }    return result;   }     public static long binaryExponentiation(long x,long n)   {    long result=1;    while(n>0)    {     if(n % 2 ==1)      result=result * x;     x=x*x;     n=n/2;    }    return result;   }     public static int modularExponentiation(int x,int n,int M)   {    int result=1;    while(n>0)    {     if(n % 2 ==1)      result=(result * x)%M;     x=(x%M*x)%M;     n=n/2;    }    return result;   }     public static long modularExponentiation(long x,long n,long M)   {    long result=1;    while(n>0)    {     if(n % 2 ==1)      result=(result%M * x%M)%M;     x=(x%M * x%M)%M;     n=n/2;    }    return result;   }     public static long modInverse(int A,int M)   {    return modularExponentiation(A,M-2,M);   }     public static long modInverse(long A,long M)   {    return modularExponentiation(A,M-2,M);   }     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 long[] shuffle(long[] a, Random gen){     for(int i = 0, n = a.length;i < n;i++){      int ind = gen.nextInt(n-i)+i;      long d = a[i];      a[i] = a[ind];      a[ind] = d;     }     return a;    }   static class pair implements Comparable<pair>{    Long x;    Long y;    Integer z;    pair(long l,long y2,int z){     this.x=l;     this.y=y2;     this.z=z;    }    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);    }   }      }
4	public class Solution {  private BufferedReader in; private PrintWriter out; private StringTokenizer st;  void solve() throws IOException {  String s = next();  HashSet<String> set = new HashSet<String>();  int ans = 0;  for (int i = 0; i < s.length(); ++i) {  for (int j = i + 1; j <= s.length(); ++j) {   String t = s.substring(i, j);   if (set.contains(t)) {   ans = Math.max(ans, t.length());   }   set.add(t);  }  }  out.println(ans); }  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 A {  int INF = 1 << 28;  void run() {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int a = sc.nextInt();   int b = sc.nextInt();   long[] chores = new long[n];   for(int i=0;i<n;i++) chores[i] = sc.nextLong();   sort(chores);   System.out.println(chores[b]-chores[b-1]);  }  public static void main(String[] args) {   new A().run();  } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   private final int MOD = (int) (1e9 + 7);   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.nextInt();    String[] arr = new String[n];    for (int i = 0; i < n; i++) {     arr[i] = in.nextString();    }    int[] dp = new int[n];    Arrays.parallelSetAll(dp, i -> 0);    dp[0] = 1;    int cnt = 0;    for (int i = 0; i < n; i++) {     if (arr[i].equals("f")) {      cnt++;      continue;     }     calc(dp, n, cnt);     cnt = 0;    }    int sum = 0;    for (int i = 0; i < n; i++) {     sum += dp[i];     sum %= MOD;    }    out.println(sum);   }   private void calc(int[] dp, int n, int cnt) {    for (int i = n - 1; i >= 0; i--) {     if (i != n - 1) dp[i] += dp[i + 1];     dp[i] %= MOD;    }       int prev = dp[0];    for (int i = 0, y = 0; i < MathUtil.gcdInt(n, cnt); i++) {         y = i;     prev = dp[i];     do {      int nextId = (y + cnt) % n;      int tmp = dp[nextId];      dp[nextId] = prev;      prev = tmp;      y = nextId;     } while (y != i);    }      }  }  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());   }  }  static class MathUtil {   public static int gcdInt(int a, int b) {    if (b == 0) return a;    return gcdInt(b, a % b);   }  } }
2	public class NastyaWardrobe {  static long modulo = 1000000007;  static long ans = 0;  public static void main(String[] args) throws IOException {   BufferedReader inp = new BufferedReader(new InputStreamReader(System.in));   String[] s1 = inp.readLine().split(" ");   long clothes = Long.parseLong(s1[0]);   long months = Long.parseLong(s1[1]);      calc(clothes,months);   System.out.print(ans);  }  static void calc(long clothes,long months){   if(clothes!=0) {    long a;    long count = 0;    ArrayList<Long> list = new ArrayList<>();    if (months >= 2) {     a = 2;     long c = months;     while (c > 1) {      if (c % 2 == 1) {       count++;       list.add(a);      }      c = c / 2;      a = (a * a) % modulo;     }     while (count > 0) {      long b = list.get(0);      list.remove(0);      a = (a * b) % modulo;      count--;     }    } else {     a = (long) Math.pow(2, months);    }     long b = clothes;        b = (2 * b - 1) % modulo;    ans = (a * b) % modulo;    ans = (ans + 1) % modulo;   }else{    ans = 0;   }  } }
1	public class Main {  public static void main(String []args)throws Exception  {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   int n=0;   n=Integer.parseInt(br.readLine());   String inp="";   inp=br.readLine();   int no[]=new int[n];   String tinp[]=inp.split(" ");   for(int i=0;i<n;i++)   {    no[i]=Integer.parseInt(tinp[i]);   }   int eve=0,odd=0;   for(int i=0;i<3;i++)   {    int rem=no[i]%2;    if(rem==0)     eve++;    else     odd++;   }     if(eve>1)     {      for(int i=0;i<n;i++)      {       if(no[i]%2==1)       {        System.out.println(i+1);        break;       }      }     }     else     {      for(int i=0;i<n;i++)      {       if(no[i]%2==0)       {        System.out.println(i+1);        break;       }      }        }      } }
0	public class first { int max(int a1,int a2,int a3) {  int max=a1;  if(a2>=max)  max=a2;  if(a3>=max)  max = a3;  return max;  }  public static void main(String[] args) {  int num=0;   Scanner sc = new Scanner(System.in);  num = sc.nextInt();  int num2 = num/10;  int num3 = num%10;  int num4 = (num2/10)*10+num3;  first fs = new first();  int result = fs.max(num,num2,num4);  System.out.println(result); } }
4	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; }  private List<Integer> kmp(String x, String a) {  String s = a + "$" + x;  int[] oppa = new int[s.length()];  oppa[0] = 0;  int tmp = 0;  List<Integer> res = new ArrayList<Integer>();  for (int i = 1; i < s.length(); i++) {  while (tmp != 0 && s.charAt(tmp) != s.charAt(i)) {     tmp = oppa[tmp - 1];  }  if (s.charAt(tmp) == s.charAt(i))   tmp++;  oppa[i] = tmp;  if (tmp == a.length()) {   res.add(i - a.length() - a.length());  }  }  return res; }  double nextDouble(StreamTokenizer st) throws IOException {  st.nextToken();  return st.nval; }  String nextLine(StreamTokenizer st) throws IOException {  st.nextToken();  return st.sval; }  int cnt = 0; int[] col;  void unite(int a, int b) {  if (cnt % 2 == 0)  col[getCol(a)] = getCol(b);  else  col[getCol(b)] = getCol(a);  cnt++; }  int getCol(int a) {  return a == col[a] ? a : (col[a] = getCol(col[a])); }  public void run1() throws IOException {  Scanner sc = new Scanner(new InputStreamReader(System.in));      String s= sc.next();  int res = 0;  int n = s.length();  for(int i = 0; i < n; i++)  for(int j = i + 1; j < n; j++) {   int k = 0;   while(j + k < n && s.charAt(i + k) == s.charAt(j + k))   k++;   res = Math.max(res, k);  }  System.out.println(res); } }
4	public class C35C_BFS_Fire {  public static boolean[][] burning;  public static LinkedList<int[]> LitTrees;  public static int N, M;  public static int[] lastTree;  public static void main(String[] args) throws IOException {        BufferedReader input = new BufferedReader(new FileReader("input.txt"));  PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));   StringTokenizer dataR = new StringTokenizer(input.readLine());   N = Integer.parseInt(dataR.nextToken());   M = Integer.parseInt(dataR.nextToken());   burning = new boolean[N+1][M+1];   StringTokenizer dataR1 = new StringTokenizer(input.readLine());   int K = Integer.parseInt(dataR1.nextToken());   StringTokenizer dataR2 = new StringTokenizer(input.readLine());   LitTrees = new LinkedList<int[]>();   for (int j = 0; j < K; j++){    int x = Integer.parseInt(dataR2.nextToken());    int y = Integer.parseInt(dataR2.nextToken());    int[] coord = {x, y};    LitTrees.add(coord);    burning[x][y] = true;   }   spread();   out.println(lastTree[0] + " " + lastTree[1]);   out.close();  }  public static void spread(){   while(!LitTrees.isEmpty()){    int[] studying = LitTrees.remove();    LinkedList<int[]> ll = new LinkedList<int[]>();    if(studying[0]-1 >= 1) ll.add(new int[]{studying[0]-1, studying[1]});    if(studying[1]-1 >= 1) ll.add(new int[]{studying[0], studying[1]-1});    if(studying[1]+1 < M+1) ll.add(new int[]{studying[0], studying[1]+1});    if(studying[0]+1 < N+1) ll.add(new int[]{studying[0]+1, studying[1]});    while(!ll.isEmpty()) {     int[] focus = ll.remove();     if(!burning[focus[0]][focus[1]]) {      LitTrees.add(focus);      burning[focus[0]][focus[1]] = true;     }    }    lastTree = studying;   }    }  }
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 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();  } }
4	public class Main { static int n, m, k; static int inf = (int) 1e9; static class Pair {  int x, y;  Pair(int a, int b) {  x = a; y = b;  } } static int[] dx = {1, -1, 0, 0}, dy = {0, 0, 1, -1}; static boolean valid(int x, int y) {  return x >= 0 && x < n && y >= 0 && y < m; } static int[][] bfs(int[] xs, int[] ys) {  int[][] dist = new int[n][m];  for(int i = 0; i < n; i++)  Arrays.fill(dist[i], inf);  Queue<Pair> q = new LinkedList<>();  for(int i = 0; i < k; i++) {  dist[xs[i]][ys[i]] = 0;  q.add(new Pair(xs[i], ys[i]));  }  while(!q.isEmpty()) {  Pair p = q.remove();  for(int d = 0; d < 4; d++) {   int nx = p.x + dx[d], ny = p.y + dy[d];   if(valid(nx, ny) && dist[nx][ny] == inf) {   dist[nx][ny] = dist[p.x][p.y] + 1;   q.add(new Pair(nx, ny));   }  }  }  return dist; }  public static void main(String[] args) throws IOException {  Scanner in = new Scanner();  int n = in.nextInt() ;  int m = in.nextInt();  int k = in.nextInt();  int x[] = new int[k] ;  int y[] = new int[k] ;  int trees [][] = new int [n][m] ;   for (int i = 0; i < n; i++)  for (int j = 0; j < m; j++)   trees[i][j]=Integer.MAX_VALUE ;  for (int i = 0; i < k; i++)  {  x[i]=in.nextInt()-1;   y[i]=in.nextInt()-1;  trees[x[i]][y[i]]=0 ;  }  int dis = Integer.MIN_VALUE ; ;  int xp=0; ;  int yp=0;  for (int i = 0; i < n; i++)  for (int j = 0; j < m; j++)   if(trees[i][j] != 0)   for (int j2 = 0; j2 < k; j2++)    trees[i][j]=Math.min(trees[i][j], Math.abs(i-x[j2])+Math.abs(j-y[j2]));  for (int i = 0; i <n; i++)  for (int j = 0; j < m; j++)   if(trees[i][j] > dis)   {   dis=trees[i][j];   xp=i+1;   yp=j+1;   }  PrintWriter out = new PrintWriter("output.txt");  out.printf("%d %d\n", xp ,yp);  out.close(); }  static class Scanner {  BufferedReader br;  StringTokenizer st;  Scanner() throws FileNotFoundException {  br = new BufferedReader(new FileReader("input.txt"));  }  String next() throws IOException {  while(st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  int nextInt() throws IOException {  return Integer.parseInt(next());  } } }
3	public class Main {    public static void main(String[] args) throws Exception{   FastReader sc=new FastReader();   OutputStream outputStream = System.out;   PrintWriter out = new PrintWriter(outputStream);   int n=sc.nextInt();   int[] font=new int[n];   int[] cost=new int[n];   for(int i=0;i<n;i++) {    font[i]=sc.nextInt();     }   for(int i=0;i<n;i++) {    cost[i]=sc.nextInt();   }   int[] dou= new int[n];   for(int i=0;i<n;i++) {    int min=Integer.MAX_VALUE;    for(int j=0;j<i;j++) {     if(font[j]<font[i]) {      if(min>cost[i]+cost[j]) {       min=cost[i]+cost[j];      }     }    }    dou[i]=min;   }   int ans=Integer.MAX_VALUE;   for(int i=0;i<n;i++) {    int min=Integer.MAX_VALUE;    for(int j=0;j<i;j++) {     if(dou[j]!=Integer.MAX_VALUE && font[j]<font[i]) {      if(min>dou[j]+cost[i]) {       min=dou[j]+cost[i];      }     }    }    if(min<ans) {     ans=min;    }   }   if(ans==Integer.MAX_VALUE) {    System.out.println(-1);   }   else {    System.out.println(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;  } }
2	public class Main2 {  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();   }  }   public static void main(String[] args) throws IOException  {   Reader z = new Reader();   long n=z.nextLong(), k=z.nextLong(), x;   x=9L+8L*(k+n);   x=(long) Math.sqrt(x);   x=(x-3)/2;   System.out.println(n-x);  } }
2	public class R489C { static long MOD=(long)1e9+7; public static void main(String[] args) {  Scanner scan=new Scanner(System.in);  long n=scan.nextLong(), k=scan.nextLong();  if(n==0) {  System.out.println(0);  return;  }  long x=2*n-1;  long e=exp(2,k);  System.out.println((x%MOD*e%MOD+1)%MOD); } public static long exp(long x, long e) {  long res=1;    while (e>0) {  if(e%2==1) res=(res*x)%MOD;    e/=2;  x=(x*x)%MOD;  }  return res; } }
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();  } }
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(); }  }
4	public class Main{ static int[][][]memo; static int inf=(int)1e9; static int n,m,down[][],right[][]; static int dp(int i,int j,int k) {  if(k<=0)return 0;  if(memo[i][j][k]!=-1)return memo[i][j][k];  int ans=inf;  if(i+1<n) {  ans=Math.min(ans, down[i][j]+dp(i+1, j, k-1));  }  if(i-1>=0) {  ans=Math.min(ans, down[i-1][j]+dp(i-1, j, k-1));  }  if(j+1<m) {  ans=Math.min(ans, right[i][j]+dp(i, j+1, k-1));  }  if(j-1>=0) {  ans=Math.min(ans, right[i][j-1]+dp(i, j-1, k-1));  }  return memo[i][j][k]=ans; } static void main() throws Exception{  n=sc.nextInt();m=sc.nextInt();int k=sc.nextInt();  if((k&1)==1) {  for(int i=0;i<n;i++) {   for(int j=0;j<m;j++) {   pw.print((-1)+" ");   }   pw.println();  }  return;  }  k>>=1;  right=new int[n][];  down=new int[n-1][];  for(int i=0;i<n;i++) {  right[i]=sc.intArr(m-1);  }  for(int i=0;i<n-1;i++) {  down[i]=sc.intArr(m);  }  memo = new int[n][m][k+1];  int inf=(int)1e9;  for(int i=0;i<=k;i++) {  for(int j=0;j<n;j++) {   for(int o=0;o<m;o++) {   memo[j][o][i]=-1;   }  }  }   for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   pw.print((dp(i, j, k)<<1)+" ");  }  pw.println();  }  }  public static void main(String[] args) throws Exception{  sc=new MScanner(System.in);  pw = new PrintWriter(System.out);   int tc=1;   for(int i=1;i<=tc;i++) {    main();   }   pw.flush();  }  static PrintWriter pw;  static MScanner sc;  static class MScanner {   StringTokenizer st;   BufferedReader br;   public MScanner(InputStream system) {    br = new BufferedReader(new InputStreamReader(system));   }     public MScanner(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 int[] intArr(int n) throws IOException {    int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();    return in;   }   public long[] longArr(int n) throws IOException {    long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();    return in;   }   public int[] intSortedArr(int n) throws IOException {    int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();    shuffle(in);    Arrays.sort(in);    return in;   }   public long[] longSortedArr(int n) throws IOException {    long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();    shuffle(in);    Arrays.sort(in);    return in;   }   public Integer[] IntegerArr(int n) throws IOException {    Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();    return in;   }   public Long[] LongArr(int n) throws IOException {    Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();    return in;   }   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);   }    }  static void sort(int[]in) {  shuffle(in);   Arrays.sort(in);  }  static void sort(long[]in) {  shuffle(in);   Arrays.sort(in);  }  static void shuffle(int[]in) {   for(int i=0;i<in.length;i++) {    int idx=(int)(Math.random()*in.length);    int tmp=in[i];    in[i]=in[idx];    in[idx]=tmp;   }  }  static void shuffle(long[]in) {   for(int i=0;i<in.length;i++) {    int idx=(int)(Math.random()*in.length);    long tmp=in[i];    in[i]=in[idx];    in[idx]=tmp;   }  } }
4	public class _1517_D {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(System.out);   StringTokenizer line = new StringTokenizer(in.readLine());   int n = Integer.parseInt(line.nextToken());   int m = Integer.parseInt(line.nextToken());   int k = Integer.parseInt(line.nextToken());   int[][] edges1 = new int[n][m - 1];   int[][] edges2 = new int[n - 1][m];   for(int i = 0; i < n; i++) {    line = new StringTokenizer(in.readLine());    for(int j = 0; j < m - 1; j++) {     edges1[i][j] = Integer.parseInt(line.nextToken());    }   }   for(int i = 0; i < n - 1; i++) {    line = new StringTokenizer(in.readLine());    for(int j = 0; j < m; j++) {     edges2[i][j] = Integer.parseInt(line.nextToken());    }   }   if(k % 2 == 1) {    for(int i = 0; i < n; i++) {     StringBuilder sb = new StringBuilder();     for (int j = 0; j < m; j++) {      sb.append(-1);      if(j < m - 1) sb.append(' ');     }     out.println(sb.toString());    }   }else {    int[][][] dp = new int[n][m][k + 1];    for(int i = 0; i < n; i++) {     for(int j = 0; j < m; j++) {      Arrays.fill(dp[i][j], Integer.MAX_VALUE);      dp[i][j][0] = 0;     }    }    for(int a = 2; a <= k; a += 2) {     for(int i = 0; i < n; i++) {      for(int j = 0; j < m; j++) {       if(i > 0) {        dp[i][j][a] = Math.min(dp[i][j][a], dp[i - 1][j][a - 2] + 2 * edges2[i - 1][j]);       }       if(i < n - 1) {        dp[i][j][a] = Math.min(dp[i][j][a], dp[i + 1][j][a - 2] + 2 * edges2[i][j]);       }       if(j > 0) {        dp[i][j][a] = Math.min(dp[i][j][a], dp[i][j - 1][a - 2] + 2 * edges1[i][j - 1]);       }       if(j < m - 1) {        dp[i][j][a] = Math.min(dp[i][j][a], dp[i][j + 1][a - 2] + 2 * edges1[i][j]);       }      }     }    }    for(int i = 0; i < n; i++) {     StringBuilder sb = new StringBuilder();     for(int j = 0; j < m; j++) {      sb.append(dp[i][j][k]);      if(j < m - 1) sb.append(' ');     }     out.println(sb.toString());    }   }   in.close();   out.close();  } }
0	public class A912 {  public static void main(String[] args) {    Scanner scan = new Scanner(System.in);   int A = scan.nextInt();  int B = scan.nextInt();  long x = scan.nextInt();  long y = scan.nextInt();  long z = scan.nextInt();   long requiredA = x * 2 + y;  long requiredB = y + z * 3;   long neededA = Math.max(0, requiredA - A);  long neededB = Math.max(0, requiredB - B);  System.out.print(neededA + neededB); } }
5	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(); }  void solve() {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  Arrays.sort(a);  int i = 1;  while (i < n && a[i] == a[i - 1]) {  ++i;  }  if (i >= n) {  out.println("NO");  } else {  out.println(a[i]);  } } }
5	public class A22 {  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();  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = nextInt();   Arrays.sort(a);  int f = a[0], q = 1;  while (q < n && a[q] == f) q++;   out.println(q < n ? a[q] : "NO");   out.flush(); } }
2	public class B { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  public static void main(String[] args) throws Exception {  String[] split = br.readLine().split(" ");   long n = Long.parseLong(split[0]);  long k = Long.parseLong(split[1]);   long left = -1;  long right = n + 1;   while(right - left >= 2) {  long mid = (left + right) / 2;              long newN = n - mid;   long temp = newN * (newN + 1) / 2;     long eh = temp - k - mid;    if(eh == 0) {   pw.println(mid);   break;  }  else if(eh < 0)   right = mid;  else   left = mid;  }   pw.close(); } }
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");  } } }
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);  TaskE1 solver = new TaskE1();  int testCount = Integer.parseInt(in.next());  for (int i = 1; i <= testCount; i++) {  solver.solve(i, in, out);  }  out.close(); }  static class TaskE1 {  public void solve(int testNumber, InputReader in, OutputWriter out) {  int n = in.nextInt();  int m = in.nextInt();  int[][] d = new int[2][1 << n];  int[] buf = new int[1 << n];  int[][] a = new int[m][n];  for (int i = 0; i < n; ++i) {   for (int j = 0; j < m; ++j) {   a[j][i] = in.nextInt();   }  }  for (int i = 0; i < m; ++i) {   int[] prev = d[i % 2], nx = d[(i + 1) % 2];   for (int shift = 0; shift < n; ++shift) {   int[] b = new int[n];   for (int j = 0; j < n; ++j) {    b[j] = a[i][(j + shift) % n];   }   System.arraycopy(prev, 0, buf, 0, prev.length);   for (int mask = 0; mask < (1 << n); ++mask) {    int val0 = buf[mask];    for (int j = 0; j < n; ++j) {    if ((mask >> j) % 2 == 0) {     int val = val0 + b[j];     int nm = mask ^ (1 << j);     if (val > buf[nm]) {     buf[nm] = val;     }    }    }   }   for (int mask = 0; mask < (1 << n); ++mask) {    if (nx[mask] < buf[mask]) {    nx[mask] = buf[mask];    }   }   }  }  out.printLine(d[m % 2][(1 << n) - 1]);  }  }  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 InputReader {  private InputStream stream;  private byte[] buffer = new byte[10000];  private int cur;  private int count;  public InputReader(InputStream stream) {  this.stream = stream;  }  public static boolean isSpace(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  public int read() {  if (count == -1) {   throw new InputMismatchException();  }  try {   if (cur >= count) {   cur = 0;   count = stream.read(buffer);   if (count <= 0) {    return -1;   }   }  } catch (IOException e) {   throw new InputMismatchException();  }  return buffer[cur++];  }  public int readSkipSpace() {  int c;  do {   c = read();  } while (isSpace(c));  return c;  }  public String nextToken() {  int c = readSkipSpace();  StringBuilder sb = new StringBuilder();  while (!isSpace(c)) {   sb.append((char) c);   c = read();  }  return sb.toString();  }  public String next() {  return nextToken();  }  public int nextInt() {  int sgn = 1;  int c = readSkipSpace();  if (c == '-') {   sgn = -1;   c = read();  }  int res = 0;  do {   if (c < '0' || c > '9') {   throw new InputMismatchException();   }   res = res * 10 + c - '0';   c = read();  } while (!isSpace(c));  res *= sgn;  return res;  }  } }
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(); }  }
2	public class Main { public static void main(String[] args) {  long x=nl(),k=nl();  if(x==0)  {  pr(0);  exit();  }  x%=mod;  pr((((x*powm(2,k+1,mod))%mod-powm(2,k,mod)+1)%mod+mod)%mod);  System.out.print(output); }    static class pair {  long a, b;  pair(){}  pair(long c,long d){a=c;b=d;} } static interface combiner {  public long combine(long a, long b); } static final int mod=1000000007; static final double eps=1e-9; static final long inf=100000000000000000L; static Reader in=new Reader(); static StringBuilder output=new StringBuilder(); static Random rn=new Random(); static void reverse(int[]a){for(int i=0; i<a.length/2; i++){a[i]^=a[a.length-i-1];a[a.length-i-1]^=a[i];a[i]^=a[a.length-i-1];}} static void sort(int[]a) {  int te;  for(int i=0; i<a.length; i+=2)  {  te=rn.nextInt(a.length);  if(i!=te)  {   a[i]^=a[te];   a[te]^=a[i];   a[i]^=a[te];  }  }  Arrays.sort(a); } static void sort(long[]a) {  int te;  for(int i=0; i<a.length; i+=2)  {  te=rn.nextInt(a.length);  if(i!=te)  {  a[i]^=a[te];  a[te]^=a[i];  a[i]^=a[te];  }  }  Arrays.sort(a); } static void sort(double[]a) {  int te;  double te1;  for(int i=0; i<a.length; i+=2)  {  te=rn.nextInt(a.length);  if(i!=te)  {  te1=a[te];  a[te]=a[i];  a[i]=te1;  }  }  Arrays.sort(a); } static void sort(int[][]a) {  Arrays.sort(a, new Comparator<int[]>()  {  public int compare(int[]a,int[]b)  {   if(a[0]>b[0])   return -1;   if(b[0]>a[0])   return 1;   return 0;  }  }); } static void sort(pair[]a) {  Arrays.sort(a,new Comparator<pair>()   {  @Override  public int compare(pair a,pair b)  {   if(a.a>b.a)   return 1;   if(b.a>a.a)   return -1;   return 0;  }   }); } static int log2n(long a) {  int te=0;  while(a>0)  {  a>>=1;  ++te;  }  return te; } static class vector implements Iterable<Integer> {  int a[],size;  vector(){a=new int[10];size=0;}  vector(int n){a=new int[n];size=0;}  public void add(int b){if(++size==a.length)a=Arrays.copyOf(a, 2*size);a[size-1]=b;}  public void sort(){Arrays.sort(a, 0, size);}  public void sort(int l, int r){Arrays.sort(a, l, r);}  @Override  public Iterator<Integer> iterator() {  Iterator<Integer> hola=new Iterator<Integer>()   {   int cur=0;    @Override    public boolean hasNext() {    return cur<size;    }    @Override    public Integer next() {    return a[cur++];    }     };  return hola;  } }  static void pr(Object a){output.append(a+"\n");} static void pr(){output.append("\n");} static void p(Object a){output.append(a);} static void pra(int[]a){for(int i:a)output.append(i+" ");output.append("\n");} static void pra(long[]a){for(long i:a)output.append(i+" ");output.append("\n");} static void pra(String[]a){for(String i:a)output.append(i+" ");output.append("\n");} static void pra(double[]a){for(double i:a)output.append(i+" ");output.append("\n");} static void sop(Object a){System.out.println(a);} static void flush(){System.out.println(output);output=new StringBuilder();}   static int ni(){return Integer.parseInt(in.next());} static long nl(){return Long.parseLong(in.next());} static String ns(){return in.next();} static double nd(){return Double.parseDouble(in.next());} static int[] nia(int n){int a[]=new int[n];for(int i=0; i<n; i++)a[i]=ni();return a;} static int[] pnia(int n){int a[]=new int[n+1];for(int i=1; i<=n; i++)a[i]=ni();return a;} static long[] nla(int n){long a[]=new long[n];for(int i=0; i<n; i++)a[i]=nl();return a;} static String[] nsa(int n){String a[]=new String[n];for(int i=0; i<n; i++)a[i]=ns();return a;} static double[] nda(int n){double a[]=new double[n];for(int i=0; i<n; i++)a[i]=nd();return a;}   static void exit(){System.out.print(output);System.exit(0);} static int min(int... a){int min=a[0];for(int i:a)min=Math.min(min, i);return min;} static int max(int... a){int max=a[0];for(int i:a)max=Math.max(max, i);return max;}  static int gcd(int... a){int gcd=a[0];for(int i:a)gcd=gcd(gcd, i);return gcd;}  static long min(long... a){long min=a[0];for(long i:a)min=Math.min(min, i);return min;} static long max(long... a){long max=a[0];for(long i:a)max=Math.max(max, i);return max;}  static long gcd(long... a){long gcd=a[0];for(long i:a)gcd=gcd(gcd, i);return gcd;}  static String pr(String a, long b){String c="";while(b>0){if(b%2==1)c=c.concat(a);a=a.concat(a);b>>=1;}return c;} static long powm(long a, long b, long m) {long an=1;long c=a;while(b>0) {if(b%2==1)an=(an*c)%m;c=(c*c)%m;b>>=1;}return an;} 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 class Reader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public Reader() {    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();   }  } }
3	public class D {  int[][] fast(int n, int m){   int[][] ans = new int[2][n * m];   int c = 0;   for (int left = 1, right = m; left < right; left++, right--) {    for (int l = 1, r = n; l <= n && r >= 1; l++, r--) {     ans[0][c] = l;     ans[1][c++] = left;     ans[0][c] = r;     ans[1][c++] = right;    }   }   if (m % 2 == 1) {    int x = m/2 + 1;    for(int l = 1, r = n;l < r;l++, r--){     ans[0][c] = l;     ans[1][c++] = x;     ans[0][c] = r;     ans[1][c++] = x;      if(n % 2 == 1 && l + 2 == r){       ans[0][c] = l+1;       ans[1][c++] = x;      }    }   }   if(n == 1 && m % 2 == 1){    ans[0][c] = 1;    ans[1][c] = m/2 + 1;   }   return ans;  }  void stress(){   for(int i = 3;i<=5;i++){    for(int j = 2;j<=5;j++){     int[][] ans = new int[2][];     try{      ans = fast(i, j);     }catch(Exception e){      out.println("ошибка");      out.print(i + " " + j);      return;     }     boolean[][] check = new boolean[i][j];     for(int c = 0;c<ans[0].length;c++){      int x = ans[0][c] - 1;      int y = ans[1][c] - 1;      check[x][y] = true;     }     for(int c = 0;c<i;c++){      for(int q = 0;q<j;q++){       if(!check[c][q]){        out.println(i + " " + j);        out.println("точки");        for(int w = 0;w<ans[0].length;w++){         out.println(ans[0][w] + " " + ans[1][w]);        }        return;       }      }     }     HashSet<String> set = new HashSet<>();     for(int c = 1;c<ans[0].length;c++){      int x = ans[0][c] - ans[0][c- 1];      int y = ans[1][c] - ans[1][c - 1];      set.add(x + " " + y);     }     if(set.size() < i * j - 1){      out.println(i + " " + j);      out.println("вектора");      for(int w = 0;w<ans[0].length;w++){       out.println(ans[0][w] + " " + ans[1][w]);      }      return;     }    }   }  }  void normal(){   int n =readInt();   int m = readInt();   int[][] ans = fast(n, m);   for(int i = 0;i<ans[0].length;i++){    out.println(ans[0][i] + " " + ans[1][i]);   }  }  boolean stress = false;  void solve(){   if(stress) stress();   else normal();  }  public static void main(String[] args) {   new D().run();  }  void run(){   init();   solve();   out.close();  }  BufferedReader in;  PrintWriter out;  StringTokenizer tok = new StringTokenizer("");  void init(){   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);  }  String readLine(){   try{    return in.readLine();   }catch(Exception ex){    throw new RuntimeException(ex);   }  }  String readString(){   while(!tok.hasMoreTokens()){    String nextLine = readLine();    if(nextLine == null) return null;    tok = new StringTokenizer(nextLine);   }   return tok.nextToken();  }  int readInt(){   return Integer.parseInt(readString());  }  long readLong(){   return Long.parseLong(readString());  }  double readDouble(){   return Double.parseDouble(readString());  } }
1	public class C {  static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter out = new PrintWriter(System.out);  static String nextToken() throws IOException{  while (st==null || !st.hasMoreTokens()){  String s = bf.readLine();  if (s == null)   return null;  st = new StringTokenizer(s);  }   return st.nextToken(); }  static int nextInt() throws IOException{  return Integer.parseInt(nextToken()); }  static String nextStr() throws IOException{  return nextToken(); }  static int f(byte s[], int n){  int l = 0,  r = n-1;  int res = 0;   do{  while (l<n && s[l]=='H')   l++;  while (r>=0 && s[r]=='T')   r--;    if (l < r){   res++;  }  l++;  r--;  }  while (l < r);   return res; }  public static void main(String[] args) throws IOException{  int n = nextInt();  byte s[] = nextStr().getBytes();   int res = f(s, n);  for (int i=1; i<n; i++){  byte c = s[0];  for (int j=0; j<n-1; j++)   s[j] = s[j+1];  s[n-1] = c;  res = Math.min(res, f(s, n));  }   out.println(res);  out.flush(); } }
1	public class Main {   void change(int [] all, char c, int val) {   if (Character.isUpperCase(c))    all[c - 'A' + 26] += val;   else    all[c - 'a'] += val;  }  int countDistinct(int [] a) {   int res = 0;   for (int i = 0 ; i< a.length ; i++) {    if (a[i] > 0)     res ++;   }   return res;  }  public void solve() throws IOException {   int n = nextInt();   String s = next();   int [] all = new int[52];   for (int i = 0 ; i < s.length() ; i++) {    char c = s.charAt(i);    change(all, c, 1);   }   int distinct = countDistinct(all);   int [] window = new int[52];   int best = n;   for (int i = 0, j = 0 ; i < s.length() ; i++) {    if (i > 0) {     change(window, s.charAt(i-1), -1);    }    while (j < s.length()) {     if (countDistinct(window) == distinct)      break;     change(window, s.charAt(j), 1);     j ++;    }    if (countDistinct(window) < distinct)     break;    best = Math.min(best, j - i);   }   out.println(best);  }       BufferedReader bf;  StringTokenizer st;  PrintWriter out;   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 long nextLong() throws IOException {   return Long.parseLong(next());  }  public Main() throws IOException {   bf = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(new OutputStreamWriter(System.out));    solve();   bf.close();   out.close();  }   public static void main(String args[]) throws IOException {   new Main();  } }
5	public class A {  public static void main(String[] args) {  Scanner in=new Scanner(System.in);  int n=in.nextInt();  int t=in.nextInt();  pt[] P=new pt[n];  for (int i=0; i<n; ++i)  P[i]=new pt(in.nextInt(), in.nextInt());  Arrays.sort(P);  int res=2;  for (int i=0; i+1<n; ++i)  {  double d=P[i+1].x-P[i].x-P[i+1].a/2.-P[i].a/2.;  if (Math.abs(d-t) <= 1e-11)   ++res;  else if (d>t)   res+=2;  }  System.out.println(res); }  } class pt implements Comparable<pt> { int x,a; pt(int x, int a) {  this.x=x;  this.a=a; }  public int compareTo(pt o) {  return x-o.x; } }
5	public class AA implements Runnable { public static void main(String[] args) {  new Thread(new AA()).run();  }  static class Utils {  private Utils() {  }  public static void mergeSort(int[] a) {  mergeSort(a, 0, a.length - 1);  }  private static void mergeSort(int[] a, int leftIndex, int rightIndex) {  final int MAGIC_VALUE = 50;  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 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;  }  }  }  BufferedReader br; StringTokenizer str = new StringTokenizer(""); PrintWriter pw;  public Integer ni() {  return Integer.parseInt(nextToken()); }  public Double nd() {  return Double.parseDouble(nextToken()); }  public Long nl() {  return Long.parseLong(nextToken()); }  public boolean EOF() {  try {  if (!br.ready() && !str.hasMoreTokens()) {   return true;  }  } catch (IOException e) {    e.printStackTrace();  }  return false; }  public String nextToken() {  while (!str.hasMoreTokens())  try {   str = new StringTokenizer(br.readLine());  } catch (IOException e) {     e.printStackTrace();  }  return str.nextToken();  }  @Override public void run() {  br = new BufferedReader(new InputStreamReader(System.in));  pw = new PrintWriter(new OutputStreamWriter(System.out));                  solve();  pw.close(); }  public void solve() {  int n = ni();  int[] a = new int[n];  int total = 0;  for (int i = 0; i < n; i++) {  a[i] = ni();  total+=a[i];  }  Arrays.sort(a);  int c =0;  int left=0;  for(int i=n-1; i>=0;i--){  if (left<=total){   c++;   left+=a[i];   total-=a[i];  }  }  pw.print(c); } }
0	public class Main { public static void main(String[] args) throws NumberFormatException,  IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  String s = n + "";  if (n >= 0)  System.out.println(n);  else {  int a = n, b = Integer.parseInt(s.substring(0, s.length() - 1)), c = Integer.parseInt(s.substring(0, s.length()-2)+s.charAt(s.length()-1));  System.out.println(Math.max(a, Math.max(b,c)));  } } }
6	public class Cycle {   public static void main(String[] args) {  Locale.setDefault(Locale.US);  InputStream inputstream = System.in;  OutputStream outputstream = System.out;  FastReader in = new FastReader(inputstream);  PrintWriter out = new PrintWriter(outputstream);  TaskA solver = new TaskA();    for (int i = 0; i < 1; i++)   solver.solve(i, in, out);  out.close();   }  }  class TaskA {   public void solve(int testnumber, FastReader in, PrintWriter out) {   int n = in.ni();  int m = in.ni();   boolean graph[][] = new boolean[n][n];   for (int i = 0; i < m; i++) {   int a = in.ni() - 1;   int b = in.ni() - 1;    graph[a][b] = true;   graph[b][a] = true;  }      long dp[][] = new long[1 << n][n];   for (int i = 0; i < n; i++) {   dp[1 << i][i] = 1;  }   long answer = 0;  for (int mask = 1; mask < (1 << n); mask++) {   int start = Integer.numberOfTrailingZeros(mask);     for (int i = 0; i < n; i++) {   if ((mask & (1 << i)) == 0) {    continue;   }    for (int j = start + 1; j < n; j++) {    if (graph[i][j] && (mask & (1 << j)) == 0) {    dp[mask + (1 << j)][j] += dp[mask][i];    }    }   if (graph[i][start]) {    answer += dp[mask][i];   }   }   }   out.println((answer - m) / 2);  } }  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 String ns() {  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 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 String next() {  return ns();  }   public interface SpaceCharFilter {  public boolean isSpaceChar(int ch);  }  }
5	public class Main{   BufferedReader in;   StringTokenizer str = null;   PrintWriter out;   private String next() throws Exception{     if (str == null || !str.hasMoreTokens())       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());   }   public void run() throws Exception{     in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);     int n = nextInt();     HashSet<Integer> hs = new HashSet<Integer>();     for(int i=0;i<n;i++) hs.add(nextInt());     if (hs.size() == 1){     out.println("NO");     out.close();     return;     }     int a[] = new int[hs.size()];     int yk = 0;     for(int i:hs) a[yk++] = i;     Arrays.sort(a);     out.println(a[1]);     out.close();   }   public static void main(String args[]) throws Exception{     new Main().run();   } }
4	public class Main { public static void main(String[] args) throws Exception {  FastScanner sc = new FastScanner();  PrintWriter out = new PrintWriter(System.out);   int h = sc.nexI();  int w = sc.nexI();  int k = sc.nexI();     Graph grid = new Graph(h*w);   for(int i=0; i<h; i++) {  for(int j=1; j<w; j++) {   long w1 = sc.nexL();   grid.add2(getad(w, i, j-1), getad(w, i, j), w1);  }  }  for(int i=1; i<h; i++) {  for(int j=0; j<w; j++) {   long w1 = sc.nexL();   grid.add2(getad(w, i-1, j), getad(w, i, j), w1);  }  }   if(k%2 != 0) {  int[][] anss = new int[h][w];  fill(anss,-1);  for(int i=0; i<h; i++) {   prtspas(anss[i]);  }    return;  }  if((h*w) == 1) {  System.out.println(-1);  return;  }   long[][] mincos = new long[(k/2)+1][h*w];  fill(mincos[0],0L);   for(int t=1; t<=(k/2); t++) {  fill(mincos[t], INFL);  for(int i=0; i<h; i++) {   for(int j=0; j<w; j++) {   int ad = getad(w, i, j);   for(Edge e: grid.get(ad)) {    mincos[t][ad] = min(mincos[t][ad], mincos[t-1][e.v2]+e.w);   }   }  }  }     for(int i=0; i<(h*w); i++) {  mincos[k/2][i]*=2L;  }  for(int i=0; i<h; i++) {  prtspas(Arrays.copyOfRange(mincos[k/2], i*w, i*w + w));  }   out.flush();  return; }  public static int getad(int w, int i, int j) {  return (i*w + j); }  static class Graph {  private ArrayList<Node> dt = new ArrayList<>();  Graph(int sz) {  for (int i = 0; i < sz; i++) {   Node node1 = new Node();   dt.add(node1);  }  }  public void add(int v8, int cnct2, long w) {  dt.get(v8).add(new Edge(v8, cnct2, w));  }  public void add2(int v1, int v2, long w) {  dt.get(v1).add(new Edge(v1, v2, w));  dt.get(v2).add(new Edge(v2, v1, w));  }  public Set<Edge> get(int v) {  return dt.get(v).getAll();  }  public int size() {  return dt.size();  }  public int sizeOf(int v) {  return dt.get(v).size();  }  public void clear() {  for (int i = 0; i < dt.size(); i++)   dt.get(i).clear();  }  public void clear(int v) {  dt.get(v).clear();  }  private void add_v(Node v_new) {  dt.add(v_new);  }  public void show2() {  for (int i = 0; i < dt.size(); i++) {   System.out.print(i + ":");   for (Edge e : dt.get(i).getAll())   e.show2();   System.out.println();  }  }  public static Graph make_Graph(int vn, int en, FastScanner sc) {  Graph g = new Graph(vn);  for (int i = 0; i < en; i++) {   int s1 = sc.nexI() - 1;   int g1 = sc.nexI() - 1;   long w = sc.nexL();   g.add2(s1, g1, w);  }  return g;  }  public static Graph make_tree(int vn, FastScanner sc) {  Graph g = new Graph(vn);  for (int i = 1; i < vn; i++) {   int s1 = sc.nexI() - 1;   int g1 = sc.nexI() - 1;   long w = sc.nexL();   g.add2(s1, g1, w);  }  return g;  }    private long[] dijkstra(int from) {  PriorityQueue<Edge> dijk = new PriorityQueue<>(new CompEdge_float());  long[] d8i = new long[this.dt.size()];  fill(d8i, INFL);  dijk.add(new Edge(from, 0L));   while (!dijk.isEmpty()) {   Edge dw = dijk.poll();   if (d8i[dw.v2] > dw.w) {   d8i[dw.v2] = dw.w;   for (Edge e : this.get(dw.v2)) {    long w2 = dw.w + e.w;    if (d8i[e.v2] > w2)    dijk.add(new Edge(e.v2, w2));   }   }  }  return d8i;  } }  static class Node {  private Set<Edge> next_vs = new HashSet<>();  public void add(Edge cnct2) {  next_vs.add(cnct2);  }  public Set<Edge> getAll() {  return next_vs;  }  public int size() {  return next_vs.size();  }  public void clear() {  next_vs.clear();  }  public void addAll(Node list2add) {  this.next_vs.addAll(list2add.next_vs);  } }  static class Edge {  int from = -1, v2 = -1;  long w;  public Edge(int going2, long weight_route) {  this.v2 = going2;  this.w = weight_route;  }  public Edge(int come8, int going2, long weight_route) {  this.from = come8;  this.v2 = going2;  this.w = weight_route;  }  public void show2() {  System.out.println(this.from + "->" + this.v2 + " :w=" + this.w);  } }  static class CompEdge_float implements Comparator<Edge> {   public int compare(Edge a, Edge b) {  if (a.w > b.w)   return 1;  else if (a.w < b.w)   return -1;  else   return a.v2 - b.v2;  } }  private static final int INF = (int) 3e8; private static final long INFL = (long) 1e17; private static final int INTMAX = Integer.MAX_VALUE; private static final long LONGMAX = Long.MAX_VALUE; private static final long e97 = 1000000007L; private static final long e99 = 998244353L; private static final double PI = Math.PI;  private static void assertion(boolean should_true) {   if (!should_true)  throw new AssertionError(); }  private static int abs(int a) {  return (a >= 0) ? a : -a; }  private static long abs(long a) {  return (a >= 0L) ? a : -a; }  private static double abs(double a) {  return (a >= 0.0) ? a : -a; }  private static int min(int a, int b) {  return (a < b) ? a : b; }  private static long min(long a, long b) {  return (a < b) ? a : b; }  private static double min(double a, double b) {  return (a < b) ? a : b; }  private static int max(int a, int b) {  return (a > b) ? a : b; }  private static long max(long a, long b) {  return (a > b) ? a : b; }  private static double max(double a, double b) {  return (a > b) ? a : b; }  private static int pow2(int num2pow) {  if (num2pow > 4e4)  throw new IllegalArgumentException("Input is to Large. Use Long.");  return num2pow * num2pow; }  private static long pow2(long num2pow) {  if (num2pow > 1e8)  throw new IllegalArgumentException("Input is to Large. Use PowP.");  return num2pow * num2pow; }  private static int pow(int num_powered, int index) {  int ans = 1;  for (int i = 0; i < index; i++) {  if (ans >= (INTMAX / num_powered))   throw new IllegalArgumentException("Input is to Large. Use Long.");  ans *= num_powered;  }  return ans; }  private static long pow(long num_powered, int index) {  long ans = 1L;  for (int i = 0; i < index; i++) {  if (ans >= (LONGMAX / num_powered))   throw new IllegalArgumentException("Input is to Large. Use PowP.");  ans *= num_powered;  }  return ans; }  private static long powP(long num_powered, long index, long p) {     if (num_powered == 0L)  return 0L;  if (index == 0L)  return 1L;  if (index == 2L) {  return (pow2(num_powered) % p);  }  int d = getDigit2(index);  long[] num_done_by2 = new long[d + 1];  num_done_by2[0] = num_powered;  for (int i = 1; i <= d; i++) {  num_done_by2[i] = num_done_by2[i - 1] * num_done_by2[i - 1];  num_done_by2[i] %= p;  }  long ans = 1L;  for (int i = d; i >= 0; i--) {  long cf = (1L << (long) i);  if (index >= cf) {   index -= cf;   ans = ans * num_done_by2[i];   ans %= p;  }  }  return ans; }  private static double hypod(double a, double b) {  return Math.sqrt(a * a + b * b); }  private static int getDigit2(long num2know) {   long compare4 = 1L;  int digit = 0;  while (num2know >= compare4) {  digit++;  compare4 = (1L << (long) digit);  }  return digit;   }  private static int getDigit10(long num2know) {   long compare4 = 1L;  int digit = 0;  while (num2know >= compare4) {  digit++;  compare4 *= 10L;  }  return digit;  }  private static int divceil(int numerator, int denominator) {  return (numerator + denominator - 1) / denominator; }  private static long divceil(long numerator, long denominator) {  return (numerator + denominator - 1L) / denominator; }  private static long factorial(int n) {   long ans = 1L;  for (long i = 2; i <= n; i++) {  if (ans >= (LONGMAX / i))   throw new IllegalArgumentException("Input is to Large. Use facP.");  ans *= i;  }  return ans; }  private static long facP(int n, long p) {   long ans = 1L;  for (long i = 2; i <= n; i++) {  ans *= i;  ans %= p;  }  return ans; }  private static long lcm(long m, long n) {  long ans = m / gcd(m, n);  if (ans >= (LONGMAX / n))  throw new IllegalArgumentException("Input is to Large.");  ans *= n;  return ans; }  private static long gcd(long m, long n) {   if ((m <= 0L) || (n <= 0L))  throw new IllegalArgumentException("m and n should be natural.");  while ((m > 0L) && (n > 0L)) {  if (m >= n)   m %= n;  else   n %= m;  }  if (m > 0L)  return m;  else  return n; }  private static boolean is_prime(long n2check) {   if (n2check == 1L)  return false;  for (long i = 2L; i <= Math.sqrt(n2check); i++) {  if (n2check % i == 0L)   return false;  }  return true; }  private static int safe_mod(int n, int p) {  n %= p;  if (n >= 0)  return n;  return (n + p); }  private static long safe_mod(long n, long p) {  n %= p;  if (n >= 0L)  return n;  return (n + p); }  private static long modinv(long n, long p) {        n %= p;  if ((p == 1L) || (gcd(n, p) != 1L))  throw new IllegalArgumentException("n and p should be coprime.");            long a = p, b = n, s = 1L, t = 0L, u = 0L, v = 1L;  while (b > 1) {  long quo = a / b, rem = a % b;  a = b;  b = rem;  long s2 = s * quo + u, t2 = t * quo + v;  u = s;  v = t;  s = s2;  t = t2;  }  long det = s * v - t * u;  if (abs(det) != 1L)  throw new ArithmeticException("My algorithm was Wrong!!");  s /= det;  s %= p;  if (s < 0L)  s += p;  return s; }  private static int minAll(int[] dt4min) {   int min = INF;  for (int element : dt4min) {  if (element < min)   min = element;  }  return min; }  private static long minAll(long[] dt4min) {   long min = INFL;  for (long element : dt4min) {  if (element < min)   min = element;  }  return min; }  private static int maxAll(int[] dt4max) {   int max = -INF;  for (int element : dt4max) {  if (element > max)   max = element;  }  return max; }  private static long maxAll(long[] dt4max) {   long max = -INFL;  for (long element : dt4max) {  if (element > max)   max = element;  }  return max; }  private static int sumAll(int[] dt4sum) {   int sum_of_dt = 0;  for (int element : dt4sum) {  if (sum_of_dt > (INTMAX - element))   throw new IllegalArgumentException("Input is to Large. Use Long.");  sum_of_dt += element;  }  return sum_of_dt; }  private static long sumAll(long[] dt4sum) {   long sum_of_dt = 0L;  for (long element : dt4sum) {  if (sum_of_dt > (LONGMAX - element))   throw new IllegalArgumentException("Input is to Large.");  sum_of_dt += element;  }  return sum_of_dt; }  private static int sumAll(ArrayList<Integer> dt4sum) {  int sum_of_dt = 0;  for (long element : dt4sum) {  if (sum_of_dt > (INTMAX - element))   throw new IllegalArgumentException("Input is to Large. Use Long.");  sum_of_dt += element;  }  return sum_of_dt; }  private static int[] reverse(int[] as) {  int ln = as.length;  int[] bs = new int[ln];  for (int i = 0; i < ln; i++)  bs[i] = as[ln - i - 1];  return bs; }  private static void reverseSub(int[] as, int S_include, int Gnot_include) {   int ln = Gnot_include - S_include;  int[] bs = new int[ln];  for (int i = S_include; i < Gnot_include; i++)  bs[i - S_include] = as[i];  for (int i = 0; i < ln; i++)  as[i + S_include] = bs[ln - i - 1]; }  private static boolean is_in_area(int y, int x, int height, int width) {  if (y < 0)  return false;  if (x < 0)  return false;  if (y >= height)  return false;  if (x >= width)  return false;  return true; }  private static boolean is_in_area(Vector v, int height, int width) {  if (v.y < 0)  return false;  if (v.x < 0)  return false;  if (v.y >= height)  return false;  if (v.x >= width)  return false;  return true; }  private static int nC2(int n) {  return ((n * (n - 1)) / 2); }  private static long nC2(long n) {  return ((n * (n - 1L)) / 2L); }  private static int iflag(int pos) {  if (pos >= 32)  throw new IllegalArgumentException("Input is to Large. Use Long.");  return (1 << pos); }  private static long flag(int pos) {  if (pos >= 64)  throw new IllegalArgumentException("Input is to Large. Use Long.");  return (1L << (long) pos); }  private static boolean isFlaged(int bit, int pos) {  if (pos >= 32)  throw new IllegalArgumentException("Input is to Large.");  return ((bit & (1 << pos)) != 0); }  private static boolean isFlaged(long bit, int pos) {  if (pos >= 64)  throw new IllegalArgumentException("Input is to Large.");  return ((bit & (1L << (long) pos)) != 0L); }  private static int deflag(int bit, int pos) {  return (bit & (~(1 << pos))); }  private static int countFlaged(int bit) {  int ans = 0;  for (int i = 0; i < 31; i++) {  if ((bit & (1 << i)) != 0)   ans++;  }  return ans; }  private static int countFlaged(long bit) {  int ans = 0;  for (long i = 0L; i < 63L; i++) {  if ((bit & (1L << i)) != 0L)   ans++;  }  return ans; }  private static int[] Xdir4 = { 1, 0, 0, -1 }; private static int[] Ydir4 = { 0, 1, -1, 0 }; private static int[] Xdir8 = { 1, 1, 1, 0, 0, -1, -1, -1 }; private static int[] Ydir8 = { 1, 0, -1, 1, -1, 1, 0, -1 };  public static int biSearch(int[] dt, int target) {      int left = 0, right = dt.length - 1;  int mid = -1;  while (left <= right) {  mid = ((right + left) / 2);  if (dt[mid] == target)   return mid;  if (dt[mid] < target)   left = (mid + 1);  else   right = (mid - 1);  }  return -1; }  public static int biSearchMax(long[] dt, long target) {     int left = -1, right = dt.length, mid = -1;  while ((right - left) > 1) {  mid = ((right + left) / 2);  if (dt[mid] <= target)   left = mid;  else   right = mid;  }  return left;   }  public static int biSearchMin(long[] dt, long target) {     int left = -1, right = dt.length, mid = -1;  while ((right - left) > 1) {  mid = ((right + left) / 2);  if (dt[mid] <= target)   left = mid;  else   right = mid;  }  return right;   }  private static void fill(boolean[] target, boolean reset) {  for (int i = 0; i < target.length; i++)  target[i] = reset; }  private static void fill(int[] target, int reset) {  for (int i = 0; i < target.length; i++)  target[i] = reset; }  private static void fill(long[] target, long reset) {  for (int i = 0; i < target.length; i++)  target[i] = reset; }  private static void fill(char[] target, char reset) {  for (int i = 0; i < target.length; i++)  target[i] = reset; }  private static void fill(double[] target, double reset) {  for (int i = 0; i < target.length; i++)  target[i] = reset; }  private static void fill(boolean[][] target, boolean reset) {  for (int i = 0; i < target.length; i++) {  for (int j = 0; j < target[i].length; j++) {   target[i][j] = reset;  }  } }  private static void fill(int[][] target, int reset) {  for (int i = 0; i < target.length; i++) {  for (int j = 0; j < target[i].length; j++) {   target[i][j] = reset;  }  } }  private static void fill(long[][] target, long reset) {  for (int i = 0; i < target.length; i++) {  for (int j = 0; j < target[i].length; j++) {   target[i][j] = reset;  }  } }  private static void fill(char[][] target, char reset) {  for (int i = 0; i < target.length; i++) {  for (int j = 0; j < target[i].length; j++) {   target[i][j] = reset;  }  } }  private static void fill(double[][] target, double reset) {  for (int i = 0; i < target.length; i++) {  for (int j = 0; j < target[i].length; j++) {   target[i][j] = reset;  }  } }  private static void fill(int[][][] target, int reset) {  for (int i = 0; i < target.length; i++) {  for (int j = 0; j < target[i].length; j++) {   for (int k = 0; k < target[i][j].length; k++) {   target[i][j][k] = reset;   }  }  } }  private static void fill(long[][][] target, long reset) {  for (int i = 0; i < target.length; i++) {  for (int j = 0; j < target[i].length; j++) {   for (int k = 0; k < target[i][j].length; k++) {   target[i][j][k] = reset;   }  }  } }  private static void fill_parent(int[] parent) {  for (int i = 0; i < parent.length; i++) {  parent[i] = i;  } }  private static void showBit(int bit) {  for (int i = 0; i < getDigit2(bit); i++) {  if (isFlaged(bit, i))   System.out.print("O");  else   System.out.print(".");  }  System.out.println(); }  private static void showBit(long bit) {  for (int i = 0; i < getDigit2(bit); i++) {  if (isFlaged(bit, i))   System.out.print("O");  else   System.out.print(".");  }  System.out.println(); }  static void show2(boolean[][] dt, String cmnt) {  for (int i = 0; i < dt.length; i++) {  for (int j = 0; j < dt[i].length; j++) {   if (dt[i][j])   System.out.print("O");   else   System.out.print(".");  }  if (!cmnt.equals(""))   System.out.print("<-" + cmnt);  System.out.println(" :" + i);  } }  static void show2(int[][] dt, String cmnt) {  for (int i = 0; i < dt.length; i++) {  for (int j = 0; j < dt[i].length; j++)   System.out.print(dt[i][j] + ",");  if (!cmnt.equals(""))   System.out.print("<-" + cmnt);  System.out.println(" :" + i);  } }  static void show2(long[][] dt, String cmnt) {  for (int i = 0; i < dt.length; i++) {  for (int j = 0; j < dt[i].length; j++)   System.out.print(dt[i][j] + ",");  if (!cmnt.equals(""))   System.out.print("<-" + cmnt);  System.out.println(" :" + i);  } }  static void show2(ArrayDeque<Long> dt) {  long element = 0;  while (dt.size() > 0) {  element = dt.removeFirst();  System.out.print(element);  }  System.out.println("\n"); }  static void show2(List<Object> dt) {  for (int i = 0; i < dt.size(); i++)  System.out.print(dt.get(i) + ",");  System.out.println("\n"); }  private static void prtlnas(int[] array) {  PrintWriter out = new PrintWriter(System.out);  for (int e: array)  out.println(e);  out.flush(); }  private static void prtlnas(long[] array) {  PrintWriter out = new PrintWriter(System.out);  for (long e: array)  out.println(e);  out.flush(); }  private static void prtlnas(ArrayList<Object> array) {  PrintWriter out = new PrintWriter(System.out);  for (Object e: array)  out.println(e);  out.flush(); }  private static void prtspas(int[] array) {  PrintWriter out = new PrintWriter(System.out);  out.print(array[0]);  for (int i = 1; i < array.length; i++)  out.print(" " + array[i]);  out.println();  out.flush(); }  private static void prtspas(long[] array) {  PrintWriter out = new PrintWriter(System.out);  out.print(array[0]);  for (int i = 1; i < array.length; i++)  out.print(" " + array[i]);  out.println();  out.flush(); }  private static void prtspas(double[] array) {  PrintWriter out = new PrintWriter(System.out);  out.print(array[0]);  for (int i = 1; i < array.length; i++)  out.print(" " + array[i]);  out.println();  out.flush(); }  private static void prtspas(ArrayList<Integer> array) {  if (array.isEmpty())  return;  PrintWriter out = new PrintWriter(System.out);  out.print(array.get(0));  for (int i = 1; i < array.size(); i++)  out.print(" " + array.get(i));  out.println();  out.flush(); }  static class Vector {  int x, y;  public Vector(int sx, int sy) {  this.x = sx;  this.y = sy;  }  public boolean equals(Vector v) {  return (this.x == v.x && this.y == v.y);  }  public void show2() {  System.out.println(this.x + ", " + this.y);  }  public static int dist2(Vector a, Vector b) {  int dx = abs(a.x - b.x);  int dy = abs(a.y - b.y);  if (dx > 3e4)   throw new IllegalArgumentException("Input is to Large. Use Long.");  if (dy > 3e4)   throw new IllegalArgumentException("Input is to Large. Use Long.");  return (dx * dx + dy * dy);  } }  static class CompVector implements Comparator<Vector> {  public int compare(Vector a, Vector b) {  if (a.x == b.x)   return a.y - b.y;  else   return a.x - b.x;  } }  static class FastScanner {   private final InputStream in = System.in;  private final byte[] buffer = new byte[1024];  private int ptr = 0;  private int buflen = 0;  private boolean hasNextByte() {  if (ptr < buflen) {   return true;  } else {   ptr = 0;   try {   buflen = in.read(buffer);   } catch (IOException e) {   e.printStackTrace();   }   if (buflen <= 0) {   return false;   }  }  return true;  }  private int readByte() {  if (hasNextByte())   return buffer[ptr++];  else   return -1;  }  private static boolean isPrintableChar(int c) {  return (33 <= c) && (c <= 126);  }  public boolean hasNext() {  while (hasNextByte() && !isPrintableChar(buffer[ptr]))   ptr++;  return hasNextByte();  }  public String next() {  if (!hasNext())   throw new NoSuchElementException();  StringBuilder sb = new StringBuilder();  int b = readByte();  while (isPrintableChar(b)) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }  public long nexL() {  if (!hasNext())   throw new NoSuchElementException();  long n = 0;  boolean minus = false;  int b = readByte();  if (b == '-') {   minus = true;   b = readByte();  }  if (b < '0' || '9' < b) {   throw new NumberFormatException();  }  while (true) {   if ('0' <= b && b <= '9') {   n *= 10;   n += b - '0';   } else if (b == -1 || !isPrintableChar(b) || b == ':') {   return minus ? -n : n;   } else {   throw new NumberFormatException();   }   b = readByte();  }  }  public int nexI() {  long nl = nexL();  if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {   throw new NumberFormatException();  }  return (int) nl;  }  public double nexD() {  return Double.parseDouble(next());  }    public void ai(int[]... array) {  for (int i = 0; i < array[0].length; i++) {   for (int j = 0; j < array.length; j++) {   array[j][i] = nexI();   }  }  return;  }  public void al(long[]... array) {  for (int i = 0; i < array[0].length; i++) {   for (int j = 0; j < array.length; j++) {   array[j][i] = nexL();   }  }  return;  }  public void aimin1(int[] array) {  for (int i = 0; i < array.length; i++) {   array[i] = nexI() - 1;  }  return;  }  public void aD(double[] array) {  for (int i = 0; i < array.length; i++) {   array[i] = nexD();  }  return;  }  public void ai2d(int[][] array) {  for (int i = 0; i < array.length; i++) {   for (int j = 0; j < array[0].length; j++) {   array[i][j] = nexI();   }  }  return;  }  public void al2d(long[][] array) {  for (int i = 0; i < array.length; i++) {   for (int j = 0; j < array[0].length; j++) {   array[i][j] = nexL();   }  }  return;  } } }
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 ;  }  }
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 MOD = MathExtentions.DEFAULT_MOD;    long x = in.NextLong();    long k = in.NextLong();    if (x == 0) {     out.println(0);     return;    }    x %= MOD;    long res = x * MathExtentions.powerMod(2, k + 1, MOD);    res %= MOD;    res -= MathExtentions.powerMod(2, k, MOD) - 1;    res %= MOD;    while (res < 0) res += MOD;    while (res >= MOD) res -= MOD;    out.println(res);   }  }  static 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(), " \t\n\r\f,");     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }   public long NextLong() {    return Long.parseLong(next());   }  }  static class MathExtentions {   public static final long DEFAULT_MOD = 1_000_000_007;   public static long powerMod(final long x, final long y, final long m) {    if (y == 0)     return 1;    long p = powerMod(x, y / 2, m) % m;    p = (p * p) % m;    if (y % 2 == 0)     return p;    else     return (x * p) % m;   }  } }
2	public class b {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   long n = sc.nextLong() - 1, k = sc.nextLong() - 1;   int a = 0;   if ((k + 1) * k / 2 < n) {    System.out.println(-1);    return;   }   while (n > 0 && k > 0) {    long min = go(n, k);    a += (k - min + 1);    n -= (k + min) * (k - min + 1) / 2;    k = Math.min(min - 1, n);   }   if (n == 0)    System.out.println(a);   else    System.out.println(-1);  }  static long go(long n, long k) {   long low = 1, high = k;   while (low + 1 < high) {    long mid = (low + high) / 2;    if ((k + mid) * (k - mid + 1) / 2 <= n) {     high = mid;    } else     low = mid;   }   return high;  } }
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);  } } }
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;  } }
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);   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();    String s = in.next();    int[] cnt = new int[26];    int[] cnt2 = new int[26];    int j = 0;    int res = n;    HashSet<Character> set = new HashSet<Character>();    for (char c : s.toCharArray()) {     set.add(c);    }    int m = set.size();    for (int i = 0; i < n; ++i) {     if (Character.isLowerCase(s.charAt(i))) {      cnt[s.charAt(i) - 'a']++;     } else {      cnt2[s.charAt(i) - 'A']++;     }     while (isOK(cnt, cnt2, m)) {      res = Math.min(res, i - j + 1);      if (Character.isLowerCase(s.charAt(j))) {       cnt[s.charAt(j) - 'a']--;      } else {       cnt2[s.charAt(j) - 'A']--;      }      ++j;     }    }    out.println(res);   }   boolean isOK(int[] cnt, int[] cnt2, int m) {    int c = 0;    for (int i = 0; i < 26; ++i) {     if (cnt[i] > 0) {      ++c;     }    }    for (int i = 0; i < 26; ++i) {     if (cnt2[i] > 0) {      ++c;     }    }    return c >= m;   }  } }
5	public class Main implements Runnable {  class Home implements Comparable<Home> {   @Override   public int compareTo(Home arg0) {    return st - arg0.st;   }   int st, end;    }   public void solve() throws IOException {   int n = nextInt(), t = nextInt() * 2;   Home[] h = new Home[n];   for(int i = 0; i < n; ++i) {    int x = nextInt() * 2, a = nextInt() * 2;    h[i] = new Home();    h[i].st = x - a / 2;    h[i].end = x + a / 2;      }      Arrays.sort(h);   int ans = 2;   for(int i = 0; i + 1 < n; ++i) {    int delta = h[i + 1].st - h[i].end;    if (delta == t)     ans++;    if (delta > t)     ans += 2;   }   pw.println(ans);  }   static final String filename = "A";  static final boolean fromConsole = true;  public void run() {   try {    if (!fromConsole) {     in = new BufferedReader(new FileReader(filename + ".in"));     pw = new PrintWriter(filename + ".out");    } else {     in = new BufferedReader(new InputStreamReader(System.in));     pw = new PrintWriter(System.out);    }    st = new StringTokenizer("");    long st = System.currentTimeMillis();    solve();          pw.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(-1);   }  }   private StringTokenizer st;  private BufferedReader in;  private PrintWriter pw;    boolean hasNext() throws IOException {   while (!st.hasMoreTokens()) {    String line = in.readLine();    if (line == null) {     return false;    }    st = new StringTokenizer(line);   }   return st.hasMoreTokens();  }   String next() throws IOException {   return hasNext() ? st.nextToken() : null;  }   int nextInt() throws IOException {   return Integer.parseInt(next());  }   BigInteger nextBigInteger() throws IOException {   return new BigInteger(next());  }   long nextLong() throws IOException {   return Long.parseLong(next());  }   double nextDouble() throws IOException {   return Double.parseDouble(next());  }   public static void main(String[] args) {   new Thread(new Main()).start();  }  }
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(); } }
5	public class CottageVillage {  public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  int size=sc.nextInt();  int side=sc.nextInt();  ArrayList<Pair> lis=new ArrayList<Pair>();  for(int x=0;x<size;x++)  {  lis.add(new Pair(sc.nextInt(), sc.nextInt()));    }  Collections.sort(lis);  int count=2;  for(int x=0;x<lis.size()-1;x++)  {  Pair a=lis.get(x);  Pair b=lis.get(x+1);  double na=a.x+a.len/2;  double nb=b.x-b.len/2;    if(na<nb)  {   double dif=Math.abs(nb-na);   if(dif==side)count++;   else if(dif>side)count+=2;  }  }  System.out.println(count); } } class Pair implements Comparable<Pair> { int x; double len;  public Pair(int a,int b) {  x=a;  len=b; } public int compareTo(Pair o) {  return x-o.x; } }
4	public class Main { public static void main(String[] args) throws FileNotFoundException {  Scanner sc = new Scanner(new File("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  ArrayList<ArrayList<Integer>> fire = new ArrayList<ArrayList<Integer>>();  while (k-- != 0) {  ArrayList<Integer> t = new ArrayList<Integer>();  t.add(sc.nextInt());  t.add(sc.nextInt());  fire.add(t);  }   int maxI = 0, maxJ = 0, maxManhatten = -1;  for(int i = 1; i <= n; i++)  for(int j = 1; j <= m; j++){   int curManhatten = Integer.MAX_VALUE;   for(int u = 0; u < fire.size(); u++)   curManhatten = Math.min(curManhatten, manhatten(i, j, fire.get(u).get(0), fire.get(u).get(1)));     if(curManhatten > maxManhatten){   maxManhatten = curManhatten;   maxI = i;   maxJ = j;   }  }   out.print(maxI + " " + maxJ);  out.flush();  out.close(); }  private static int manhatten(int i, int j, Integer a, Integer b) {  return Math.abs(i - a) + Math.abs(j - b); } }
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){}      } }
5	public class Main {  public Main() {  super(); }  public static void main(String... args) {  Main main = new Main();  main.start(); }   public void start() {  Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));  int n = in.nextInt();  int t = in.nextInt();  House list[] = new House[n];  for (int i = 0; i < n; i++) {  int x = in.nextInt();  int a = in.nextInt();  list[i] = new House(x, a);  }  Arrays.sort(list);  int c = 2;  for (int i = 1; i < n; i++) {  float d = list[i].left - list[i - 1].right;  if (d == t) c++;  else if (d > t) c += 2;  }  System.out.println(c); } }  class House implements Comparable<House> { public int x; public float left, right; public House(int x, int a) {  this.x = x;  float h = a / 2f;  this.left = x - h;  this.right = x + h; }  public int compareTo(House h) {  return this.x == h.x ? 0 : this.x < h.x ? -1 : 1; }  }
0	public class Template {  BufferedReader in;  PrintWriter out;  StringTokenizer st;  String next() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(in.readLine());    } catch (Exception e) {    }   }   return st.nextToken();  }  int nextInt() {   return Integer.parseInt(next());  }  long nextLong() {   return Long.parseLong(next());  }  double nextDouble() {   return Double.parseDouble(next());  }  public void run() throws Exception {        in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   solve();   out.flush();   out.close();   in.close();  }  public int sub(int a, int b) {   int res = 0;   while (b > 0) {    res += a / b;    int m = a % b;    a = b;    b = m;   }   return res;  }  public void solve() throws Exception {   int n = nextInt();   while (n-- > 0) {    out.println(sub(nextInt(), nextInt()));   }  }  public static void main(String[] args) throws Exception {   new Template().run();  } }
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());   }  } }
1	public class Code1 {  public static void main(String[] args) {  InputReader in = new InputReader(System.in);  PrintWriter pw = new PrintWriter(System.out);   int n = in.nextInt();  long d = in.nextLong();  long[]a = new long[n];  for(int i=0;i<n;i++)  a[i] = in.nextLong();  int ans = 1;  for(int i=0;i<n-1;i++)  {  long x = a[i+1]-a[i];  if(x==2*d)   ans++;  else if(x>2*d)   ans+=2;    }  ans++;  pw.print(ans);  pw.flush();  pw.close(); }  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 static int[] suffle(int[] a,Random gen) {  int n = a.length;  for(int i=0;i<n;i++)  {  int ind = gen.nextInt(n-i)+i;  int 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); }  public static long GCD(long a,long b) {  if(b==0)  return a;  else  return GCD(b,a%b); }  public static void extendedEuclid(int A,int B) {  if(B==0)  {  d = A;  p = 1 ;  q = 0;  }  else  {  extendedEuclid(B, A%B);  int temp = p;  p = q;  q = temp - (A/B)*q;  } }  public static long LCM(long a,long b) {  return (a*b)/GCD(a,b); }  public static int LCM(int a,int b) {  return (a*b)/GCD(a,b); }  public static int binaryExponentiation(int x,int n) {  int result=1;  while(n>0)  {   if(n % 2 ==1)    result=result * x;   x=x*x;   n=n/2;  }  return result; }  public static long binaryExponentiation(long x,long n) {  long result=1;  while(n>0)  {   if(n % 2 ==1)    result=result * x;   x=x*x;   n=n/2;  }  return result; }  public static int modularExponentiation(int x,int n,int M) {  int result=1;  while(n>0)  {   if(n % 2 ==1)    result=(result * x)%M;   x=(x*x)%M;   n=n/2;  }  return result; }  public static long modularExponentiation(long x,long n,long M) {  long result=1;  while(n>0)  {   if(n % 2 ==1)    result=(result * x)%M;   x=(x*x)%M;   n=n/2;  }  return result; }  public static int modInverse(int A,int M) {  return modularExponentiation(A,M-2,M); }  public static long modInverse(long A,long M) {  return modularExponentiation(A,M-2,M); }  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 class pair implements Comparable<pair> {  Integer x, y;  pair(int x,int 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();  } } }
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;  } }
1	public class utkarsh {  InputStream is;  PrintWriter out;   long mod = (long) (1e9 + 7);  boolean SHOW_TIME;   void solve() {        int n = ni();   HashMap <String, Integer> mp = new HashMap<>();   mp.put("M", 0);   mp.put("S", 1); mp.put("XS", 2); mp.put("XXS", 3); mp.put("XXXS", 4);   mp.put("L", 5); mp.put("XL", 6); mp.put("XXL", 7); mp.put("XXXL", 8);   int a[] = new int[10];   for(int i = 0; i < n; i++) {    int j = mp.get(ns());    a[j]++;   }   for(int i = 0; i < n; i++) {    int j = mp.get(ns());    a[j]--;   }   int ans = 0;   for(int i = 0; i < 10; i++) {    if(a[i] > 0) ans += a[i];   }   out.println(ans);  }     public static void main(String[] args) { new utkarsh().run(); }  void run() {   is = System.in;   out = new PrintWriter(System.out);   long start = System.currentTimeMillis();   solve();   long end = System.currentTimeMillis();   if(SHOW_TIME) out.println("\n" + (end - start) + " ms");   out.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[] na(int n) {   int a[] = new int[n];   for(int i = 0; i < n; i++) { a[i] = ni(); }   return a;  }  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);  } }
2	public class palin { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(System.out);  Scanner scan = new Scanner(System.in);  TaskC solver = new TaskC();  solver.solve(1, in, out);  out.close(); } } class TaskC { public void solve(int testNumber, InputReader in, PrintWriter out) {  long n = in.nextLong() - 1;  long k = in.nextLong() - 1;  if (n == 0) {  out.print("0");  } else {  if (k >= n) {   out.print("1");  } else {   if (k * (k + 1) / 2 < n) {   out.print("-1");   } else {   long t = binsearch(n, k, 1, k);   long ans = k - t + 1;   if (k * (k + 1) / 2 - t * (t - 1) / 2 != n)    ans++;   System.out.println(ans);   }  }  } }  public static long binsearch(long n, long k, long from, long to) {  if (from == to) {  return from;  }  long mid = (from + to) / 2;  if ((k * (k + 1)) / 2 - (mid * (mid - 1)) / 2 > n)  return binsearch(n, k, mid + 1, to);  else   return binsearch(n, k, from, mid); } } 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()); }  public long nextLong() {  return Long.parseLong(next()); } }
4	public class D {  static long[][][] dp;  static int[][] hor, ver;  static int n, m;  static int[][] dir = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};  public static boolean isValid (int row, int col) {   return row >= 0 && col >= 0 && row < n && col < m;  }  public static void minCost (int row, int col, int k) {   if (k == 0)    return;   if (k == 2) {    long min = Long.MAX_VALUE;    for (int i = 0; i < 4; i++) {     if (isValid(row + dir[i][0], col + dir[i][1])) {      if ((row + dir[i][0]) == row) {       if ((col + dir[i][1]) > col) {        min = Math.min(min, hor[row][col]);       } else {        min = Math.min(min, hor[row][col - 1]);       }      } else {       if ((row + dir[i][0]) > row) {        min = Math.min(min, ver[row][col]);       } else {        min = Math.min(min, ver[row - 1][col]);       }      }     }    }    dp[row][col][k] = 2 * min;    return;   }   if (dp[row][col][k] != Long.MAX_VALUE)    return;   long min = Long.MAX_VALUE;   for (int i = 0; i < 4; i++) {    if (isValid(row + dir[i][0], col + dir[i][1])) {     if (k >= 4) {      minCost(row + dir[i][0], col + dir[i][1], k - 2);      int edge = 0;      if ((row + dir[i][0]) == row) {       if ((col + dir[i][1]) > col) {        edge = hor[row][col];       } else {        edge = hor[row][col - 1];       }      } else {       if ((row + dir[i][0]) > row) {        edge = ver[row][col];       } else {        edge = ver[row - 1][col];       }      }      min = Math.min(min, 2 * edge + dp[row + dir[i][0]][col + dir[i][1]][k - 2]);     }    }   }   dp[row][col][k] = min;  }  public static void main(String[] args) {   Scanner input = new Scanner(System.in);   n = input.nextInt();   m = input.nextInt();   int k = input.nextInt();   hor = new int[n][m - 1];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m - 1; j++) {     hor[i][j] = input.nextInt();    }   }   ver = new int[n - 1][m];   for (int i = 0; i < n - 1; i++) {    for (int j = 0; j < m; j++) {     ver[i][j] = input.nextInt();    }   }   if (k % 2 != 0) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      System.out.print(-1 + " ");     }     System.out.println("");    }   } else {    dp = new long[n][m][k + 1];    for (int i = 0; i < n; i++)     for (int j = 0; j < m; j++)      for (int x = 0; x <= k; x++) {       dp[i][j][x] = Long.MAX_VALUE;      }    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      minCost(i, j, k);      System.out.print(dp[i][j][k] + " ");     }     System.out.println("");    }   }     input.close();  } }
0	public class file{   public static void main(String []args) {  Scanner sc=new Scanner(System.in);  int n=sc.nextInt();  while(n-->0)  {   int a=sc.nextInt();   int b=sc.nextInt();   int ans=f(a,b);   System.out.println(ans);  }  }  public static int f(int a,int b)  {   if(a==0||b==0)    return 0;   if(a>b)   {    return a/b + f(b,a%b);   }   else    return b/a + f(a,b%a);  } }
5	public class Solution {  class Q implements Comparable<Q> {  int p, t;  Q(int q, int w) {  p = q; t = w;  }  @Override  public int compareTo(Q arg0) {  if (p == arg0.p) return t - arg0.t;   return arg0.p - p;  } }  void solve() throws Exception {  int n = nextInt();  int k = nextInt() - 1;  Q[] a = new Q[n];  for (int i = 0; i < n; i++) a[i] = new Q(nextInt(), nextInt());  Arrays.sort(a);  int ans = 1;  for (int i = k - 1; i >= 0; i--) if (a[i].compareTo(a[k]) == 0) ans++; else break;  for (int i = k + 1; i < n; i++) if (a[i].compareTo(a[k]) == 0) ans++; else break;  out.println(ans); }  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);  solve();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } finally {  out.close();  } }  String nextToken() throws Exception {  while (st == null || !st.hasMoreTokens()) {  String s = in.readLine();  if (s == null) return null;  st = new StringTokenizer(s);  }  return st.nextToken(); }  int nextInt() throws Exception {  return Integer.parseInt(nextToken()); }  BufferedReader in; PrintWriter out; StringTokenizer st; }
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;  } }  }
1	public class C {  MyScanner in;  PrintWriter out;  public static void main(String[] args) throws Exception {   new C().run();  }  public void run() throws Exception {   in = new MyScanner();   out = new PrintWriter(System.out);   solve();   out.close();  }  public void solve() throws Exception {   int n = in.nextInt();   char[] a = in.next().toCharArray();   int h = 0;   for (int i = 0; i < a.length; i++) {    if (a[i] == 'H') h++;   }   char[] b = new char[2 * a.length - 1];   for (int i = 0; i < b.length; i++) {    b[i] = a[i % a.length];   }   int maxh = 0;   int hh = 0;   for (int i = 0; i < b.length - h; i++) {    hh = 0;    for (int j = 0; j < h; j++) {     if (b[i + j] == 'H') hh++;    }    maxh = Math.max(maxh, hh);   }        out.println(h - maxh);  }  class MyScanner {   BufferedReader br;   StringTokenizer st;   public MyScanner() throws Exception {    br = new BufferedReader(new InputStreamReader(System.in));   }   String next() throws Exception {    if ((st == null) || (!st.hasMoreTokens())) {     st = new StringTokenizer(br.readLine());    }    return st.nextToken();   }   int nextInt() throws Exception {    return Integer.parseInt(next());   }   double nextDouble() throws Exception {    return Double.parseDouble(next());   }   boolean nextBoolean() throws Exception {    return Boolean.parseBoolean(next());   }   long nextLong() throws Exception {    return Long.parseLong(next());   }  } }
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();  }  } }
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);  } }
3	public class cfs584A {  static long LINF = Long.MAX_VALUE / 4;  static long IING = Integer.MAX_VALUE / 4;  public static void main(String[] args) {   FastScanner sc = new FastScanner();   StringBuilder sb = new StringBuilder();   int N = sc.nextInt();   int[] nums = sc.readIntArray(N);   ArrayList<Integer> num = new ArrayList<>();   for (int i = 0; i < N; i++) {    num.add(nums[i]);   }    int count = 0;   while (!num.isEmpty()) {    count++;    int size = num.size();    int min = 200;    for (int j = size-1; j >=0; j--) {     if (num.get(j) < min) {      min = num.get(j);     }    }    for (int j = size-1; j >=0; j--) {     int div = num.get(j) / min;     if ((div * min) == num.get(j)) {      num.remove(j);     }    }   }   sb.append(count);   System.out.print(sb);  }  static void Assert(boolean b) {   if (!b) throw new Error("Assertion Failed");  }  static class Pair implements Comparable<Pair> {   int x, y;   Pair(int _x, int _y) {    x = _x;    y = _y;   }   public int compareTo(Pair o) {    int c1 = Integer.compare(x, o.x);    return c1 != 0 ? c1 : Integer.compare(y, o.y);   }  }  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;   }  } }
0	public class Main { public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  int n=sc.nextInt();  while(n-->0){   long a=sc.nextLong(),b=sc.nextLong();   long ans=0,cur=0;   while(a>0 && b>0){    if(b>a)a=a+b-(b=a);    cur=(a/b);    ans+=cur;    a-=(cur*b);   }   System.out.println(ans);  } } }
5	public class P15A_CottageVillage {   public static void main(String[] args) {  Scanner scanner = new Scanner(System.in);  int n = scanner.nextInt();  int t = scanner.nextInt();  scanner.nextLine();  int[] x = new int[n];  int[] a = new int[n];  for (int i = 0; i < n; i++) {  x[i] = scanner.nextInt();  a[i] = scanner.nextInt();  scanner.nextLine();  }  scanner.close();  for (int i = 0; i < n - 1; i++) {  for (int j = i + 1; j < n; j++) {   if (x[i] > x[j]) {   swap(x, i, j);   swap(a, i, j);   }  }  }  int countPositions = 2;  for (int i = 1; i < n; i++) {  double left = x[i - 1] + a[i - 1] * 1.0 / 2;  double right = x[i] - a[i] * 1.0 / 2;  double length = right - left;   if (length == (double) t) {   countPositions++;  } else if (length > t) {   countPositions += 2;  }  }  System.out.println(countPositions); }  private static void swap(int[] numbers, int i, int j) {  int temp = numbers[i];  numbers[i] = numbers[j];  numbers[j] = temp; } }
3	public class Kaudo {  static Reader in =new Reader();  static StringBuilder Sd=new StringBuilder();  static long ans,res,lot,max;  static List<Integer>gr[];  static ArrayList<Integer> A=new ArrayList();  static String ch[];  public static void main(String [] args) {   int n=in.nextInt(),a[]=new int [n],g=0;   for(int i=0;i<n;i++){   a[i]=in.nextInt();   if(a[i]==1){System.out.println("1");return;}   }   ans=0;   Arrays.sort(a);   for(int i=0;i<n;i++){    int x=a[i];    if(x>0){ans++;   for(int u=i;u<n;u++){   if(a[u]%x==0){a[u]=0;}     }}     }   System.out.println(ans);  }  static int gcd(int a,int b){  if(b==0)return a;  return gcd(b,a%b);  }  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 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) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  }  }
3	public class Main {   public static void main(String[] args) {   Scanner scanner = new Scanner(System.in);   int n = scanner.nextInt();   int[] colors = new int[n];   for (int i = 0; i < n; i++) {    colors[i] = scanner.nextInt();   }   Arrays.sort(colors);   int amountOfColors = 0;   for (int i = 0; i < n; i++) {    if (colors[i] != 0){     amountOfColors++;     int color = colors[i];     for (int j = i; j < n; j++) {      if (colors[j] % color == 0){       colors[j] = 0;      }     }    }   }   System.out.println(amountOfColors);  } }
4	public class GivenString {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   String line = sc.nextLine();   String sub = "";   int count = 0;   int max = 0;   for (int i = 0; i < line.length() - 1; i++) {    sub = line.substring(i, i + 1);    int q = i + 1;    int p;    int r = i;    while (q < line.length() && q > 0) {     p = q;     r = i;     int ind = line.indexOf(sub, p);     count = 0;     if (ind != -1) {      for (int j = ind; j < line.length(); j++) {       if (line.substring(j, j + 1).equalsIgnoreCase(line.substring(r, r + 1))) {        r++;        count++;       } else {        break;       }      }      if (count > max) {       max = count;      }     }     q = ind + 1;        }   }   System.out.println(max);  } }
1	public class Solution{   public static long page(long p,long k){     return (p-1)/k;    }   public static void main(String[] args) throws Exception {   Scanner sc = new Scanner(System.in);     long n = sc.nextLong();   int m = sc.nextInt();   long k = sc.nextLong();   long[] p = new long[m];   long del = 0;   long nb = 1;   int op = 0;   for(int i=0;i<m;i++) p[i] = sc.nextLong();   for(int i=1;i<m;i++){    if(page(p[i]-del,k)!=page(p[i-1]-del,k)){         del += nb;     nb = 1;     op++;        }else{     nb++;        }   }   if(nb!=0) op++;     System.out.println(op);    }  }
3	public class CF1141F { static class V {  int l, r, a;  V(int l, int r, int a) {  this.l = l; this.r = r; this.a = a;  } } 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 + 1];  for (int i = 1; i <= n; i++)  aa[i] = Integer.parseInt(st.nextToken());  for (int i = 1; i <= n; i++)  aa[i] += aa[i - 1];  int m = n * (n + 1) / 2;  V[] vv = new V[m];  m = 0;  for (int i = 1; i <= n; i++)  for (int j = i; j <= n; j++)   vv[m++] = new V(i, j, aa[j] - aa[i - 1]);  Arrays.sort(vv, (u, v) -> u.a != v.a ? u.a - v.a : u.r - v.r);  int[] ii_ = new int[m];  int[] ii = new int[m];  int k_ = 0;  for (int i = 0, j; i < m; i = j) {  j = i + 1;  while (j < m && vv[j].a == vv[i].a)   j++;  int k = 0, r = 0;  for (int h = i; h < j; h++)   if (vv[h].l > r) {   ii[k++] = h;   r = vv[h].r;   }  if (k_ < k) {   k_ = k;   int[] tmp = ii_; ii_ = ii; ii = tmp;  }  }  pw.println(k_);  for (int h = 0; h < k_; h++) {  int i = ii_[h];  pw.println(vv[i].l + " " + vv[i].r);  }  pw.close(); } }
0	public class Subtractions {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int tests = scan.nextInt();  while (tests > 0) {   tests--;   int first = scan.nextInt();  int second = scan.nextInt();   int count = 0;  while (first > 0 && second > 0) {     if (first < second) {    count += second / first;   second = second % first;   } else {      count += first / second;   first = first % second;   }  }    System.out.println(count);  } } }
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);   G1PlaylistForPolycarpEasyVersion solver = new G1PlaylistForPolycarpEasyVersion();   solver.solve(1, in, out);   out.close();  }  static class G1PlaylistForPolycarpEasyVersion {   public static final int GENRES_COUNT = 3;   private int songsCount;   private int totalDuration;   private Song[] songs;   private int[][][] mem;   static final int mod = 1000000007;   public void solve(int testNumber, InputReader in, PrintWriter out) {    songsCount = in.nextInt();    totalDuration = in.nextInt();    songs = new Song[songsCount];    for (int i = 0; i < songsCount; i++) {     songs[i] = new Song(in.nextInt(), in.nextInt() - 1);    }    long ret = 0;    int chosenSongs = 0;    mem = new int[GENRES_COUNT + 1][][];    for (int i = 0; i < GENRES_COUNT; i++) {     mem[i] = new int[totalDuration + 1][];     for (int j = 0; j <= totalDuration; j++) {      mem[i][j] = new int[1 << songsCount];      for (int k = 0; k < 1 << songsCount; k++) {       mem[i][j][k] = -1;      }     }    }    for (int i = 0; i < songsCount; i++) {     chosenSongs = 1 << i;     ret += search(totalDuration - songs[i].duration, songs[i].genre, chosenSongs);    }    out.println(ret % mod);   }   private long search(int timeLeft, int lastGenre, int chosen) {    if (timeLeft < 0) {     return 0;    }    if (timeLeft == 0) {     return 1;    }    if (mem[lastGenre][timeLeft][chosen] != -1) {     return mem[lastGenre][timeLeft][chosen];    }    long ret = 0;    for (int i = 0; i < songsCount; i++) {     if (((1 << i) & chosen) == 0 && songs[i].genre != lastGenre) {      ret += search(timeLeft - songs[i].duration, songs[i].genre, chosen | 1 << i);      if (ret > mod) {       ret = ret % mod;      }     }    }    mem[lastGenre][timeLeft][chosen] = (int) (ret % mod);    return mem[lastGenre][timeLeft][chosen];   }   class Song {    public int duration;    public int genre;    public Song(int duration, int genre) {     this.duration = duration;     this.genre = genre;    }   }  }  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());   }  } }
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);  TaskC solver = new TaskC();  solver.solve(1, in, out);  out.close(); }  static class TaskC {  private long MOD = (long) (1e9 + 7);  int[][] dp = new int[5001][5001];  public void solve(int testNumber, InputReader in, PrintWriter out) {  int n = in.nextInt();  ArrayList<Character> commands = new ArrayList<>();   for (int i = 0; i < n; i++) {   char ch = in.next().charAt(0);   commands.add(ch);  }  for (int a[] : dp) Arrays.fill(a, -1);   out.println(count(0, commands, 0));  }  public int count(int index, ArrayList<Character> commands, int deepCount) {  if (deepCount < 0) {   return 0;  }  if (index == commands.size()) {   return 1;  } else {   if (dp[index][deepCount] != -1) return dp[index][deepCount];   long result = 0;   char ch = commands.get(index);   result = count(index, commands, deepCount - 1);   if (ch == 's') {   result += count(index + 1, commands, deepCount);   } else {   result += count(index + 1, commands, deepCount + 1);   result -= count(index + 1, commands, deepCount);   }   if (result >= MOD) {   result -= MOD;   }   if (result < 0) {   result += MOD;   }   return dp[index][deepCount] = (int) result;  }  }  }  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 String readString() {  int c = read();  while (isSpaceChar(c)) {   c = read();  }  StringBuilder res = new StringBuilder();  do {   if (Character.isValidCodePoint(c)) {   res.appendCodePoint(c);   }   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  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 String next() {  return readString();  }  public int nextInt() {  return readInt();  }  public interface SpaceCharFilter {  public boolean isSpaceChar(int ch);  }  } }
3	public class TaskA { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  Set<Integer> set = new HashSet<>();  for (int i = 0; i < n; i++) {   int a = sc.nextInt();   boolean flag = false;   List<Integer> toRemove = new ArrayList<>();   for (int b : set) {    if (a % b == 0) {     flag = true;     break;    } else if (b % a == 0 && a < b) {     toRemove.add(b);    }   }   for (int r: toRemove) {    set.remove(r);   }   if (!flag) {    set.add(a);   }  }  System.out.println(set.size()); } }
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;  } }
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();   boolean[] k = new boolean[n];   for (int r = 0; r < n; r++) {    k[r] = sc.next().charAt(0) == 'f';   }   if (k[n - 1]) {    out.println(0);    return;   }   long[][] res = new long[n + 1][n + 1];   res[0][0] = 1;   for (int t = 0; t < n; t++) {    boolean pl = t != 0 && k[t - 1];    if (pl) {     System.arraycopy(res[t], 0, res[t + 1], 1, n);    } else {     long last = 0;     for (int f = n; f >= 0; f--) {      last += res[t][f];      last %= M2;      res[t + 1][f] = last;     }    }   }   long pp = 0;   for (long kk : res[n]) {    pp += kk;    pp %= M2;   }   out.println(pp);  }  private static void initData() {   }  static char[][] data;  static String cmd;  private static final class STree {   private final Comparator<Integer> comparator;   int[] val1;   int[] from1;   int[] to1;   int[] max1;   public STree(int c, Comparator<Integer> comparator) {    this.comparator = comparator;    int size = Integer.highestOneBit(c);    if (size != c) {     size <<= 1;    }    int rs = size << 1;    val1 = new int[rs];    from1 = new int[rs];    max1 = new int[rs];    to1 = new int[rs];    Arrays.fill(from1, Integer.MAX_VALUE);    for (int r = rs - 1; r > 1; r--) {     if (r >= size) {      from1[r] = r - size;      to1[r] = r - size;     }     from1[r / 2] = Math.min(from1[r / 2], from1[r]);     to1[r / 2] = Math.max(to1[r / 2], to1[r]);    }   }   public int max(int from, int to) {    return max(1, from, to);   }   private int max(int cur, int from, int to) {    if (cur >= val1.length) return -1;    if (from <= from1[cur] && to1[cur] <= to) {     return max1[cur];    }    if (from1[cur] > to || from > to1[cur]) {     return -1;    }    cur <<= 1;    return max0(max(cur, from, to), max(cur + 1, from, to));   }    public void put(int x, int val) {    x += val1.length >> 1;    val1[x] = val;    max1[x] = val;    addToParent(x);   }    private void addToParent(int cur) {    while (cur > 1) {     cur >>= 1;     max1[cur] = max0(max1[cur << 1], max1[1 + (cur << 1)]);    }   }   private int max0(int i, int i1) {    if (i == -1) return i1;    if (i1 == -1) return i;    return comparator.compare(i, i1) > 0 ? i1 : i;   }  }   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());   }  }  }
6	public class G1 { public static void main(String[] args) throws Exception {  new G1().run();  }  int MOD = 1_000_000_007; public void run() throws Exception {  FastScanner f = new FastScanner();   PrintWriter out = new PrintWriter(System.out);   int n = f.nextInt(), t = f.nextInt();   int[][] dp = new int[1 << n][3];   int[] tarr = new int[n];   int[] garr = new int[n];   for(int i = 0; i < n; i++) {    tarr[i] = f.nextInt();    garr[i] = f.nextInt()-1;    if(tarr[i] <= t) dp[1 << i][garr[i]] = 1;   }   int[] time = new int[1 << n];   for(int i = 0; i < dp.length; i++) {    for(int bi = 0; bi < n; bi++)     if((i & 1 << bi) != 0) time[i] += tarr[bi];   }   for(int i = 0; i < dp.length; i++) {    int j = time[i];     for(int k = 0; k < 3; k++) {      if(dp[i][k] == 0) continue;      for(int bi = 0; bi < n; bi++)       if(tarr[bi] + j <= t && (i & 1 << bi) == 0 && garr[bi] != k) {          dp[i | 1 << bi][garr[bi]] =           (dp[i | 1 << bi][garr[bi]] + dp[i][k]) % MOD;       }     }   }   long ans = 0;   for(int i = 0; i < dp.length; i++)    for(int j = 0; j < 3; j++)    if(time[i] == t) ans = (ans + dp[i][j]) % MOD;   out.println(ans);   out.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);   }   }  } }
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; }  }
5	public class Main implements Runnable {  private BufferedReader in;  private PrintWriter out;  private StringTokenizer st;   private void eat(String line)  {   st = new StringTokenizer(line);  }   private String next() throws IOException  {   while(!st.hasMoreTokens()) {    String line = in.readLine();    if(line == null)     return null;    eat(line);   }   return st.nextToken();  }   private int nextInt() throws IOException  {   return Integer.parseInt(next());  }   public void run()  {   try {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(new OutputStreamWriter(System.out));    eat("");       go();       out.close();   } catch(Exception e) {    e.printStackTrace();    System.exit(-1);   }  }   public static void main(String[] args)  {   new Thread(new Main()).start();  }   public void go() throws IOException  {   int n = nextInt(), t = nextInt();   int[] x = new int[n], a = new int[n];   for(int i = 0; i < n; ++i) {    x[i] = nextInt();    a[i] = nextInt();   }   out.println(new Algo().solve(n, t, x, a));  } } final class Algo {  public int solve(int n, int t, final int[] x, final int[] a)  {   Integer[] order = new Integer[n];   for(int i = 0; i < n; ++i)    order[i] = i;   Arrays.sort(order, new Comparator<Integer>() {    public int compare(Integer a, Integer b)    {     return x[a] - x[b];    }   });   int result = 2;   for(int i = 0; i + 1 < n; ++i) {    int u = order[i], v = order[i + 1];    int dist = 2 * (x[v] - x[u]) - (a[v] + a[u]);    if(dist > 2 * t)     result += 2;    else if(dist == 2 * t)     ++result;   }   return result;  } }
1	public class Main { static Scanner in = new Scanner(System.in); static PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) {  int n = in.nextInt();  int m = in.nextInt();  long boyMax = 0;  int NBoyMax = 0;  long sweets = 0;  TreeSet<Long> boyMember = new TreeSet<>();  for (int i = 0; i < n; i++) {  long input = in.nextLong();  boyMember.add(input);  if (boyMax < input) {   boyMax = input;   NBoyMax = 1;  } else if (boyMax == input) NBoyMax++;  sweets += (input * m);  }  long smallestGirl = (long) 1e8 + 1;  long sum = 0;  for (int i = 0; i < m; i++) {  long input = in.nextLong();  sum += input;  if (smallestGirl > input) smallestGirl = input;  }  if (smallestGirl < boyMember.last()) {  out.println(-1);  } else if (smallestGirl == boyMember.last()) {  sweets += sum - boyMember.last() * m;  out.println(sweets);  } else {   if (NBoyMax > 1) {   sweets += sum - boyMember.last() * m;   out.println(sweets);  } else {   Object[] boyList = boyMember.toArray();   if (boyList.length > 1) {   long boy = 0;   boy = (long)boyList[boyList.length - 2];   sweets += (sum - smallestGirl - boyMember.last() * (m - 1));   sweets += (smallestGirl - boy);   out.println(sweets);   } else {   out.println(-1);   }  }  }  in.close();  out.close(); } }
4	public class A {  public static void main(String[] args) throws IOException{   Scanner sc = new Scanner(System.in);   String s = sc.next();   int n = s.length();   for (int i = n; i >= 1; i--) {    Set<String> set = new HashSet<String>();    for (int j = 0; j < n-i+1; j++) {     String t = s.substring(j, j+i);     if (set.contains(t)) {      System.out.println(i);      return;     }     set.add(t);    }   }   System.out.println(0);  }  }
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(); } }
6	public class Main {  public static void main(String[] args) {     Scanner in = new Scanner(System.in);   int n = in.nextInt();   int m = in.nextInt();     boolean[][] graph = new boolean[n][n];     for(int i = 0; i < m; i++) {    int from = in.nextInt() - 1;    int to = in.nextInt() - 1;    graph[from][to] = true;    graph[to][from] = true;   }   int max = 1 << n;   long[][] dp = new long[max][n];   for(int mask = 1; mask < max; mask++) {    for(int i = 0; i < n; i++) {     int countMask = Integer.bitCount(mask);     boolean existSubSeti = (mask & (1 << i)) > 0;     if(countMask == 1 && existSubSeti) {      dp[mask][i] = 1;     }     else if(countMask > 1 && existSubSeti) {      int mask1 = mask ^ (1 << i);      for(int j = 0; j < n; j++) {       if(((mask1 & (1 << j)) > 0) && graph[j][i] && i != firstMask(mask, n)) {        dp[mask][i] += dp[mask1][j];       }      }     }    }   }     long counter = 0;   for(int mask = 1; mask < max; mask++) {    for(int i = 0; i < n; i++) {     if(Integer.bitCount(mask) >= 3 && graph[firstMask(mask, n)][i]) {      counter += dp[mask][i];     }    }      }   System.out.println(counter / 2);   in.close();  }   public static int firstMask(int mask, int n) {   for(int i = 0; i < n; i++) {    if((mask & (1 << i)) > 0) return i;   }   return -1;    } }
2	public class Solution {  public static void main (String[] args) throws IOException {   boolean online = "true".equals(System.getProperty("ONLINE_JUDGE"));   if (online) {    in = new InputReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);   }   else {    in = new InputReader(new FileReader("input.txt"));    out = new PrintWriter(new File("output.txt"));   }     new Solution().run();     out.close();  }   long sum (int x) {   return x * 1l * (x+1) / 2;  }   int bins (long n, int k) {   int l = 1,    r = k;   while (l < r) {    int w = (l+r)/2;    long s = sum(k) - sum(w-1);    if (s == n)     return w;    if (s < n)     r = w;    else     l = w+1;   }   return l;  }   private void run () {   long n = in.nextLong();   int k = in.nextInt();   if (n == 1) {    out.println(0);    return;   }   if (1 + sum(k-1) < n) {    out.println(-1);    return;   }   int c = bins(n-1,k-1);   if (1 + sum(k-1) - sum(c-1) == n)    out.println(k-c);   else    out.println(k-c+1);  }   private static InputReader in;  private static PrintWriter out; } class InputReader {  public InputReader (Reader r) {   buff = new BufferedReader(r);   try {    str = new StringTokenizer(buff.readLine());   } catch (IOException e) {    e.printStackTrace();   }  }   public String next () {   while (!str.hasMoreTokens())    try {     str = new StringTokenizer(buff.readLine());    } catch (IOException e) {     e.printStackTrace();    }   return str.nextToken();  }   public int nextInt () {   return Integer.parseInt(this.next());  }   public long nextLong () {   return Long.parseLong(this.next());  }   private static BufferedReader buff;  private static StringTokenizer str; }
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);  TaskB solver = new TaskB();  solver.solve(1, in, out);  out.close(); } } class TaskB {  public void solve(int testNumber, InputReader in, PrintWriter out) {   long N = in.nextLong();   long K = in.nextLong();   if(N == 1) {    out.println(0);    return;   }   if(N <= K) {    out.println(1);    return;   }   long st = 1;   long dr = K - 1;   long m;   long ans = -1;   while(st <= dr) {    m = (st + dr) / 2;    if(get(m, K) <= N) {     ans = m;     st = m + 1;    }    else dr = m - 1;   }   N -= get(ans, K);   if(ans == -1 || (ans == K - 1 && N > 0) ) {    out.println(-1);    return;   }   if(N > 0)    ans++;   out.println(ans);  }  private long get(long p, long K) {   long sum = (K - p + 1 + K) * p / 2;   long extra = p - 1;   return sum - extra;  } } 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 long nextLong() {   return Long.parseLong(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 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; } }
2	public class ProblemB { public static void main(String[] args) throws IOException {   ProblemB solver = new ProblemB();  solver.init();  solver.solve(); }  private void init() {   }  private void solve() throws IOException {    Reader in = new Reader(System.in);  PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));   int n = in.nextInt();  int x = in.nextInt();  int y = in.nextInt();  int c = in.nextInt();   long lo = 0;  long hi = 2 * n;   while (lo < hi) {  long mid = (lo + hi)/2;  long r = count(n, x , y, mid);  if (r < c) {   lo = mid + 1;  } else {   hi = mid;;  }  }  out.println(lo);  out.flush();  out.close(); }  private long count(int n, int x, int y, long steps) {  long r = 1 + 2 * steps * (1 + steps);  r -= countWall(x - 1 - steps);  r -= countWall(y - 1 - steps);  r -= countWall(n - (x + steps));  r -= countWall(n - (y + steps));  r += countCorner(steps - (x - 1) - (y - 1) - 1);  r += countCorner(steps - (y - 1) - (n - x) - 1);  r += countCorner(steps - (n - x) - (n - y) - 1);  r += countCorner(steps - (x - 1) - (n - y) - 1);   return r; }  private long countCorner(long x) {  if (x <= 0) return 0;  return x * ( x + 1) / 2; }  private long countWall(long x) {  if (x >= 0) return 0;  return x * x; }  private static class Reader {  BufferedReader reader;  StringTokenizer tokenizer;     Reader(InputStream input) {   reader = new BufferedReader(       new InputStreamReader(input) );   tokenizer = new StringTokenizer("");  }     public String next() throws IOException {   while ( ! tokenizer.hasMoreTokens() ) {        tokenizer = new StringTokenizer(      reader.readLine() );   }   return tokenizer.nextToken();  }   public int nextInt() throws IOException {   return Integer.parseInt( next() );  }    public double nextDouble() throws IOException {   return Double.parseDouble( next() );  }    public long nextLong() throws IOException {   return Long.parseLong(next());  } } }
5	public class Main{ public static void main(String[] args) throws Exception{  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));  String out = "";  String[] p = br.readLine().split("[ ]");  int n = Integer.valueOf(p[0]);  double t = Double.valueOf(p[1]);   int offset = 5000;  boolean[] flags = new boolean[offset+5000];  for(int i=0;i<n;i++){  int[] q = toIntArray(br.readLine());  int c = 2*q[0];  for(int j=-q[1];j<q[1];j++){   flags[c+offset+j] = true;     }  }  int buf = 0;  int last = -1;  int index = 0;  for(;index<flags.length;index++){  if(flags[index]){   if(last==-1){   buf++;   }else{         if(Math.abs(index-last-(2*t+1))<1e-10) buf++;   else if(index-last>2*t+1) buf+=2;   }   last = index;  }  }  buf ++;  out = ""+buf+"\r\n";  bw.write(out,0,out.length());  br.close();  bw.close(); } static int[] toIntArray(String line){  String[] p = line.trim().split("\\s+");  int[] out = new int[p.length];  for(int i=0;i<out.length;i++) out[i] = Integer.valueOf(p[i]);  return out; } }
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();  } }
6	public class EdC { static long[] mods = {1000000007, 998244353, 1000000009}; static long mod = mods[0]; public static MyScanner sc;  public static PrintWriter out;  static char[][] grid;  static int n;  static int t;  static int[][] dp;  static int[] times;  static int[] genre; public static void main(String[] omkar) throws Exception{    sc = new MyScanner();  out = new PrintWriter(System.out);  n = sc.nextInt();  t = sc.nextInt();  times = new int[n];  genre = new int[n];  for(int j =0 ;j<n;j++){   times[j] = sc.nextInt();   genre[j] = sc.nextInt();   }  dp = new int[1<<n][4];  for(int j = 0;j<1<<n;j++)   Arrays.fill(dp[j], -1);  int ans = 0;  for(int j=0;j<1<<n;j++){   int time = 0;   for(int k = 0;k<n;k++){   if (((1<<k) & j) != 0){    time+=times[k];   }   }   if (time == t){   letsgodp(j, 1);   letsgodp(j, 2);   letsgodp(j, 3);   ans+=dp[j][1];   ans%=mod;   ans+=dp[j][2];   ans%=mod;   ans+=dp[j][3];   ans%=mod;   }  }  out.println(ans);  out.close();  } public static void letsgodp(int mask, int dg){  if (dp[mask][dg] != -1)  return;  dp[mask][dg] = 0;  for(int j = 0;j<n;j++){  if (((1<<j) & mask) != 0 && genre[j] == dg){   int submask = mask - (1<<j);   int og1 = genre[j]+1 > 3 ? genre[j]-2 : genre[j]+1;   int og2 = genre[j]+2 > 3 ? genre[j]-1 : genre[j]+2;   if (submask != 0){   letsgodp(submask, og1);   letsgodp(submask, og2);   dp[mask][dg] +=(dp[submask][og1] + dp[submask][og2]);   dp[mask][dg] %=mod;   }   else{   dp[mask][dg] = 1;   }  }  } } public static void sort(int[] array){  ArrayList<Integer> copy = new ArrayList<Integer>();  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;   }    } }
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());   }  }  }
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();  }  static class TaskB {   public void solve(int testNumber, FastReader in, PrintWriter out) {    Debug debug = new Debug();    int n = in.nextInt();    int K = in.nextInt();    List<Integer>[] g = GraphUtils.nextU(in, n, n - 1, true);    int[] center = GraphUtils.getCenter(g);    if (center.length == 2) {     out.println("No");     return;    }    int[][] pars = GraphUtils.parents3(g, center[0]);    int[] par = pars[0], ord = pars[1], depth = pars[2];    int[] deg = new int[n];    for (int i = 0; i < n; ++i) deg[i] = g[i].size();    if (deg[center[0]] < 3) {     out.println("No");     return;    }        for (int i = 0; i < n; ++i) {     if (deg[i] == 1) {      if (depth[i] != K) {       out.println("No");       return;      }     } else if (i != center[0]) {      if (deg[i] < 4) {       out.println("No");       return;      }     }    }    out.println("Yes");   }  }  static class GraphUtils {   public static List<Integer>[] nextU(FastReader in, int n, int m, boolean oneIndexed) {    int diff = oneIndexed ? 1 : 0;    List<Integer>[] g = new List[n];    for (int i = 0; i < n; ++i) g[i] = new ArrayList<>();    for (int i = 0; i < m; ++i) {     int u = in.nextInt() - diff;     int v = in.nextInt() - diff;     g[u].add(v);     g[v].add(u);    }    return g;   }   public static int[][] parents3(List<Integer>[] g, int root) {    int n = g.length;    int[] par = new int[n];    ArrayUtils.fill(par, -1);    int[] depth = new int[n];    depth[0] = 0;    int[] q = new int[n];    q[0] = root;    for (int p = 0, r = 1; p < r; p++) {     int cur = q[p];     for (int nex : g[cur]) {      if (par[cur] != nex) {       q[r++] = nex;       par[nex] = cur;       depth[nex] = depth[cur] + 1;      }     }    }    return new int[][]{par, q, depth};   }   public static int[] getCenter(List<Integer>[] g) {    int n = g.length;    int[] q = new int[n];    int[] deg = new int[n];    int p = 0;    for (int i = 0; i < n; i++) {     deg[i] = g[i].size();     if (g[i].size() <= 1) {      q[p++] = i;     }    }    int bound = p == n ? 0 : p;    for (int z = 0; z < p; z++) {     if (bound == z && p < n) bound = p;     int cur = q[z];     deg[cur]--;     for (int e : g[cur]) {      if (--deg[e] == 1) q[p++] = e;     }    }    assert p == n;    assert bound >= n - 2 && bound < n;    if (bound == n - 2) {     return new int[]{q[n - 2], q[n - 1]};    } else {     return new int[]{q[n - 1]};    }   }  }  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;   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  }  static class ArrayUtils {   public static void fill(int[] array, int value) {    Arrays.fill(array, value);   }  }  static class Debug {   PrintWriter out;   boolean oj;   boolean system;   long timeBegin;   Runtime runtime;   public Debug(PrintWriter out) {    oj = System.getProperty("ONLINE_JUDGE") != null;    this.out = out;    this.timeBegin = System.currentTimeMillis();    this.runtime = Runtime.getRuntime();   }   public Debug() {    system = true;    oj = System.getProperty("ONLINE_JUDGE") != null;    OutputStream outputStream = System.out;    this.out = new PrintWriter(outputStream);    this.timeBegin = System.currentTimeMillis();    this.runtime = Runtime.getRuntime();   }  } }
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));  }  } } }
4	public class D {  public static void main(String[] args) {  FastScanner sc = new FastScanner();  int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int[][] lr = new int[n][m-1];  for(int i = 0; i < n; i++){  for(int j = 0; j < m-1; j++){   lr[i][j] = sc.nextInt();  }  }  int[][] ud = new int[n-1][m];  for(int i = 0; i < n-1; i++){  for(int j = 0; j < m; j++){   ud[i][j] = sc.nextInt();  }  }  if(k % 2 == 1) {  StringBuilder sb = new StringBuilder();  for(int i = 0; i < n; i++){   for(int j = 0; j < m; j++){   sb.append(-1+" ");   }   sb.replace(sb.length()-1, sb.length(), "\n");  }  PrintWriter pw = new PrintWriter(System.out);  pw.println(sb.toString().trim());  pw.flush();  }  else {  int[][] dir = {{0,1},{0,-1},{1,0},{-1,0}};  long[][][] dp = new long[k/2+1][n][m];  for(int s = 1; s <= k/2; s++) {   for(int i = 0; i < n; i++){   for(int j = 0; j < m; j++){    dp[s][i][j] = Long.MAX_VALUE;    for(int[] d: dir) {    int u = i + d[0], v = j + d[1];    if(u >= 0 && u < n && v >= 0 && v < m) {     long w = calc(i, j, u, v, lr, ud);     dp[s][i][j] = Math.min(dp[s][i][j], dp[s-1][u][v] + 2*w);    }    }   }   }  }  StringBuilder sb = new StringBuilder();  for(int i = 0; i < n; i++){   for(int j = 0; j < m; j++){   sb.append(dp[k/2][i][j]+" ");   }   sb.replace(sb.length()-1, sb.length(), "\n");  }  PrintWriter pw = new PrintWriter(System.out);  pw.println(sb.toString().trim());  pw.flush();  } } static long calc(int i, int j, int u, int v, int[][] lr, int[][] ud) {  if(i == u) {  return lr[i][Math.min(j, v)];  }  else {  return ud[Math.min(i, u)][j];  } }   static class Pair implements Comparable<Pair>{  int x, y;  public Pair(int x, int y) {  this.x = x; this.y = y;  }  @Override  public int compareTo(Pair p) {  if(x == p.x) return y - p.y;  else return x - p.x;  }  public String toString() {  return x+" "+y;  } } 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);  }  } } }
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); } }
3	public class C909 {  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 ar[] = new int[n+1];    int count = 1;    ar[0] = 1;    for(int i=0;i<n;i++){     char c = in.next().charAt(0);     if(c == 'f')      count++;     else{      for(int j=1;j<count;j++){       ar[j] = (ar[j] + ar[j-1])% (int)(1e9+7);      }     }     }    out.println(ar[count-1]);   }  }  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());   }   public String nextLine() {    String str = "";    try    {     str = reader.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  } }
1	public class MSpreadSheet {   public int toNum(String x)  {   int result = 0;   int pow = 0;   for (int i = x.length()-1; i >=0; i--)   {    result+=(x.charAt(i)-'A'+1)*Math.pow(26, pow);    pow++;   }   return result;  }   public String toString(int x)  {   if(x<=26) return String.valueOf((char)(x+'A'-1));   String result = "";   while(x!=0)   {    if(x%26==0)    {     result = 'Z' + result;     x = x/26 - 1;    }    else    {     result = (char)((x%26)+'A'-1) + result;     x = x/26;    }      }   return result;  }   public boolean check(String x)  {   if(x.charAt(0)!='R') return false;   int in = x.indexOf('C');   if(in==-1) return false;   if(Character.isDigit(x.charAt(in-1))&&Character.isDigit(x.charAt(in+1))) return true;   return false;  }   public void solve(String x)  {   String r="";   String c="";   if(check(x))   {    int in = x.indexOf('C');    r = x.substring(1,in);    c = x.substring(in+1);    System.out.println(toString(Integer.parseInt(c))+r);   }   else   {    int i =0;    while(!Character.isDigit(x.charAt(i)))      c+=x.charAt(i++);    while(i<x.length())     r+=x.charAt(i++);    System.out.println("R"+r+"C"+toNum(c));   }  }   public static void main(String[] args) {   MSpreadSheet sh = new MSpreadSheet();   Scanner s = new Scanner(System.in);   int n = s.nextInt();   int i = 0;   while(i<n)   {    sh.solve(s.next());    i++;   }  } }
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 Main{   static BigInteger n, x, y, c; static BigInteger mk[] = new BigInteger[8]; public static BigInteger f(BigInteger t) {  return t.multiply(t); }  public static BigInteger g(BigInteger t) {  return t.multiply(t.add(BigInteger.ONE)).shiftRight(1); }  public static int solve(BigInteger z) {  BigInteger ret = z.multiply(z.add(BigInteger.ONE)).shiftLeft(1);  ret = ret.add(BigInteger.ONE);   for(int i = 0; i < 8; i += 2) {  if(z.compareTo(mk[i]) > 0) {   ret = ret.subtract(f(z.subtract(mk[i])));  }  }  for(int i = 1; i < 8; i += 2) {  if(z.compareTo(mk[i]) > 0) {   ret = ret.add(g(z.subtract(mk[i])));  }  }   if(ret.compareTo(c) >= 0) return 1;  return 0; } public static void main(String[] args) {   Scanner cin = new Scanner(System.in);  while(cin.hasNext()) {  n = cin.nextBigInteger();  x = cin.nextBigInteger();  y = cin.nextBigInteger();  c = cin.nextBigInteger();  mk[0] = x.subtract(BigInteger.ONE);  mk[2] = n.subtract(y);  mk[4] = n.subtract(x);  mk[6] = y.subtract(BigInteger.ONE);  mk[1] = mk[0].add(mk[2]).add(BigInteger.ONE);  mk[3] = mk[2].add(mk[4]).add(BigInteger.ONE);  mk[5] = mk[4].add(mk[6]).add(BigInteger.ONE);  mk[7] = mk[6].add(mk[0]).add(BigInteger.ONE);  BigInteger beg = BigInteger.ZERO, end = mk[0], mid;  for(int i = 1; i < 8; ++i) if(end.compareTo(mk[i]) < 0) end = mk[i];  while(beg.compareTo(end) < 0) {   mid = beg.add(end).shiftRight(1);   if(solve(mid) == 1) end = mid;   else beg = mid.add(BigInteger.ONE);  }  System.out.println(end);  }  } }
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);   }  } }
2	public class Test5{  static long mod=1000000007;  public static void main(String[] z) throws Exception{   Scanner s = new Scanner(System.in);   long a = s.nextLong(), b=s.nextLong(), c=(a*2-1)%mod, i=binpow(2,b)%mod;   System.out.println(a<1 ? a : (c*i+1)%mod);  }  static long binpow(long c, long step){   if(step==0) return 1;   if(step==1) return c%mod;   if(step%2<1){    return binpow(((c%mod)*(c%mod))%mod, step/2)%mod;   }   else{    return (c%mod)*(binpow(c%mod, step-1)%mod);   }  }  static class PyraSort {   private static int heapSize;   public static void sort(int[] a) {    buildHeap(a);    while (heapSize > 1) {     swap(a, 0, heapSize - 1);     heapSize--;     heapify(a, 0);    }   }   private static void buildHeap(int[] a) {    heapSize = a.length;    for (int i = a.length / 2; i >= 0; i--) {     heapify(a, i);    }   }   private static void heapify(int[] a, int i) {    int l = 2 * i + 2;    int r = 2 * i + 1;    int largest = i;    if (l < heapSize && a[i] < a[l]) {     largest = l;    }    if (r < heapSize && a[largest] < a[r]) {     largest = r;    }    if (i != largest) {     swap(a, i, largest);     heapify(a, largest);    }   }   private static void swap(int[] a, int i, int j) {    a[i] ^= a[j] ^= a[i];    a[j] ^= a[i];   }  } }
2	public class Codeforces {   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 input = new FastReader();   long n = input.nextLong();   long K = input.nextLong();   long root = (long) Math.sqrt(8 * (K+n) + 9);   if (root * root != 8 * (K+n) + 9){    root++;    if (root * root != 8 * (K+n) + 9) root -= 2;   }   System.out.println(n - (root - 3) / 2);       } }
3	public class Ideone {  public static void main(String args[] ) throws Exception{   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int n,i,j,k,temp ;   n = ni(br.readLine());   int[] a = nia(br);   Arrays.sort(a);   int c = 0;   for( i = 0; i< n ; i++) {   if(a[i] > 0) {    c++;    temp = a[i];    for(j = i+1; j< n; j++) {    if(a[j] % temp == 0)     a[j] = 0;    }   }   }        System.out.println(c);   }  static Integer[] nIa(BufferedReader br) throws Exception{   String sa[]=br.readLine().split(" ");   Integer [] a = new Integer [sa.length];   for(int i = 0; i< sa.length; i++){    a[i]= ni(sa[i]);   }   return a;  }  static int[] nia(BufferedReader br) throws Exception{   String sa[]=br.readLine().split(" ");   int [] a = new int [sa.length];   for(int i = 0; i< sa.length; i++){    a[i]= ni(sa[i]);   }   return a;  }   static int ni(String s){   return Integer.parseInt(s);  }  static float nf(String s){   return Float.parseFloat(s);  }  static double nd(String s){   return Double.parseDouble(s);  }  }
3	public class Main implements Runnable {  boolean multiiple = false;  void solve() throws Exception  {   int n = sc.nextInt();   ArrayList<Integer> list = new ArrayList<>();   for (int i = 0; i < n; i++)    list.add(sc.nextInt());   Collections.sort(list);   int ans = 0;   while (!list.isEmpty())   {    ans++;    int next = list.get(0);    for (int i = list.size() - 1; i >= 1; i--)    {     if (list.get(i) % next == 0)      list.remove(i);    }    list.remove(0);   }   System.out.println(ans);  }  @Override  public void run()  {   try   {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    sc = new FastScanner(in);    if (multiiple)    {     int q = sc.nextInt();     for (int i = 0; i < q; i++)      solve();    }    else     solve();   }   catch (Throwable uncaught)   {    Main.uncaught = uncaught;   }   finally   {    out.close();   }  }  public static void main(String[] args) throws Throwable {   Thread thread = new Thread(null, new Main(), "", (1 << 26));   thread.start();   thread.join();   if (Main.uncaught != null) {    throw Main.uncaught;   }  }  static Throwable uncaught;  BufferedReader in;  FastScanner sc;  PrintWriter out; } class FastScanner {  BufferedReader in;  StringTokenizer st;  public FastScanner(BufferedReader in)  {   this.in = in;  }  public String nextToken() throws Exception {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  public int nextInt() throws Exception {   return Integer.parseInt(nextToken());  }  public long nextLong() throws Exception {   return Long.parseLong(nextToken());  }  public double nextDouble() throws Exception {   return Double.parseDouble(nextToken());  } }
0	public class A {   public static void main(String[] args) {  Account acnt = new Account();  acnt.solve();  acnt.print(); } } class Account {  Account() {  Scanner scr = new Scanner(System.in);  n = scr.nextInt(); }  void solve() {  if (n > 0) {  ans = n;  }  else {  int nn = -n;  int ans1 = nn/10;  int ans2 = nn % 10 + (nn/100)*10;  if (ans1 < ans2){   ans = -ans1;  }  else {   ans = -ans2;  }  }   }  void print(){  System.out.println(ans); }  int ans; int n; }
6	public class Main { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  while ( sc.hasNextInt() ) {  int n = sc.nextInt();  long m = sc.nextInt();  boolean edge[][] = new boolean[n][n];  long dp[][] = new long[1<<n][n];  for ( long i = 1 ; i<=m ; ++i ) {   int u = sc.nextInt();    int v = sc.nextInt();   -- u;   -- v;   edge[u][v] = edge[v][u] = true;  }  for ( int i = 0 ; i<n ; ++i ) {   dp[1<<i][i] = 1;  }  long res = 0;  for ( int i = 1 ; i<(1<<n) ; ++i ) {   int first = cal(i);   for ( int j = 0 ; j<n ; ++j ) {   if ( dp[i][j]==0 ) {    continue;   }   for ( int k = first ; k<n ; ++k ) {    if ( j==k || !edge[j][k] ) {    continue;    }    if ( k==first && (i&(1<<k))!=0 ) {    res += dp[i][j];    }    if ( (i&(1<<k))==0 ) {    dp[i|(1<<k)][k] += dp[i][j];    }   }   }  }  res -= m;  System.out.println(res/2);   } } public static int cal( int x ) {  int ord = 0;  while ( true ) {  if ( (x&(1<<ord))!=0 ) {   break;  }  ++ ord;  }  return ord; } public static boolean judge( int x ) {  int cnt = 0;  while ( x>=1 ) {  if ( (x&1)==1 ) {   ++ cnt;  }  x >>= 1;  }  return cnt >= 3; } }
0	public class D { public static void main(String args[]) {  int n;  Scanner in = new Scanner (System.in);  n= in.nextInt();  if (n%4==0 || n%7==0 || n%44==0 || n%47==0 || n%444==0 || n%447==0 ||   n%474==0 || n%477==0 || n%744==0 || n%747==0 || n%774==0 || n%777==0)   System.out.println("YES"); else System.out.println("NO"); } }
1	public class Main implements Runnable {  public void _main() throws IOException {  int n = nextInt();  int[] a = new int[n];  String s = next();  for (int i = 0; i < n; i++)  a[i] = s.charAt(i) == 'H' ? 1 : 0;  int res = 10 * n;  for (int i = 0; i < n; i++) {  int[] b = new int[n];  for (int j = 0; j < n; j++)   b[j] = a[(i + j) % n];  res = Math.min(res, solve(b, 0));  res = Math.min(res, solve(b, 1));  }  out.print(res); }  private int solve(int[] a, int x) {  int n = a.length;   int j;  for (j = n - 1; j >= 0; j--)  if (a[j] == x)   break;  if (a[j] != x) return 0;  int res = 0;  for (int i = 0; i < j; i++)  if (a[i] != x) {   --j;   while (j >= i && a[j] != x)   --j;   ++res;  }  return res; }  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) {  Locale.setDefault(Locale.UK);  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);  } } }
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();  }     }
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 {   }
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; } }
5	public class Main {  private void solve() {   int n = in.nextInt();   int k = in.nextInt();   final int[] p = new int[n];   final int[] t = new int[n];   for(int i =0 ; i < n; ++i) {    p[i] = in.nextInt();    t[i] = in.nextInt();   }   Integer[] ord = new Integer[n];   for(int i = 0; i < n; ++i)    ord[i] = i;   for(int i = 0; i < n; ++i) {    for(int j = 0; j < n - 1; ++j) {     if (Less(ord[j], ord[j + 1], p, t)) {      Integer tx = ord[j];      ord[j] = ord[j + 1];      ord[j + 1] = tx;     }    }   }          for(int i = 0, j = 0; i < n; i = j) {    for(j = i; j < n && p[ord[i]] == p[ord[j]] && t[ord[i]] == t[ord[j]]; ++j) ;    int first = i+1;    int second = j;    if (first <= k && k <= second) {     out.print(j - i);     return ;    }   }   out.print(0);  }  private boolean Less(Integer i, Integer j, int[] p, int[] t) {   return p[i] < p[j] || p[i] == p[j] && t[i] > t[j];  }  private void run() {   try {    in = new FastScanner();    out = new PrintWriter(new OutputStreamWriter(System.out));    solve();    out.flush();   } catch (Exception e) {    e.printStackTrace();   }  }   public static void main(String[] args) {   new Main().run();  }  FastScanner in;  PrintWriter out;  class FastScanner {   public BufferedReader reader;   private StringTokenizer tokenizer;   public FastScanner(String file) {    try {     reader = new BufferedReader(new FileReader(new File(file)));     tokenizer = null;    } catch (FileNotFoundException e) {     e.printStackTrace();    }   }     public FastScanner() {    try {     reader = new BufferedReader(new InputStreamReader(System.in));     tokenizer = null;    } catch (Exception e) {     e.printStackTrace();    }   }   public String nextToken() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (Exception e) {      e.printStackTrace();     }    }    return tokenizer.nextToken();   }   int nextInt() {    return Integer.parseInt(nextToken());   }   long nextLong() {    return Long.parseLong(nextToken());   }  } }
2	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 MOD = (int) 1e9 + 7;   public void solve(int testNumber, InputReader in, OutputWriter out) {    long x = in.nextLong(), k = in.nextLong();    long res = Utilities.mul(x, Utilities.power(2, k + 1, MOD), MOD) % MOD - Utilities.power(2, k, MOD) + 1;    while (res < 0) res += MOD;    out.println(x == 0 ? 0 : 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 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 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 close() {    writer.close();   }   public void println(long i) {    writer.println(i);   }  }  static class Utilities {   public static long mul(long x, long y, long mod) {    return (x % mod) * (y % mod) % mod;   }   public static long power(long a, long k, long m) {    long res = 1;    while (k > 0) {     if ((k & 1) != 0) {      res = mul(res, a, m);     }     a = mul(a, a, m);     k >>= 1;    }    return res;   }  } }
2	public class algo93 {  public static void main(String args[])  {   Scanner ex=new Scanner(System.in);   long x=ex.nextLong();   long k=ex.nextLong();   long mod=1000000007;   if(k==0)   System.out.println((2*x)%mod);   else if(x==0)   System.out.println("0");   else   {    long pow=power(2,k);    long pow1=(2*pow)%mod;    long ans=(pow1*(x%mod))-pow+1;    if(ans<0)    ans=ans+mod;    ans=ans%mod;    System.out.println(ans);   }  }  public static long power(long x,long y)  {   if (y == 0)   return 1;   long mod=1000000007;   long pow=power(x,y/2);   pow=(pow*pow)%mod;   if(y%2==0)   return pow;   else   return ((x%mod)*pow)%mod;  } }
5	public class VK2A {  public static void main(String args[])  {   Scanner S = new Scanner(System.in);   int n = S.nextInt();   int a = S.nextInt();   int b = S.nextInt();   int[] A = new int[n];   for(int i = 0; i < n; i++)    A[i] = S.nextInt();   for(int i = 0; i < n; i++)    for(int j = 0; j < n - i - 1; j++)    {     if(A[j] < A[j + 1])     {      int temp = A[j];      A[j] = A[j + 1];      A[j + 1] = temp;     }    }      System.out.println(A[a - 1] - A[a]);   }  }
0	public class A {  public static void main(String[] args) throws Throwable {  new A().go(); }  void p(String s) {  System.out.println(s); }  void go() throws Throwable {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  String[] t = in.readLine().split(" ");  long a = Long.parseLong(t[0]), b = Long.parseLong(t[1]);  long mv = 0;  while (a > 1 && b > 1) {  if (a > b) {   long tt = a;   a = b;   b = tt;  }  mv += b / a;  b %= a;  }  System.out.println(mv + Math.max(a, b)); } }
0	public class lukno {  public static void main (String args[])  {   Scanner i= new Scanner(System.in);   int n,p;        n=i.nextInt(); int t=n;   while(n!=0)   {    p=n%10;    if(p!=4||p!=7)    { if(t%7==0||t%4==0||t%47==0||t%74==0||t%447==0||t%477==0||t%474==0)     System.out.print("YES");     else System.out.print("NO");    break;}    else System.out.print("NO");       n=(n/10);    }     } }
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();  }   }
4	public class A {  public void run() {   Scanner sc = new Scanner(System.in);   String s = sc.next();   int n = s.length();   String[] ss = new String[n];   for (int i = 0; i < n; i++)    ss[i] = s.substring(i);   sort(ss);   int res = 0;   for (int i = 1; i < n; i++)    res = max(res, count(ss[i - 1], ss[i]));   System.out.println(res);  }  int count(String s, String t) {   int ret = 0;   for (int i = 0; i < min(s.length(), t.length()); i++)    if (s.charAt(i) != t.charAt(i))     return ret;    else     ret++;   return ret;  }  void debug(Object... os) {   System.err.println(Arrays.deepToString(os));  }  public static void main(String... args) {   new 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);   OutputWriter out = new OutputWriter(outputStream);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt(), d = in.nextInt();    long a[] = in.parseLong1D(n);    int cnt = 0;    HashSet<Long> ans = new HashSet<>();    for (long v : a) {     long c = v - d;     if (isPos(a, c, d)) ans.add(c);     c = v + d;     if (isPos(a, c, d)) ans.add(c);    }    out.println(ans.size());   }   private boolean isPos(long a[], long c, long d) {    for (long v : a) {     if (Math.abs(v - c) < d) return false;    }    return true;   }  }  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 close() {    writer.close();   }   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 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 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 nextInt() {    return readInt();   }   public long[] parseLong1D(int n) {    long r[] = new long[n];    for (int i = 0; i < n; i++) {     r[i] = readLong();    }    return r;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
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(); } }
6	public class E {  public static void main(String[] args) {   FastScanner scanner = new FastScanner();   PrintWriter out = new PrintWriter(System.out, false);   int t = scanner.nextInt();   while(t-->0) {    int n = scanner.nextInt();    int m = scanner.nextInt();    int[][] cols = new int[m][n];    for(int i = 0; i < n; i++) {     for(int j =0; j < m; j++) {      cols[j][i] = scanner.nextInt();     }    }    int maxMask = 1 << n;    int[] dp = new int[maxMask];    Arrays.fill(dp, -1);    dp[0] = 0;    for(int i = 0; i < m; i++) {     for(int mask = maxMask-1; mask>=0; mask--) {      int[] arr = cols[i].clone();      for(int j = 0; j < n; j++) {       for(int smask = mask; smask >= 0; smask = (smask-1)&mask) {        if (dp[smask] == -1) continue;        int add = 0;        for(int k = 0; k < n; k++) {         if (((mask^smask)&(1 << k)) > 0) add += arr[k];        }        dp[mask] = Math.max(dp[mask], dp[smask] + add);        if (smask == 0) break;       }       arr = shift(arr);      }     }    }    out.println(dp[maxMask-1]);   }   out.flush();  }  static int[] shift (int[] a) {   int[] b = new int[a.length];   b[0] = a[a.length-1];   for(int i = 0; i < a.length-1; i++) {    b[i+1] = a[i];   }   return b;  }  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;   }  } }
1	public class Main { private static Scanner in = new Scanner(System.in); public static void main(String args[]){  int n = in.nextInt();  String s = in.next();  if(n==1)  System.out.println("1");  else{  int j=0,i=1,ans=s.length();  int h[]=new int[128];  h[(int)s.charAt(0)]=1;  while(i<n){   if(h[(int)s.charAt(i)]==0)   ans = i-j+1;   h[(int) s.charAt(i)]++;   while(j<i && h[(int)s.charAt(j)]>1){   h[(int)s.charAt(j)]--;   j++;   ans = Math.min(ans, i-j+1);   }   i++;  }  System.out.println(ans);  } } }
0	public class lukno {  public static void main (String args[])  {   Scanner i= new Scanner(System.in);   int n,p;     n=i.nextInt(); int t=n;   if(t%4==0||t%7==0||t%47==0||t%74==0||t%44==0||t%447==0||t%474==0||t%477==0)     System.out.print("YES");     else System.out.print("NO");       } }
3	public class C { static char[] arr; static int mod = (int) 1e9 + 7; static int[][] memo; static int n;  static int solve(int idx, int depth) {  if (idx == n) {  return depth == 0 ? 1 : 0;  }  if (memo[idx][depth] != -1)  return memo[idx][depth];  int ret = 0;  if (arr[idx] == 's') {  if (depth > 0)   ret = ret + solve(idx, depth - 1);  ret = (ret + solve(idx + 1, depth)) % mod;  }  if (arr[idx] == 'f' || arr[idx] == 'z')  ret = (ret + solve(idx + 1, depth + 1)) % mod;  return memo[idx][depth] = ret; }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  n = sc.nextInt();  arr = new char[n];  for (int i = 0; i < n; i++)  arr[i] = sc.next().charAt(0);  memo = new int[n + 1][n + 1];  for (int[] x : memo)  Arrays.fill(x, -1);  System.out.println(solve(0, 0)); }  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();  } } }
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");  }  }
5	public class main {   public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int houses = sc.nextInt();   int size = sc.nextInt();   hizzy[] array = new hizzy[houses];   long total =2;   for(int a=0;a<houses;a++)array[a]=new hizzy(sc.nextInt(),sc.nextInt());   Arrays.sort(array);   for(int a=0;a<houses-1;a++){    double L = array[a].loc+array[a].size/2;    double R = array[a+1].loc-array[a+1].size/2;    if(R-L>size)total+=2;    else if((R-L)==size)total++;   }   System.out.println(total);  }  } class hizzy implements Comparable{  double loc;  double size;  hizzy(double l, double s){   this.loc=l;   this.size=s;  }   public int compareTo(Object o) {   hizzy other = (hizzy) o;   return (int) (this.loc-other.loc);  }  }
2	public class R489C {  static long m = (long)(1e9+7);   public static void main(String[] args) {  JS scan = new JS();  long n = scan.nextLong();  long k = scan.nextLong();  if(n == 0) {  System.out.println(0);  return;  }  if(k == 0) {  long ans = (n%m)*(2%m)%m;  System.out.println(ans%m);  return;  }   long coeff = power(2L, k+1, m);   long r = (coeff%m)*(n%m)%m;   long x = power(2L, k, m)%m-1;  if(x < 0) x += m;  long ans = r-x;  if(ans < 0) ans += m;  System.out.println(ans%m); }  static long power(long x, long y, long p){    long res = 1;            x = x % p;     while (y > 0){           if((y & 1)==1)     res = (res%p * x%p) % p;            y = y >> 1;    x = (x%p * x%p) % p;   }   return res;  }    static class JS{  public int BS = 1<<16;  public char NC = (char)0;  byte[] buf = new byte[BS];  int bId = 0, size = 0;  char c = NC;  double num = 1;  BufferedInputStream in;  public JS() {  in = new BufferedInputStream(System.in, BS);  }  public JS(String s) throws FileNotFoundException {  in = new BufferedInputStream(new FileInputStream(new File(s)), BS);  }  public char nextChar(){  while(bId==size) {   try {   size = in.read(buf);   }catch(Exception e) {   return NC;   }     if(size==-1)return NC;   bId=0;  }  return (char)buf[bId++];  }  public int nextInt() {  return (int)nextLong();  }  public long nextLong() {  num=1;  boolean neg = false;  if(c==NC)c=nextChar();  for(;(c<'0' || c>'9'); c = nextChar()) {   if(c=='-')neg=true;  }  long res = 0;  for(; c>='0' && c <='9'; c=nextChar()) {   res = (res<<3)+(res<<1)+c-'0';   num*=10;  }  return neg?-res:res;  }  public double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }  public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }  public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  } } }
5	public class A {  public static void main(String[] args)  {  new A(new Scanner(System.in));  }  public A(Scanner in)  {  int n = in.nextInt();  int t = in.nextInt();  int tt = 2*t;   rect[] rs = new rect[n];  for (int i=0; i<n; i++)   rs[i] = new rect(in.nextInt(), in.nextInt());    Arrays.sort(rs);   int res = 2;  for (int i=1; i<n; i++)  {   rect a = rs[i-1];   rect b = rs[i];   int d = b.p-a.p;   int dd = a.t+b.t;   int tv = 2*d-dd;   if (tt == tv)    res++;   if (tv > tt)    res+=2;  }  System.out.printf("%d%n", res);  } } class rect implements Comparable<rect> {  int p;  int t;  public rect(int pp, int tt)  {  p = pp;  t = tt;  }  public int compareTo(rect rhs)  {  return p-rhs.p;  } }
3	public final class PythonIndentation { public static void main(String[] args) {  new PythonIndentation(System.in, System.out); }  static class Solver implements Runnable {  static final int MOD = (int) 1e9 + 7;  int n;  char[] arr;  long[][] dp;  BufferedReader in;  PrintWriter out;  void solve() throws IOException  {  n = Integer.parseInt(in.readLine());  arr = new char[n];  dp = new long[n + 1][n + 1];   for (int i = 0; i < n; i++)   arr[i] = in.readLine().charAt(0);   for (int i = 0; i <= n; i++)   Arrays.fill(dp[i], -1);   dp[0][0] = 1;   if (arr[0] == 's')   out.println(find(1, 0));  else   out.println(find(1, 1));  }  long find(int curr, int backIndents)  {  if (backIndents < 0)   return 0;   if (curr == n)   return 1;   if (dp[curr][backIndents] != -1)   return dp[curr][backIndents];   long ans;   if (arr[curr] == 's')   ans = find(curr + 1, backIndents);  else   ans = find(curr + 1, backIndents + 1);   if (arr[curr - 1] != 'f')   ans = CMath.mod(ans + find(curr, backIndents - 1), MOD);   return dp[curr][backIndents] = ans;  }  public Solver(BufferedReader in, PrintWriter out)  {  this.in = in;  this.out = out;  }  @Override public void run()  {  try  {   solve();  }  catch (IOException e)  {   e.printStackTrace();  }  }  }  static class CMath {  static long mod(long number, long mod)  {  return number - (number / mod) * mod;  }  }  private PythonIndentation(InputStream inputStream, OutputStream outputStream) {  BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));  PrintWriter out = new PrintWriter(outputStream);  Thread thread = new Thread(null, new Solver(in, out), "PythonIndentation", 1 << 29);  try  {  thread.start();  thread.join();  }  catch (InterruptedException e)  {  e.printStackTrace();  }  finally  {  try  {   in.close();  }  catch (IOException e)  {   e.printStackTrace();  }   out.flush();  out.close();  } } }
1	public final class CF {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   ArrayList<String> a = new ArrayList<>();   for(int i = 0; i<n; i++)    a.add(sc.next());   int count = 0;   for(int i = 0; i<n; i++) {    String b = sc.next();    int idx = a.indexOf(b);    if(idx!=-1)     a.remove(idx);    else     count++;   }   System.out.println(count);  } }
4	public class Main {   public static void main(String[] args) throws IOException{   Scanner scan = new Scanner("input.txt");  PrintWriter out = new PrintWriter(new FileWriter("output.txt"));   int n,m;  n = scan.nextInt();  m = scan.nextInt();  boolean visited[][] = new boolean[n][m];   int numOfStartingPoints;  numOfStartingPoints = scan.nextInt();     int resX = 0, resY = 0;   Queue<Point> que = new LinkedList<Point>();  for (int i = 0; i < numOfStartingPoints; i++) {  int x = scan.nextInt() - 1;  int y = scan.nextInt() - 1;  que.add(new Point(x, y));  visited[x][y] = true;  }   while (true) {  Point current = que.poll();   if (current == null) {   break;  } else {   resX = current.x;   resY = current.y;     if (current.x + 1 < n && !visited[current.x + 1][current.y])   {   que.add(new Point(current.x + 1, current.y));   visited[current.x + 1][current.y] = true;    }   if (current.y + 1 < m && !visited[current.x][current.y + 1])   {   que.add(new Point(current.x, current.y + 1));   visited[current.x][current.y + 1] = true;     }   if (current.x - 1 >= 0 && !visited[current.x - 1][current.y])   {   que.add(new Point(current.x - 1, current.y));   visited[current.x - 1][current.y] = true;     }   if (current.y - 1 >= 0 && !visited[current.x][current.y - 1])   {   que.add(new Point(current.x, current.y - 1));   visited[current.x][current.y - 1] = true;     }     }  }     out.printf("%d %d\n", ++resX, ++resY);  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();}  } }
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(); } }
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);  } }
5	public class TaskA {  class Contest implements Comparable<Contest>  {   int problems;   int penalty;   Contest (int problems, int penalty) {    this.problems = problems;    this.penalty = penalty;   }   public int compareTo(Contest contest) {    if(problems != contest.problems) return contest.problems - problems;    return penalty - contest.penalty;    }  }  void run(){   int n = nextInt(), k = nextInt();   Contest[] c = new Contest[n];   for(int i = 0; i < n; i++) {    c[i] = new Contest(nextInt(), nextInt());   }   Arrays.sort(c);   int cproblem = c[k - 1].problems, cpenalty = c[k - 1].penalty;   int ans = 0;   for(int i = 0; i < n; i++) {    if(c[i].problems == cproblem && c[i].penalty == cpenalty) ans++;   }   System.out.println(ans);  }  int nextInt(){   try{    int c = System.in.read();    if(c == -1) return c;    while(c != '-' && (c < '0' || '9' < c)){     c = System.in.read();     if(c == -1) return c;    }    if(c == '-') return -nextInt();    int res = 0;    do{     res *= 10;     res += c - '0';     c = System.in.read();    }while('0' <= c && c <= '9');    return res;   }catch(Exception e){    return -1;   }  }  long nextLong(){   try{    int c = System.in.read();    if(c == -1) return -1;    while(c != '-' && (c < '0' || '9' < c)){     c = System.in.read();     if(c == -1) return -1;    }    if(c == '-') return -nextLong();    long res = 0;    do{     res *= 10;     res += c-'0';     c = System.in.read();    }while('0' <= c && c <= '9');    return res;   }catch(Exception e){    return -1;   }  }  double nextDouble(){   return Double.parseDouble(next());  }  String next(){   try{    StringBuilder res = new StringBuilder("");    int c = System.in.read();    while(Character.isWhitespace(c))     c = System.in.read();    do{     res.append((char)c);    }while(!Character.isWhitespace(c=System.in.read()));    return res.toString();   }catch(Exception e){    return null;   }  }  String nextLine(){   try{    StringBuilder res = new StringBuilder("");    int c = System.in.read();    while(c == '\r' || c == '\n')     c = System.in.read();    do{     res.append((char)c);     c = System.in.read();    }while(c != '\r' && c != '\n');    return res.toString();   }catch(Exception e){    return null;   }  }  public static void main(String[] args){   new TaskA().run();  } }
3	public class A { public static void main(String[] args) throws IOException {    Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));     int n = sc.nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = sc.nextInt();  Arrays.sort(a);  int ans = 0;  boolean[] v = new boolean[n];  for (int i = 0; i < n; i++) {  if (v[i])   continue;  v[i] = true;  ans++;  for (int j = i; j < n; j++) {   if (a[j]%a[i]==0)   v[j] = true;  }  }  System.out.println(ans); } }
6	public class D {  public static long [][]dp;  public static boolean [][]map;  public static void main(String[] args) {   Scanner in = new Scanner();   PrintWriter out = new PrintWriter(System.out);       int n = in.nextInt();   int m = in.nextInt();   dp = new long[n][1 << n + 1] ;   map = new boolean[n][n];   for (int i = 0; i < m; i++) {    int a = in.nextInt() - 1;    int b = in.nextInt() - 1;    map[a][b] = true;    map[b][a] = true;      }   for(long []temp : dp){    Arrays.fill(temp, -1);   }   long result = 0;   for(int i = 0; i < n; i++){    result += cal((1<<i),i,i,1);   }   out.println((result/2));   out.close();  }  public static long cal(int mask, int from, int to, int len){   if(dp[to][mask]!= -1){    return dp[to][mask];   }   long result = 0;   if(len > 2 && map[from][to]){    result++;   }   for(int i = from+1; i< map.length; i++){    if(map[to][i] && (mask & (1<<i)) == 0){     result += cal(mask|(1<<i), from,i,len + 1);    }   }   dp[to][mask] = result;   return result;    }    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;     index += (index & (-index));    }   }   public int get(int index) {    int 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) {   if (b == 0) {    return 1;   }   if (b == 1) {    return a;   }   long val = pow(a, b / 2);   if (b % 2 == 0) {    return val * val ;   } else {    return val * (val * a) ;   }  }  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();    }   }  } }
0	public class A122 {  public static void main(String aa[])  {   Scanner ob=new Scanner(System.in);   int n;     n=ob.nextInt();   if(n%4==0||n%7==0||n%44==0||n%47==0||n%444==0||n%447==0||n%474==0||n%477==0||n%744==0||n%747==0||n%774==0||n%777==0)   System.out.println("YES");   else   System.out.println("NO");  } }
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);  } }
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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    int d = in.nextInt();    int[] a = new int[n];    Set<Integer> set = new HashSet<>();    for (int i = 0; i < n; i++) {     a[i] = in.nextInt();    }     int ans = 2;    for (int i = 1; i < n; i++) {     if (a[i] - a[i - 1] == 2 * d) {      ans++;     } else if (a[i] - a[i - 1] > 2 * d) {      ans += 2;     }    }    out.println(ans);   }  }  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 close() {    writer.close();   }   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 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 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 interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    HashMap<String, Integer> map = new HashMap<>();    for (int i = 0; i < n; i++) {     String next = in.next();     map.put(next, map.getOrDefault(next, 0) + 1);    }    int ct = 0;    for (int i = 0; i < n; i++) {     String next = in.next();     if (map.containsKey(next)) {      map.put(next, map.get(next) - 1);      if (map.get(next) <= 0) {       map.remove(next);      }     }    }    for (Map.Entry<String, Integer> entry : map.entrySet()) {     ct += entry.getValue();    }    out.println(ct);   }  }  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 close() {    writer.close();   }   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 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();    }    StringBuilder res = new StringBuilder();    do {     if (Character.isValidCodePoint(c)) {      res.appendCodePoint(c);     }     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   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 String next() {    return readString();   }   public int nextInt() {    return readInt();   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
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;  }  } }
6	public class Main {  private static FastScanner sc = new FastScanner();  private static long mod = 1000000007;  public static void main(String[] args) {  int n = sc.nextInt();  int T = sc.nextInt();  int[] t = new int[n];  int[] g = new int[n];  for(int i=0; i<n; i++) {   t[i] = sc.nextInt();   g[i] = sc.nextInt() - 1;  }  long[][][] dp = new long[T+1][3][1 << 15];  for(int i=1; i<=T; i++) {   for(int j=0; j<n; j++) {   if(i - t[j] == 0) {    dp[i][g[j]][1 << j] = (dp[i][g[j]][1 << j] + 1) % mod;   } else if(i - t[j] > 0) {    for(int k=0; k<(1 << 15); k++) {    if((k >> j & 1) == 1) {     continue;    }    dp[i][g[j]][k + (1 << j)] = (dp[i][g[j]][k + (1 << j)] + dp[i - t[j]][(g[j] + 1) % 3][k] + dp[i - t[j]][(g[j] + 2) % 3][k]) % mod;    }   }   }  }  long ans = 0;  for(int j=0; j<3; j++) {   for(int k=0; k<(1 << 15); k++) {   ans = (ans + dp[T][j][k]) % mod;   }  }  System.out.println(ans);  }  static long power(long m , long n){  if(n == 0) {   return 1;  }else if(n == 1){    return m;   }else if(n % 2 == 0){    long s = power(m, n/2);    return ( (s % mod) * (s % mod) ) % mod;   }else{    return ( (m % mod) * (power(m, n-1) % mod) ) % mod;   }  }  static class FastScanner {   private final InputStream in = System.in;   private final byte[] buffer = new byte[1024];   private int ptr = 0;   private int buflen = 0;   private boolean hasNextByte() {    if(ptr < buflen) {     return true;    } else {     ptr = 0;     try {      buflen = in.read(buffer);     } catch(IOException e) {      e.printStackTrace();     }     if(buflen <= 0) {      return false;     }    }    return true;   }   private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}   private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}   private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}   public boolean hasNext() { skipUnprintable(); return hasNextByte();}   public String next() {    if (!hasNext()) throw new NoSuchElementException();    StringBuilder sb = new StringBuilder();    int b = readByte();    while(isPrintableChar(b)) {     sb.appendCodePoint(b);     b = readByte();    }    return sb.toString();   }   public long nextLong() {    return Long.parseLong(next());   }   public int nextInt(){    return Integer.parseInt(next());   }   public double nextDouble(){    return Double.parseDouble(next());   }  } }
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());   }  } }
1	public class p2 { final static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); private static String ss() throws IOException {return br.readLine();}  private static int stoi(String x) {return Integer.parseInt(x);} private static int si() throws IOException {return stoi(ss());} private static long sl() throws IOException {return Long.parseLong(ss());}  private static int[] sia(int len) throws IOException {  int[] ret = new int[len];  final StringTokenizer st = new StringTokenizer(ss());  for (int i = 0; i < len; ++i) {ret[i] = stoi(st.nextToken());}  return ret; } private static long[] sla(int len) throws IOException {  long[] ret = new long[len];  final StringTokenizer st = new StringTokenizer(ss());  for (int i = 0; i < len; ++i) {ret[i] = Long.parseLong(st.nextToken());}  return ret; }  public static void main (final String[] args) throws IOException {   Set<Integer> poss = new HashSet<>();  for (int i = 1; 2 * (i*i) <= 1000000000; ++i) {  poss.add(2 * (i*i));  poss.add(4 * (i*i));  }  int t = si();  for (int i = 0; i < t; ++i) {  int n = si();  if (poss.contains(n)) System.out.println("YES");  else System.out.println("NO");  } } }
4	public class BetaRound35_C implements Runnable {  final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer("");  void init() throws IOException {  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()); }  @Override 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);  } }  public static void main(String[] args) {  new Thread(new BetaRound35_C()).start(); }  void solve() throws IOException {  int n = readInt();  int m = readInt();  int k = readInt();  Queue<Point> q = new ArrayDeque<Point>();  boolean[][] visited = new boolean[n + 2][m + 2];  for (int j = 0; j < m + 2; j++) {  visited[0][j] = true;  visited[n + 1][j] = true;  }  for (int i = 0; i < n + 2; i++) {  visited[i][0] = true;  visited[i][m + 1] = true;  }  for (int i = 0; i < k; i++) {  int x = readInt();  int y = readInt();  q.add(new Point(x, y));  visited[x][y] = true;  }   Point p = null;  while (!q.isEmpty()) {  p = q.poll();  int x = p.x, y = p.y;  if (!visited[x + 1][y]) {   q.add(new Point(x + 1, y));   visited[x + 1][y] = true;  }  if (!visited[x - 1][y]) {   q.add(new Point(x - 1, y));   visited[x - 1][y] = true;  }  if (!visited[x][y + 1]) {   q.add(new Point(x, y + 1));   visited[x][y + 1] = true;  }  if (!visited[x][y - 1]) {   q.add(new Point(x, y - 1));   visited[x][y - 1] = true;  }  }  out.print(p.x + " " + p.y); }  }
5	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 t = in.readInt();  final int[] x = new int[n];  int[] a = new int[n];  for (int i = 0; i < n; i++) {  x[i] = in.readInt();  a[i] = in.readInt();  }  Integer[] o = new Integer[n];  for (int i = 0; i < n; i++)  o[i] = i;  Arrays.sort(o, new Comparator<Integer>() {  public int compare(Integer o1, Integer o2) {   return x[o1] - x[o2];  }  });  int ans = 2;  for (int i = 1; i < n; i++) {  int d = x[o[i]] - x[o[i - 1]];  d = 2 * d - a[o[i]] - a[o[i - 1]] - 2 * t;  if (d > 0)   ans += 2;  else if (d == 0)   ans++;  }  out.println(ans);  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;  } } }
4	public class Main {  static int[][] l,r,u,d;  static int[][][]dist;  static int inf=Integer.MAX_VALUE;  static class Node{   int x,y,len,dis;   Node(int x,int y,int len,int dis){    this.x=x;this.y=y;this.len=len;this.dis=dis;   }  }  public static void process()throws IOException  {   int n=ni();   int m=ni();   int k=ni();   dist=new int[n][m][k/2+1];   l=new int[n][m];   r=new int[n][m];   for(int i=0;i<n;i++)    for(int j=0;j<m-1;j++)     l[i][j]=r[i][j+1]=ni();   u=new int[n][m];   d=new int[n][m];   for(int i=0;i<n-1;i++)    for(int j=0;j<m;j++)     d[i][j]=u[i+1][j]=ni();   if(k%2==1)   {    for(int i=0;i<n;i++)    {     for(int j=0;j<m;j++)      p("-1 ");     pn("");    }    return;   }   k/=2;   for(int kk=1;kk<=k;kk++)   for(int i=0;i<n;i++)   {    for(int j=0;j<m;j++)    {     dist[i][j][kk]=inf;     if(i!=0)      dist[i][j][kk]=Math.min(dist[i][j][kk],dist[i-1][j][kk-1]+u[i][j]);     if(i!=n-1)      dist[i][j][kk]=Math.min(dist[i][j][kk],dist[i+1][j][kk-1]+d[i][j]);     if(j!=0)      dist[i][j][kk]=Math.min(dist[i][j][kk],dist[i][j-1][kk-1]+r[i][j]);     if(j!=m-1)      dist[i][j][kk]=Math.min(dist[i][j][kk],dist[i][j+1][kk-1]+l[i][j]);    }   }   for(int i=0;i<n;i++)   {    for(int j=0;j<m;j++)     p(2*dist[i][j][k]+" ");    pn("");   }  }  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;     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;}}   }
1	public class C {  public static void main(String[] args) {   CIO io = new CIO();   try {    Csolver solver = new Csolver(io);    solver.solve();   } finally {    io.close();   }  } } class Csolver {  CIO io;  public Csolver(CIO io) {   this.io = io;  }  public void solve() {   int n = io.nextInt();   String input = io.next();   int[] count = new int[1000];   int pokemonsInRange = 0;   int answer = Integer.MAX_VALUE;   int a = 0;   int b = 0;   for (; b < n ; b++) {    char end = input.charAt(b);    if (count[end] == 0) {     pokemonsInRange++;     answer = Integer.MAX_VALUE;    }    count[end]++;    while (count[input.charAt(a)] > 1) {     count[input.charAt(a)]--;     a++;    }    answer = Math.min(answer, b-a+1);   }   io.println(answer);  }  private static class Pair implements Comparable<Pair> {   int id;   long val;   public Pair(long val, int id) {    this.val = val;    this.id = id;   }   @Override   public int compareTo(Pair o) {    if (this.val < o.val) return -1;    if (this.val > o.val) return 1;    return this.id - o.id;   }  }  private List<Integer>[] toGraph(CIO io, int n) {   List<Integer>[] g = new ArrayList[n+1];   for (int i=1; i<=n; i++) g[i] = new ArrayList<>();   for (int i=1; i<=n-1; i++) {    int a = io.nextInt();    int b = io.nextInt();    g[a].add(b);    g[b].add(a);   }   return g;  } } class CIO extends PrintWriter {  private InputStreamReader r;  private static final int BUFSIZE = 1 << 15;  private char[] buf;  private int bufc;  private int bufi;  private StringBuilder sb;  public CIO() {   super(new BufferedOutputStream(System.out));   r = new InputStreamReader(System.in);   buf = new char[BUFSIZE];   bufc = 0;   bufi = 0;   sb = new StringBuilder();  }  private void fillBuf() throws IOException {   bufi = 0;   bufc = 0;   while(bufc == 0) {    bufc = r.read(buf, 0, BUFSIZE);    if(bufc == -1) {     bufc = 0;     return;    }   }  }  private boolean pumpBuf() throws IOException {   if(bufi == bufc) {    fillBuf();   }   return bufc != 0;  }  private boolean isDelimiter(char c) {   return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f';  }  private void eatDelimiters() throws IOException {   while(true) {    if(bufi == bufc) {     fillBuf();     if(bufc == 0) throw new RuntimeException("IO: Out of input.");    }    if(!isDelimiter(buf[bufi])) break;    ++bufi;   }  }  public String next() {   try {    sb.setLength(0);    eatDelimiters();    int start = bufi;    while(true) {     if(bufi == bufc) {      sb.append(buf, start, bufi - start);      fillBuf();      start = 0;      if(bufc == 0) break;     }     if(isDelimiter(buf[bufi])) break;     ++bufi;    }    sb.append(buf, start, bufi - start);    return sb.toString();   } catch(IOException e) {    throw new RuntimeException("IO.next: Caught IOException.");   }  }  public int nextInt() {   try {    int ret = 0;    eatDelimiters();    boolean positive = true;    if(buf[bufi] == '-') {     ++bufi;     if(!pumpBuf()) throw new RuntimeException("IO.nextInt: Invalid int.");     positive = false;    }    boolean first = true;    while(true) {     if(!pumpBuf()) break;     if(isDelimiter(buf[bufi])) {      if(first) throw new RuntimeException("IO.nextInt: Invalid int.");      break;     }     first = false;     if(buf[bufi] >= '0' && buf[bufi] <= '9') {      if(ret < -214748364) throw new RuntimeException("IO.nextInt: Invalid int.");      ret *= 10;      ret -= (int)(buf[bufi] - '0');      if(ret > 0) throw new RuntimeException("IO.nextInt: Invalid int.");     } else {      throw new RuntimeException("IO.nextInt: Invalid int.");     }     ++bufi;    }    if(positive) {     if(ret == -2147483648) throw new RuntimeException("IO.nextInt: Invalid int.");     ret = -ret;    }    return ret;   } catch(IOException e) {    throw new RuntimeException("IO.nextInt: Caught IOException.");   }  }  public long nextLong() {   try {    long ret = 0;    eatDelimiters();    boolean positive = true;    if(buf[bufi] == '-') {     ++bufi;     if(!pumpBuf()) throw new RuntimeException("IO.nextLong: Invalid long.");     positive = false;    }    boolean first = true;    while(true) {     if(!pumpBuf()) break;     if(isDelimiter(buf[bufi])) {      if(first) throw new RuntimeException("IO.nextLong: Invalid long.");      break;     }     first = false;     if(buf[bufi] >= '0' && buf[bufi] <= '9') {      if(ret < -922337203685477580L) throw new RuntimeException("IO.nextLong: Invalid long.");      ret *= 10;      ret -= (long)(buf[bufi] - '0');      if(ret > 0) throw new RuntimeException("IO.nextLong: Invalid long.");     } else {      throw new RuntimeException("IO.nextLong: Invalid long.");     }     ++bufi;    }    if(positive) {     if(ret == -9223372036854775808L) throw new RuntimeException("IO.nextLong: Invalid long.");     ret = -ret;    }    return ret;   } catch(IOException e) {    throw new RuntimeException("IO.nextLong: Caught IOException.");   }  }  public double nextDouble() {   return Double.parseDouble(next());  } }
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);   TaskE2 solver = new TaskE2();   int testCount = Integer.parseInt(in.next());   for (int i = 1; i <= testCount; i++) {    solver.solve(i, in, out);   }   out.close();  }  static class TaskE2 {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.readInt();    int m = in.readInt();    int[][] a = in.readIntTable(n, m);    int[][] id = new int[n + 1][1 << n];    int[][] val = new int[n + 1][1 << n];    ArrayUtils.fill(id, m);    int[] sum = new int[1 << n];    int[] low = new int[1 << n];    boolean[] base = new boolean[1 << n];    int[] vv = new int[1 << n];    for (int i = 1; i < (1 << n); i++) {     low[i] = Integer.bitCount(Integer.lowestOneBit(i) - 1);     int current = i;     base[i] = true;     vv[i] = i;     for (int j = 0; j < n; j++) {      current = current << 1;      current += current >> n;      current -= (current >> n) << n;      if (current < i) {       base[i] = false;       vv[i] = vv[current];       break;      }     }    }    for (int i = 0; i < m; i++) {     for (int j = 1; j < (1 << n); j++) {      sum[j] = sum[j - (1 << low[j])] + a[low[j]][i];     }     for (int j = 1; j < (1 << n); j++) {      sum[vv[j]] = Math.max(sum[vv[j]], sum[j]);     }     for (int j = 1; j < (1 << n); j++) {      if (!base[j]) {       continue;      }      for (int k = n - 1; k >= 0; k--) {       if (sum[j] > val[k][j]) {        val[k + 1][j] = val[k][j];        id[k + 1][j] = id[k][j];        val[k][j] = sum[j];        id[k][j] = i;       } else {        break;       }      }     }    }    int[] tempVal = new int[n];    int[] tempId = new int[n];    for (int i = 1; i < (1 << n); i++) {     if (!base[i]) {      for (int j = 0; j < n; j++) {       val[j][i] = val[j][vv[i]];       id[j][i] = id[j][vv[i]];      }     } else {      for (int j = 0; j < n; j++) {       tempVal[j] = val[j][i];       tempId[j] = id[j][i];      }      ArrayUtils.orderBy(tempId, tempVal);      for (int j = 0; j < n; j++) {       val[j][i] = tempVal[j];       id[j][i] = tempId[j];      }     }    }    int[] at = new int[1 << n];    int[] current = new int[1 << n];    int[] next = new int[1 << n];    int all = (1 << n) - 1;    for (int i = 0; i < m; i++) {     System.arraycopy(current, 0, next, 0, (1 << n));     for (int j = 1; j < (1 << n); j++) {      if (at[j] == n || id[at[j]][j] != i) {       continue;      }      int other = all - j;      for (int k = other; k > 0; k = (k - 1) & other) {       next[k + j] = Math.max(next[k + j], current[k] + val[at[j]][j]);      }      next[j] = Math.max(next[j], val[at[j]][j]);      at[j]++;     }     int[] temp = current;     current = next;     next = temp;    }    out.printLine(current[all]);   }  }  static abstract class IntAbstractStream implements IntStream {   public String toString() {    StringBuilder builder = new StringBuilder();    boolean first = true;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     if (first) {      first = false;     } else {      builder.append(' ');     }     builder.append(it.value());    }    return builder.toString();   }   public boolean equals(Object o) {    if (!(o instanceof IntStream)) {     return false;    }    IntStream c = (IntStream) o;    IntIterator it = intIterator();    IntIterator jt = c.intIterator();    while (it.isValid() && jt.isValid()) {     if (it.value() != jt.value()) {      return false;     }     it.advance();     jt.advance();    }    return !it.isValid() && !jt.isValid();   }   public int hashCode() {    int result = 0;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     result *= 31;     result += it.value();    }    return result;   }  }  static interface IntList extends IntReversableCollection {   public abstract int get(int index);   public abstract void set(int index, int value);   public abstract void addAt(int index, int value);   public abstract void removeAt(int index);   default public void swap(int first, int second) {    if (first == second) {     return;    }    int temp = get(first);    set(first, get(second));    set(second, temp);   }   default public IntIterator intIterator() {    return new IntIterator() {     private int at;     private boolean removed;     public int value() {      if (removed) {       throw new IllegalStateException();      }      return get(at);     }     public boolean advance() {      at++;      removed = false;      return isValid();     }     public boolean isValid() {      return !removed && at < size();     }     public void remove() {      removeAt(at);      at--;      removed = true;     }    };   }   default public void add(int value) {    addAt(size(), value);   }   default public IntList sort(IntComparator comparator) {    Sorter.sort(this, comparator);    return this;   }   default public IntList subList(final int from, final int to) {    return new IntList() {     private final int shift;     private final int size;     {      if (from < 0 || from > to || to > IntList.this.size()) {       throw new IndexOutOfBoundsException("from = " + from + ", to = " + to + ", size = " + size());      }      shift = from;      size = to - from;     }     public int size() {      return size;     }     public int get(int at) {      if (at < 0 || at >= size) {       throw new IndexOutOfBoundsException("at = " + at + ", size = " + size());      }      return IntList.this.get(at + shift);     }     public void addAt(int index, int value) {      throw new UnsupportedOperationException();     }     public void removeAt(int index) {      throw new UnsupportedOperationException();     }     public void set(int at, int value) {      if (at < 0 || at >= size) {       throw new IndexOutOfBoundsException("at = " + at + ", size = " + size());      }      IntList.this.set(at + shift, value);     }     public IntList compute() {      return new IntArrayList(this);     }    };   }  }  static interface IntCollection extends IntStream {   public int size();   default public void add(int value) {    throw new UnsupportedOperationException();   }   default public int[] toArray() {    int size = size();    int[] array = new int[size];    int i = 0;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     array[i++] = it.value();    }    return array;   }   default public IntCollection addAll(IntStream values) {    for (IntIterator it = values.intIterator(); it.isValid(); it.advance()) {     add(it.value());    }    return this;   }  }  static interface IntIterator {   public int value() throws NoSuchElementException;   public boolean advance();   public boolean isValid();  }  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[][] readIntTable(int rowCount, int columnCount) {    int[][] table = new int[rowCount][];    for (int i = 0; i < rowCount; i++) {     table[i] = readIntArray(columnCount);    }    return table;   }   public int[] readIntArray(int size) {    int[] array = new int[size];    for (int i = 0; i < size; i++) {     array[i] = readInt();    }    return array;   }   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();    }    StringBuilder res = new StringBuilder();    do {     if (Character.isValidCodePoint(c)) {      res.appendCodePoint(c);     }     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   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 String next() {    return readString();   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  static class Range {   public static IntList range(int from, int to) {    int[] result = new int[Math.abs(from - to)];    int current = from;    if (from <= to) {     for (int i = 0; i < result.length; i++) {      result[i] = current++;     }    } else {     for (int i = 0; i < result.length; i++) {      result[i] = current--;     }    }    return new IntArray(result);   }  }  static class ArrayUtils {   public static void fill(int[][] array, int value) {    for (int[] row : array) {     Arrays.fill(row, value);    }   }   public static int[] range(int from, int to) {    return Range.range(from, to).toArray();   }   public static int[] createOrder(int size) {    return range(0, size);   }   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) {    if (from == 0 && to == array.length) {     new IntArray(array).sort(comparator);    } else {     new IntArray(array).subList(from, to).sort(comparator);    }    return array;   }   public static int[] order(final int[] array) {    return sort(createOrder(array.length), new IntComparator() {     public int compare(int first, int second) {      if (array[first] < array[second]) {       return -1;      }      if (array[first] > array[second]) {       return 1;      }      return 0;     }    });   }   public static void orderBy(int[] base, int[]... arrays) {    int[] order = ArrayUtils.order(base);    order(order, base);    for (int[] array : arrays) {     order(order, array);    }   }   public static void order(int[] order, int[] array) {    int[] tempInt = new int[order.length];    for (int i = 0; i < order.length; i++) {     tempInt[i] = array[order[i]];    }    System.arraycopy(tempInt, 0, array, 0, array.length);   }  }  static class IntArrayList extends IntAbstractStream implements IntList {   private int size;   private int[] data;   public IntArrayList() {    this(3);   }   public IntArrayList(int capacity) {    data = new int[capacity];   }   public IntArrayList(IntCollection c) {    this(c.size());    addAll(c);   }   public IntArrayList(IntStream c) {    this();    if (c instanceof IntCollection) {     ensureCapacity(((IntCollection) c).size());    }    addAll(c);   }   public IntArrayList(IntArrayList c) {    size = c.size();    data = c.data.clone();   }   public IntArrayList(int[] arr) {    size = arr.length;    data = arr.clone();   }   public int size() {    return size;   }   public int get(int at) {    if (at >= size) {     throw new IndexOutOfBoundsException("at = " + at + ", size = " + size);    }    return data[at];   }   private void ensureCapacity(int capacity) {    if (data.length >= capacity) {     return;    }    capacity = Math.max(2 * data.length, capacity);    data = Arrays.copyOf(data, capacity);   }   public void addAt(int index, int value) {    ensureCapacity(size + 1);    if (index > size || index < 0) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    if (index != size) {     System.arraycopy(data, index, data, index + 1, size - index);    }    data[index] = value;    size++;   }   public void removeAt(int index) {    if (index >= size || index < 0) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    if (index != size - 1) {     System.arraycopy(data, index + 1, data, index, size - index - 1);    }    size--;   }   public void set(int index, int value) {    if (index >= size) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    data[index] = value;   }   public int[] toArray() {    return Arrays.copyOf(data, size);   }  }  static interface IntReversableCollection extends IntCollection {  }  static class IntArray extends IntAbstractStream implements IntList {   private int[] data;   public IntArray(int[] arr) {    data = arr;   }   public int size() {    return data.length;   }   public int get(int at) {    return data[at];   }   public void addAt(int index, int value) {    throw new UnsupportedOperationException();   }   public void removeAt(int index) {    throw new UnsupportedOperationException();   }   public void set(int index, int value) {    data[index] = value;   }  }  static interface IntComparator {   public int compare(int first, int second);  }  static interface IntStream extends Iterable<Integer>, Comparable<IntStream> {   public IntIterator intIterator();   default public Iterator<Integer> iterator() {    return new Iterator<Integer>() {     private IntIterator it = intIterator();     public boolean hasNext() {      return it.isValid();     }     public Integer next() {      int result = it.value();      it.advance();      return result;     }    };   }   default public int compareTo(IntStream c) {    IntIterator it = intIterator();    IntIterator jt = c.intIterator();    while (it.isValid() && jt.isValid()) {     int i = it.value();     int j = jt.value();     if (i < j) {      return -1;     } else if (i > j) {      return 1;     }     it.advance();     jt.advance();    }    if (it.isValid()) {     return 1;    }    if (jt.isValid()) {     return -1;    }    return 0;   }  }  static class Sorter {   private static final int INSERTION_THRESHOLD = 16;   private Sorter() {   }   public static void sort(IntList list, IntComparator comparator) {    quickSort(list, 0, list.size() - 1, (Integer.bitCount(Integer.highestOneBit(list.size()) - 1) * 5) >> 1,      comparator);   }   private static void quickSort(IntList list, int from, int to, int remaining, IntComparator comparator) {    if (to - from < INSERTION_THRESHOLD) {     insertionSort(list, from, to, comparator);     return;    }    if (remaining == 0) {     heapSort(list, from, to, comparator);     return;    }    remaining--;    int pivotIndex = (from + to) >> 1;    int pivot = list.get(pivotIndex);    list.swap(pivotIndex, to);    int storeIndex = from;    int equalIndex = to;    for (int i = from; i < equalIndex; i++) {     int value = comparator.compare(list.get(i), pivot);     if (value < 0) {      list.swap(storeIndex++, i);     } else if (value == 0) {      list.swap(--equalIndex, i--);     }    }    quickSort(list, from, storeIndex - 1, remaining, comparator);    for (int i = equalIndex; i <= to; i++) {     list.swap(storeIndex++, i);    }    quickSort(list, storeIndex, to, remaining, comparator);   }   private static void heapSort(IntList list, int from, int to, IntComparator comparator) {    for (int i = (to + from - 1) >> 1; i >= from; i--) {     siftDown(list, i, to, comparator, from);    }    for (int i = to; i > from; i--) {     list.swap(from, i);     siftDown(list, from, i - 1, comparator, from);    }   }   private static void siftDown(IntList list, int start, int end, IntComparator comparator, int delta) {    int value = list.get(start);    while (true) {     int child = ((start - delta) << 1) + 1 + delta;     if (child > end) {      return;     }     int childValue = list.get(child);     if (child + 1 <= end) {      int otherValue = list.get(child + 1);      if (comparator.compare(otherValue, childValue) > 0) {       child++;       childValue = otherValue;      }     }     if (comparator.compare(value, childValue) >= 0) {      return;     }     list.swap(start, child);     start = child;    }   }   private static void insertionSort(IntList list, int from, int to, IntComparator comparator) {    for (int i = from + 1; i <= to; i++) {     int value = list.get(i);     for (int j = i - 1; j >= from; j--) {      if (comparator.compare(list.get(j), value) <= 0) {       break;      }      list.swap(j, j + 1);     }    }   }  }  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 close() {    writer.close();   }   public void printLine(int i) {    writer.println(i);   }  } }
4	public class YouAreGivenAString {  void run() {   try {    BufferedReader bfd = new BufferedReader(new InputStreamReader(      System.in));    int i, j, k, mxLen = 0;    String s= bfd.readLine();    for(i=0; i<s.length(); ++i){     for(j=i+1; j<s.length()+1; ++j){      String s2 = s.substring(i, j);      if(s2.length()<=mxLen) continue;      int cnt=0;      for(k=0; k<s.length(); ++k){       if(s.length()>=k+s2.length())       if(s2.equals(s.substring(k,k+s2.length()))){        cnt++;        if(cnt>1)mxLen = Math.max(mxLen, s2.length());       }      }     }    }    System.out.println(mxLen);   } catch (Exception e) {   }  }  public static void main(String[] args) {   new YouAreGivenAString().run();  } }
1	public class C364C {  static StringTokenizer st; static BufferedReader br; static PrintWriter pw;  static int n; static int[] a; public static void main(String[] args) throws IOException {  br = new BufferedReader(new InputStreamReader(System.in));  pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  n = nextInt();  int ans = n, cc, cur = 0;  a = new int [52];  char[] c = next().toCharArray();  int l = 0, len = 0;  for (int i = 0; i < n; ++i) {  if (Character.isUpperCase(c[i])) {   cur = 26 + c[i] - 'A';  } else   cur = c[i] - 'a';  if (a[cur] == 0) {   a[cur]++;   len++;   ans = i - l + 1;  } else {   a[cur]++;   for (; l < i; ++l) {   if (Character.isUpperCase(c[l])) {    cc = 26 + c[l] - 'A';   } else    cc = c[l] - 'a';      if (a[cc] > 1) {    --a[cc];   } else break;   }   if (i - l + 1 < ans) {   ans = i - l + 1;   }  }  }    pw.print(ans);  pw.close(); }  private static int sumf(int[] fen, int id) {  int summ = 0;  for (; id >= 0; id = (id & (id + 1)) - 1)   summ += fen[id];  return summ; }  private static void addf(int[] fen, int id) {  for (; id < fen.length; id |= id + 1)   fen[id]++; }  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(); } }
5	public class Main {   public static void main(String[] args) throws Exception {   int n = nextInt();     int[] mas = new int[n];     for(int i = 0; i<n; i++) {    mas[i] = nextInt();   }     Arrays.sort(mas);     if(mas[n-1] == 1) {    for(int i = 0; i<n-1; i++) {     out.print(1 + " ");    }    out.println(2);    out.flush();    exit();   }     out.print("1 ");     for(int i = 0; i<n-1; i++) {    out.print(mas[i] + " ");   }     out.println();   out.flush();  }        private static StreamTokenizer in;  private static PrintWriter out;  private static BufferedReader inB;   private static boolean FILE=false;   private static int nextInt() throws Exception{   in.nextToken();   return (int)in.nval;  }   private static String nextString() throws Exception{   in.nextToken();   return in.sval;  }   static{   try {    out = new PrintWriter(FILE ? (new FileOutputStream("output.txt")) : System.out);    inB = new BufferedReader(new InputStreamReader(FILE ? new FileInputStream("input.txt") : System.in));   } catch(Exception e) {e.printStackTrace();}   in = new StreamTokenizer(inB);  }         private static void println(Object o) throws Exception {   out.println(o);   out.flush();  }  private static void exit(Object o) throws Exception {   println(o);   exit();  }  private static void exit() {   System.exit(0);  }  private static final int INF = Integer.MAX_VALUE;  private static final int MINF = Integer.MIN_VALUE;  }
0	public class A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   long n = sc.nextLong();     List<Long> fi = new ArrayList<Long>();      fi.add((long) 0);   fi.add((long) 1);     while (fi.get(fi.size()-1)<n) {    fi.add(fi.get(fi.size()-1)+fi.get(fi.size()-2));   }     int last = fi.size()-1;   long z = last-1>=0 ? fi.get(last-1) : 0;   long y = last-3>=0 ? fi.get(last-3) : 0;   long x = last-4>=0 ? fi.get(last-4) : 0;   if (x+y+z<n)    x=1;     System.out.println(x+" "+y+" "+z);  }  }
3	public class Main { public static void main(String args[]) {new Main().run();}  FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){  work();  out.flush(); } long mod=998244353; long gcd(long a,long b) {  return b==0?a:gcd(b,a%b); } void work() {  int n=in.nextInt();  int[] A=new int[n];  for(int i=0;i<n;i++)A[i]=in.nextInt();  HashMap<Integer,Integer> map=new HashMap<>();  HashMap<Integer,ArrayList<int[]>> rec=new HashMap<>();  for(int i=0;i<n;i++) {  for(int j=i,cur=0;j>=0;j--) {   cur+=A[j];   if(map.get(cur)==null) {   map.put(cur,i);   rec.put(cur,new ArrayList<>());   rec.get(cur).add(new int[] {j,i});   }else if(map.get(cur)<j) {   map.put(cur,i);   rec.get(cur).add(new int[] {j,i});   }  }  }  ArrayList<int[]> ret=null;  for(ArrayList<int[]> list:rec.values()) {  if(ret==null||ret.size()<list.size()) {   ret=list;  }  }  out.println(ret.size());  for(int[] r:ret) {  out.println((r[0]+1)+" "+(r[1]+1));  } } }   class FastReader { BufferedReader br; StringTokenizer st;  public FastReader() {  br=new BufferedReader(new InputStreamReader(System.in)); }  public String next()  {  if(st==null || !st.hasMoreElements())  {  try {   st = new StringTokenizer(br.readLine());  } catch (IOException e) {   e.printStackTrace();  }  }  return st.nextToken(); }  public int nextInt()  {  return Integer.parseInt(next()); }  public long nextLong() {  return Long.parseLong(next()); } }
0	public class a extends Thread {  BufferedReader bf; PrintWriter out; FastScanner in;  void solve() throws Exception {  long n = in.nextLong();  long f[] = new long[2001];  int i = 2;  f[0] = 0;  f[1] = 1;  while (true){  f[i] = f[i-1] + f[i-2];  if (f[i] < n) i++;  else break;  }  if (n == 1) out.println("1 0 0");  else if (n == 0) out.println("0 0 0");  else  if (i - 3 >= 0) out.println(f[i-2] +" " + f[i-2] + " " +f[i-3]);  else out.println("I'm too stupid to solve this problem"); }  public void run() {  try {  bf = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  in = new FastScanner(bf);  solve();  out.flush();  } catch (Exception ex) {  ex.printStackTrace();  } finally {  out.close();  } }  public static void main(String args[]) {  new a().start(); }  class FastScanner {  BufferedReader bf;  StringTokenizer st;  public FastScanner(BufferedReader bf) {  this.bf = bf;  }  public String nextToken() throws Exception {  while (st == null || !st.hasMoreTokens()) {   st = new StringTokenizer(bf.readLine());  }  return st.nextToken();  }  public int nextInt() throws Exception {  return Integer.parseInt(nextToken());  }  public long nextLong() throws Exception {  return Long.parseLong(nextToken());  }  public Double nextDouble() throws Exception {  return Double.parseDouble(nextToken());  }  public BigInteger nextBigInteger() throws Exception {  return new BigInteger(nextToken());  } } }
5	public class One { InputStreamReader inp = new InputStreamReader(System.in); BufferedReader in = new BufferedReader(inp); boolean test = false;    String[] inData = { "4","1 1 2" };  static int id = -1;  public String readLine() throws IOException {  id++;  if (test)  return inData[id];  else  return in.readLine(); }  public void solve() throws Exception {  readLine();  String readLine = readLine();   String[] split = readLine.split(" ");  List<Integer> ints = new ArrayList<Integer>();   for (int i = 0; i < split.length; i++) {  ints.add(Integer.valueOf(split[i]));  }   Collections.sort(ints);  Integer object = ints.get(0);  for (int i = 0; i < split.length; i++) {  if(ints.get(i).compareTo(object) > 0){   System.out.println(ints.get(i));   return;  }  }  System.out.println("NO"); }  public static void main(String[] args) throws Exception {  new One().solve();  } }
0	public class Main { public static void main(String args[]) throws Exception  {    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  int n=Integer.parseInt(br.readLine());  System.out.println("0 0 "+n);} }
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 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(); } }
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;      }     }   }  } } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public int[] parse(FastScanner in, int n) {    String s = in.next();    int[] temp = new int[n];    for (int i = 0; i < n; ++i) {     temp[i] = s.charAt(i) - 'A';    }    return temp;   }   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.nextInt();    int[] s = parse(in, n);    Map<Integer, TreeSet<Integer>> map = new HashMap<>();    for (int i = 0; i < n; ++i) {     if (map.containsKey(s[i])) {      map.get(s[i]).add(i);     } else {      TreeSet<Integer> temp = new TreeSet<>();      temp.add(i);      map.put(s[i], temp);     }    }    int ans = Integer.MAX_VALUE;    for (int i = 0; i < n; ++i) {     int finalI = i;     final Int integer = new Int();     integer.x = i;     map.forEach((Integer x, TreeSet set) -> {      if (x != s[finalI]) {       Integer temp = (Integer) set.higher(finalI);       if (temp == null) {        integer.x = -2;       } else {        if (integer.x != -2)         integer.x = Integer.max(integer.x, temp);       }      } else {      }     });     if (integer.x != -2) {      ans = Integer.min(ans, integer.x - i + 1);     }    }    out.print(ans);   }   public class Int {    int x;    public Int() {     x = -1;    }   }  }  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 inputStream) {    br = new BufferedReader(new InputStreamReader(inputStream));   }   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());   }  } }
1	public class CTask {   public static void main(String[] args) throws IOException {   MyInputReader in = new MyInputReader(System.in);   HashMap<Character, Integer> m = new HashMap<Character, Integer>();   int n = in.nextInt();   char[] s = in.next().toCharArray();   for (int i = 0; i < n; i++) {    m.put(s[i], 0);   }   int mx = m.size();   int start = 0;   int end = 0;   int min = Integer.MAX_VALUE;   int cur = 0;   while (end < n) {    while (end < n && cur != mx) {     int x = m.get(s[end]);     if (x == 0) {      cur += 1;     }     m.put(s[end], x + 1);     end += 1;    }    while (start <= end && cur == mx) {     int x = m.get(s[start]);     m.put(s[start], x - 1);     if (x - 1 == 0) {      cur -= 1;     }     start += 1;    }    min = Math.min(min, end - start + 1);   }   System.out.println(min);  }   static class Pair {   long x;   long y;   public Pair(long x, long y) {    this.x = x;    this.y = y;   }   @Override   public boolean equals(Object o) {    if (this == o) return true;    if (o == null || getClass() != o.getClass()) return false;    Pair pair = (Pair) o;    if (x != pair.x) return false;    return y == pair.y;   }   @Override   public int hashCode() {    int result = (int) (x ^ (x >>> 32));    result = 31 * result + (int) (y ^ (y >>> 32));    return result;   }  }  static class MyInputReader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public MyInputReader(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());   }  } }
2	public class C {  public static void main(String[] args) {   Solver solver = new Solver();  }  static class Solver {   IO io;   public Solver() {    this.io = new IO();    try {     solve();    } catch (RuntimeException e) {     if (!e.getMessage().equals("Clean exit")) {      throw e;     }    } finally {     io.close();    }   }      void solve() {    long x = io.nextLong();    long k = io.nextLong();    if (x==0) done(0);    long ans = pow(2,k) * ((2*x - 1)%MOD) + 1;    io.println(ans%MOD);   }   long pow(long base, long exp) {    if (exp == 0) return 1L;    long x = pow(base, exp/2);    long ans = x * x;    ans %= MOD;    if (exp % 2 != 0) {     ans *= base;     ans %= MOD;    }    return ans;   }   void solve2() {    long x = io.nextLong();    long k = io.nextLong();    if (x==0) done(0);        long checkPointA = min(10000, k);    double count = x;    long i=0;    for (; i<checkPointA; i++) {     count *= 2;     count -= 0.5;     count %= MOD;    }    List<Double> bah = new ArrayList<>();    List<Long> meh = new ArrayList<>();    while (true) {     bah.add(count);     meh.add(i);     long j = 2*i;     if (j > k || j < 0) break;     i = j;     count *= count;     count %= MOD;    }    while (!bah.isEmpty()) {     long muller = meh.get(meh.size()-1);     long cand = i + muller;     if (cand > k || cand < 0) {      meh.remove(meh.size()-1);      bah.remove(bah.size()-1);      continue;     }     i = cand;     count *= meh.get(meh.size()-1);     count %= MOD;    }    for (; i<k; i++) {     count *= 2;     count -= 0.5;     count %= MOD;    }       count *= 2;    count %= MOD;    io.println(Math.round(count));   }      long MOD = (long)1e9 + 7;   boolean closeToZero(double v) {       return Math.abs(v) <= 0.0000000000001;   }   class DrawGrid {    void draw(boolean[][] d) {     System.out.print(" ");     for (int x=0; x<d[0].length; x++) {      System.out.print(" " + x + " ");     }     System.out.println("");     for (int y=0; y<d.length; y++) {      System.out.print(y + " ");      for (int x=0; x<d[0].length; x++) {       System.out.print((d[y][x] ? "[x]" : "[ ]"));      }      System.out.println("");     }    }    void draw(int[][] d) {     int max = 1;     for (int y=0; y<d.length; y++) {      for (int x=0; x<d[0].length; x++) {       max = Math.max(max, ("" + d[y][x]).length());      }     }     System.out.print(" ");     String format = "%" + (max+2) + "s";     for (int x=0; x<d[0].length; x++) {      System.out.print(String.format(format, x) + " ");     }     format = "%" + (max) + "s";     System.out.println("");     for (int y=0; y<d.length; y++) {      System.out.print(y + " ");      for (int x=0; x<d[0].length; x++) {       System.out.print(" [" + String.format(format, (d[y][x])) + "]");      }      System.out.println("");     }    }   }   class IDval implements Comparable<IDval> {    int id;    long val;    public IDval(int id, long val) {     this.val = val;     this.id = id;    }    @Override    public int compareTo(IDval o) {     if (this.val < o.val) return -1;     if (this.val > o.val) return 1;     return this.id - o.id;    }   }   private class ElementCounter {    private HashMap<Long, Integer> elements;    public ElementCounter() {     elements = new HashMap<>();    }    public void add(long element) {     int count = 1;     Integer prev = elements.get(element);     if (prev != null) count += prev;     elements.put(element, count);    }    public void remove(long element) {     int count = elements.remove(element);     count--;     if (count > 0) elements.put(element, count);    }    public int get(long element) {     Integer val = elements.get(element);     if (val == null) return 0;     return val;    }    public int size() {     return elements.size();    }   }   class StringCounter {    HashMap<String, Integer> elements;    public StringCounter() {     elements = new HashMap<>();    }    public void add(String identifier) {     int count = 1;     Integer prev = elements.get(identifier);     if (prev != null) count += prev;     elements.put(identifier, count);    }    public void remove(String identifier) {     int count = elements.remove(identifier);     count--;     if (count > 0) elements.put(identifier, count);    }    public long get(String identifier) {     Integer val = elements.get(identifier);     if (val == null) return 0;     return val;    }    public int size() {     return elements.size();    }   }   class DisjointSet {       int[] size;    int[] parent;    int componentCount;    public DisjointSet(int n) {     componentCount = n;     size = new int[n];     parent = new int[n];     for (int i=0; i<n; i++) parent[i] = i;     for (int i=0; i<n; i++) size[i] = 1;    }    public void join(int a, int b) {         int rootA = parent[a];     int rootB = parent[b];     while (rootA != parent[rootA]) rootA = parent[rootA];     while (rootB != parent[rootB]) rootB = parent[rootB];     if (rootA == rootB) {           return;     }          if (size[rootA] > size[rootB]) {      size[rootA] += size[rootB];      parent[rootB] = rootA;     } else {      size[rootB] += size[rootA];      parent[rootA] = rootB;     }     componentCount--;    }   }   class Trie {    int N;    int Z;    int nextFreeId;    int[][] pointers;    boolean[] end;        public Trie(int maxLenSum, int alphabetSize) {     this.N = maxLenSum;     this.Z = alphabetSize;     this.nextFreeId = 1;     pointers = new int[N+1][alphabetSize];     end = new boolean[N+1];    }    public void addWord(String word) {     int curr = 0;     for (int j=0; j<word.length(); j++) {      int c = word.charAt(j) - 'a';      int next = pointers[curr][c];      if (next == 0) {       next = nextFreeId++;       pointers[curr][c] = next;      }      curr = next;     }     end[curr] = true;    }    public boolean hasWord(String word) {     int curr = 0;     for (int j=0; j<word.length(); j++) {      int c = word.charAt(j) - 'a';      int next = pointers[curr][c];      if (next == 0) return false;      curr = next;     }     return end[curr];    }   }   private static class Prob {            private double logP;        public Prob(double real) {     if (real > 0) this.logP = Math.log(real);     else this.logP = Double.NaN;    }        static boolean dontLogAgain = true;    public Prob(double logP, boolean anyBooleanHereToChooseThisConstructor) {     this.logP = logP;    }        public double get() {     return Math.exp(logP);    }    @Override    public String toString() {     return ""+get();    }            public static Prob add(Prob a, Prob b) {     if (nullOrNaN(a) && nullOrNaN(b)) return new Prob(Double.NaN, dontLogAgain);     if (nullOrNaN(a)) return copy(b);     if (nullOrNaN(b)) return copy(a);     double x = Math.max(a.logP, b.logP);     double y = Math.min(a.logP, b.logP);     double sum = x + Math.log(1 + Math.exp(y - x));     return new Prob(sum, dontLogAgain);    }        public static Prob multiply(Prob a, Prob b) {     if (nullOrNaN(a) || nullOrNaN(b)) return new Prob(Double.NaN, dontLogAgain);     return new Prob(a.logP + b.logP, dontLogAgain);    }        private static boolean nullOrNaN(Prob p) {     return (p == null || Double.isNaN(p.logP));    }        private static Prob copy(Prob original) {     return new Prob(original.logP, dontLogAgain);    }   }   class Binary implements Comparable<Binary> {        private boolean[] d;    private int first;    public int length;     public Binary(String binaryString) {     this(binaryString, false);    }    public Binary(String binaryString, boolean initWithMinArraySize) {     length = binaryString.length();     int size = Math.max(2*length, 1);     first = length/4;     if (initWithMinArraySize) {      first = 0;      size = Math.max(length, 1);     }     d = new boolean[size];     for (int i=0; i<length; i++) {      if (binaryString.charAt(i) == '1') d[i+first] = true;     }    }    public void addFirst(char c) {     if (first-1 < 0) doubleArraySize();     first--;     d[first] = (c == '1' ? true : false);     length++;    }    public void addLast(char c) {     if (first+length >= d.length) doubleArraySize();     d[first+length] = (c == '1' ? true : false);     length++;    }    private void doubleArraySize() {     boolean[] bigArray = new boolean[(d.length+1) * 2];     int newFirst = bigArray.length / 4;     for (int i=0; i<length; i++) {      bigArray[i + newFirst] = d[i + first];     }     first = newFirst;     d = bigArray;    }    public boolean flip(int i) {     boolean value = (this.d[first+i] ? false : true);     this.d[first+i] = value;     return value;    }    public void set(int i, char c) {     boolean value = (c == '1' ? true : false);     this.d[first+i] = value;    }    public char get(int i) {     return (this.d[first+i] ? '1' : '0');    }    @Override    public int compareTo(Binary o) {     if (this.length != o.length) return this.length - o.length;     int len = this.length;     for (int i=0; i<len; i++) {      int diff = this.get(i) - o.get(i);      if (diff != 0) return diff;     }     return 0;    }    @Override    public String toString() {     StringBuilder sb = new StringBuilder();     for (int i=0; i<length; i++) {      sb.append(d[i+first] ? '1' : '0');     }     return sb.toString();    }    }      class FenwickMin {    long n;    long[] original;    long[] bottomUp;    long[] topDown;    public FenwickMin(int n) {     this.n = n;     original = new long[n+2];     bottomUp = new long[n+2];     topDown = new long[n+2];    }    public void set(int modifiedNode, long value) {     long replaced = original[modifiedNode];     original[modifiedNode] = value;         int i = modifiedNode;     long v = value;     while (i <= n) {      if (v > bottomUp[i]) {       if (replaced == bottomUp[i]) {        v = Math.min(v, original[i]);        for (int r=1 ;; r++) {         int x = (i&-i)>>>r;         if (x == 0) break;         int child = i-x;         v = Math.min(v, bottomUp[child]);        }       } else break;      }      if (v == bottomUp[i]) break;      bottomUp[i] = v;      i += (i&-i);     }         i = modifiedNode;     v = value;     while (i > 0) {      if (v > topDown[i]) {       if (replaced == topDown[i]) {        v = Math.min(v, original[i]);        for (int r=1 ;; r++) {         int x = (i&-i)>>>r;         if (x == 0) break;         int child = i+x;         if (child > n+1) break;         v = Math.min(v, topDown[child]);        }       } else break;      }      if (v == topDown[i]) break;      topDown[i] = v;      i -= (i&-i);     }    }    public long getMin(int a, int b) {     long min = original[a];     int prev = a;     int curr = prev + (prev&-prev);     while (curr <= b) {      min = Math.min(min, topDown[prev]);      prev = curr;      curr = prev + (prev&-prev);;     }     min = Math.min(min, original[prev]);     prev = b;     curr = prev - (prev&-prev);     while (curr >= a) {      min = Math.min(min,bottomUp[prev]);      prev = curr;      curr = prev - (prev&-prev);     }     return min;    }   }   class FenwickSum {    public long[] d;    public FenwickSum(int n) {     d=new long[n+1];    }        public FenwickSum(long[] a) {     d=new long[a.length];     for (int i=1; i<a.length; i++) {      modify(i, a[i]);     }    }        void modify(int i, long v) {     while (i<d.length) {      d[i] += v;           i += (i&-i);     }    }        long getSum(int a, int b) {     return getSum(b) - getSum(a-1);    }    private long getSum(int i) {     long sum = 0;     while (i>0) {      sum += d[i];           i -= (i&-i);     }     return sum;    }   }   class SegmentTree {       int N;    long[] p;    public SegmentTree(int n) {         for (N=2; N<n; N++) N *= 2;     p = new long[2*N];    }    public void modifyRange(int a, int b, long change) {     muuta(a, change);     muuta(b+1, -change);    }    void muuta(int k, long muutos) {     k += N;     p[k] += muutos;     for (k /= 2; k >= 1; k /= 2) {      p[k] = p[2*k] + p[2*k+1];     }    }    public long get(int k) {     int a = N;     int b = k+N;     long s = 0;     while (a <= b) {      if (a%2 == 1) s += p[a++];      if (b%2 == 0) s += p[b--];      a /= 2;      b /= 2;     }     return s;    }   }      List<Integer>[] toGraph(IO io, int n) {    List<Integer>[] g = new ArrayList[n+1];    for (int i=1; i<=n; i++) g[i] = new ArrayList<>();    for (int i=1; i<=n-1; i++) {     int a = io.nextInt();     int b = io.nextInt();     g[a].add(b);     g[b].add(a);    }    return g;   }   class Graph {    HashMap<Long, List<Long>> edges;    public Graph() {     edges = new HashMap<>();    }    List<Long> getSetNeighbors(Long node) {     List<Long> neighbors = edges.get(node);     if (neighbors == null) {      neighbors = new ArrayList<>();      edges.put(node, neighbors);     }     return neighbors;    }    void addBiEdge(Long a, Long b) {     addEdge(a, b);     addEdge(b, a);    }    void addEdge(Long from, Long to) {     getSetNeighbors(to);     List<Long> neighbors = getSetNeighbors(from);     neighbors.add(to);    }        int UNTOUCHED = 0;    int FINISHED = 2;    int INPROGRESS = 1;    HashMap<Long, Integer> vis;    List<Long> topoAns;    List<Long> failDueToCycle = new ArrayList<Long>() {{ add(-1L); }};    List<Long> topoSort() {     topoAns = new ArrayList<>();     vis = new HashMap<>();     for (Long a : edges.keySet()) {      if (!topoDFS(a)) return failDueToCycle;     }     Collections.reverse(topoAns);     return topoAns;    }    boolean topoDFS(long curr) {     Integer status = vis.get(curr);     if (status == null) status = UNTOUCHED;     if (status == FINISHED) return true;     if (status == INPROGRESS) {      return false;     }     vis.put(curr, INPROGRESS);     for (long next : edges.get(curr)) {      if (!topoDFS(next)) return false;     }     vis.put(curr, FINISHED);     topoAns.add(curr);     return true;    }   }   public class StronglyConnectedComponents {        ArrayList<Integer>[] forw;    ArrayList<Integer>[] bacw;        public int getCount(int n, int[] mista, int[] minne) {     forw = new ArrayList[n+1];     bacw = new ArrayList[n+1];     for (int i=1; i<=n; i++) {      forw[i] = new ArrayList<Integer>();      bacw[i] = new ArrayList<Integer>();     }     for (int i=0; i<mista.length; i++) {      int a = mista[i];      int b = minne[i];      forw[a].add(b);      bacw[b].add(a);     }     int count = 0;     List<Integer> list = new ArrayList<Integer>();     boolean[] visited = new boolean[n+1];     for (int i=1; i<=n; i++) {      dfsForward(i, visited, list);     }     visited = new boolean[n+1];     for (int i=n-1; i>=0; i--) {      int node = list.get(i);      if (visited[node]) continue;      count++;      dfsBackward(node, visited);     }     return count;    }    public void dfsForward(int i, boolean[] visited, List<Integer> list) {     if (visited[i]) return;     visited[i] = true;     for (int neighbor : forw[i]) {      dfsForward(neighbor, visited, list);     }     list.add(i);    }    public void dfsBackward(int i, boolean[] visited) {     if (visited[i]) return;     visited[i] = true;     for (int neighbor : bacw[i]) {      dfsBackward(neighbor, visited);     }    }   }   class LCAFinder {        int[] nodes;    int[] depths;    int[] entries;    int pointer;    FenwickMin fenwick;    public LCAFinder(List<Integer>[] graph) {     this.nodes = new int[(int)10e6];     this.depths = new int[(int)10e6];     this.entries = new int[graph.length];     this.pointer = 1;     boolean[] visited = new boolean[graph.length+1];     dfs(1, 0, graph, visited);     fenwick = new FenwickMin(pointer-1);     for (int i=1; i<pointer; i++) {      fenwick.set(i, depths[i] * 1000000L + i);     }    }    private void dfs(int node, int depth, List<Integer>[] graph, boolean[] visited) {     visited[node] = true;     entries[node] = pointer;     nodes[pointer] = node;     depths[pointer] = depth;     pointer++;     for (int neighbor : graph[node]) {      if (visited[neighbor]) continue;      dfs(neighbor, depth+1, graph, visited);      nodes[pointer] = node;      depths[pointer] = depth;      pointer++;     }    }    public int find(int a, int b) {     int left = entries[a];     int right = entries[b];     if (left > right) {      int temp = left;      left = right;      right = temp;     }     long mixedBag = fenwick.getMin(left, right);     int index = (int) (mixedBag % 1000000L);     return nodes[index];    }   }      class Point {    int y;    int x;    public Point(int y, int x) {     this.y = y;     this.x = x;    }   }   boolean segmentsIntersect(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {        if (x1 == x2 && x3 == x4) {         if (x1 != x3) return false;     if (min(y1,y2) < min(y3,y4)) {      return max(y1,y2) >= min(y3,y4);     } else {      return max(y3,y4) >= min(y1,y2);     }    }    if (x1 == x2) {         double a34 = (y4-y3)/(x4-x3);     double b34 = y3 - a34*x3;     double y = a34 * x1 + b34;     return y >= min(y1,y2) && y <= max(y1,y2) && x1 >= min(x3,x4) && x1 <= max(x3,x4);    }    if (x3 == x4) {         double a12 = (y2-y1)/(x2-x1);     double b12 = y1 - a12*x1;     double y = a12 * x3 + b12;     return y >= min(y3,y4) && y <= max(y3,y4) && x3 >= min(x1,x2) && x3 <= max(x1,x2);    }    double a12 = (y2-y1)/(x2-x1);    double b12 = y1 - a12*x1;    double a34 = (y4-y3)/(x4-x3);    double b34 = y3 - a34*x3;    if (closeToZero(a12 - a34)) {         return closeToZero(b12 - b34);    }       double x = -(b12-b34)/(a12-a34);    return x >= min(x1,x2) && x <= max(x1,x2) && x >= min(x3,x4) && x <= max(x3,x4);   }   boolean pointInsideRectangle(Point p, List<Point> r) {    Point a = r.get(0);    Point b = r.get(1);    Point c = r.get(2);    Point d = r.get(3);    double apd = areaOfTriangle(a, p, d);    double dpc = areaOfTriangle(d, p, c);    double cpb = areaOfTriangle(c, p, b);    double pba = areaOfTriangle(p, b, a);    double sumOfAreas = apd + dpc + cpb + pba;    if (closeToZero(sumOfAreas - areaOfRectangle(r))) {     if (closeToZero(apd) || closeToZero(dpc) || closeToZero(cpb) || closeToZero(pba)) {      return false;     }     return true;    }    return false;   }   double areaOfTriangle(Point a, Point b, Point c) {    return 0.5 * Math.abs((a.x-c.x)*(b.y-a.y)-(a.x-b.x)*(c.y-a.y));   }   double areaOfRectangle(List<Point> r) {    double side1xDiff = r.get(0).x - r.get(1).x;    double side1yDiff = r.get(0).y - r.get(1).y;    double side2xDiff = r.get(1).x - r.get(2).x;    double side2yDiff = r.get(1).y - r.get(2).y;    double side1 = Math.sqrt(side1xDiff * side1xDiff + side1yDiff * side1yDiff);    double side2 = Math.sqrt(side2xDiff * side2xDiff + side2yDiff * side2yDiff);    return side1 * side2;   }   boolean pointsOnSameLine(double x1, double y1, double x2, double y2, double x3, double y3) {    double areaTimes2 = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2);    return (closeToZero(areaTimes2));   }   class PointToLineSegmentDistanceCalculator {        double minDistFromPointToLineSegment(double point_x, double point_y, double x1, double y1, double x2, double y2) {     return Math.sqrt(distToSegmentSquared(point_x, point_y, x1, y1, x2, y2));    }    private double distToSegmentSquared(double point_x, double point_y, double x1, double y1, double x2, double y2) {     double l2 = dist2(x1,y1,x2,y2);     if (l2 == 0) return dist2(point_x, point_y, x1, y1);     double t = ((point_x - x1) * (x2 - x1) + (point_y - y1) * (y2 - y1)) / l2;     if (t < 0) return dist2(point_x, point_y, x1, y1);     if (t > 1) return dist2(point_x, point_y, x2, y2);     double com_x = x1 + t * (x2 - x1);     double com_y = y1 + t * (y2 - y1);     return dist2(point_x, point_y, com_x, com_y);    }    private double dist2(double x1, double y1, double x2, double y2) {     return Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2);    }   }       long gcd(long... v) {       if (v.length == 1) return v[0];    long ans = gcd(v[1], v[0]);    for (int i=2; i<v.length; i++) {     ans = gcd(ans, v[i]);    }    return ans;   }   long gcd(long a, long b) {       if (b == 0) return a;    return gcd(b, a%b);   }   int[] generatePrimesUpTo(int last) {       int[] div = new int[last+1];    for (int x=2; x<=last; x++) {     if (div[x] > 0) continue;     for (int u=2*x; u<=last; u+=x) {      div[u] = x;     }    }    return div;   }   long lcm(long a, long b) {       return a * b / gcd(a,b);   }   class BaseConverter {        public String convert(Long number, int base) {     return Long.toString(number, base);    }        public String convert(String number, int baseFrom, int baseTo) {     return Long.toString(Long.parseLong(number, baseFrom), baseTo);    }        public long longify(String number, int baseFrom) {     return Long.parseLong(number, baseFrom);    }   }   class BinomialCoefficients {           public long biCo(long n, long k) {     long r = 1;     if (k > n) return 0;     for (long d = 1; d <= k; d++) {      r *= n--;      r /= d;     }     return r;    }        public long[] precalcBinomialCoefficientsK(int n, int maxK) {     long v[] = new long[maxK+1];     v[0] = 1;     for (int i=1; i<=n; i++) {      for (int j=Math.min(i,maxK); j>0; j--) {       v[j] = v[j] + v[j-1];      }     }     return v;    }        public long[] precalcBinomialCoefficientsK(int n, int k, long M) {     long v[] = new long[k+1];     v[0] = 1;     for (int i=1; i<=n; i++) {      for (int j=Math.min(i,k); j>0; j--) {       v[j] = v[j] + v[j-1];       v[j] %= M;      }     }     return v;    }   }      class Zalgo {    public int pisinEsiintyma(String haku, String kohde) {     char[] s = new char[haku.length() + 1 + kohde.length()];     for (int i=0; i<haku.length(); i++) {      s[i] = haku.charAt(i);     }     int j = haku.length();     s[j++] = '#';     for (int i=0; i<kohde.length(); i++) {      s[j++] = kohde.charAt(i);     }     int[] z = toZarray(s);     int max = 0;     for (int i=haku.length(); i<z.length; i++) {      max = Math.max(max, z[i]);     }     return max;    }    public int[] toZarray(char[] s) {     int n = s.length;     int[] z = new int[n];     int a = 0, b = 0;     for (int i = 1; i < n; i++) {      if (i > b) {       for (int j = i; j < n && s[j - i] == s[j]; j++) z[i]++;      }      else {       z[i] = z[i - a];       if (i + z[i - a] > b) {        for (int j = b + 1; j < n && s[j - i] == s[j]; j++) z[i]++;        a = i;        b = i + z[i] - 1;       }      }     }     return z;    }    public List<Integer> getStartIndexesWhereWordIsFound(String haku, String kohde) {         char[] s = new char[haku.length() + 1 + kohde.length()];     for (int i=0; i<haku.length(); i++) {      s[i] = haku.charAt(i);     }     int j = haku.length();     s[j++] = '#';     for (int i=0; i<kohde.length(); i++) {      s[j++] = kohde.charAt(i);     }     int[] z = toZarray(s);     List<Integer> indexes = new ArrayList<>();     for (int i=haku.length(); i<z.length; i++) {      if (z[i] < haku.length()) continue;      indexes.add(i);     }     return indexes;    }   }   class StringHasher {    class HashedString {     long[] hashes;     long[] modifiers;     public HashedString(long[] hashes, long[] modifiers) {      this.hashes = hashes;      this.modifiers = modifiers;     }    }    long P;    long M;    public StringHasher() {     initializePandM();    }    HashedString hashString(String s) {     int n = s.length();     long[] hashes = new long[n];     long[] modifiers = new long[n];     hashes[0] = s.charAt(0);     modifiers[0] = 1;     for (int i=1; i<n; i++) {      hashes[i] = (hashes[i-1] * P + s.charAt(i)) % M;      modifiers[i] = (modifiers[i-1] * P) % M;     }     return new HashedString(hashes, modifiers);    }        long getHash(HashedString hashedString, int startIndex, int endIndex) {     long[] hashes = hashedString.hashes;     long[] modifiers = hashedString.modifiers;     long result = hashes[endIndex];     if (startIndex > 0) result -= (hashes[startIndex-1] * modifiers[endIndex-startIndex+1]) % M;     if (result < 0) result += M;     return result;    }             HashedString[] hashString(String first, String second) {     HashedString[] array = new HashedString[2];     int n = first.length();     long[] modifiers = new long[n];     modifiers[0] = 1;     long[] firstHashes = new long[n];     firstHashes[0] = first.charAt(0);     array[0] = new HashedString(firstHashes, modifiers);     long[] secondHashes = new long[n];     secondHashes[0] = second.charAt(0);     array[1] = new HashedString(secondHashes, modifiers);     for (int i=1; i<n; i++) {      modifiers[i] = (modifiers[i-1] * P) % M;      firstHashes[i] = (firstHashes[i-1] * P + first.charAt(i)) % M;      secondHashes[i] = (secondHashes[i-1] * P + second.charAt(i)) % M;     }     return array;    }        HashedString[] hashString(String... strings) {     HashedString[] array = new HashedString[strings.length];     int n = strings[0].length();     long[] modifiers = new long[n];     modifiers[0] = 1;     for (int j=0; j<strings.length; j++) {           if (strings[j].length() != n) {       for (int i=0; i<n; i++) {        array[i] = hashString(strings[i]);       }       return array;      }            long[] hashes = new long[n];      hashes[0] = strings[j].charAt(0);      array[j] = new HashedString(hashes, modifiers);     }     for (int i=1; i<n; i++) {      modifiers[i] = (modifiers[i-1] * P) % M;      for (int j=0; j<strings.length; j++) {       String s = strings[j];       long[] hashes = array[j].hashes;       hashes[i] = (hashes[i-1] * P + s.charAt(i)) % M;      }     }     return array;    }    void initializePandM() {     ArrayList<Long> modOptions = new ArrayList<>(20);     modOptions.add(353873237L);     modOptions.add(353875897L);     modOptions.add(353878703L);     modOptions.add(353882671L);     modOptions.add(353885303L);     modOptions.add(353888377L);     modOptions.add(353893457L);     P = modOptions.get(new Random().nextInt(modOptions.size()));     modOptions.clear();     modOptions.add(452940277L);     modOptions.add(452947687L);     modOptions.add(464478431L);     modOptions.add(468098221L);     modOptions.add(470374601L);     modOptions.add(472879717L);     modOptions.add(472881973L);     M = modOptions.get(new Random().nextInt(modOptions.size()));    }   }      private class IO extends PrintWriter {    private InputStreamReader r;    private static final int BUFSIZE = 1 << 15;    private char[] buf;    private int bufc;    private int bufi;    private StringBuilder sb;    public IO() {     super(new BufferedOutputStream(System.out));     r = new InputStreamReader(System.in);     buf = new char[BUFSIZE];     bufc = 0;     bufi = 0;     sb = new StringBuilder();    }        private int queryInt(String s) {     io.println(s);     io.flush();     return nextInt();    }        private long queryLong(String s) {     io.println(s);     io.flush();     return nextLong();    }        private String queryNext(String s) {     io.println(s);     io.flush();     return next();    }    private void fillBuf() throws IOException {     bufi = 0;     bufc = 0;     while(bufc == 0) {      bufc = r.read(buf, 0, BUFSIZE);      if(bufc == -1) {       bufc = 0;       return;      }     }    }    private boolean pumpBuf() throws IOException {     if(bufi == bufc) {      fillBuf();     }     return bufc != 0;    }    private boolean isDelimiter(char c) {     return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f';    }    private void eatDelimiters() throws IOException {     while(true) {      if(bufi == bufc) {       fillBuf();       if(bufc == 0) throw new RuntimeException("IO: Out of input.");      }      if(!isDelimiter(buf[bufi])) break;      ++bufi;     }    }    public String next() {     try {      sb.setLength(0);      eatDelimiters();      int start = bufi;      while(true) {       if(bufi == bufc) {        sb.append(buf, start, bufi - start);        fillBuf();        start = 0;        if(bufc == 0) break;       }       if(isDelimiter(buf[bufi])) break;       ++bufi;      }      sb.append(buf, start, bufi - start);      return sb.toString();     } catch(IOException e) {      throw new RuntimeException("IO.next: Caught IOException.");     }    }    public int nextInt() {     try {      int ret = 0;      eatDelimiters();      boolean positive = true;      if(buf[bufi] == '-') {       ++bufi;       if(!pumpBuf()) throw new RuntimeException("IO.nextInt: Invalid int.");       positive = false;      }      boolean first = true;      while(true) {       if(!pumpBuf()) break;       if(isDelimiter(buf[bufi])) {        if(first) throw new RuntimeException("IO.nextInt: Invalid int.");        break;       }       first = false;       if(buf[bufi] >= '0' && buf[bufi] <= '9') {        if(ret < -214748364) throw new RuntimeException("IO.nextInt: Invalid int.");        ret *= 10;        ret -= (int)(buf[bufi] - '0');        if(ret > 0) throw new RuntimeException("IO.nextInt: Invalid int.");       } else {        throw new RuntimeException("IO.nextInt: Invalid int.");       }       ++bufi;      }      if(positive) {       if(ret == -2147483648) throw new RuntimeException("IO.nextInt: Invalid int.");       ret = -ret;      }      return ret;     } catch(IOException e) {      throw new RuntimeException("IO.nextInt: Caught IOException.");     }    }    public long nextLong() {     try {      long ret = 0;      eatDelimiters();      boolean positive = true;      if(buf[bufi] == '-') {       ++bufi;       if(!pumpBuf()) throw new RuntimeException("IO.nextLong: Invalid long.");       positive = false;      }      boolean first = true;      while(true) {       if(!pumpBuf()) break;       if(isDelimiter(buf[bufi])) {        if(first) throw new RuntimeException("IO.nextLong: Invalid long.");        break;       }       first = false;       if(buf[bufi] >= '0' && buf[bufi] <= '9') {        if(ret < -922337203685477580L) throw new RuntimeException("IO.nextLong: Invalid long.");        ret *= 10;        ret -= (long)(buf[bufi] - '0');        if(ret > 0) throw new RuntimeException("IO.nextLong: Invalid long.");       } else {        throw new RuntimeException("IO.nextLong: Invalid long.");       }       ++bufi;      }      if(positive) {       if(ret == -9223372036854775808L) throw new RuntimeException("IO.nextLong: Invalid long.");       ret = -ret;      }      return ret;     } catch(IOException e) {      throw new RuntimeException("IO.nextLong: Caught IOException.");     }    }    public double nextDouble() {     return Double.parseDouble(next());    }   }   void print(Object output) {    io.println(output);   }   void done(Object output) {    print(output);    done();   }   void done() {    io.close();    throw new RuntimeException("Clean exit");   }   long min(long... v) {    long ans = v[0];    for (int i=1; i<v.length; i++) {     ans = Math.min(ans, v[i]);    }    return ans;   }   double min(double... v) {    double ans = v[0];    for (int i=1; i<v.length; i++) {     ans = Math.min(ans, v[i]);    }    return ans;   }   int min(int... v) {    int ans = v[0];    for (int i=1; i<v.length; i++) {     ans = Math.min(ans, v[i]);    }    return ans;   }   long max(long... v) {    long ans = v[0];    for (int i=1; i<v.length; i++) {     ans = Math.max(ans, v[i]);    }    return ans;   }   double max(double... v) {    double ans = v[0];    for (int i=1; i<v.length; i++) {     ans = Math.max(ans, v[i]);    }    return ans;   }   int max(int... v) {    int ans = v[0];    for (int i=1; i<v.length; i++) {     ans = Math.max(ans, v[i]);    }    return ans;   }  } }
4	public class Main {  public static int n;  public static int m;  public static int k;  public static int[][] right;  public static int[][] down;  public static int[][][] dp;  public static void recur(int i, int j, int depth)  {   if(dp[i][j][depth]!=-1)    return;   int min=Integer.MAX_VALUE;     if(j>0)   {    recur(i, j-1, depth-1);    min=Math.min(min, dp[i][j-1][depth-1] + right[i][j-1]);   }     if(j<m-1)   {    recur(i, j+1, depth-1);    min=Math.min(min, dp[i][j+1][depth-1] + right[i][j]);   }     if(i>0)   {    recur(i-1, j, depth-1);    min=Math.min(min, dp[i-1][j][depth-1] + down[i-1][j]);   }     if(i<n-1)   {    recur(i+1, j, depth-1);    min=Math.min(min, dp[i+1][j][depth-1] + down[i][j]);   }   dp[i][j][depth]=min;  }  public static void main (String[] args) throws java.lang.Exception  {     Scanner sc=new Scanner(System.in);   n=sc.nextInt();   m=sc.nextInt();   k=sc.nextInt();   right=new int[n][m-1];   down=new int[n-1][m];   for(int i=0;i<n;i++)    for(int j=0;j<m-1;j++)     right[i][j]=sc.nextInt();   for(int i=0;i<n-1;i++)    for(int j=0;j<m;j++)     down[i][j]=sc.nextInt();   if(k%2==1) {    for(int i=0;i<n;++i) {     for (int j = 0; j < m; j++)      System.out.print(-1 + " ");     System.out.println();    }   }   else   {    k/=2;    dp=new int[n][m][k+1];    for(int i=0;i<n;++i)     for(int j=0;j<m;j++)      for(int z=1;z<=k;z++)       dp[i][j][z]=-1;    for(int i=0;i<n;++i)     for(int j=0;j<m;j++)      recur(i,j,k);    for(int i=0;i<n;++i) {     for (int j = 0; j < m; j++)      System.out.print((dp[i][j][k] * 2) + " ");     System.out.println();    }   }  } }
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();  } }
2	public class Solver {  StringTokenizer st;  BufferedReader in;  PrintWriter out;  public static void main(String[] args) throws NumberFormatException,    IOException {   Solver solver = new Solver();   solver.open();   solver.solve();   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()) {    String line = in.readLine();    if (line == null)     return null;    st = new StringTokenizer(line);   }   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());  }  int n;  class Otr {   int x1, y1, x2, y2;   int dx, dy;   public Otr(int x, int y, int dx, int dy) {    super();    this.x1 = x;    this.y1 = y;    this.x2 = x;    this.y2 = y;    this.dx = dx;    this.dy = dy;   }   int getAns() {    if (x1 == x2 && y1 == y2) {     int nx1 = x1 + dx;     int ny2 = y2 + dy;     if ((nx1 <= 0 || nx1 > n) && (ny2 <= 0 || ny2 > n)) {      return 0;     }    }    x1 += dx;    if (x1 <= 0) {     x1 = 1;     y1 += dy;    }    if (x1 > n) {     x1 = n;     y1 += dy;    }    y2 += dy;    if (y2 <= 0) {     y2 = 1;     x2 += dx;    }    if (y2 > n) {     y2 = n;     x2 += dx;    }    return Math.abs(x1 - x2) + 1;   }   @Override   public String toString() {    return "(" + x1 + "," + y1 + ")->(" + x2 + "," + y2 + ")";   }  }  int[] dxs = { -1, -1, 1, 1 };  int[] dys = { -1, 1, -1, 1 };  public void solve() throws NumberFormatException, IOException {   n = nextInt();   int x = nextInt();   int y = nextInt();   long c = nextLong();   long now = 1;   Otr[] otr = new Otr[4];   for (int i = 0; i < 4; i++) {    otr[i] = new Otr(x, y, dxs[i], dys[i]);   }   int result = 0;   while (now < c) {    for (int i = 0; i < 4; i++) {     now += otr[i].getAns();    }    for (int i = 0; i < 3; i++) {     for (int j = i + 1; j < 4; j++) {      Otr o1 = otr[i];      Otr o2 = otr[j];      if (o1.x1!=o1.x2 || o1.y1!=o1.y2){       if (o2.x1!=o2.x2 || o2.y1!=o2.y2){        if (o1.x1 == o2.x1 && o1.y1 == o2.y1) {         now--;        }        if (o1.x1 == o2.x2 && o1.y1 == o2.y2) {         now--;        }        if (o1.x2 == o2.x1 && o1.y2 == o2.y1) {         now--;        }        if (o1.x2 == o2.x2 && o1.y2 == o2.y2) {         now--;        }       }else{        if (o1.x1 == o2.x1 && o1.y1 == o2.y1) {         now--;        }        if (o1.x2 == o2.x1 && o1.y2 == o2.y1) {         now--;        }       }      }else{       if (o2.x1!=o2.x2 || o2.y1!=o2.y2){        if (o1.x2 == o2.x1 && o1.y2 == o2.y1) {         now--;        }        if (o1.x2 == o2.x2 && o1.y2 == o2.y2) {         now--;        }       }else{        if (o1.x1 == o2.x1 && o1.y1 == o2.y1) {         now--;        }       }      }                }    }    result++;   }   out.println(result);  }  public void close() {   out.flush();   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)); } }
5	public class a {  private void solve() throws Exception {  int n = nextInt(), t = nextInt();  int[] x = new int[n], a = new int[n];  for (int i = 0; i < n; ++i){  x[i] = nextInt();  a[i] = nextInt();  }  for (int i = 0; i < n; ++i)  for (int j = 0; j < n - 1; ++j){   if (x[j] > x[j + 1]){   int tmp = x[j];   x[j] = x[j + 1];   x[j + 1] = tmp;      tmp = a[j];   a[j] = a[j + 1];   a[j + 1] = tmp;   }  }  int res = 2;  for (int i = 1; i < n; ++i){  int betw = (x[i] - x[i - 1]) * 2 - a[i] - a[i - 1];  if (betw == t * 2)   ++res;  else if (betw > t * 2)   res += 2;  }  out.print(res); }  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) {  new a().run(); } }
5	public class Village { static Scanner in = new Scanner( new BufferedReader( new InputStreamReader( System.in ) ) );  public static void main( String[] args ) {  int n = in.nextInt(), t = 2*in.nextInt(), h[][] = new int[n][2], ans = 2;  for( int i = 0; i < n; i++ )  {  h[i][0] = 2*in.nextInt();  h[i][1] = in.nextInt();  }  Arrays.sort( h, new Comp() );  for( int i = 1; i < n; i++ )  {  int d = (h[i][0]-h[i][1])-(h[i-1][0]+h[i-1][1]);  if( d > t ) ans += 2;  else if( d == t ) ans++;  }  System.out.println( ans ); }  static class Comp implements Comparator<int[]> { public int compare( int[] a, int[] b ) { return a[0]-b[0]; } } }
2	public class P1195B {  public static void main(String[] args) {   SimpleScanner scanner = new SimpleScanner(System.in);   PrintWriter writer = new PrintWriter(System.out);   int n = scanner.nextInt();   int k = scanner.nextInt();   int l = 0;   int r = n;   int ans = 0;   while (l <= r) {    int eat = (l + r) >> 1;    int lastPut = n - eat;    long totalPut = (long) (lastPut + 1) * lastPut / 2;    long remain = totalPut - eat;    if (remain == k) {     ans = eat;     break;    } else if (remain > k)     l = eat + 1;    else     r = eat - 1;   }   writer.println(ans);   writer.close();  }  private static class SimpleScanner {   private static final int BUFFER_SIZE = 10240;   private Readable in;   private CharBuffer buffer;   private boolean eof;   SimpleScanner(InputStream in) {    this.in = new BufferedReader(new InputStreamReader(in));    buffer = CharBuffer.allocate(BUFFER_SIZE);    buffer.limit(0);    eof = false;   }    private char read() {    if (!buffer.hasRemaining()) {     buffer.clear();     int n;     try {      n = in.read(buffer);     } catch (IOException e) {      n = -1;     }     if (n <= 0) {      eof = true;      return '\0';     }     buffer.flip();    }    return buffer.get();   }   void checkEof() {    if (eof)     throw new NoSuchElementException();   }   char nextChar() {    checkEof();    char b = read();    checkEof();    return b;   }   String next() {    char b;    do {     b = read();     checkEof();    } while (Character.isWhitespace(b));    StringBuilder sb = new StringBuilder();    do {     sb.append(b);     b = read();    } while (!eof && !Character.isWhitespace(b));    return sb.toString();   }   int nextInt() {    return Integer.valueOf(next());   }   long nextLong() {    return Long.valueOf(next());   }   double nextDouble() {    return Double.parseDouble(next());   }  } }
4	public class a{  static BufferedReader br;  static PrintWriter pw;  static int N, M, K;  static ArrayList<Integer> graph[][];  public static void main(String args[]) throws IOException{   br = new BufferedReader(new InputStreamReader(System.in));   pw = new PrintWriter(System.out);   StringTokenizer st = new StringTokenizer(br.readLine());   N = Integer.parseInt(st.nextToken());   M = Integer.parseInt(st.nextToken());   K = Integer.parseInt(st.nextToken());   if(K % 2 == 1){    for(int i = 0; i < N; i++){     for(int j = 0; j < M; j++){      pw.print("-1 ");     }     pw.println();    }    br.close(); pw.close();    return;   }   graph = new ArrayList[N][M];   for(int i = 0; i < N; i++){    for(int j = 0; j < M; j++){     graph[i][j] = new ArrayList<Integer>();    }   }   for(int i = 0; i < N; i++){    st = new StringTokenizer(br.readLine());    for(int j = 0; j < M-1; j++){     int w = Integer.parseInt(st.nextToken());     graph[i][j].add(w);    }   }   for(int i = 0; i < N; i++){    graph[i][M-1].add(0);   }   for(int i = 0; i < N-1; i++){    st = new StringTokenizer(br.readLine());    for(int j = 0; j < M; j++){     int w = Integer.parseInt(st.nextToken());     graph[i][j].add(w);    }   }   K /= 2;   for(int i = 0; i < M; i++) graph[N-1][i].add(0);   long ans[][][] = new long[K+1][N][M];   for(int i = 0; i < N; i++){    Arrays.fill(ans[0][i], 0);   }   for(int i = 1; i <= K; i++){    for(int x = 0; x < N; x++){     for(int y = 0; y < M; y++){      long cur = (long)1e17;      if(x < N-1){       cur = (long)Math.min(cur, graph[x][y].get(1) + ans[i-1][x+1][y]);      }      if(y < M-1){       cur = (long)Math.min(cur, graph[x][y].get(0) + ans[i-1][x][y+1]);      }      if(x > 0){       cur = (long)Math.min(cur, graph[x-1][y].get(1) + ans[i-1][x-1][y]);            }      if(y > 0){       cur = (long)Math.min(cur, graph[x][y-1].get(0) + ans[i-1][x][y-1]);      }      ans[i][x][y] = cur;     }    }   }   for(int i = 0; i < N; i++){    for(int j = 0; j < M; j++){     pw.print(ans[K][i][j] * 2 + " ");    }    pw.println();   }   br.close(); pw.close();  }  static class pii implements Comparable<pii>{   int f, s, k;   pii(int f, int s, int k){    this.f = f;    this.s = s;    this.k = k;   }   public int compareTo(pii x){    return Integer.compare(f, x.f);   }  } }
4	public class C { public static void main(String[] args) throws Exception {  final int fuck = 2001;  Scanner in = new Scanner(new File("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  int n = in.nextInt(), m = in.nextInt();  int[] D = new int[ fuck*fuck ],  dx = new int[] { 1, -1, 0, 0},  dy = new int[] { 0, 0, -1, 1};  Arrays.fill(D, -1);  ArrayDeque<Integer> Q = new ArrayDeque<>();  int k = in.nextInt(), ans = 0;  for(int i = 0; i < k; ++i) {  int x = in.nextInt(), y = in.nextInt();  D[ans = (x * fuck + y)] = 0;  Q.offer(ans);  }   while(!Q.isEmpty()) {  int idx = Q.poll();  int x = idx / fuck, y = idx % fuck;  for(int i = 0; i < 4; ++i) {   int wtf = (dx[i] + x) * fuck + (dy[i] + y);   if(dx[i] + x <= n && dx[i] + x >= 1 && dy[i] + y <= m && dy[i] + y >= 1 && D[wtf] == -1) {   D[wtf] = D[idx] + 1;   Q.offer(wtf);    if(D[wtf] >= D[ans])    ans = wtf;   }  }  }  out.println((ans / fuck) + " " + (ans % fuck));  out.close();  in.close(); } }
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;  } }
0	public class LuckyDivision {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);     int n = in.nextInt();     if( n % 4==0 ||    n % 7==0 ||    n % 47==0 ||    n % 74==0 ||    n % 447==0 ||    n % 474==0 ||    n % 477==0 ||    n % 744==0 ||    n % 774==0 ||    n % 777==0   )    System.out.println("YES");   else    System.out.println("NO");  } }
5	public class Main {  public static void main(String[] args) {   Scanner input = new Scanner(System.in);   int n = input.nextInt();   int k = input.nextInt() - 1 ;   int a[][] = new int[n][2];   for (int i = 0;i <n; i++) {    a[i][0]=input.nextInt();    a[i][1]=input.nextInt();   }   for (int i = 0; i<n; i++) {    for (int j=i+1; j<n; j++) {     if (a[i][0]<a[j][0]) {      int x=a[i][0];      int y=a[i][1];      a[i][0]=a[j][0];      a[i][1]=a[j][1];      a[j][0]=x;      a[j][1]=y;          }    }   }   for (int i = 0; i<n; i++) {    for (int j=i+1; j<n; j++) {     if ((a[i][1]>a[j][1])&&(a[i][0]==a[j][0])) {      int x=a[i][0];      int y=a[i][1];      a[i][0]=a[j][0];      a[i][1]=a[j][1];      a[j][0]=x;      a[j][1]=y;          }    }   }   int x = a[k][0];   int y = a[k][1];   int s = 0;   for (int i = 0; i<n; i++) {    if ((a[i][0]==x)&&(a[i][1]==y)) {     s++;    }   }   System.out.println(s);  } }
6	public class Main {  public static void main(String[] args) {   new Thread(null, new Runnable() {    public void run() {     new Main().solve();    }   }, "1", 1 << 26).start();  }  void solve() {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   E2RotateColumnsHardVersion solver = new E2RotateColumnsHardVersion();   int testCount = in.scanInt();   for (int i = 1; i <= testCount; i++)    solver.solve(i, in, out);   out.close();  }  static class E2RotateColumnsHardVersion {   int[][] dp;   int[] cur;   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    int m = in.scanInt();    int[][] ar = new int[n][m];    int[][] max = new int[m][2];    for (int i = 0; i < n; i++)     for (int j = 0; j < m; j++)      ar[i][j] = in.scanInt();    for (int i = 0; i < m; i++) {     for (int j = 0; j < n; j++) max[i][0] = Math.max(max[i][0], ar[j][i]);     max[i][1] = i;    }    CodeHash.shuffle(max);    Arrays.sort(max, (o1, o2) -> -o1[0] + o2[0]);    dp = new int[2][1 << n];    cur = new int[1 << n];    for (int i = 0; i < Math.min(m, n); i++) {     Arrays.fill(dp[i & 1], 0);     for (int k = 0; k < n; k++) {      System.arraycopy(dp[(i - 1) & 1], 0, cur, 0, 1 << n);      for (int l = 0; l < n; l++) {       for (int j = 0; j < 1 << n; j++) {        if ((j & (1 << l)) == 0) {         cur[j ^ (1 << l)] = Math.max(cur[j ^ (1 << l)], cur[j] + ar[(k + l) % n][max[i][1]]);        }       }      }      for (int j = 0; j < 1 << n; j++) dp[i & 1][j] = Math.max(dp[i & 1][j], cur[j]);     }    }    out.println(dp[Math.min(n, m) & 1 ^ 1][(1 << n) - 1]);   }  }  static class CodeHash {   public static void shuffle(int[][] ar) {    Random rd = new Random(new Random().nextInt());    for (int i = 0; i < ar.length; i++) {     int index = rd.nextInt(ar.length);     int[] temp = ar[i];     ar[i] = ar[index];     ar[index] = temp;    }   }  }  static class ScanReader {   private byte[] buf = new byte[4 * 1024];   private int index;   private BufferedInputStream in;   private int total;   public ScanReader(InputStream inputStream) {    in = new BufferedInputStream(inputStream);   }   private int scan() {    if (index >= total) {     index = 0;     try {      total = in.read(buf);     } catch (Exception e) {      e.printStackTrace();     }     if (total <= 0) return -1;    }    return buf[index++];   }   public int scanInt() {    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();     }    }    return neg * integer;   }   private boolean isWhiteSpace(int n) {    if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;    else return false;   }  } }
5	public class Main{   public static void main(String[] args){     Scanner sc = new Scanner(System.in);     int n = sc.nextInt();     TreeSet<Integer> set = new TreeSet<Integer>();      for(int i=0;i<n;i++){       set.add(sc.nextInt());     }      if(set.size() >= 2)       System.out.println(set.toArray()[1]);     else       System.out.println("NO");   } }
2	public class Contest {  public static void main(String[] args)throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   String[] s=br.readLine().split(" ");  BigInteger x = new BigInteger(s[0]);  BigInteger k = new BigInteger(s[1]);  BigInteger mod = new BigInteger(String.valueOf((int) (Math.pow(10, 9) + 7)));  BigInteger two = new BigInteger("2");  BigInteger interm = two.modPow(k, mod);  BigInteger res = interm.multiply(x).add(interm.multiply(x)).subtract(interm).add(BigInteger.ONE).mod(mod);  if(x.equals(BigInteger.ZERO)) {  System.out.println("0");  return;  }  System.out.println(res); } }
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()); } }
6	public class CFContest {  public static void main(String[] args) throws Exception {   boolean local = System.getProperty("ONLINE_JUDGE") == null;   boolean async = false;   Charset charset = Charset.forName("ascii");   FastIO io = local ? new FastIO(new FileInputStream("D:\\DATABASE\\TESTCASE\\Code.in"), System.out, charset) : new FastIO(System.in, System.out, charset);   Task task = new Task(io, new Debug(local));   if (async) {    Thread t = new Thread(null, task, "dalt", 1 << 27);    t.setPriority(Thread.MAX_PRIORITY);    t.start();    t.join();   } else {    task.run();   }   if (local) {    io.cache.append("\n\n--memory -- \n" + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20) + "M");   }   io.flush();  }  public static class Task implements Runnable {   final FastIO io;   final Debug debug;   int inf = (int) 1e9 + 2;   BitOperator bitOperator = new BitOperator();   Modular modular = new Modular((int) 1e9 + 7);   public Task(FastIO io, Debug debug) {    this.io = io;    this.debug = debug;   }   @Override   public void run() {    solve();   }   int[][][] f;   int n;   int t;   int[] songTimes;   int[] songTypes;   int mask;   public void solve() {    n = io.readInt();    t = io.readInt();    mask = 1 << n;    f = new int[4][mask][t + 1];    for (int i = 0; i < 4; i++) {     for (int j = 0; j < mask; j++) {      for (int k = 0; k <= t; k++) {       f[i][j][k] = -1;      }     }    }    songTimes = new int[n + 1];    songTypes = new int[n + 1];    for (int i = 1; i <= n; i++) {     songTimes[i] = io.readInt();     songTypes[i] = io.readInt();    }    int ans = 0;    for (int i = 0; i < 4; i++) {     for (int j = 0; j < mask; j++) {      ans = modular.plus(ans, f(i, j, t));     }    }    io.cache.append(ans);   }   int f(int i, int j, int k) {    if (j == 0) {     return k == 0 && i == 0 ? 1 : 0;    }    if (k < 0) {     return 0;    }    if (f[i][j][k] == -1) {     f[i][j][k] = 0;     for (int x = 1; x <= n; x++) {      if (songTypes[x] != i || bitOperator.bitAt(j, x - 1) == 0) {       continue;      }      for (int y = 0; y < 4; y++) {       if (y == i) {        continue;       }       f[i][j][k] = modular.plus(f[i][j][k], f(y, bitOperator.setBit(j, x - 1, false), k - songTimes[x]));      }     }    }    return f[i][j][k];   }  }    public static class Modular {   int m;   public Modular(int m) {    this.m = m;   }   public int valueOf(int x) {    x %= m;    if (x < 0) {     x += m;    }    return x;   }   public int valueOf(long x) {    x %= m;    if (x < 0) {     x += m;    }    return (int) x;   }   public int mul(int x, int y) {    return valueOf((long) x * y);   }   public int plus(int x, int y) {    return valueOf(x + y);   }   @Override   public String toString() {    return "mod " + m;   }  }  public static class BitOperator {   public int bitAt(int x, int i) {    return (x >> i) & 1;   }   public int bitAt(long x, int i) {    return (int) ((x >> i) & 1);   }   public int setBit(int x, int i, boolean v) {    if (v) {     x |= 1 << i;    } else {     x &= ~(1 << i);    }    return x;   }   public long setBit(long x, int i, boolean v) {    if (v) {     x |= 1L << i;    } else {     x &= ~(1L << i);    }    return x;   }      public boolean subset(long x, long y) {    return intersect(x, y) == x;   }      public long merge(long x, long y) {    return x | y;   }   public long intersect(long x, long y) {    return x & y;   }   public long differ(long x, long y) {    return x - intersect(x, y);   }  }  public static class Randomized {   static Random random = new Random();   public static double nextDouble(double min, double max) {    return random.nextDouble() * (max - min) + min;   }   public static void randomizedArray(int[] data, int from, int to) {    to--;    for (int i = from; i <= to; i++) {     int s = nextInt(i, to);     int tmp = data[i];     data[i] = data[s];     data[s] = tmp;    }   }   public static void randomizedArray(long[] data, int from, int to) {    to--;    for (int i = from; i <= to; i++) {     int s = nextInt(i, to);     long tmp = data[i];     data[i] = data[s];     data[s] = tmp;    }   }   public static void randomizedArray(double[] data, int from, int to) {    to--;    for (int i = from; i <= to; i++) {     int s = nextInt(i, to);     double tmp = data[i];     data[i] = data[s];     data[s] = tmp;    }   }   public static void randomizedArray(float[] data, int from, int to) {    to--;    for (int i = from; i <= to; i++) {     int s = nextInt(i, to);     float tmp = data[i];     data[i] = data[s];     data[s] = tmp;    }   }   public static <T> void randomizedArray(T[] data, int from, int to) {    to--;    for (int i = from; i <= to; i++) {     int s = nextInt(i, to);     T tmp = data[i];     data[i] = data[s];     data[s] = tmp;    }   }   public static int nextInt(int l, int r) {    return random.nextInt(r - l + 1) + l;   }  }   public static class Splay implements Cloneable {   public static final Splay NIL = new Splay();   static {    NIL.left = NIL;    NIL.right = NIL;    NIL.father = NIL;    NIL.size = 0;    NIL.key = Integer.MIN_VALUE;    NIL.sum = 0;   }   Splay left = NIL;   Splay right = NIL;   Splay father = NIL;   int size = 1;   int key;   long sum;   public static void splay(Splay x) {    if (x == NIL) {     return;    }    Splay y, z;    while ((y = x.father) != NIL) {     if ((z = y.father) == NIL) {      y.pushDown();      x.pushDown();      if (x == y.left) {       zig(x);      } else {       zag(x);      }     } else {      z.pushDown();      y.pushDown();      x.pushDown();      if (x == y.left) {       if (y == z.left) {        zig(y);        zig(x);       } else {        zig(x);        zag(x);       }      } else {       if (y == z.left) {        zag(x);        zig(x);       } else {        zag(y);        zag(x);       }      }     }    }    x.pushDown();    x.pushUp();   }   public static void zig(Splay x) {    Splay y = x.father;    Splay z = y.father;    Splay b = x.right;    y.setLeft(b);    x.setRight(y);    z.changeChild(y, x);    y.pushUp();   }   public static void zag(Splay x) {    Splay y = x.father;    Splay z = y.father;    Splay b = x.left;    y.setRight(b);    x.setLeft(y);    z.changeChild(y, x);    y.pushUp();   }   public void setLeft(Splay x) {    left = x;    x.father = this;   }   public void setRight(Splay x) {    right = x;    x.father = this;   }   public void changeChild(Splay y, Splay x) {    if (left == y) {     setLeft(x);    } else {     setRight(x);    }   }   public void pushUp() {    if (this == NIL) {     return;    }    size = left.size + right.size + 1;    sum = left.sum + right.sum + key;   }   public void pushDown() {   }   public static int toArray(Splay root, int[] data, int offset) {    if (root == NIL) {     return offset;    }    offset = toArray(root.left, data, offset);    data[offset++] = root.key;    offset = toArray(root.right, data, offset);    return offset;   }   public static void toString(Splay root, StringBuilder builder) {    if (root == NIL) {     return;    }    root.pushDown();    toString(root.left, builder);    builder.append(root.key).append(',');    toString(root.right, builder);   }   public Splay clone() {    try {     return (Splay) super.clone();    } catch (CloneNotSupportedException e) {     throw new RuntimeException(e);    }   }   public static Splay cloneTree(Splay splay) {    if (splay == NIL) {     return NIL;    }    splay = splay.clone();    splay.left = cloneTree(splay.left);    splay.right = cloneTree(splay.right);    return splay;   }   public static Splay add(Splay root, Splay node) {    if (root == NIL) {     return node;    }    Splay p = root;    while (root != NIL) {     p = root;     root.pushDown();     if (root.key < node.key) {      root = root.right;     } else {      root = root.left;     }    }    if (p.key < node.key) {     p.setRight(node);    } else {     p.setLeft(node);    }    p.pushUp();    splay(node);    return node;   }      public static Splay selectMinAsRoot(Splay root) {    if (root == NIL) {     return root;    }    root.pushDown();    while (root.left != NIL) {     root = root.left;     root.pushDown();    }    splay(root);    return root;   }      public static Splay selectMaxAsRoot(Splay root) {    if (root == NIL) {     return root;    }    root.pushDown();    while (root.right != NIL) {     root = root.right;     root.pushDown();    }    splay(root);    return root;   }      public static Splay deleteRoot(Splay root) {    root.pushDown();    Splay left = splitLeft(root);    Splay right = splitRight(root);    return merge(left, right);   }      public static Splay splitLeft(Splay root) {    root.pushDown();    Splay left = root.left;    left.father = NIL;    root.setLeft(NIL);    root.pushUp();    return left;   }      public static Splay splitRight(Splay root) {    root.pushDown();    Splay right = root.right;    right.father = NIL;    root.setRight(NIL);    root.pushUp();    return right;   }    public static Splay merge(Splay a, Splay b) {    if (a == NIL) {     return b;    }    if (b == NIL) {     return a;    }    a = selectMaxAsRoot(a);    a.setRight(b);    a.pushUp();    return a;   }   public static Splay selectKthAsRoot(Splay root, int k) {    if (root == NIL) {     return NIL;    }    Splay trace = root;    Splay father = NIL;    while (trace != NIL) {     father = trace;     trace.pushDown();     if (trace.left.size >= k) {      trace = trace.left;     } else {      k -= trace.left.size + 1;      if (k == 0) {       break;      } else {       trace = trace.right;      }     }    }    splay(father);    return father;   }   public static Splay selectKeyAsRoot(Splay root, int k) {    if (root == NIL) {     return NIL;    }    Splay trace = root;    Splay father = NIL;    Splay find = NIL;    while (trace != NIL) {     father = trace;     trace.pushDown();     if (trace.key > k) {      trace = trace.left;     } else {      if (trace.key == k) {       find = trace;       trace = trace.left;      } else {       trace = trace.right;      }     }    }    splay(father);    if (find != NIL) {     splay(find);     return find;    }    return father;   }   public static Splay bruteForceMerge(Splay a, Splay b) {    if (a == NIL) {     return b;    } else if (b == NIL) {     return a;    }    if (a.size < b.size) {     Splay tmp = a;     a = b;     b = tmp;    }    a = selectMaxAsRoot(a);    int k = a.key;    while (b != NIL) {     b = selectMinAsRoot(b);     if (b.key >= k) {      break;     }     Splay kickedOut = b;     b = deleteRoot(b);     a = add(a, kickedOut);    }    return merge(a, b);   }   public static Splay[] split(Splay root, int key) {    if (root == NIL) {     return new Splay[]{NIL, NIL};    }    Splay p = root;    while (root != NIL) {     p = root;     root.pushDown();     if (root.key > key) {      root = root.left;     } else {      root = root.right;     }    }    splay(p);    if (p.key <= key) {     return new Splay[]{p, splitRight(p)};    } else {     return new Splay[]{splitLeft(p), p};    }   }   @Override   public String toString() {    StringBuilder builder = new StringBuilder().append(key).append(":");    toString(cloneTree(this), builder);    return builder.toString();   }  }  public static class FastIO {   public final StringBuilder cache = new StringBuilder();   private final InputStream is;   private final OutputStream os;   private final Charset charset;   private StringBuilder defaultStringBuf = new StringBuilder(1 << 8);   private byte[] buf = new byte[1 << 13];   private int bufLen;   private int bufOffset;   private int next;   public FastIO(InputStream is, OutputStream os, Charset charset) {    this.is = is;    this.os = os;    this.charset = charset;   }   public FastIO(InputStream is, OutputStream os) {    this(is, os, Charset.forName("ascii"));   }   private int read() {    while (bufLen == bufOffset) {     bufOffset = 0;     try {      bufLen = is.read(buf);     } catch (IOException e) {      throw new RuntimeException(e);     }     if (bufLen == -1) {      return -1;     }    }    return buf[bufOffset++];   }   public void skipBlank() {    while (next >= 0 && next <= 32) {     next = read();    }   }   public int readInt() {    int sign = 1;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+' ? 1 : -1;     next = read();    }    int val = 0;    if (sign == 1) {     while (next >= '0' && next <= '9') {      val = val * 10 + next - '0';      next = read();     }    } else {     while (next >= '0' && next <= '9') {      val = val * 10 - next + '0';      next = read();     }    }    return val;   }   public long readLong() {    int sign = 1;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+' ? 1 : -1;     next = read();    }    long val = 0;    if (sign == 1) {     while (next >= '0' && next <= '9') {      val = val * 10 + next - '0';      next = read();     }    } else {     while (next >= '0' && next <= '9') {      val = val * 10 - next + '0';      next = read();     }    }    return val;   }   public double readDouble() {    boolean sign = true;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+';     next = read();    }    long val = 0;    while (next >= '0' && next <= '9') {     val = val * 10 + next - '0';     next = read();    }    if (next != '.') {     return sign ? val : -val;    }    next = read();    long radix = 1;    long point = 0;    while (next >= '0' && next <= '9') {     point = point * 10 + next - '0';     radix = radix * 10;     next = read();    }    double result = val + (double) point / radix;    return sign ? result : -result;   }   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);   }   public int readLine(char[] data, int offset) {    int originalOffset = offset;    while (next != -1 && next != '\n') {     data[offset++] = (char) next;     next = read();    }    return offset - originalOffset;   }   public int readString(char[] data, int offset) {    skipBlank();    int originalOffset = offset;    while (next > 32) {     data[offset++] = (char) next;     next = read();    }    return offset - originalOffset;   }   public int readString(byte[] data, int offset) {    skipBlank();    int originalOffset = offset;    while (next > 32) {     data[offset++] = (byte) next;     next = read();    }    return offset - originalOffset;   }   public char readChar() {    skipBlank();    char c = (char) next;    next = read();    return c;   }   public void flush() {    try {     os.write(cache.toString().getBytes(charset));     os.flush();     cache.setLength(0);    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public boolean hasMore() {    skipBlank();    return next != -1;   }  }  public static class Debug {   private boolean allowDebug;   public Debug(boolean allowDebug) {    this.allowDebug = allowDebug;   }   public void assertTrue(boolean flag) {    if (!allowDebug) {     return;    }    if (!flag) {     fail();    }   }   public void fail() {    throw new RuntimeException();   }   public void assertFalse(boolean flag) {    if (!allowDebug) {     return;    }    if (flag) {     fail();    }   }   private void outputName(String name) {    System.out.print(name + " = ");   }   public void debug(String name, int x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, long x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, double x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, int[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, long[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, double[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, Object x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, Object... x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.deepToString(x));   }  } }
0	public class Main { public static void main(String args[]) throws IOException {  BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));  String line = stdin.readLine();  String[] prms = line.split(" ");   long a = Long.parseLong(prms[0]);  long b = Long.parseLong(prms[1]);   long cnt = 0;  while (a > 0 && b > 0) {  if (a >= b) {   cnt += a / b;   a = a % b;  }  long c = a;  a = b;  b = c;  }   System.out.println(cnt); } }
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());  } }
1	public class B {  private static StreamTokenizer in;  private static PrintWriter out;   private static int nextInt() throws Exception{   in.nextToken();   return (int)in.nval;  }   private static String nextString() throws Exception{   in.nextToken();   return in.sval;  }   static{   in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));   out = new PrintWriter(System.out);  }   public static void main(String[] args)throws Exception{   int n = nextInt();   char[] c = nextString().toCharArray();     int tc = 0, hc = 0;   for(int i = 0;i<c.length; i++){    if(c[i] == 'T')tc++; else hc++;   }        int max = -1;   int pos = 0;   for(int i = 0; i<c.length; i++){    int a = 0;    for(int j = 0; j<tc;j++){     int k = i+j;     if(k>=n)k-=n;     if(c[k] == 'T'){      a++;     }    }    if(a>max){     max = a;     pos = i;    }   }   int min1 = tc - max;     max = -1;   pos = 0;   for(int i = 0; i<c.length; i++){    int a = 0;    for(int j = 0; j<hc;j++){     int k = i+j;     if(k>=n)k-=n;     if(c[k] == 'H'){      a++;     }    }    if(a>max){     max = a;     pos = i;    }   }   int min2 = hc - max;     out.println(Math.min(min1, min2));   out.flush();  } }
3	public class F2{ static class Pair{  int l;  int r;  Pair(int l, int r){  this.l = l;  this.r = r;  }  public String toString(){  return "(" + l + ", " + r + ")";  } } public static void main(String[] args){  Scanner in = new Scanner(System.in);  int n = in.nextInt();  int[] a = new int[n+1];  for(int i = 1;i<=n;++i){  a[i] = in.nextInt();  }  HashMap<Integer, Vector<Pair>> map = new HashMap<>();  for(int i = 1;i<=n;++i){  int sum = 0;  for(int j = i;j<=n;++j){   sum+=a[j];   if(!map.containsKey(sum))   map.put(sum,new Vector<>());   map.get(sum).add(new Pair(i,j));  }  }  Vector<Pair> an = null;  for(Integer key : map.keySet()){  Vector<Pair> vec = map.get(key);  Vector<Pair> ans = new Vector<>();  ans.add(vec.get(0));  int size = 1;  for(int i = 1;i<vec.size();++i){   if(ans.get(size-1).r > vec.get(i).r)   ans.set(size-1,vec.get(i));   else if(ans.get(size-1).r < vec.get(i).l){   ans.add(vec.get(i));   size++;   }  }  if(an == null || an.size() < size) an = ans;  }  StringBuilder res = new StringBuilder().append(an.size() + "\n");  for(int i = 0;i<an.size();++i)  res.append(an.get(i).l + " " + an.get(i).r + "\n");  System.out.println(res); } }
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();  } }
2	public class run{  public static void main(String args[]){   Scanner in = new Scanner(System.in);   long n = in.nextInt();   long k = in.nextInt();   long ans = (-3 + (long)Math.sqrt(9+8*(n+k)))/2;   System.out.println(n-ans);  } }
6	public class ELR {  static double solveUnweighted (int nodes, long curr, long pool, long excl) {  if (pool == 0 && excl == 0) {  int cnt = 0;  for (int i = 0; i < nodes; i++)   if ((curr & 1L << i) > 0)   cnt++;    double cont = (k / (cnt*1.0));  double edges = (cnt) * (cnt - 1) / 2.0;  return cont * cont * edges;  }  double res = 0;  int j = 0;  for (int i = 0; i < nodes; i++)  if ((pool & 1L << i) > 0 || (excl & 1L << i) > 0)   j = i;  for (int i = 0; i < nodes; i++) {  if ((pool & 1L << i) == 0 || adj[i][j])   continue;  long ncurr = curr, npool = 0, nexcl = 0;  ncurr |= 1L << i;   for (int k = 0; k < nodes; k++) {   if (adj[i][k]) {   npool |= pool & 1L << k;   nexcl |= excl & 1L << k;   }  }  res = Math.max(res, solveUnweighted(nodes, ncurr, npool, nexcl));   pool &= ~(1L << i);  excl |= 1L >> i;  }  return res; } public static void main(String[] args) {new Thread(null, new Runnable() { public void run() {try {  sol(); } catch (Throwable e) {   e.printStackTrace(); }}}, "2",1<<26).start();}  static int n,k; static boolean adj[][]; public static void sol() throws Throwable {  Scanner sc = new Scanner(System.in);  n = sc.nextInt();  k = sc.nextInt();  adj = new boolean[n][n];  for (int i = 0 ; i < n ; ++i) {  for (int j = 0 ; j < n ; ++j) {   adj[i][j] = sc.nextInt() == 1;  }  }  double ans = solveUnweighted(n, 0, (1L << n) - 1, 0);  System.out.println(ans); }  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 {  return Double.parseDouble(next());  }  public boolean ready() throws IOException {  return br.ready();  } } }
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;   }  } }
4	public class j { public static void main(String a[])throws IOException { BufferedReader b = new BufferedReader(new FileReader("input.txt")); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt"))); int l=0,x2=0,x=0,y1=0,y=0,max=-1,min=100000,x1=0,n=0,j=0,k=0,p=0,m=0,i=0; String s; s=b.readLine(); StringTokenizer c=new StringTokenizer(s); n=Integer.parseInt(c.nextToken()); m=Integer.parseInt(c.nextToken()); k=Integer.parseInt(b.readLine()); int e[][]=new int[k][2]; s=b.readLine(); StringTokenizer z=new StringTokenizer(s); for(i=0;i<k;i++) { e[i][0]=Integer.parseInt(z.nextToken()); e[i][1]=Integer.parseInt(z.nextToken()); } for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { for(l=0;l<k;l++) { p=(int)Math.abs(e[l][0]-i)+(int)Math.abs(e[l][1]-j); if(p<min) { min=p; x1=i; y1=j; } } if(min>max) { max=min; x=x1; y=y1; } min=100000; } } out.print(x+" "+y); out.close(); } }
3	public class oK{    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();    }    Arrays.sort(a);    int b[]=new int[101];    int flag=0;    int count=0;    for(int i=0;i<n;i++) {     flag=0;     if(b[a[i]]==0) {     count++;     }     for(int j=i;j<n;j++) {     if(b[a[j]]==0&&a[j]%a[i]==0) {           b[a[j]]=1;           }          }             }    pn(count);            }                                      static boolean multipleTC = false, memory = false;    FastReader in;PrintWriter out;    void run() throws Exception{     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();    }    public static void main(String[] args) throws Exception{     if(memory)new Thread(null, new Runnable() {public void run(){try{new oK().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();     else new oK().run();    }    void p(Object o){out.print(o);}    void pn(Object o){out.println(o);}    void pni(Object o){out.println(o);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());}       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;     }    }   }
3	public class codea{ public static void main(String args[]) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  int arr[] = new int[n];  for(int i =0;i<n;i++)  arr[i]= in.nextInt();  Arrays.sort(arr);  int max =0;  boolean check[]= new boolean [n];  int count=0;  for(int i =0;i<n;i++)  {    if(!check[i])  {   count++;    for(int j=i;j<n;j++)  {    if(arr[j]%arr[i]==0)   check[j]=true;  }    }  }  System.out.println(count);  } }
2	public class A {  private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  private StringTokenizer tokenizer = null;  long mod = 1000000007;  public static void main(String[] args) throws IOException  {   new A().solve();  }  private void solve() throws IOException  {   long x = nl();   long k = nl();   if (x == 0)   {    System.out.println(0);    System.exit(0);   }   if (k == 0)   {    System.out.println((x * 2) % mod);    System.exit(0);   }             BigInteger n = BigInteger.valueOf(2)     .modPow(BigInteger.valueOf(k + 1), BigInteger.valueOf(mod))     .multiply(BigInteger.valueOf(x))     .add(BigInteger.ONE)     .subtract(BigInteger.valueOf(2)       .modPow(BigInteger.valueOf(k), BigInteger.valueOf(mod)))     .mod(BigInteger.valueOf(mod));   System.out.println(n.toString());  }  long aux(long x, long k) {   long p1 = 2 * x;   long p2 = 2 * x - 1;   for (int i = 0; i < k - 1; i++)   {    p1 = (p1 * 2) % mod;    p2 = (p2 * 2 - 1) % mod;   }   return ((p1 + p2) % mod);  }  void debug(Object... os)  {   System.out.println(Arrays.deepToString(os));  }  int ni() throws IOException  {   return Integer.parseInt(ns());  }  long nl() throws IOException  {   return Long.parseLong(ns());  }  double nd() throws IOException  {   return Double.parseDouble(ns());  }  String ns() throws IOException  {   while (tokenizer == null || !tokenizer.hasMoreTokens())    tokenizer = new StringTokenizer(br.readLine());   return tokenizer.nextToken();  }  String nline() throws IOException  {   tokenizer = null;   return br.readLine();  }  private static long gcd(long a, long b)  {   while (b > 0)   {    long temp = b;    b = a % b;    a = temp;   }   return a;  }  private static long lcm(long a, long b)  {   return a * (b / gcd(a, b));  } }
3	public class PaintTheNumbers {  public static void main(String[] args) throws IOException {   int[] colors = new int[101];   BufferedReader f = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(f.readLine());   int N = Integer.parseInt(st.nextToken());   st = new StringTokenizer(f.readLine());   for (int i = 0; i < N; i++) {    colors[Integer.parseInt(st.nextToken())]++;   }   int colorCount = 0;   for (int i = 1; i <= 100; i++) {    if (colors[i] != 0) {     colors[i] = 0;     for (int multiple = 2; multiple * i <= 100; multiple++) {      colors[i*multiple] = 0;     }     colorCount++;    }   }   System.out.println(colorCount);  } }
5	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("");  private void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  int n = nextInt();  int m[] = new int[n];  for(int i = 0; i < n; i++)  m[i] = nextInt();  sort(m);  m[n - 1] = m[n - 1] != 1 ? 1 : 2;  sort(m);  for(int i = 0; i < n; i++){  if(i != 0) out.print(" ");  out.print(m[i]);  }  out.println();  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; } }
1	public class Main implements Runnable { private BufferedReader in; private PrintWriter out; private StringTokenizer st;  private void eat(String line) {  st = new StringTokenizer(line); }  private String next() throws IOException {  while(!st.hasMoreTokens()) {  String line = in.readLine();  if(line == null)   return null;  eat(line);  }  return st.nextToken(); }  private int nextInt() throws IOException {  return Integer.parseInt(next()); }  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new OutputStreamWriter(System.out));  eat("");    go();    out.close();  } catch(Exception e) {  e.printStackTrace();  System.exit(-1);  } }  public static void main(String[] args) {  new Thread(new Main()).start(); }  public void go() throws IOException {  int n = nextInt();  int[] v = new int[n], count = new int[2];  for(int i = 0; i < n; ++i) {  v[i] = nextInt();  ++count[v[i] % 2];  }  int residue = count[0] == 1 ? 0 : 1;  for(int i = 0; i < n; ++i)  if(v[i] % 2 == residue)   out.println(i + 1); } }
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");   } } }
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());  } }
5	public class A015 {  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt(), t = in.nextInt();  int[] centers = new int[n], sides = new int[n];  for (int x = 0; x < n; x++) {  centers[x] = in.nextInt();  sides[x] = in.nextInt();  }  int count = 0;  big: for (int x = -4000; x <= 4000; x++) {  boolean touch = false;  for (int i = 0; i < n; i++) {   int d = 2*centers[i] - x;   d = d > 0 ? d : -d;   int s = t + sides[i];   if (s == d) {   touch = true;   } else if (s > d) {   continue big;   }  }  if (touch)   count++;  }  System.out.println(count); } }
1	public class Main { PrintWriter out = new PrintWriter(System.out); BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer tok = new StringTokenizer("");  String next() throws IOException {   if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }   return tok.nextToken();  }  int ni() throws IOException { return Integer.parseInt(next()); }  long nl() throws IOException { return Long.parseLong(next()); }   long mod=1000000007;   void solve() throws IOException {   for (int tc=ni();tc>0;tc--) {    long n=ni();    long q=1;    long p=1;    boolean f=false;    while (true) {     if (p*2==n || p*4==n) { f=true; break; }     q++;     p=q*q;     if (p>n) break;    }    if (f) out.println("YES");    else out.println("NO");   }   out.flush();  }   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)); }  long mp(long a,long p) { long r=1; while(p>0) { if ((p&1)==1) r=(r*a)%mod; p>>=1; a=(a*a)%mod; } return r; }   public static void main(String[] args) throws IOException {   new Main().solve();  } }
2	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);   CNastyaAndAWardrobe solver = new CNastyaAndAWardrobe();   solver.solve(1, in, out);   out.close();  }  static class CNastyaAndAWardrobe {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    long x = in.nextLong();    long k = in.nextLong();    if (x == 0) {     out.println(0);    } else {     long mod = (long) (1e9 + 7);     long ans = (((((2 * x - 1) % mod)) * power(2, k, mod)) % mod) + 1;     ans %= mod;     out.println(ans);    }   }   long power(long x, long y, long p) {    long res = 1;    x = x % p;    while (y > 0) {     if ((y & 1) > 0)      res = (res * x) % p;     y = y >> 1;     x = (x * x) % p;    }    return res;   }  }  static class FastScanner {   private final InputStream stream;   private final byte[] buf = new byte[1024];   private int curChar;   private int numChars;   public FastScanner(InputStream stream) {    this.stream = stream;   }   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++];   }   boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public long nextLong() {    return Long.parseLong(next());   }   public String next() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }  } }
2	public class Main {  void solve() {   long x=nl(),k=nl();   if(x==0) {    pw.println(0);    return;   }   long d=modpow(2,k,M);   long ans=mul(2,d,M);   ans=mul(ans,x,M)%M;   ans++;   ans%=M;   ans=(ans-d+M)%M;   pw.println(ans);   }    long mul(long x, long y, long m) {   long ans = 0;   while (y>0) {    if ((y & 1)>0) {     ans += x;     if (ans >= m) ans -= m;    }    x = x + x;    if (x >= m) x -= m;    y >>= 1;   }   return ans;  }  long modpow(long a, long b,long M)  {   long r=1;   while(b>0)   {    if((b&1)>0) r=mul(r,a,M);    a=mul(a,a,M);    b>>=1;   }   return r;  }  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 Main().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)); } }
4	public class Main { public String[][] a; public void run () throws Exception {  Scanner in = new Scanner(new File("input.txt"));  PrintWriter pw = new PrintWriter(new File("output.txt"));  int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();   int[] xx = new int[k];  int[] yy = new int[k];  for(int i=0;i<k;i++){  xx[i] = in.nextInt();  yy[i]= in.nextInt();  }  int x=0,y=0,r;  r=-1;   for(int i=0;i<n;i++)  for(int j=0;j<m;j++){   int rr = 1000000;   for(int q=0;q<k;q++)   rr = Math.min(rr, Math.abs(xx[q]-1-i)+Math.abs(yy[q]-1-j));   if(rr>r){   r=rr;   x=i;   y=j;   }  }  pw.print((x+1)+" "+(y+1));  pw.close(); } public static void main(String[] args) throws Exception {  new Main ().run(); } }
2	public class TaskB {  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());  }  static long nextLong() throws IOException {   return Long.parseLong(next());  }  static double nextDouble() throws IOException {   return Double.parseDouble(next());  }  public static void main(String[] args) throws IOException {   long n = nextLong();   int k = nextInt();   if (n == 1) {    System.out.println(0);    return;   }   long sum = (((2 + (long) k)) * ((long) k - 1)) / 2 - ((long) k - 2);   if (n > sum) {    System.out.println(-1);    return;   } else if (n <= k) {    System.out.println(1);    return;   }   long cnt = 0;   long sum2 = 0;   int index = binSearch(2, k, k, n);   sum2 = (((long) (index) + k) * (long) (k - index + 1)) / 2 - (long) (k - index);   cnt = k - index + 1;   if (sum2 == n) {    System.out.println(cnt);    return;   }   if (sum2 > n)    for (int kk = index; kk <= k; kk++) {     sum2 = (((long) (kk) + k) * (long) (k - kk + 1)) / 2 - (long) (k - kk);     cnt--;     if (sum2 <= n) {      System.out.println(cnt + 1);      return;     }    }   else {    for (int kk = index - 1; kk >= 2; kk--) {     sum2 = (((long) (kk) + k) * (long) (k - kk + 1)) / 2 - (long) (k - kk);     cnt++;     if (sum2 >= n) {      System.out.println(cnt);      return;     }    }   }   System.out.println(-1);   return;  }  static int binSearch(int l, int r, int k, long n) {   while (true) {    int mid = l + (r - l) / 2;    long sum2 = (((long) (mid) + k) * (long) (k - mid + 1)) / 2 - (long) (k - mid);    if (l >= r || sum2 == n) {     return mid;    } else if (sum2 > n) {     l = mid + 1;    } else if (sum2 < n) {     r = mid;    }   }  } }
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;   }  } }
5	public class codef {  public static void main(String ar[]) throws IOException  {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   StringTokenizer nk=new StringTokenizer(br.readLine());   int n=Integer.parseInt(nk.nextToken());   int k=Integer.parseInt(nk.nextToken());   String st[]=br.readLine().split(" ");     int ans[]=new int[n];   int a[]=new int[n];   for(int i=0;i<n;i++)    ans[i]=Integer.parseInt(st[i]);    for(int i=1;i<n;i++)    a[i]=ans[i]-ans[i-1];   a[0]=-1;   Arrays.sort(a);   int count=0,sum=0;   for(int i=0;i<n;i++)    if(a[i]<0)     count++;    else     sum=sum+a[i];     k=k-count;   int i=n-1;   while(k>0 && i>=0)   {    if(a[i]>-1)    {     sum=sum-a[i];     k--;    }    i--;   }   System.out.println(sum);  } }
3	public class SameSumBlocksHard {  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in .nextInt();  long[] a = new long[n + 1];  long[] sum = new long[n + 1];  for (int i = 1; i <= n; i++) {  a[i] = in.nextInt();  sum[i] = sum[i - 1] + a[i];  }  Map<Long, List<int[]>> map = new HashMap<>();  for (int i = 1; i <= n; i++) {  for (int j = i; j <= n; j++) {   long x = sum[j] - sum[i - 1];   List<int[]> list = map.get(x);   if (list == null) {   list = new ArrayList<>();   map.put(x, list);   }   list.add(new int[] {i, j});  }  }  List<int[]> ans = new ArrayList<>();  for (Map.Entry<Long, List<int[]>> entry : map.entrySet()) {  List<int[]> list = entry.getValue();  List<int[]> tmp = new ArrayList<>();  calc(list, tmp);  if (tmp.size() > ans.size()) {   ans.clear();   ans.addAll(tmp);  }  }  System.out.println(ans.size());  for (int[] pair : ans) {  System.out.println(pair[0] + " " + pair[1]);  }  in.close(); }  static void calc(List<int[]> list, List<int[]> tmp) {  Collections.sort(list, new Comparator<int[]>() {  @Override  public int compare(int[] o1, int[] o2) {   if (o1[1] < o2[1]) {   return -1;   } else if (o1[1] > o2[1]) {   return 1;   } else {   return 0;   }  }  });  int last = -1;  for (int[] p : list) {  if (last == -1) {   last = p[1];   tmp.add(p);  } else if (p[0] > last) {   last = p[1];   tmp.add(p);  }  } } }
0	public class Main { static int mod = 1000000007; static int size = 200000; static long[] fac = new long[size]; static long[] finv = new long[size]; static long[] inv = new long[size]; static int INF = Integer.MAX_VALUE;  public static void main(String[] args){  Scanner scanner = new Scanner(System.in);  String[] s = new String[2];  for(int i = 0; i < 2; i++){  s[i] = scanner.next();  }  int n = s[0].length();  char[][] c = new char[2][n];  for(int i = 0; i < 2; i++){  for(int j = 0; j < n; j++){   c[i][j] = s[i].charAt(j);  }  }  int count = 0;  for(int i = 0; i < n-1; i++){  if(c[0][i] == '0' && c[1][i] == '0' && c[0][i+1] == '0'){   c[0][i] = 'X';   c[1][i] = 'X';   c[0][i+1] = 'X';   count++;  }  if(c[0][i] == '0' && c[1][i] == '0' && c[1][i+1] == '0'){   c[0][i] = 'X';   c[1][i] = 'X';   c[1][i+1] = 'X';   count++;  }  if(c[0][i] == '0' && c[0][i+1] == '0' && c[1][i+1] == '0'){   c[0][i] = 'X';   c[0][i+1] = 'X';   c[1][i+1] = 'X';   count++;  }  if(c[0][i+1] == '0' && c[1][i+1] == '0' && c[1][i] == '0'){   c[1][i] = 'X';   c[0][i+1] = 'X';   c[1][i+1] = 'X';   count++;  }  }  System.out.println(count); } public static boolean isPrime(int n){  if(n == 1) return false;  if(n == 2 || n == 3) return true;  for(int i = 2; i <= Math.sqrt(n); i++){  if(n % i == 0) return false;  }  return true; }  static boolean compare(String tar, String src) {  if (src == null) return true;  if (src.length() == tar.length()) {  int len = tar.length();  for (int i = 0; i < len; i++) {   if (src.charAt(i) > tar.charAt(i)) {   return false;   } else if (src.charAt(i) < tar.charAt(i)) {   return true;   }  }  return tar.compareTo(src) > 0 ? true : false;  } else if (src.length() < tar.length()) {  return true;  } else if (src.length() > tar.length()) {  return false;  }  return false; } public static class Edge{  int to;  Edge(int to){  this.to = to;  } } public static void swap(long a, long b){  long tmp = 0;  if(a > b){  tmp = a;  a = b;  b = tmp;  } } static class Pair implements Comparable<Pair>{  int first, second;  Pair(int a, int b){   first = a;   second = b;  }  @Override  public boolean equals(Object o){   if (this == o) return true;   if (!(o instanceof Pair)) return false;   Pair p = (Pair) o;   return first == p.first && second == p.second;  }  @Override  public int compareTo(Pair p){   return first == p.first ? second - p.second : first - p.first;          } }   public static long pow(long x, long n){  long ans = 1;  while(n > 0){  if((n & 1) == 1){   ans = ans * x;   ans %= mod;  }  x = x * x % mod;  n >>= 1;  }  return ans; }  public static long div(long x, long y){  return (x*pow(y, mod-2))%mod; }   public static void initComb(){  fac[0] = finv[0] = inv[0] = fac[1] = finv[1] = inv[1] = 1;  for (int i = 2; i < size; ++i) {  fac[i] = fac[i - 1] * i % mod;  inv[i] = mod - (mod / i) * inv[(int) (mod % i)] % mod;  finv[i] = finv[i - 1] * inv[i] % mod;  } }   public static long comb(int n, int k){  return fac[n] * finv[k] % mod * finv[n - k] % mod; }   public static long fact(int n){  return fac[n]; }   public static long finv(int n){  return finv[n]; }  static class UnionFind {  int[] parent;  public UnionFind(int size) {  parent = new int[size];  Arrays.fill(parent, -1);  }  public boolean unite(int x, int y) {  x = root(x);  y = root(y);  if (x != y) {   if (parent[y] < parent[x]) {   int tmp = y;   y = x;   x = tmp;   }   parent[x] += parent[y];   parent[y] = x;   return true;  }  return false;  }  public boolean same(int x, int y) {  return root(x) == root(y);  }  public int root(int x) {  return parent[x] < 0 ? x : (parent[x] = root(parent[x]));  }  public int size(int x) {  return -parent[root(x)];  } } public static int upperBound(int[] array, int value) {   int low = 0;   int high = array.length;   int mid;   while( low < high ) {    mid = ((high - low) >>> 1) + low;    if( array[mid] <= value ) {     low = mid + 1;    } else {     high = mid;    }   }   return low;  }  public static final int lowerBound(final int[] arr, final int value) {  int low = 0;  int high = arr.length;  int mid;  while (low < high){   mid = ((high - low) >>> 1) + low;    if (arr[mid] < value) {    low = mid + 1;   } else {    high = mid;   }  }  return low;  }  public static long gcd(long n, long m){  if(m > n) return gcd(m,n);  if(m == 0) return n;  return gcd(m, n%m); }  private class Pair2 implements Comparable<Pair2> {  String s;  int p;  int index;  public Pair2(String s, int p, int index) {   this.s = s;   this.p = p;   this.index = index;  }  public int compareTo(Pair2 other) {   if (s.equals(other.s)) {    return other.p - this.p;   }   return this.s.compareTo(other.s);  } }  public static int c2i(char c){ if('A' <= c && c <= 'Z'){  return c - 'A'; }else{  return c - 'a' + 26; } } public static char i2c(int i){ if(0 <= i && i < 26){  return (char)(i + 'A'); }else{  return (char)(i + 'a' - 26); } } }
1	public class Main {  class node{  int data;  node next;  public node(int val){  data=val;  next=null;  } } class linkedlist{  node start;  node end;  int size;  int turn;  public linkedlist(){  start=null;  end=null;  size=0;  }  void add(int val){  if(size==0){   node t=new node(val);   start=t;   end=t;   size++;  }  else{   node t=new node(val);   end.next=t;   end=end.next;   size++;  }  }  void myfunc(){  if(start.data>start.next.data){     node t=new node(start.next.data);   start.next=start.next.next;   end.next=t;   end=end.next;  }  else{     int t=start.data;   start=start.next;   add(t);   size--;  }  }  int findmax(){  int m=0;  node temp=start;  for(int i=0;i<size;i++){   if(temp.data>m){   m=temp.data;   }   temp=temp.next;  }  return m;  }  void display(){  node temp=start;  for(int i=0;i<size;i++){   System.out.print(temp.data+" ");   temp=temp.next;  }  System.out.println("");  } } linkedlist l; public Main(){  l=new linkedlist(); } public static void main(String [] argv) throws IOException {  BufferedReader in=new BufferedReader(new InputStreamReader(System.in));  Main ma=new Main();  String[] l1=in.readLine().split(" ");  int n=Integer.parseInt(l1[0]);  int q=Integer.parseInt(l1[1]);  String[] ar=in.readLine().split(" ");  int a1=Integer.parseInt(ar[0]);  int b1=Integer.parseInt(ar[1]);  for(int i=0;i<n;i++){  ma.l.add(Integer.parseInt(ar[i]));  }  int m=ma.l.findmax();  int[][] pair=new int[n][2];  int t=0;  for(int i=0;i<n;i++){  if(ma.l.start.data==m)   break;  ma.l.myfunc();  pair[t][0]=ma.l.start.data;  pair[t][1]=ma.l.start.next.data;  t++;  }  int rl[]=new int[n];  node temp=ma.l.start;  for(int i=0;i<n;i++){  rl[i]=temp.data;  temp=temp.next;  }  for(int i=0;i<q;i++){  long a=Long.parseLong(in.readLine());  if(a==1){   System.out.println(a1 + " " + b1);  }  else{   if(a<=t+1){   System.out.println(pair[(int)(a-2)][0]+" "+pair[(int)(a-2)][1]);   }   else{   if((a-t)%(n-1)==0){    System.out.println(rl[0]+" "+rl[n-1]);   }   else{    System.out.println(rl[0]+" "+rl[(int)((a-t)%(n-1))]);   }   }  }  } } }
1	public class Main implements Runnable {  public InputReader in;  public PrintWriter out;  public void solve() throws Exception {     int N = in.nextInt();   int[] houses = new int[N];   boolean[] exist = new boolean[52];   for (int i = 0; i < N; i++) {    char c = in.nextChar();    if ('a' <= c && c <= 'z') {     houses[i] = 26 + (c - 'a');    } else {     houses[i] = (c - 'A');    }    exist[houses[i]] = true;   }   int[][] pokemons = new int[N][52];   pokemons[0][houses[0]] = 1;   for (int i = 1; i < N; i++) {    System.arraycopy(pokemons[i-1], 0, pokemons[i], 0, pokemons[i].length);    pokemons[i][houses[i]]++;   }   int uniques = 0;   for(boolean bool : exist)    if (bool)     uniques++;   if (uniques == 1) {    out.print(1);    return;   }    int last_variant = -1;   for (int i = 0; i < N-1; i++) {    if (pokemons[i][houses[i]] == pokemons[N-1][houses[i]]) {     last_variant = i;     break;    }   }   int minimum = N;   for (int i = 0; i <= last_variant; i++) {    if (houses[i] == houses[i+1])     continue;        int low = i+1;    int high = N-1;    while (low < high) {     int mid = (low + high) / 2;     boolean allPresent = true;     for (int j = 0; j < 52; j++) {      if (j != houses[i] && exist[j] && pokemons[mid][j] == pokemons[i][j]) {       allPresent = false;       break;      }     }     if (allPresent) {      high = mid;     } else {      low = mid + 1;     }    }    minimum = min(minimum, low - i + 1);   }   out.print(minimum);  }  public void run() {   try {    in = new InputReader(System.in);    out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));    Locale.setDefault(Locale.US);    int tests = 1;    while (tests-- > 0) {     solve();    }    out.close();   } catch (Throwable e) {    e.printStackTrace();    System.exit(7);   }  }  static int abs(int x) {   return x < 0 ? -x : x;  }  static int max(int a, int b) {   return a > b ? a : b;  }  static int min(int a, int b) {   return a < b ? a : b;  }  static long abs(long x) {   return x < 0 ? -x : x;  }  static long max(long a, long b) {   return a > b ? a : b;  }  static long min(long a, long b) {   return a < b ? a : b;  }  public static void main(String args[]) {   new Thread(null, new Main(), "Main", 1 << 28).start();  }  static boolean OJ = System.getProperty("ONLINE_JUDGE") != null;  public void console(Object... objects) {   if (!OJ) {    out.println(Arrays.deepToString(objects));    out.flush();   }  }  @SuppressWarnings({"Duplicates", "unused"})  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[2048];   private int curChar;   private int numChars;   private SpaceCharFilter filter;   public InputReader() {    this.stream = System.in;   }   public InputReader(InputStream stream) {    this.stream = stream;   }   public InputReader(SpaceCharFilter filter) {    this.stream = System.in;    this.filter = filter;   }   public InputReader(InputStream stream, SpaceCharFilter filter) {    this.stream = stream;    this.filter = filter;   }   public int read() {    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 char nextChar() {    int c = read();    while (isSpaceChar(c))     c = read();    return (char) c;   }   public int nextDigit() {    int c = read();    while (isSpaceChar(c))     c = read();    return c - '0';   }   public int nextInt() {    int c = read();    while (isSpaceChar(c))     c = read();    boolean negative = false;    if (c == '-') {     negative = true;     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 negative ? -res : res;   }   public int[] nextInts(int N) {    int[] nums = new int[N];    for (int i = 0; i < N; i++)     nums[i] = nextInt();    return nums;   }   public long[] nextLongs(int N) {    long[] nums = new long[N];    for (int i = 0; i < N; i++)     nums[i] = nextLong();    return nums;   }   public int nextUnsignedInt() {    int c = read();    while (isSpaceChar(c))     c = read();    int res = 0;    do {     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res;   }   public final long nextLong() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    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 long nextUnsignedLong() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    long res = 0;    do {     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res;   }   public double nextDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    long 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 (!(c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1 || c == '.'));    if (c != '.') {     return res * sgn;    }    c = read();    long aft = 0;    int len = 1;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     aft *= 10;     len *= 10;     aft += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn + aft / (1.0 * len);   }   public String nextLine() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isEndChar(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 boolean isEndChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public String next() {    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 char[] nextChars() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    char[] chars = new char[res.length()];    res.getChars(0, chars.length, chars, 0);    return chars;   }   public int[][] nextIntMatrix(int rows, int cols) {    int[][] matrix = new int[rows][cols];    for (int i = 0; i < rows; i++)     for (int j = 0; j < cols; j++)      matrix[i][j] = nextInt();    return matrix;   }   public long[][] nextLongMatrix(int rows, int cols) {    long[][] matrix = new long[rows][cols];    for (int i = 0; i < rows; i++)     for (int j = 0; j < cols; j++)      matrix[i][j] = nextLong();    return matrix;   }   public char[][] nextCharMap(int rows, int cols) {    char[][] matrix = new char[rows][cols];    for (int i = 0; i < rows; i++)     for (int j = 0; j < cols; j++)      matrix[i][j] = nextChar();    return matrix;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
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 + ")"; } }
1	public class Main {  public static void main(String[] args) {   new Thread(null, new Runnable() {    public void run() {     new Main().solve();    }   }, "1", 1 << 26).start();  }  void solve() {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   ASonyaAndHotels solver = new ASonyaAndHotels();   solver.solve(1, in, out);   out.close();  }  static class ASonyaAndHotels {   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    int d = in.scanInt();    int[] ar = new int[n];    int ans = 2;    for (int i = 0; i < n; i++) ar[i] = in.scanInt();    for (int i = 0; i < n - 1; i++) {     if (ar[i + 1] - ar[i] == 2 * d) ans++;     else if (ar[i + 1] - ar[i] > 2 * d) ans += 2;    }    out.println(ans);   }  }  static class ScanReader {   private byte[] buf = new byte[4 * 1024];   private int index;   private BufferedInputStream in;   private int total;   public ScanReader(InputStream inputStream) {    in = new BufferedInputStream(inputStream);   }   private int scan() {    if (index >= total) {     index = 0;     try {      total = in.read(buf);     } catch (Exception e) {      e.printStackTrace();     }     if (total <= 0) return -1;    }    return buf[index++];   }   public int scanInt() {    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();     }    }    return neg * integer;   }   private boolean isWhiteSpace(int n) {    if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;    else return false;   }  } }
5	public class A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int N = sc.nextInt();   TreeSet<Integer> set = new TreeSet<Integer>();   for(int i=0;i<N;i++){    int a = sc.nextInt();    set.add(a);   }   if(set.size()==1)System.out.println("NO");   else{    set.remove(set.first());    System.out.println(set.first());   }  } }
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) {   }  } } }
5	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);    StreamTokenizer st = new StreamTokenizer(reader);    PrintWriter out = new PrintWriter(writer);    MyTokenizer tok = new MyTokenizer(br.readLine());    int n = (int)tok.getNum();    tok =new MyTokenizer(br.readLine());    List<Integer> a = new ArrayList<Integer>();    for(int i=0;i<n;i++) {     int r = (int)tok.getNum();     if (!a.contains(r)) {      a.add(r);     }    }    Collections.sort(a);    if (a.size() < 2) {     out.printf("NO");    } else {     out.printf("%d", a.get(1));    }    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) == '.' || 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')) || ((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();   }  } }
6	public class TaskD implements Runnable { private InputReader in; private PrintWriter out; private int n; private int m; private boolean[][] e; private long[][] qp;  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;  } }  public static void main(String[] args) {  new TaskD().run(); }  public TaskD() {     in = new InputReader(System.in);  out = new PrintWriter(System.out); }  public void run() {   n = in.readInt();  m = in.readInt();  e = new boolean[n][n];  for (int i = 0; i < m; i++) {  int a = in.readInt() - 1;  int b = in.readInt() - 1;  e[a][b] = e[b][a] = true;  }     int msk = (1 << n) - 1;  qp = new long[n - 1][1 << (n - 1)];  long ans = 0;  for (int i = n - 1; i >= 0; i--) {  msk -= (1 << i);  for (int k = 0; k < i; k++)   Arrays.fill(qp[k], 0, 1 << i, -1);  for (int j = 0; j < i; j++) {   if (e[i][j]) {   e[i][j] = e[j][i] = false;   ans += go(j, msk - (1 << j), i);   e[i][j] = e[j][i] = true;   }  }  }  out.println(ans / 2);  out.close(); }  private long go(int v, int msk, int u) {  if (qp[v][msk] != -1)  return qp[v][msk];  qp[v][msk] = 0;  if (e[v][u])  qp[v][msk] = 1;  for (int i = 0; i < u; i++) {  if (e[v][i] && ((msk >> i) & 1) != 0)   qp[v][msk] += go(i, msk - (1 << i), u);  }  return qp[v][msk]; } }
5	public class Main {  public static void main(String[] args) throws Exception {     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int iTotTerm, i, j, iSml = 0, iPos = 0;   iTotTerm = Integer.parseInt(br.readLine());   String seq[];   seq = br.readLine().split(" ");   int iSeq[] = new int[iTotTerm];   for (i = 0; i < iTotTerm; i++) {    iSeq[i] = Integer.parseInt(seq[i]);   }   for (i = 0; i < iTotTerm; i++) {    iSml = iSeq[i];    iPos = i;    for (j = i; j < iTotTerm; j++) {     if (iSeq[j] < iSml) {      iSml = iSeq[j];      iPos = j;     }    }    iSeq[iPos] = iSeq[i];    iSeq[i] = iSml;    if (i != 0 && iSeq[i - 1] != iSeq[i]) {     break;    }   }   if (iSml != iSeq[0]) {    System.out.print(iSml);   } else {    System.out.print("NO");   }  } }
4	public class Main {  public static void main(String[] args) throws IOException  {   PrintWriter pw = new PrintWriter(new FileWriter("output.txt"));   Scanner in=new Scanner(new File("input.txt"));   int n,m,k;   n=in.nextInt();   m=in.nextInt();   k=in.nextInt();   Vector<Integer> vec=new Vector<Integer>();   Vector<Integer> temp=new Vector<Integer>();   boolean[][] mas=new boolean[n][m];   long time=System.currentTimeMillis();   for(int i=0;i<k;i++)   {    vec.add(in.nextInt()-1);    vec.add(in.nextInt()-1);    mas[vec.get(vec.size()-2)][vec.get(vec.size()-1)]=true;   }   int x,y;   x=y=0;   while(vec.size()!=0)   {    for(int i=0;i<vec.size();i+=2)    {     x=vec.get(i);     y=vec.get(i+1);     if(x>0 && !mas[x-1][y])     {      temp.add(x-1);      temp.add(y);      mas[x-1][y]=true;     }     if(x<n-1 && !mas[x+1][y])     {      temp.add(x+1);      temp.add(y);      mas[x+1][y]=true;     }     if(y>0 && !mas[x][y-1])     {      temp.add(x);      temp.add(y-1);      mas[x][y-1]=true;     }     if(y<m-1 && !mas[x][y+1])     {      temp.add(x);      temp.add(y+1);      mas[x][y+1]=true;     }    }    vec=temp;    temp=new Vector<Integer>();   }   pw.println((x+1)+" "+(y+1));   System.out.println(System.currentTimeMillis()-time);   in.close();   pw.close();  } }
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();  } }
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);   TaskB solver = new TaskB();   solver.solve(1, in, out);   out.close();  } } class TaskB {  public void solve(int testNumber, Scanner in, PrintWriter out) {   long n=in.nextLong();   long k=in.nextInt();   if(n==1){    out.println(0);    return;   }   long max=k*(k-1)/2+1;   if(max<n){    out.println("-1");    return;   }   long low=1,high=k-1;   long ans=k-1;   while (low<=high){    long mid=(low+high)/2;    long val=mid*mid-mid*(2*k-1)+2*n-2;    if(val>0){     low=mid+1;    }    else {     ans=mid;     high=mid-1;    }   }   out.println(ans);  } }
1	public class a implements Runnable {  private void solve() throws IOException {  int n = nextInt();  int oddcnt = 0, evencnt = 0;  int odd = 0, even = 0;  for (int i = 0; i < n; i++) {  int a = nextInt();  if (a % 2 == 0) {   even = i + 1;   evencnt++;  } else {   odd = i + 1;   oddcnt++;  }  }  if (oddcnt == 1) {  System.out.println(odd);  } else {  System.out.println(even);  } }  public static void main(String[] args) {  new Thread(new a()).start(); }  BufferedReader br; StringTokenizer st; PrintWriter out; boolean eof = false;  public void run() {  Locale.setDefault(Locale.US);  try {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  out.close();  } catch (Throwable e) {  e.printStackTrace();  System.exit(239);  } }  String nextToken() {  while (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(br.readLine());  } catch (Exception e) {   eof = true;   return "0";  }  }  return st.nextToken(); }  int nextInt() {  return Integer.parseInt(nextToken()); }  long nextLong() {  return Long.parseLong(nextToken()); }  double nextDouble() {  return Double.parseDouble(nextToken()); } }
3	public class C455C { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = Integer.parseInt(sc.nextLine());  ArrayList<Integer> listCount = new ArrayList<Integer>();  listCount.add(1);  boolean justf = false;  int p = 1000000007;  long ans = 0;   for(int x=0; x<n; x++){  String next = sc.nextLine();    if(next.equals("f")){     if(justf){   listCount.add(0);   }   else{      for(int i=1; i<listCount.size(); i++){    int sum = (listCount.get(i-1) + listCount.get(i)) % p;    listCount.set(i, sum);   }      listCount.add(0);   }     justf = true;  }  else{   if(justf){   justf = false;   }   else{   for(int i=1; i<listCount.size(); i++){    int sum = (listCount.get(i-1) + listCount.get(i)) % p;    listCount.set(i, sum);   }   }  }      }   for(int i=0; i<listCount.size(); i++){  ans += listCount.get(i);  }   System.out.print((ans % p)); } }
0	public class Main {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   long a=s.nextLong(), b=s.nextLong();   long c=0;   while(true) {    if(a==b ){     System.out.println(c+a);     return ;    } else if(b==a+1){     c+=1;     b=a;    } else if(b<a){     long h = a/b-1;     if(h<=0){      a-=b;c++;continue;     }     a-=b*h;     c+=h;    } else{     if(a==1){      long t = b-a;      b = t;      c+=t;      b = a;      continue;     }     long t = b-a;     long h = b/a - 1 ;     if(h<=0){      b = t;      c+=1;continue;     }     c+=h;b-=h*a;    }   }   } }
3	public class CF915D { static ArrayList[] aa; static boolean[] visited, instack; static int[] stack; static int cnt, h_, i_, j_; static boolean dfs1(int i) {  if (visited[i]) {  if (instack[i]) {   h_ = i;   return true;  }  return false;  }  visited[i] = instack[i] = true;  stack[cnt++] = i;  ArrayList<Integer> adj = aa[i];  for (int j : adj)  if (dfs1(j))   return true;  instack[i] = false;  cnt--;  return false; } static boolean dfs2(int i) {  if (visited[i])  return instack[i];  visited[i] = instack[i] = true;  ArrayList<Integer> adj = aa[i];  for (int j : adj)  if (!(i == i_ && j == j_) && dfs2(j))   return true;  instack[i] = false;  return false; } 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 m = Integer.parseInt(st.nextToken());  aa = new ArrayList[n];  for (int i = 0; i < n; i++)  aa[i] = new ArrayList<Integer>();  while (m-- > 0) {  st = new StringTokenizer(br.readLine());  int i = Integer.parseInt(st.nextToken()) - 1;  int j = Integer.parseInt(st.nextToken()) - 1;  aa[i].add(j);  }  visited = new boolean[n];  instack = new boolean[n];  stack = new int[n];  for (int i = 0; i < n; i++)  if (dfs1(i))   break;  if (cnt == 0) {  System.out.println("YES");  return;  }  for (j_ = h_, i_ = stack[--cnt]; ; j_ = i_, i_ = stack[--cnt]) {  Arrays.fill(visited, false);  Arrays.fill(instack, false);  boolean cycle = false;  for (int i = 0; i < n; i++)   if (dfs2(i)) {   cycle = true;   break;   }  if (!cycle) {   System.out.println("YES");   return;  }  if (i_ == h_)   break;  }  System.out.println("NO"); } }
3	public class A01Easy { private static interface Matrix {  boolean get(int i, int j);  int size(); }  private static class MData implements Matrix {  private final boolean[][] m;  MData(boolean[][] m) {  this.m = m;  }  @Override  public boolean get(int i, int j) {  return m[i][j];  }  @Override  public int size() {  return m.length;  } }  private static abstract class MDecorator implements Matrix {  protected final Matrix inner;  MDecorator(Matrix inner) {  this.inner = inner;  }  @Override  public int size() {  return inner.size();  } }  private static class MHFlip extends MDecorator {  MHFlip(Matrix inner) {  super(inner);  }  @Override  public boolean get(int i, int j) {  return inner.get(size() - 1 - i, j);  } }  private static class MVFlip extends MDecorator {  MVFlip(Matrix inner) {  super(inner);  }  @Override  public boolean get(int i, int j) {  return inner.get(i, size() - 1 - j);  } }  private static class MRot extends MDecorator {  MRot(Matrix inner) {  super(inner);  }  @Override  public boolean get(int i, int j) {  return inner.get(j, size() - 1 - i);  } }  public static void main(String[] args) {  try (BufferedReader r = new BufferedReader(new InputStreamReader(System.in))) {  final int N = Integer.parseInt(r.readLine());  Matrix m1 = readMatrix(r, N), m2 = readMatrix(r, N);  boolean matched = matchesFlipped(m1, m2);  int i = 0;  while (i < 3 && !matched) {   m1 = new MRot(m1);   matched = matchesFlipped(m1, m2);   i++;  }  System.out.println(matched ? "Yes" : "No");  }  catch (IOException e) {  e.printStackTrace();  } }  private static Matrix readMatrix(BufferedReader r, int n) throws IOException {  boolean[][] m = new boolean[n][n];  for (int i = 0; i < n; i++) {  String line = r.readLine();  for (int j = 0; j < n; j++) {   m[i][j] = line.charAt(j) == 'X';  }  }  return new MData(m); }  private static boolean matches(Matrix m1, Matrix m2) {  int i = 0, j = 0, n = m1.size();  while (i < n && m1.get(i, j) == m2.get(i, j)) {  j++;  if (j == n) {   j = 0;   i++;  }  }  return i == n; }  private static boolean matchesFlipped(Matrix m1, Matrix m2) {  return matches(m1, m2) || matches(new MHFlip(m1), m2) || matches(new MVFlip(m1), m2); } }
4	public class cf35c { public static void main(String[] args) throws Exception {  Scanner in = new Scanner(new File("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  int[] dx = {0,0,1,-1};  int[] dy = {1,-1,0,0};  int n = in.nextInt();  int m = in.nextInt();  int[][] seen = new int[n][m];  for(int i=0; i<n; i++)  Arrays.fill(seen[i], -1);  Queue<Integer> q = new LinkedList<Integer>();  int k = in.nextInt();  for(int i=0; i<k; i++) {  int x = in.nextInt()-1;  int y = in.nextInt()-1;  q.add(x);  q.add(y);  q.add(0);  seen[x][y] = 0;  }  while(!q.isEmpty()) {  int x = q.poll();  int y = q.poll();  int t = q.poll();  for(int i=0; i<dx.length; i++) {   int nx = x + dx[i];   int ny = y + dy[i];   if(nx < 0 || nx >= n || ny < 0 || ny >= m)   continue;   if(seen[nx][ny] != -1) continue;   seen[nx][ny] = t+1;   q.add(nx);   q.add(ny);   q.add(t+1);  }  }  int best=-1,x=0,y=0;  for(int i=0; i<n; i++)  for(int j=0; j<m; j++)   if(seen[i][j] > best) {   best = seen[i][j];   x = i+1;   y = j+1;   }  out.println(x + " " +y);  out.close(); } }
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;  } }
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(); } }
4	public class a { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  String s = sc.next();   int len = s.length();  for(int i=len-1; i>=1; --i) {  for(int j=0; j<=len - i; ++j) {   String ss = s.substring(j, j+i);   if(s.substring(j+1).indexOf(ss)!=-1) {   System.out.println(ss.length());   return;   }   }  }  System.out.println(0); } }
1	public class A { private static StreamTokenizer in; private static PrintWriter out;  private static int nextInt() throws Exception {  in.nextToken();  return (int) in.nval; }  private static String nextString() throws Exception {  in.nextToken();  return in.sval; }  public static void main(String[] args) throws Exception {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(System.out);   ArrayList<Integer> p = new ArrayList<Integer>();  ArrayList<Integer> o = new ArrayList<Integer>();   int n = nextInt();  for (int i=0; i<n; i++) {  int a = nextInt();  if (a % 2 == 0) p.add(i+1);  else o.add(i+1);  }   if (p.size() < o.size()) out.println(p.get(0));  else out.println(o.get(0));  out.flush();  } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   static final long MODULO = (long) (1e9 + 7);   public void solve(int testNumber, FastReader in, PrintWriter out) {    int n = in.nextInt();    long[][] dp = new long[n + 100][n + 100];    dp[0][0] = 1;    for (int i = 0; i < n; ++i) {     char current = in.nextCharacter();     if (current == 'f') {      for (int j = 0; j < n; ++j) {             dp[i + 1][j + 1] += dp[i][j];       dp[i + 1][j + 1] %= MODULO;      }     } else {      long runningSum = 0;      for (int j = n; j >= 0; --j) {                          runningSum += dp[i][j];       runningSum %= MODULO;       dp[i + 1][j] += runningSum;       dp[i + 1][j] %= MODULO;      }     }    }    out.println(dp[n][0]);   }  }  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;   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public char nextCharacter() {    int c = pread();    while (isSpaceChar(c))     c = pread();    return (char) c;   }  } }
3	public final class PythonIndentation { public static void main(String[] args) {  new PythonIndentation(System.in, System.out); }  static class Solver implements Runnable {  static final int MOD = (int) 1e9 + 7;  int n;  char[] arr;  long[][] dp;  BufferedReader in;  PrintWriter out;  void solve() throws IOException  {  n = Integer.parseInt(in.readLine());  arr = new char[n];  dp = new long[n + 1][n + 1];   for (int i = 0; i < n; i++)   arr[i] = in.readLine().charAt(0);   for (int i = 0; i <= n; i++)   Arrays.fill(dp[i], -1);   dp[0][0] = 1;   if (arr[0] == 's')   out.println(find(1, 0));  else   out.println(find(1, 1));  }  long find(int curr, int backIndents)  {  if (backIndents < 0)   return 0;   if (curr == n)   return 1;   if (dp[curr][backIndents] != -1)   return dp[curr][backIndents];   long ans;   if (arr[curr] == 's')  {   if (arr[curr - 1] == 'f')   ans = find(curr + 1, backIndents);   else   ans = CMath.mod(find(curr + 1, backIndents) + find(curr, backIndents - 1), MOD);  }  else  {   ans = find(curr + 1, backIndents + 1);   if (arr[curr - 1] != 'f')   ans = CMath.mod(ans + find(curr, backIndents - 1), MOD);  }   return dp[curr][backIndents] = ans;  }  public Solver(BufferedReader in, PrintWriter out)  {  this.in = in;  this.out = out;  }  @Override public void run()  {  try  {   solve();  }  catch (IOException e)  {   e.printStackTrace();  }  }  }  static class CMath {  static long mod(long number, long mod)  {  return number - (number / mod) * mod;  }  }  private PythonIndentation(InputStream inputStream, OutputStream outputStream) {  BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));  PrintWriter out = new PrintWriter(outputStream);  Thread thread = new Thread(null, new Solver(in, out), "PythonIndentation", 1 << 29);  try  {  thread.start();  thread.join();  }  catch (InterruptedException e)  {  e.printStackTrace();  }  finally  {  try  {   in.close();  }  catch (IOException e)  {   e.printStackTrace();  }   out.flush();  out.close();  } } }
4	public class Watermelon {  static int[][] ans;static int n,m;static boolean[][] vis;  public static void main(String[] args) throws IOException {   Scanner sc=new Scanner(new File("input.txt"));   PrintWriter pw=new PrintWriter("output.txt");   int n=sc.nextInt(),m=sc.nextInt(),k=sc.nextInt();   Queue<Integer> pq=new ArrayDeque<>();   boolean[] vis=new boolean[n*m];   for(int i=0;i<k;i++){    int r=sc.nextInt()-1,c=sc.nextInt()-1;    pq.add(m*r+c);    vis[m*r+c]=true;   }   sc.close();   int ans=0;   while(pq.size()!=0){    int x=pq.remove();    ans=x;    if(n!=1 && x%n==0){     if(x+m<n*m&&!vis[x+m]){      pq.add(x+m);      vis[x+m]=true;     }     if(x-m>=0&&!vis[x-m]){      pq.add(x-m);      vis[x-m]=true;     }     if(x+1<n*m&&!vis[x+1]){      pq.add(x+1);      vis[x+1]=true;     }    }    else if(n!=1 && (x+1)%n==0){     if(x+m<n*m&&!vis[x+m]){      pq.add(x+m);      vis[x+m]=true;     }     if(x-m>=0&&!vis[x-m]){      pq.add(x-m);      vis[x-m]=true;     }     if(x-1>=0&&!vis[x-1]){      pq.add(x-1);      vis[x-1]=true;     }    }    else{     if(x+m<n*m&&!vis[x+m]){      pq.add(x+m);      vis[x+m]=true;     }     if(x-m>=0&&!vis[x-m]){      pq.add(x-m);      vis[x-m]=true;     }     if(x-1>=0&&!vis[x-1]){      pq.add(x-1);      vis[x-1]=true;     }     if(x+1<n*m&&!vis[x+1]){      pq.add(x+1);      vis[x+1]=true;     }    }   }   pw.println((ans/m+1)+" "+(ans%m+1));   pw.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();   }  }  }
2	public class SportMafia { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);   int n = sc.nextInt();  int k = sc.nextInt();   int next = 1;  int current = 0;  int result = 0;   for(int i = 0; i < n; i++) {  if(current < k) {   current += next++;  } else {   current--;   result++;  }  }   System.out.println(result);   sc.close(); } }
1	public class C { InputStream is;  int __t__ = 1; int __f__ = 0; int __FILE_DEBUG_FLAG__ = __f__; String __DEBUG_FILE_NAME__ = "src/C4";  FastScanner in; PrintWriter out;  int charToIndex(char c) {  if (Character.isLowerCase(c))  return c - 'a';  else if (Character.isUpperCase(c))  return c - 'A' + 26;  return -1; }  int CH_NUM = 52; public void solve() {  int n = in.nextInt();  String s = in.next();   boolean[] exist = new boolean[CH_NUM];  int typeNum = 0;  for (int i = 0; i < n; i++) {  int idx = charToIndex(s.charAt(i));  if (!exist[idx]) {   exist[idx] = true;   typeNum++;  }  }   int get = 0;  int tail = 0, head = 0;  int res = Integer.MAX_VALUE;  int[] cnt = new int[CH_NUM];  while (tail < n || head < n) {  if (head == n || typeNum == get) {   int idx = charToIndex(s.charAt(tail++));   if (cnt[idx] == 1) get--;   cnt[idx]--;  } else {   int idx = charToIndex(s.charAt(head++));   if (cnt[idx] == 0) get++;   cnt[idx]++;  }  if (typeNum == get)   res = Math.min(res, head - tail);  }  System.out.println(res);   }  public void run() {  if (__FILE_DEBUG_FLAG__ == __t__) {  try {   is = new FileInputStream(__DEBUG_FILE_NAME__);  } catch (FileNotFoundException e) {     e.printStackTrace();  }  System.out.println("FILE_INPUT!");  } else {  is = System.in;  }  in = new FastScanner(is);  out = new PrintWriter(System.out);  solve(); }  public static void main(String[] args) {  new C().run(); }  public void mapDebug(int[][] a) {  System.out.println("--------map display---------");  for (int i = 0; i < a.length; i++) {  for (int j = 0; j < a[i].length; j++) {   System.out.printf("%3d ", a[i][j]);  }  System.out.println();  }  System.out.println("----------------------------");  System.out.println(); }  public void debug(Object... obj) {  System.out.println(Arrays.deepToString(obj)); }  class FastScanner {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  public FastScanner(InputStream stream) {  this.stream = stream;    }  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++];  }  boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  boolean isEndline(int c) {  return c == '\n' || c == '\r' || c == -1;  }  int nextInt() {  return Integer.parseInt(next());  }  int[] nextIntArray(int n) {  return nextIntArray(n, 0);  }  int[] nextIntArray(int n, int margin) {  int[] array = new int[n + margin];  for (int i = 0; i < n; i++)   array[i + margin] = nextInt();   return array;  }  int[][] nextIntMap(int n, int m) {  int[][] map = new int[n][m];  for (int i = 0; i < n; i++) {   map[i] = in.nextIntArray(m);  }  return map;  }  long nextLong() {  return Long.parseLong(next());  }  long[] nextLongArray(int n) {  return nextLongArray(n, 0);  }  long[] nextLongArray(int n, int margin) {  long[] array = new long[n + margin];  for (int i = 0; i < n; i++)   array[i + margin] = nextLong();   return array;  }  long[][] nextLongMap(int n, int m) {  long[][] map = new long[n][m];  for (int i = 0; i < n; i++) {   map[i] = in.nextLongArray(m);  }  return map;  }  double nextDouble() {  return Double.parseDouble(next());  }  double[] nextDoubleArray(int n) {  return nextDoubleArray(n, 0);  }  double[] nextDoubleArray(int n, int margin) {  double[] array = new double[n + margin];  for (int i = 0; i < n; i++)   array[i + margin] = nextDouble();   return array;  }  double[][] nextDoubleMap(int n, int m) {  double[][] map = new double[n][m];  for (int i = 0; i < n; i++) {   map[i] = in.nextDoubleArray(m);  }  return map;  }  String next() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  String[] nextStringArray(int n) {  String[] array = new String[n];  for (int i = 0; i < n; i++)   array[i] = next();   return array;  }  String nextLine() {  int c = read();  while (isEndline(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isEndline(c));  return res.toString();  } } }
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);   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();    long k = in.nextLong();    HashMap<Long, Integer> hm = new HashMap<>();    long ar[] = in.nextLongArray(n);    for (int i = 0; i < n; i++) {     long dist = ar[i] + k;     long min = k;     for (int j = 0; j < n; j++) {      min = Math.min(min, Math.abs(ar[j] - dist));     }     if (min == k) {      hm.put(dist, 1);     }     dist = ar[i] - k;     min = k;     for (int j = 0; j < n; j++) {      min = Math.min(min, Math.abs(ar[j] - dist));     }     if (min == k) {      hm.put(dist, 1);     }    }    out.print(hm.size());   }  }  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 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 long[] nextLongArray(int n) {    long a[] = new long[n];    for (int i = 0; i < n; i++) {     a[i] = nextLong();    }    return a;   }   public boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
3	public class Main {  Scanner scanner = new Scanner(System.in);  public static void main(String[] args) {   new Main().solve();  }   void solve() {   int n = scanner.nextInt();   scanner.nextLine();   String s1 = scanner.nextLine();   String s2 = scanner.nextLine();    int ans = 0;   boolean a[] = new boolean[30];   boolean b[] = new boolean[30];   for (int i = 0; i < n; i++) {    if (s1.charAt(i) != s2.charAt(i)) {     ans ++;     a[s1.charAt(i) - 'a'] = true;     b[s2.charAt(i) - 'a'] = true;    }   }   for (int i = 0; i < n; i++) {    if (s1.charAt(i) != s2.charAt(i) && a[s2.charAt(i) - 'a'] && b[s1.charAt(i) - 'a']) {     for (int j = i + 1; j < n; j ++) {      if (s1.charAt(i) == s2.charAt(j) && s1.charAt(j) == s2.charAt(i)) {       out.println(ans - 2);       out.println((i + 1) + " " + (j + 1));       return;      }     }    }   }   for (int i = 0; i < n; i++) {    if (s1.charAt(i) != s2.charAt(i) && (a[s2.charAt(i) - 'a'] || b[s1.charAt(i) - 'a'])) {     for (int j = i + 1; j < n; j ++) {      if (s1.charAt(j) != s2.charAt(j) && (s1.charAt(i) == s2.charAt(j) || s1.charAt(j) == s2.charAt(i))) {       out.println(ans - 1);       out.println((i + 1) + " " + (j + 1));       return;      }     }    }   }   out.println(ans);   out.println(-1 + " " + -1);  } }
5	public class order { public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(new BufferedWriter(   new OutputStreamWriter(System.out)));  int n=Integer.parseInt(in.readLine());  Set<Integer> set = new TreeSet<Integer>();  StringTokenizer st= new StringTokenizer(in.readLine());  int a;  List<Integer> list =new LinkedList<Integer>();  while(st.hasMoreTokens()){  a= Integer.parseInt(st.nextToken());  if(!set.contains(a)){   list.add(a);   set.add(a);  }    }  if(list.size()==1){  out.println("NO");  }else{  Collections.sort(list);  out.println(list.get(1));  }  out.close();  System.exit(0); } }
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;   } }
5	public class Three{  public static void main(String[] args) { Scanner in = new Scanner (System.in); PrintWriter out = new PrintWriter(System.out);  pair[] points = new pair [3]; for (int i = 0; i < 3; ++i) {  int x = in.nextInt();  int y = in.nextInt();  points[i] = new pair (x, y); }  Arrays.sort(points);  int MaxY = Math.max(Math.max(points[0].y, points[1].y), points[2].y); int MinY = Math.min(Math.min(points[0].y, points[1].y), points[2].y);  out.println(MaxY - MinY + points[2].x - points[0].x + 1); for (int i = MinY; i <= MaxY; ++i)  out.println(points[1].x + " " + i); for (int i = points[0].x; i < points[1].x; ++i)  out.println(i + " " + points[0].y); for (int i = points[1].x + 1; i <= points[2].x; ++i)  out.println(i + " " + points[2].y);  out.close();  }  public static class pair implements Comparable<pair> { int x, y; public pair (int x_, int y_) {  x = x_; y = y_; }  @Override public int compareTo(pair o) {  return x - o.x; }  } }
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();   }  } }
0	public class Hexadec implements Runnable {  final static String taskname = "filename";  public void solve() throws Exception {    int n = Integer.parseInt(in.readLine());        out.write(n + " "+0+" "+0);   }  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) {     new Thread(new Hexadec()).start();  } }
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] + " ");  } } }
5	public class Beta22PA {   public static void main(String[] args) {   Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int minimum = 200, second = 200;  for(int i=0; i<n; i++) {  int temp = scan.nextInt();  if(temp<minimum) {   second = minimum;   minimum = temp;  } else if(temp>minimum&&temp<second) {   second = temp;  }  }  if(second>100) {  System.out.println("NO");  } else {  System.out.println(second);  } } }
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() ; } }
2	public class Main {  private void solve() throws IOException {  out.println(solve(nl()));  out.close();  }  private long solve(long n) throws IOException {  if (n > 0) {  n <<= 1;  long k = nl();  n--;  int M = 1000000007;  long p = power(2, k, M);    n = (n % M * p + 1) % M;  }  return n; }  long power(long a, long b, long mod) {  long x = 1, y = a;  while (b > 0) {  if (b % 2 != 0) {   x = (x * y) % mod;  }  y = (y * y) % mod;  b /= 2;  }  return x % mod; }  static BufferedReader in; static PrintWriter out; static StringTokenizer tok;  private int[][] na(int n) throws IOException {  int[][] a = new int[n][2];  for (int i = 0; i < n; i++) {  a[i][0] = ni();  a[i][1] = i;  }  return a; }  String ns() throws IOException {  while (!tok.hasMoreTokens()) {  tok = new StringTokenizer(in.readLine(), " ");  }  return tok.nextToken(); }  int ni() throws IOException {  return Integer.parseInt(ns()); }  long nl() throws IOException {  return Long.parseLong(ns()); }  double nd() throws IOException {  return Double.parseDouble(ns()); }  String[] nsa(int n) throws IOException {  String[] res = new String[n];  for (int i = 0; i < n; i++) {  res[i] = ns();  }  return res; }  int[] nia(int n) throws IOException {  int[] res = new int[n];  for (int i = 0; i < n; i++) {  res[i] = ni();  }  return res; }  long[] nla(int n) throws IOException {  long[] res = new long[n];  for (int i = 0; i < n; i++) {  res[i] = nl();  }  return res; }  public static void main(String[] args) throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  tok = new StringTokenizer("");  Main main = new Main();  main.solve();  out.close(); } }
4	public class A {  static { final Locale us = Locale.US; if (!Locale.getDefault().equals(us)) {  Locale.setDefault(us); }  }  static boolean file = false;  static Scanner in;  static { try {  in = new Scanner(file ? new FileInputStream("f:\\var\\tmp\\in.txt")   : System.in); } catch (final FileNotFoundException e) {  e.printStackTrace(); }  }  static PrintWriter out;  static { try {  out = file ? new PrintWriter(   new FileWriter("f:\\var\\tmp\\out.txt")) : new PrintWriter(   System.out); } catch (final IOException e) {  e.printStackTrace(); }  }    public static void main(final String[] args) { try {   solve();  if (file) {  System.out.flush();  }  if (!file) {  out.flush();  }  } finally {  in.close();  out.close(); }  }  private static void solve() { final String s = in.next();  int ans = 0; for (int l = 0; l < s.length(); ++l) {  for (int r = l; r < s.length(); ++r) {  for (int p = l + 1; p - l + r < s.length(); ++p) {   boolean ok = true;   for (int q = l, qq = p; q <= r; ++q, ++qq) {  if (s.charAt(q) != s.charAt(qq)) {   ok = false;  }   }   if (ok) {  ans = Math.max(ans, r - l + 1);   }  }  } }  out.println(ans);  } }
3	public class Main {         static PrintWriter out;   static class FastReader{  BufferedReader br;  StringTokenizer st;  public FastReader(){  br=new BufferedReader(new InputStreamReader(System.in));  out=new PrintWriter(System.out);  }  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 int countDigit(long n)  {   return (int)Math.floor(Math.log10(n) + 1);  }    public static int sumOfDigits(long n) {  if( n< 0)return -1 ;  int sum = 0;  while( n > 0) {  sum = sum + (int)( n %10) ;    n /= 10 ; }   return sum ;     }   public static long arraySum(int[] arr , int start , int end) {  long ans = 0 ;   for(int i = start ; i <= end ; i++)ans += arr[i] ;   return ans ; }    public static void swapArray(int[] arr , int start , int end) {  while(start < end)  {   int temp = arr[start] ;   arr[start] = arr[end];   arr[end] = temp;   start++ ;end-- ;  } }   static long factorial(long a) {  if(a== 0L || a==1L)return 1L ;   return a*factorial(a-1L) ; }   public static int[][] rotate(int[][] input){ int n =input.length; int m = input[0].length ; int[][] output = new int [m][n]; for (int i=0; i<n; i++) for (int j=0;j<m; j++)  output [j][n-1-i] = input[i][j]; return output; }   public static boolean isPowerOfTwo(long n) {  if(n==0)  return false;  if(((n ) & (n-1)) == 0 ) return true ; else return false ; }     public static String reverse(String input) { StringBuilder str = new StringBuilder("") ;   for(int i =input.length()-1 ; i >= 0 ; i-- )  {   str.append(input.charAt(i));  }  return str.toString() ; }   public static boolean isPossibleTriangle(int a ,int b , int c) {  if( a + b > c && c+b > a && a +c > b)return true ;  else return false ; }  static long xnor(long num1, long num2) {  if (num1 < num2) {  long temp = num1;  num1 = num2;  num2 = temp;  }  num1 = togglebit(num1);  return num1 ^ num2; }  static long togglebit(long n) {  if (n == 0)  return 1;  long i = n;  n |= n >> 1;  n |= n >> 2;  n |= n >> 4;  n |= n >> 8;  n |= n >> 16;  return i ^ n; }  public static int xorOfFirstN(int n) {   if( n % 4 ==0)return n ;  else if( n % 4 == 1)return 1 ;  else if( n % 4 == 2)return n+1 ;  else return 0 ;   }  public static int gcd(int a, int b ) { if(b==0)return a ; else return gcd(b,a%b) ;  }  public static long gcd(long a, long b ) { if(b==0)return a ; else return gcd(b,a%b) ;  }  public static int lcm(int a, int b ,int c , int d ) { int temp = lcm(a,b , c) ;   int ans = lcm(temp ,d ) ; return ans ;  }  public static int lcm(int a, int b ,int c ) { int temp = lcm(a,b) ; int ans = lcm(temp ,c) ; return ans ;  }   public static int lcm(int a , int b ) { int gc = gcd(a,b); return (a/gc)*b ; }  public static long lcm(long a , long b ) { long gc = gcd(a,b); return (a/gc)*b; }  static boolean isPrime(long n) {  if(n==1)  {    return false ;  }    boolean ans = true ;    for(long i = 2L; i*i <= n ;i++)  {    if(n% i ==0)    {     ans = false ;break ;    }  }      return ans ; }  static boolean isPrime(int n) {  if(n==1)  {    return false ;  }    boolean ans = true ;    for(int i = 2; i*i <= n ;i++)  {    if(n% i ==0)    {     ans = false ;break ;    }  }      return ans ; }    static int sieve = 1000000 ;  static boolean[] prime = new boolean[sieve + 1] ; public static void sieveOfEratosthenes()  {                               for(int i = 4; i<= sieve ; i++)   {    prime[i] = true ;    i++ ;   }     for(int p = 3; p*p <= sieve; p++)   {        if(prime[p] == false)    {          for(int i = p*p; i <= sieve; i += p)      prime[i] = true;    }        p++ ;   }            }    public static void sortD(int[] arr , int s , int e) {  sort(arr ,s , e) ;    int i =s ; int j = e ;    while( i < j)  {    int temp = arr[i] ;    arr[i] =arr[j] ;    arr[j] = temp ;    i++ ; j-- ;  }        return ; }   public static long countSubarraysSumToK(long[] arr ,long sum )  {  HashMap<Long,Long> map = new HashMap<>() ;     int n = arr.length ;     long prefixsum = 0 ;     long count = 0L ;  for(int i = 0; i < n ; i++)  {   prefixsum = prefixsum + arr[i] ;       if(sum == prefixsum)count = count+1 ;       if(map.containsKey(prefixsum -sum))   {    count = count + map.get(prefixsum -sum) ;   }         if(map.containsKey(prefixsum ))   {    map.put(prefixsum , map.get(prefixsum) +1 );   }      else{    map.put(prefixsum , 1L );   }         }          return count ;     }      public static ArrayList<Integer> kmpAlgorithm(String str , String pat)  {   ArrayList<Integer> list =new ArrayList<>();     int n = str.length() ;   int m = pat.length() ;     String q = pat + "#" + str ;     int[] lps =new int[n+m+1] ;      longestPefixSuffix(lps, q,(n+m+1)) ;         for(int i =m+1 ; i < (n+m+1) ; i++ )   {    if(lps[i] == m)    {     list.add(i-2*m) ;    }   }     return list ;        }   public static void longestPefixSuffix(int[] lps ,String str , int n)  {   lps[0] = 0 ;     for(int i = 1 ; i<= n-1; i++)   {   int l = lps[i-1] ;       while( l > 0 && str.charAt(i) != str.charAt(l))   {    l = lps[l-1] ;   }       if(str.charAt(i) == str.charAt(l))   {    l++ ;   }          lps[i] = l ;   }    }              public static void eulerTotientFunction(int[] arr ,int n )  {    for(int i = 1; i <= n ;i++)arr[i] =i ;      for(int i= 2 ; i<= n ;i++)  {   if(arr[i] == i)   {    arr[i] =i-1 ;        for(int j =2*i ; j<= n ; j+= i )    {     arr[j] = (arr[j]*(i-1))/i ;    }       }  }     return ;     }  public static long nCr(int n,int k) {  long ans=1L;  k=k>n-k?n-k:k;  int j=1;  for(;j<=k;j++,n--)  {   if(n%j==0)   {    ans*=n/j;   }else   if(ans%j==0)   {    ans=ans/j*n;   }else   {    ans=(ans*n)/j;   }  }  return ans; }  public static ArrayList<Integer> allFactors(int n) {   ArrayList<Integer> list = new ArrayList<>() ;    for(int i = 1; i*i <= n ;i++)  {   if( n % i == 0)   {    if(i*i == n)    {      list.add(i) ;    }    else{      list.add(i) ;      list.add(n/i) ;          }   }  }    return list ;     }  public static ArrayList<Long> allFactors(long n) {   ArrayList<Long> list = new ArrayList<>() ;    for(long i = 1L; i*i <= n ;i++)  {   if( n % i == 0)   {    if(i*i == n)    {      list.add(i) ;    }    else{      list.add(i) ;      list.add(n/i) ;          }   }  }    return list ;     }  static final int MAXN = 1000001;      static int spf[] = new int[MAXN];    static 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;    }   }  }     static ArrayList<Integer> getPrimeFactorization(int x)  {   ArrayList<Integer> ret = new ArrayList<Integer>();   while (x != 1)   {    ret.add(spf[x]);    x = x / spf[x];   }   return ret;  }       public 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++;   }  }     public 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);   }  } public 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);   }  }  public 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++;   }  }     public static long knapsack(int[] weight,long value[],int maxWeight){      int n= value.length ;      long []dp = new long[maxWeight+1];      Arrays.fill(dp, 0);     for(int i=0; i < n; i++)        for(int j = maxWeight; j >= weight[i]; j--)    dp[j] = Math.max(dp[j] , value[i] + dp[j - weight[i]]);        return dp[maxWeight];  }    public static long kadanesAlgorithm(long[] arr) {   if(arr.length == 0)return 0 ;    long[] dp = new long[arr.length] ;    dp[0] = arr[0] ;  long max = dp[0] ;      for(int i = 1; i < arr.length ; i++)  {    if(dp[i-1] > 0)    {     dp[i] = dp[i-1] + arr[i] ;    }    else{     dp[i] = arr[i] ;    }       if(dp[i] > max)max = dp[i] ;      }    return max ;   } public static long kadanesAlgorithm(int[] arr) {  if(arr.length == 0)return 0 ;    long[] dp = new long[arr.length] ;    dp[0] = arr[0] ;  long max = dp[0] ;      for(int i = 1; i < arr.length ; i++)  {    if(dp[i-1] > 0)    {     dp[i] = dp[i-1] + arr[i] ;    }    else{     dp[i] = arr[i] ;    }       if(dp[i] > max)max = dp[i] ;      }    return max ;   }             public static String swapString(String a, int i, int j) {   char[] b =a.toCharArray();   char ch;   ch = b[i];   b[i] = b[j];   b[j] = ch;   return String.valueOf(b);  }     public static void generatePermutation(String str, int start, int end)  {      if (start == end-1)    System.out.println(str);   else   {    for (int i = start; i < end; i++)    {          str = swapString(str,start,i);          generatePermutation(str,start+1,end);          str = swapString(str,start,i);    }   }  }    public static long factMod(long n, long mod) {  if (n <= 1) return 1;  long ans = 1;  for (int i = 1; i <= n; i++) {  ans = (ans * i) % mod;  }  return ans; }   public static long power(int a ,int b)  {        long x = (long)(a) ;   long n = (long)(b) ;     if(n==0)return 1 ;   if(n==1)return x;     long ans =1L ;     while(n>0)  {   if(n % 2 ==1)   {    ans = ans *x ;   }       n = n/2L ;       x = x*x ;      }     return ans ;  }   public static long power(long a ,long b)  {        long x = (a) ;   long n = (b) ;     if(n==0)return 1L ;   if(n==1)return x;     long ans =1L ;     while(n>0)  {   if(n % 2 ==1)   {    ans = ans *x ;   }       n = n/2L ;       x = x*x ;      }     return ans ;  }       public static long powerMod(long x, long n, long mod) {     if(n==0)return 1L ;   if(n==1)return x;      long ans = 1;  while (n > 0) {  if (n % 2 == 1) ans = (ans * x) % mod;  x = (x * x) % mod;  n /= 2;  }  return ans; }     public static long lowerBound(long[] arr,long k) {  long ans=-1;   int start=0;  int end=arr.length-1;   while(start<=end)  {  int mid=(start+end)/2;    if(arr[mid]<=k)  {   ans=arr[mid];   start=mid+1;  }  else  {   end=mid-1;  }    }   return ans;   }  public static int lowerBound(int[] arr,int k) {  int ans=-1;   int start=0;  int end=arr.length-1;   while(start<=end)  {  int mid=(start+end)/2;    if(arr[mid]<=k)  {   ans=arr[mid];   start=mid+1;  }  else  {   end=mid-1;  }    }   return ans;   }   public static long upperBound(long[] arr,long k) {  long ans=-1;   int start=0;  int end=arr.length-1;   while(start<=end)  {  int mid=(start+end)/2;    if(arr[mid]>=k)  {   ans=arr[mid];   end=mid-1;  }  else  {   start=mid+1;  }    }   return ans; }   public static int upperBound(int[] arr,int k) {  int ans=-1;   int start=0;  int end=arr.length-1;   while(start<=end)  {  int mid=(start+end)/2;    if(arr[mid]>=k)  {   ans=arr[mid];   end=mid-1;  }  else  {   start=mid+1;  }    }   return ans; }   public static void printArray(int[] arr , int si ,int ei) {  for(int i = si ; i <= ei ; i++)  {   out.print(arr[i] +" ") ;  }  } public static void printArrayln(int[] arr , int si ,int ei) {  for(int i = si ; i <= ei ; i++)  {   out.print(arr[i] +" ") ;  }  out.println() ; }  public static void printLArray(long[] arr , int si , int ei) {  for(int i = si ; i <= ei ; i++)  {   out.print(arr[i] +" ") ;  }  }   public static void printLArrayln(long[] arr , int si , int ei) {  for(int i = si ; i <= ei ; i++)  {   out.print(arr[i] +" ") ;  }  out.println() ;  } public static void printtwodArray(int[][] ans) {  for(int i = 0; i< ans.length ; i++)  {   for(int j = 0 ; j < ans[0].length ; j++)out.print(ans[i][j] +" ");   out.println() ;  }  out.println() ;  }   static long modPow(long a, long x, long p) {     a = a % p ;   if(a == 0)return 0L ;     long res = 1L;  while(x > 0) {   if( x % 2 != 0) {    res = (res * a) % p;   }   a = (a * a) % p;   x =x/2;  }  return res; }    static long modInverse(long a, long p) {     return modPow(a, p-2, p); }  static long[] factorial = new long[1000001] ;  static void modfac(long mod) {  factorial[0]=1L ; factorial[1]=1L ;    for(int i = 2; i<= 1000000 ;i++)  {   factorial[i] = factorial[i-1] *(long)(i) ;   factorial[i] = factorial[i] % mod ;  }     }     static long modBinomial(long n, long r, long p) {   if(n < r) return 0L ;   long num = factorial[(int)(n)] ;   long den = (factorial[(int)(r)]*factorial[(int)(n-r)]) % p ;     long ans = num*(modInverse(den,p)) ;   ans = ans % p ;   return ans ;   }   static void update(int val , long[] bit ,int n) {  for( ; val <= n ; val += (val &(-val)) )  {   bit[val]++ ;  }     }   static long query(int val , long[] bit , int n) {  long ans = 0L;   for( ; val >=1 ; val-=(val&(-val)) )ans += bit[val];    return ans ; }  static int countSetBits(long n)  {   int count = 0;   while (n > 0) {    n = (n) & (n - 1L);    count++;   }   return count;  }  static int abs(int x) {  if(x < 0)x = -1*x ;   return x ; }  static long abs(long x) {  if(x < 0)x = -1L*x ;   return x ; }  static void p(int val) {  out.print(val) ; } static void p() {  out.print(" ") ; } static void pln(int val) {  out.println(val) ; } static void pln() {  out.println() ; }  static void p(long val) {  out.print(val) ; }  static void pln(long val) {  out.println(val) ; }    static int bs(int[] arr, int s ,int e ,int key) {  if( s> e)return 0 ;    int mid = (s+e)/2 ;     if(arr[mid] <key)   {    return bs(arr ,mid+1,e , key) ;      }        else{        return bs(arr ,s ,mid-1, key) + e-mid+1;          } }        public static void solve() { FastReader scn = new FastReader() ;    ArrayList<Integer> list = new ArrayList<>() ; ArrayList<Long> lista = new ArrayList<>() ; ArrayList<Long> listb = new ArrayList<>() ;   HashMap<Integer,ArrayList<Pair>> map = new HashMap<>() ; HashMap<Integer,Integer> mapx = new HashMap<>() ; HashMap<Integer,Integer> mapy = new HashMap<>() ;   Set<Integer> set = new HashSet<>() ; Set<Integer> setx = new HashSet<>() ; Set<Integer> sety = new HashSet<>() ; StringBuilder sb =new StringBuilder("") ;            int testcase = 1;  for(int testcases =1 ; testcases <= testcase ;testcases++) {           int n= scn.nextInt() ; int[] arr= new int[n] ; for(int i=0; i < n;i++) {  arr[i]= scn.nextInt(); } for(int r= 0 ; r < n ;r++) {  int sum = 0 ;  for(int l =r ;l>= 0 ;l--)  {   sum = sum + arr[l] ;     if(map.containsKey(sum))   {    map.get(sum).add(new Pair(l,r)) ;   }   else{       map.put(sum,new ArrayList<Pair>());    map.get(sum).add(new Pair(l,r)) ;   }  } }  ArrayList<Pair> ans = null ;  int bestcount = 0 ; for(int x : map.keySet()) {   ArrayList<Pair> curr = map.get(x) ;  ArrayList<Pair> now = new ArrayList<Pair>() ;   int r=-1 ;   int count = 0 ;   for(Pair seg : curr)  {       if(seg.first > r)  {   count++ ;   now.add(seg) ;   r= seg.second ;  }       }     if(count > bestcount)  {   ans = now ;   bestcount = count ;  }    }  pln(bestcount) ; if(bestcount >0) { for(Pair x : ans) {  out.println((x.first+1) +" " +( x.second+1)) ; } }        set.clear() ; sb.delete(0 , sb.length()) ; list.clear() ;lista.clear() ;listb.clear() ; map.clear() ; mapx.clear() ; mapy.clear() ; setx.clear() ;sety.clear() ; }  out.flush() ; }  public static void main (String[] args) throws java.lang.Exception {  solve() ;   }  }  class Pair { int first ;  int second ;     public Pair(int l , int r)  {   first = l ;second = r ;  }   @Override public String toString() {  String ans = "" ; ans += this.first ; ans += " "; ans += this.second ;  return ans ; }  }
0	public class A implements Runnable {  private void Solution() throws IOException {  int n = nextInt();  if (n % 7 == 0 || n % 4 == 0 || n % 47 == 0 || n % 74 == 0 || n % 747 == 0 || n % 474 == 0 || n % 777 == 0 || n % 444 == 0 || n % 774 == 0 || n % 447 == 0 || n % 744 == 0 || n % 477 == 0)  System.out.println("YES"); else   System.out.println("NO"); }  public static void main(String args[]) {  new A().run(); }  BufferedReader in; StringTokenizer tokenizer;  public void run() {  try {    in = new BufferedReader(new InputStreamReader(System.in));    tokenizer = null;    Solution();    in.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   } }  int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(nextToken()); }  String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens())  tokenizer = new StringTokenizer(in.readLine());  return tokenizer.nextToken(); } }
1	public class Main{  final long mod = (int)1e9+7, IINF = (long)1e19;  final int MAX = (int)1e6+1, MX = (int)1e7+1, INF = (int)1e9, root = 3;  DecimalFormat df = new DecimalFormat("0.0000000000000");  double eps = 1e-9;  FastReader in;  PrintWriter out;  static boolean multipleTC = false, memory = false;  public static void main(String[] args) throws Exception{   if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();   else new Main().run();  }  void run() throws Exception{   in = new FastReader();   out = new PrintWriter(System.out);   for(int i = 1, t = (multipleTC)?ni():1; i<=t; i++)solve(i);   out.flush();    out.close();  }   void solve(int TC)throws Exception{   int n = ni();   int[] f1 = new int[9], f2 = new int[9];   MyHashSet<String> set = new MyHashSet<>();   for(int i = 0; i< n; i++){    String s = n();    set.add(s);    f1[s.length()]++;   }   int[] f = new int[4];   for(int i = 0; i< n; i++){    String s = n();    if(set.remove(s))continue;    else f[s.length()-1]++;   }   int ans = 0;   for(int i = 0; i< 4; i++)ans+=f[i];   pn(ans);  }   class MyHashSet<T>{   private int size;   private HashMap<T, Integer> map;   public MyHashSet(){    size = 0;    map = new HashMap<>();   }   public int size(){return size;}   public void add(T t){    size++;    map.put(t, map.getOrDefault(t, 0)+1);   }   public int cnt(T t){return map.getOrDefault(t,0);}   public boolean remove(T t){    if(!map.containsKey(t))return false;    size--;    int c = map.get(t);    if(c==1)map.remove(t);    else map.put(t, c-1);    return true;   }  }   int[] reverse(int[] a){   int[] o = new int[a.length];   for(int i = 0; i< a.length; i++)o[i] = a[a.length-i-1];   return o;   }  int[] sort(int[] a){   if(a.length==1)return a;   int mid = a.length/2;   int[] b = sort(Arrays.copyOfRange(a,0,mid)), c = sort(Arrays.copyOfRange(a,mid,a.length));   for(int i = 0, j = 0, k = 0; i< a.length; i++){    if(j<b.length && k<c.length){     if(b[j]<c[k])a[i] = b[j++];     else a[i] = c[k++];    }else if(j<b.length)a[i] = b[j++];    else a[i] = c[k++];   }   return a;  }  long[] sort(long[] a){   if(a.length==1)return a;   int mid = a.length/2;   long[] b = sort(Arrays.copyOfRange(a,0,mid)), c = sort(Arrays.copyOfRange(a,mid,a.length));   for(int i = 0, j = 0, k = 0; i< a.length; i++){    if(j<b.length && k<c.length){     if(b[j]<c[k])a[i] = b[j++];     else a[i] = c[k++];    }else if(j<b.length)a[i] = b[j++];    else a[i] = c[k++];   }   return a;  }  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 bitcount(long n){return (n==0)?0:(1+bitcount(n&(n-1)));}  void p(Object o){out.print(o);}  void pn(Object o){out.println(o);}  void pni(Object o){out.println(o);out.flush();}  String n(){return in.next();}  String nln(){return in.nextLine();}  int ni(){return Integer.parseInt(in.next());}  long nl(){return Long.parseLong(in.next());}  double nd(){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(){    while (st == null || !st.hasMoreElements()){     try{      st = new StringTokenizer(br.readLine());     }catch (IOException e){      e.printStackTrace();     }    }    return st.nextToken();   }   String nextLine(){    String str = "";    try{     str = br.readLine();    }catch (IOException e){     e.printStackTrace();    }     return str;   }  } }
1	public class Main {  static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out);  static long oo = 1000000000000L;  public static void main(String[] args) throws IOException {   int n = in.nextInt();  int q = in.nextInt();   ArrayDeque<Integer> dq = new ArrayDeque<>();  int max = -1;  for(int i = 0; i < n; ++i) {  int x = in.nextInt();  dq.add(x);  max = Math.max(max, x);  }  ArrayList<Pair> ans = new ArrayList<>();  while(dq.peekFirst() != max) {  int a = dq.pollFirst();  int b = dq.pollFirst();  ans.add(new Pair(a, b));  if(a > b) {   dq.addFirst(a);   dq.addLast(b);  }  else {   dq.addFirst(b);   dq.addLast(a);  }  }  ArrayList<Integer> a = new ArrayList<>();  dq.pollFirst();  for(int x : dq)  a.add(x);  while(q --> 0) {  long m = in.nextLong() - 1;  if(m < ans.size()) {   System.out.println(ans.get((int)m).first + " " + ans.get((int)m).second);  }  else {   int idx = (int)((m - ans.size()) % a.size());   System.out.println(max + " " + a.get(idx));  }  }   out.close(); }    static long lcm(long a, long b) {  return a * b / gcd(a, b); }  static boolean nextPermutation(int[] a) {  for(int i = a.length - 2; i >= 0; --i) {  if(a[i] < a[i+1]) {   for(int j = a.length - 1; ; --j) {   if(a[i] < a[j]) {    int t = a[i];    a[i] = a[j];    a[j] = t;    for(i++, j = a.length - 1; i < j; ++i, --j) {    t = a[i];    a[i] = a[j];    a[j] = t;    }    return true;   }   }  }  }  return false; }   static void shuffle(int[] a) {  Random r = new Random();  for(int i = a.length - 1; i > 0; --i) {  int si = r.nextInt(i);  int t = a[si];  a[si] = a[i];  a[i] = t;  } }  static void shuffle(long[] a) {  Random r = new Random();  for(int i = a.length - 1; i > 0; --i) {  int si = r.nextInt(i);  long t = a[si];  a[si] = a[i];  a[i] = t;  } }  static int lower_bound(int[] a, int n, int k) {  int s = 0;  int e = n;  int m;  while (e - s > 0) {  m = (s + e) / 2;  if (a[m] < k)   s = m + 1;  else   e = m;  }  return e; } static int lower_bound(long[] a, int n, long k) {  int s = 0;  int e = n;  int m;  while (e - s > 0) {  m = (s + e) / 2;  if (a[m] < k)   s = m + 1;  else   e = m;  }  return e; }  static int gcd(int a, int b) {  return b == 0 ? a : gcd(b, a % b); } static long gcd(long a, long b) {  return b == 0 ? a : gcd(b, a % b); }  static class Pair implements Comparable<Pair> {  int first, second;   public Pair(int first, int second) {  super();  this.first = first;  this.second = second;  }   @Override  public int compareTo(Pair o) {  return this.first != o.first ? this.first - o.first : this.second - o.second;  }   @Override  public int hashCode() {  final int prime = 31;  int result = 1;  result = prime * result + first;  result = prime * result + second;  return result;  }   @Override  public boolean equals(Object obj) {  if (this == obj)   return true;  if (obj == null)   return false;  if (getClass() != obj.getClass())   return false;  Pair other = (Pair) obj;  if (first != other.first)   return false;  if (second != other.second)   return false;  return true;  } }   }    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) {  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();  Arrays.sort(a);  int min = a[0];  if (a[0] == a[n-1]){   System.out.println("NO");  }else{   for(int i=1;;i++){    if (a[i] > min) {     System.out.println(a[i]);     break;    }   }  } } }
6	public class E implements Runnable { FastReader scn; PrintWriter out; String INPUT = "";  void solve() {  int t = scn.nextInt();  while(t-- > 0) {  int n = scn.nextInt(), m = scn.nextInt();  int[][] arr = scn.next2DInt(n, m);    int[][] col = new int[m][2];  for(int j = 0; j < m; j++) {   int max = 0;   for(int i = 0; i < n; i++) {   max = Math.max(max, arr[i][j]);   }   col[j][0] = max;   col[j][1] = j;  }  Arrays.parallelSort(col, (o1, o2) -> o2[0] - o1[0]);    m = Math.min(n, m);    int[][] lol = new int[n][m];    for(int j = 0; j < m; j++) {   for(int i = 0; i < n; i++) {   lol[i][j] = arr[i][col[j][1]];   }  }    int[] row = new int[n];  for(int i = 0; i < n; i++) {   row[i] = lol[i][0];  }    ans = 0;  func(lol, 1, row);  out.println(ans);  } }  int ans;  void func(int[][] arr, int col, int[] rowM) {  int n = arr.length, m = arr[0].length;  if(col >= m) {  int rv = 0;  for(int a : rowM) {   rv += a;  }  ans = Math.max(ans, rv);  return;  }   int max = 0, ind = -1;  for(int i = 0; i < n; i++) {  if(arr[i][col] > max) {   max = arr[i][col];   ind = i;  }  }   boolean in = false;  for(int r = 0; r < n; r++) {  if(max <= rowM[r]) {   continue;  }  int rot = (ind - r + n) % n;  int[] need = new int[n], copy = Arrays.copyOf(rowM, n);  for(int i = 0; i < n; i++) {   need[i] = arr[(i + rot) % n][col];  }  for(int i = 0; i < n; i++) {   arr[i][col] = need[i];   copy[i] = Math.max(rowM[i], arr[i][col]);  }    ind = r;  in = true;  func(arr, col + 1, copy);  }   if(!in) {  func(arr, col + 2, rowM);  } }  public void run() {  long time = System.currentTimeMillis();  boolean oj = System.getProperty("ONLINE_JUDGE") != null;  out = new PrintWriter(System.out);  scn = new FastReader(oj);  solve();  out.flush();  if (!oj) {  System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));  } }  public static void main(String[] args) {  new Thread(null, new E(), "Main", 1 << 26).start(); }  class FastReader {  InputStream is;  public FastReader(boolean onlineJudge) {  is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());  }  byte[] inbuf = new byte[1024];  public int lenbuf = 0, ptrbuf = 0;  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++];  }  boolean isSpaceChar(int c) {  return !(c >= 33 && c <= 126);  }  int skip() {  int b;  while ((b = readByte()) != -1 && isSpaceChar(b))   ;  return b;  }  double nextDouble() {  return Double.parseDouble(next());  }  char nextChar() {  return (char) skip();  }  String next() {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(isSpaceChar(b))) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }  String nextLine() {  int b = skip();  StringBuilder sb = new StringBuilder();  while ((!isSpaceChar(b) || b == ' ')) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }  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);  }  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 * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }  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 * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }  char[][] nextMatrix(int n, int m) {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)   map[i] = next(m);  return map;  }  int[] nextIntArray(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = nextInt();  return a;  }  long[] nextLongArray(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  int[][] next2DInt(int n, int m) {  int[][] arr = new int[n][];  for (int i = 0; i < n; i++) {   arr[i] = nextIntArray(m);  }  return arr;  }  long[][] next2DLong(int n, int m) {  long[][] arr = new long[n][];  for (int i = 0; i < n; i++) {   arr[i] = nextLongArray(m);  }  return arr;  }  int[] shuffle(int[] arr) {  Random r = new Random();  for (int i = 1, j; i < arr.length; i++) {   j = r.nextInt(i);   int c = arr[i];   arr[i] = arr[j];   arr[j] = c;  }  return arr;  }  long[] shuffle(long[] arr) {  Random r = new Random();  for (int i = 1, j; i < arr.length; i++) {   j = r.nextInt(i);   long c = arr[i];   arr[i] = arr[j];   arr[j] = c;  }  return arr;  }  int[] uniq(int[] arr) {  arr = scn.shuffle(arr);  Arrays.sort(arr);  int[] rv = new int[arr.length];  int pos = 0;  rv[pos++] = arr[0];  for (int i = 1; i < arr.length; i++) {   if (arr[i] != arr[i - 1]) {   rv[pos++] = arr[i];   }  }  return Arrays.copyOf(rv, pos);  }  long[] uniq(long[] arr) {  arr = scn.shuffle(arr);  Arrays.sort(arr);  long[] rv = new long[arr.length];  int pos = 0;  rv[pos++] = arr[0];  for (int i = 1; i < arr.length; i++) {   if (arr[i] != arr[i - 1]) {   rv[pos++] = arr[i];   }  }  return Arrays.copyOf(rv, pos);  }  int[] reverse(int[] arr) {  int l = 0, r = arr.length - 1;  while (l < r) {   arr[l] = arr[l] ^ arr[r];   arr[r] = arr[l] ^ arr[r];   arr[l] = arr[l] ^ arr[r];   l++;   r--;  }  return arr;  }  long[] reverse(long[] arr) {  int l = 0, r = arr.length - 1;  while (l < r) {   arr[l] = arr[l] ^ arr[r];   arr[r] = arr[l] ^ arr[r];   arr[l] = arr[l] ^ arr[r];   l++;   r--;  }  return arr;  }  int[] compress(int[] arr) {  int n = arr.length;  int[] rv = Arrays.copyOf(arr, n);  rv = uniq(rv);  for (int i = 0; i < n; i++) {   arr[i] = Arrays.binarySearch(rv, arr[i]);  }  return arr;  }  long[] compress(long[] arr) {  int n = arr.length;  long[] rv = Arrays.copyOf(arr, n);  rv = uniq(rv);  for (int i = 0; i < n; i++) {   arr[i] = Arrays.binarySearch(rv, arr[i]);  }  return arr;  } } }
2	public class Pipeline {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  long n = sc.nextLong();  long k = sc.nextLong();  sc.close();  if (k * (k - 1) / 2 + 1 < n) {  System.out.println(-1);  } else {  long l = -1, r = k;  while (r - l > 1) {   long m = (r + l) / 2;   if (cantidadPosible(k, m) >= n) {   r = m;   } else {   l = m;   }  }  System.out.println(r);  }  }  private static long cantidadPosible(long k, long usadas) {  return (k * (k - 1) / 2 + 1 - (k - usadas) * (k - usadas - 1) / 2); } }
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));  } }
4	public class D {  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];   }  }   static int n,m,k,uu[][],rr[][],dd[][],ll[][],dp[][][];   public static void main(String args[]) throws IOException {   Scan input=new Scan();   StringBuilder ans=new StringBuilder("");     n=input.scanInt();   m=input.scanInt();   k=input.scanInt();     dp=new int[n][m][k];   for(int i=0;i<n;i++) {    for(int j=0;j<m;j++) {     for(int kk=0;kk<k;kk++) {      dp[i][j][kk]=-1;     }    }   }     uu=new int[n][m];   rr=new int[n][m];   dd=new int[n][m];   ll=new int[n][m];     for(int i=0;i<n;i++) {    for(int j=0;j<m-1;j++) {     int tmp=input.scanInt();     rr[i][j]=tmp;     ll[i][j+1]=tmp;    }   }     for(int i=0;i<n-1;i++) {    for(int j=0;j<m;j++) {     int tmp=input.scanInt();     dd[i][j]=tmp;     uu[i+1][j]=tmp;    }   }     for(int i=0;i<n;i++) {    for(int j=0;j<m;j++) {     if(k%2!=0) {      ans.append(-1+" ");      continue;     }     ans.append((2*solve(i,j,k/2))+" ");    }    ans.append("\n");   }     System.out.println(ans);  }   public static int solve(int x,int y,int rem) {   if(rem==0) {    return 0;   }     if(dp[x][y][rem]!=-1) {    return dp[x][y][rem];   }     int ans=Integer.MAX_VALUE/10;   if(uu[x][y]!=0) {    ans=Math.min(ans,uu[x][y]+solve(x-1,y,rem-1));   }   if(rr[x][y]!=0) {    ans=Math.min(ans,rr[x][y]+solve(x,y+1,rem-1));   }   if(dd[x][y]!=0) {    ans=Math.min(ans,dd[x][y]+solve(x+1,y,rem-1));   }   if(ll[x][y]!=0) {    ans=Math.min(ans,ll[x][y]+solve(x,y-1,rem-1));   }     dp[x][y][rem]=ans;     return ans;  } }
1	public class Main {  public static StreamTokenizer in;  public static PrintStream out;  public static BufferedReader br;  public static String readString() throws IOException {   in.nextToken();   return in.sval;   }  public static double readDouble() throws IOException {   in.nextToken();   return in.nval;   }  public static int readInt() throws IOException {   in.nextToken();   return (int) in.nval;  }   public static String readLine() throws IOException {  return br.readLine();  }   public static int genans(String ss) {    int n = ss.length();  char[] s = ss.toCharArray();  int res = 0;  while (true) {   int firstT = -1;   for (int i=0; i<n; i++)   if (s[i]=='T') { firstT = i; break; }     int lastH = -1;   for (int i=n-1; i>=0; i--)   if (s[i]=='H') { lastH=i; break; }     if (firstT<lastH) {   res++;   s[firstT] = 'H';   s[lastH] = 'T';   } else break;     }   return res;  }   public static void main(String[] args) throws IOException {   in = new StreamTokenizer(new InputStreamReader (System.in) );   br = new BufferedReader(new InputStreamReader(System.in));   out = new PrintStream(System.out);   readLine();   String s = readLine();   int n = s.length();   String kk = s;   int ans = n*100;   for (int tr=0; tr<n+2; tr++) {   String kk2 = "";   for (int i=1; i<n; i++) kk2 = kk2 +kk.charAt(i);   kk2 = kk2 + kk.charAt(0);   kk = kk2;     int cur = genans(kk);     if (cur<ans) ans = cur;   }     out.println(ans);  }   }
5	public class R111_D2_A {  public static void main(String[] args) {   InputReader in = new InputReader(System.in);        int n = in.readInt();   int[] inp = new int[n];   for (int i = 0; i < inp.length; i++) {    inp[i] = in.readInt();   }   Arrays.sort(inp);   int sum1 = 0;   int res = 0;   for (int i = inp.length - 1; i >= 0; i--) {    sum1 += inp[i];    res++;    int sum2 = 0;    for (int j = 0; j < i; j++) {     sum2 += inp[j];    }    if (sum1 > sum2) {     break;    }   }   System.out.println(res);  }  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 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;   }  } }
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(); } }
4	public class Solution {   public static void main(String[] args) {   InputStream inputStream;   try {    inputStream = new FileInputStream("input.txt");   } catch (IOException e) {    throw new RuntimeException(e);   }   OutputStream outputStream;   try {    outputStream = new FileOutputStream("output.txt");   } catch (IOException e) {    throw new RuntimeException(e);   }   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[][] or;   int n;   int m;   public void solve(int testNumber, InputReader in, PrintWriter out) {    n = in.nextInt();    m = in.nextInt();    int k = in.nextInt();    ArrayList<Point> arr1 = new ArrayList<>();    ArrayList<Point> arr2 = new ArrayList<>();    for (int i = 0; i < k; i++) {     arr1.add(new Point(in.nextInt(), in.nextInt()));    }    or = new int[n + 1][m + 1];    for (int i = 0; i < k; i++) {     or[arr1.get(i).x][arr1.get(i).y] = -1;    }    Point lastValue = arr1.get(0);    while (arr1.size() > 0 || arr2.size() > 0) {     for (Point p : arr1) {      if (valid(new Point(p.x - 1, p.y))) {       arr2.add(new Point(p.x - 1, p.y));      }      if (valid(new Point(p.x + 1, p.y))) {       arr2.add(new Point(p.x + 1, p.y));      }      if (valid(new Point(p.x, p.y - 1))) {       arr2.add(new Point(p.x, p.y - 1));      }      if (valid(new Point(p.x, p.y + 1))) {       arr2.add(new Point(p.x, p.y + 1));      }     }     arr1.clear();     if (arr2.size() > 0) {      lastValue = arr2.get(0);     }     for (Point p : arr2) {      if (valid(new Point(p.x - 1, p.y))) {       arr1.add(new Point(p.x - 1, p.y));      }      if (valid(new Point(p.x + 1, p.y))) {       arr1.add(new Point(p.x + 1, p.y));      }      if (valid(new Point(p.x, p.y - 1))) {       arr1.add(new Point(p.x, p.y - 1));      }      if (valid(new Point(p.x, p.y + 1))) {       arr1.add(new Point(p.x, p.y + 1));      }     }     arr2.clear();     if (arr1.size() > 0) {      lastValue = arr1.get(0);     }    }    out.println(lastValue.x + " " + lastValue.y);   }   boolean valid(Point p) {    if ((p.x < 1 || p.x > n) ||      (p.y < 1 || p.y > m) ||      or[p.x][p.y] == -1) {     return false;    }    or[p.x][p.y] = -1;    return true;   }   class Point {    int x;    int y;    public Point(int a, int b) {     x = a;     y = b;    }   }  }  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());   }  } }
2	public class TC {  static long N;  static int k;  static long WHOLESUM;   static long SUM( long k )  {   long res=k*( k+1 )/2;   return res-1;  }   static long returnPipes( int mid )  {   long not=SUM( mid-1 );   long totpipes=WHOLESUM-not;   int number=k-mid+1;   long res=totpipes-number+1;   return res;  }   static long binarySearch( int lo, int hi )  {   int res=Integer.MAX_VALUE;   int val=0;   while( lo <= hi )   {    int mid=( lo+hi )/2;    long cnt=returnPipes( mid );    val=k-mid+1;;       if( cnt < N )    {     hi=mid-1;     continue;    }    else    {     res=Math.min( val, res );     lo=mid+1;    }   }     if( res==Integer.MAX_VALUE )    return -1;   else    return res;    }    public static void main( String[] args ) throws IOException  {   Scanner s=new Scanner( System.in );   N=s.nextLong();   k=s.nextInt();   WHOLESUM=SUM( k );   if( N<=1 )    System.out.println(0 );   else    System.out.println( binarySearch( 2, k ) );  }    }
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 + " ");   }  } }
0	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);   ASubtractions solver = new ASubtractions();   solver.solve(1, in, out);   out.close();  }  static class ASubtractions {   public void solve(int testNumber, InputReader c, OutputWriter w) {    int tc = c.readInt();    while (tc-- > 0) {     int a = c.readInt(), b = c.readInt();     int res = 0;     while (a != 0 && b != 0) {      res += b / a;      b = b % a;      int t = b;      b = a;      a = t;     }     w.printLine(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 close() {    writer.close();   }   public void printLine(int i) {    writer.println(i);   }  } }
0	public class RationalResistance { public static void main(String args[]) throws IOException{  BufferedReader f= new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  StringTokenizer st=new StringTokenizer(f.readLine());  long a=Long.parseLong(st.nextToken());  long b=Long.parseLong(st.nextToken());  long sum = 0;  while(a!= 0 && b!= 0){  if (a > b){   long val = a / b;   sum += val;   a -= val * b;  }  else{   long val = b / a;   sum += val;   b -= val * a;  }  }   out.println(sum);  out.close();  System.exit(0); }  }
6	public class l {               static long mod = (int) (1e9 + 7);  static int n;  static StringBuilder sol;  static class pair implements Comparable<pair> {   int L,R;   public pair( int x,int y) {    L=x;R=y;   }    public int compareTo(pair o) {    if (L!=o.L)return L-o.L;    return o.R-R;   }   public String toString(){    return L+" "+R;   }  }  static boolean is;  static int [][][]memo;  static int[]val,gen;  static int dp(int last,int rem,int msk){   if (rem==0)return 1;   if (memo[last][rem][msk]!=-1)return memo[last][rem][msk];   int ans =0;   for (int i =0;i<n;i++){    if ((msk&1<<i)==0){     if (gen[i]!=last&&val[i]<=rem){      ans+=dp(gen[i],rem-val[i],msk|1<<i);      ans%=mod;     }    }   }   return memo[last][rem][msk]=ans;  }  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);     PrintWriter pw = new PrintWriter(System.out);   n = sc.nextInt();   int t = sc.nextInt();   gen= new int[n];   val= new int[n];   for (int i =0;i<n;i++){    val[i]=sc.nextInt();    gen[i]=sc.nextInt();   }   memo= new int[4][t+1][1<<n];   for (int[][]x:memo)for (int[]a:x)Arrays.fill(a,-1);   pw.println(dp(0,t,0));   pw.flush();  }  static class Scanner {   StringTokenizer st;   BufferedReader br;   public Scanner(FileReader r) {    br = new BufferedReader(r);   }   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 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); } }
1	public class A { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni(), d = ni();  int[] a = na(n);  Set<Long> set = new HashSet<>();  for(int v : a){  set.add(v-(long)d);  set.add(v+(long)d);  }  int ct = 0;  for(long s : set){  long min = Long.MAX_VALUE;  for(int v : a){   min = Math.min(min, Math.abs(s-v));  }  if(min == d)ct++;  }  out.println(ct); }  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]; 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)); } }
6	public class D {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int m = sc.nextInt();   int[][]a = new int[n][n];   for (int i = 1; i <= m; i++) {    int v1 = sc.nextInt();    int v2 = sc.nextInt();    v1--;    v2--;    a[v1][v2] = a[v2][v1] = 1;   }   long[][]dp = new long[1 << n][n];   for (int i = 0; i < n; i++) {    dp[1 << i][i] = 1;   }   for (int mask = 0; mask < (1 << n); mask++) {    if (Integer.bitCount(mask) > 1) {     for (int i = 0; i < n; i++) {      if (i==Integer.numberOfTrailingZeros(mask))       continue;      if ((mask & (1 << i)) != 0) {       for (int j = 0; j < n; j++) {        if ((mask & (1 << j)) != 0 && a[j][i]==1) {         dp[mask][i] += dp[(mask ^ (1 << i))][j];        }       }      }     }    }   }   long ans = 0;   for (int mask = 0; mask < (1 << n); mask++) {    if (Integer.bitCount(mask) >= 3) {     int t = Integer.numberOfTrailingZeros(mask);     for (int i = 0; i < n; i++) {      if (a[t][i]==1)       ans += dp[mask][i];     }    }   }   ans /= 2;   System.out.println(ans);  } }
4	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{  static boolean twofind(String s, String t){   int index = s.indexOf(t);   int index2 = s.indexOf(t, index + 1);   if(index2 != -1)return true;   return false;  } public void solve(int testNumber, FastScanner scan, FastPrinter out) {      String s = scan.next();   String ans = "";   boolean ok = false;   for(int i = s.length(); i >= 0; i--){   for(int j = 0; j <= s.length() - 1; j++){    try{    if(twofind(s, s.substring(j, j + i))){     ans = s.substring(j, j + i); break;    }    }catch(Exception e){    break;    }   }   if(!ans.equals(""))break;   }     out.println(ans.length());    } } class FastScanner extends BufferedReader { public FastScanner(InputStream is) {  super(new InputStreamReader(is)); }  public int read() {  try{  int ret = super.read();  return ret;  }catch(Exception 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 long nextLong() {  return Long.parseLong(next()); }  public BigInteger nextBigInteger() {  return new BigInteger(next()); }  public BigDecimal nextBigDecimal(){  return new BigDecimal(next()); }  public String readLine(){  try{  return super.readLine();  }catch(IOException e){  return null;  } } } class FastPrinter extends PrintWriter {  public FastPrinter(OutputStream out) {  super(out); } public FastPrinter(Writer out) {  super(out); } }
0	public class LuckyDivision {  public final String check (String s) {   String result = "NO";   StringTokenizer stringTokenizer = new StringTokenizer(s, "47");   if(!stringTokenizer.hasMoreTokens()) return "YES";   int S = Integer.parseInt(s);   generateSimpleAndDivide(S, 4, 4, 7);   generateSimpleAndDivide(S, 7, 4, 7);   if(lucky) return "YES";   return result;  }  public static final void main(String[] args) {   Scanner scanner = new Scanner(System.in);   System.out.print(new LuckyDivision().check(scanner.next()));  }  public void generateSimpleAndDivide(int divided, int n, int n1, int n2) {   if(lucky || n >= divided) return;   if(divided % n == 0) lucky = true;   generateSimpleAndDivide(divided, Integer.parseInt(n + "" + n1), n1, n2);   generateSimpleAndDivide(divided, Integer.parseInt(n + "" + n2), n1, n2);  }  private boolean lucky = false; }
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 CFA {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  private static final long MOD = 1000 * 1000 * 1000 + 7;  private static final int[] dx = {0, -1, 0, 1};  private static final int[] dy = {1, 0, -1, 0};  private static final String yes = "Yes";  private static final String no = "No";  void solve() throws IOException {   int n = nextInt();   String[] arr1 = new String[n];   String[] arr2 = new String[n];   for (int i = 0; i < n; i++) {    arr1[i] = nextString();   }   for (int i = 0; i < n; i++) {    arr2[i] = nextString();   }   Map<String, Integer> m1 = getMap(arr1);   Map<String, Integer> m2 = getMap(arr2);   int res = 0;   for (Map.Entry<String, Integer> entry : m2.entrySet()) {    String key = entry.getKey();    int val = entry.getValue();    if (m1.containsKey(key)) {     int v2 = m1.get(key);     if (val > v2) {      res += val - v2;     }    }    else {     res += val;    }   }   for (Map.Entry<String, Integer> entry : m1.entrySet()) {    String key = entry.getKey();    int val = entry.getValue();    if (m2.containsKey(key)) {     int v2 = m2.get(key);     if (val > v2) {      res += val - v2;     }    }    else {     res += val;    }   }   outln(res / 2);  }  Map<String, Integer> getMap(String[] arr) {   Map<String, Integer> res = new HashMap<>();   for (String str : arr) {    res.put(str, res.getOrDefault(str, 0) + 1);   }   return res;  }  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);  }  private void formatPrint(double val) {   outln(String.format("%.9f%n", val));  }  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());  } }
6	public class D { static int dp(int i,int start,int msk) {  if(Integer.bitCount(msk)==n)  return s_e[i][start];  if(dp[i][start][msk]!=-1)  return dp[i][start][msk];   int max=0;  for(int k=0;k<n;k++)  {   int min=Integer.MAX_VALUE;  if((msk & (1<<k)) == 0 )  {   min=diff[i][k];   min=Math.min(min, dp(k,start,msk | (1<<k)));   max=Math.max(max, min);  }  }  return dp[i][start][msk]=max; } static int n,m,a[][],dp[][][],diff[][],s_e[][]; public static void main(String[] args) throws IOException {  Scanner sc = new Scanner();  PrintWriter pw = new PrintWriter(System.out);  n=sc.nextInt();  m=sc.nextInt();  a=new int[n][m];  diff=new int[n][n];  s_e=new int[n][n];  for(int i=0;i<n;i++)  for(int j=0;j<m;j++)   a[i][j]=sc.nextInt();   dp=new int[n][n][70000];  int ans=0;  for(int i=0;i<n;i++)  for(int j=0;j<n;j++)  {   Arrays.fill(dp[i][j], -1);   diff[i][j]=Integer.MAX_VALUE;   s_e[i][j]=Integer.MAX_VALUE;   for(int k=0;k<m-1;k++)   {    diff[i][j]=Math.min(Math.abs(a[i][k]-a[j][k]), diff[i][j]);   s_e[i][j]=Math.min(Math.abs(a[i][k]-a[j][k+1]), s_e[i][j]);   }   diff[i][j]=Math.min(Math.abs(a[i][m-1]-a[j][m-1]), diff[i][j]);  }   for(int i=0;i<n;i++)  ans=Math.max(ans, dp(i,i,1<<i));   pw.print(ans);  pw.close(); }  static class Scanner {  BufferedReader br;  StringTokenizer st;  Scanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  String next() throws IOException {  while (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());  }  String nextLine() throws IOException {  return br.readLine();  }  boolean hasnext() throws IOException {  return br.ready();  }  } }
6	public class Main {  static HashSet<Integer> adjList[];  public static void main(String[]args)throws IOException{   BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(System.in));   StringBuilder stringBuilder=new StringBuilder();   String temp[]=bufferedReader.readLine().split(" ");   int V=Integer.parseInt(temp[0]);   int E=Integer.parseInt(temp[1]);   adjList=new HashSet[V];   for(int i=0;i<V;i++)    adjList[i]=new HashSet<>();   for(int i=0;i<E;i++){    temp=bufferedReader.readLine().split(" ");    int x=Integer.parseInt(temp[0])-1;    int y=Integer.parseInt(temp[1])-1;    adjList[y].add(x);    adjList[x].add(y);   }   stringBuilder.append(solve(V)+"\n");   System.out.println(stringBuilder);  }  private static long solve(int V) {   long dp[][]=new long[(1<<V)][V];   long count=0;   for(int i=0;i<V;i++)    dp[(1<<i)][i]=1;   for(int mask=1;mask<(1<<V);mask++){       int first = Integer.numberOfTrailingZeros(mask);    for(int i=0;i<V;i++){     if((mask&(1<<i))==0 || first==i) continue;     for (int j = 0; j < V; j++)      if (adjList[i].contains(j) && (mask & (1<<j))!=0)       dp[mask][i] += dp[mask ^ (1 << i)][j];         if (Integer.bitCount(mask)>=3)      if(adjList[first].contains(i))       count+=dp[mask][i];    }   }   return count/2;  } }
6	public class Main{  static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  static long mod=(long)1e9+7;  static long mod1=998244353;  static boolean sieve[];  static ArrayList<Integer> primes;  static long factorial[],invFactorial[];  static HashSet<Pair> graph[];  static boolean oj = System.getProperty("ONLINE_JUDGE") != null;  static int n,T,input[],type[];  static long dp[][];  static long dfs(int mask,int t){   if(dp[mask][t]!=-1){    return dp[mask][t];   }   int s=0;   for(int i=0;i<n;i++){    if((mask&(1<<i))!=0){     s+=input[i];    }   }   if(s>T){    return 0;   }   if(s==T){    dp[mask][t]=1;    return dp[mask][t];   }   long ans=0;   for(int i=0;i<n;i++){    if((mask&(1<<i))==0&&type[i]!=t){     ans=(ans+dfs(mask|(1<<i),type[i]))%mod;    }   }   dp[mask][t]=ans;   return dp[mask][t];  }  public static void main (String[] args) throws Exception {   String st[]=nl();   n=pi(st[0]);   T=pi(st[1]);   input=new int[n];   type=new int[n];   for(int i=0;i<n;i++){    st=nl();    input[i]=pi(st[0]);    type[i]=pi(st[1]);   }   dp=new long[1<<n][4];   for(long arr[]:dp)    Arrays.fill(arr,-1);   long ans=dfs(0,0);      out.println(ans);   out.flush();   out.close();  }  static String[] nl() throws Exception{   return br.readLine().split(" ");  }  static String[] nls() throws Exception{   return br.readLine().split("");  }  static int pi(String str) {   return Integer.parseInt(str);  }  static long pl(String str){   return Long.parseLong(str);  }  static double pd(String str){   return Double.parseDouble(str);  }  static void printPrecision(double d){   DecimalFormat ft = new DecimalFormat("0.00000000000000000");   out.println(ft.format(d));  }  static void printMask(long mask){   System.out.println(Long.toBinaryString(mask));  }  static int countBit(int mask){   int ans=0;   while(mask!=0){    if(mask%2==1){     ans++;    }    mask/=2;   }   return ans;  }  static void Makegraph(int n){   graph=new HashSet[n];   for(int i=0;i<n;i++){    graph[i]=new HashSet<>();   }  }  static void addEdge(int a,int b){   graph[a].add(new Pair(b,1));  }  static void addEdge(int a,int b,int c){   graph[a].add(new Pair(b,c));  }   static class PairComp implements Comparator<Pair>{   public int compare(Pair p1,Pair p2){    return ((p1.u+p1.v)-(p2.u+p2.v));   }  }  static class Pair implements Comparable<Pair> {   int u;   int v;   int index=-1;   public Pair(int u, int v) {    this.u = u;    this.v = v;   }   public int hashCode() {    int hu = (int) (u ^ (u >>> 32));    int hv = (int) (v ^ (v >>> 32));    return 31 * hu + hv;   }   public boolean equals(Object o) {    Pair other = (Pair) o;    return u == other.u && v == other.v;   }   public int compareTo(Pair other) {    if(index!=other.index)     return Long.compare(index, other.index);    return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);   }   public String toString() {    return "[u=" + u + ", v=" + v + "]";   }  }  static class PairCompL implements Comparator<Pairl>{   public int compare(Pairl p1,Pairl p2){    if((p1.u+2*p1.v)-(p2.u+2*p2.v)<0){     return -1;    }    else if((p1.u+2*p1.v)-(p2.u+2*p2.v)>0){     return 1;    }    else{     return 0;    }   }  }  static class Pairl implements Comparable<Pairl> {    long u;    long v;    int index=-1;    public Pairl(long u, long v) {     this.u = u;     this.v = v;    }     public int hashCode() {     int hu = (int) (u ^ (u >>> 32));     int hv = (int) (v ^ (v >>> 32));     return 31 * hu + hv;    }     public boolean equals(Object o) {     Pair other = (Pair) o;     return u == other.u && v == other.v;    }     public int compareTo(Pairl other) {     if(index!=other.index)      return Long.compare(index, other.index);     return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);    }     public String toString() {     return "[u=" + u + ", v=" + v + "]";    }   }  public static void debug(Object... o) {   if(!oj)   System.out.println(Arrays.deepToString(o));  }  static long modulo(long a,long b,long c) {   long x=1;   long y=a;   while(b > 0){    if(b%2 == 1){     x=(x*y)%c;    }    y = (y*y)%c;    b /= 2;   }   return x%c;  }  static long gcd(long x, long y)  {   if(x==0)    return y;   if(y==0)    return x;   long r=0, a, b;   a = (x > y) ? x : y;   b = (x < y) ? x : y;   r = b;   while(a % b != 0)   {    r = a % b;    a = b;    b = r;   }   return r;  }  static void sieveMake(int n){   sieve=new boolean[n];   Arrays.fill(sieve,true);   sieve[0]=false;   sieve[1]=false;   for(int i=2;i*i<n;i++){    if(sieve[i]){     for(int j=i*i;j<n;j+=i){      sieve[j]=false;     }    }   }   primes=new ArrayList<Integer>();   for(int i=0;i<n;i++){    if(sieve[i]){     primes.add(i);    }   }    } }
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;   }  } }
2	public class CF256B extends PrintWriter { CF256B() { super(System.out, true); } Scanner sc = new Scanner(System.in); public static void main(String[] $) {  CF256B o = new CF256B(); o.main(); o.flush(); }  long count(int n, int x, int y, int r) {  long a = 2L * r * r + 2 * r + 1;  int w;  if ((w = 1 - (x - r)) > 0)  a -= (long) w * w;  if ((w = 1 - (y - r)) > 0)  a -= (long) w * w;  if ((w = (x + r) - n) > 0)  a -= (long) w * w;  if ((w = (y + r) - n) > 0)  a -= (long) w * w;  if ((w = r - 1 - (x - 1) - (y - 1)) > 0)  a += (long) w * (w + 1) / 2;  if ((w = r - 1 - (x - 1) - (n - y)) > 0)  a += (long) w * (w + 1) / 2;  if ((w = r - 1 - (n - x) - (y - 1)) > 0)  a += (long) w * (w + 1) / 2;  if ((w = r - 1 - (n - x) - (n - y)) > 0)  a += (long) w * (w + 1) / 2;  return a; } void main() {  int n = sc.nextInt();  int x = sc.nextInt();  int y = sc.nextInt();  int c = sc.nextInt();  int lower = -1, upper = c;  while (upper - lower > 1) {  int r = (lower + upper) / 2;  if (count(n, x, y, r) >= c)   upper = r;  else   lower = r;  }  println(upper); } }
5	public class Main { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tokenizer=null;  public static void main(String[] args) throws IOException {  new Main().execute(); }  void debug(Object...os) {  System.out.println(Arrays.deepToString(os)); }  int ni() throws IOException {  return Integer.parseInt(ns()); }  long nl() throws IOException  {  return Long.parseLong(ns()); }  double nd() throws IOException  {  return Double.parseDouble(ns()); }   String ns() throws IOException  {  while (tokenizer == null || !tokenizer.hasMoreTokens())   tokenizer = new StringTokenizer(br.readLine());  return tokenizer.nextToken(); }  String nline() throws IOException {  tokenizer=null;  return br.readLine(); }     int totalCases, testNum;  int n,a,b; long arr[];  void execute() throws IOException {  totalCases = 1;  for(testNum = 1; testNum <= totalCases; testNum++)  {  if(!input())   break;  solve();  } }  void solve() throws IOException {  Arrays.sort(arr);  long x1 = arr[b-1];  long x2 = arr[b];   System.out.println(x2-x1); }  boolean input() throws IOException {  n = ni();  a = ni();  b = ni();  arr = new long[n];  for(int i = 0;i<n;i++)  {  arr[i] = nl();  }  return true; } }
4	public class P1517D {    private static int n, m, k; private static int[][] hor, ver, a, b; private static long ans; private static int[][] id; private static Integer[][][] dp; private static int idf; private static String s, t; private static HashMap<Integer, ArrayList<Integer>> g;   private static final int MOD = (int) 1e9 + 7;  public static void main(String[] args) {  n = ini();  m = ini();  k = ini();   if (k%2!=0) {  for(int i=0; i<n; i++) {   for(int j=0; j<m; j++) {   print(-1+" ");   }   println();  }  out.flush();  return;  }  hor = new int[n][m-1];  ver = new int[n-1][m];   for(int i=0; i<n; i++) {  for(int j=0; j<m-1; j++) {   hor[i][j] = ini();  }  }  for(int i=0; i<n-1; i++) {  for(int j=0; j<m; j++) {   ver[i][j] = ini();  }  }   dp = new Integer[n][m][k+1];   for(int i=0; i<n; i++) {  for(int j=0; j<m; j++) {   print(2*solve(i, j, k/2)+" ");  }  println();  }   out.flush();  out.close();  }  private static int solve(int i, int j, int kLeft) {  if (i<0 || i>=n || j<0 || j>=m) {  return (int)1e9;  } else if (kLeft==0) {  return 0;  }   if (dp[i][j][kLeft]!=null) {  return dp[i][j][kLeft];  }   int ans = (int)1e9;   final int[] dx = {-1, 1, 0, 0};  final int[] dy = {0, 0, -1, 1};   for(int type=0; type<4; type++) {  int ni = i+dx[type];  int nj = j+dy[type];  if (ni<0 || ni>=n || nj<0 || nj>=m) continue;    int inhibit = 0;  if (type==0) {   inhibit = ver[ni][nj];  } else if (type==1) {   inhibit = ver[i][j];  } else if (type==2) {   inhibit = hor[ni][nj];  } else {   inhibit = hor[i][j];  }    ans = Math.min(ans, inhibit+solve(ni, nj, kLeft-1));  }   return dp[i][j][kLeft]=ans; }   private static void initCase(int z) {  idf = z;  ans = 0; }   private static void printAns(Object o) {  out.println(o); }  private static void printAns(Object o, int testCaseNo) {  out.println("Case #" + testCaseNo + ": " + o); }  private static void printArray(Object[] a) {  for (int i = 0; i < a.length; i++) {  out.print(a[i] + " ");  }  out.println(); }   private static void sort(int[] a) {  int n = a.length;  Integer[] b = new Integer[n];  for (int i = 0; i < n; i++) {  b[i] = a[i];  }  Arrays.sort(b);  for (int i = 0; i < n; i++) {  a[i] = b[i];  } }  private static void sort(long[] a) {  int n = a.length;  Long[] b = new Long[n];  for (int i = 0; i < n; i++) {  b[i] = a[i];  }  Arrays.sort(b);  for (int i = 0; i < n; i++) {  a[i] = b[i];  } }   private static int[] ina(int n) {  int[] temp = new int[n];  for (int i = 0; i < n; i++) {  temp[i] = in.nextInt();  }  return temp; }  private static int[][] ina2d(int n, int m) {  int[][] temp = new int[n][m];  for (int i = 0; i < n; i++) {  temp[i] = ina(m);  }  return temp; }  private static int ini() {  return in.nextInt(); }  private static long inl() {  return in.nextLong(); }  private static double ind() {  return Double.parseDouble(ins()); }  private static String ins() {  return in.readString(); }   private static void println(Object... o) {  for (Object x : o) {  out.write(x + "");  }  out.write("\n"); }  private static void pd(Object... o) {  for (Object x : o) {  out.write(x + "");  }  out.flush();  out.write("\n"); }  private static void print(Object... o) {  for (Object x : o) {  out.write(x + "");  } }   private static HashMap<Integer, ArrayList<Integer>> intree(int n) {  HashMap<Integer, ArrayList<Integer>> g = new HashMap<>();  for (int i = 0; i < n; i++) {  g.put(i, new ArrayList<>());  }  for (int i = 0; i < n - 1; i++) {  int u = ini() - 1;  int v = ini() - 1;  g.get(u).add(v);  g.get(v).add(u);  }  return g; }  private static HashMap<Integer, ArrayList<Integer>> ingraph(int n, int m) {  HashMap<Integer, ArrayList<Integer>> g = new HashMap<>();  for (int i = 0; i < n; i++) {  g.put(i, new ArrayList<>());  }  for (int i = 0; i < m; i++) {  int u = ini() - 1;  int v = ini() - 1;  g.get(u).add(v);  g.get(v).add(u);  }  return g;  }  private static HashMap<Integer, ArrayList<Integer>> indirectedgraph(int n, int m) {  HashMap<Integer, ArrayList<Integer>> g = new HashMap<>();  for (int i = 0; i < n; i++) {  g.put(i, new ArrayList<>());  }  for (int i = 0; i < m; i++) {  int u = ini() - 1;  int v = ini() - 1;  g.get(u).add(v);  }  return g;  }  private static HashMap<Integer, ArrayList<Edge>> inweightedgraph(int n, int m) {  HashMap<Integer, ArrayList<Edge>> g = new HashMap<>();  for (int i = 0; i < n; i++) {  g.put(i, new ArrayList<>());  }  for (int i = 0; i < m; i++) {  int u = ini() - 1;  int v = ini() - 1;  int w = ini();  Edge edge = new Edge(u, v, w);  g.get(u).add(edge);  g.get(v).add(edge);  }  return g;  }  private static class Edge implements Comparable<Edge> {  private int u, v;  private long w;  public Edge(int a, int b, long c) {  u = a;  v = b;  w = c;  }  public int other(int x) {  return (x == u ? v : u);  }  public int compareTo(Edge edge) {  return Long.compare(w, edge.w);  } }  private static class Pair {  private int u, v;  public Pair(int a, int b) {  u = a;  v = b;  }  public int hashCode() {  return u + v + u * v;  }  public boolean equals(Object object) {  Pair pair = (Pair) object;  return u == pair.u && v == pair.v;  } }  private static class Node implements Comparable<Node> {  private int u;  private long dist;  public Node(int a, long b) {  u = a;  dist = b;  }  public int compareTo(Node node) {  return Long.compare(dist, node.dist);  } }   private static int gcd(int a, int b) {   if (b == 0)  return a;  return gcd(b, a % b); }  private static long modExp(long a, long b) {  if (b == 0)  return 1;  a %= MOD;  long exp = modExp(a, b / 2);  if (b % 2 == 0) {  return (exp * exp) % MOD;  } else {  return (a * ((exp * exp) % MOD)) % MOD;  } }  private long mul(int a, int b) {  return a * 1L * b; }   private static class SegmentTree<T extends Comparable<T>> {  private int n, m;  private T[] a;  private T[] seg;  private T NULLVALUE;  public SegmentTree(int n, T NULLVALUE) {  this.NULLVALUE = NULLVALUE;  this.n = n;  m = 4 * n;  seg = (T[]) new Object[m];  }  public SegmentTree(T[] a, int n, T NULLVALUE) {  this.NULLVALUE = NULLVALUE;  this.a = a;  this.n = n;  m = 4 * n;  seg = (T[]) new Object[m];  construct(0, n - 1, 0);  }  private void update(int pos) {         if (seg[2 * pos + 1].compareTo(seg[2 * pos + 2]) <= 0) {   seg[pos] = seg[2 * pos + 1];  } else {   seg[pos] = seg[2 * pos + 2];  }  }  private T optimum(T leftValue, T rightValue) {         if (leftValue.compareTo(rightValue) <= 0) {   return leftValue;  } else {   return rightValue;  }  }  public void construct(int low, int high, int pos) {  if (low == high) {   seg[pos] = a[low];   return;  }   int mid = (low + high) / 2;   construct(low, mid, 2 * pos + 1);  construct(mid + 1, high, 2 * pos + 2);  update(pos);  }  public void add(int index, T value) {  add(index, value, 0, n - 1, 0);  }  private void add(int index, T value, int low, int high, int pos) {  if (low == high) {   seg[pos] = value;   return;  }   int mid = (low + high) / 2;   if (index <= mid) {   add(index, value, low, mid, 2 * pos + 1);  } else {   add(index, value, mid + 1, high, 2 * pos + 2);  }  update(pos);  }  public T get(int qlow, int qhigh) {  return get(qlow, qhigh, 0, n - 1, 0);  }  public T get(int qlow, int qhigh, int low, int high, int pos) {  if (qlow > low || low > qhigh) {   return NULLVALUE;  } else if (qlow <= low || qhigh >= high) {   return seg[pos];  } else {   int mid = (low + high) / 2;   T leftValue = get(qlow, qhigh, low, mid, 2 * pos + 1);   T rightValue = get(qlow, qhigh, mid + 1, high, 2 * pos + 2);   return optimum(leftValue, rightValue);  }  } }   private static class DSU {  private int[] id;  private int[] size;  private int n;  public DSU(int n) {  this.n = n;   id = new int[n];  for (int i = 0; i < n; i++) {   id[i] = i;  }   size = new int[n];  Arrays.fill(size, 1);  }  private int root(int u) {  while (u != id[u]) {   id[u] = id[id[u]];   u = id[u];  }  return u;  }  public boolean connected(int u, int v) {  return root(u) == root(v);  }  public void union(int u, int v) {  int p = root(u);  int q = root(v);   if (size[p] >= size[q]) {   id[q] = p;   size[p] += size[q];  } else {   id[p] = q;   size[q] += size[p];  }  } }   private static int countSearch(String s, String p) {  int n = s.length();  int m = p.length();  int[] b = backTable(p);  int j = 0;  int count = 0;  for (int i = 0; i < n; i++) {  if (j == m) {   j = b[j - 1];   count++;  }  while (j != 0 && s.charAt(i) != p.charAt(j)) {   j = b[j - 1];  }  if (s.charAt(i) == p.charAt(j)) {   j++;  }  }  if (j == m)  count++;  return count; }  private static int[] backTable(String p) {  int m = p.length();  int j = 0;  int[] b = new int[m];  for (int i = 1; i < m; i++) {  while (j != 0 && p.charAt(i) != p.charAt(j)) {   j = b[j - 1];  }  if (p.charAt(i) == p.charAt(j)) {   b[i] = ++j;  }  }  return b; }  private static class LCA {  private HashMap<Integer, ArrayList<Integer>> g;  private int[] level;  private int[] a;  private int[][] P;  private int n, m;  private int[] xor;  public LCA(HashMap<Integer, ArrayList<Integer>> g, int[] a) {  this.g = g;  this.a = a;  n = g.size();  m = (int) (Math.log(n) / Math.log(2)) + 5;  P = new int[n][m];  xor = new int[n];  level = new int[n];   preprocess();  }  private void preprocess() {  dfs(0, -1);   for (int j = 1; j < m; j++) {   for (int i = 0; i < n; i++) {   if (P[i][j - 1] != -1) {    P[i][j] = P[P[i][j - 1]][j - 1];   }   }  }  }  private void dfs(int u, int p) {  P[u][0] = p;  xor[u] = a[u] ^ (p == -1 ? 0 : xor[p]);  level[u] = (p == -1 ? 0 : level[p] + 1);   for (int v : g.get(u)) {   if (v == p)   continue;   dfs(v, u);  }  }  public int lca(int u, int v) {  if (level[v] > level[u]) {   int temp = v;   v = u;   u = temp;  }   for (int j = m; j >= 0; j--) {   if (level[u] - (1 << j) < level[v]) {   continue;   } else {   u = P[u][j];   }  }   if (u == v)   return u;   for (int j = m - 1; j >= 0; j--) {   if (P[u][j] == -1 || P[u][j] == P[v][j]) {   continue;   } else {   u = P[u][j];   v = P[v][j];   }  }   return P[u][0];  }  private int xor(int u, int v) {  int l = lca(u, v);   return xor[u] ^ xor[v] ^ a[l];  } }   private static InputReader in = new InputReader(System.in); private static PrintWriter out = new PrintWriter(System.out);  private static 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 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;  }  } }
1	public class A{       private BufferedReader in;   private StringTokenizer st;     void solve() throws IOException{       int n = nextInt();    int i = 0;    int[]nums = new int[n];    int numeven = 0;    int numodd = 0;    while(n-->0){     nums[i] = nextInt();     if(nums[i]%2==0) numeven++;     else numodd++;     i++;    }    for (int j = 0; j < nums.length; j++) {     if(numeven==1&&nums[j]%2==0){      System.out.println(j+1); break;     }     if(numodd==1&&nums[j]%2!=0){      System.out.println(j+1); break;     }    }          }       A() throws IOException {    in = new BufferedReader(new InputStreamReader(System.in));      eat("");    solve();      }   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 A();   }   int gcd(int a,int b){    if(b>a) return gcd(b,a);    if(b==0) return a;    return gcd(b,a%b);   } }
3	public class DivRound584ProblemA { static FastReader sc=new FastReader();  public static void main(String args[]) throws IOException {  int n = sc.nextInt();   int a[]=new int[n];   for(int i=0;i<n;i++)  a[i]=sc.nextInt();   Arrays.sort(a);  int c=0;  for(int i=0;i<n;i++) {  if(a[i]<0) continue;  c=c-1;  for(int j=i+1;j<n;j++) {   if(a[j]<0) continue;   if(a[j]%a[i]==0) {      a[j]=c;   }  }    }  System.out.println(Math.abs(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;   }  } }
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 ce = 0;  int co = 0;  int le = 0;  int lo = 0;  for (int i = 0; i < n; i++) {  int x = sc.nextInt();  if (x % 2 == 0) {   ce++;   le = i + 1;  } else {   co++;   lo = i + 1;  }  }  System.out.println(ce == 1 ? le : lo); } }
0	public class A {  private static StringTokenizer tokenizer;  private static BufferedReader bf;  private static PrintWriter out;   private static int nextInt() throws IOException {  return Integer.parseInt(nextToken());  }   @SuppressWarnings("unused") private static long nextLong() throws IOException {  return Long.parseLong(nextToken());  }   private static String nextToken() throws IOException {  while(tokenizer == null || !tokenizer.hasMoreTokens()) {   tokenizer = new StringTokenizer(bf.readLine());  }  return tokenizer.nextToken();  }   public static void main(String[] args) throws IOException {  bf = new BufferedReader(new InputStreamReader(System.in));  tokenizer = null;  out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  int n = nextInt();  if(n >= 0) out.println(n);  else {   n = -n;   int a = n % 10; int m = n/10;   int b = m % 10;   if(a >= b) {   if(m == 0) out.println(0);   else out.println(-m);   }   else {   m = (m-b)+a;   if(m == 0) out.println(0);   else out.println(-m);   }  }  out.close(); } }
4	public class D {  static Scanner sc;  static PrintWriter out;  public static void main(String[] args) throws Exception {   sc = new Scanner(System.in);   out = new PrintWriter(System.out);     for(int i=0; i<1; i++) {    solve();   }   out.flush();  }  static void solve() {   int n = sc.nextInt();   int m = sc.nextInt();   int k = sc.nextInt();   int[][] a = new int[n][m-1];   int[][] b = new int[n-1][m];   for(int i=0 ;i<n; i++) {    for(int j=0; j<m-1; j++) {     a[i][j] = sc.nextInt();    }   }   for(int i=0 ;i<n-1; i++) {    for(int j=0; j<m; j++) {     b[i][j] = sc.nextInt();    }   }   if(k % 2 == 1) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      if (j > 0)       out.print(" ");      out.print("-1");     }     out.println();    }    return;   }    int[][] prev = new int[n][m];   k /= 2;   for(int l=0; l<k; l++) {    int[][] next = new int[n][m];    for(int i=0; i<n; i++) {     for(int j=0; j<m; j++) {      next[i][j] = Integer.MAX_VALUE;      if(i>0) {       next[i][j] = Math.min(next[i][j], prev[i-1][j] + b[i-1][j]);      }      if(i+1<n) {       next[i][j] = Math.min(next[i][j], prev[i+1][j] + b[i][j]);      }      if(j>0) {       next[i][j] = Math.min(next[i][j], prev[i][j-1] + a[i][j-1]);      }      if(j+1<m) {       next[i][j] = Math.min(next[i][j], prev[i][j+1] + a[i][j]);      }     }    }    prev = next;   }   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     if (j > 0)      out.print(" ");     out.print(prev[i][j] * 2);    }    out.println();   }   }  }
1	public class Main { public static void main(String[] args) {  Scanner scn = new Scanner(System.in);   int t = scn.nextInt();  while(t-- >0){  String str = scn.next();  Pattern p = Pattern.compile("R[0-9]+C[0-9]+");  Matcher m = p.matcher(str);  if (m.matches()){   String nums[] = str.split("[RC]");   String first = nums[1];   String second = nums[2];     String ans = "";   long num = Integer.parseInt(second);   while(num >0){   if (num % 26 > 0){    ans += (char)(num%26+'A'-1);    num/=26;   } else {    ans += 'Z';    num/=26;    num--;   }   }   for (int i = ans.length()-1; i>=0;--i){   System.out.print(ans.charAt(i));   }     System.out.println(first);  } else {   String first = str.split("[0-9]+")[0];   String second = str.split("[A-Z]+")[1];   System.out.print("R"+second);     long num = 0, pow = 1;   for (int i = first.length()-1; i>=0; --i){   num += (long)(first.charAt(i)-'A'+1) * pow;   pow*=26;   }   System.out.println("C"+num);  }    } } }
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; } }
2	public class Code3 {  public static void main(String[] args) {  InputReader in = new InputReader(System.in);  PrintWriter pw = new PrintWriter(System.out);   long x = in.nextLong();  long k = in.nextLong();   if(x==0)  pw.println(0);  else  {  long mul = modularExponentiation(2L, k, mod);  x = (x%mod * 2L%mod)%mod;  x = (x%mod - 1L%mod + mod)%mod;  x = (x%mod * mul%mod)%mod;  x = (x%mod + 1%mod)%mod;   pw.print(x);  }  pw.flush();  pw.close(); }  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 static int[] suffle(int[] a,Random gen) {  int n = a.length;  for(int i=0;i<n;i++)  {  int ind = gen.nextInt(n-i)+i;  int 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); }  public static long GCD(long a,long b) {  if(b==0)  return a;  else  return GCD(b,a%b); }  public static void extendedEuclid(int A,int B) {  if(B==0)  {  d = A;  p = 1 ;  q = 0;  }  else  {  extendedEuclid(B, A%B);  int temp = p;  p = q;  q = temp - (A/B)*q;  } }  public static long LCM(long a,long b) {  return (a*b)/GCD(a,b); }  public static int LCM(int a,int b) {  return (a*b)/GCD(a,b); }  public static int binaryExponentiation(int x,int n) {  int result=1;  while(n>0)  {   if(n % 2 ==1)    result=result * x;   x=x*x;   n=n/2;  }  return result; }  public static long binaryExponentiation(long x,long n) {  long result=1;  while(n>0)  {   if(n % 2 ==1)    result=result * x;   x=x*x;   n=n/2;  }  return result; }  public static int modularExponentiation(int x,int n,int M) {  int result=1;  while(n>0)  {   if(n % 2 ==1)    result=(result * x)%M;   x=(x*x)%M;   n=n/2;  }  return result; }  public static long modularExponentiation(long x,long n,long M) {  long result=1;  while(n>0)  {   if(n % 2 ==1)    result=(result * x)%M;   x=(x*x)%M;   n=n/2;  }  return result; }  public static int modInverse(int A,int M) {  return modularExponentiation(A,M-2,M); }  public static long modInverse(long A,long M) {  return modularExponentiation(A,M-2,M); }  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 class pair implements Comparable<pair> {  Integer x, y;  pair(int x,int 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();  } } }
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();   }  } }
3	public class C_Round_455_Div2 {  static long[][]dp;  static long MOD =(long) 1e9 + 7;  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int n = in.nextInt();   char[]data = new char[n];   dp = new long[n][n];   for(long []a : dp){    Arrays.fill(a,-1);   }   for(int i = 0; i < n; i++){    data[i] = in.next().charAt(0);   }   out.println(cal(0, 0, data));   out.close();  }  static long cal(int index, int nested, char[]data ){     if(index + 1 == data.length){    return 1;   }   if(dp[index][nested] != -1){    return dp[index][nested];   }   long result = 0;   boolean isLoop = data[index] == 'f';   if(isLoop){    result = cal(index + 1, nested + 1, data);   }else{    result = cal(index + 1, nested, data);    if(nested > 0){     result += cal(index, nested - 1, data);     result %= MOD;    }   }     return dp[index][nested]= result;  } }
3	public class Main { public static void main(String[] args) throws Exception {  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  int n=Integer.parseInt(br.readLine());  String s=br.readLine();  String ss[]=s.split(" ");  int arr[]=new int[n];  for(int i=0;i<n;i++)  arr[i]=Integer.parseInt(ss[i]);  Arrays.sort(arr);  int coun=0,coun2=0;  for(int i=arr[0],k=0;k<n;)  {   for(int j=k;j<n;j++)   {    if(arr[j]%i==0)    {     arr[j]=-1;     coun2++;    }   }   Arrays.sort(arr);   k=coun2;   coun++;   if(coun2<n)   i=arr[coun2];   else   break;     }  System.out.println(coun); } }
5	public class R015A {  final double EPS = 1e-9;   boolean isEqual(double x, double y) {   return Math.abs(x-y) <= EPS * Math.max(Math.abs(x), Math.abs(y));  }  class Pair implements Comparable<Pair>{   double left;   double right;   Pair(double left, double right) {    this.left = left;    this.right = right;   }   public String toString() {    return "(" + left + "," + right + ")";   }   public int hashCode() {    return (int)(left * 17 + right * 31);   }   public boolean equals(Object o) {    if(!(o instanceof Pair)) return false;    Pair that = (Pair)o;    return isEqual(this.left, that.left) && isEqual(this.right, that.right);   }   public int compareTo(Pair that) {    if(this.left != that.left)     return (int)(this.left - that.left);    return (int)(this.right - that.right);   }  }  public R015A() {  }   private void process() {   Scanner scanner = new Scanner(System.in);   int n = scanner.nextInt();   int t = scanner.nextInt();   int[] x = new int[n];   int[] a = new int[n];   for(int i=0; i<n; i++) {    x[i] = scanner.nextInt();    a[i] = scanner.nextInt();   }   List<Pair> pairs = new ArrayList<Pair>();   for(int i=0; i<n; i++) {    double left = x[i] - a[i] / 2.0;    double right= x[i] + a[i] / 2.0;    pairs.add(new Pair(left, right));   }   Collections.sort(pairs);   Set<Pair> newPairs = new HashSet<Pair>();   newPairs.add(new Pair(pairs.get(0).left - t, pairs.get(0).left));   for(int i=0; i<pairs.size()-1; i++) {    if(pairs.get(i+1).left - pairs.get(i).right >= t) {     newPairs.add(new Pair(pairs.get(i).right, pairs.get(i).right + t));     newPairs.add(new Pair(pairs.get(i+1).left - t, pairs.get(i+1).left));    }   }   newPairs.add(new Pair(pairs.get(pairs.size()-1).right, pairs.get(pairs.size()-1).right + t));   System.out.println(newPairs.size());  }   public static void main(String[] args) {   new R015A().process();  } }
6	public class Main {  private int n; private int m; private boolean[][] g; private long[][] dp; private int[] count; private int[] first;  private void solve() throws IOException {  n = nextInt();  m = nextInt();  g = new boolean[n][n];  for (int i = 0; i < m; i++) {  int a = nextInt() - 1;  int b = nextInt() - 1;  g[a][b] = true;  g[b][a] = true;  }  count = new int[1 << n];  first = new int[1 << n];  dp = new long[1 << n][n];  for (int mask = 0; mask < (1 << n); mask++) {  count[mask] = bitCount(mask);  for (int i = 0; i < n; i++) {   if (bit(i, mask) == 1) {   first[mask] = i;   break;   }  }  }  for (int mask = 0; mask < (1 << n); mask++) {  for (int i = 0; i < n; i++) {   if ((count[mask] == 1) && (bit(i, mask) == 1)) {   dp[mask][i] = 1;   } else {   for (int j = 0; j < n; j++) {    if (g[j][i] && (count[mask] > 1) && (bit(i, mask) == 1)     && (first[mask] != i)) {    dp[mask][i] += dp[mask ^ (1 << i)][j];    }   }   }  }  }  long ans = 0;  for (int i = 0; i < n; i++) {  for (int mask = 0; mask < (1 << n); mask++) {   if ((count[mask] >= 3) && (first[mask] != i)    && (g[i][first[mask]])) {   ans += dp[mask][i];   }  }  }  if (ans % 2 != 0) {  throw new RuntimeException("SHIT!!!");  }  out.println(ans / 2); }  private final int bit(int i, int mask) {  return (mask & (1 << i)) != 0 ? 1 : 0; }  private final int bitCount(int mask) {  int ret = 0;  while (mask != 0) {  ret++;  mask -= mask & (-mask);  }  return ret; }  private BufferedReader in; private PrintWriter out; private StringTokenizer st;  private Main() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  eat("");  solve();  in.close();  out.close(); }  private 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()); }  public static void main(String[] args) throws IOException {  new Main(); } }
6	public class ElongatedMatrix {  private static int n;   private static int[][] minCost;   private static int[][] minCostEndpoints;    private static HashMap<Integer, Integer> costs = new HashMap<>();  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int[] params = Arrays.stream(br.readLine().split(" "))     .mapToInt(x -> Integer.parseInt(x)).toArray();   n = params[0];   int m = params[1];   int[][] matrix = new int[n][m];   for (int i = 0; i < n; i++) {    matrix[i] = Arrays.stream(br.readLine().split(" "))      .mapToInt(x -> Integer.parseInt(x)).toArray();   }   minCost = new int[n][n];   minCostEndpoints = new int[n][n];   for (int i = 0; i < n; i++) {    for (int j = 0; j < n; j++) {     if (i > j) {      minCost[i][j] = Integer.MAX_VALUE;      for (int k = 0; k < m; k++) {       int diff = Math.abs(matrix[i][k] - matrix[j][k]);       if (diff < minCost[i][j]) {        minCost[i][j] = diff;       }      }      minCost[j][i] = minCost[i][j];     }     minCostEndpoints[i][j] = Integer.MAX_VALUE;     for (int k = 0; k < m - 1; k++) {      int diff = Math.abs(matrix[i][k + 1] - matrix[j][k]);      if (diff < minCostEndpoints[i][j]) {       minCostEndpoints[i][j] = diff;      }     }    }   }   int maxCost = n == 1 ? minCostEndpoints[0][0] : 0;   for (int i = 0; i < n; i++) {    costs.clear();    for (int j = 0; j < n; j++) {     if (i != j) {      int bitmask = (1 << i) | (1 << j);      int state = bitmask + (j << 16);      costs.put(state, minCost[i][j]);     }    }    for (int j = 0; j < n; j++) {     if (i != j) {      if (minCostEndpoints[i][j] <= maxCost) {       continue;      } else {       int pathCost = Math.min(minCostEndpoints[i][j], findMaxCost(i, j, (1 << n) - 1));       maxCost = Math.max(maxCost, pathCost);      }     }    }   }   System.out.println(maxCost);   br.close();  }    private static int findMaxCost(int st, int end, int set) {   int state = set + (end << 16);   if (costs.containsKey(state)) {    return costs.get(state);   }   int maxCost = 0;   for (int i = 0; i < n; i++) {    if (i != st && i != end && (set & (1 << i)) != 0) {     int setWithoutEnd = set - (1 << end);     int pathCost = Math.min(findMaxCost(st, i, setWithoutEnd), minCost[i][end]);     maxCost = Math.max(pathCost, maxCost);    }   }   costs.put(state, maxCost);   return maxCost;  } }
3	public class Main {  static StringBuilder data = new StringBuilder();  final static FastReader in = new FastReader();   public static void main(String[] args) {   int n = in.nextInt();   int a[] = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }   Arrays.sort(a);   int answ = 0;   for (int i = 0; i < n; i++) {    if (a[i] != 0) {     for (int j = i + 1; j < n; j++) {      if (a[j] % a[i] == 0) {       a[j] = 0;      }     }     answ++;     a[i]=0;    }   }   System.out.println(answ);  }   static void fileOut(String s) {   File out = new File("output.txt");   try {    FileWriter fw = new FileWriter(out);    fw.write(s);    fw.flush();    fw.close();   } catch (IOException e) {    e.printStackTrace();   }  }  static class FastReader {   BufferedReader br;   StringTokenizer st;   public FastReader() {    br = new BufferedReader(new      InputStreamReader(System.in));   }   public FastReader(String path) {    try {     br = new BufferedReader(new       InputStreamReader(new FileInputStream(path)));    } catch (FileNotFoundException e) {     e.printStackTrace();    }   }   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());   }   float nextFloat() {    return Float.parseFloat(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 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));  } } }
6	public class cf1185g1_3 {  public static void main(String[] args) throws IOException {   int n = rni(), t = ni(), song[][] = new int[n][2];   for (int i = 0; i < n; ++i) {    song[i][0] = rni();    song[i][1] = ni() - 1;   }   int dp[][] = new int[1 << n][4], sum[] = new int[1 << n], ans = 0;   dp[0][3] = 1;   for (int i = 0; i < 1 << n; ++i) {    for (int j = 0; j < 4; ++j) {     for (int k = 0; k < n; ++k) {      if ((i & (1 << k)) == 0 && song[k][1] != j) {       dp[i | (1 << k)][song[k][1]] = madd(dp[i | (1 << k)][song[k][1]], dp[i][j]);       sum[i | (1 << k)] = sum[i] + song[k][0];      }     }    }   }   for (int i = 0; i < 1 << n; ++i) {    if (sum[i] == t) {     ans = madd(ans, dp[i][0], dp[i][1], dp[i][2]);    }   }   prln(ans);   close();  }  static int mmod = 1000000007;  static int madd(int a, int b) {   return (a + b) % mmod;  }  static int madd(int... a) {   int ans = a[0];   for (int i = 1; i < a.length; ++i) {    ans = madd(ans, a[i]);   }   return ans;  }  static int msub(int a, int b) {   return (a - b + mmod) % mmod;  }  static int mmul(int a, int b) {   return (int) ((long) a * b % mmod);  }  static int mmul(int... a) {   int ans = a[0];   for (int i = 1; i < a.length; ++i) {    ans = mmul(ans, a[i]);   }   return ans;  }  static int minv(int x) {     return (exgcd(x, mmod)[0] % mmod + mmod) % mmod;  }  static int mpow(int a, long b) {   if (a == 0) {    return 0;   }   int ans = 1;   while (b > 0) {    if ((b & 1) > 0) {     ans = mmul(ans, a);    }    a = mmul(a, a);    b >>= 1;   }   return ans;  }  static BufferedReader __i = new BufferedReader(new InputStreamReader(System.in));  static PrintWriter __o = new PrintWriter(new OutputStreamWriter(System.out));  static StringTokenizer input;  static Random __r = new Random();          static final int IBIG = 1000000007;  static final int IMAX = 2147483647;  static final long LMAX = 9223372036854775807L;   static int minof(int a, int b, int c) {return min(a, min(b, c));}  static int minof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); int min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static long minof(long a, long b, long c) {return min(a, min(b, c));}  static long minof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); long min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static int maxof(int a, int b, int c) {return max(a, max(b, c));}  static int maxof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); int max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static long maxof(long a, long b, long c) {return max(a, max(b, c));}  static long maxof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); long max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static int powi(int a, int b) {if (a == 0) return 0; int ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static long powl(long a, int b) {if (a == 0) return 0; long ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static int fli(double d) {return (int) d;}  static int cei(double d) {return (int) ceil(d);}  static long fll(double d) {return (long) d;}  static long cel(double d) {return (long) ceil(d);}  static int gcf(int a, int b) {return b == 0 ? a : gcf(b, a % b);}  static long gcf(long a, long b) {return b == 0 ? a : gcf(b, a % b);}  static int[] exgcd(int a, int b) {if (b == 0) return new int[] {1, 0}; int[] y = exgcd(b, a % b); return new int[] {y[1], y[0] - y[1] * (a / b)};}  static long[] exgcd(long a, long b) {if (b == 0) return new long[] {1, 0}; long[] y = exgcd(b, a % b); return new long[] {y[1], y[0] - y[1] * (a / b)};}  static int randInt(int min, int max) {return __r.nextInt(max - min + 1) + min;}  static long mix(long x) {x += 0x9e3779b97f4a7c15L; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9L; x = (x ^ (x >> 27)) * 0x94d049bb133111ebL; return x ^ (x >> 31);}   static void reverse(int[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {int swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(long[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {long swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(double[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {double swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(char[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {char swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void shuffle(int[] a) {int n = a.length - 1; for (int i = 0; i < n; ++i) {int ind = randInt(i, n); int swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}  static void shuffle(long[] a) {int n = a.length - 1; for (int i = 0; i < n; ++i) {int ind = randInt(i, n); long swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}  static void shuffle(double[] a) {int n = a.length - 1; for (int i = 0; i < n; ++i) {int ind = randInt(i, n); double swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}  static void rsort(int[] a) {shuffle(a); sort(a);}  static void rsort(long[] a) {shuffle(a); sort(a);}  static void rsort(double[] a) {shuffle(a); sort(a);}  static int[] copy(int[] a) {int[] ans = new int[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static long[] copy(long[] a) {long[] ans = new long[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static double[] copy(double[] a) {double[] ans = new double[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static char[] copy(char[] a) {char[] ans = new char[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}   static void r() throws IOException {input = new StringTokenizer(rline());}  static int ri() throws IOException {return Integer.parseInt(rline());}  static long rl() throws IOException {return Long.parseLong(rline());}  static double rd() throws IOException {return Double.parseDouble(rline());}  static int[] ria(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni(); return a;}  static int[] riam1(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni() - 1; return a;}  static long[] rla(int n) throws IOException {long[] a = new long[n]; r(); for (int i = 0; i < n; ++i) a[i] = nl(); return a;}  static double[] rda(int n) throws IOException {double[] a = new double[n]; r(); for (int i = 0; i < n; ++i) a[i] = nd(); return a;}  static char[] rcha() throws IOException {return rline().toCharArray();}  static String rline() throws IOException {return __i.readLine();}  static String n() {return input.nextToken();}  static int rni() throws IOException {r(); return ni();}  static int ni() {return Integer.parseInt(n());}  static long rnl() throws IOException {r(); return nl();}  static long nl() {return Long.parseLong(n());}  static double rnd() throws IOException {r(); return nd();}  static double nd() {return Double.parseDouble(n());}   static void pr(int i) {__o.print(i);}  static void prln(int i) {__o.println(i);}  static void pr(long l) {__o.print(l);}  static void prln(long l) {__o.println(l);}  static void pr(double d) {__o.print(d);}  static void prln(double d) {__o.println(d);}  static void pr(char c) {__o.print(c);}  static void prln(char c) {__o.println(c);}  static void pr(char[] s) {__o.print(new String(s));}  static void prln(char[] s) {__o.println(new String(s));}  static void pr(String s) {__o.print(s);}  static void prln(String s) {__o.println(s);}  static void pr(Object o) {__o.print(o);}  static void prln(Object o) {__o.println(o);}  static void prln() {__o.println();}  static void pryes() {prln("yes");}  static void pry() {prln("Yes");}  static void prY() {prln("YES");}  static void prno() {prln("no");}  static void prn() {prln("No");}  static void prN() {prln("NO");}  static boolean pryesno(boolean b) {prln(b ? "yes" : "no"); return b;};  static boolean pryn(boolean b) {prln(b ? "Yes" : "No"); return b;}  static boolean prYN(boolean b) {prln(b ? "YES" : "NO"); return b;}  static void prln(int... a) {for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i); if (a.length > 0) prln(a[a.length - 1]); else prln();}  static void prln(long... a) {for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i); if (a.length > 0) prln(a[a.length - 1]); else prln();}  static void prln(double... a) {for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i); if (a.length > 0) prln(a[a.length - 1]); else prln();}  static <T> void prln(Collection<T> c) {int n = c.size() - 1; Iterator<T> iter = c.iterator(); for (int i = 0; i < n; pr(iter.next()), pr(' '), ++i); if (n >= 0) prln(iter.next()); else prln();}  static void h() {prln("hlfd"); flush();}  static void flush() {__o.flush();}  static void close() {__o.close();} }
5	public class Prob015A {  public static void main( String[] Args )  {   Scanner scan = new Scanner( System.in );   int numHouses = scan.nextInt();   int side = scan.nextInt() * 2;   ArrayList<Integer> sides = new ArrayList<Integer>();   for ( int x = 0; x < numHouses; x++ )   {    int c = scan.nextInt() * 2;    int s = scan.nextInt();    int l = c - s;    int r = c + s;    int li = Collections.binarySearch( sides, l );    int ri = Collections.binarySearch( sides, r );    if ( li >= 0 && ri >= 0 )    {     sides.remove( li );     sides.remove( li );    }    else if ( li >= 0 )     sides.set( li, r );    else if ( ri >= 0 )     sides.set( ri, l );    else    {     sides.add( -li - 1, r );     sides.add( -li - 1, l );    }   }   int possibilities = 2;   for ( int x = 1; x < sides.size() - 1; x += 2 )    if ( sides.get( x + 1 ) - sides.get( x ) > side )     possibilities += 2;    else if ( sides.get( x + 1 ) - sides.get( x ) == side )     possibilities += 1;   System.out.println( possibilities );  } }
1	public class A { private Scanner in; private PrintWriter out; private String INPUT = "";  public void solve() {  int n = ni();  int[] u = new int[n];  int fe = -1, fo = -1;  int ne = -1, no = -1;  for(int i = 0;i < n;i++){  u[i] = ni();  if(u[i] % 2 == 0){   if(fe == -1){   fe = i + 1;   }else{   ne = i + 1;   }  }else{   if(fo == -1){   fo = i + 1;   }else{   no = i + 1;   }  }  }  if(ne > 0){  out.println(fo);  }else{  out.println(fe);  } }  public void run() throws Exception {  in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);  out = new PrintWriter(System.out);   solve();  out.flush(); }   public static void main(String[] args) throws Exception {  new A().run(); }  private int ni() { return Integer.parseInt(in.next()); } private static void tr(Object... o) { System.out.println(o.length == 1 ? o[0] : Arrays.toString(o)); } }
1	public class A { public static void main(String[] args) {  Locale.setDefault(Locale.US);  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  String[] number = new String[n];  sc.nextLine();  String l = sc.nextLine();  number = l.split(" ");  int oe = 1;  if((Integer.valueOf(number[0])%2 +   Integer.valueOf(number[1])%2 +   Integer.valueOf(number[2])%2) > 1) {  oe = 0;  }  for(int i=0;i<n;i++) {  if((Integer.valueOf(number[i])%2)==oe) {   System.out.println(i+1);   break;  }  } } }
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);   DExplorerSpace solver = new DExplorerSpace();   solver.solve(1, in, out);   out.close();  }  static class DExplorerSpace {   static final int oo = 1000000000;   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt(), m = in.nextInt(), k = in.nextInt();    int[][] right = new int[n][m - 1];    int[][] down = new int[n - 1][m];    for (int i = 0; i < n; i++) right[i] = in.readIntArray(m - 1);    for (int i = 0; i + 1 < n; i++) down[i] = in.readIntArray(m);    if (k % 2 == 1) {     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) out.print(-1 + " ");      out.println();     }     return;    }    int[][][] dp = new int[k / 2 + 1][n][m];    for (int r = 1; 2 * r <= k; r++) {     for (int i = 0; i < n; i++) Arrays.fill(dp[r][i], oo);     for (int i = 0; i < n; i++)      for (int j = 0; j < m - 1; j++) {       int cost = right[i][j];       dp[r][i][j] = Integer.min(dp[r][i][j], dp[r - 1][i][j + 1] + cost);       dp[r][i][j + 1] = Integer.min(dp[r][i][j + 1], dp[r - 1][i][j] + cost);      }     for (int i = 0; i + 1 < n; i++)      for (int j = 0; j < m; j++) {       int cost = down[i][j];       dp[r][i][j] = Integer.min(dp[r][i][j], dp[r - 1][i + 1][j] + cost);       dp[r][i + 1][j] = Integer.min(dp[r][i + 1][j], dp[r - 1][i][j] + cost);      }    }    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      out.print(2 * dp[k / 2][i][j] + " ");     }     out.println();    }   }  }  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) {    for (int i = 0; i < objects.length; i++) {     if (i != 0) {      writer.print(' ');     }     writer.print(objects[i]);    }    writer.print('\n');   }   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[] readIntArray(int size) {    int[] array = new int[size];    for (int i = 0; i < size; i++) {     array[i] = readInt();    }    return array;   }   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 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);   }  } }
6	public class Main {  static int inf = (int) 1e9 + 7;  static int n, m, a[][];  static ArrayList<Integer> used;  static int num[];  static int ans;  static void rec(int id) {   if (id == used.size()) {    check();    return;   }   for(int i = 0;i < n;i++) {    num[id] = i;    rec(id + 1);   }  }  static void check() {   int new_ans = 0;   for(int i = 0;i < n;i++) {    int max = 0;    for(int j = 0;j < used.size();j++) {     max = Math.max(max, a[(i + num[j]) % n][used.get(j)]);    }    new_ans += max;   }   ans = Math.max(ans, new_ans);  }  public static void main(String[] args) throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));   pw = new PrintWriter(System.out);   int test = nextInt();   while(test-- > 0) {    n = nextInt();    m = nextInt();    a = new int [n][m];    for(int i = 0;i < n;i++) {     for(int j = 0;j < m;j++) a[i][j] = nextInt();    }    used = new ArrayList<>();    num = new int [n * m];    ans = 0;    pair b[] = new pair[n * m];    for(int i = 0;i < n;i++) {     for(int j = 0;j < m;j++) {      b[i * m + j] = new pair(a[i][j], j);     }    }    Arrays.sort(b, new pair());    for(int i = b.length - 1;i >= Math.max(0, b.length - 5);i--) {     int v = b[i].y;     boolean bad = false;     for(int j = 0;j < used.size();j++) if (used.get(j) == v) bad = true;     if (!bad) used.add(v);    }    rec(0);    pw.println(ans);   }   pw.close();  }  static BufferedReader br;  static StringTokenizer st = new StringTokenizer("");  static PrintWriter pw;  static String next() throws IOException {   while (!st.hasMoreTokens()) st = new StringTokenizer(br.readLine());   return st.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt(next());  }  static long nextLong() throws IOException {   return Long.parseLong(next());  } } class pair implements Comparator<pair>{  int x, y;  pair(int x, int y) {   this.x = x;   this.y = y;  }  pair() {}  @Override  public int compare(pair o1, pair o2) {   return Integer.compare(o1.x, o2.x);  } }
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());   }  } }
0	public class CF {  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);   int n = in.nextInt();   if (n >= 0) {    out.println(n);   } else {    int res = n;    n = Math.abs(n);    String s = String.valueOf(Math.abs(n));    if (s.length() == 1) {     res = 0;    } else {     res = Math.max(-Integer.parseInt(s.substring(0, s.length() - 1)), res);     res = Math.max(-Integer.parseInt(s.substring(0, s.length() - 2) + s.charAt(s.length() - 1)), res);    }    out.println(res);   }   out.close();  } } class InputReader {  public BufferedReader reader;  public 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());  } }
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 = new int[n];   for (int i = 0; i < n; i++) {    a[i] = reader.nextString().charAt(0);   }   long[][] d = new long[n + 1][n + 1];   d[0][0] = 1;   long mod = 1_000_000_007;   for (int i = 1; i < n; i++) {    for (int j = n - 1; j >= 0; j--) {     if (a[i - 1] == 'f') {      d[i][j + 1] = d[i - 1][j];     } else {      d[i][j] = (d[i - 1][j] + d[i][j + 1]) % mod;     }    }   }   long ans = 0;   for (int i = 0; i <= n; i++) {    ans += d[n - 1][i];   }   writer.print(ans % mod);  }  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();   }  } }
4	public class Main {  public static InputStream IN;  public static OutputStream OUT;  public static PrintWriter out;  public static BufferedReader in;   public static StringTokenizer st = null;  public static int ni() throws Exception {   for (;st == null || !st.hasMoreTokens();){    st = new StringTokenizer(in.readLine());   }   return Integer.parseInt(st.nextToken());  }  public static void main(String[] args) throws Exception {   IN = new FileInputStream("input.txt");   OUT = new FileOutputStream("output.txt");   out = new PrintWriter(OUT);   in = new BufferedReader(new InputStreamReader(IN));   int n = ni();   int m = ni();   int k = ni();   int[] x = new int[k];   int[] y = new int[k];   for (int i = 0 ; i < k; i++){    x[i] = ni() - 1;    y[i] = ni() - 1;   }   int w = Integer.MIN_VALUE;   int aa = -1;   int ab = -1;   for (int i = 0 ; i < n ; i++){    for (int j = 0; j < m; j++){     int min = Integer.MAX_VALUE;     for (int q = 0; q < k; q++){      int cur = Math.abs(i - x[q]) + Math.abs(j - y[q]);      min = Math.min(cur, min);     }     if (min > w){      w = min;      aa = i;      ab = j;     }    }   }   out.println((aa + 1) + " " + (ab + 1));     out.flush();  } }
4	public class A {  static int[] dx = {-1, 0, 1, 0};  static int[] dy = {0, 1, 0, -1};  public static void main(String[] args) throws Exception {   Scanner sc = new Scanner("input.txt");   PrintWriter out = new PrintWriter("output.txt");   int n = sc.nextInt(), m = sc.nextInt(), k = sc.nextInt();   int[][] dist = new int[n][m];   for(int[] a : dist) Arrays.fill(a, -1);   Queue<Point> q = new LinkedList<>();   for(int i = 0; i < k; i++)   {    int x = sc.nextInt() - 1, y = sc.nextInt() - 1;    dist[x][y] = 0;    q.add(new Point(x, y));   }   int ansX = -1, ansY = -1;   while(!q.isEmpty())   {    Point cur = q.remove();    ansX = cur.x; ansY = cur.y;    for(int i = 0; i < 4; i++)    {     int x = cur.x + dx[i], y = cur.y + dy[i];     if(x != -1 && y != -1 && x != n && y != m && dist[x][y] == -1)     {      q.add(new Point(x, y));      dist[x][y] = dist[cur.x][cur.y] + 1;     }    }   }   out.println((ansX + 1) + " " + (ansY + 1));   out.flush();   out.close();  }  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(4000);}  } }
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 Main {  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 static void main(String[] args) {   FastScanner sc = new FastScanner();   PrintWriter pw = new PrintWriter(System.out);   int n = sc.nextInt();   int best = 1;   int bestTime = Integer.MAX_VALUE;   for(int i=0;i<n;i++) {    int time;    int a = sc.nextInt();    time = (a%n==0 || a%n<=i) ? a/n : (a+n)/n;    if(time < bestTime) {     best = i + 1;     bestTime = time;    }   }   pw.println(best);   pw.close();  } }
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();}  } }
5	public class D {  public static void main(String[] args) throws FileNotFoundException {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[] a = new int[n];   int[] p = new int[n];   for (int i = 0; i < a.length; i++)    a[i] = p[i] = in.nextInt();   Arrays.sort(a);   int sum = 0;   int t = 0;   for (int i = 0; i < a.length; i++)    t += a[i];   int cnt = 0;   for (int i = a.length - 1; i >= 0; i--) {    cnt++;    sum += a[i];    if (t - sum < sum)     break;   }   System.out.println(cnt);  } }
5	public class A { 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 t = Integer.parseInt(st.nextToken());  State[] s = new State[n];  for(int i = 0; i < n; i++) {  st = new StringTokenizer(br.readLine());  s[i] = new State(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));  }  Arrays.sort(s);  int num = 2;  for(int i = 1; i < s.length; i++) {  int dist = s[i].x - s[i-1].x;  dist *= 2;  int size = s[i].d + s[i-1].d;  size += 2 * t;  if(dist == size)   num++;  else if(dist > size)   num += 2;  }  System.out.println(num); } static class State implements Comparable<State> {  public int x,d;  public State(int a, int b) {  x=a;  d=b;  }  public int compareTo(State s) {  return x - s.x;  } } }
4	public class Main {  public static void main(String []args)throws Exception  {   String inp="";   String res="";   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   inp=br.readLine();   for(int i=0;i<inp.length();i++)   {    for(int j=0;j<(inp.length()-i);j++)    {     for(int k=j+1;k<=inp.length()-i;k++)     {      if(inp.substring(j,j+i).equals(inp.substring(k,k+i)))       res =inp.substring(j,j+i);     }    }   }   System.out.println(res.length());   } }
4	public class Main{  public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));  static long MOD = (long) (1e9 + 7);   static long MOD2 = MOD * MOD;  static FastReader sc = new FastReader();  static int pInf = Integer.MAX_VALUE;  static int nInf = Integer.MIN_VALUE;  static long ded = (long)(1e17)+9;  public static void main(String[] args) throws Exception {   int test = 1;   for (int i = 1; i <= test; i++){    solve();   }   out.flush();   out.close();  }  static int n,m;  static int[][] hor,ver;  static Long[][][] dp;  static void solve(){   n = sc.nextInt();   m = sc.nextInt();   int k = sc.nextInt();   dp = new Long[n+1][m+1][k+1];   hor = new int[n][m-1];   ver = new int[n-1][m];   for(int i = 0; i < n; i++){    for(int j = 0; j < m-1; j++){     hor[i][j] = sc.nextInt();    }   }   for(int i = 0; i < n-1; i++){    for(int j = 0; j < m; j++){     ver[i][j] = sc.nextInt();    }   }   if(k%2==1){    for(int i = 0; i < n; i++){     for(int j = 0; j < m; j++){      out.print(-1+" ");     }     out.println();    }    return;   }   k = k/2;   for(int i = 0; i < n; i++){    for(int j = 0; j < m; j++){     long ans = cal(i,j,k);     out.print((2*ans)+" ");    }    out.println();   }  }  static long cal(int i, int j,int k){   if(k==0)return 0;   if(dp[i][j][k]!=null)return dp[i][j][k];   long ans = ded;   for(int h = 0; h < 4; h++){    int ni = i+di[h];    int nj = j+dj[h];    if(e(ni,nj)){     int cost = 0;     if(ni==i){      if(nj>j){       cost = hor[i][j];      }else{       cost = hor[i][nj];      }     }if(nj==j){      if(ni>i){       cost = ver[i][j];      }else{       cost = ver[ni][j];      }     }     ans = Math.min(ans,(cost)+cal(ni,nj,k-1));    }   }   return dp[i][j][k] = ans;  }  static int[] di = new int[]{0,-1,0,1};  static int[] dj = new int[]{-1,0,1,0};  static boolean e(int i, int j){   return i>=0&&j>=0&&i<n&&j<m;  }  static class Pair implements Comparable<Pair> {   int x;   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;   }   @Override   public String toString() {    return "Pair{" + "x=" + x + ", y=" + y + '}';   }   public boolean equals(Pair o){    return this.x==o.x&&this.y==o.y;   }  }  public static long mul(long a, long b) {   return ((a % MOD) * (b % MOD)) % MOD;  }  public static long add(long a, long b) {   return ((a % MOD) + (b % MOD)) % MOD;  }  public static long c2(long n) {   if ((n & 1) == 0) {    return mul(n / 2, n - 1);   } else {    return mul(n, (n - 1) / 2);   }  }   static final Random random = new Random();  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 long countSetBits(long n) {   if (n == 0) return 0;   return 1 + countSetBits(n & (n - 1));  }   static long gcd(long A, long B) {   if (B == 0) return A;   return gcd(B, A % B);  }   static long fastExpo(long x, long n) {   if (n == 0) return 1;   if ((n & 1) == 0) return fastExpo((x * x) % MOD, n / 2) % MOD;   return ((x % MOD) * fastExpo((x * x) % MOD, (n - 1) / 2)) % MOD;  }   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 <= Math.sqrt(n); i += 6)    if (n % i == 0 || n % (i + 2) == 0) return false;   return true;  }  public static long modinv(long x) {   return modpow(x, MOD - 2);  }  public static long modpow(long a, long b) {   if (b == 0) {    return 1;   }   long x = modpow(a, b / 2);   x = (x * x) % MOD;   if (b % 2 == 1) {    return (x * a) % MOD;   }   return x;  }   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;   }  } }
1	public class GenerateLogin {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  String a = scan.next();  String b = scan.next();  char last = b.charAt(0);  String ans = ""+a.charAt(0);  for(int i = 1;i<a.length();i++){  if(a.charAt(i)>=last)break;  ans+=a.charAt(i);  }  ans+=last;  System.out.println(ans); } }
1	public class A {   public static void main(String[] args) throws NumberFormatException, IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  int nums = Integer.parseInt(reader.readLine());   String line = reader.readLine();  int[] ar = new int[nums];  String[] par = line.split(" ");   for(int i=0; i<nums; i++){  ar[i] = Integer.parseInt(par[i]);  }  A a = new A();   System.out.print(a.getDif(ar)); }  private int getDif(int[] input){  int odd = 0, even = 0, d = 0;  int p = 0, q = 0;   for(int i=0; i<input.length; i++){  int t = input[i]%2;  if(t==0){   even++;   p = i+1;  }  else{   odd++;   q = i+1;  }     if(odd>0 && even>0 && (odd!=even)){   if(even>odd)   return q;   else   return p;  }    }   return d; } }
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); } }
6	public class CF1185G2 { static final int MD = 1000000007; static int[][] solve1(int[] aa, int t, int n) {  int[][] da = new int[t + 1][n + 1];  da[0][0] = 1;  for (int i = 0; i < n; i++) {  int a = aa[i];  for (int s = t - 1; s >= 0; s--)   for (int m = 0; m < n; m++) {   int x = da[s][m];   if (x != 0) {    int s_ = s + a;    if (s_ <= t)    da[s_][m + 1] = (da[s_][m + 1] + x) % MD;   }   }  }  return da; } static int[][][] solve2(int[] aa, int[] bb, int t, int na, int nb) {  int[][] da = solve1(aa, t, na);  int[][][] dab = new int[t + 1][na + 1][nb + 1];  for (int s = 0; s <= t; s++)  for (int ma = 0; ma <= na; ma++)   dab[s][ma][0] = da[s][ma];  for (int i = 0; i < nb; i++) {  int b = bb[i];  for (int s = t - 1; s >= 0; s--)   for (int ma = 0; ma <= na; ma++)   for (int mb = 0; mb < nb; mb++) {    int x = dab[s][ma][mb];    if (x != 0) {    int s_ = s + b;    if (s_ <= t)     dab[s_][ma][mb + 1] = (dab[s_][ma][mb + 1] + x) % MD;    }   }  }  return dab; } static long power(int a, int k) {  if (k == 0)  return 1;  long p = power(a, k / 2);  p = p * p % MD;  if (k % 2 == 1)  p = p * a % MD;  return p; } static int[] ff, gg; static int ch(int n, int k) {  return (int) ((long) ff[n] * gg[n - k] % MD * gg[k] % MD); } static int[][][] init(int n, int na, int nb, int nc) {  ff = new int[n + 1];  gg = new int[n + 1];  for (int i = 0, f = 1; i <= n; i++) {  ff[i] = f;  gg[i] = (int) power(f, MD - 2);  f = (int) ((long) f * (i + 1) % MD);  }  int[][][] dp = new int[na + 1][nb + 1][nc + 1];  for (int ma = 0; ma <= na; ma++)  for (int mb = 0; mb <= nb; mb++)   for (int mc = 0; mc <= nc; mc++) {   int x = (int) ((long) ff[ma + mb + mc] * gg[ma] % MD * gg[mb] % MD * gg[mc] % MD);   for (int ma_ = ma == 0 ? 0 : 1; ma_ <= ma; ma_++) {    int cha = ma == 0 ? 1 : ch(ma - 1, ma_ - 1);    for (int mb_ = mb == 0 ? 0 : 1; mb_ <= mb; mb_++) {    int chb = mb == 0 ? 1 : ch(mb - 1, mb_ - 1);    for (int mc_ = mc == 0 ? 0 : 1; mc_ <= mc; mc_++) {     int chc = mc == 0 ? 1 : ch(mc - 1, mc_ - 1);     int y = dp[ma_][mb_][mc_];     if (y == 0)     continue;     x = (int) ((x - (long) y * cha % MD * chb % MD * chc) % MD);    }    }   }   if (x < 0)    x += MD;   dp[ma][mb][mc] = x;   }  for (int ma = 0; ma <= na; ma++)  for (int mb = 0; mb <= nb; mb++)   for (int mc = 0; mc <= nc; mc++)   dp[ma][mb][mc] = (int) ((long) dp[ma][mb][mc] * ff[ma] % MD * ff[mb] % MD * ff[mc] % MD);  return dp; } 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 t = Integer.parseInt(st.nextToken());  int[] aa = new int[n];  int[] bb = new int[n];  int[] cc = new int[n];  int na = 0, nb = 0, nc = 0;  for (int i = 0; i < n; i++) {  st = new StringTokenizer(br.readLine());  int a = Integer.parseInt(st.nextToken());  int g = Integer.parseInt(st.nextToken());  if (g == 1)   aa[na++] = a;  else if (g == 2)   bb[nb++] = a;  else   cc[nc++] = a;  }  int[][][] dp = init(n, na, nb, nc);  int[][][] dab = solve2(aa, bb, t, na, nb);  int[][] dc = solve1(cc, t, nc);  int ans = 0;  for (int tab = 0; tab <= t; tab++) {  int tc = t - tab;  for (int ma = 0; ma <= na; ma++)   for (int mb = 0; mb <= nb; mb++) {   int xab = dab[tab][ma][mb];   if (xab == 0)    continue;   for (int mc = 0; mc <= nc; mc++) {    int xc = dc[tc][mc];    if (xc == 0)    continue;    ans = (int) ((ans + (long) xab * xc % MD * dp[ma][mb][mc]) % MD);   }   }  }  System.out.println(ans); } }
0	public class C344C {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  long a = sc.nextLong();  long b = sc.nextLong();  long count = a / b, c;  a = a % b;  while(true){  if (a <= 1 || b <= 1) break;  c = b - a;  b = a;  a = c;  count++;  if (a > b) count += a / b;  a = a % b;  }  if (b > 1) count += b;  System.out.println(count);  sc.close(); } }
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;  } }
1	public class CFA {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  private static final long MOD = 1000L * 1000L * 1000L + 7;  private static final int[] dx = {0, -1, 0, 1};  private static final int[] dy = {1, 0, -1, 0};  private static final String yes = "Yes";  private static final String no = "No";  void solve() throws IOException {   int n = nextInt();   long d = nextInt();   long[] arr = nextLongArr(n);   Set<Long> res = new HashSet<>();   for (long cur : arr) {    if (findMin(cur - d, arr) == d) {     res.add(cur - d);    }    if (findMin(cur + d, arr) == d) {     res.add(cur + d);    }   }   outln(res.size());  }  long findMin(long cur, long[] arr) {   long res = Long.MAX_VALUE;   for (long v : arr) {    res = Math.min(res, Math.abs(v - cur));   }   return res;  }  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);  }  private void formatPrint(double val) {   outln(String.format("%.9f%n", val));  }  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());  } }
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()); }  }
0	public class Main{  void solve(){   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int n1 = n/10;   int n2 = n/100*10 + n%10;   int ans = n;   ans = Math.max(ans, n1);   ans = Math.max(ans, n2);   System.out.println(ans);  }  public static void main(String[] args){   new Main().solve();  } }
1	public class B {  public static String toB(String str){   String row,col;   int i=0;   while(i<str.length() && str.charAt(i)<='Z'&&str.charAt(i)>='A')i++;   col = str.substring(0,i);   row = str.substring(i,str.length());   StringBuffer sb = new StringBuffer(col);   col = sb.reverse().toString();   int accum = 0;   for(i=0;i<col.length();i++){    int val = getValue(col.charAt(i));    accum+=val*Math.pow(26, i);    }   return "R"+row+"C"+accum;    }  public static String toA(String str){   int i = str.indexOf('C');   String row,col,ans="";   row = str.substring(1,i);   col = str.substring(i+1,str.length());   int colVal = Integer.parseInt(col),mod;   while(colVal>0){    mod = colVal%26;    if(mod==0){     ans+='Z';     colVal--;    }    else{     ans+=getLetter(mod);    }    colVal/=26;   }   StringBuffer sb = new StringBuffer(ans);   ans = sb.reverse().toString();   return ans+row;  }  public static int getValue(char c){   return c-'A'+1;  }  public static char getLetter(int n){   return (char)(n+'A'-1);  }  public static void main(String[] args)throws Exception{   Scanner in = new Scanner(System.in);   int cases = in.nextInt();   for(int i = 0;i<cases;i++){    String str = in.next();    if(str.charAt(0)=='R' && str.charAt(1)>='0'&&str.charAt(1)<='9' && str.indexOf('C')!=-1){     System.out.println(toA(str));    }    else System.out.println(toB(str));   }    } }
0	public class CF125A {  private void work() throws IOException {  Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(   System.in)));  int n = sc.nextInt();  System.out.printf("%d %d %d\n", 0, 0, n);  System.out.close(); }  public static void main(String[] args) throws IOException {  new CF125A().work(); } }
3	public class Main { static final long MOD = 998244353;  static boolean[] visited;  public static void main(String[] args) throws IOException {   FastScanner sc = new FastScanner();   int N = sc.nextInt();   int[] nums = new int[N];   for (int i = 0; i < N; i++) {   nums[i] = sc.nextInt();   }   Arrays.sort(nums);   boolean[] hit = new boolean[N];   int colors = 0;   int index = 0;   while (index < N) {   if (hit[index] == false) {    colors++;    int div = nums[index];    for (int i = index; i < N; i++) {    if (nums[i] % div == 0) {     hit[i] = true;    }    }   }   index++;   }   System.out.println(colors);  }   public static int[][] sort(int[][] array) {    Random rgen = new Random();  for (int i = 0; i< array.length; i++) {   int randomPosition = rgen.nextInt(array.length);   int[] temp = array[i];   array[i] = array[randomPosition];   array[randomPosition] = temp;  }  Arrays.sort(array, new Comparator<int[]>() {   @Override   public int compare(int[] arr1, int[] arr2) {      if (arr1[0] != arr2[0])    return arr1[0]-arr2[0];   else    return arr2[1]-arr1[1];   }  });  return array; }   static class FastScanner {   BufferedReader br;   StringTokenizer st;    public FastScanner() {    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;   }  } } class Node { public HashSet<Node> children; public int n;  public Node(int n) {  this.n = n;  children = new HashSet<Node>(); }  public void addChild(Node node) {  children.add(node); }  public void removeChild(Node node) {  children.remove(node); }   @Override public int hashCode() {  return n; }  @Override public boolean equals(Object obj) {  if (! (obj instanceof Node)) {  return false;  } else {  Node node = (Node) obj;  return (n == node.n);  } }  public String toString() {  return (this.n+1)+""; } }
3	public class Main {  public static void main(String[] args) throws NumberFormatException, IOException  {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   Task solver = new Task();   int tc = in.nextInt();   for(int i = 0; i < tc; i++)    solver.solve(i, in, out);   out.close();  }  static class Task {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int k = in.nextInt();    int[] s = getArray(in.nextToken());    int[] a = getArray(in.nextToken());    int[] b = getArray(in.nextToken());    int[] per = new int[k];    boolean[] used = new boolean[k];    Arrays.fill(per , -1);    if(!check(s , a, per.clone(), k, used)){     out.println("NO");     return;    }    for(int i = 0; i < s.length; i++){     if(per[s[i]] != -1){      continue;     }     for(int j = 0; j < k; j++){      if(used[j]){       continue;      }      per[s[i]] = j;      used[j] = true;      if(check(s , a , per.clone() , k, used)){       break;      }      per[s[i]] = -1;      used[j] = false;     }    }    for(int i = 0; i < s.length; i++){     if(per[s[i]] == -1){      out.println("NO");      return;     }     s[i] = per[s[i]];    }    if(cmp(s , b) > 0){     out.println("NO");     return;    }     int last = 0;    for(int i = 0; i < k; i++){     if(per[i] == -1) {      while(used[last])last++;      per[i] = last;      used[last] = true;     }    }    char[] result = new char[k];    for(int i = 0; i < k; i++){     result[i] = (char)('a' + per[i]);    }    out.println("YES");    out.println(new String(result));   }   private int cmp(int[] a, int[] b){    for(int i = 0; i < a.length; i++){     if(a[i] != b[i]){      return a[i] < b[i] ? -1 : 1;     }    }    return 0;   }    private boolean check(int[] s, int[] a, int[] per, int k, boolean[] used) {    int res[] = new int[s.length];    int last = k - 1;    for(int i = 0; i < res.length; ++i){     if(per[s[i]] == -1){      while(last >= 0 && used[last]){       last--;      }      if(last < 0){       return false;      }      per[s[i]] = last;      last--;     }     res[i] = per[s[i]];    }    return cmp(a , res) <= 0;   }   private int[] getArray(String nextToken) {    int result[] = new int[nextToken.length()];    for(int i = 0; i < nextToken.length(); i++){     result[i] = nextToken.charAt(i) - 'a';    }    return result;   }  }  static class InputReader {   BufferedReader in;   StringTokenizer tok;   public InputReader(InputStream stream){    in = new BufferedReader(new InputStreamReader(stream), 32768);    tok = null;   }   String nextToken()   {    String line = "";    while(tok == null || !tok.hasMoreTokens()) {     try {      if((line = in.readLine()) != null)       tok = new StringTokenizer(line);      else       return null;     } catch (IOException e) {      e.printStackTrace();      return null;     }    }    return tok.nextToken();   }   int nextInt(){    return Integer.parseInt(nextToken());   }   long nextLong() {    return Long.parseLong(nextToken());   }   double nextDouble() {    return Double.parseDouble(nextToken());   }  } }
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) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   OutputWriter out = new OutputWriter(outputStream);   APaintTheNumbers solver = new APaintTheNumbers();   solver.solve(1, in, out);   out.close();  }  static class APaintTheNumbers {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.i();    int[] a = in.ia(n);    RadixSort.radixSort(a);    boolean[] flag = new boolean[n];    int count = 0;    for (int i = 0; i < n; i++) {     if (!flag[i]) {      ++count;      flag[i] = true;      for (int j = 0; j < n; j++) {       if (!flag[j] && a[j] % a[i] == 0) {        flag[j] = true;       }      }     }    }    out.printLine(count);   }  }  static class RadixSort {   public static int[] radixSort(int[] f) {    return radixSort(f, f.length);   }   public static int[] radixSort(int[] f, int n) {       int[] to = new int[n];    {     int[] b = new int[65537];     for (int i = 0; i < n; i++) b[1 + (int) (f[i] & 0xffff)]++;     for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];     for (int i = 0; i < n; i++) to[b[(int) (f[i] & 0xffff)]++] = f[i];     int[] d = f;     f = to;     to = d;    }    {     int[] b = new int[65537];     for (int i = 0; i < n; i++) b[1 + (int) (f[i] >>> 16 & 0xffff)]++;     for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];     for (int i = 0; i < n; i++) to[b[(int) (f[i] >>> 16 & 0xffff)]++] = f[i];     int[] d = f;     f = to;     to = d;    }    return f;   }  }  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 close() {    writer.close();   }   public void printLine(int i) {    writer.println(i);   }  }  static class InputReader {   private InputStream is;   private byte[] inbuf = new byte[1024];   private int lenbuf = 0;   private int ptrbuf = 0;   public InputReader(InputStream is) {    this.is = is;   }   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++];   }   public int[] ia(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++) a[i] = i();    return a;   }   public 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();    }   }  } }
4	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) {    final int[] dr = {-1, 0, 1, 0};    final int[] dc = {0, -1, 0, 1};    int height = in.nextInt();    int width = in.nextInt();    int k = in.nextInt();    int[][][] cost = new int[4][height][width];    for (int r = 0; r < height; r++) {     for (int c = 0; c + 1 < width; c++) {      int x = in.nextInt();      cost[3][r][c] = x;      cost[1][r][c + 1] = x;     }    }    for (int r = 0; r + 1 < height; r++) {     for (int c = 0; c < width; c++) {      int x = in.nextInt();      cost[2][r][c] = x;      cost[0][r + 1][c] = x;     }    }    boolean odd = (k % 2 != 0);    k /= 2;    int[][][] d = new int[k + 1][height][width];    for (int len = 1; len <= k; len++) {     for (int r = 0; r < height; r++) {      for (int c = 0; c < width; c++) {       d[len][r][c] = Integer.MAX_VALUE;       for (int dir = 0; dir < 4; dir++) {        int nr = r + dr[dir];        int nc = c + dc[dir];        if (nr < 0 || nr >= height || nc < 0 || nc >= width) {         continue;        }        d[len][r][c] = Math.min(d[len][r][c], d[len - 1][nr][nc] + cost[dir][r][c]);       }      }     }    }    for (int r = 0; r < height; r++) {     for (int c = 0; c < width; c++) {      if (c > 0) {       out.print(" ");      }      out.print(odd ? -1 : 2 * d[k][r][c]);     }     out.println();    }   }  }  static 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 {      st = new StringTokenizer(in.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    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;   FastScanner in = new FastScanner(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, FastScanner in, PrintWriter out) {    int n = in.nextInt();    int[] a = in.nextIntArray(n);    Arrays.sort(a);    int count = 0;    boolean[] used = new boolean[n];    for (int i = 0; i < n; i++) {     if (!used[i]) {      count++;      for (int j = i; j < n; j++) {       if (a[j] % a[i] == 0) {        used[j] = true;       }      }     }    }    out.println(count);   }  }  static class FastScanner {   BufferedReader br;   StringTokenizer st;   public FastScanner(InputStream in) {    br = new BufferedReader(new InputStreamReader(in));   }   public FastScanner(String fileName) {    try {     br = new BufferedReader(new FileReader(fileName));    } catch (FileNotFoundException e) {     e.printStackTrace();    }   }   public int nextInt() {    return Integer.parseInt(next());   }   public String next() {    while (st == null || !st.hasMoreElements()) {     String line = null;     try {      line = br.readLine();     } catch (IOException e) {     }     st = new StringTokenizer(line);    }    return st.nextToken();   }   public int[] nextIntArray(int n) {    int[] ret = new int[n];    for (int i = 0; i < n; i++) {     ret[i] = nextInt();    }    return ret;   }  } }
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;   }  } }
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 A { 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(1, in, out);  out.close(); }  static class Task {  public void solve(int testNumber, InputReader in, PrintWriter out) {  int n = in.nextInt();  int d = in.nextInt();  int a[] = new int[n];  int c[] = new int[2 * n];  for (int i = 0; i < n; i++) {   a[i] = in.nextInt();   c[2 * i] = a[i] - d;   c[2 * i + 1] = a[i] + d;  }  Arrays.sort(c);  int ans = 0;  for (int i = 0; i < 2 * n; i++) {   if (i != 0 && c[i] == c[i - 1]) continue;   int mind = d + 1;   for (int j = 0; j < n; j++)   mind = Math.min(mind, Math.abs(a[j] - c[i]));   if (mind == d) {   ans += 1;   }  }  out.println(ans);  } }  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());  }  } }
6	public class Hello {  public static void main(String[] args){    Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int m = scan.nextInt();  boolean[][] graph = new boolean[n][n];    for(int i = 0; i < m; i++) {   int from = scan.nextInt() - 1;   int to = scan.nextInt() - 1;   graph[from][to] = graph[to][from] = true;  }    int max = 1 << n;  long[][] dp = new long[max][n];    for(int mask = 1; mask < max; mask++) {   for(int i = 0; i < n; i++) {   boolean existI = (mask & (1 << i)) > 0;   if(Integer.bitCount(mask) == 1 && existI) {    dp[mask][i] = 1;   } else if(Integer.bitCount(mask) > 1 && existI && first(mask) != i) {    long sum = 0;    for(int j = 0; j < n; j++) {    if(graph[i][j]) sum += dp[mask ^ (1 << i)][j];    }    dp[mask][i] = sum;   }   }  }    long countCycles = 0;  for(int mask = 7; mask < max; mask++) {   for(int i = 0; i < n; i++) {   if(Integer.bitCount(mask) >= 3 && graph[first(mask)][i]) {    countCycles += dp[mask][i];   }   }  }  System.out.println(countCycles / 2);  }     public static int first(int mask) {  int i = 0;  while((mask & (1 << i++)) == 0);  return i - 1;  } }
4	public class Abc {  public static void main(String[] args) throws IOException {   Scanner sc=new Scanner(new FileReader("input.txt"));   PrintWriter out=new PrintWriter(new File("output.txt"));   int n=sc.nextInt(),m=sc.nextInt(),k=sc.nextInt();   boolean vis[][]=new boolean[n][m];   LinkedList<Integer> q=new LinkedList<>();   for (int i=0;i<k;i++){    int x=sc.nextInt()-1,y=sc.nextInt()-1;    vis[x][y]=true;    q.add(x);q.add(y);   }   int lastx=-1,lasty=-1;   int dirX[]={1,-1,0,0},dirY[]={0,0,1,-1};   while (!q.isEmpty()){    int x=q.removeFirst();    int y=q.removeFirst();    lastx=x;lasty=y;    for (int i=0;i<4;i++){     int newx=x+dirX[i],newy=y+dirY[i];     if (newx>=0 && newx<n && newy>=0 && newy<m && !vis[newx][newy]){      vis[newx][newy]=true;      q.add(newx);q.add(newy);     }    }   }   out.println((lastx+1)+" "+(lasty+1));   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;   }  } }
3	public class kosyaDetka {  public static void main(String[] args){   Scanner scan = new Scanner(System.in);   int t = scan.nextInt();   ArrayList<Integer> arr = new ArrayList<>();   for(int i = 0; i < t; i++){    arr.add( scan.nextInt());   }   int count = 0;   while (arr.size() != 0){    int min = Integer.MAX_VALUE;    for(int i = 0; i < arr.size(); i++){     int temp = arr.get(i);     if( temp < min){      min = temp;     }    }     for(int i = 0; i < arr.size(); i++){     int temp = arr.get(i);     if( temp % min == 0){      arr.remove(i);      i--;     }    }    count++;   }   System.out.println(count);  } }
3	public class Main {  public static void main(String[] args) throws Exception {   new Main().run();}                                                                                                       static long mul(long a, long b, long p)  {   long res=0,base=a;   while(b>0)   {    if((b&1L)>0)     res=(res+base)%p;    base=(base+base)%p;    b>>=1;   }   return res;  }  static long mod_pow(long k,long n,long p){   long res = 1L;   long temp = k;   while(n!=0L){    if((n&1L)==1L){     res = (res*temp)%p;    }    temp = (temp*temp)%p;    n = n>>1L;   }   return res%p;  }  int ct = 0;  int f[] =new int[200001];  int b[] =new int[200001];  int str[] =new int[200001];  void go(int rt,List<Integer> g[]){   str[ct] = rt;   f[rt] = ct;   for(int cd:g[rt]){    ct++;    go(cd,g);   }   b[rt] = ct;  }  int add =0;  void go(int rt,int sd,int k,List<Integer> g[],int n){   if(add>n) {    return;   }   Queue<Integer> q =new LinkedList<>();   q.offer(rt);   for(int i=1;i<=sd;++i){    int sz =q.size();    if(sz==0) break;    int f = (i==1?2:1);    while(sz-->0){     int cur = q.poll();     for(int j=0;j<k-f;++j){      q.offer(add);      g[cur].add(add);add++;      if(add==n+1){       return;      }     }    }   }   }   void solve() {   int n = ni();   int s[] = new int[n+1];   for(int i=0;i<n;++i){    s[i+1] = s[i] + ni();   }   Map<Integer,List<int[]>> mp = new HashMap<>();   for(int i=0;i<n;++i) {    for (int j = i; j>=0; --j) {     int v = s[i+1]-s[j];     if(!mp.containsKey(v)){      mp.put(v, new ArrayList<>());     }     mp.get(v).add(new int[]{j,i});    }   }   int all = 0;int vv = -1;   for(int v:mp.keySet()){    List<int[]> r = mp.get(v);    int sz = r.size();int c = 0;    int ri = -2000000000;    for(int j=0;j<sz;++j){     if(r.get(j)[0]>ri){      ri = r.get(j)[1];c++;     }    }    if(c>all){     all = c;     vv = v;    }   }   println(all);   List<int[]> r = mp.get(vv);   int sz = r.size();int c = 0;   int ri = -2000000000;   for(int j=0;j<sz;++j){    if(r.get(j)[0]>ri){     ri = r.get(j)[1];println((1+r.get(j)[0])+" "+(1+r.get(j)[1]));    }   }                                                                                                                                                }       long t1[];   void update(long[] t,int i,long v){   for(;i<t.length;i+=(i&-i)){    t[i] += v;   }  }  long get(long[] t,int i){   long s = 0;   for(;i>0;i-=(i&-i)){    s += t[i];   }   return s;  }  int equal_bigger(long t[],long v){   int s=0,p=0;   for(int i=Integer.numberOfTrailingZeros(Integer.highestOneBit(t.length));i>=0;--i) {    if(p+(1<<i)< t.length && s + t[p+(1<<i)] < v){     v -= t[p+(1<<i)];     p |= 1<<i;    }   }   return p+1;  }      static class S{   int l = 0;   int r = 0 ;   long le = 0;   long ri = 0;   long tot = 0;   long all = 0;   public S(int l,int r) {    this.l = l;    this.r = r;   }  }  static S a[];  static int[] o;  static void init(int[] f){   o = f;   int len = o.length;   a = new S[len*4];   build(1,0,len-1);  }  static void build(int num,int l,int r){   S cur = new S(l,r);   if(l==r){    a[num] = cur;    return;   }else{    int m = (l+r)>>1;    int le = num<<1;    int ri = le|1;    build(le, l,m);    build(ri, m+1,r);    a[num] = cur;    pushup(num, le, ri);   }  }                static long dd = 10007;  static void update(int num,int l,long v){   if(a[num].l==a[num].r){    a[num].le = v%dd;    a[num].ri = v%dd;    a[num].all = v%dd;    a[num].tot = v%dd;   }else{    int m = (a[num].l+a[num].r)>>1;    int le = num<<1;    int ri = le|1;    pushdown(num, le, ri);    if(l<=m){     update(le,l,v);    }    if(l>m){     update(ri,l,v);    }    pushup(num,le,ri);   }  }  static void pushup(int num,int le,int ri){   a[num].all = (a[le].all*a[ri].all)%dd;   a[num].le = (a[le].le + a[le].all*a[ri].le)%dd;   a[num].ri = (a[ri].ri + a[ri].all*a[le].ri)%dd;   a[num].tot = (a[le].tot + a[ri].tot + a[le].ri*a[ri].le)%dd;     }  static void pushdown(int num,int le,int ri){  }   int gcd(int a,int b){ return b==0?a: gcd(b,a%b);}  InputStream is;PrintWriter out;  void run() throws Exception {is = System.in;out = new PrintWriter(System.out);solve();out.flush();}  private byte[] inbuf = new byte[2];  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 char ncc() {int b;while((b = readByte()) != -1 && !(b >= 32 && b <= 126));return (char)b;}  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 String nline() {int b = skip();StringBuilder sb = new StringBuilder();   while (!isSpaceChar(b) || b == ' ') { sb.appendCodePoint(b);b = readByte(); }   return sb.toString();}  private char[][] nm(int n, int m) {char[][] a = new char[n][];for (int i = 0; i < n; i++) a[i] = ns(m);return a;}  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 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 << 3) + (num << 1) + (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();}}  void print(Object obj){out.print(obj);}  void println(Object obj){out.println(obj);}  void println(){out.println();} }
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();  } }
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)); } }
3	public class Main {  private final static long mod = 1000000007;  private final static int MAXN = 100001;  private static long power(long x, long y, long m) {   long temp;   if (y == 0)    return 1;   temp = power(x, y / 2, m);   temp = (temp * temp) % m;   if (y % 2 == 0)    return temp;   else    return ((x % m) * temp) % m;  }  private static long power(long x, long y) {   return power(x, y, mod);  }  private static long gcd(long a, long b) {   if (b == 0) return a;   return gcd(b, a % b);  }  static int nextPowerOf2(int a) {   return 1 << nextLog2(a);  }  static int nextLog2(int a) {   return (a == 0 ? 0 : 32 - Integer.numberOfLeadingZeros(a - 1));  }  private static long modInverse(long a, long m) {   long m0 = m;   long y = 0, x = 1;   if (m == 1)    return 0;   while (a > 1) {    long q = a / m;    long t = m;    m = a % m;    a = t;    t = y;    y = x - q * y;    x = t;   }   if (x < 0)    x += m0;   return x;  }  private static int[] getLogArr(int n) {   int arr[] = new int[n + 1];   for (int i = 1; i < n + 1; i++) {    arr[i] = (int) (Math.log(i) / Math.log(2) + 1e-10);   }   return arr;  }  private static int log[] = getLogArr(MAXN);  private static int getLRMax(int st[][], int L, int R) {   int j = log[R - L + 1];   return Math.max(st[L][j], st[R - (1 << j) + 1][j]);  }  private static int[][] getSparseTable(int array[]) {   int k = log[MAXN] + 1;   int st[][] = new int[MAXN][k + 1];   for (int i = 0; i < array.length; i++)    st[i][0] = array[i];   for (int j = 1; j <= k; j++) {    for (int i = 0; i + (1 << j) <= array.length; i++) {     st[i][j] = Math.max(st[i][j - 1], st[i + (1 << (j - 1))][j - 1]);    }   }   return st;  }  static class Subset {   int parent;   int rank;   @Override   public String toString() {    return "" + parent;   }  }  static int find(Subset[] Subsets, int i) {   if (Subsets[i].parent != i)    Subsets[i].parent = find(Subsets, Subsets[i].parent);   return Subsets[i].parent;  }  static void union(Subset[] Subsets, int x, int y) {   int xroot = find(Subsets, x);   int yroot = find(Subsets, y);   if (Subsets[xroot].rank < Subsets[yroot].rank)    Subsets[xroot].parent = yroot;   else if (Subsets[yroot].rank < Subsets[xroot].rank)    Subsets[yroot].parent = xroot;   else {    Subsets[xroot].parent = yroot;    Subsets[yroot].rank++;   }  }   private static int maxx(Integer... a) {   return Collections.max(Arrays.asList(a));  }   private static class Pair<T, U> {   T a;   U b;   public Pair(T a, U b) {    this.a = a;    this.b = 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.equals(pair.a) &&      b.equals(pair.b);   }   @Override   public int hashCode() {    return Objects.hash(a, b);   }   @Override   public String toString() {    return "(" + a +      "," + b +      ')';   }  }   public static void main(String[] args) throws Exception {   try (FastReader in = new FastReader();    FastWriter out = new FastWriter()) {    int t, i, j, n, k, l, r, m, c, p, q, ti, tidx;    long x, y, z;        {         n=in.nextInt();     int a[]=new int[101];     for (i=0;i<n;i++){      a[in.nextInt()]++;     }     m=0;     for(i=1;i<101;i++){      if(a[i]>0){       m++;       for(j=i;j<=100;j+=i){        a[j]=0;       }      }     }     out.println(m);    }    out.commit();   }  }   static class FastReader implements Closeable {   private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   private StringTokenizer st;   String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (Exception 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[] nextIntArr(int n) {    int[] arr = new int[n];    for (int i = 0; i < n; i++) {     arr[i] = nextInt();    }    return arr;   }   double[] nextDoubleArr(int n) {    double[] arr = new double[n];    for (int i = 0; i < n; i++) {     arr[i] = nextDouble();    }    return arr;   }   long[] nextLongArr(int n) {    long[] arr = new long[n];    for (int i = 0; i < n; i++) {     arr[i] = nextLong();    }    return arr;   }   String[] nextStrArr(int n) {    String[] arr = new String[n];    for (int i = 0; i < n; i++) {     arr[i] = next();    }    return arr;   }   int[][] nextIntArr2(int n, int m) {    int[][] arr = new int[n][m];    for (int i = 0; i < n; i++) {     arr[i] = nextIntArr(m);    }    return arr;   }   long[][] nextLongArr2(int n, int m) {    long[][] arr = new long[n][m];    for (int i = 0; i < n; i++) {     arr[i] = nextLongArr(m);    }    return arr;   }   @Override   public void close() throws IOException {    br.close();   }  }   static class FastWriter implements Closeable {   BufferedWriter bw;   StringBuilder sb = new StringBuilder();   List<String> list = new ArrayList<>();   Set<String> set = new HashSet<>();   FastWriter() {    bw = new BufferedWriter(new OutputStreamWriter(System.out));   }   <T> void commit() throws IOException {    bw.write(sb.toString());    bw.flush();    sb = new StringBuilder();   }   <T> void print(T obj) {    sb.append(obj.toString());   }   void println() throws IOException {    print("\n");   }   <T> void println(T obj) throws IOException {    print(obj.toString() + "\n");   }   <T> void printArrLn(T[] arr) throws IOException {    for (int i = 0; i < arr.length - 1; i++) {     print(arr[i] + " ");    }    println(arr[arr.length - 1]);   }   <T> void printArr2(T[][] arr) throws IOException {    for (int j = 0; j < arr.length; j++) {     for (int i = 0; i < arr[j].length - 1; i++) {      print(arr[j][i] + " ");     }     println(arr[j][arr.length - 1]);    }   }   <T> void printColl(Collection<T> coll) throws IOException {    for (T e : coll) {     print(e + " ");    }    println();   }   void printCharN(char c, int n) throws IOException {    for (int i = 0; i < n; i++) {     print(c);    }   }   void printIntArr2(int[][] arr) throws IOException {    for (int j = 0; j < arr.length; j++) {     for (int i = 0; i < arr[j].length - 1; i++) {      print(arr[j][i] + " ");     }     println(arr[j][arr.length - 1]);    }   }   @Override   public void close() throws IOException {    bw.close();   }  } }
3	public final class paint_and_numers {  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();   Arrays.sort(a);   int count = 0;   boolean[] c = new boolean[n];   for(int i=0;i<n;i++) {    if(c[i]==false) {     c[i]=true;     count++;     for(int j=i+1;j<n;j++) {      if(a[j]%a[i]==0) {       c[j] = true;      }     }    }   }   System.out.println(count);  } }
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);  } }
1	public class cfedu46a{ public static void main(String [] args) throws IOException{  InputReader in = new InputReader("cfedu46a.in");   int [] arr = new int[9];  int [] arr2 = new int[9];  int [] size = {4, 3, 2, 1, 1, 1, 2, 3, 4};  int n = in.nextInt();  for(int i = 0; i < n; i++){  String s = in.next();  switch(s.length()){   case 1:    if(s.charAt(0) == 'S')    arr[3]++;   if(s.charAt(0) == 'M')    arr[4]++;   if(s.charAt(0) == 'L')    arr[5]++;   break;   default:   if(s.charAt(s.length() - 1) == 'S'){    arr[3 - (s.length() - 1)]++;   }   if(s.charAt(s.length() - 1) == 'L'){    arr[5 + (s.length() - 1)]++;   }   }  }  for(int i = 0; i < n; i++){  String s = in.next();  switch(s.length()){   case 1:    if(s.charAt(0) == 'S')    arr2[3]++;   if(s.charAt(0) == 'M')    arr2[4]++;   if(s.charAt(0) == 'L')    arr2[5]++;   break;   default:   if(s.charAt(s.length() - 1) == 'S'){    arr2[3 - (s.length() - 1)]++;   }   if(s.charAt(s.length() - 1) == 'L'){    arr2[5 + (s.length() - 1)]++;   }   }  }  int cnt = 0;  for(int i = 0; i < 9; i++){  if(arr[i] == arr2[i])   continue;  else{   cnt += (arr2[i] - arr[i] > 0? arr2[i] - arr[i]: 0);  }  }  System.out.println(cnt); }  static class InputReader {  public BufferedReader reader;  public StringTokenizer tokenizer;  public InputReader(String s) {  try{   reader = new BufferedReader(new FileReader(s), 32768);  }  catch (Exception e){    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());  } } }
5	public class A {  public A()  {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   Integer mas[] = new Integer[n];   int b = 0;   for (int i = 0 ; i < n ; i ++)   {    mas[i] = sc.nextInt();    b+=mas[i];   }   Arrays.sort(mas, new Comparator<Integer>()   {    @Override    public int compare(Integer o1, Integer o2)    {     if(o1>o2)      return -1;     else if(o1==o2)      return 0;     else      return 1;    }    });   int N = 0; int g = 0;   for (int i = 0 ; i < n ; i ++)   {    g+=mas[i];    if(g>(int)(b/2))    {     System.out.println(i+1);     return;    }   }   System.out.println(n);  }  public static void main(String[] args)  {   new A();   } }
4	public class A {  public static void main(String[] args) throws FileNotFoundException, IOException {   Scanner in = new Scanner();   PrintWriter out = new PrintWriter(System.out);   String val = in.next();   ArrayList<String> list = new ArrayList();   for(int i = 0; i < val.length() ; i++){    list.add(val.substring(i));   }   Collections.sort(list);   int result = 0;   for(int i = 1; i < list.size() ; i++){    String other = list.get(i - 1);    int temp = 0;    for(int j = 0; j < list.get(i).length() && j < other.length() ; j++){     if(other.charAt(j) == list.get(i).charAt(j)){      temp++;     }else{      break;     }    }    if(temp > result){     result = temp;    }   }   out.println(result);   out.close();  }  public static int dist(int x0, int y0, int x1, int y1) {   return (x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1);  }  public static boolean isRight(int a, int b, int c) {   if (a == 0 || b == 0 || c == 0) {    return false;   }   if (a == b + c) {    return true;   }   if (b == a + c) {    return true;   }   if (c == a + b) {    return true;   }   return false;  }  public static int gcd(int a, int b) {   if (b == 0) {    return a;   }   return gcd(b, a % b);  }  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 int pow(int a, int b) {   if (b == 0) {    return 1;   }   if (b == 1) {    return a;   }   int val = pow(a, b / 2);   if (b % 2 == 0) {    return val * val;   } else {    return val * val * a;   }  }         static Point minus(Point a, Point b) {   return new Point(a.x - b.x, a.y - b.y);  }  static Point add(Point a, Point b) {   return new Point(a.x + b.x, a.y + b.y);  }  static double cross(Point a, Point b) {   return a.x * b.y - a.y * b.x;  }  static class Point {   int x, y;   Point(int x, int y) {    this.x = x;    this.y = y;   }   @Override   public String toString() {    return "Point: " + x + " " + 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();    }   }  } }
5	public class Main{   static class Run implements Runnable{       final boolean consoleIO = true;    final String inFile = "input.txt";    final String outFile = "output.txt";       Pair<Double,Double>[] p;    int n, t;       int find() {     int count = 2;         for(int i = 0; i < n-1; ++i) {      double dif = p[i+1].a-p[i].b;      int comp = Double.compare(dif,t);           if(comp==0)       count+=1;      else       if(comp>0)        count+=2;     }         return count;    }       @Override    public void run() {     n = nextInt();     t = nextInt();         p = new Pair[n];     for(int i = 0; i < n; ++i) {      int x = nextInt()+1000;      int a = nextInt();           double h = a/(double)2;      p[i] = new Pair<Double,Double>(x-h,x+h);     }         Arrays.sort(p, new PComparator());     print(find());     close();    }       class PComparator implements Comparator<Pair<Double,Double>> {     @Override     public int compare(Pair<Double, Double> o1,       Pair<Double, Double> o2) {           return Double.compare(o1.a, o2.a);     }    }      BufferedReader in;    PrintWriter out;    StringTokenizer strTok;       Run() {     if (consoleIO) {      initConsoleIO();     }     else {      initFileIO();     }    }       void initConsoleIO() {     in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(new OutputStreamWriter(System.out));    }       void initFileIO() {     try {      in = new BufferedReader(new FileReader(inFile));      out = new PrintWriter(new FileWriter(outFile));     } catch (FileNotFoundException e) {      e.printStackTrace();     } catch (IOException e) {      e.printStackTrace();     }    }       void close() {     try {      in.close();      out.close();     } catch (IOException e) {      e.printStackTrace();     }    }       int nextInt() {     return Integer.parseInt(nextToken());    }       double nextDouble() {     return Double.parseDouble(nextToken());    }       float nextFloat() {     return Float.parseFloat(nextToken());    }       long nextLong() {     return Long.parseLong(nextToken());    }       String nextLine() {     try {      return in.readLine();     } catch (IOException e) {      return "__NULL";     }    }       boolean hasMoreTokens() {     return (strTok == null) || (strTok.hasMoreTokens());    }       String nextToken() {     while (strTok == null || !strTok.hasMoreTokens()) {      String line;      try {       line = in.readLine();       strTok = new StringTokenizer(line);      } catch (IOException e) {       e.printStackTrace();      }     }         return strTok.nextToken();    }       void cout(Object o){     System.out.println(o);    }       void print(Object o) {     out.write(o.toString());    }       void println(Object o) {     out.write(o.toString() + '\n');    }       void printf(String format, Object... args) {     out.printf(format, args);    }       String sprintf(String format, Object... args) {    return MessageFormat.format(format, args);   }   }     static class Pair<A, B> {    A a;    B b;       A f() {     return a;    }       B s() {     return b;    }       Pair(A a, B b) {     this.a = a;     this.b = b;    }       Pair(Pair<A, B> p) {     a = p.f();     b = p.s();    }       @Override    public String toString() {     return a+" "+b;    }   }     public static void main(String[] args) throws IOException {    Run run = new Run();    Thread thread = new Thread(run);    thread.run();   }  }
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;      }     }    }   }  } }
0	public final class Subtractions {  public static void main(String[] args)  {   InputReader in = new InputReader(System.in);   PrintWriter out = new PrintWriter(System.out);  Solver solver = new Solver(in, out);  solver.solve();   in.close();   out.flush();   out.close();  }  static class Solver  {   int n;   InputReader in;   PrintWriter out;  void solve()  {  n = in.nextInt();   while (n-- > 0)  {   int a, b;   a = in.nextInt();   b = in.nextInt();   int cnt = 0;   while (a > 0 && b > 0)   {   if (a < b)    a = swap(b, b = a);    cnt += a / b;   a -= b * (a / b);   }   out.println(cnt);  }  }  int swap(int a, int b)  {  return a;  }   public Solver(InputReader in, PrintWriter out)   {   this.in = in;   this.out = out;   }  }  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 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 boolean isSpaceChar(int c)   {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public void close()   {    try    {     stream.close();    } catch (IOException e)    {     e.printStackTrace();    }   }  } }
3	public class A{  void solve(){   int n=ni();   s=new char[n+1];   s[0]='.';   for(int i=1;i<=n;i++) s[i]=ns().charAt(0);   dp=new long[5001][5001];   dp[1][0]=1;   long sum[]=new long[n+2];   sum[0]=1;   for(int i=2;i<=n;i++){    for(int j=0;j<=n;j++) {     if (s[i - 1] == 'f') {       if(j-1>=0) dp[i][j]=dp[i-1][j-1];       else dp[i][j]=0;     }else {      dp[i][j]=sum[j];     }    }    for(int j=n;j>=0;j--){     sum[j]=(sum[j+1]+dp[i][j])%M;    }   }   long ans=0;   for(int i=0;i<=n;i++){    ans+=dp[n][i];    if(ans>=M) ans%=M;   }   pw.println(ans);  }  char s[];  long dp[][];  long go(int x,int cnt,int n){    if(x>n) return 1;   long cc=0;   if(dp[x][cnt]!=-1) return dp[x][cnt];   if(s[x]=='f'){    cc=(cc+go(x+1,cnt+1,n))%M;   }else {    for(int j=cnt;j>=0;j--) cc=(cc+go(x+1,j,n))%M;    if(x==n) cc=(cc-cnt+M)%M;   }   cc%=M;   dp[x][cnt]=cc;   return cc;  }   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)); } }
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();   }  } }
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);   TaskF2 solver = new TaskF2();   solver.solve(1, in, out);   out.close();  }  static class TaskF2 {   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();    }    HashMap<Integer, Integer> lastIndex = new HashMap<>();    HashMap<Integer, Integer> maxSize = new HashMap<>();    for (int i = 0; i < n; i++) {     int sum = 0;     for (int j = i; j < n; j++) {      sum += a[j];      if (maxSize.containsKey(sum) == false) {       maxSize.put(sum, 0);      }      int curMaxSize = maxSize.get(sum);      int curLastIndex = curMaxSize == 0 ? -1 : lastIndex.get(sum);      if (curMaxSize == 0 || curLastIndex < i) {       curMaxSize++;       curLastIndex = j;      } else if (curLastIndex >= j) {       curLastIndex = j;      }      maxSize.put(sum, curMaxSize);      lastIndex.put(sum, curLastIndex);     }    }    int bestSum = -1;    int bestSize = -1;    for (int sum : maxSize.keySet()) {     if (maxSize.get(sum) > bestSize) {      bestSize = maxSize.get(sum);      bestSum = sum;     }    }    ArrayList<Interval> best = new ArrayList<>();    lastIndex = new HashMap<>();    maxSize = new HashMap<>();    for (int i = 0; i < n; i++) {     int sum = 0;     for (int j = i; j < n; j++) {      sum += a[j];      if (sum != bestSum)       continue;      if (maxSize.containsKey(sum) == false) {       maxSize.put(sum, 0);      }      int curMaxSize = maxSize.get(sum);      int curLastIndex = curMaxSize == 0 ? -1 : lastIndex.get(sum);      if (curMaxSize == 0 || curLastIndex < i) {       curMaxSize++;       curLastIndex = j;       best.add(new Interval(i, j));      } else if (curLastIndex >= j) {       curLastIndex = j;       best.set(best.size() - 1, new Interval(i, j));      }      maxSize.put(sum, curMaxSize);      lastIndex.put(sum, curLastIndex);     }    }    out.println(bestSize);    for (Interval i : best) {     out.println((i.l + 1) + " " + (i.r + 1));    }   }   class Interval {    int l;    int r;    Interval(int l, int r) {     this.l = l;     this.r = r;    }   }  }  static class InputReader {   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private InputStream stream;   public InputReader(InputStream stream) {    this.stream = stream;   }   private boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   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 nextInt() {    int c = read();    while (isWhitespace(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 (!isWhitespace(c));    return res * sgn;   }  } }
1	public class RoundOneProblemB {   public static void main(String[] args) {    int n=1;   BufferedReader input = new BufferedReader(new InputStreamReader(System.in), 50);   try {    n = Integer.valueOf(input.readLine());    if (! ((1 <= n) && (n <= Math.pow(10, 5)))) {   formatError();  }    Pattern typeOne = Pattern.compile("^([A-Z]+)([0-9]+)$");  Pattern typeTwo = Pattern.compile("^R([0-9]+)C([0-9]+)$");  for (int i=0; i < n; i++) {   String line = input.readLine();   Matcher matchOne = typeOne.matcher(line);   if (matchOne.find()) {   System.out.println(convertOneToTwo(matchOne.group(2), matchOne.group(1)));   } else {   Matcher matchTwo = typeTwo.matcher(line);   if (matchTwo.find()) {    System.out.println(convertTwoToOne(matchTwo.group(1), matchTwo.group(2)));   }   }  }     } catch (Exception e) {  formatError();   }   }  private static String convertTwoToOne(String row, String col) {  StringBuilder result = new StringBuilder();   long c = Long.parseLong(col);  while ( c > 0) {  result.append((char)(((c-1) % 26)+'A'));  c = (c-1) / 26;  }  result.reverse();  result.append(Long.parseLong(row));   return result.toString(); }  private static String convertOneToTwo(String row, String col) {  StringBuilder result = new StringBuilder();   int l = col.length();  col = col.toUpperCase();   long base = 1;  long c = 0;  for (int i=l-1; i >= 0; i--) {  c = c + ((col.charAt(i) - 'A' + 1) * base);  base = base * 26;  }   result.append("R").append(Long.parseLong(row)).append("C").append(c);  return result.toString(); }   private static void formatError() {  System.out.println("Unexpected input");  System.exit(1);  } }
4	public class A {   Scanner sc = new Scanner(System.in);   void run(){     String s = sc.next();   String subS;   int max = 0;     for (int i=0;i<s.length();i++) {    for (int j=i+1;j<s.length()+1;j++) {              subS = s.substring(i, j);         for (int k=i+1;k<s.length();k++) {                if ( s.startsWith(subS,k) ){       if ( max < subS.length() )        max = subS.length();      }     }        }   }     System.out.println(max);   return;    }   public static void main(String[] args){     new A().run();    } }
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;   }  } }
2	public class C {                         public static void main(String[] args)  {   Scanner sc = new Scanner(System.in);   BigInteger x = sc.nextBigInteger();   BigInteger k = sc.nextBigInteger();   BigInteger zero = new BigInteger("0");   BigInteger one = new BigInteger("1");   BigInteger two = new BigInteger("2");   BigInteger modulo = new BigInteger("1000000007");   BigInteger ans = two.modPow(k.add(one),modulo);   ans = ans.multiply(x);   ans = ans.subtract(two.modPow(k,modulo));   ans = ans.add(one);   ans = ans.mod(modulo);   if (x.equals(zero))   {   System.out.println(0);   }   else   {   System.out.println(ans);   }  } }
1	public class Main {  static MyScanner scan;  static PrintWriter pw;  public static void main(String[] args) {   new Thread(null,null,"_",1<<25)   {    public void run()    {     try     {      solve();     }     catch(Exception e)     {      e.printStackTrace();      System.exit(1);     }    }   }.start();  }  static void solve() throws IOException {   scan = new MyScanner();   pw = new PrintWriter(System.out, true);   StringBuilder sb = new StringBuilder();   Map<String,Integer> map = new HashMap<>();   map.put("M",0);   map.put("L",1);   map.put("S",2);   map.put("XL",3);   map.put("XS",4);   map.put("XXL",5);   map.put("XXS",6);   map.put("XXXL",7);   map.put("XXXS",8);   int freqa[] = new int[9];   int freqb[] = new int[9];   int n = ni();   for(int i=0;i<n;++i)    ++freqa[map.get(ne())];   for(int i=0;i<n;++i)    ++freqb[map.get(ne())];   for(int i=0;i<9;++i)   {    int xx = min(freqa[i],freqb[i]);    freqa[i]-=xx;    freqb[i]-=xx;   }   long res = 0;   for(int i=0;i<9;++i)    res+=freqa[i]+freqb[i];   pl(res/2);   pw.flush();   pw.close();  }  static long MMI(long A,long MOD)  {   return modpow(A,MOD-2,MOD);  }  static long modpow(long x,long y,long MOD)  {   if(y==0)    return 1;   if((y&1)==0)    return modpow((x*x)%MOD,y>>1,MOD);   else return (x*modpow(x,y-1,MOD))%MOD;  }  static class Pair implements Comparable<Pair>  {   int x,y;   Pair(int x,int y)   {    this.x=x;    this.y=y;   }   public int compareTo(Pair other)   {    if(this.x!=other.x)     return this.x-other.x;    return this.y-other.y;   }   public String toString()   {    return "{"+x+","+y+"}";   }  }  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 class MyScanner  {   BufferedReader br;   StringTokenizer st;   MyScanner()   {    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());   }  } }
3	public class Dasha {  static Scanner sc = new Scanner(System.in);  static PrintWriter pw = new PrintWriter(System.out), pw2 = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {   int n=sc.nextInt();   int[] arr=new int[101];   for(int i=0;i<n;i++)    arr[sc.nextInt()]++;   boolean [] vis=new boolean[101];   int c=0;   for(int i=1;i<=100;i++){    if(!vis[i]&&arr[i]>0){     c++;     for(int j=i+i;j<=100;j+=i)      vis[j]=true;    }   }   pw.println(c);   pw.flush();  }  public static <E> void print2D(E[][] arr) {   for (int i = 0; i < arr.length; i++) {    for (int j = 0; j < arr[i].length; j++) {     pw.println(arr[i][j]);    }   }  }  public static int digitSum(String s) {   int toReturn = 0;   for (int i = 0; i < s.length(); i++) toReturn += Integer.parseInt(s.charAt(i) + " ");   return toReturn;  }  public 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 (long i = 5; i * i <= n; i = i + 6)    if (n % i == 0 || n % (i + 2) == 0)     return false;   return true;  }  public static long pow(long a, long pow) {   return pow == 0 ? 1 : pow % 2 == 0 ? pow(a * a, pow >> 1) : a * pow(a * a, pow >> 1);  }  public static long sumNum(long a) {   return a * (a + 1) / 2;  }  public static int gcd(int n1, int n2) {   return n2 == 0 ? n1 : gcd(n2, n1 % n2);  }  public static long factorial(long a) {   return a == 0 || a == 1 ? 1 : a * factorial(a - 1);  }  public static void sort(int arr[]) {   shuffle(arr);   Arrays.sort(arr);  }  public static void shuffle(int arr[]) {   Random rnd = new Random();   for (int i = arr.length - 1; i > 0; i--) {    int index = rnd.nextInt(i + 1);    int temp = arr[index];    arr[index] = arr[i];    arr[i] = temp;   }  }  public static Double[] solveQuadratic(double a, double b, double c) {   double result = (b * b) - 4.0 * a * c;   double r1;   if (result > 0.0) {    r1 = ((double) (-b) + Math.pow(result, 0.5)) / (2.0 * a);    double r2 = ((double) (-b) - Math.pow(result, 0.5)) / (2.0 * a);    return new Double[]{r1, r2};   } else if (result == 0.0) {    r1 = (double) (-b) / (2.0 * a);    return new Double[]{r1, r1};   } else {    return new Double[]{null, null};   }  }  static class Scanner {   StringTokenizer st;   BufferedReader br;   public Scanner(FileReader r) {    br = new BufferedReader(r);   }   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();   }  }  static class pair<E1, E2> implements Comparable<pair> {   E1 x;   E2 y;   pair(E1 x, E2 y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(pair o) {    return x.equals(o.x) ? (Integer) y - (Integer) o.y : (Integer) x - (Integer) o.x;   }   @Override   public String toString() {    return x + " " + y;   }   public double pointDis(pair p1) {    return Math.sqrt(((Integer) y - (Integer) p1.y) * ((Integer) y - (Integer) p1.y) + ((Integer) x - (Integer) p1.x) * ((Integer) x - (Integer) p1.x));   }  } }
5	public class Solution implements Runnable {   public void solve() throws Exception {  int n = nextInt();  int a [] = new int [n];  for (int i = 0 ;i < n; i++) {  a[i] = nextInt();  }  Arrays.sort(a);  if (n == 1) {  if (a[0] == 1) {   out.print(2);  } else {   out.print(1);  }  } else {  out.print(1);  for (int i = 1; i < n; i++) {   if (i == n-1 && a[i] == 1) {   out.print(" "+2);   } else {   out.print(" "+a[i-1]);   }  }  } }      BufferedReader in; PrintWriter out; StringTokenizer st;  long stime=0;  private String next() throws Exception {  while (st == null || !st.hasMoreElements())  st = new StringTokenizer(in.readLine());  return st.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()); }  public void run() {  try {    in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new OutputStreamWriter(System.out));  solve();  } catch (Exception ex) {  throw new RuntimeException(ex);  } finally {  out.close();  } }  public static void main(String[] args) throws Exception {  new Thread(null, new Solution(), "", 1 << 25).start(); }  }
5	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("");  void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   int N = nextInt();  int T = nextInt();  Pair[] p = new Pair [N];  for (int i = 0; i < N; i++)  p[i] = new Pair(nextInt(), nextInt());  sort(p);  int ans = 2;  for (int i = 1; i < N; i++) {  int dif = (2 * p[i].x - p[i].a) - (2 * p[i - 1].x + p[i - 1].a);  if (dif == 2 * T)   ans++;  else if (dif > 2 * T)   ans += 2;  }  out.println(ans);  out.close(); }  class Pair implements Comparable<Pair> {  int x, a;   public Pair(int xx, int aa) {  x = xx;  a = aa;  }   @Override  public int compareTo(Pair p) {  return x < p.x ? -1 : 1;  } }  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; } }
4	public class Main { BufferedReader in; PrintWriter out;  public static void main(String[] args) throws IOException {  new Main().run(); } public void run() throws IOException {     in=new BufferedReader(new InputStreamReader(System.in));  out=new PrintWriter(new OutputStreamWriter(System.out));  solve();   out.flush(); }  public void solve() throws IOException {  String now=in.readLine();  int l=now.length();  int answ=0;  for(int i=0;i!=l;i++)  for(int j=i+1;j<l;j++)  {   String a=now.substring(i, j);   for(int k=i+1;k<l-j+i+1;k++)   if(a.compareTo(now.substring(k, k+j-i))==0)    answ=Math.max(answ, a.length());  }  out.print(answ);    } }
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<>();     }   }
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");   }  }
3	public class A {  public static void main(String[] args) throws Exception {  FastScanner sc = new FastScanner(System.in);  FastPrinter out = new FastPrinter(System.out);  new A().run(sc, out);  out.close(); }  public void run(FastScanner sc, FastPrinter out) throws Exception {  int N = sc.nextInt();  int[] arr = sc.nextIntArray(N);  Arrays.sort(arr);  boolean[] done = new boolean[N];  int ans = 0;  for (int i = 0; i < N; i++) {  if (done[i]) continue;  ans++;  for (int j = i; j < N; j++) {   if (arr[j] % arr[i] == 0) {   done[j] = true;   }  }  }  out.println(ans); }  public void shuffle(int[] arr) {  for (int i = 0; i < arr.length; i++) {  int r = (int) (Math.random() * arr.length);  if (i != r) {   arr[i] ^= arr[r];   arr[r] ^= arr[i];   arr[i] ^= arr[r];  }  } }  static class FastScanner {  final private int BUFFER_SIZE = 1 << 10;  private DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;  public FastScanner() {  this(System.in);  }  public FastScanner(InputStream stream) {  din = new DataInputStream(stream);  buffer = new byte[BUFFER_SIZE];  bufferPointer = bytesRead = 0;  }  public FastScanner(String fileName) throws IOException {  Path p = Paths.get(fileName);  buffer = Files.readAllBytes(p);  bytesRead = buffer.length;  }  int[] nextIntArray(int N) throws IOException {  int[] arr = new int[N];  for (int i = 0; i < N; i++) {   arr[i] = nextInt();  }  return arr;  }  String nextLine() throws IOException {  int c = read();  while (c != -1 && isEndline(c))   c = read();  if (c == -1) {   return null;  }  StringBuilder res = new StringBuilder();  do {   if (c >= 0) {   res.appendCodePoint(c);   }   c = read();  } while (!isEndline(c));  return res.toString();  }  boolean isEndline(int c) {  return c == '\n' || c == '\r' || c == -1;  }  String next() throws Exception {  int c = readOutSpaces();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  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 {  if (din == null) {   bufferPointer = 0;   bytesRead = -1;  } else {   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++];  }  private int readOutSpaces() throws IOException {  while (true) {   if (bufferPointer == bytesRead) fillBuffer();   int c = buffer[bufferPointer++];   if (!isSpaceChar(c)) {   return c;   }  }  }  public void close() throws IOException {  if (din == null) return;  din.close();  }  public int[][] readGraph(int N, int M, boolean zeroIndexed, boolean bidirectional) throws Exception {  int[][] adj = new int[N][];  int[] numNodes = new int[N];  int[][] input = new int[M][2];  for (int i = 0; i < M; i++) {   int a = nextInt();   int b = nextInt();   if (zeroIndexed) {   a--;   b--;   }   input[i][0] = a;   input[i][1] = b;   numNodes[a]++;   if (bidirectional) numNodes[b]++;  }  for (int i = 0; i < N; i++) {   adj[i] = new int[numNodes[i]];   numNodes[i] = 0;  }  for (int i = 0; i < M; i++) {   int a = input[i][0];   int b = input[i][1];   adj[a][numNodes[a]++] = b;   if (bidirectional) adj[b][numNodes[b]++] = a;  }  return adj;  }  public int[][][] readWeightedGraph(int N, int M, boolean zeroIndexed, boolean bidirectional) throws Exception {  int[][][] adj = new int[N][][];  int[] numNodes = new int[N];  int[][] input = new int[M][3];  for (int i = 0; i < M; i++) {   int a = nextInt();   int b = nextInt();   if (zeroIndexed) {   a--;   b--;   }   int d = nextInt();   input[i][0] = a;   input[i][1] = b;   input[i][2] = d;   numNodes[a]++;   if (bidirectional) numNodes[b]++;  }  for (int i = 0; i < N; i++) {   adj[i] = new int[numNodes[i]][2];   numNodes[i] = 0;  }  for (int i = 0; i < M; i++) {   int a = input[i][0];   int b = input[i][1];   int d = input[i][2];   adj[a][numNodes[a]][0] = b;   adj[a][numNodes[a]][1] = d;   numNodes[a]++;   if (bidirectional) {   adj[b][numNodes[b]][0] = a;   adj[b][numNodes[b]][1] = d;   numNodes[b]++;   }  }  return adj;  } }  static class FastPrinter {  static final char ENDL = '\n';  StringBuilder buf;  PrintWriter pw;  public FastPrinter(OutputStream stream) {  buf = new StringBuilder();  pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream)));  }  public FastPrinter(String fileName) throws Exception {  buf = new StringBuilder();  pw = new PrintWriter(new BufferedWriter(new FileWriter(fileName)));  }  public FastPrinter(StringBuilder buf) {  this.buf = buf;  }  public void print(int a) {  buf.append(a);  }  public void print(long a) {  buf.append(a);  }  public void print(char a) {  buf.append(a);  }  public void print(char[] a) {  buf.append(a);  }  public void print(double a) {  buf.append(a);  }  public void print(String a) {  buf.append(a);  }  public void print(Object a) {  buf.append(a.toString());  }  public void println() {  buf.append(ENDL);  }  public void println(int a) {  buf.append(a);  buf.append(ENDL);  }  public void println(long a) {  buf.append(a);  buf.append(ENDL);  }  public void println(char a) {  buf.append(a);  buf.append(ENDL);  }  public void println(char[] a) {  buf.append(a);  buf.append(ENDL);  }  public void println(double a) {  buf.append(a);  buf.append(ENDL);  }  public void println(String a) {  buf.append(a);  buf.append(ENDL);  }  public void println(Object a) {  buf.append(a.toString());  buf.append(ENDL);  }  public void printf(String format, Object... args) {  buf.append(String.format(format, args));  }  public void close() {  pw.print(buf);  pw.close();  }  public void flush() {  pw.print(buf);  pw.flush();  buf.setLength(0);  }  } }
3	public class Problem1 {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);  int n = sc.nextInt();  int a []=new int[n];  for(int i=0;i<n;i++) {  a[i]=sc.nextInt();  }  Arrays.sort(a);  int k=a.length;  for(int i=a.length-1;i>=0;i--) {  int A=a[i];  for (int j=0;j<i;j++) {   if(A%a[j]==0) {   k--;   break;   }  }  }  System.out.println(k);  sc.close(); } }
0	public class Main {         public static void main(String[] args) throws Exception {   Scanner sc = null;   PrintWriter pr = null;    pr=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));          long n = sc.nextInt();   if (n > 0) pr.println(n);   else {    long n1 = n / 10;    long n2 = n / 100 * 10 + n % 10;    if (n1 < n2) pr.println(n2);    else pr.println(n1);   }      pr.close();   sc.close();  } }
4	public class OverlapedString { public static void main(String args[]) throws Exception {  OverlapedString os = new OverlapedString();  BufferedReader stdin =  new BufferedReader(new InputStreamReader(System.in));  String line;  while ((line = stdin.readLine()) != null) {  System.out.println(os.handleOverlap(line));  } } private int handleOverlap(String str) {  int len = str.length();  int count = 0;  for(int i=0;i<len;i++)  for(int j=i+1;j<len;j++) {   String _tmp = str.substring(i,j);   if(_tmp!=null&&_tmp.length()>0) {   if(getOverlapCount(str,_tmp)>1)   {    if(_tmp.length()>count)    count = _tmp.length();   }   }  }  return count; } private int getOverlapCount(String str,String sub) {  int start = 0;  int count = 0;  while(start<str.length()) {  start = str.indexOf(sub,start);  if(start==-1)   break;  else {   start++;   count++;  }  }  return count; } }
5	public class House { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int t = sc.nextInt();  ArrayList<HS> list = new ArrayList<HS>();  for (int i = 0; i < n; i++) {  list.add(new HS(sc.nextInt(),sc.nextInt()));  }   Collections.sort(list);   int count = 0;   if(n >= 1)  count = 2;   for(int i = 0; i < list.size() - 1; i++){  double d = Math.abs(list.get(i + 1).x - list.get(i).x);  d -= ((1.0*list.get(i).a/2.0) + (1.0*list.get(i + 1).a/2.0));  if ((d >= t)&& ((d-t) <= 0.00000001)){   count++;  }  else if(d > t){   count+= 2;  }  }  System.out.println(count); } } class HS implements Comparable<HS> { public int x; public int a;  public HS(int x, int a) {  this.x = x;  this.a = a; }  public int compareTo(HS o) {  return x - o.x; } }
1	public class Edu_46A {  public static void main(String[] args) throws IOException {  BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  PrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  int nE = Integer.parseInt(reader.readLine());  int[][] cnt = new int[][] { { 0, 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };  for (int i = 0; i < nE; i++) {  String nxt = reader.readLine();  if (nxt.equals("S")) {   cnt[0][0]++;  }  if (nxt.equals("M")) {   cnt[0][1]++;  }  if (nxt.equals("L")) {   cnt[0][2]++;  }  if (nxt.equals("XS")) {   cnt[1][0]++;  }  if (nxt.equals("XL")) {   cnt[1][1]++;  }  if (nxt.equals("XXS")) {   cnt[2][0]++;  }  if (nxt.equals("XXL")) {   cnt[2][1]++;  }  if (nxt.equals("XXXS")) {   cnt[3][0]++;  }  if (nxt.equals("XXXL")) {   cnt[3][1]++;  }  }  for (int i = 0; i < nE; i++) {  String nxt = reader.readLine();  if (nxt.equals("S")) {   cnt[0][0]--;  }  if (nxt.equals("M")) {   cnt[0][1]--;  }  if (nxt.equals("L")) {   cnt[0][2]--;  }  if (nxt.equals("XS")) {   cnt[1][0]--;  }  if (nxt.equals("XL")) {   cnt[1][1]--;  }  if (nxt.equals("XXS")) {   cnt[2][0]--;  }  if (nxt.equals("XXL")) {   cnt[2][1]--;  }  if (nxt.equals("XXXS")) {   cnt[3][0]--;  }  if (nxt.equals("XXXL")) {   cnt[3][1]--;  }  }  int ans = 0;  for (int i = 1; i <= 3; i++) {  ans += Math.abs(cnt[i][0]);  }  int max = 0;  for (int i = 0; i < 3; i++) {  max = Math.max(max, Math.abs(cnt[0][i]));  }  ans += max;  printer.println(ans);  printer.close(); } }
4	public class FireAgain {  static int n, m, k;  static int inf = (int) 1e9;  static class Pair {   int x, y;   Pair(int a, int b) {    x = a; y = b;   }  }  static int[] dx = {1, -1, 0, 0}, dy = {0, 0, 1, -1};  static boolean valid(int x, int y) {   return x >= 0 && x < n && y >= 0 && y < m;  }  static int[][] bfs(int[] xs, int[] ys) {   int[][] dist = new int[n][m];   for(int i = 0; i < n; i++)    Arrays.fill(dist[i], inf);   Queue<Pair> q = new LinkedList<>();   for(int i = 0; i < k; i++) {    dist[xs[i]][ys[i]] = 0;    q.add(new Pair(xs[i], ys[i]));   }   while(!q.isEmpty()) {    Pair p = q.remove();    for(int d = 0; d < 4; d++) {     int nx = p.x + dx[d], ny = p.y + dy[d];     if(valid(nx, ny) && dist[nx][ny] == inf) {      dist[nx][ny] = dist[p.x][p.y] + 1;      q.add(new Pair(nx, ny));     }    }   }   return dist;  }  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner();   n = sc.nextInt(); m = sc.nextInt(); k = sc.nextInt();   int[] xs = new int[k], ys = new int[k];   for(int i = 0; i < k; i++) {    xs[i] = sc.nextInt() - 1; ys[i] = sc.nextInt() - 1;   }   int[][] dist = bfs(xs, ys);   int x = 0, y = 0;   for(int i = 0; i < n; i++)    for(int j = 0; j < m; j++)     if(dist[i][j] > dist[x][y]) {      x = i; y = j;     }   x++; y++;   PrintWriter out = new PrintWriter("output.txt");   out.println(x + " " + y);   out.flush();   out.close();  }  static class Scanner {   BufferedReader br;   StringTokenizer st;   Scanner() throws FileNotFoundException {    br = new BufferedReader(new FileReader("input.txt"));   }   String next() throws IOException {    while(st == null || !st.hasMoreTokens())     st = new StringTokenizer(br.readLine());    return st.nextToken();   }   int nextInt() throws IOException {    return Integer.parseInt(next());   }  } }
2	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);   CNastyaAndAWardrobe solver = new CNastyaAndAWardrobe();   solver.solve(1, in, out);   out.close();  }  static class CNastyaAndAWardrobe {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    long mod = (long) (1e9 + 7);    long n = in.nextLong();    long k = in.nextLong();    if (n == 0) {     out.println(0);     return;    }    long c = (((2 * n - 1) % mod) * pow(2L, k, mod)) % mod + 1;    c %= mod;    out.println(c);   }   public long pow(long a, long b, long mod) {    long result = 1;    while (b > 0) {     if (b % 2 != 0) {      result *= a;      result %= mod;      b--;     }     a *= a;     a %= mod;     b /= 2;    }    return result % mod;   }  }  static class FastScanner {   private BufferedReader br;   private StringTokenizer st;   public FastScanner(InputStream inputStream) {    br = new BufferedReader(new InputStreamReader(inputStream));   }   public String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   public long nextLong() {    return Long.parseLong(next());   }  } }
4	public class D {  private static void run() throws IOException {   int n = in.nextInt();   int m = in.nextInt();   int p = in.nextInt();   int[] dx = {1, -1, 0, 0};   int[] dy = {0, 0, 1, -1};   int[][][] map = new int[n][m][4];   ArrayList<Edge> edges = new ArrayList<>();   for (int i = 0; i < n; i++) {    for (int j = 0; j < m - 1; j++) {     int len = in.nextInt();     edges.add(new Edge(new Point[]{new Point(i, j), new Point(i, j + 1)}, len));     map[i][j][2] = map[i][j + 1][3] = len;    }   }   for (int i = 0; i < n - 1; i++) {    for (int j = 0; j < m; j++) {     int len = in.nextInt();     edges.add(new Edge(new Point[]{new Point(i, j), new Point(i + 1, j)}, len));     map[i][j][0] = map[i + 1][j][1] = len;    }   }   if (p % 2 != 0) {    int[] ans = new int[m];    for (int i = 0; i < m; i++) {     ans[i] = -1;    }    for (int i = 0; i < n; i++) {     print_array(ans);    }    return;   }   edges.sort(Comparator.comparingInt(o -> o.len));   int[][][] dp = new int[2][n][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     int min = Integer.MAX_VALUE;     for (int k = 0; k < 4; k++) {      if (map[i][j][k] == 0) continue;      min = Math.min(min, map[i][j][k]);     }     dp[1][i][j] = min * 2;    }   }   for (int k = 2; k <= p / 2; k++) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      dp[k & 1][i][j] = Integer.MAX_VALUE;      for (int d = 0; d < 4; d++) {       int nx = i + dx[d];       int ny = j + dy[d];       if (nx < 0 || nx >= n || ny < 0 || ny >= m) continue;       dp[k & 1][i][j] = Math.min(dp[(k - 1) & 1][nx][ny] + map[i][j][d] * 2, dp[k&1][i][j]);      }     }    }   }   for (int i = 0; i < n; i++) {    print_array(dp[(p / 2) & 1][i]);   }  }  static class Edge {   Point[] points;   int len;   public Edge(Point[] points, int len) {    this.points = points;    this.len = len;   }  }  static class Point {   final int x, y;   public Point(int x, int y) {    this.x = x;    this.y = y;   }  }  public static void main(String[] args) throws IOException {   in = new Reader();   out = new PrintWriter(new OutputStreamWriter(System.out));     run();   out.flush();   in.close();   out.close();  }  private static int gcd(int a, int b) {   if (a == 0 || b == 0)    return 0;   while (b != 0) {    int tmp;    tmp = a % b;    a = b;    b = tmp;   }   return a;  }  static final long mod = 1000000007;  static long pow_mod(long a, long b) {   long result = 1;   while (b != 0) {    if ((b & 1) != 0) result = (result * a) % mod;    a = (a * a) % mod;    b >>= 1;   }   return result;  }  private static long multiplied_mod(long... longs) {   long ans = 1;   for (long now : longs) {    ans = (ans * now) % mod;   }   return ans;  }  @SuppressWarnings("FieldCanBeLocal")  private static Reader in;  private static PrintWriter out;  private static void print_array(int[] array) {   for (int now : array) {    out.print(now);    out.print(' ');   }   out.println();  }  private static void print_array(long[] array) {   for (long now : array) {    out.print(now);    out.print(' ');   }   out.println();  }  static class Reader {   private static final int BUFFER_SIZE = 1 << 16;   private final DataInputStream din;   private final byte[] buffer;   private int bufferPointer, bytesRead;   Reader() {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public String readLine() throws IOException {    final byte[] buf = new byte[1024];    int cnt = 0, c;    while ((c = read()) != -1) {     if (c == '\n') {      break;     }     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }   public int nextSign() throws IOException {    byte c = read();    while ('+' != c && '-' != c) {     c = read();    }    return '+' == c ? 0 : 1;   }   private static boolean isSpaceChar(int c) {    return !(c >= 33 && c <= 126);   }   public int skip() throws IOException {    int b;       while ((b = read()) != -1 && isSpaceChar(b)) {     ;    }    return b;   }   public char nc() throws IOException {    return (char) skip();   }   public String next() throws IOException {    int b = skip();    final StringBuilder sb = new StringBuilder();    while (!isSpaceChar(b)) {     sb.appendCodePoint(b);     b = read();    }    return sb.toString();   }   public int nextInt() throws IOException {    int ret = 0;    byte c = read();    while (c <= ' ') {     c = read();    }    final 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();    }    final 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();    }    final 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 {    din.close();   }  } }
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);  } }
4	public class N718 { static PrintWriter out; static Scanner sc; static ArrayList<int[]>q,w,x; static ArrayList<Integer>adj[]; static HashSet<Integer>primesH; static boolean prime[];  static HashSet<Long>tmp; static int[][][]dist; static boolean[]v; static int[]a,b,c,d; static Boolean[][]dp; static char[][]mp; static int A,B,n,m,h,ans,sum;  static long oo=(long)1e9+7; public static void main(String[]args) throws IOException {  sc=new Scanner(System.in);  out=new PrintWriter(System.out);      D();      out.close(); }  private static void A() throws IOException {  int t=ni();  while(t-->0) {   long l=nl();   if(l%2050!=0)ol(-1);   else {   long num=l/2050;   int cnt=0;   while(num>0) {    cnt+=num%10;    num/=10;   }   ol(cnt);      }  }    }  static void B() throws IOException {  int t=ni();  while(t-->0) {   int n=ni(),m=ni();   int[][]a=nmi(n,m);   PriorityQueue<int[]>pq=new PriorityQueue<int[]>((u,v)->u[0]-v[0]);   ArrayList<Integer>[]nums=new ArrayList[n];   for(int i=0;i<n;i++) {      for(int j=0;j<m;j++) {       pq.add(new int[] {a[i][j],i});   }   }   int[][]ans=new int[n][m];   for(int i=0;i<m;i++) {   int[]x=pq.poll();   ans[x[1]][i]=x[0];   }   int []indices=new int[n];   while(!pq.isEmpty()) {   int[]x=pq.poll();   int i=x[1];   while(ans[i][indices[i]]!=0) {    indices[i]++;   }   ans[i][indices[i]]=x[0];   }   for(int i=0;i<n;i++) {   for(int j=0;j<m;j++) {    out.print(ans[i][j]+" ");   }   ol("");   }  }  }   static void C() throws IOException{   int t=1;   while(t-->0) {   int n=ni();   a=nai(n);   int[][]ans=new int[n][n];   for(int i=0;i<n;i++)ans[i][i]=a[i];   for(int i=n-1;i>=0;i--) {    int j=i,k=i;    int cur=ans[i][i];    cur--;    while(cur>0) {    j++;    if(j>=n||ans[j][k]!=0) {     j--;     k--;    }    ans[j][k]=ans[i][i];    cur--;    }   }   for(int i=0;i<n;i++) {    for(int j=0;j<=i;j++) {    out.print(ans[i][j]+" ");    }    ol("");   }   }  }  private static Boolean dp(int i, int j) {  if(j>sum/2)return false;  if(i==x.size()) {   return sum/2==j;  }  if(dp[i][j]!=null)return dp[i][j];    return dp[i][j]=dp(i+1,j+x.get(i)[0])||dp(i+1,j);  }  static boolean isPrime(long n) {  if(n==2)return true;  if(n<2||n%2==0)return false;    for(long i=3L;i*i<n;i+=2l) {   long rem=(n%i);   if(rem==0)return false;  }  return true;  }  static void D() throws IOException {  int t=1;  while(t-->0) {   int n=ni(),m=ni(),k=ni();   int[][]ans=new int[n][m];   dist=new int[n][m][4];   for(int i=0;i<n;i++)for(int j=0;j>m;j++)   Arrays.fill(dist[i][j], Integer.MAX_VALUE);   int x;   for(int i=0;i<n;i++) {   for(int j=0;j<m-1;j++) {    dist[i][j][2]=(x=ni());    dist[i][j+1][3]=x;   }   }   for(int i=0;i<n-1;i++) {   for(int j=0;j<m;j++) {    dist[i][j][1]=(x=ni());    dist[i+1][j][0]=x;   }   }   int[][]nans=new int[n][m];   if(k%2==1) {   for(int i=0;i<n;i++)Arrays.fill(ans[i], -1);   }else {   for(int ii=0;ii<k/2;ii++) {   for(int i=0;i<n;i++) {       for(int j=0;j<m;j++) {    nans[i][j]=Integer.MAX_VALUE;    if(i>0)     nans[i][j]=Math.min(nans[i][j], ans[i-1][j]+dist[i-1][j][1]);    if(i<n-1)     nans[i][j]=Math.min(nans[i][j], ans[i+1][j]+dist[i+1][j][0]);    if(j>0)     nans[i][j]=Math.min(nans[i][j], ans[i][j-1]+dist[i][j-1][2]);    if(j<m-1)     nans[i][j]=Math.min(nans[i][j], ans[i][j+1]+dist[i][j+1][3]);    }   }   int[][]tmp=ans;   ans=nans;   nans=tmp;   }   }   for(int i=0;i<n;i++) {   for(int j=0;j<m;j++) {    if(ans[i][j]!=-1)ans[i][j]*=2;    out.print(ans[i][j]+" ");   }   ol("");   }  }  }  private static int bfs(int i, int j,int k) {  boolean [][]vis=new boolean[dist.length][dist[0].length];  Queue<int[]>q=new LinkedList<int[]>();  int mn=Integer.MAX_VALUE;  q.add(new int[] {i,j,0,0});  int[]dx=new int[] {-1,1,0,0};  int[]dy=new int[] {0,0,1,-1};  while(!q.isEmpty()) {   int []x=q.poll();   vis[x[0]][x[1]]=true;   int c=x[2];   if(c>k/2)continue;   if(c>0&&k%c==0&&(k/c)%2==0) {   mn=Math.min(mn,x[3]*k/c );   }   for(int a=0;a<4;a++) {   int nx=x[0]+dx[a];   int ny=x[1]+dy[a];   if(valid(nx,ny)&&!vis[nx][ny]) {    q.add(new int[] {nx,ny,c+1,x[3]+dist[x[0]][x[1]][a]});   }   }     }  return mn;  }  private static boolean valid(int nx, int ny) {  return nx>=0&&nx<dist.length&&ny>=0&&ny<dist[0].length;  }  static int gcd (int a, int b) {   return b==0?a:gcd (b, a % b);  }   static void E() throws IOException {  int t=ni();  while(t-->0) {      }   }  static void F() throws IOException {  int t=ni();  while(t-->0) {    } } static void CC() throws IOException {  for(int kk=2;kk<21;kk++) {  ol(kk+" -------");  int n=kk;  int k=n-2;  int msk=1<<k;  int[]a=new int[k];  for(int i=0;i<a.length;i++)a[i]=i+2;  int mx=1;  int ms=0;  for(int i=1;i<msk;i++) {  long prod=1;  int cnt=0;  for(int j=0;j<a.length;j++) {   if(((i>>j)&1)!=0) {   prod*=a[j];   cnt++;   }  }  if(cnt>=mx&&prod%n==1) {   mx=cnt;   ms=i;  }    }  ol(mx==1?mx:mx+1);  out.print(1+" ");  long pr=1;  for(int j=0;j<a.length;j++) {  if(((ms>>j)&1)!=0) {   out.print(a[j]+" ");   pr*=a[j];  }  }  ol("");  ol("Prod: "+pr);  ol(n+"*"+((pr-1)/n)+" + "+1);  } } static int ni() throws IOException {  return sc.nextInt(); } static double nd() throws IOException {  return sc.nextDouble(); } static long nl() throws IOException {  return sc.nextLong(); } static String ns() throws IOException {  return sc.next(); } static int[] nai(int n) throws IOException {  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = sc.nextInt();  return a; } static long[] nal(int n) throws IOException {  long[] a = new long[n];  for (int i = 0; i < n; i++)  a[i] = sc.nextLong();  return a; } static int[][] nmi(int n,int m) throws IOException{  int[][]a=new int[n][m];  for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   a[i][j]=sc.nextInt();  }  }  return a; }  static long[][] nml(int n,int m) throws IOException{  long[][]a=new long[n][m];  for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   a[i][j]=sc.nextLong();  }  }  return a; } static void o(String x) {  out.print(x); } static void ol(String x) {  out.println(x); } static void ol(int x) {  out.println(x); } static void disp1(int []a) {  for(int i=0;i<a.length;i++) {  out.print(a[i]+" ");  }  out.println(); }  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 boolean hasNext() {return st.hasMoreTokens();}  public int nextInt() throws IOException {return Integer.parseInt(next());}   public double nextDouble() throws IOException {return Double.parseDouble(next());}   public long nextLong() throws IOException {return Long.parseLong(next());}  public String nextLine() throws IOException {return br.readLine();}    public boolean ready() throws IOException {return br.ready(); }   } }
5	public class A { public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int t = scan.nextInt();  List<Double> coords = new ArrayList<Double>();  while (n-- > 0) {  double x = scan.nextDouble();  double a = scan.nextDouble() / 2;  coords.add(x - a);  coords.add(x + a);  }  Collections.sort(coords);  int count = 2;  ChoiceFormat f = new ChoiceFormat("-1#0|0#1|0<2");  for (int i = 1; i < coords.size()-2; i+=2) {  count += new Integer(f.format(coords.get(i+1)-coords.get(i)-t));  }  System.out.println(count); } }
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;   }  } }
3	public class TaskC {  public static void main(String[] args) {  new TaskC().run(); }  void solve(){  int n = in.nextInt();  String s[] = new String[n];  for(int i = 0; i < n; i++) s[i] = in.next();  if(s[n-1].compareTo("f") == 0){  out.println(0);  return;  }  int dp[] = new int[n+2];  int mod = 1000*1000*1000+7;  dp[0] = 1;  for(int i = n-1; i >= 0; i--){   if(s[i].compareTo("s") == 0){   int ss = 0;   for(int j = 0; j <= n; j++){   ss += dp[j];   if(ss>=mod) ss -= mod;   dp[j] = ss;   }  }else{   for(int j = 0; j < n;j++){   dp[j] = dp[j+1];   }   dp[n] = 0;  }  }  out.println(dp[0]); }   FastScanner in; PrintWriter out; void run() {  in = new FastScanner(System.in);  out = new PrintWriter(System.out);  int tests = 1;  while(tests > 0){  solve();  tests--;  }  out.close(); }  class Pair implements Comparable<Pair>{  Integer x, y;  public Pair(int x, int y){  this.x = x;  this.y = y;  }  @Override  public int compareTo(Pair o) {  if(x.compareTo(o.x) == 0) return y.compareTo(o.y);  return x.compareTo(o.x);  }   }  class FastScanner {  StringTokenizer st;  BufferedReader bf;   public FastScanner(InputStream is) {  bf = new BufferedReader(new InputStreamReader(is));  }   public FastScanner(File f){  try{   bf = new BufferedReader(new FileReader(f));  }  catch(IOException ex){   ex.printStackTrace();  }  }  String next(){  while(st == null || !st.hasMoreTokens()){   try{   st = new StringTokenizer(bf.readLine());   }   catch(Exception ex){   ex.printStackTrace();   }  }  return st.nextToken();  }  int nextInt(){  return Integer.parseInt(next());  }  long nextLong(){  return Long.parseLong(next());  }  double nextDouble(){  return Double.parseDouble(next());  }  int[] readArray(int n){  int[] a = new int[n];  for(int i = 0; i < n; i++)   a[i] = nextInt();  return a;  } }  }
1	public class Main {  private static void solve() {  int n = ni();  int d = ni();  int[] a = na(n);  Arrays.sort(a);  Set<Integer> set = new HashSet<>();  for (int i = 0; i < n; i ++) {  int cand1 = a[i] - d;  int cand2 = a[i] + d;  int d1 = d;  int d2 = d;  for (int j = 0; j < n; j ++) {   d1 = Math.min(d1, Math.abs(a[j] - cand1));   d2 = Math.min(d2, Math.abs(a[j] - cand2));  }  if (d1 == d) {   set.add(cand1);  }  if (d2 == d) {   set.add(cand2);  }  }  System.out.println(set.size()); }   public static void main(String[] args) {  new Thread(null, new Runnable() {  @Override  public void run() {   long start = System.currentTimeMillis();   String debug = args.length > 0 ? args[0] : null;   if (debug != null) {   try {    is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));   } catch (Exception e) {    throw new RuntimeException(e);   }   }   reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);   solve();   out.flush();   tr((System.currentTimeMillis() - start) + "ms");  }  }, "", 64000000).start(); }  private static java.io.InputStream is = System.in; private static java.io.PrintWriter out = new java.io.PrintWriter(System.out); private static java.util.StringTokenizer tokenizer = null; private static java.io.BufferedReader reader;  public static String next() {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  try {   tokenizer = new java.util.StringTokenizer(reader.readLine());  } catch (Exception e) {   throw new RuntimeException(e);  }  }  return tokenizer.nextToken(); }  private static double nd() {  return Double.parseDouble(next()); }  private static long nl() {  return Long.parseLong(next()); }  private static int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = ni();  return a; }  private static char[] ns() {  return next().toCharArray(); }  private static long[] nal(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)  a[i] = nl();  return a; }  private static int[][] ntable(int n, int m) {  int[][] table = new int[n][m];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   table[i][j] = ni();  }  }  return table; }  private static int[][] nlist(int n, int m) {  int[][] table = new int[m][n];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   table[j][i] = ni();  }  }  return table; }  private static int ni() {  return Integer.parseInt(next()); }  private static void tr(Object... o) {  if (is != System.in)  System.out.println(java.util.Arrays.deepToString(o)); } }
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();   int ret=0;  int [] p = new int [n];  readNextLine();  int sum=0;  for(int i=0; i<n; i++)  {  int a=NextInt();  p[i]=a;  sum+=a;  }  Arrays.sort(p);  int my=0;   for(int i=n-1; i>=0; i--)  {  my+=p[i];  ret++;  if(my*2>sum)break;  }   System.out.println(ret);   closeInput();  } }
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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    String arr1[] = new String[n];    String arr2[] = new String[n];    int i, j, count = 0;    for (i = 0; i < n; i++) {     arr1[i] = in.nextString();    }    for (i = 0; i < n; i++) {     arr2[i] = in.nextString();     for (j = 0; j < n; j++) {      if (arr2[i].equals(arr1[j])) {       arr1[j] = "";       count++;       break;      }     }    }    out.println(n - count);   }  }  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 String nextString() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     if (Character.isValidCodePoint(c)) {      res.appendCodePoint(c);     }     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   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 close() {    writer.close();   }   public void println(int i) {    writer.println(i);   }  } }
5	public class Main {  protected static final double EPS = 1e-11;  private static StreamTokenizer in;  private static Scanner ins;  private static PrintWriter out;  protected static final Double[] BAD = new Double[]{null, null};  private boolean[][] layouts;  private int c;  private int b;  private int a;  private String word;  public static void main(String[] args) {   try {    in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));    ins = new Scanner(new BufferedReader(new InputStreamReader(System.in)));    out = new PrintWriter(System.out);    try {     if (System.getProperty("xDx") != null) {      in = new StreamTokenizer(new BufferedReader(new FileReader("input.txt")));      ins = new Scanner(new FileReader("input.txt"));      out = new PrintWriter(new FileWriter("output.txt"));     }    } catch (Exception e) {     in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));     ins = new Scanner(new BufferedReader(new InputStreamReader(System.in)));     out = new PrintWriter(System.out);    }    new Main().run();   } catch (Throwable e) {    throw new RuntimeException(e);   } finally {    out.close();   }  }  private int nextInt() throws IOException {   in.nextToken();   return (int) in.nval;  }  private long nextLong() throws IOException {   in.nextToken();   return (long) in.nval;  }  private double nextDouble() throws IOException {   in.nextToken();   return in.nval;  }  private String nextString() throws IOException {   in.nextToken();   return in.sval;  }  private char nextChar() throws IOException {   in.nextToken();   return (char) in.ttype;  }  private void run() throws Exception {     solve();  }  private void solve() throws IOException {   int n = ins.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = ins.nextInt();   }   Map<Long, Integer> map = new HashMap<>();   BigInteger res = BigInteger.ZERO;   long sum = 0;   long amount = 0;   for (int i = n - 1; i >= 0; i--) {    long cur = a[i];    Pair same = getZeroAmount(cur, map);    res = res.add(BigInteger.valueOf((sum - same.sum) - cur * (amount - same.amount)));    amount++;    sum += cur;    map.put(cur, map.getOrDefault(cur, 0) + 1);   }   out.println(res);  }  class Pair {   long amount;   long sum;   public Pair(long amount, long sum) {    this.amount = amount;    this.sum = sum;   }  }  private Pair getZeroAmount(long cur, Map<Long, Integer> map) {   long amount = 0;   long sum = 0;   for (long i = cur - 1; i <= cur + 1; i++) {    long amountI = map.getOrDefault(i, 0);    amount += amountI;    sum += amountI * i;   }   return new Pair(amount, sum);  }  private List<Integer> iterate(List<Integer> a) {   ArrayList<Integer> b = new ArrayList<>();   int prev = -1;   for (int x : a) {    if (x == prev) {     b.add(x);    } else {     prev = x;    }   }   return b;  }  private long gcd(long a, long b) {   while (a > 0 && b > 0) {    long k = a % b;    a = b;    b = k;   }   return a | b;  } }
0	public class Subtractions {  public static void main(String[] args) {   InputReader r = new InputReader(System.in);   int n = r.nextInt();   while (n-- > 0) {    int a = r.nextInt();    int b = r.nextInt();    int res = 0;    while (a > 0 && b > 0) {     if (a > b) {      int div = a / b;      a -= div * b;      res += div;     } else {      int div = b / a;      b -= div * a;      res += div;     }    }    System.out.println(res);   }  }  static class InputReader {   private BufferedReader reader;   private StringTokenizer tokenizer;   public InputReader(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());   }  } }
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();  } }
1	public class Main implements Runnable { StreamTokenizer ST;  PrintWriter out;  BufferedReader br;  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)));     ST = new StreamTokenizer(br);    solve();    out.close();   br.close();     }    catch (IOException e) {     throw new IllegalStateException(e);    }  }  String code(int x) {  x--;  StringBuilder sb = new StringBuilder();  while (x>0) {   int c = x%26;   if (x<10) sb.append((char)(c+'0')); else sb.append((char)('A'+c-10));   x /= 26;  }  if (sb.length()==0) sb.append("0");  return sb.toString(); } StringBuilder sb = new StringBuilder(); public void solve() throws IOException {  int tt = Integer.parseInt(br.readLine());  HashMap<String, Integer> map = new HashMap<String, Integer>();  for (int i=1; i<=10; i++) map.put(code(i), i);  while (tt-->0) {   String s = br.readLine();   if (s.matches("^[A-Z]+[0-9]+$")) {    int t = 0;    while (Character.isLetter(s.charAt(t))) t++;    int r = Integer.parseInt(s.substring(t));    s = s.substring(0, t);    int res = 0;    for (int c:s.toCharArray()) {     res *= 26;     res += c-'A'+1;    }    out.println("R"+r+"C"+res);   } else {    int t = s.indexOf('C');    int c = Integer.parseInt(s.substring(1, t));    int r = Integer.parseInt(s.substring(t+1));       sb.setLength(0);    while (r>0) {     r--;     int ch = r%26;     sb.append((char)('A'+ch));     r /= 26;    }    sb = sb.reverse();    out.println(sb+""+c);   }    }    } }
0	public class A {  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter out;   public void solve() throws IOException {    long A = nextLong();  long B = nextLong();   long ans = 0;  while(A > 0){  if(A >= B){   ans += A/B;   A %= B;   if(A == 0) break;  }  else{   long tmp = A; A = B; B = tmp;  }   }   out.println(ans); }   public static void main(String[] args) {  new A().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();  } }
1	public class Main {    public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[] nums = new int[n];   int kisu = 0;   int gusu = 0;   for(int i = 0 ; i < n ; i++){    nums[i] = sc.nextInt();    if(nums[i] % 2 == 0)gusu++;    if(nums[i] % 2 == 1)kisu++;   }   int ans = -1;   if(gusu == 1){    for(int i = 0 ; i < n ; i++){     if(nums[i]%2 == 0){      ans = i+1;      break;     }    }   }   else{    for(int i = 0 ; i < n ; i++){     if(nums[i]%2 == 1){      ans = i+1;      break;     }    }      }   System.out.println(ans);  } }
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();   }  }      }
5	public class ProblemA {  public static class Team {   int solved;   int penalty;   Team(int s, int p) {    solved = s;    penalty = p;   }  }   public static void main(String[] args) throws IOException {   BufferedReader s = new BufferedReader(new InputStreamReader(System.in));   String[] data = s.readLine().split(" ");   int n = Integer.valueOf(data[0]);   int k = Integer.valueOf(data[1]);      Team[] t = new Team[n];   for (int i = 0 ; i < n ; i++) {    String[] line = s.readLine().split(" ");    t[i] = new Team(Integer.valueOf(line[0]), Integer.valueOf(line[1]));   }   Arrays.sort(t, new Comparator<Team>(){    public int compare(Team arg0, Team arg1) {     if (arg0.solved != arg1.solved) {      return arg1.solved - arg0.solved;     }     return arg0.penalty - arg1.penalty;    }   });        int idx = k - 1;   int ksol = t[idx].solved;   int kpen = t[idx].penalty;   int count = 0;   for (int i = 0 ; i < n ; i++) {    if (t[i].solved == ksol && t[i].penalty == kpen) {     count++;    }   }   System.out.println(count);  } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    char[] poks = in.next().toCharArray();    boolean[] was = new boolean[52];    for (int i = 0; i < n; i++) {     if (Character.isLowerCase(poks[i])) {      was[poks[i] - 'a'] = true;     } else {      was[poks[i] - 'A' + 26] = true;     }    }    int count = 0;    for (int i = 0; i < 52; i++) {     count += was[i] ? 1 : 0;    }    int[] vis = new int[52];    int pre = 0;    int chr = 0;    int ans = Integer.MAX_VALUE;    for (int i = 0; i < n; i++) {     int pos = poks[i] - 'a';     if (Character.isUpperCase(poks[i])) {      pos = poks[i] - 'A' + 26;     }     if (vis[pos] == 0) {      chr++;     }     vis[pos]++;     while (chr == count) {      ans = Math.min(ans, i - pre + 1);      pos = poks[pre] - 'a';      if (Character.isUpperCase(poks[pre])) {       pos = poks[pre] - 'A' + 26;      }      vis[pos]--;      if (vis[pos] == 0) chr--;      pre++;     }    }    out.println(ans);   }  }  static 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 int nextInt() {    return Integer.parseInt(next());   }  } }
2	public class bender {  static long[] dx = new long[]{0, 1, 0, -1};  static long[] dy = new long[]{-1, 0, 1, 0};  static long n, x, y, c;   public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));        StringTokenizer dxdync = new StringTokenizer(in.readLine());   n = Long.parseLong(dxdync.nextToken());   x = Long.parseLong(dxdync.nextToken());   y = Long.parseLong(dxdync.nextToken());   c = Long.parseLong(dxdync.nextToken());     long a = 0;   long b = c;     while(a < b){    long m = (a + b)/2;       long[] dxn = new long[4];    long[] dyn = new long[4];       for(int d = 0; d < 4; d++){     dxn[d] = x + dx[d] * m;     dyn[d] = y + dy[d] * m;    }       long ret = (m+1)*(m+1) + m*m;       ret -= h(1 - dyn[0]);    ret -= h(dyn[2] - n);    ret -= h(dxn[1] - n);    ret -= h(1 - dxn[3]);       ret += q(1 - dyn[0] - (n-x+1));    ret += q(1 - dyn[0] - x);    ret += q(dyn[2] - n - (n - x + 1));    ret += q(dyn[2] - n - (x));       if (ret < c) a = m + 1;    else b = m;   }     System.out.println(a);  }   public static long h(long x) {   if (x <= 0) return 0;   return 2*q(x) - x;  }  private static long q(long x){   if (x <= 0) return 0;   return x*(x+1)/2;  } }
1	public class B {   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());    StringTokenizer st = new StringTokenizer(bf.readLine());    Integer[] a = new Integer[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());    Arrays.sort(a);    int[] b = new int[n];    for(int i=0; i<n; i++) b[i] = a[i].intValue();    boolean diff = false;    boolean diff2 = false;    Set<Integer> vals = new HashSet<Integer>();    vals.add(b[0]);    int valval = 0;    for(int i=1; i<n; i++) {     vals.add(b[i]);     if(b[i] == b[i-1]) {      if(!diff) {       diff = true;       valval = b[i];      }      else diff2 = true;     }    }    long sum = 0;    for(int i : b) sum += i;    sum -= 1L*n*(n-1)/2;    if(diff && !diff2) {     if(!vals.contains((valval-1)) && (valval > 0)) {      if(sum%2 == 0) out.println("cslnb"); else out.println("sjfnb");     }     else out.println("cslnb");    }    else if(diff2) out.println("cslnb");    else if(sum%2 == 0) out.println("cslnb"); else out.println("sjfnb");             out.close(); System.exit(0);   }  }
5	public class C{  public static void main(String args[]) {  Scanner in = new Scanner(System.in);  int n=in.nextInt(),key=in.nextInt(),ans=0;  int[] a = new int[101], b = new int[101];  for (int i=1;i<=n;i++) {a[i]=in.nextInt();b[i]=in.nextInt();}  for (int i=1;i<n;i++)  for (int j=i+1;j<=n;j++)   if (a[i]<a[j] || (a[i]==a[j] && b[i]>b[j])) {  int yed = a[i];a[i]=a[j];  a[j]=yed;  yed = b[i];b[i]=b[j];b[j]=yed;   }  int k=0;     for (int i=1;i<=n;i++) {  if (a[i]==a[i-1] && b[i]==b[i-1]) k++; else   {if (i>key && ans==0) ans = k;k=1;}    }  if (ans == 0) ans = k;  System.out.println(ans);   } }
0	public class Sasha1113A {   static int solution(int n, int v){    int count;    if(v>=n)     return n-1;    else{     count = (v-1) + ((n-v)*(n-v+1))/2;    }    return count;   }   public static void main(String[] args){    Scanner scan = new Scanner(System.in);    int n = scan.nextInt();    int v = scan.nextInt();    System.out.print(solution(n, v));   }  }
0	public class ex5 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String S [] = new String[3];  int m=0,s=0,p=0; int temp=0;  for (int i = 0; i < S.length; i++) {  S[i]=scan.next();  if(S[i].indexOf('m')!=-1) m++;  if(S[i].indexOf('s')!=-1) s++;  if(S[i].indexOf('p')!=-1) p++; }   int n1 = Integer.parseInt(S[0].substring(0,1)); int n2 = Integer.parseInt(S[1].substring(0,1)); int n3 = Integer.parseInt(S[2].substring(0,1));     int d3 = Math.abs(n1-n2);  int d4 = Math.abs(n1-n3);  int d5 = Math.abs(n2-n3);    if(m==3||s==3||p==3) {    if(d3==1&d5==1&d4==2||d3==1&d4==1&d5==2||d5==1&d4==1&d3==2)  System.out.println(0);  else   if(d3==0&d4==0) System.out.println(0);  else   if(d3<d5&d3<d4) {   if(d3==1||d3==2||d3==0) System.out.println(1);    else     System.out.println(2);   }  else if (d5<d4&d5<d3){   if(d5==1||d5==2||d5==0) System.out.println(1);   else     System.out.println(2);  }  else if(d4<d5&d4<d3) {   if(d4==1||d4==2||d4==0) System.out.println(1);   else     System.out.println(2);  }  else if(d3==2&d5==2||d4==2&d5==2||d3==2&d4==2||d3==1&d5==1||d4==1&d5==1||d3==2&d4==1)   System.out.println(1);  else System.out.println(2);              }  if(m==2||s==2||p==2) {      char c1 = S[0].charAt(1);  char c2 = S[1].charAt(1);  char c3 = S[2].charAt(1);     if(c1==c2) {  if(n1==n2) System.out.println(1);  else if(d3==1||d3==2) System.out.println(1);  else System.out.println(2);  }  if(c1==c3) {  if(n1==n3) System.out.println(1);  else if(d4==1||d4==2) System.out.println(1);  else System.out.println(2);  }  if(c2==c3) {  if(n2==n3) System.out.println(1);  else if(d5==1||d5==2) System.out.println(1);  else System.out.println(2);  } }  if(m==1&s==1&p==1) System.out.println(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);   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 A23 {  public static void main(String[] args){ Scanner sc = new Scanner(System.in); char[] input = sc.nextLine().toCharArray(); int[][] dyn = new int[input.length][input.length]; int max = 0; for(int a = 0; a < input.length; a++) {  for(int b = a + 1; b < input.length; b++) {  if(input[a] == input[b]) {   int prev = (a == 0) ? 0 : dyn[a-1][b-1];   dyn[a][b] = prev + 1;   max = (dyn[a][b] > max) ? dyn[a][b] : max;  }  } } System.out.println(max);  } }
2	public class B {  static Scanner in; static int next() throws Exception {return in.nextInt();};   static PrintWriter out;  public static long count(long k, long x, long y, long n) {   long sum = 2*k*(k+1)+1;   if (k >= x-1) {    sum -= (k-x+1)*(k-x+1);   }   if (k >= y-1) {    sum -= (k-y+1)*(k-y+1);   }   if (k + x >= n) {    sum -= (k+x-n)*(k+x-n);   }   if (k + y >= n) {    sum -= (k+y-n)*(k+y-n);   }   if (k > x+y-1) {    sum += ((k+1-x-y)*(k+1-x-y+1))/2;   }   if (k > n-x+y) {    sum += ((k+x-n-y)*(k+x-n-y+1))/2;   }   if (k > n-y+x) {    sum += ((k+y-n-x)*(k+y-n-x+1))/2;   }   if (k > 2*n-x-y+1) {    sum += ((k-2*n+x+y-1)*(k-2*n+x+y))/2;   }   return sum;  }  public static void main(String[] args) throws Exception {   in = new Scanner(System.in);    out = new PrintWriter(System.out);   long n = in.nextLong(), x = in.nextLong(), y = in.nextLong(), c = in.nextLong();   long res = 0;   while (count(res, x, y, n) < c) res++;   out.println(res);    out.println();   out.close();  } }
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;  } } }
6	public class A {  static MyScanner sc;  static PrintWriter pw;  public static void main(String[] args) throws Throwable {   sc = new MyScanner();   pw = new PrintWriter(System.out);   n = sc.nextInt();   int m = sc.nextInt();   int[][] a = new int[n][m];   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     a[i][j] = sc.nextInt();   val = new int[n][n];   for (int i = 0; i < n; i++)    Arrays.fill(val[i], Integer.MAX_VALUE);   for (int i = 0; i < n; i++)    for (int j = i; j < n; j++) {     for (int k = 0; k < m; k++)      val[i][j] = val[j][i] = Math.min(val[i][j], Math.abs(a[i][k] - a[j][k]));    }   val2 = new int[n][n];   for (int i = 0; i < n; i++)    Arrays.fill(val2[i], Integer.MAX_VALUE);   for (int i = 0; i < n; i++)    for (int j = 0; j < n; j++) {     for (int k = 0; k < m - 1; k++)      val2[i][j] = Math.min(val2[i][j], Math.abs(a[i][k] - a[j][k + 1]));    }   mem = new Long[n][n][1 << n];   long ans = 0;   for (int i = 0; i < n; i++) {    ans = Math.max(ans, dp(i, i, 1 << i));   }   if (n == 1)    pw.println(val2[0][0]);   else    pw.println(ans);    pw.flush();   pw.close();  }  static int n;  static int[][] val, val2;  static Long[][][] mem;  static long dp(int st, int lst, int msk) {   int bits = Integer.bitCount(msk);   if (mem[st][lst][msk] != null)    return mem[st][lst][msk];   long ans = 0;   for (int i = 0; i < n; i++)    if ((msk & (1 << i)) == 0) {     int newMsk = (msk | (1 << i));     if (bits < n - 1)      ans = Math.max(ans, Math.min(val[lst][i], dp(st, i, newMsk)));     else      ans = Math.max(ans, Math.min(val[lst][i], val2[i][st]));    }   return mem[st][lst][msk] = ans;  }  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 A {  static InputStreamReader in = new InputStreamReader(System.in);  static BufferedReader bf = new BufferedReader(in);  static StreamTokenizer st = new StreamTokenizer(bf);  static Scanner sc = new Scanner(System.in);  static class Sort implements Comparable<Sort> {   int x, a;   public int compareTo(Sort arg0) {    if (this.x > arg0.x)     return 1;    return 0;   }  }  public static void main(String[] args) throws IOException {   int n = nextInt();   double t = nextInt();   Sort[] p = new Sort[n];   for (int i = 0; i < n; i++) {    p[i] = new Sort();    p[i].x = nextInt();    p[i].a = nextInt();   }   int ans = 2;   Arrays.sort(p);   for (int i = 1; i < p.length; i++) {    double k = p[i].x - p[i].a / 2.0 - p[i - 1].x - p[i - 1].a / 2.0;    if (t == k)     ans++;    else if (k > t)     ans += 2;   }   System.out.println(ans);  }  private static String nextString() throws IOException {   st.nextToken();   return st.sval;  }  private static int nextInt() throws IOException {   st.nextToken();   return (int) st.nval;  } }
3	public class TaskA {  public static void main(String[] args) {   FastReader in = new FastReader(System.in);   PrintWriter out = new PrintWriter(System.out);    int n = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }   Arrays.sort(a);   int ans = 1;   for (int i = 1; i < n; i++) {    boolean bb = false;    for (int j = i - 1; j >= 0; j--) {     if (a[i] % a[j] == 0) {      bb = true;      break;     }    }    if (!bb) ans++;   }   out.println(ans);     out.close();  }  static class FastReader {   BufferedReader br;   StringTokenizer st;   FastReader(InputStream is) {    br = new BufferedReader(new InputStreamReader(is));   }   Integer 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 s = "";    try {     s = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return s;   }  } }
2	public class l {               static int mod = (int) (1e9 + 7);   static StringBuilder sol;  static class pair implements Comparable<pair> {   int left, type;   double w;   public pair(int x, double y) {    left = x;    w = y;    type= 0;   }   public int compareTo(pair o) {    return Double.compare(w,o.w);   }   public String toString() {    return left + " " + w;   }  }  static class tri implements Comparable<tri> {   int st, end,len, side;   tri(int a, int b, int c,int d) {    st = a;    end = b;    len = c;    side=d;   }   public int compareTo(tri o) {    if (st == o.st) return end - o.end;    return st - o.st;   }   public String toString() {    return st + " " + end ;   }  }   static ArrayList<pair>[]adj;   static int n;  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);     PrintWriter pw = new PrintWriter(System.out);   int n = sc.nextInt();   int k = sc.nextInt();   int lo=0;   int hi=n;   int ans=0;   while (lo<=hi){    int mid=lo+hi>>1;    long rem= n-mid;    rem*=(rem+1);    rem/=2;    rem-=mid;       if (rem==k){     ans=mid;     break;    }    else if (rem>k){     lo=mid+1;    }    else hi=mid-1;   }   pw.println(ans);   pw.flush();  }  static long gcd(long a ,long b){   if (a==0)return b;   return gcd(b%a,a);  }     static class Scanner {   StringTokenizer st;   BufferedReader br;   public Scanner(FileReader r) {    br = new BufferedReader(r);   }   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();   }  } }
4	public class Problem {  public static Pair solve(Forest f, List<Pair> queue){  Pair current = null, next = null;  int index = 0;  while(queue.size() > 0){  current = queue.remove(0);  index = f.desk[current.x][current.y];   if(current.x>0){   next = new Pair(current.x-1,current.y);   if(f.desk[next.x][next.y]==0){    f.desk[next.x][next.y] = index+1;    queue.add(next);   }   }   if(current.x<f.N-1){   next = new Pair(current.x+1,current.y);   if(f.desk[next.x][next.y]==0){    f.desk[next.x][next.y] = index+1;    queue.add(next);   }   }   if(current.y>0){   next = new Pair(current.x,current.y-1);   if(f.desk[next.x][next.y]==0){    f.desk[next.x][next.y] = index+1;    queue.add(next);   }   }   if(current.y<f.M-1){   next = new Pair(current.x,current.y+1);   if(f.desk[next.x][next.y]==0){    f.desk[next.x][next.y] = index+1;    queue.add(next);   }   }  }  return f.findMax(); }  public static void main(String[] args){  String buffer = null;  StringTokenizer st = null;  Forest f = null;  List<Pair> pairs = new LinkedList<Pair>();  Integer N,M,K,x,y;  try {  BufferedReader in = new BufferedReader(    new FileReader("input.txt")    );  FileWriter out = new FileWriter("output.txt");  buffer = in.readLine();  st = new StringTokenizer(buffer);  N = new Integer(st.nextToken());  M = new Integer(st.nextToken());  f = new Forest(N,M);  buffer = in.readLine();  st = new StringTokenizer(buffer);  K = new Integer(st.nextToken());  buffer = in.readLine();  st = new StringTokenizer(buffer);  for(int i = 0; i<K; i++){   x = new Integer(st.nextToken());   y = new Integer(st.nextToken());   f.desk[x-1][y-1] = 1;   pairs.add(new Pair(x-1,y-1));  }  Pair res = solve(f,pairs);    out.write(res.toString());  out.flush();  } catch (Exception e) {  } } } class Pair { public Pair(int i, int j){  x = i;  y = j; } public String toString(){  return (x+1) + " " + (y+1); } public int x; public int y; } class Forest { public Forest(int n, int m){  N = n;  M = m;  desk = new int[N][M]; }  public Pair findMax(){  Pair max = new Pair(0,0);  for(int i = 0; i<N; i++){  for(int j = 0; j<M; j++){   if(desk[i][j]>desk[max.x][max.y]){   max.x = i;   max.y = j;   }  }  }  return max; }  public int N; public int M; public int[][] desk; }
0	public class HelloWorld {  InputReader input;  PrintWriter output;  BufferedReader inp;  void run(){   output = new PrintWriter(new OutputStreamWriter(System.out));   input = new InputReader(System.in);   inp = new BufferedReader(new InputStreamReader(System.in));   solve();   output.flush();  }  public static void main(String[] args){   new HelloWorld().run();  }   long stps;   long gcd(long a, long b) {   if(b == 0 || a == 0) {    return 0;   }   return a/b + gcd(b, a%b);  }   void solve() {   long a = input.readLong();   long b = input.readLong();   stps = gcd(a, b);   output.println(stps);  }      class node implements Comparable<node>{   int destination;   int direction;   int distance;     public node(int destination, int distance, int direction) {    this.direction = direction;    this.distance = distance;    this.destination = destination;   }     public int compareTo(node b) {    return this.distance - b.distance;   }  }   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 boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  }  }
6	public class Main implements Runnable { private void solution() throws IOException {  int n = in.nextInt();  int m = in.nextInt();  boolean[][] adj = new boolean[n][n];  long res = 0;  for (int i = 0; i < m; ++i) {  int x = in.nextInt();  int y = in.nextInt();  adj[x - 1][y - 1] = true;  adj[y - 1][x - 1] = true;  }  for (int i = 0; i < n; ++i) {  for (int j = i + 1; j < n; ++j) {   if (adj[i][j]) {   --res;   }  }  }  for (int i = 0; i < n; ++i) {  long[][] dp = new long[n - i][1 << (n - i)];  dp[0][0] = 1;  for (int mask = 0; mask < (1 << (n - i)); ++mask) {   for (int j = 0; j < n - i; ++j) {   if (dp[j][mask] != 0) {    for (int k = 0; k < n - i; ++k) {    if (((mask >> k) & 1) == 0 && adj[j + i][k + i]) {     dp[k][mask | (1 << k)] += dp[j][mask];    }    }   }   }   if (((mask >> 0) & 1) != 0) {   res += dp[0][mask];   }  }  }  out.println(res / 2); }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  private class Scanner {  BufferedReader reader;  StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  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 int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
4	public class Solution {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new FileReader("input.txt"));   PrintWriter out = new PrintWriter("output.txt");   String[] raw = in.readLine().split(" ");   int n = Integer.parseInt(raw[0]);   int m = Integer.parseInt(raw[1]);   int k = Integer.parseInt(in.readLine());   raw = in.readLine().split(" ");   boolean[][] map = new boolean[n][m];   LinkedList<Point> queue = new LinkedList<>();   for (int i = 0; i < k; i++) {    Point fireStarter = new Point(Integer.parseInt(raw[i * 2]) - 1, Integer.parseInt(raw[i * 2 + 1]) - 1);    queue.addLast(fireStarter);   }   int treesLeft = n * m;   while (true) {    Point firepoint = queue.removeFirst();    if (map[firepoint.x][firepoint.y])     continue;    treesLeft--;    map[firepoint.x][firepoint.y] = true;    if (treesLeft == 0) {     out.printf("%d %d", firepoint.x + 1, firepoint.y + 1);     out.flush();     return;    }    if (firepoint.x > 0 && !map[firepoint.x - 1][firepoint.y])     queue.add(new Point(firepoint.x - 1, firepoint.y));    if (firepoint.y > 0 && !map[firepoint.x][firepoint.y - 1])     queue.add(new Point(firepoint.x, firepoint.y - 1));    if (firepoint.x < n - 1 && !map[firepoint.x + 1][firepoint.y])     queue.add(new Point(firepoint.x + 1, firepoint.y));    if (firepoint.y < m - 1 && !map[firepoint.x][firepoint.y + 1])     queue.add(new Point(firepoint.x, firepoint.y + 1));       }  }  private static class Point {   public int x;   public int y;   public Point(int x, int y) {    this.x = x;    this.y = y;   }  } }
3	public class Colours {  public static void main(String args[] ) throws Exception {     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   String line = br.readLine();   int n = Integer.parseInt(line);   line = br.readLine();   String[] values = line.split(" ");   int[] arr = new int[n];   TreeSet<Integer> set = new TreeSet<>();   for (int i = 0; i < n; i++) {    arr[i] = Integer.parseInt(values[i]);    set.add(arr[i]);   }   int count=0;   TreeSet<Integer> copy = new TreeSet<>();        copy.addAll(set);   int prev = copy.size();     for(Integer i: set){       if(copy.size()==0){     break;    }    Iterator<Integer> iterator = copy.iterator();    while (iterator.hasNext()) {     Integer e = iterator.next();     if (e % i == 0) {      iterator.remove();     }    }    if(copy.size()!=prev){     count++;     prev = copy.size();    }          }      System.out.println(count);  } }
0	public class B {  public static void main(String[] args) throws Exception {   BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));     StringTokenizer st = new StringTokenizer(bf.readLine());     int n = Integer.parseInt(st.nextToken());   int m = Integer.parseInt(st.nextToken());   StringBuilder ans1 = new StringBuilder();   StringBuilder ans2 = new StringBuilder();   for(int i=0; i<2229; i++) ans1.append('5');   ans1.append('6');   for(int i=0; i<2230; i++) ans2.append('4');   out.println(ans1.toString());   out.println(ans2.toString());   out.close(); System.exit(0);  } }
5	public class A {  public A () throws IOException {  int N = sc.nextInt();  int [] A = new int [N];  for (int n = 0; n < N; ++n)  A[n] = sc.nextInt();  solve(N, A); }  public void solve (int N, int [] A) {   Arrays.sort(A);  int S1 = 0;  for (int n = 0; n < N; ++n)  S1 += A[n];   int S2 = 0;  for (int n = N - 1; n >= 0; --n) {  S2 += A[n];  if (S2 > S1 - S2)   exit(N - n);  } }    static MyScanner sc; static long t;  static void print (Object o) {  System.out.println(o); }  static void exit (Object o) {  print(o);   System.exit(0); }  static void run () throws IOException {  sc = new MyScanner ();  new A(); }  public static void main(String[] args) throws IOException {  run(); }  static long millis() {  return System.currentTimeMillis(); }  static void start() {  t = millis(); }  static class MyScanner {  String next() throws IOException {  newLine();  return line[index++];  }   int nextInt() throws IOException {  return Integer.parseInt(next());  }   String nextLine() throws IOException {  line = null;  return r.readLine();  }     private final BufferedReader r;  MyScanner () throws IOException {  this(new BufferedReader(new InputStreamReader(System.in)));  }   MyScanner(BufferedReader r) throws IOException {   this.r = r;  newLine();  }   private String [] line;  private int index;  private void newLine() throws IOException {  if (line == null || index == line.length) {   line = r.readLine().split(" ");   index = 0;  }  }  } }
2	public class B { static long sum(long from, long to){  final long d = to - from;  return (d*(d + 1))/2 + (d + 1)*from; } static long howMany(long n, long k){  if (n == 1){  return 0;  }  if (n > (k*(k - 1))/2 + 1){  return -1;  }  long hi = k - 1;  long lo = 1;  while (lo < hi){  final long mi = (lo + hi + 1) >> 1;  final long sum = sum(mi, k - 1);  if (n - 1 - sum < mi){   lo = mi;  }else{   hi = mi - 1;  }  }  long res = k - lo;  final long sum = sum(lo, k - 1);  if (n - 1 - sum > 0){  res++;  }  return res; } public static void main(String [] args){  try (Scanner s = new Scanner(System.in)){  final long n = s.nextLong();  final long k = s.nextLong();  System.out.println(howMany(n, k));  } } }
4	public class FireAgain {  Point[] coordinate; Queue<Point> q = new LinkedList<>();  boolean[][] vis; PrintStream out; int x, y;  boolean distance(Point word1, Point word2) {  if (Math.abs(word1.x - word2.x) == 1 && Math.abs(word1.y - word2.y) == 1)  return false;  if (Math.abs(word1.x - word2.x) == 1 && word1.y == word2.y)  return true;  if (word1.x == word2.x && Math.abs(word1.y - word2.y) == 1)  return true;  return false; }  void bfs(Point s) {  while (!q.isEmpty()) {  s = q.poll();   Point p = new Point();  p.x = s.x - 1;  p.y = s.y;   if (p.x >= 1 && p.x <= x && p.y >= 1 && p.y <= y) {   if (!vis[p.x][p.y]) {   vis[p.x][p.y] = true;   q.add(p);   }  }   p = new Point();  p.x = s.x + 1;  p.y = s.y;   if (p.x >= 1 && p.x <= x && p.y >= 1 && p.y <= y) {   if (!vis[p.x][p.y]) {   vis[p.x][p.y] = true;   q.add(p);   }  }   p = new Point();  p.x = s.x;  p.y = s.y - 1;   if (p.x >= 1 && p.x <= x && p.y >= 1 && p.y <= y) {   if (!vis[p.x][p.y]) {   vis[p.x][p.y] = true;   q.add(p);   }  }    p = new Point () ;  p.x = s.x ;  p.y = s.y + 1;    if (p.x >= 1 && p.x <= x && p.y >= 1 && p.y <= y) {   if (!vis[p.x][p.y]) {   vis[p.x][p.y] = true ;   q.add(p);      }  }   if (q.size() == 0)   out.print(s.x + " " + s.y);  }  }  public static void main(String[] args) throws FileNotFoundException {    FireAgain F = new FireAgain();  Scanner in = new Scanner (new FileReader("input.txt"));  F.out = new PrintStream(new File("output.txt"));   F.x = in.nextInt();  F.y = in.nextInt();  int l = 0;  F.vis = new boolean[F.x + 1][F.y + 1];  int k = in.nextInt();  for (int i = 0; i < k; i++) {  Point P = new Point(in.nextInt(), in.nextInt());  F.vis[P.x][P.y] = true;   F.q.add(P);  }  F.bfs(F.q.peek());  } }
2	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   long n = in.nextLong();   long k = in.nextLong();   long disc = (long)(Math.sqrt(9 - 4 * (-2 * n - 2 * k)));   long x = (-3 + disc) / 2;   System.out.println(n - x);  } }
3	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = sc.nextInt();   }   Arrays.sort(a);   Set<Integer> div = new HashSet<>();   boolean[] d = new boolean[n];   for (int i = 0; i < n; i++) {    for (int j = 0 ; j < n; j++) {     if (d[j]) {      continue;     }     if (a[j]%a[i] == 0) {      d[j] = true;      div.add(a[i]);     }    }   }   System.out.println(div.size());  } }
4	public class Main { static int[] di = {-1,0,1,0}; static int[] dj = {0,1,0,-1}; public static void main(String[] args) throws IOException  {  Scanner sc = new Scanner("input.txt");  PrintWriter out = new PrintWriter("output.txt");  Queue<Pair> q = new LinkedList<Pair>();  int n = sc.nextInt(),m = sc.nextInt() , k = sc.nextInt();  boolean [][] vis = new boolean[n][m];  while(k-->0)  q.add(new Pair(sc.nextInt()-1,sc.nextInt()-1));   int ansX = 1 , ansY = 1;   while(!q.isEmpty())  {  Pair cur = q.poll();  if(vis[cur.i][cur.j])continue;  ansX = cur.i ; ansY = cur.j;  vis[cur.i][cur.j] = true;  for (int i = 0; i < di.length; i++) {   int ni = cur.i + di[i] , nj = cur.j + dj[i];   if(ni>=0 && ni<n && nj>=0 && nj<m && !vis[ni][nj])   q.add(new Pair(ni,nj));  }  }   out.append(++ansX+" "+ ++ansY);  out.flush();   } static class Pair {  int i,j;  public Pair(int a,int b) {  i = a; j = b;  } }  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 String nextLine() throws IOException {return br.readLine();}   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();} }  }
0	public class A {  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  long n = s.nextLong();  if(n >= 0)   System.out.println(n);  else {   String str = ("" + n).substring(1);   if(str.length() == 1)   System.out.println("-" + str);   else {   long one = Long.parseLong(str.substring(0, str.length()-1));   long two = Long.parseLong(str.substring(0, str.length()-2) + str.substring(str.length()-1));   if(one > two)    System.out.println((two!=0?"-":"") + two);   else    System.out.println((one!=0?"-":"") + one);   }  }  } }
5	public class A {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int a = in.nextInt();   int b = in.nextInt();   int[] ar = new int[n];   for (int i = 0; i < n; i++)    ar[i] = in.nextInt();   Arrays.sort(ar);   int x1 = ar[b-1];   int x2 = ar[b];   System.out.println(x2-x1);  } }
3	public class ProblemF_2 {  public static InputStream inputStream = System.in;  public static OutputStream outputStream = System.out;  public static void main(String[] args) {   MyScanner scanner = new MyScanner(inputStream);   PrintWriter out = new PrintWriter(outputStream);   int n = scanner.nextInt();   List<Integer> list = new ArrayList<>();   for (int i = 0; i < n; i++) {    list.add(scanner.nextInt());   }   Map<Integer, List<Pair<Integer, Integer>>> map = new HashMap<>();   for (int i = n - 1; i >= 0; i--) {    int x = 0;    for (int j = i; j >= 0; j--) {     x = x + list.get(j);     if (!map.containsKey(x)) {      map.put(x, new ArrayList<>());     }     map.get(x).add(new Pair<>(j + 1, i + 1));    }   }   List<Pair<Integer, Integer>> ans = new ArrayList<>();   for (Map.Entry<Integer, List<Pair<Integer, Integer>>> entry : map.entrySet()) {    List<Pair<Integer, Integer>> segments = entry.getValue();    Collections.reverse(segments);    List<Pair<Integer, Integer>> result = new ArrayList<>();    result.add(segments.get(0));    for (int i = 1; i < segments.size(); i++) {     if (segments.get(i).first > result.get(result.size() - 1).second) {      result.add(segments.get(i));     }    }    if (result.size() > ans.size()) {     ans = result;    }   }   out.println(ans.size());   for (Pair<Integer, Integer> pair : ans) {    out.println(pair.first + " " + pair.second);   }    out.flush();  }  private static class MyScanner {   private BufferedReader bufferedReader;   private StringTokenizer stringTokenizer;   private MyScanner(InputStream inputStream) {    bufferedReader = new BufferedReader(new InputStreamReader(inputStream));   }   private String next() {    while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {     try {      stringTokenizer = new StringTokenizer(bufferedReader.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return stringTokenizer.nextToken();   }   private int nextInt() {    return Integer.parseInt(next());   }   private long nextLong() {    return Long.parseLong(next());   }   private double nextDouble() {    return Double.parseDouble(next());   }   private String nextLine() {    String str = "";    try {     str = bufferedReader.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  }  private static class Pair<F, S> {   private F first;   private S second;   public Pair() {}   public Pair(F first, S second) {    this.first = first;    this.second = second;   }  } }
5	public class Main { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tokenizer=null;  public static void main(String[] args) throws IOException {  new Main().execute(); }  void debug(Object...os) {  System.out.println(Arrays.deepToString(os)); }  int ni() throws IOException {  return Integer.parseInt(ns()); }  long nl() throws IOException  {  return Long.parseLong(ns()); }  double nd() throws IOException  {  return Double.parseDouble(ns()); }   String ns() throws IOException  {  while (tokenizer == null || !tokenizer.hasMoreTokens())   tokenizer = new StringTokenizer(br.readLine());  return tokenizer.nextToken(); }  String nline() throws IOException {  tokenizer=null;  return br.readLine(); }     int totalCases, testNum;  int sum; int n; int arr[];  void execute() throws IOException {  totalCases = 1;  for(testNum = 1; testNum <= totalCases; testNum++)  {  if(!input())   break;  solve();  } }  void solve() throws IOException {  Arrays.sort(arr);  int count = 0;  int ans = 0;  for(int i = n-1;i>=0;i--)  {  count+= arr[i];  if(count>sum-count)  {   ans = n-i;   break;  }  }  System.out.println(ans); }   boolean input() throws IOException {  n = ni();  sum = 0;  arr = new int[n];  for(int i = 0;i<n;i++)  {  arr[i] = ni();  sum = sum+arr[i];  }  return true; }  }
6	public class Main {  public static class Pair implements Comparable<Pair> {   int k, x;   public Pair(int k) {    this.k = k;   }   public void update(int x) {    this.x = Math.max(this.x, x);   }   public int compareTo(Pair other) {    if (x != other.x) {     return other.x - x;    }    return k - other.k;   }  }  public static int sum(int[] arr) {   int sum = 0;   for (int x : arr) {    sum += x;   }   return sum;  }  public static int[] join(int[] a, int[] b) {   int n = a.length;   int[] best = new int[n];   int sum = 0;   for (int shift = 0; shift < n; shift++) {    int[] curr = new int[n];    for (int i = 0; i < n; i++) {     curr[i] = Math.max(a[i], b[(i + shift) % n]);    }    int now = sum(curr);    if (now > sum) {     sum = now;     best = curr;    }   }   return best;  }  public static int n;  public static int[] pow;  public static int[][] dp, real;  public static void calc(int mask) {   int[] best = new int[n];   int sum = 0;   for (int i = 0; i < n; i++) {    if ((mask & pow[i]) != 0) {     int to = mask ^ pow[i];     int[] init = new int[n];     for (int j = 0; j < n; j++) {      init[j] = real[j][i];     }     int[] curr = join(dp[to], init);     int s = sum(curr);     if (s > sum) {      sum = s;      best = curr;     }    }   }   dp[mask] = best;  }  public static void main(String[] args) {   pow = new int[15];   pow[0] = 1;   for (int i = 1; i < pow.length; i++) {    pow[i] = pow[i - 1] * 2;   }   Scanner in = new Scanner(System.in);   int t = in.nextInt();   for (int i = 0; i < t; i++) {    n = in.nextInt();    int m = in.nextInt();    int[][] arr = new int[n][m];    for (int j = 0; j < n; j++) {     for (int k = 0; k < m; k++) {      arr[j][k] = in.nextInt();     }    }    Pair[] best = new Pair[m];    for (int j = 0; j < m; j++) {     best[j] = new Pair(j);     for (int k = 0; k < n; k++) {      best[j].update(arr[k][j]);     }    }    Arrays.sort(best);    real = new int[n][n];    for (int j = 0; j < n; j++) {     for (int k = 0; k < Math.min(n, m); k++) {      real[j][k] = arr[j][best[k].k];     }    }    dp = new int[1 << n][];    Stack<Integer>[] min = new Stack[n + 1];    for (int j = 0; j <= n; j++) {     min[j] = new Stack<>();    }    for (int j = 0; j < dp.length; j++) {     int cnt = 0;     for (int k = 0; k < n; k++) {      if ((j & pow[k]) != 0) {       cnt++;      }     }     min[cnt].add(j);    }    for (int j = 0; j < min.length; j++) {     for (int x : min[j]) {      if (j == 0) {       dp[x] = new int[n];      } else {       calc(x);      }     }    }    System.out.println(sum(dp[dp.length - 1]));   }  } }
3	public class Main { public static void main(String[] args){  long MOD = 1000000007;  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  long[][]dp = new long[n][5010];  char[] program = new char[n];   for(int i = 0; i < n; i++){  program[i] = sc.next().charAt(0);  }   dp[0][0] = 1;   long[] acc = new long[5010];   acc[0] = 1;   for(int i = 1 ; i < n; i++){  for(int j = 0; j< 5010; j++){   if(program[i-1] == 'f'){   if(j - 1 >= 0){    dp[i][j] = dp[i-1][j-1];   }   }else{   dp[i][j] = acc[j];   }  }  acc[5009] = dp[i][5009];  for(int j = 5008; j >= 0; j--){   acc[j] = (acc[j + 1] + dp[i][j]) % MOD;  }  }  System.out.println(acc[0]); } }
0	public class A {  BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof;  void solve() throws IOException {  String s = nextToken();  int res = Integer.parseInt(s);   String s1 = s.substring(0, s.length() - 1);  res = Math.max(res, Integer.parseInt(s1));   String s2 = s.substring(0, s.length() - 2) + s.charAt(s.length() - 1);  res = Math.max(res, Integer.parseInt(s2));   out.println(res); }  A() 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 A(); }  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{  public static void main(String[] Args) throws Exception {   Scanner sc = new Scanner(new FileReader("input.txt"));   int n,m,k;   Integer lx,ly;   boolean d[][];   n = sc.nextInt(); m = sc.nextInt(); k = sc.nextInt();   d = new boolean [n+1][m+1];   for(int i=0;i<=n;++i)   for(int j=0;j<=m;++j)   d[i][j]=false;     Queue< pair > q = new LinkedList< pair >();   lx = ly = -1;   for(int i=0;i<k;++i){   int x,y; x = sc.nextInt(); y = sc.nextInt();   q.add(new pair(x,y)); lx = x; ly = y;   d[x][y]=true;   }     int dx [] = {0,0,1,-1};   int dy [] = {-1,1,0,0};        while(!q.isEmpty()){    pair tp = q.remove();    int x = tp.x; int y = tp.y;    for(int i=0;i<4;++i){     int nx = x+dx[i]; int ny = y+dy[i];     if(nx<1 || nx>n || ny<1 || ny>m || d[nx][ny] ) continue;     d[nx][ny]=true;     q.add(new pair(nx,ny));     lx = nx; ly = ny;    }   }   FileWriter fw = new FileWriter("output.txt");   fw.write(lx.toString()); fw.write(" "); fw.write(ly.toString());;   fw.flush();    } } class pair {  public int x,y; public pair(int _x,int _y){ x = _x; y = _y; } }
2	public class B {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);   long n = sc.nextInt(), k = sc.nextInt();     long start = 1, end = n;   while(start <= end) {  long mid = (start + end) >> 1;  if(calc(mid) - (n - mid) == k) {   System.out.println(n - mid);   return;  } else if (calc(mid) - (n - mid) > k) {   end = mid - 1;  } else {   start = mid + 1;  }    }   }  public static long calc(long n) {  return (n * n + n) / 2; } }
2	public class CF1195B {  private static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  private static BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));  private static StringTokenizer st;  public static void main(String[] args) throws Exception {   st = new StringTokenizer(reader.readLine());   long n = Long.parseLong(st.nextToken());   long k = Long.parseLong(st.nextToken());   long put = (-3 + (long)Math.sqrt((long)9 + 8 * k + 8 * n)) / 2;   long eat = n - put;   writer.write(Long.toString(eat));   writer.newLine();   writer.flush();  } }
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();  } }
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];  boolean []used = new boolean[n];  for (int i = 0; i < n; i++) {  a[i] = sc.nextInt();  }  Arrays.sort(a);  int ans = 0;  for (int i = 0; i < used.length; i++) {  if (!used[i]){   ans++;   for (int j = i; j < used.length; j++) {   if (a[j]%a[i] == 0){   used[j] = true;   }   }  }  }  System.out.print(ans); } }
0	public class CodeForces {  public static void main(String[] args) throws IOException,NumberFormatException{  try {  FastScanner sc=new FastScanner();  int t=sc.nextInt();  while(t-->0) {   int a=sc.nextInt(),b=sc.nextInt();   int count=0;   while(a!=0&&b!=0) {   if(a>b) {    int temp=a;    a=b;    b=temp;   }    count+=(b/a);    b=b%a;   }   System.out.println(count);  }     }  catch(Exception e) {  return ;  }  }   public 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) {}  return st.nextToken();  }   int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }   } }
1	public class R025A { int n; int[] nums; public R025A() {  Scanner scanner = new Scanner(System.in);  n = scanner.nextInt();  nums = new int[n];  for(int i=0; i<n; i++) {  nums[i] = scanner.nextInt();  } }  private void process() {  int[] c = new int[2];  int[] r = new int[2];  for(int i=0; i<n; i++) {  c[nums[i] % 2]++;  if(r[nums[i] %2] == 0) {   r[nums[i] % 2] = i+1;  }  }  System.out.println(r[c[0]==1 ? 0 : 1]); }  public static void main(String[] args) {  new R025A().process(); } }
4	public class D {  private static ArrayDeque<Integer>[][] edge;  private static long[][] dp[],w1,w2;  private static int N,M,K;  private static void answer()  {   StringBuilder sb=new StringBuilder();   for(int i=0;i<N;i++)   {    for (int j = 0; j < M; j++) sb.append(dp[i][j][K]).append(" ");    sb.append("\n");   }   System.out.println(sb);  }  private static long solve(int i, int j, int pos)  {   if(pos==0) return 0;   if(dp[i][j][pos]!=-1) return dp[i][j][pos];   long a=Long.MAX_VALUE/100;   if(i-1>=0) a=Math.min(a,solve(i-1,j,pos-1)+w2[i-1][j]);   if(i<N-1) a=Math.min(a,solve(i+1,j,pos-1)+w2[i][j]);   if(j-1>=0) a=Math.min(a,solve(i,j-1,pos-1)+w1[i][j-1]);   if(j<M-1) a=Math.min(a,solve(i,j+1,pos-1)+w1[i][j]);   return dp[i][j][pos]=a;  }  public static void main(String[] args) throws Exception  {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   int i;   String[] s=br.readLine().trim().split(" ");   N=Integer.parseInt(s[0]);   M=Integer.parseInt(s[1]);   K=Integer.parseInt(s[2]);   edge=new ArrayDeque[N][M];   for(i=0;i<N;i++)   {    for(int j=0;j<M;j++)     edge[i][j]=new ArrayDeque<>();   }   w1=new long[N][M-1];   w2=new long[N-1][M];   dp=new long[N][M][K/2+1];   for(i=0;i<N;i++)   {    s=br.readLine().trim().split(" ");    for(int j=0;j<M-1;j++) w1[i][j]=Integer.parseInt(s[j])*2L;   }   for(i=0;i<N-1;i++)   {    s=br.readLine().trim().split(" ");    for(int j=0;j<M;j++) w2[i][j]=Integer.parseInt(s[j])*2L;   }   for(i=0;i<N;i++)   {    for(int j=0;j<M;j++)     Arrays.fill(dp[i][j],-1);   }   if(K%2==1)   {    K/=2;    answer();    System.exit(0);   }   K/=2;   for(i=0;i<N;i++)   {    for(int j=0;j<M;j++)     solve(i,j,K);   }   answer();  } }
4	public class A { public static void main(String[] args) throws Exception{  String str = new Scanner(System.in).next();  Set<String> set = new HashSet<String>();  String max = "";  for(int l = 1; l < str.length(); ++l){  for(int i = 0; i < str.length()-l; ++i){   String substr = str.substring(i, i+l);   if(!set.contains(substr) && str.indexOf(substr) != str.lastIndexOf(substr)){   set.add(substr);   if(substr.length() > max.length()){    max = substr;   }   }  }  }  System.out.println(max.length()); }  }
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 w = solve();   out.print(w == 0 ? "sjfnb" : "cslnb");  }  int n;  long a[];  int solve(){   n = in.nextInt(); a = new long[n];   long sum = 0;   for(int i = 0; i < n; i++)sum += a[i] = in.nextLong();   if(sum == 0){    return 1;   }   Arrays.sort(a);   int c = 0, c0 = 0; long p = -1, max = 0;   int f = 0;   long t = -1; int pp = -1;   for(int i = 0; i < n; i++){    if(a[i] == p){     c++;    }else{     if(p == 0)c0 = c;     if(c >= 2){f++; t = p; pp = i - 2;}     max = Math.max(max, c);     p = a[i];     c = 1;    }   }   max = Math.max(max, c);   sum = 0;   if(c >= 2){f++; t = p; pp = n - 2;}   if(max > 2 || c0 > 1 || f > 1)return 1;   if(f == 1){    long v = Arrays.binarySearch(a, t - 1);    if(v >= 0)return 1;    a[pp]--; sum = 1;   }   p = -1;   for(int i = 0; i < n; i++){    sum += a[i] - (p + 1);    a[i] = p + 1;    p = a[i];   }   return 1 - (int)(sum % 2);  }  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();   }  } }
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 { private Scanner in; private PrintWriter out;  private String INPUT = "";  public void solve() {  int n = ni();  int[] a = new int[n];  for(int i = 0;i < n;i++){  a[i] = ni();  }  Arrays.sort(a);  for(int i = 1;i < n;i++){  if(a[i] > a[i - 1]){   out.println(a[i]);   return;  }  }  out.println("NO"); }  public void run() throws Exception {  in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(new StringReader(INPUT));  out = new PrintWriter(System.out);   solve();  out.flush(); }   public static void main(String[] args) throws Exception {  new A().run(); }  private int ni() { return Integer.parseInt(in.next()); } private static void tr(Object... o) { System.out.println(o.length == 1 ? o[0] : Arrays.toString(o)); } }
3	public class SameSumBlocks {  public static void main(String[] args) throws Exception {   FastScanner sc = new FastScanner();   PrintWriter out = new PrintWriter(System.out);   int N = sc.nextInt();   int[] pre = new int[N + 1];   for (int i = 1; i <= N; i++) {    pre[i] = pre[i - 1] + sc.nextInt();   }   var sums = new ArrayList<Pair>();   for (int i = 1; i <= N; i++) {    for (int j = i; j <= N; j++) {     int sum = pre[j] - pre[i - 1];     sums.add(new Pair(i, j, sum));    }   }   Collections.sort(sums, (p1, p2) -> p1.sum - p2.sum != 0 ? p1.sum - p2.sum : p1.r - p2.r);   var ans = new ArrayList<Pair>();   int i = 0;   while (i < sums.size()) {    int j = i;    var group = new ArrayList(List.of(sums.get(i)));    int last = sums.get(i).r;    while (j + 1 < sums.size() && sums.get(j + 1).sum == sums.get(j).sum) {     if (sums.get(j + 1).l > last) {      group.add(sums.get(j + 1));      last = sums.get(j + 1).r;     }     j++;    }    if (group.size() > ans.size()) {     ans = group;    }    i = j + 1;   }   out.println(ans.size());   for (Pair p : ans) {    out.println(p);   }   out.close();  }  static class Pair {   int l, r, sum;   public Pair(int ll, int rr, int ss) {    l = ll; r = rr; sum = ss;   }   public String toString() {    return l + " " + r;   }  }  static class FastScanner {   private int BS = 1<<16;   private char NC = (char)0;   private byte[] buf = new byte[BS];   private int bId = 0, size = 0;   private char c = NC;   private double cnt = 1;   private BufferedInputStream in;   public FastScanner() {    in = new BufferedInputStream(System.in, BS);   }   public FastScanner(String s) {    try {     in = new BufferedInputStream(new FileInputStream(new File(s)), BS);    }    catch (Exception e) {     in = new BufferedInputStream(System.in, BS);    }   }   private char getChar(){    while(bId==size) {     try {      size = in.read(buf);     }catch(Exception e) {      return NC;     }     if(size==-1)return NC;     bId=0;    }    return (char)buf[bId++];   }   public int nextInt() {    return (int)nextLong();   }   public int[] nextInts(int N) {    int[] res = new int[N];    for (int i = 0; i < N; i++) {     res[i] = (int) nextLong();    }    return res;   }   public long[] nextLongs(int N) {    long[] res = new long[N];    for (int i = 0; i < N; i++) {     res[i] = nextLong();    }    return res;   }   public long nextLong() {    cnt=1;    boolean neg = false;    if(c==NC)c=getChar();    for(;(c<'0' || c>'9'); c = getChar()) {     if(c=='-')neg=true;    }    long res = 0;    for(; c>='0' && c <='9'; c=getChar()) {     res = (res<<3)+(res<<1)+c-'0';     cnt*=10;    }    return neg?-res:res;   }   public double nextDouble() {    double cur = nextLong();    return c!='.' ? cur:cur+nextLong()/cnt;   }   public String next() {    StringBuilder res = new StringBuilder();    while(c<=32)c=getChar();    while(c>32) {     res.append(c);     c=getChar();    }    return res.toString();   }   public String nextLine() {    StringBuilder res = new StringBuilder();    while(c<=32)c=getChar();    while(c!='\n') {     res.append(c);     c=getChar();    }    return res.toString();   }   public boolean hasNext() {    if(c>32)return true;    while(true) {     c=getChar();     if(c==NC)return false;     else if(c>32)return true;    }   }  } }
1	public class theyareeverywhere {  public static void main(String[] args) throws Exception {   BufferedReader r = new BufferedReader(new InputStreamReader(System.in));   PrintWriter w = new PrintWriter(System.out);        int n = Integer.parseInt(r.readLine());     char[] pokemans = r.readLine().toCharArray();     int[] counts = new int[52];   boolean[] exists = new boolean[52];     for (int i = 0; i < pokemans.length; i++) {    exists[index(pokemans[i])] = true;   }     int left = 0, right = 0;   counts[index(pokemans[0])] = 1;     int answer = 1000000000;     while (left < n && right < n) {    if (!valid(counts, exists)) {         right++;     if (right < n)     counts[index(pokemans[right])]++;    } else {     answer = Math.min(answer, right - left + 1);     left++;     if (left - 1 >= 0)     counts[index(pokemans[left - 1])]--;    }   }     w.println(answer);   w.flush();  }   public static boolean valid(int[] counts, boolean[] exists) {   for (int i = 0; i < counts.length; i++) {    if (exists[i] && counts[i] == 0) return false;   }   return true;  }   public static int index(char c) {   if (c >= 'a' && c <= 'z') {    return c - 'a';   } else {    return c - 'A' + 26;   }  } }
5	public class Round111A {  public static void main(String[] args) throws IOException {   new Round111A().run();  }  public void run() throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   Scanner scanner = new Scanner(reader);   PrintWriter writer = new PrintWriter(System.out);   int n = scanner.nextInt();   int sum = 0;   Integer[] a = new Integer[n];   for (int i = 0; i < n; i++) {    a[i] = scanner.nextInt();    sum += a[i];   }   Arrays.sort(a, Collections.reverseOrder());   int s = 0;   int i = 0;   while (i < n && (s <= sum / 2)) {    s += a[i];    i++;   }   writer.print(i);   scanner.close();   writer.close();  } }
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);   APaintTheNumbers solver = new APaintTheNumbers();   solver.solve(1, in, out);   out.close();  }  static class APaintTheNumbers {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    int arr[] = in.nextIntArray(n);    Arrays.sort(arr);    int ans = 0;    for (int i = 0; i < n; i++) {     if (arr[i] == -1)      continue;     else {           ans++;      for (int j = i + 1; j < n; j++) {       if (arr[j] % arr[i] == 0)        arr[j] = -1;      }      arr[i] = -1;          }    }    out.println(ans);   }  }  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);   }  }  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 close() {    writer.close();   }   public void println(int i) {    writer.println(i);   }  } }
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(); } }
2	public class Main7{  static class Pair  {   int x;  int y;  public Pair(int x,int y)   {    this.x= x;   this.y= y;  }     @Override   public int hashCode()    {    final int temp = 14;    int ans = 1;    ans =x*31+y*13;    return ans;    }            @Override   public boolean equals(Object o)   {    if (this == o) {    return true;    }    if (o == null) {    return false;    }    if (this.getClass() != o.getClass()) {    return false;    }    Pair other = (Pair)o;    if (this.x != other.x || this.y!=other.y) {    return false;    }    return true;   }     }  static class Pair1  {  String x;  int y;  int z;    }  static class Compare  {    }     public static long pow(long a, long b)  {  long result=1;  while(b>0)  {   if (b % 2 != 0)   {   result=(result*a)%mod;   b--;   }   a=(a*a)%mod;   b /= 2;  }   return result;  }  public static long fact(long num)  {   long value=1;   int i=0;   for(i=2;i<num;i++)   {    value=((value%mod)*i%mod)%mod;   }   return value;   }   public static int gcd(int a, int b)   {   if (a == 0)    return b;   return gcd(b%a, a);   }     public static long sum(int h)   {   return (h*(h+1)/2);   }       static int[] dis;   static int mod=1000000007;   static ArrayList<ArrayList<Integer>> graph;     public static void bfs(int num,int size)   {   boolean[] visited=new boolean[size+1];   Queue<Integer> q=new LinkedList<>();   q.add(num);   ans[num]=1;   visited[num]=true;   while(!q.isEmpty())   {    int x=q.poll();    ArrayList<Integer> al=graph.get(x);    for(int i=0;i<al.size();i++)    {    int y=al.get(i);     if(visited[y]==false)    {     q.add(y);     ans[y]=ans[x]+1;     visited[y]=true;    }    }   }   }   static int[] ans;                              public static int[] sort(int[] a)   {   int n=a.length;   ArrayList<Integer> ar=new ArrayList<>();   for(int i=0;i<a.length;i++)   {    ar.add(a[i]);   }   Collections.sort(ar);   for(int i=0;i<n;i++)   {    a[i]=ar.get(i);   }   return a;   }                                                  static public void main(String args[])throws IOException   {       int n=i();   int k=i();   long low=0;   long high=k;   long fin=0;   long ans=0;   for(int i=1;i<=n;i++)   {    ans+=i;    if(Math.abs(ans-k)+i==n && ans>=k)    {    fin=Math.abs(ans-k);    break;    }   }   pln(fin+"");   }                                               static InputReader in=new InputReader(System.in);   static OutputWriter out=new OutputWriter(System.out);   public static long l()   {    String s=in.String();    return Long.parseLong(s);   }   public static void pln(String value)   {    System.out.println(value);   }   public static int i()   {    return in.Int();   }   public static String s()   {    return in.String();   }  }                                                         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 Int() {   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 String() {   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 String();   }     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();   }     public void flush() {   writer.flush();   }     }     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.Int();   return array;   }     }
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);   }  } }
6	public class r584p5 {  private static BufferedReader r = new BufferedReader(new InputStreamReader(System.in));  private static PrintWriter pw = new PrintWriter(System.out);  private static int n, m, arr[][];  private static ArrayList<HashSet<Integer>> chls;  private static void gench(){   chls.add(new HashSet<>());   chls.get(0).add(0);   for(int i=1; i<(1<<n); i++){    int des = i^Integer.highestOneBit(i);    HashSet<Integer> st = new HashSet<>();    for(int z : chls.get(des)){     st.add(z);     st.add(z|Integer.highestOneBit(i));    }    chls.add(st);   }  }  private static void cal(){   int val[][] = new int[(1<<n)][m];   for(int j=0; j<m; j++){    val[0][j] = 0;    for(int mask=1; mask<(1<<n); mask++){     int max = 0;     for(int begin=0; begin<n; begin++){      int sum = 0;      for(int ptr=begin, pos=0; pos<n; ptr=(ptr+1)%n, pos++){       if((mask&(1<<pos)) > 0)        sum += arr[ptr][j];      }      max = Math.max(max, sum);     }     val[mask][j] = max;    }   }   int dp[][] = new int[(1<<n)][m];   for(int mask=0; mask<(1<<n); mask++)    dp[mask][0] = val[mask][0];   for(int j=1; j<m; j++){    dp[0][j] = 0;    for(int mask=1; mask<(1<<n); mask++){     dp[mask][j] = 0;     for(int ch1 : chls.get(mask)){      int ch2 = mask^ch1;      dp[mask][j] = Math.max(dp[mask][j], val[ch1][j]+dp[ch2][j-1]);     }    }   }   pw.println(dp[(1<<n)-1][m-1]);  }  private static void run()throws IOException{   StringTokenizer tk = new StringTokenizer(r.readLine());   n = Integer.parseInt(tk.nextToken());   m = Integer.parseInt(tk.nextToken());   arr = new int[n][m];   chls = new ArrayList<>();   for(int i=0; i<n; i++){    tk = new StringTokenizer(r.readLine());    for(int j=0; j<m; j++)     arr[i][j] = Integer.parseInt(tk.nextToken());   }   gench();   cal();  }  public static void main(String args[])throws IOException{   int t = Integer.parseInt(r.readLine());   while(t-->0)    run();   pw.flush();   pw.close();  } }
0	public class P122A_LuckyDivision {  private static boolean isLuckyNumber(int number) {  while (number > 0) {  int digit = number % 10;   if (digit != 4 && digit != 7) {   return false;  }   number /= 10;  }  return true; }  private static boolean isAlmostLuckyNumber(int number) {  int max = (int) Math.sqrt(number);  int i = 1;  while (i <= max) {  if (number % i == 0   && (isLuckyNumber(i) || isLuckyNumber(number / i))) {   return true;  }   i++;  }  return false; }   public static void main(String[] args) {  try {    InputStreamReader isr = new InputStreamReader(System.in);  BufferedReader reader = new BufferedReader(isr);     int input = Integer.parseInt(reader.readLine());   reader.close();  isr.close();     boolean result = isAlmostLuckyNumber(input);  System.out.println(result ? "YES" : "NO");  } catch (Exception e) {  e.printStackTrace();  } } }
1	public class SFly {  public static void main(String[] args) throws IOException {   BufferedReader lector = new BufferedReader(new InputStreamReader(System.in));  int planet = Integer.parseInt(lector.readLine());  int ini = Integer.parseInt(lector.readLine());  double peso = ini;  int[] desp = new int[planet];  int[] ater = new int[planet];  String[] temp = lector.readLine().split(" ");   for(int i=0; i<planet; i++) {  desp[i] = Integer.parseInt(temp[i]);  if(desp[i] == 1) {   System.out.println(-1);   lector.close();   return;  }  }  temp = lector.readLine().split(" ");   for(int i=0; i<planet; i++) {  ater[i] = Integer.parseInt(temp[i]);  if(ater[i] == 1) {   System.out.println(-1);   lector.close();   return;  }  }  temp = null;  int i=planet-1;  peso = (peso*ater[0])/(ater[0]-1);  while(i>0) {  peso = (peso*desp[i])/(desp[i]-1);  peso = (peso*ater[i])/(ater[i]-1);  i--;  }  peso = (peso*desp[0])/(desp[0]-1);  peso = peso - ini;  System.out.println(peso);  lector.close(); } }
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; } }
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);   TaskF solver = new TaskF();   solver.solve(1, in, out);   out.close();  }  static class TaskF {   final int INF = (int) 1e9 + 5;   int n;   int m;   int[][][] dp;   int[][] diff;   int[][] diffStartLast;   int two(int x) {    return 1 << x;   }   boolean contain(int mask, int x) {    return (mask & two(x)) > 0;   }   int rec(int start, int pre, int mask) {    if (mask == two(n) - 1)     return INF;    int res = dp[start][pre][mask];    if (res != -1)     return res;    res = 0;    for (int i = 0; i < n; i++)     if (contain(mask, i) == false) {      int diffPre = mask == 0 ? INF : diff[pre][i];      int diffLast = (mask | two(i)) == two(n) - 1 ? diffStartLast[start][i] : INF;      res = Math.max(res, Math.min(rec(start, i, mask | two(i)), Math.min(diffLast, diffPre)));     }    dp[start][pre][mask] = res;    return res;   }   public void solve(int testNumber, InputReader in, PrintWriter out) {    n = in.nextInt();    m = in.nextInt();    int[][] grid = new int[n][m];    for (int i = 0; i < n; i++)     for (int j = 0; j < m; j++)      grid[i][j] = in.nextInt();    if (n == 1) {     int res = INF;     for (int i = 0; i + 1 < m; i++) {      res = Math.min(res, Math.abs(grid[0][i] - grid[0][i + 1]));     }     out.println(res);     return;    }    diff = new int[n][n];    diffStartLast = new int[n][n];    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      diff[i][j] = INF;      diffStartLast[i][j] = INF;      for (int k = 0; k < m; k++) {       diff[i][j] = Math.min(diff[i][j], Math.abs(grid[i][k] - grid[j][k]));       if (k + 1 < m) {        diffStartLast[i][j] = Math.min(diffStartLast[i][j], Math.abs(grid[i][k + 1] - grid[j][k]));       }      }     }    }    dp = new int[n][n][two(n)];    for (int[][] aux : dp)     for (int[] aux2 : aux)      Arrays.fill(aux2, -1);    int ans = 0;    for (int start = 0; start < n; start++) {     ans = Math.max(ans, rec(start, start, two(start)));    }    out.println(ans);   }  }  static class InputReader {   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private InputStream stream;   public InputReader(InputStream stream) {    this.stream = stream;   }   private boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   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 nextInt() {    int c = read();    while (isWhitespace(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 (!isWhitespace(c));    return res * sgn;   }  } }
5	public class A {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int k = in.nextInt();   team[] t = new team[n];   for (int i = 0; i < n; i++)    t[i] = new team(in.nextInt(), in.nextInt());   Arrays.sort(t);   int cnt = 0;   team tm = t[t.length - k];   for (int i = t.length - 1; i >= 0; i--)    if (tm.equal(t[i]))     cnt++;   System.out.println(cnt);  }  static class team implements Comparable<team> {   int p, t;   public team(int pp, int tt) {    p = pp;    t = tt;   }   @Override   public int compareTo(team o) {    if (p == o.p)     return o.t - t;    return p - o.p;   }   public boolean equal(team a) {    return a.p == p && a.t == t;   }  } }
5	public class C { Scanner sc; BufferedReader in; PrintStream out; StringTokenizer tok;  public C() throws NumberFormatException, IOException {     in = new BufferedReader(new InputStreamReader(System.in));   out = System.out;  run(); } void run() throws NumberFormatException, IOException {   int[] array;  int n = nextInt();  array = new int[n];  int max = 0;  int pos = 0;  for(int i = 0; i <n; i++)  {  int l = nextInt();  if(l > max)  {   pos = i;   max = l;  }  array[i] = l;  }  if(max == 1)array[pos] = 2;  else array [pos] = 1;  Arrays.sort(array);  out.print(array[0]);  for(int i = 1; i < n; i++)  out.print(" " + array[i]);  out.println(); } public static void main(String[] args) throws NumberFormatException, IOException  {  new C(); } 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()); } }
0	public class A {  FastScanner in; PrintWriter out;  void solve() {  long a = in.nextLong(), b = in.nextLong();  long ans = 0;  while (true) {  long div = a / b;    ans += div;  a -= div * b;    if (a == 0) {   break;  }    long tmp = a;  a = b;  b = tmp;  }   out.println(ans); }   void run() {  in = new FastScanner();  out = new PrintWriter(System.out);  solve();  out.close(); }  class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  String nextToken() {  while (st == null || !st.hasMoreElements()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {      e.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(nextToken());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  } }  public static void main(String[] args) {  new A().run(); } }
5	public class Main implements Runnable { class House implements Comparable<House> {  int x;  int a;  public House(int x, int a) {  this.x = x;  this.a = a;  }  @Override  public int compareTo(House other) {  return x - other.x;  } }              private void solution() throws IOException {  int n = in.nextInt();  int t = in.nextInt();  House[] h = new House[n];  for (int i = 0; i < h.length; ++i) {  h[i] = new House(in.nextInt(), in.nextInt());  }  Arrays.sort(h);  int res = 2;  for (int i = 0; i < h.length - 1; ++i) {  double dist = h[i + 1].x - h[i + 1].a / 2.0 - (h[i].x + h[i].a / 2.0);  if (dist >= t) {   if (dist == t) {   ++res;   } else {   res += 2;   }  }  }  out.println(res); }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(-1);  } }  private class Scanner {  private BufferedReader reader;  private StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  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 int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
4	public class GivenString implements Runnable { public static void main(String[] args) throws Exception {  new GivenString().run(); }  private void solve() throws Exception {  String s = nextToken();  int len = s.length();  KMP kmp = new KMP();  int r = 0;  for (int i = 0; i < len; i++)  {  for (int j = i + 1; j <= len; j++)  {   String cur = s.substring(i, j);   int count = kmp.search(s, cur);   if (count >= 2)   r = max(r, cur.length());  }  }  out.println(r); }  class KMP {  public int search(String text, String pattern)  {  int count = 0;  int n = text.length(), m = pattern.length(), matchPoint = -1;  char pat[] = pattern.toCharArray(), t[] = text.toCharArray();  int p[] = prefixTable(pattern);  int j = 0;  for (int i = 0; i < n; i++)  {   while (j > 0 && pat[j] != t[i])   j = p[j - 1];   if (pat[j] == t[i])   j++;   if (j == m)   {   matchPoint = i - m + 1;   j = p[j - 1];   count++;   }  }  return count;  }  private int[] prefixTable(String pat)  {  int m = pat.length(), p[] = new int[m];  char s[] = pat.toCharArray();  int j = 0;  for (int i = 1; i < m; i++)  {   while (j > 0 && s[j] != s[i])   j = p[j - 1];   if (s[j] == s[i])   j++;   p[i] = j;  }  return p;  }  }   private BufferedReader in; PrintWriter out; StringTokenizer tokenizer;  public void run() {   try  {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new BufferedOutputStream(System.out));  solve();  out.flush();  in.close();  out.close();  }  catch (Exception e)  {  e.printStackTrace();    } }  String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens())  {  tokenizer = new StringTokenizer(in.readLine());  }  return tokenizer.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()); } }
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); } }
2	public class Main3 {  static long x, k;  static long MOD = (long)1e9 + 7;  public static void main(String args[]) throws Exception{   FastInput fi = new FastInput(new InputStreamReader(System.in));   PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   x = fi.nextLong();   k = fi.nextLong();   if(x == 0) {    System.out.println(0);    return;   }    long q1 = (pow(2, k+1) * (x%MOD)) % MOD;   long q2 = pow(2, k);   long q3 = 1;     long exp = (q1-q2 + MOD + MOD)%MOD;   exp = (exp + q3)%MOD;    pw.println(exp);   pw.close();  }  static long pow(long n, long k) {   if(k == 0)    return 1;   if(k == 1)    return n;   long ret = pow(n, k/2)%MOD;   ret = (ret*ret)%MOD;   if(k%2 == 1)    ret = (ret*n)%MOD;   return ret;  }  static class FastInput {   private Reader in;   private BufferedReader br;   private StringTokenizer st;   public FastInput(Reader in) {    this.in=in;    br = new BufferedReader(in);   }   public String nextString() {    while(st==null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     }     catch (IOException e) {      System.out.println(e.getStackTrace());     }    }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(nextString());   }   public long nextLong() {    return Long.parseLong(nextString());   }   public double nextDouble() {    return Double.parseDouble(nextString());   }  } }
0	public class LuckyNumbers {  public static void main(String[] args)throws IOException  {   BufferedReader scan=new BufferedReader(new InputStreamReader(System.in));   short num=Short.parseShort(scan.readLine());   if(funcion(num))   {    System.out.println("YES");   }   else    System.out.println("NO");  }  public static boolean funcion(short num)  {   LinkedList<Short>queue=new LinkedList<Short>();   queue.offer((short) 4);   queue.offer((short) 44);   queue.offer((short) 444);   queue.offer((short) 47);   queue.offer((short) 477);   queue.offer((short) 7);   queue.offer((short) 77);   queue.offer((short) 777);   queue.offer((short) 74);   queue.offer((short) 744);   while(queue.peek()!=null)   {    if(num%queue.poll()==0)    {     return true;    }   }   return false;  } }
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();  } }
1	public class Polycarp{  public static void main(String args[]){  Scanner s = new Scanner(System.in);   int rem[] = new int[3];   Arrays.fill(rem,-1);  rem[0] = 0;   char ch[] = s.next().toCharArray();  int n = ch.length;  long dp[] = new long[n];   int sum = 0;    for(int i=0;i<ch.length;i++){   sum = sum + (ch[i]-48);   if(rem[sum%3] != -1)   if(i>0){   dp[i] = Math.max(dp[i-1],dp[rem[sum%3]]+1);}   else   dp[i] = 1;   else   if(i>0)    dp[i] = dp[i-1];        rem[sum%3] = i;   sum = sum%3;    }       System.out.println(dp[n-1]);      } }
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)); } }
0	public class RationalResistance {  public static void main(String[] args) throws IOException {   BufferedReader f = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(f.readLine());   long a = Long.parseLong(st.nextToken());   long b = Long.parseLong(st.nextToken());   System.out.println(f(a,b));  }   public static long f(long a, long b)  {   if (a == 1 || b == 1)    return a+b-1;   if (a > b)    return f(a%b,b) + a/b;   else    return f(a,b%a) + b/a;  } }
5	public class Solver {  StringTokenizer st;  BufferedReader in;  PrintWriter out;  public static void main(String[] args) throws NumberFormatException, IOException {   Solver solver = new Solver();   solver.open();   solver.solve();   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 class result implements Comparable{   public int t = 0;   public int p = 0;     public result(int p,int t){    this.t = t;    this.p = p;   }   @Override   public int compareTo(Object o) {    result r = (result)o;    int out = r.p-p;    if (out==0) out = t-r.t;    return out;   }       }   public void solve() throws NumberFormatException, IOException {   int n = nextInt();   int k = nextInt();     result[] table = new result[n];     for (int i=0;i<n;i++){    int p = nextInt();    int t = nextInt();       table[i] = new result(p,t);   }     Arrays.sort(table);     int result = 1;   k--;     for (int i=k-1;i>=0 && table[i].p==table[k].p && table[i].t==table[k].t;i--){    result++;   }   for (int i=k+1;i<n && table[i].p==table[k].p && table[i].t==table[k].t;i++){    result++;   }   out.println(result);  }  public void close() {   out.flush();   out.close();  } }
3	public class Codeforces {   static long MOD = 1_000_000_007L;  static void main2() throws Exception {   int n = ni();   int[] arr = nia(n);   Map<Integer, List<Pair<Integer, Integer>>> map = new HashMap<>();   for(int r = 0; r < n; r++) {    int sum = 0;    for(int l = r; l >= 0; l--) {     sum += arr[l];     if(!map.containsKey(sum)) map.put(sum, new ArrayList<Pair<Integer, Integer>>());     map.get(sum).add(new Pair<Integer, Integer>(l + 1, r + 1));    }   }   int bestSum = Integer.MIN_VALUE;   int bestSumCount = -1;   for(Map.Entry<Integer, List<Pair<Integer, Integer>>> entry : map.entrySet()) {    int count = 0;    int r = -1;    for(Pair<Integer, Integer> pair : entry.getValue()) {     if(r < pair.first) {      count++;      r = pair.second;     }    }    if(count > bestSumCount) {     bestSumCount = count;     bestSum = entry.getKey();    }   }     println(bestSumCount);   int r = -1;   for(Pair<Integer, Integer> pair : map.get(bestSum)) {    if(r < pair.first) {     println(pair.first + " " + pair.second);     r = pair.second;    }   }  }                    private static byte[] scannerByteBuffer = new byte[1024];  private static int scannerIndex;  private static InputStream scannerIn;  private static int scannerTotal;  private static BufferedWriter printerBW;  private static boolean DEBUG = false;  private static int next() throws IOException {   if (scannerTotal < 0)    throw new InputMismatchException();   if (scannerIndex >= scannerTotal) {    scannerIndex = 0;    scannerTotal = scannerIn.read(scannerByteBuffer);    if (scannerTotal <= 0)     return -1;   }   return scannerByteBuffer[scannerIndex++];  }  static int ni() throws IOException {   int integer = 0;   int n = next();   while (isWhiteSpace(n))    n = next();   int neg = 1;   if (n == '-') {    neg = -1;    n = next();   }   while (!isWhiteSpace(n)) {    if (n >= '0' && n <= '9') {     integer *= 10;     integer += n - '0';     n = next();    } else     throw new InputMismatchException();   }   return neg * integer;  }  static long nl() throws IOException {   long integer = 0;   int n = next();   while (isWhiteSpace(n))    n = next();   int neg = 1;   if (n == '-') {    neg = -1;    n = next();   }   while (!isWhiteSpace(n)) {    if (n >= '0' && n <= '9') {     integer *= 10;     integer += n - '0';     n = next();    } else     throw new InputMismatchException();   }   return neg * integer;  }  static String line() throws IOException {   StringBuilder sb = new StringBuilder();   int n = next();   while (isWhiteSpace(n))    n = next();   while (!isNewLine(n)) {    sb.append((char) n);    n = next();   }   return sb.toString();  }  private static boolean isNewLine(int n) {   return n == '\n' || n == '\r' || n == -1;  }  private static boolean isWhiteSpace(int n) {   return n == ' ' || isNewLine(n) || n == '\t';  }  static int[] nia(int n) throws Exception {   if (n < 0)    throw new Exception("Array size should be non negative");   int[] array = new int[n];   for (int i = 0; i < n; i++)    array[i] = ni();   return array;  }  static int[][] n2dia(int r, int c) throws Exception {   if (r < 0 || c < 0)    throw new Exception("Array size should be non negative");   int[][] array = new int[r][c];   for (int i = 0; i < r; i++)    array[i] = nia(c);   return array;  }  static long[] nla(int n) throws Exception {   if (n < 0)    throw new Exception("Array size should be non negative");   long[] array = new long[n];   for (int i = 0; i < n; i++)    array[i] = nl();   return array;  }  static float[] nfa(int n) throws Exception {   if (n < 0)    throw new Exception("Array size should be non negative");   float[] array = new float[n];   for (int i = 0; i < n; i++)    array[i] = nl();   return array;  }  static double[] nda(int n) throws Exception {   if (n < 0)    throw new Exception("Array size should be non negative");   double[] array = new double[n];   for (int i = 0; i < n; i++)    array[i] = nl();   return array;  }  static <T> void print(T ... str) {   try {    for(T ele : str)     printerBW.append(ele.toString());    if (DEBUG)     flush();   } catch (IOException e) {    System.out.println(e.toString());   }  }  static <T> void println(T ... str) {   if(str.length == 0) {    print('\n');    return;   }   for(T ele : str)    print(ele, '\n');  }  static void flush() throws IOException {   printerBW.flush();  }  static void close() {   try {    printerBW.close();   } catch (IOException e) {    System.out.println(e.toString());   }  }  public static void main(String[] args) throws Exception {   long startPointTime = System.currentTimeMillis();   scannerIn = System.in;   printerBW = new BufferedWriter(new OutputStreamWriter(System.out));   if (args.length > 0 && args[0].equalsIgnoreCase("debug")     || args.length > 1 && args[1].equalsIgnoreCase("debug"))    DEBUG = true;   main2();   long endTime = System.currentTimeMillis();   float totalProgramTime = endTime - startPointTime;   if (args.length > 0 && args[0].equalsIgnoreCase("time") || args.length > 1 && args[1].equalsIgnoreCase("time"))    print("Execution time is " + totalProgramTime + " (" + (totalProgramTime / 1000) + "s)");   close();  }  static class Pair <L, R> {   L first;   R second;   Pair(L first, R second) {    this.first = first;    this.second = second;   }   public boolean equals(Object p2) {    if (p2 instanceof Pair) {     return ((Pair) p2).first.equals(first) && ((Pair) p2).second.equals(second);    }    return false;   }   public String toString() {    return "(first=" + first.toString() + ",second=" + second.toString() + ")";   }  }  static class DisjointSet {   int[] arr;   int[] size;   DisjointSet(int n) {    arr = new int[n + 1];    size = new int[n + 1];    makeSet();   }   void makeSet() {    for (int i = 1; i < arr.length; i++) {     arr[i] = i;     size[i] = 1;    }   }   void union(int i, int j) {    if (i == j)     return;    if (i > j) {     i ^= j;     j ^= i;     i ^= j;    }    i = find(i);    j = find(j);    if (i == j)     return;    arr[j] = arr[i];    size[i] += size[j];    size[j] = size[i];   }   int find(int i) {    if (arr[i] != i) {     arr[i] = find(arr[i]);     size[i] = size[arr[i]];    }    return arr[i];   }   int getSize(int i) {    i = find(i);    return size[i];   }   public String toString() {    return Arrays.toString(arr);   }  }  static boolean isSqrt(double a) {   double sr = Math.sqrt(a);   return ((sr - Math.floor(sr)) == 0);  }  static long abs(long a) {   return Math.abs(a);  }  static int min(int ... arr) {   int min = Integer.MAX_VALUE;   for (int var : arr)    min = Math.min(min, var);   return min;  }  static long min(long ... arr) {   long min = Long.MAX_VALUE;   for (long var : arr)    min = Math.min(min, var);   return min;  }  static int max(int... arr) {   int max = Integer.MIN_VALUE;   for (int var : arr)    max = Math.max(max, var);   return max;  }  static long gcd(long a, long b) {   if (b == 0)    return a;   return gcd(b, a % b);  } }
3	public class c {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);  int numbOfStatements = in.nextInt();  long[] dp = new long[numbOfStatements];  dp[0] = 1L;  boolean priorFor = in.next().equals("f");   for(int i=0; i<numbOfStatements-1; i++)  {  String type = in.next();  if (priorFor) {   for(int j=numbOfStatements-1;j>0;j--) {   dp[j] = dp[j-1];   }   dp[0] = 0L;  } else {   long sum = 0;   for(int j = numbOfStatements - 1; j >= 0; --j) {   sum = (sum + dp[j]) % 1000000007;   dp[j] = sum;   }  }  priorFor = type.equals("f");  }  long ans = 0;  for(int j=0; j<numbOfStatements; j++) {  ans = (ans + dp[j]) % 1000000007;  }  System.out.println(ans); } }
5	public class A {   public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int k = scan.nextInt()-1;  team[] t = new team[n];  for(int i = 0 ;i < n ; i++)  t[i] = new team(scan.nextInt(), scan.nextInt());  Arrays.sort(t);  int a =0;  int b = 0;  while(k+a < t.length-1 && t[k+a+1].compareTo(t[k]) == 0)  a++;  while(k-b > 0 && t[k-b-1].compareTo(t[k]) == 0)  b++;  System.out.println(a+b+1); } } class team implements Comparable<team> { int p; int t; public team(int pp , int tt) {  p = pp;  t= tt; } @Override public String toString() {  return p+" "+t; } @Override public int compareTo(team e) {  int a = e.p-p;  if(a == 0)  {  return t-e.t;  }else  return a; } }
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 { 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(); } }
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);   BSportMafia solver = new BSportMafia();   solver.solve(1, in, out);   out.close();  }  static class BSportMafia {   public void solve(int testNumber, InputReader in, PrintWriter out) {    long n = in.nextInt();    long k = in.nextInt();    long d = 9 + 4 * (2 * n + 2 * k);    double smh = Math.sqrt(d);    double ans = (-3 + smh) / 2;    out.println(n - (int) ans);   }  }  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 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;   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
0	public class A { public static void main(String[] args){  FastScanner sc = new FastScanner();  int n = sc.nextInt();  String nStr = Integer.toString(n);  String nStr1 = nStr.substring(0, nStr.length() - 1);  String nStr2 = nStr.substring(0, nStr.length() - 2) + nStr.charAt(nStr.length() - 1);  int result = Math.max(n, Integer.parseInt(nStr1));  result = Math.max(result, Integer.parseInt(nStr2));  System.out.println(result); }  public static class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner(String s) {  try {   br = new BufferedReader(new FileReader(s));  } catch (FileNotFoundException e) {   e.printStackTrace();  }  }  public FastScanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  String nextToken() {  while (st == null || !st.hasMoreElements()) try {   st = new StringTokenizer(br.readLine());  } catch (IOException e) {   e.printStackTrace();  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(nextToken());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  } } }
3	public class CFA {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  private static final long MOD = 1000L * 1000L * 1000L + 7;  private static final int[] dx = {0, -1, 0, 1};  private static final int[] dy = {1, 0, -1, 0};  private static final String yes = "Yes";  private static final String no = "No";  int n;  int[] arr;  class Segment {   int start;   int end;   public Segment(int start, int end) {    this.start = start;    this.end = end;   }   @Override   public String toString() {    return start + " " + end;   }  }  Map<Integer, List<Segment>> hm = new HashMap<>();  void solve() throws IOException {   n = nextInt();   arr = nextIntArr(n);   for (int i = 0; i < n; i++) {    int sum = 0;    for (int j = i; j < n; j++) {     sum += arr[j];     if (!hm.containsKey(sum)) {      hm.put(sum, new ArrayList<>());     }     hm.get(sum).add(new Segment(i, j));    }   }   int max = -1;   int idx = -1;   for (Map.Entry<Integer, List<Segment>> entry : hm.entrySet()) {    int key = entry.getKey();    List<Segment> values = entry.getValue();    Collections.sort(values, new Comparator<Segment>() {     @Override     public int compare(Segment o1, Segment o2) {      return Integer.compare(o1.end, o2.end);     }    });    int cnt = findSeg(values).size();    if (cnt > max) {     max = cnt;     idx = key;    }   }   List<Segment> res = findSeg(hm.get(idx));   outln(res.size());   for (int i = 0; i < res.size(); i++) {    outln((1 + res.get(i).start) + " " + (1 + res.get(i).end));   }  }  List<Segment> findSeg(List<Segment> input) {   List<Segment> res = new ArrayList<>();   int bound = -1;   for (int i = 0; i < input.size(); i++) {    if (input.get(i).start > bound) {     res.add(input.get(i));     bound = input.get(i).end;    }   }   return res;  }  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);  }  private void formatPrint(double val) {   outln(String.format("%.9f%n", val));  }  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 B {  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());    boolean flag=false;    int sqrt=(int) Math.sqrt(N/2);    if(sqrt*sqrt==N/2&&N%2==0) flag = true;    sqrt=(int) Math.sqrt(N/4);    if(sqrt*sqrt==N/4&&N%4==0) flag = true;    sb.append(flag?"YES\n":"NO\n");   }   System.out.println(sb);  } }
5	public class C {     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 C().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{   int n = readInt();   int[] a = new int[n];   for(int i = 0; i < n; i++){    a[i] = readInt();   }   boolean c = true;   for(int i = 0; i < n; i++){    if(a[i] != 1){    c = false;    break;    }   }   if(c){    for(int i = 0; i < n-1; i++){    out.print(a[i] + " ");    }    out.println(2);    return;   }   Utils.mergeSort(a);   out.print(1 + " ");   for(int i = 1; i < n; i++){    out.print(a[i-1] + " ");   }   }     int[] zFunction(char[] s){   int[] z = new int[s.length];   z[0] = 0;   for (int i=1, l=0, r=0; i<s.length; ++i) {    if (i <= r)    z[i] = min (r-i+1, z[i-l]);    while (i+z[i] < s.length && s[z[i]] == s[i+z[i]])    ++z[i];    if (i+z[i]-1 > r){    l = i;     r = i+z[i]-1;    }   }    return z;   }     int[] prefixFunction(char[] s){   int[] pr = new int[s.length];   for (int i = 1; i< s.length; ++i) {    int j = pr[i-1];    while (j > 0 && s[i] != s[j])    j = pr[j-1];    if (s[i] == s[j]) ++j;    pr[i] = j;   }   return pr;   }     int ModExp(int a, int n, int mod){   int res = 1;   while (n!=0)    if ((n & 1) != 0) {    res = (res*a)%mod;    --n;    }    else {    a = (a*a)%mod;    n >>= 1;    }   return res;   }        static class Utils {      private Utils() {}      public static void mergeSort(int[] a) {       mergeSort(a, 0, a.length - 1);     }      private static void mergeSort(int[] a, int leftIndex, int rightIndex) {       final int MAGIC_VALUE = 50;       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 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;       }     }   }          boolean isPrime(int a){   for(int i = 2; i <= sqrt(a); i++)    if(a % i == 0) return false;   return true;   }     static double distance(long x1, long y1, long x2, long y2){   return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));   }     static long gcd(long a, long b){   if(min(a,b) == 0) return max(a,b);   return gcd(max(a, b) % min(a,b), min(a,b));   }     static long lcm(long a, long b){   return a * b /gcd(a, b);   } }
3	public class Main {      public static void main(String[] args) throws IOException {     PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   br = new BufferedReader(new InputStreamReader(System.in));   int n=nextInt();   int arr[]=new int[n];   for(int i=0;i<n;i++){    arr[i]=nextInt();   }   Arrays.sort(arr);   int c=0;   for(int i=0;i<n;i++){    if(arr[i]!=0){     int a=arr[i];     c++;     for(int j=i;j<n;j++){           if(arr[j]%a==0){       arr[j]=0;      }     }    }   }   pw.println(c);   pw.close();  }   static long maxSubArraySum(long a[],int size) {    long max_so_far = 0, max_ending_here = 0;   for (int i = 0; i < size; i++)  {   max_ending_here = max_ending_here + a[i];   if (max_ending_here < 0)    max_ending_here = 0;         else if (max_so_far < max_ending_here)    max_so_far = max_ending_here;     }  return max_so_far; }  public static BufferedReader br;  public static StringTokenizer st;  public static String next() {   while (st == null || !st.hasMoreTokens()) {   try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     throw new RuntimeException(e);    }   }   return st.nextToken();  }   public static Integer nextInt() {   return Integer.parseInt(next());  }   public static Long nextLong() {   return Long.parseLong(next());  }   public static Double nextDouble() {   return Double.parseDouble(next());  }  static class Pair{   int x;int y;int z;   Pair(int x,int y,int z){    this.x=x;    this.y=y;    this.z=z;      }  }  static class sorting implements Comparator<Pair>{   public int compare(Pair a,Pair b){       return (a.x-b.x);   }  }  public static int[] na(int n)throws IOException{   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = nextInt();   return a;  }  static class query implements Comparable<query>{   int l,r,idx,block;   static int len;   query(int l,int r,int i){    this.l=l;    this.r=r;    this.idx=i;    this.block=l/len;   }    public int compareTo(query a){    return block==a.block?r-a.r:block-a.block;   }  }  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 long gcd(long a, long b) {   if (b == 0)   return a;   return gcd(b, a % b);  }  static long modInverse(long a, long m) {   long g = gcd(a, m);   if (g != 1)    return -1;   else{           return (power(a, m - 2, m));   }  }      static 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;     if (y % 2 == 0)    return p;   else    return (x * p) % m;  }  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,int M){   return fast_pow(n,M-2,M);  }  }
1	public class Solution {  public static void main(String[] args) throws Exception {   Scanner sc = new Scanner(new InputStreamReader(System.in));   int n = sc.nextInt();   String s = sc.next();   sc.close();     int cH = 0;   for (int i=0; i < s.length(); i++)    if (s.charAt(i) == 'H')     cH++;     int best = cH;     for (int st=0; st < s.length(); st++) {    int cur = st;    int cnt = cH;    for (int i=0; i < cH; i++) {     if (s.charAt(cur) == 'H')      cnt--;     cur++;     if (cur == s.length()) cur = 0;    }    best = Math.min(best, cnt);   }     System.out.println(best);  } }
6	public class E {  static void solve() throws Exception {  int tests = scanInt();  for (int test = 0; test < tests; test++) {  int n = scanInt(), m = scanInt(), a[][] = new int[n][m];   for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   a[i][j] = scanInt();   }  }  int bestCols[] = new int[min(m, n)];  for (int i = 0; i < bestCols.length; i++) {   bestCols[i] = i;  }  if (m > n) {   int bestColMax[] = new int[n];   for (int i = 0; i < n; i++) {   int cmax = 0;   for (int j = 0; j < n; j++) {    cmax = max(cmax, a[j][i]);   }   bestColMax[i] = cmax;   }   for (int i = n; i < m; i++) {   int cmax = 0;   for (int j = 0; j < n; j++) {    cmax = max(cmax, a[j][i]);   }   int minBC = 0, minBCM = Integer.MAX_VALUE;   for (int j = 0; j < n; j++) {    if (bestColMax[j] < minBCM) {    minBC = j;    minBCM = bestColMax[j];    }   }   if (cmax > minBCM) {    bestCols[minBC] = i;    bestColMax[minBC] = cmax;   }   }  }  int dyn[] = new int[1 << n], dynNext[] = new int[1 << n], sums[] = new int[1 << n], csums[] = new int[1 << n];  for (int i: bestCols) {   fill(dynNext, 0);   fill(sums, 0);   for (int j = 0; j < n; j++) {   for (int k = 1, bit = 0; k < 1 << n; k++) {    if (k == 1 << (bit + 1)) {    ++bit;    }    sums[k] = max(sums[k], csums[k] = csums[k ^ (1 << bit)] + a[(bit + j) % n][i]);   }   }   for (int mask1 = 0; mask1 < 1 << n; mask1++) {   int cdyn = dynNext[mask1];   for (int mask2 = mask1;; mask2 = (mask2 - 1) & mask1) {    cdyn = max(cdyn, dyn[mask2] + sums[mask1 ^ mask2]);    if (mask2 == 0) {    break;    }   }   dynNext[mask1] = cdyn;   }   int t[] = dyn;   dyn = dynNext;   dynNext = t;  }  out.println(dyn[(1 << n) - 1]);  } }  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);  } } }
3	public class TimePass implements Runnable {  InputStream is;  PrintWriter out;  String INPUT = "";   boolean debug=true;  static long mod=998244353;  static long mod2=1000000007;   void solve() throws IOException  {   int n=ni();   int[] a=na(n);   long[] sum=new long[n];   sum[0]=a[0];   for(int i=1;i<n;i++)sum[i]=sum[i-1]+a[i];   HashMap<Long,ArrayList<Pair>> map=new HashMap<>();   for(int i=0;i<n;i++)   {    for(int j=i;j<n;j++)    {     long curr=sum[j]-(i>0?sum[i-1]:0);     if(map.containsKey(curr))     {      map.get(curr).add(new Pair(i+1,j+1));     }     else     {      ArrayList<Pair> list=new ArrayList<>();      list.add(new Pair(i+1,j+1));      map.put(curr,list);     }    }   }   int max=0;   long maxSum=0;   for(long key:map.keySet())   {    ArrayList<Pair> list=map.get(key);    list.sort(new Comparator<Pair>(){     public int compare(Pair p1,Pair p2)     {      return p1.b-p2.b;     }    });    int prevl=0;    int cnt=0;    for(Pair pr:list)    {     if(pr.a>prevl)     {      cnt++;      prevl=pr.b;     }    }    if(max<cnt)    {     max=cnt;     maxSum=key;    }   }   int prevl=0;   ArrayList<Pair> list=map.get(maxSum);   ArrayList<Pair> ans=new ArrayList<>();   for(Pair pr:list)   {    if(pr.a>prevl)    {         ans.add(pr);         prevl=pr.b;    }   }   out.println(ans.size());   for(Pair pr:ans)   {    out.println(pr.a+" "+pr.b);   }  }   static long fnc(int a,int b)  {   return a+(long)1000000007*b;  }   static Pair[][] packU(int n,int[] from,Pair[] to)  {   Pair[][] g=new Pair[n][];   int[] p=new int[n];   for(int f:from)   {    p[f]++;   }   int m=from.length;   for(int i=0;i<n;i++)   {    g[i]=new Pair[p[i]];   }   for(int i=0;i<m;i++)   {    g[from[i]][--p[from[i]]]=to[i];   }   return g;  }  static int[][] packD(int n,int[] from,int[] to)  {   int[][] g=new int[n][];   int[] p=new int[n];   for(int f:from)   {    p[f]++;   }   int m=from.length;   for(int i=0;i<n;i++)   {    g[i]=new int[p[i]];   }   for(int i=0;i<m;i++)   {    g[from[i]][--p[from[i]]]=to[i];   }   return g;  }    static class Pair  {   int a,b,c;   public Pair(int a,int b     )   {    this.a=a;    this.b=b;      }  }   static long lcm(int a,int b)  {   long val=a;   val*=b;   return (val/gcd(a,b));  }   static long gcd(long a,long b)  {   if(a==0)return b;   return gcd(b%a,a);  }   static int pow(int a, int b, int p)  {   long ans = 1, base = a;   while (b!=0)   {    if ((b & 1)!=0)    {     ans *= base;     ans%= p;    }    base *= base;    base%= p;    b >>= 1;   }   return (int)ans;  }  static int inv(int x, int p)  {   return pow(x, p - 2, p);  }   public static long[] radixSort(long[] f){ return radixSort(f, f.length); }  public static long[] radixSort(long[] f, int n)  {   long[] to = new long[n];   {    int[] b = new int[65537];    for(int i = 0;i < n;i++)b[1+(int)(f[i]&0xffff)]++;    for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];    for(int i = 0;i < n;i++)to[b[(int)(f[i]&0xffff)]++] = f[i];    long[] d = f; f = to;to = d;   }   {    int[] b = new int[65537];    for(int i = 0;i < n;i++)b[1+(int)(f[i]>>>16&0xffff)]++;    for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];    for(int i = 0;i < n;i++)to[b[(int)(f[i]>>>16&0xffff)]++] = f[i];    long[] d = f; f = to;to = d;   }   {    int[] b = new int[65537];    for(int i = 0;i < n;i++)b[1+(int)(f[i]>>>32&0xffff)]++;    for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];    for(int i = 0;i < n;i++)to[b[(int)(f[i]>>>32&0xffff)]++] = f[i];    long[] d = f; f = to;to = d;   }   {    int[] b = new int[65537];    for(int i = 0;i < n;i++)b[1+(int)(f[i]>>>48&0xffff)]++;    for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];    for(int i = 0;i < n;i++)to[b[(int)(f[i]>>>48&0xffff)]++] = f[i];    long[] d = f; f = to;to = d;   }   return f;  }    public void run()  {   if(debug)oj=true;   is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());   out = new PrintWriter(System.out);     long s = System.currentTimeMillis();   try {    solve();   } catch (IOException e) {       e.printStackTrace();   }   out.flush();   tr(System.currentTimeMillis()-s+"ms");  }   public static void main(String[] args) throws Exception {new Thread(null,new TimePass(),"Main",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 boolean oj = System.getProperty("ONLINE_JUDGE") != null;  private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
1	public class Solution {  public static void main(String[] args) {   new Thread(new Runnable() {       @Override    public void run() {     new Solution();    }   }).start();  }  Solution() {   String data = "2\nR1C18\nR1";   PrintWriter pw = new PrintWriter(System.out);   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));     try {    int n = Integer.parseInt(in.readLine());    int[] res = new int[2];    for (int i = 0; i < n; i++) {     String s = in.readLine();     if (isSecondType(s, res)) {      pw.println(toFirstType(res));     } else {      pw.println(toSecondType(s));     }    }   } catch (IOException e) {   } finally {    pw.flush();    pw.close();   }  }  private String toSecondType(String s) {   int i = 0;   for (; i < s.length(); i++) {    if (s.charAt(i) < 'A' || s.charAt(i) > 'Z') break;   }   String first = s.substring(0, i);   String second = s.substring(i, s.length());   StringBuilder sb = new StringBuilder();   sb.append("R");   sb.append(second);   sb.append("C");   sb.append(stringToNum(first));   return sb.toString();  }  private int stringToNum(String first) {   int k = 0;   int res = 0;   int p = 1;   for (int i = first.length() - 1; i >= 0; i--) {    int v = first.charAt(i) - 'A' + k;    k = 1;    res += p * v;    p *= 26;   }   return res + 1;  }  private String toFirstType(int[] res) {   StringBuilder sb = new StringBuilder();   sb.append(numToString(res[1]));   sb.append(res[0]);   return sb.toString();  }  private String numToString(int num) {   StringBuilder sb = new StringBuilder();   while (num > 0) {    num--;    char c = (char) (num % 26 + 'A');    sb.append(c);    num /= 26;   }   return sb.reverse().toString();  }  private boolean isSecondType(String s, int[] res) {   try {    return doIsSecondType(s, res);   } catch (Exception e) {    return false;   }  }  private boolean doIsSecondType(String s, int[] res) {   StringTokenizer st = new StringTokenizer(s, "RC", true);   String token = st.nextToken();   if (!token.equals("R")) return false;   token = st.nextToken();   if (!isDigit(token)) return false;   res[0] = Integer.parseInt(token);   token = st.nextToken();   if (!token.equals("C")) return false;   token = st.nextToken();   if (!isDigit(token)) return false;   res[1] = Integer.parseInt(token);   return true;  }  private boolean isDigit(String token) {   for (int i = 0; i < token.length(); i++) {    if (token.charAt(i) < '0' || token.charAt(i) > '9') return false;   }   return true;  } }
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();  } }
3	public class InVoker {   public static void main(String args[]) {     Scanner inp = new Scanner(System.in);  PrintWriter out= new PrintWriter(System.out);    int n=inp.nextInt();  int a[]=new int[n];  for(int i=0;i<n;i++)   a[i]=inp.nextInt();  Arrays.sort(a);  int gg=0;  for(int i=0;i<n;i++) {   if(a[i]==0)   continue;   gg++;   for(int j=i+1;j<n;j++) {   if(a[j]%a[i]==0) {    a[j]=0;   }   }  }  out.println(gg);  out.close();  inp.close();     }   }
2	public class Main { static BigInteger tow=new BigInteger("2"),mod=new BigInteger("1000000007"); static BigInteger pow(BigInteger a,BigInteger b) {  if(b.equals(BigInteger.ZERO))return BigInteger.ONE;  BigInteger x=pow(a,b.divide(tow));  if(b.mod(tow).equals(BigInteger.ZERO))   return x.mod(mod).multiply(x.mod(mod)).mod(mod);  else   return x.mod(mod).multiply(x.mod(mod)).mod(mod).multiply(a).mod(mod); } public static void main(String[] args) throws IOException {  BigInteger x=in.RB(),k=in.RB();  if(k.equals(BigInteger.ZERO))System.out.println(x.multiply(tow).mod(mod));  else if(x.equals(BigInteger.ZERO))System.out.println(0);  else {  BigInteger x1=tow.multiply(x).subtract(BigInteger.ONE);  x1=x1.mod(mod);  BigInteger x2=pow(tow,k);  x2=x2.mod(mod);  System.out.println(x1.multiply(x2).add(BigInteger.ONE).mod(mod));    } } }  class in{ static StringTokenizer st=new StringTokenizer(""); static BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); static String next() throws IOException {  while(!st.hasMoreTokens())st=new StringTokenizer(bf.readLine());  return st.nextToken(); } static int RI() throws IOException {  return Integer.parseInt(next()); } static BigInteger RB() throws IOException {  return new BigInteger(next()); } }
5	public class Main {  private static IO io;  public static void main(String[] args) throws IOException {   new Main().run();  }  private void run() throws IOException {   io = new IO(System.getProperty("ONLINE_JUDGE")!=null);   solve();   io.flush();  }   private void solve() throws IOException {   int n = io.nI(), a = io.nI(), b = io.nI(), h[] = new int[n], i;   for(i = 0; i<n; i++)h[i] = io.nI(); Arrays.sort(h);   io.wln(h[b]-h[b-1]);  }   private int gcd(int a, int b) {   while(b>0) b^=a^=b^=a%=b;   return a;  }   @SuppressWarnings("unused")  private class IO{   StreamTokenizer in; PrintWriter out; BufferedReader br; Reader reader; Writer writer;   public IO(boolean oj) throws IOException{    Locale.setDefault(Locale.US);    reader = oj ? new InputStreamReader(System.in) : new FileReader("input.txt");    writer = oj ? new OutputStreamWriter(System.out) : new FileWriter("output.txt");    br = new BufferedReader(reader);    in = new StreamTokenizer(br);    out = new PrintWriter(writer);   }   public void wln(){out.println();}   public void wln(int arg){out.println(arg);}   public void wln(long arg){out.println(arg);}   public void wln(double arg){out.println(arg);}   public void wln(String arg){out.println(arg);}   public void wln(boolean arg){out.println(arg);}   public void wln(char arg){out.println(arg);}   public void wln(float arg){out.println(arg);}   public void wln(Object arg){out.println(arg);}   public void w(int arg){out.print(arg);}   public void w(long arg){out.print(arg);}   public void w(double arg){out.print(arg);}   public void w(String arg){out.print(arg);}   public void w(boolean arg){out.print(arg);}   public void w(char arg){out.print(arg);}   public void w(float arg){out.print(arg);}   public void w(Object arg){out.print(arg);}   public void wf(String format, Object...args){out.printf(format, args);}   public void flush(){out.flush();}   public int nI() throws IOException {in.nextToken(); return(int)in.nval;}   public long nL() throws IOException {in.nextToken(); return(long)in.nval;}   public String nS() throws IOException {in.nextToken(); return in.sval;}   public double nD() throws IOException {in.nextToken(); return in.nval;}   public float nF() throws IOException {in.nextToken(); return (float)in.nval;}   public void wc(char...a){for(char c : a){in.ordinaryChar(c);in.wordChars(c, c);}}   public void wc(char c1, char c2){in.ordinaryChars(c1, c2); in.wordChars(c1, c2);}  } }
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();   }  } }
6	@SuppressWarnings("unused") public class Solution{  static long inf = (long)1e18+100; static final long mod = (long)1e9+7;  @SuppressWarnings("unchecked") public static void main(String[] args) throws IOException {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);    int tt = 1;  outer:  while(tt-->0) {     int n = fs.nextInt(), T = fs.nextInt();   int[] t = new int[n], g = new int[n];     for(int i=0;i<n;i++) {   t[i] = fs.nextInt(); g[i] = fs.nextInt();   }        long[][] dp = new long[1<<n][4];   dp[0][0] = 1;     long ans = 0;     for(int mask=0;mask<(1<<n);mask++) {   for(int pre=0;pre<=3;pre++) {    for(int i=0;i<n;i++)    if((mask&(1<<i))==0 && g[i]!=pre)     dp[mask^(1<<i)][g[i]] = add(dp[mask^(1<<i)][g[i]], dp[mask][pre]);    int sum = 0;    for(int i=0;i<n;i++) {    if((mask&(1<<i))!=0) sum += t[i];    }    if(sum==T) ans = add(ans, dp[mask][pre]);   }   }     out.println(ans);                 }    out.close();  }  static long add(long a, long b) {  a += b;  if(a>mod) return a - mod;  return a; }    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 char nextChar() {   return next().toCharArray()[0];  }  }    }
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();   int testCount = Integer.parseInt(in.next());   for (int i = 1; i <= testCount; i++)    solver.solve(i, in, out);   out.close();  }  static class TaskB {   public void solve(int testNumber, InputReader in, PrintWriter out) {    long x = in.readLong();    if (x % 2 == 1) {     out.println("NO");     return;    }    if (x % 2 == 0) {     long p = x / 2;     long square = (long) Math.sqrt(p);     if (square * 1L * square == p) {      out.println("YES");      return;     }    }    if (x % 4 == 0) {     long p = x / 4;     long square = (long) Math.sqrt(p);     if (square * 1L * square == p) {      out.println("YES");      return;     }    }    out.println("NO");   }  }  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 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 {     if (Character.isValidCodePoint(c)) {      res.appendCodePoint(c);     }     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   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 String next() {    return readString();   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
1	public class HamstersTigers {  private BufferedReader in;  private PrintWriter out;  private StringTokenizer st;  int solve(String a, int k){  int n = a.length(), ret = 0;  int temp[] = new int[n];  for(int i = 0; i < n; i++) temp[(n + i - k) % n] = (a.charAt(i) == 'T') ? 1: 0;  int left = 0, right = n - 1;  while(left < right){  while(temp[left] == 0) left++;  while(temp[right] == 1) right--;  if(left < right){   int t = temp[left];   temp[left] = temp[right];   temp[right] = t;   ret++;  }  }  return ret; }  void solve() throws IOException {  int n = nextInt();  String a = next();  int ans = Integer.MAX_VALUE;  for(int fix = 0; fix < n; fix++){  ans = Math.min(ans, solve(a, fix));  }  out.println(ans);  }  HamstersTigers() 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 HamstersTigers();  } }
3	public class Main { public static void main(String[] args) {  Reader in = new Reader();  int n = in.nextInt();  int[] a = in.na(n);  HashMap<Long, ArrayList<Pair>> v = new HashMap<>();  for(int i = 0; i<n; i++) {  long s = 0;  for(int j = i; j<n; j++) {   s+=a[j];   Pair p = new Pair(i+1, j+1);   if(v.containsKey(s)) {   v.get(s).add(p);   }else {   ArrayList<Pair> xd = new ArrayList<>();   xd.add(p);   v.put(s,xd);   }  }  }  ArrayList<Pair> ans = new ArrayList<>();  for(Entry<Long,ArrayList<Pair>> e : v.entrySet()) {  ArrayList<Pair> pairs = e.getValue();  Collections.sort(pairs);  Stack<Pair> st = new Stack<>();  for(int i = 0; i<pairs.size(); i++) {   Pair cur = pairs.get(i);   if(st.isEmpty()||st.peek().r<cur.l) {   st.push(cur);   }else if(st.peek().r>cur.r) {    st.pop();    st.push(cur);   }   if(st.size()>ans.size()) ans = new ArrayList<>(st);  }  }  System.out.println(ans.size());  for(Pair p : ans)  System.out.println(p.l +" "+p.r); } static class Pair implements Comparable<Pair>{  int l,r;  public Pair(int l, int r) {  this.l = l;  this.r = r;  }  @Override  public int compareTo(Pair o) {  return this.l - o.l;  } } static class Reader {  static BufferedReader br;  static StringTokenizer st;  public Reader() {  this.br = new BufferedReader(new InputStreamReader(System.in));  }  public int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = nextInt();  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 String[] nS(int n) {  String[] a = new String[n];  for (int i = 0; i < n; i++)   a[i] = next();  return a;  }  public int nextInt() {  if (st == null || !st.hasMoreTokens())   try {   readLine();   } catch (Exception e) {   }  return Integer.parseInt(st.nextToken());  }  public double nextDouble() {  if (st == null || !st.hasMoreTokens())   try {   readLine();   } catch (Exception e) {   }  return Double.parseDouble(st.nextToken());  }  public Long nextLong() {  if (st == null || !st.hasMoreTokens())   try {   readLine();   } catch (Exception e) {   }  return Long.parseLong(st.nextToken());  }  public String next() {  if (st == null || !st.hasMoreTokens())   try {   readLine();   } catch (Exception e) {   }  return st.nextToken();  }  public static void readLine() {  try {   st = new StringTokenizer(br.readLine());  } catch (Exception e) {  }  } } }
0	public class CF {  long getAns(long a, long b) {  if (a == b)  return 1;  if (a < b) {  return getAns(b, a);  }   long cnt = (a - 1) / b;  return cnt + getAns(b, a - b * cnt); }  void solve() {  long a = in.nextLong();  long b = in.nextLong();  out.println(getAns(a, b)); }  FastScaner in; PrintWriter out;  void run() {  in = new FastScaner(System.in);  out = new PrintWriter(System.out);  solve();  out.close(); }  void runWithFiles() {  in = new FastScaner(new File("input.txt"));  try {  out = new PrintWriter(new File("output.txt"));  } catch (FileNotFoundException e) {  e.printStackTrace();  }  solve();  out.close(); }  public static void main(String[] args) {  new CF().run(); }  class FastScaner {  BufferedReader br;  StringTokenizer st;  FastScaner(InputStream is) {  br = new BufferedReader(new InputStreamReader(is));  }  FastScaner(File f) {  try {   br = new BufferedReader(new FileReader(f));  } catch (FileNotFoundException e) {   e.printStackTrace();  }  }  String next() {  while (st == null || !st.hasMoreElements()) {   String s = null;   try {   s = br.readLine();   } catch (IOException e) {   e.printStackTrace();   }   if (s == null)   return null;   st = new StringTokenizer(s);  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  } } }
5	public class Split {  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];  int d[] = new int[n-1];  for(int i=0;i<n;i++) {  a[i] = sc.nextInt();  if(i>0)   d[i-1] = a[i-1] - a[i];  }  Arrays.sort(d);  int t = 0;  for(int i=0;i<k-1;i++)  t += d[i];  System.out.println(a[n-1]-a[0]+t); } }
6	public class Main { static final int MOD = (int)1e9 + 7; static int n; static int[] t; static int[] g;  static int[][] memo;  static int dp(int mask, int rem, int last) {  if(rem == 0)  return 1;  if(memo[last][mask] != -1)  return memo[last][mask];   int ans = 0;  for(int i = 0; i < n; i++)  {  if((mask & (1 << i)) == 0 && rem >= t[i] && g[i] != last)   ans += dp(mask | 1 << i, rem - t[i], g[i]);    if(ans >= MOD)   ans -= MOD;  }   return memo[last][mask] = ans; }  public static void main (String[] args) throws java.lang.Exception {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);   n = in.nextInt();  int T = in.nextInt();   t = new int[n];  g = new int[n];   for(int i = 0; i < n; i++)  {  t[i] = in.nextInt();  g[i] = in.nextInt() - 1;  }   memo = new int[4][1 << n];  for(int []x : memo)  {  Arrays.fill(x, -1);  }   out.println(dp(0, T, 3));  out.close(); }  static 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)   {   throw new RuntimeException(e);   }  }    return tokenizer.nextToken();  }   public int nextInt()  {  return Integer.parseInt(next());  } } }
6	public class Solution {  public void doMain() throws Exception {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt(), m = sc.nextInt();   boolean[][] adj = new boolean[n][n];   for (int i=0; i<m; i++) {    int a = sc.nextInt()-1, b = sc.nextInt()-1;    adj[a][b] = adj[b][a] = true;   }     long res = 0;     for (int st=0; st+1<n; st++) {       long[][] numWays = new long[1<<(n-st-1)][n-st-1];    for (int i=st+1; i<n; i++)     if (adj[st][i]) numWays[1<<(i-st-1)][i-st-1] = 1;       for (int mask=1; mask < (1<<(n-st-1)); mask++) {     boolean simple = ((mask & (mask-1)) == 0);     for (int last=0; last<n-st-1; last++) if (numWays[mask][last]!=0) {      if (adj[last+st+1][st] && !simple) res += numWays[mask][last];      for (int next=0; next<n-st-1; next++)       if (adj[last+st+1][next+st+1] && (mask & (1<<next)) == 0)        numWays[mask | (1<<next)][next] += numWays[mask][last];     }    }   }     System.out.println(res/2);  }  public static void main(String[] args) throws Exception {   (new Solution()).doMain();  } }
3	public class Main {  static int inf = (int) 1e9 + 7;  public static void main(String[] args) throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));   pw = new PrintWriter(System.out);   int n = nextInt();   int a[] = new int [n];   for(int i = 0;i < n;i++) a[i] = nextInt();   int ans = 0;   boolean b[] = new boolean[n];   Arrays.sort(a);   for(int i = 0;i < n;i++) {    if (!b[i]) {     for(int j = i;j < n;j++) {      if (a[j] % a[i] == 0) b[j] = true;     }     ans++;    }   }   pw.println(ans);   pw.close();  }  static BufferedReader br;  static StringTokenizer st = new StringTokenizer("");  static PrintWriter pw;  static String next() throws IOException {   while (!st.hasMoreTokens()) st = new StringTokenizer(br.readLine());   return st.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt(next());  }  static long nextLong() throws IOException {   return Long.parseLong(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 round111A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int [] coins = new int [n];   for(int i = 0 ; i < n ; ++i)    coins[i] = sc.nextInt();   Arrays.sort(coins);   int ans = (int)1e9;   for(int i = 1 ; i <= n ; ++i){    int sum1 = 0;    int c = 0;    int j = n - 1;    for(j = n - 1 ; j >= 0 && c < i ; --j, ++c){     sum1 += coins[j];    }    int sum2 = 0;    for(int k = 0 ; k <= j ; ++k)     sum2 += coins[k];    if(sum1 > sum2){     System.out.println(i);     return;    }   }  } }
1	public class as { 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[100000000];    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();   }  }   public static void main(String[] args) throws Exception {  Reader sc=new Reader();  StringBuilder finalAnswer=new StringBuilder();   int t=sc.nextInt();  while(t-->0) {  int count=0;  int n=sc.nextInt();  if(n==2 || n==4) {   finalAnswer.append("YES").append('\n');   count++;  }  if(n%2==0 && count==0){   n/=2;   if((int)Math.sqrt(n)*(int)Math.sqrt(n)==n) {   finalAnswer.append("YES").append('\n');   count++;   }   else {   n*=2;   }  }  if(n%4==0 && count==0) {   n/=4;   if((int)Math.sqrt(n)*(int)Math.sqrt(n)==n) {   finalAnswer.append("YES").append('\n');   count++;   }  }  if(count==0){   finalAnswer.append("NO").append('\n');  }  }  System.out.println(finalAnswer); }   public static long gcd(long a, long b) {  while (b > 0)  {   long temp = b;   b = a % b;    a = temp;  }  return a; } public static long lcm(long a, long b) {  return a * (b / gcd(a, b)); } static boolean containsDigit(int number, int digit) {  while (number > 0)  {   int curr_digit = number % 10;   if (curr_digit == digit) return true;   number /= 10;  }   return false; } static boolean isPalindrome(String s) {  int n = s.length();  for (int i = 0; i < (n/2); ++i) {   if (s.charAt(i) != s.charAt(n - i - 1)) {    return false;   }  }   return true; } void sieveOfEratosthenes(int n)  {                    boolean prime[] = new boolean[n + 1];   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 * p; i <= n; i += p)      prime[i] = false;    }   }      for (int i = 2; i <= n; i++)   {    if (prime[i] == true)     System.out.print(i + " ");   }  } }
2	public class utkarsh {  InputStream is;  PrintWriter out;   long mod = (long) (1e9 + 7);  boolean SHOW_TIME;   void solve() {        long X = nl();   BigInteger x = BigInteger.valueOf(X);   long K = nl();   BigInteger k = BigInteger.valueOf(K);   BigInteger MOD = BigInteger.valueOf(mod);     if(X == 0) {    out.println(0); return;   }   if(k.compareTo(BigInteger.ZERO) == 0) {    out.println((x.add(x)).mod(MOD)); return;   }     BigInteger p = BigInteger.valueOf(modpow(2, K, mod));   BigInteger ans = x.multiply(p);   ans = ans.add(ans);   ans = ans.subtract(p).add(BigInteger.ONE);   ans = ans.add(MOD);   out.println(ans.mod(MOD));  }   long modpow(long b, long e, long mod) {   b %= mod;   long r = 1;   while(e > 0) {    if((e & 1) == 1) {     r *= b; r %= mod;    }    b *= b; b %= mod;    e >>= 1;   }   return r;  }     public static void main(String[] args) { new utkarsh().run(); }  void run() {   is = System.in;   out = new PrintWriter(System.out);   long start = System.currentTimeMillis();   solve();   long end = System.currentTimeMillis();   if(SHOW_TIME) out.println("\n" + (end - start) + " ms");   out.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[] na(int n) {   int a[] = new int[n];   for(int i = 0; i < n; i++) { a[i] = ni(); }   return a;  }  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);  } }
0	public class LuckySubstring {   static int[] luck;   public static void main(String[] args) {   Scanner s = new Scanner(System.in);     int n = s.nextInt();   int i = -1;   boolean ehLuck = false;   preencheLucky();   while (n >= luck[++i]) {    if (i > 13) {     break;    }    if (n % luck[i] == 0) {     ehLuck = true;     break;    }   }   if (ehLuck) {    System.out.println("YES");   } else {    System.out.println("NO");   }  }   static void preencheLucky() {   luck = new int[15];   luck[0] = 4;   luck[1] = 7;   luck[2] = 44;   luck[3] = 47;   luck[4] = 74;   luck[5] = 77;   luck[6] = 444;   luck[7] = 447;   luck[8] = 474;   luck[9] = 477;   luck[10] = 744;   luck[11] = 747;   luck[12] = 774;   luck[13] = 777;  }  }
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);  } }
5	public class Main {  static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));  static StringTokenizer tok;  static boolean hasNext()  {   while(tok==null||!tok.hasMoreTokens())    try{     tok=new StringTokenizer(in.readLine());    }    catch(Exception e){     return false;    }   return true;  }  static String next()  {   hasNext();   return tok.nextToken();  }  static long nextLong()  {   return Long.parseLong(next());  }  static int nextInt()  {   return Integer.parseInt(next());  }  static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));  public static void main(String[] args) {   Map<Integer,Integer> map = new HashMap();   map.put(0,1);   int n = nextInt();   int m = nextInt();   int index = -1;   int a[] = new int[n];   for(int i=0;i<n;i++){    a[i]=nextInt();    if(a[i]==m)     index=i;   }   int sum = 0;   for(int i=0;i<index;i++){    if (a[i]<m)     sum--;    else     sum++;    if (map.containsKey(sum)){     map.put(sum,map.get(sum)+1);    }else {     map.put(sum,1);    }   }   long ans = 0;   for(int i=index;i<n;i++){    if (a[i]<m)     sum--;    else if(a[i]>m)     sum++;    if (map.containsKey(sum))     ans+=map.get(sum);    if (map.containsKey(sum-1))     ans+=map.get(sum-1);   }   out.print(ans);   out.flush();  } }
5	public class p15a {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int t = in.nextInt();   if(n == 1) {    System.out.println(2);    return;   }   house[] all = new house[n];   for (int i = 0; i < all.length; i++) {    all[i] = new house(in.nextInt(),in.nextInt());   }   Arrays.sort(all);     int count = 0;   for (int i = 0; i < all.length; i++) {    double left = all[i].center - (all[i].side*1.0/2);    double right = all[i].center + (all[i].side*1.0/2);    if(i == 0) {     count++;     double left2 = all[i+1].center - (all[i+1].side*1.0/2);     if(right+t<left2) {      count++;     }     continue;        }    if(i == all.length-1) {     count++;     double right2 = all[i-1].center + (all[i-1].side*1.0/2);     if(left-t>= right2) {      count++;     }     continue;    }    double left2 = all[i+1].center - (all[i+1].side*1.0/2);    double right2 = all[i-1].center + (all[i-1].side*1.0/2);       if(right+t<left2) {     count++;    }    if(left-t>=right2)     count++;   }   System.out.println(count);    } } class house implements Comparable<house>{  int center;  int side;  public house(int a , int b) {   center = a;   side = b;  }  public int compareTo(house o) {   return center-o.center;  } }
5	public class a {   public static void main(String[] args) throws IOException {      BufferedReader input = new BufferedReader(new InputStreamReader(System.in));  BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out));  StreamTokenizer in = new StreamTokenizer(input);   in.nextToken();  int n = (int)in.nval;  int[] mas = new int[n];   for (int i = 0; i < n; i++) {  in.nextToken();  mas[i] = (int)in.nval;  }   Arrays.sort(mas);  int min = mas[0];  int i = 1;   while ((i < n)&&(min == mas[i])) {  i++;  }   if (i < n) {  output.write(Integer.toString(mas[i]));  }  else {  output.write("NO");  }  input.close();  output.close(); } }
3	public class A1 {   public static BufferedReader br;  public static StringTokenizer st;  public static String next() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     throw new RuntimeException(e);    }   }   return st.nextToken();  }   public static Integer nextInt() {   return Integer.parseInt(next());  }   public static Long nextLong() {   return Long.parseLong(next());  }   public static Double nextDouble() {   return Double.parseDouble(next());  }   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 finextDoubleMMI_fermat(long n,int M)  {   return fast_pow(n,M-2,M);  }   static long nCrModPFermat(int n, int r, int 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]* finextDoubleMMI_fermat(fac[r], p)% p * finextDoubleMMI_fermat(fac[n-r], p) % p) % p;  }   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(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 sort(int arr[])  {   int l=0;   int r=arr.length-1;   if (l < r)   {    int m = (l+r)/2;    sort(arr, l, m);    sort(arr , m+1, r);    merge(arr, l, m, r);   }  }   static long gcd(long a, long b){   if(a%b==0)    return b;   if(b%a==0)    return a;   if(a>b)    return gcd(a%b,b);   return gcd(a,b%a);  }   static PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   public static void main(String args[])throws IOException{  int i,j;   br = new BufferedReader(new InputStreamReader(System.in));   int n=nextInt();   int a[]=new int[n];   for(i=0;i<n;i++)    a[i]=nextInt();   Arrays.sort(a);   int l=0;   for(i=0;i<n;i++){    if(a[i]!=-1){     int p=a[i];     for(j=i;j<n;j++){      if(a[j]%p==0)       a[j]=-1;     }     l++;    }   }   pw.println(l);   pw.close();  } }
6	public class G {  private static int M = 1000000007, MM = 998244353; private static int N = 15,n,T; private static int[] time,gi; private static int[][][] dp;  public static void process() throws IOException {  n = sc.nextInt();T = sc.nextInt();  time = new int[n+1];  gi = new int[n+1];  for(int i=0; i<n; i++) {  int a = sc.nextInt(),b = sc.nextInt();  time[i] = a;  gi[i] = b-1;  }   dp = new int[1<<n][T+1][3];  for(int i=0; i<1<<n; i++) {  for(int j=0; j<T+1; j++) {   for(int k=0; k<3; k++)dp[i][j][k] = -1;  }  }   int ans = 0;  for(int i=0; i<n; i++) {  if(time[i] <= T) {   ans = (ans + solve(1<<i,time[i],gi[i]))%M;  }  }  println(ans); }  private static int solve(int mask, int tim, int code) {  if(tim == T)return 1;  if(dp[mask][tim][code] != -1)return dp[mask][tim][code];  int ans = 0;  for(int i=0; i<n; i++) {  if((mask>>i & 1) > 0)continue;  if(code == gi[i])continue;  if(tim + time[i] > T)continue;  ans = (ans + solve(mask|(1<<i), time[i]+tim, gi[i]))%M;    }  return dp[mask][tim][code] = (ans%M); }     static FastScanner sc; static PrintWriter out;  public static void main(String[] args) throws IOException {  boolean oj = true;  if (oj) {  sc = new FastScanner();  out = new PrintWriter(System.out);  } else {  sc = new FastScanner(100);  out = new PrintWriter("output.txt");  }  int t = 1;  while (t-- > 0) {  process();  }  out.flush();  out.close(); }  static class Pair implements Comparable<Pair> {  int x, y;  Pair(int x, int y) {  this.x = x;  this.y = y;  }  @Override  public int compareTo(Pair o) {  return Integer.compare(this.x, o.x);  } }   static void println(Object o) {  out.println(o); }  static void println() {  out.println(); }  static void print(Object o) {  out.print(o); }  static void pflush(Object o) {  out.println(o);  out.flush(); }  static int ceil(int x, int y) {  return (x % y == 0 ? x / y : (x / y + 1)); }  static long ceil(long x, long y) {  return (x % y == 0 ? x / y : (x / y + 1)); }  static int max(int x, int y) {  return Math.max(x, y); }  static int min(int x, int y) {  return Math.min(x, y); }  static int abs(int x) {  return Math.abs(x); }  static long abs(long x) {  return Math.abs(x); }  static int log2(int N) {  int result = (int) (Math.log(N) / Math.log(2));  return result; }  static long max(long x, long y) {  return Math.max(x, y); }  static long min(long x, long y) {  return Math.min(x, y); }  public static int gcd(int a, int b) {  BigInteger b1 = BigInteger.valueOf(a);  BigInteger b2 = BigInteger.valueOf(b);  BigInteger gcd = b1.gcd(b2);  return gcd.intValue(); }  public static long gcd(long a, long b) {  BigInteger b1 = BigInteger.valueOf(a);  BigInteger b2 = BigInteger.valueOf(b);  BigInteger gcd = b1.gcd(b2);  return gcd.longValue(); }   static class FastScanner {  BufferedReader br;  StringTokenizer st;  FastScanner() throws FileNotFoundException {  br = new BufferedReader(new InputStreamReader(System.in));  }  FastScanner(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;  }  int[] readArray(int n) throws IOException {  int[] A = new int[n];  for (int i = 0; i != n; i++) {   A[i] = sc.nextInt();  }  return A;  }  long[] readArrayLong(int n) throws IOException {  long[] A = new long[n];  for (int i = 0; i != n; i++) {   A[i] = sc.nextLong();  }  return A;  } }  static void ruffleSort(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;  }  Arrays.sort(a); }  static void ruffleSort(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;  }  Arrays.sort(a); } }
1	public class AMatchLists {   public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int N = in.nextInt();   HashMap<String, Integer> map = new HashMap<>();   for(int i=0; i<N; i++){    String str = in.next();    if(map.get(str)==null){     map.put(str, 0);    }    map.put(str, map.get(str)+1);   }   HashMap<String, Integer> map2 = new HashMap<>();   for(int i=0; i<N; i++){    String str = in.next();    if(map.get(str)!=null){     if(map.get(str)==1)      map.remove(str);     else      map.put(str, map.get(str)-1);    }    else{     if(map2.get(str)==null){      map2.put(str, 0);     }     map2.put(str, map2.get(str)+1);    }   }   int[] count= {0};   map2.forEach((key, value)->{     count[0] += value;     });   System.out.println(count[0]);     } }
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();  } }
5	public class AAA { public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int[] array = new int[n];  int sum = 0;  for (int i = 0; i < n; i++) {  array[i] = sc.nextInt();  sum += array[i];  }  int counter = 0;  Arrays.sort(array);  int first = 0;  for (int j = n - 1; j >= 0; j--) {  first += array[j];  sum -= array[j];  counter++;  if (first > sum) {   break;  }  }  System.out.println(counter); } }
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) throws Exception{   Scanner scan = new Scanner(System.in);   int n = scan.nextInt();   int k = scan.nextInt() - 1;   int[] arr = new int[n];   for (int i = 0; i < n; i++) {    int p = scan.nextInt();    int t = scan.nextInt();    arr[i] = -p * 10000 + t;   }   Arrays.sort(arr);   int count = 0;   for (int i = 0; i < n; i++) {    if (arr[i] == arr[k]) {     count++;    }   }   System.out.println(count);  } }
2	public class A { BufferedReader in;  PrintWriter out; StringTokenizer st;   public String next() {  while (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(in.readLine());  } catch(Exception e) {}  }  return st.nextToken(); }  public int nextInt() {  return Integer.parseInt(next());  } public long nextLong() {  return Long.parseLong(next()); }  boolean bit(int m, int i) {  return (m & (1 << i)) > 0;  }  int n, x, y, c;   long cnt(int m) {  long ret=0;  for (int i=max(1, y-m); i<=min(n, y+m); i++) {   int x1 = max(1, x - (m - abs(i - y)));   int x2 = min(n, x + (m - abs(i - y)));   ret += x2 - x1 + 1;   }  return ret;  }  public void run() {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  n = nextInt();  x = nextInt();  y = nextInt();  c = nextInt();  int l = 0, r = 1000000;  int ans=0;  while (l <= r) {  int m = (l+r) / 2;   if (cnt(m) >= c) {   ans = m;   r = m-1;   } else l=m+1;  }   out.println(ans);  out.close();  }  class Pair implements Comparable<Pair> {  long x,y;  public Pair(long x, long y) {  this.x=x;   this.y=y;  }  public int compareTo(Pair o) {  if (x != o.x) return sign(o.x - x);   return sign(y - o.y);  } }  int sign(long x) {  if (x < 0) return -1;  if (x > 0) return 1;  return 0; }  public static void main(String[] args) throws Exception {  new A().run();   } }
5	public class TaskA { BufferedReader br; PrintWriter out; StringTokenizer stok;  String nextToken() throws IOException {  while (stok == null || !stok.hasMoreTokens()) {  String s = br.readLine();  if (s == null) {   return "-1";  }  stok = new StringTokenizer(s);  }  return stok.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()); }  char nextChar() throws IOException {  return (char) (br.read()); }  String nextLine() throws IOException {  return br.readLine(); }  void solve() throws IOException {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  Arrays.sort(a);  a[n - 1] = a[n - 1] == 1 ? 2 : 1;  Arrays.sort(a);  for (int i = 0; i < n; i++) {  out.print(a[i]);  out.print(' ');  } }  void run() throws IOException {        br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  br.close();  out.close(); }  public static void main(String[] args) throws IOException {   new TaskA().run(); } }
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)); } }
5	public class Main {  BufferedReader in;  PrintWriter out;  StringTokenizer st;      void solve() throws IOException {   int n=ni();   int t=ni();     int[] center=new int[n];   int[] width=new int[n];   for(int i=0;i<n;i++){    center[i]=ni();    width[i]=ni();   }   for(int i=0;i<n;i++){    for(int j=i;j<n;j++){     if(center[i]>center[j]){      int cent=center[i];      int wid=width[i];      center[i]=center[j];      width[i]=width[j];      center[j]=cent;      width[j]=wid;     }    }   }   int count=2;   for(int i=0;i<n-1;i++){       double ideal=(double)width[i]/2+(double)width[i+1]/2+t;        double real=center[i+1]-center[i];           if(ideal==real)count++;    else{     if(ideal<real)count=count+2;    }   }   out.println(count);    }   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 A {  public static void main(String[] args) throws Exception {   new A().solve();  }  void solve() throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(in.readLine());   if (n == 0) {    System.out.println("0 0 0");    return;   }   int p2 = 0;   int p1 = 1;   while (true) {    int now = p2 + p1;    if (n == now) {     System.out.println("0 " + p1 + " " + p2);     return;    } else {     p2 = p1;     p1 = now;    }   }  } }
4	public class A { private static StreamTokenizer in; private static PrintWriter out;  private static int nextInt() throws Exception {  in.nextToken();  return (int) in.nval; }  private static String nextString() throws Exception {  in.nextToken();  return in.sval; }  public static void main(String[] args) throws Exception {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(   System.in)));  out = new PrintWriter(System.out);  String s = nextString();  int max = 0;  for (int i=0; i<s.length(); i++) {  for (int j=i+1; j<=s.length(); j++) {   String u = s.substring(i,j);   if (s.substring(i+1).indexOf(u) >= 0) {   max = Math.max(max, u.length());   }  }  }  out.println(max);   out.flush(); } }
2	public class Main { long sum ( long n ) { return (n*(n+1))/2; }  public void solve ( ) throws Exception {  Scanner in = new Scanner ( System.in );  long n = in.nextLong()-1;  long k = in.nextLong()-1;   long lo = 0, hi = k, mi;  while ( lo < hi )  {  mi = ( lo + hi ) / 2;  if ( sum(k)-sum(k-mi-1) <= n ) lo = mi+1;  else hi = mi;  }   long ans = lo;  n -= ( sum(k) - sum(k-ans) );  k -= ans;  if ( n > k ) println ( "-1" );  else if ( n == 0 ) println ( ans );  else println ( (ans+1) ); }  public static void main ( String[] args ) throws Exception { (new Main()).solve(); } public static void print ( Object o ) { System.out.print ( o ); } public static void println ( Object o ) { System.out.println ( o ); } public static void println ( ) { System.out.println ( ); } }
4	public class Main { public static void main(String[] args) {  InputStream inputStream;  try {  inputStream = new FileInputStream("input.txt");  } catch (IOException e) {  throw new RuntimeException(e);  }  OutputStream outputStream;  try {  outputStream = new FileOutputStream("output.txt");  } catch (IOException e) {  throw new RuntimeException(e);  }  PandaScanner in = new PandaScanner(inputStream);  PrintWriter out = new PrintWriter(outputStream);  C solver = new C();  solver.solve(1, in, out);  out.close(); } } class C {  final int dx[] = { -1, 0, 1, 0};  final int dy[] = { 0, -1, 0, 1};  final int SHIFT = 15;  final int COLUMN_MASK = (1 << SHIFT) - 1;  public void solve(int testNumber, PandaScanner in, PrintWriter out) {   int n = in.nextInt();   int m = in.nextInt();   boolean burning[][] = new boolean[n][m];   int k = in.nextInt();   ArrayDeque<Integer> q = new ArrayDeque<>();   for (int i = 0; i < k; i++) {    int x = in.nextInt() - 1;    int y = in.nextInt() - 1;    burning[x][y] = true;    q.add((x << SHIFT) + y);   }   int last = 0;   while (!q.isEmpty()) {    last = q.poll();    int x = last >> SHIFT;    int y = last & COLUMN_MASK;    for (int d = 0; d < 4; d++) {     int nx = x + dx[d];     int ny = y + dy[d];     if (nx >= 0 && nx < n && ny >= 0 && ny < m && !burning[nx][ny]) {      burning[nx][ny] = true;      q.add((nx << SHIFT) + ny);     }    }   }   out.printf("%d %d\n", (last >> SHIFT) + 1, (last & COLUMN_MASK) + 1);  } } class PandaScanner {  public BufferedReader br;  public StringTokenizer st;  public InputStream in;  public PandaScanner(InputStream in) {   br = new BufferedReader(new InputStreamReader(this.in = in));  }  public String nextLine() {   try {    return br.readLine();   }   catch (Exception e) {    return null;   }  }  public String next() {   if (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(nextLine().trim());    return next();   }   return st.nextToken();  }  public int nextInt() {   return Integer.parseInt(next());  }  }
4	public class Word {  static String word;  private static void check(String subword) {   int i = 0;   int j = 0;   while (j + subword.length() <= word.length()) {    if (word.substring(j).startsWith(subword)){     i++;    }    j++;   }   if (i > 1){    System.out.println(subword.length());    System.exit(0);   }  }  public static void main(String[] arg) {   Scanner in = new Scanner(System.in);   word = in.next();   if (word.length() == 1) {    System.out.println(0);    return;   }   for (int i = word.length() - 1; i > 0; i--) {    int j = 0;    while (j + i <= word.length()) {     check(word.substring(j, i+j));     j++;    }   }   System.out.println(0);  } }
4	public class ProblemA { public static void main(String[] args) {  Scanner keyboard = new Scanner(System.in);  String input = keyboard.nextLine();  boolean con = false;  for( int i = input.length()-1; i > 0 ; i--)  {   for ( int j = 0; j+i< input.length(); j++ )   for( int k = j+1; k+i <= input.length(); k++ )   if( input.substring(j,j+i).equals( input.substring(k,k+i) ) )    {    System.out.print(i+"\n");    k = input.length()+1;    j = input.length();    i = -1;    con = true;   }  }  if( con == false )  System.out.print(0+"\n"); } }
6	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);   F solver = new F();   solver.solve(1, in, out);   out.close();  }  static class F {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.ni(), m = in.ni();    int[][] a = new int[n][m];    for (int i = 0; i < n; i++) {     a[i] = in.na(m);    }    if (n == 1) {     int ans = Integer.MAX_VALUE;     for (int i = 1; i < m; i++) {      ans = Math.min(ans, Math.abs(a[0][i] - a[0][i - 1]));     }     out.println(ans);     return;    }    int[][] mk = new int[n][n];    int[][] mk1 = new int[n][n];    for (int i = 0; i < n; i++) {     for (int j = i + 1; j < n; j++) {      int minK = Integer.MAX_VALUE;      int minK1 = Integer.MAX_VALUE;      int minK2 = Integer.MAX_VALUE;      for (int l = 0; l < m; l++) {       minK = Math.min(minK, Math.abs(a[i][l] - a[j][l]));       if (l > 0) {        minK1 = Math.min(minK1, Math.abs(a[i][l] - a[j][l - 1]));        minK2 = Math.min(minK2, Math.abs(a[i][l - 1] - a[j][l]));       }      }      mk[i][j] = mk[j][i] = minK;      mk1[i][j] = minK1;      mk1[j][i] = minK2;     }    }    int ans = 0;    for (int first = 0; first < n; first++) {     int[][] dp = new int[1 << n][n];     for (int mask = 1; mask < (1 << n) - 1; mask++) {      int bc = Integer.bitCount(mask);      if ((mask & (1 << first)) != 0) {       if (bc == 1) {        dp[mask][first] = Integer.MAX_VALUE;       }       for (int i = 0; i < n; i++) {        if ((mask & (1 << i)) != 0) {         for (int j = 0; j < n; j++) {          if ((mask & (1 << j)) == 0) {           dp[mask | (1 << j)][j] = Math.max(dp[mask | (1 << j)][j], Math.min(dp[mask][i], mk[i][j]));          }         }        }       }      }     }     for (int i = 0; i < n; i++) {      if (i != first) {       ans = Math.max(ans, Math.min(dp[(1 << n) - 1][i], mk1[first][i]));      }     }    }    out.println(ans);   }  }  static class FastScanner {   private BufferedReader in;   private StringTokenizer st;   public FastScanner(InputStream stream) {    in = new BufferedReader(new InputStreamReader(stream));   }   public String ns() {    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 ni() {    return Integer.parseInt(ns());   }   public int[] na(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++) a[i] = ni();    return a;   }  } }
6	public class MaeDosDragoes { public static PrintWriter saida = new PrintWriter(System.out, false); public static class Escanear {   BufferedReader reader;   StringTokenizer tokenizer;  public Escanear() {    this(new InputStreamReader(System.in));   }  public Escanear(Reader in) {    reader = new BufferedReader(in);   }   String proximo() {    if (tokenizer == null || !tokenizer.hasMoreElements()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return tokenizer.nextToken();   }     int nextInt() {    return Integer.parseInt(proximo());   }  }   public static void main(String[] args) {  Escanear fastScanner = new Escanear();   int proximoInt = fastScanner.nextInt();   double proximoDouble = fastScanner.nextInt();   long[] graph = new long[proximoInt];   for(Integer i = 0; i < proximoInt; i++) {    for(Integer j =0; j < proximoInt; j++) {     Integer val = fastScanner.nextInt();     if (val.equals(1) || i.equals(j)) {   graph[i] |= 1L << j;   }    }   }   int szLeft = proximoInt/2;   int szRight = proximoInt - szLeft;   int[] dp = new int[1 << szLeft];   int maxMask = 1 << szLeft;   for(int mask = 1; mask <maxMask; mask++) {    int curMask = mask;    for(int j = 0; j < szLeft; j++) {     if (((1 << j) & mask) > 0) {      curMask &= graph[j + szRight] >> szRight;      dp[mask] = Math.max(dp[mask], dp[mask ^ (1 << j)]);     }    }    if (mask == curMask) {     dp[mask] = Math.max(dp[mask],Integer.bitCount(mask));    }   }   int ans = 0;   int rmaxMask = 1 << szRight;   for(int mask = 0; mask < rmaxMask; mask++) {    int curMask = mask;    int oMask = maxMask -1;    for(int j = 0; j < szRight; j++) {     if (((1 << j) & mask) > 0) {      curMask &= (graph[j] & (rmaxMask-1));      oMask &= graph[j] >> szRight;     }    }    if (curMask != mask) continue;    ans = Math.max(ans, Integer.bitCount(mask) + dp[oMask]);   }   proximoDouble/=ans;   saida.println(proximoDouble * proximoDouble * (ans * (ans-1))/2);   saida.flush();  } }
6	public class Main {  public static void main(String[] args) throws Exception {   Thread thread = new Thread(null, new TaskAdapter(), "", 1 << 27);   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);    FElongatedMatrix solver = new FElongatedMatrix();    solver.solve(1, in, out);    out.close();   }  }  static class FElongatedMatrix {   public void solve(int testNumber, FastInput in, FastOutput out) {    int n = in.readInt();    int m = in.readInt();    int[][] mat = new int[n][m];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      mat[i][j] = in.readInt();     }    }    int[][] minDist = new int[n][n];    SequenceUtils.deepFill(minDist, (int) 1e9);    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      for (int k = 0; k < m; k++) {       minDist[i][j] = Math.min(minDist[i][j], Math.abs(mat[i][k] - mat[j][k]));      }     }    }    int[][] minDistBetweenHeadAndTail = new int[n][n];    SequenceUtils.deepFill(minDistBetweenHeadAndTail, (int) 1e9);    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      for (int k = 1; k < m; k++) {       minDistBetweenHeadAndTail[i][j] = Math.min(minDistBetweenHeadAndTail[i][j], Math.abs(mat[i][k] - mat[j][k - 1]));      }     }    }    Log2 log2 = new Log2();    BitOperator bo = new BitOperator();    int[][][] dp = new int[1 << n][n][n];    for (int i = 1; i < (1 << n); i++) {     if (i == Integer.lowestOneBit(i)) {      dp[i][log2.floorLog(i)][log2.floorLog(i)] = (int) 1e9;      continue;     }     for (int j = 0; j < n; j++) {      for (int k = 0; k < n; k++) {       if (bo.bitAt(i, j) == 0) {        continue;       }       for (int t = 0; t < n; t++) {        dp[i][j][k] = Math.max(dp[i][j][k],          Math.min(dp[bo.setBit(i, j, false)][t][k],            minDist[j][t]));       }      }     }    }    int ans = 0;    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      ans = Math.max(ans, Math.min(dp[(1 << n) - 1][i][j], minDistBetweenHeadAndTail[j][i]));     }    }    out.println(ans);   }  }  static class SequenceUtils {   public static void deepFill(Object array, int val) {    if (!array.getClass().isArray()) {     throw new IllegalArgumentException();    }    if (array instanceof int[]) {     int[] intArray = (int[]) array;     Arrays.fill(intArray, val);    } else {     Object[] objArray = (Object[]) array;     for (Object obj : objArray) {      deepFill(obj, val);     }    }   }  }  static class Log2 {   public int floorLog(int x) {    return 31 - Integer.numberOfLeadingZeros(x);   }  }  static class FastInput {   private final InputStream is;   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 int readInt() {    int sign = 1;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+' ? 1 : -1;     next = read();    }    int val = 0;    if (sign == 1) {     while (next >= '0' && next <= '9') {      val = val * 10 + next - '0';      next = read();     }    } else {     while (next >= '0' && next <= '9') {      val = val * 10 - next + '0';      next = read();     }    }    return val;   }  }  static class BitOperator {   public int bitAt(int x, int i) {    return (x >> i) & 1;   }   public int setBit(int x, int i, boolean v) {    if (v) {     x |= 1 << i;    } else {     x &= ~(1 << i);    }    return x;   }  }  static class FastOutput implements AutoCloseable, Closeable {   private StringBuilder cache = new StringBuilder(10 << 20);   private final Writer os;   public FastOutput(Writer os) {    this.os = os;   }   public FastOutput(OutputStream os) {    this(new OutputStreamWriter(os));   }   public FastOutput println(int c) {    cache.append(c).append('\n');    return this;   }   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 ErrorCorrectSystem {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  String a = scan.next();  String b = scan.next();   int[][] mismatch = new int[26][26];  for(int i = 0; i < 26; i++) Arrays.fill(mismatch[i], -1);  int[][] pair = new int[2][26];  for(int i = 0; i < 2; i++) Arrays.fill(pair[i], -1);  int hd = 0;  for(int i = 0; i < n; i++) {  if(a.charAt(i) != b.charAt(i)) {   hd++;   mismatch[a.charAt(i)-'a'][b.charAt(i)-'a'] = i;   pair[0][a.charAt(i)-'a'] = i;   pair[1][b.charAt(i)-'a'] = i;  }  }  for(int i = 0; i < 26; i++) {  for(int j = i+1; j < 26; j++) {   if(mismatch[i][j] > -1 && mismatch[j][i] > -1) {   System.out.println(hd-2);   System.out.println((mismatch[i][j]+1)+" "+(mismatch[j][i]+1));   return;   }  }  }  for(int i = 0; i < n; i++) {  if(a.charAt(i) != b.charAt(i)) {     if(pair[0][b.charAt(i)-'a'] > -1) {   System.out.println(hd-1);   System.out.println((i+1)+" "+(pair[0][b.charAt(i)-'a']+1));   return;   }  }  }   System.out.println(hd);  System.out.println("-1 -1"); } }
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 CF11D { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int m = sc.nextInt();  boolean[][] map = new boolean[n][n];  long[][] dp = new long[1 << n][n];  for (int i = 0; i < m; i++) {  int a = sc.nextInt() - 1;  int b = sc.nextInt() - 1;  map[a][b] = map[b][a] = true;  dp[(1 << a) + (1 << b)][Math.max(a, b)] = 1;  }  long ans = 0;  for (int mask = 1; mask < (1 << n); mask++) {  int lowbit = 0;  for (; (mask & (1 << lowbit)) == 0; lowbit++);  for (int i = lowbit + 1; i < n; i++) {   if ((mask & (1 << i)) == 0) {   continue;   }   for (int j = lowbit + 1; j < n; j++) {   if ((mask & (1 << j)) == 0 || j == i) {    continue;   }   if (map[i][j]) {    dp[mask][i] += dp[mask ^ (1 << i)][j];   }   }   if (map[lowbit][i]) {   ans += dp[mask][i];   }  }  }  System.out.println((ans - m) / 2);  sc.close(); } }
5	public class A {  static class Sort implements Comparable<Sort> {   int x,a;   public int compareTo(Sort o) {    if (this.x==o.x)     return this.a-o.a;    return this.x-o.x;   }  }  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int t = sc.nextInt();   Sort[]a = new Sort[n];   for (int i = 0; i < n; i++) {    a[i] = new Sort();    a[i].x = sc.nextInt();    a[i].a = sc.nextInt();   }   Arrays.sort(a);   int ans = 2;   for (int i = 1; i < n; i++) {    double d = a[i].x-a[i].a / 2.0-a[i-1].x-a[i-1].a / 2.0;    if (d==t)     ans++;    else if (d > t)     ans += 2;   }   System.out.println(ans);  } }
1	public class pr1073B {  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(System.out);   int n = Integer.parseInt(br.readLine());   int[] a = new int[n];   int[] b = new int[n];   StringTokenizer st = new StringTokenizer(br.readLine());   for (int i = 0; i < n; i++) {    a[i] = Integer.parseInt(st.nextToken());   }   st = new StringTokenizer(br.readLine());   for (int i = 0; i < n; i++) {    b[i] = Integer.parseInt(st.nextToken());   }   solve(n, a, b, out);   out.flush();   out.close();  }  private static void solve(int n, int[] a, int[] b, PrintWriter out) {   boolean[] book = new boolean[n+1];   boolean f;   int j1 = 0, j2 = 0;   for (int i = 0; i < n; i++) {    f = false;    int num = b[i];    if(!book[num]) {     f = true;     j1 = j2;     for (;j2 < n; j2++) {      book[a[j2]] = true;      if (a[j2] == num) {       j2++;       break;      }     }    }    out.print(f ? j2-j1 + " ": 0 + " ");   }  } }
3	public class F11141 { static class Solver {  ArrayList<int[]> ranges[];  HashMap<Long, Integer> hm = new HashMap<>();  int id(long s) {  if (!hm.containsKey(s))   hm.put(s, hm.size());  return hm.get(s);  }     int[] memo;  int go(int r) {  memo[N] = 0;  int last = N;  for(int[] a : ranges[r]) {   while(a[0] < last) {   memo[last - 1] = memo[last];   last--;   }   memo[a[0]] = Math.max(memo[a[0]], Math.max(memo[a[0]], 1 + memo[a[1] + 1]));   last = a[0];  }  while(0 < last) {   memo[last - 1] = memo[last];   last--;  }  return memo[0];  }  ArrayDeque<int[]> ans = new ArrayDeque<>();   void go2(int r) {  memo[N] = 0;  int last = N;  int minAt[] = new int[N], oo = 987654321;  Arrays.fill(minAt, oo);  for(int[] a : ranges[r]) {   minAt[a[0]] = Math.min(minAt[a[0]], a[1] - a[0]);   while(a[0] < last) {   memo[last - 1] = memo[last];   last--;   }   memo[a[0]] = Math.max(memo[a[0]], Math.max(memo[a[0]], 1 + memo[a[1] + 1]));   last = a[0];  }  while(0 < last) {   memo[last - 1] = memo[last];   last--;  }  int k = 0;  for(; k < N;) {   if(minAt[k] == oo || memo[k] != 1 + memo[k + minAt[k] + 1]) k++;   else {   ans.push(new int[] {k, k + minAt[k]});   k += minAt[k] + 1;   }  }  }   @SuppressWarnings("unchecked")  Solver() {  ranges = new ArrayList[2250001];  for (int i = 0; i < ranges.length; i++)   ranges[i] = new ArrayList<>();  }  int N, LID;  long[] a;  void solve(Scanner s, PrintWriter out) {  N = s.nextInt();  a = new long[N + 1];  for (int i = 1; i <= N; i++)   a[i] = s.nextLong() + a[i - 1];  for (int i = N; i >= 1; i--)   for (int j = i; j <= N; j++) {   int x = id(a[j] - a[i - 1]);   ranges[x].add(new int[] { i - 1, j - 1 });   }    int best = 0, bid = -1;  memo = new int[N + 1];  Arrays.sort(ranges, (a, b) -> b.size() - a.size());  for(int i = 0; i < ranges.length; i++, LID++) {   if(ranges[i].size() <= best) break;   int ans = go(i);   if(ans > best) {   best = ans;   bid = i;   }  }      out.println(best);  go2(bid);      while(!ans.isEmpty()) {   int[] c = ans.pop();   out.println(++c[0] + " " + ++c[1]);  }    }  }  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  Solver solver = new Solver();  solver.solve(s, out);  out.close();  } }
1	public class Main {  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  int n = s.nextInt(), d = s.nextInt();  int[] arr = new int[n];  for(int i = 0; i < n; i++){  arr[i] = s.nextInt();  }  Arrays.sort(arr);  int count = 0;  for(int i = 1; i < n; i++){  int dist = arr[i] - arr[i - 1];  if(dist > 2 * d){   count += 2;  }else if(dist == 2 * d){   count++;  }    }  System.out.println(count + 2);  } }
4	public class A implements Runnable {  BufferedReader br; StringTokenizer in; PrintWriter out;  public static void main(String[] args) {  new Thread(new A()).start(); }  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 long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  public double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  public void solve() throws IOException {  String s = nextToken();  int max = 0;  for(int i = 0 ; i < s.length(); i++)  for(int j = i+1 ; j < s.length(); j ++){   String sub = s.substring(i, j);   int kv = 0;   for(int k = 0 ; k<= s.length() - sub.length(); k ++){   boolean ok = true;   for(int g = 0 ; g < sub.length(); g ++)   if (sub.charAt(g) != s.charAt(g+k)){    ok = false;    break;   }   if (ok) kv ++;   }   if (kv > 1)   max = Math.max(max, sub.length());  }    out.println(max); }  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);  }  } }
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()) ; } }
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; } }
6	public class Test { static PrintWriter writer =  new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  static int readInt() {  int ans = 0;  boolean neg = false;  try {  boolean start = false;  for (int c = 0; (c = System.in.read()) != -1; ) {   if (c == '-') {   start = true;   neg = true;   continue;   } else if (c >= '0' && c <= '9') {   start = true;   ans = ans * 10 + c - '0';   } else if (start) break;  }  } catch (IOException e) {  }  return neg ? -ans : ans; }  static long readLong() {  long ans = 0;  boolean neg = false;  try {  boolean start = false;  for (int c = 0; (c = System.in.read()) != -1; ) {   if (c == '-') {   start = true;   neg = true;   continue;   } else if (c >= '0' && c <= '9') {   start = true;   ans = ans * 10 + c - '0';   } else if (start) break;  }  } catch (IOException e) {  }  return neg ? -ans : ans; }  static String readLine() {  StringBuilder b = new StringBuilder();  try {  boolean start = false;  for (int c = 0; (c = System.in.read()) != -1; ) {   if (Character.isLetterOrDigit(c)) {   start = true;   b.append((char) c);   } else if (start) break;  }  } catch (IOException e) {  }  return b.toString(); }  public static void main(String[] args) {  Test te = new Test();  te.start();  writer.flush(); }  void start() {  int t = readInt();  while (t-- > 0) {  int n = readInt(), m = readInt();  int[][] a = new int[n][m];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++)   a[i][j] = readInt();  int[] dp = new int[1<<n];  Arrays.fill(dp, -1);  dp[0] = 0;  for (int c = 0; c < m; c++) {   for (int i = (1 << n) - 1; i >= 0; i--) {   int u = (1 << n) - 1 - i;   int p = u;   if (dp[i] >= 0)    while (p > 0) {    for (int r = 0; r < n; r++) {     int sum = 0;     for (int j = 0; j < n; j++) if (((p >> j) & 1) != 0) sum += a[(j + r) % n][c];     dp[i | p] = Math.max(dp[i | p], dp[i] + sum);     }    p = (p - 1) & u;    }   }  }  writer.println(dp[(1<<n) - 1]);  } } }
4	public class Main {  public static void main(String[] args) throws IOException {   Scanner scn = new Scanner(new File("input.txt"));   BufferedWriter out = new BufferedWriter(new FileWriter("output.txt"));      int r = scn.nextInt();   int c = scn.nextInt();     int[][] a = new int[r][c];     for(int[] i: a)    Arrays.fill(i, 1<<30);     int k = scn.nextInt();      Queue<State> q = new LinkedList<State>();   for(int l = 0; l < k; l++){    int i = scn.nextInt()-1;    int j = scn.nextInt()-1;      a[i][j] = 0;    q.add(new State(i, j, 0));   }     while(!q.isEmpty()){    State st = q.poll();       a[st.i][st.j] = st.c;       for(int d = 0; d < 4; d++){     int ii = st.i + di[d];     int jj = st.j + dj[d];         if(ii < 0 || ii >= r || jj < 0 || jj >= c)continue;     if(a[ii][jj] != 1 << 30)continue;         a[ii][jj] = st.c+1;     q.add(new State(ii, jj, st.c+1));    }   }     int max = 0;   for(int i = 0; i < r; i++)    for(int j = 0; j < c; j++)     max = Math.max(max, a[i][j]);     for(int i = 0; i < r; i++)    for(int j = 0; j < c; j++)     if(a[i][j] == max){      out.write((i+1)+" "+(j+1));      out.newLine();           out.close();           return;     }    }  static int[] di = {0, 0, -1, 1};  static int[] dj = {1, -1, 0, 0}; } class State{  int i, j, c;  public State(int ii, int ji, int ci){   i = ii;   j = ji;   c = ci;  } }
4	public class TaskC extends Thread {  public TaskC() {   try {    this.input = new BufferedReader(new FileReader("input.txt"));    this.output = new PrintWriter("output.txt");    this.setPriority(Thread.MAX_PRIORITY);   } catch (Throwable e) {    System.exit(666);   }  }  private void solve() throws Throwable {   int n = nextInt();   int m = nextInt();   int k = nextInt();   Queue<Integer> qX = new ArrayDeque<Integer>();   Queue<Integer> qY = new ArrayDeque<Integer>();   boolean [][]was = new boolean[n][m];   for (int i = 0; i < k; ++i) {    int x = nextInt() - 1, y = nextInt() - 1;    qX.add(x);    qY.add(y);    was[x][y] = true;   }   int lastX = -1, lastY = -1;   while (!qX.isEmpty()) {    lastX = qX.poll();    lastY = qY.poll();    for (int i = 0; i < dx.length; ++i) {     int nextX = lastX + dx[i], nextY = lastY + dy[i];     if (nextX < n && nextY < m && nextX >= 0 && nextY >= 0 && !was[nextX][nextY]) {      qX.add(nextX);      qY.add(nextY);      was[nextX][nextY] = true;     }    }   }   ++lastX;   ++lastY;   output.println(lastX + " " + lastY);   }  public void run() {   try {    solve();   } catch (Throwable e) {    System.err.println(e.getMessage());    e.printStackTrace();    System.exit(666);   } finally {    output.flush();    output.close();   }  }  public static void main(String[] args) {   new TaskC().start();  }  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 String nextToken() throws IOException {   while (tokens == null || !tokens.hasMoreTokens()) {    tokens = new StringTokenizer(input.readLine());   }   return tokens.nextToken();  }  static final int PRIME = 3119;  static final int[]dx = {1, -1, 0, 0}, dy = {0, 0, -1, 1};  private BufferedReader input;  private PrintWriter output;  private StringTokenizer tokens = null; }
2	public class first { public static long power(long x, long y, long p)  {   long res = 1;   x = x % p;   while (y > 0)   { if((y & 1)==1)     res = (res * x) % p;    y = y >> 1;    x = (x * x) % p;   }   return res;  }  public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  long x=sc.nextLong();  long k=sc.nextLong();  long mod=1000000007;  if(k==0 || x==0)  System.out.println((2*x)%mod);  else  { long answer=1;  answer+=(power(2,k,mod))*(((2*x)-1)%mod);  System.out.println(answer%mod);  } } }
6	public class Main {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int m = scan.nextInt();  boolean[][] graph = new boolean[n][n];  for (int i = 0; i < m; i++) {  int u = scan.nextInt() - 1;  int v = scan.nextInt() - 1;  graph[u][v] = true;  graph[v][u] = true;  }  long[][] dp = new long[1 << n][n];  long sum = 0;  for (int i = 0; i < n; i++)  dp[1 << i][i] = 1;  for (int mask = 1; mask < (1 << n); mask++) {   int first = Integer.numberOfTrailingZeros(mask);   for (int i = 0; i < n; i++) {   if ((mask & (1 << i)) == 0 || first == i)   continue;   for (int j = 0; j < n; j++) {   if (graph[i][j] && (mask & (1 << j)) != 0)    dp[mask][i] += dp[mask ^ 1 << i][j];   }   if (Integer.bitCount(mask) >= 3 && graph[i][first])   sum += dp[mask][i];  }  }  System.out.println(sum / 2);  scan.close(); } }
0	public class Hexadecimaltheorem { public static void main(String[] args) {  BufferedReader buf = new BufferedReader(   new InputStreamReader(System.in));  int x;  ArrayList<Integer> arr = new ArrayList<Integer>();  arr.add(0);  arr.add(1);  try {  while ((x = Integer.parseInt(buf.readLine())) != -1) {   if (x == 1) {    System.out.println(arr.get(0) + " " + arr.get(0) + " "    + arr.get(1));   } else if (x == 0) {   System.out.println(arr.get(0) + " " + arr.get(0) + " "    + arr.get(0));   } else {   int i = 1;   while (x > arr.get(arr.size() - 1)) {    arr.add(arr.get(i) + arr.get(i - 1));    i++;   }   System.out.println(arr.get(0) + " " + arr.get(i - 2) + " "    + arr.get(i - 1));   }  }  } catch (NumberFormatException e) {    e.printStackTrace();  } catch (IOException e) {    e.printStackTrace();  } } }
2	public class Main{  public static long howMany(long n, long x, long y, long s){   long res = 0;   int cnt = 0;   long[] px = new long[9];   long[] py = new long[9];   if(x - s < 1){    px[cnt] = 1;    py[cnt++] = y-x+s+1 <= n ? y-x+s+1 : n;    px[cnt] = 1;    py[cnt++] = x+y-s-1 > 0? x+y-s-1: 1;    res += 6;   }else{    px[cnt] = x-s;    py[cnt++] = y;    res += 2;   }     if(y - s < 1){    py[cnt] = 1;    px[cnt++] = x+y-s-1 > 0 ? x+y-s-1 : 1;    py[cnt] = 1;    px[cnt++] = x-(y-s)+1 <= n ? x-y+s+1: n;    res += 6;   }else{    px[cnt] = x;    py[cnt++] = y-s;    res += 2;   }     if(x + s > n){    px[cnt] = n;    py[cnt++] = y-(x+s)+n > 0 ? y-(x+s)+n : 1;    px[cnt] = n;    py[cnt++] = x+s+y - n <= n ? x+s+y-n : n;    res += 6;   }else{    px[cnt] = x+s;    py[cnt++] = y;    res += 2;   }     if(y + s > n){    py[cnt] = n;    px[cnt++] = x+y+s-n <= n? x+y+s-n : n;    py[cnt] = n;    px[cnt++] = n-(y+s-x) > 0 ? n-(y+s-x) :1;    res += 6;   }else{    px[cnt] = x;    py[cnt++] = y+s;    res += 2;   }     px[cnt] = px[0];   py[cnt] = py[0];     long ret = 0;   long sum = 0;   for(int i = 0; i < cnt; i++){    ret += px[i]*py[i+1]-py[i]*px[i+1];    sum += Math.max(Math.abs(px[i]-px[i+1]), Math.abs(py[i]-py[i+1]))+1;   }   return (4*ret + 4*sum - res)/8;  }   public static void main(String[] args) throws Exception{   BufferedReader r = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer str = new StringTokenizer(r.readLine());   int n = Integer.parseInt(str.nextToken());   int x = Integer.parseInt(str.nextToken());   int y = Integer.parseInt(str.nextToken());   long c = Long.parseLong(str.nextToken());   if(c == 1){    System.out.println(0);    return;   }   long high = 1;   while(howMany(n, x, y, high) < c){    high <<= 1;   }   long low = high>>1;   while(high - low > 1){    long med = (high+low)/2;    if(howMany(n, x, y, med) < c){     low = med;    }else{     high = med;    }   }   System.out.println(high);  } }
0	public class problemB185 {  public static void main(String[] args) throws IOException{  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  StringBuffer sb=new StringBuffer();  int n=Integer.parseInt(br.readLine());   if(n<0){  int temp=-n;  int temp2=temp/10;  int x=temp%10;  int y=temp2%10;  if(x>y){   temp=temp/10;  }  else{   temp=temp/10 -y +x;  }  n=-temp;      }  System.out.println(n);   }   }
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();   }  } }
2	public class Main {  static int d[][];  static int N;  static boolean used[];  static class point  {   int x = 0;   int y = 0;  }  static point dats[];    public static void main(String[] args)  {   Scanner scan = new Scanner(System.in);        long n = scan.nextLong();   long k = scan.nextLong();   if(n==1)   {    System.out.print("0");    return;   }   if(n<=k)   {    System.out.print("1");    return;   }   long d = 9-4*(2*n-k*k+k);   if(d<0)   {    System.out.print("-1");    return;   }   double a = ((3+Math.sqrt(d)) / 2) ;    if(a>=1)     System.out.println(Math.max(2, k-(long)a+1));    else    System.out.println(-1);       }   }
0	public class Main { public static int gcd(int a , int b) {  if (b == 0) return 0;  else {  return a / b + gcd (b , a % b);  } }  public static void main(String[] args) {  Scanner sc = new Scanner (System.in);  int testCase = sc.nextInt();  while (testCase-- > 0) {  int n = sc.nextInt();  int m = sc.nextInt();  if (n < m) {   int temp = n;   n = m;   m = temp;  }   int ans = gcd (n , m);  System.out.println(ans);  } } }
5	public class A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   int n = sc.nextInt();   int[] a = new int[n];   int sum = 0;   for (int i = 0; i < n; i++) {    a[i] = sc.nextInt();    sum += a[i];   }   for (int i = 0; i < n; i++)    a[i] *= -1;   Arrays.sort(a);   for (int i = 0; i < n; i++)    a[i] *= -1;   int ans = 0;   int sum1 = 0;   for (int i = 0; i < n; i++) {    sum1 += a[i];    sum -= a[i];    ans++;    if (sum1 > sum)     break;   }   pw.print(ans);   pw.close();  } }
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)];  } }; }
2	public class B {  public void solve() throws IOException {   long n = nextInt(), k = nextInt();   long c = 2 * (n + k);   long l = -1, r = 200000;   while (r - l > 1) {    long m = l + (r - l) / 2;    if (m * m + 3 * m >= c) {     r = m;    } else {     l = m;    }   }   out.print(n - r);  }  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);   }  }  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 long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  public int[] nextArr(int n) throws IOException {   int[] res = new int[n];   for (int i = 0; i < n; i++) {    res[i] = nextInt();   }   return res;  }  public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);   new B().run();  } }
0	public class ProbA { int account;  void start(Scanner sc, PrintStream out) {  int ans = 0;  account = sc.nextInt();  int account1 = account / 10;  int account2 = (account - (account % 100)) / 10 + (account % 10);    out.println(Math.max(account1, Math.max(account, account2))); }  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  PrintStream out = System.out;  new ProbA().start(sc, out);  } }
5	public class P166A {  public static void main(String[] args) throws Exception {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int k = in.nextInt();   Point[] P = new Point[n];   for(int i=0; i<n; i++)    P[i] = new Point(in.nextInt(), in.nextInt());   Arrays.sort(P, new Comparator<Point>() {    public int compare(Point A, Point B) {     if(A.x != B.x) return B.x-A.x;     return A.y - B.y;    }   });   int cnt = 0;   Point ans = P[k-1];   for(int i=0; i<n; i++) {    if(P[i].x == ans.x && P[i].y==ans.y)     cnt++;   }   System.out.println(cnt);  } }
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());  } } }
3	public class Main {  static int N;  static int [][] dp;  static int M = (int)(1e9 + 7);  static ArrayList<Integer> l;  static int f(int idx, int b) {   if(idx == l.size())    return 1;   if(dp[idx][b] != -1)    return dp[idx][b];   long ret = f(idx + 1, b + l.get(idx));   if(b > 0)    ret += f(idx, b - 1);   return dp[idx][b] = (int) (ret % M);  }  public static void main(String[] args) throws IOException{  Scanner sc = new Scanner();  N = sc.nextInt();   int [] val = new int[N];   for(int i = 0; i < N; ++i)    if(sc.next().charAt(0) == 's')     val[i] = 0;    else     val[i] = 1;   l = new ArrayList<Integer>();   l.add(val[0]);   for(int i = 1; i < N; ++i)    if(val[i] == val[i - 1] && val[i] == 1) {     int prev = l.get(l.size() - 1);     l.set(l.size() - 1, ++prev);    } else if(val[i - 1] == 0){     l.add(val[i]);    }    dp = new int[l.size() + 1][N + 1];   for(int i = 0; i <= l.size(); ++i)    Arrays.fill(dp[i], -1);   System.out.println(f(0, 0));  }   static class Scanner {   BufferedReader br;   StringTokenizer st;   Scanner() {    br = new BufferedReader(new InputStreamReader(System.in));   }   String next() throws IOException {    while (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());   }   String nextLine() throws IOException {    return br.readLine();   }  } }
2	public class B {  final String filename = new String("B").toLowerCase();  int n; int r, c;  void solve() throws Exception {  n = nextInt();  r = nextInt() - 1;  c = nextInt() - 1;  long count = nextLong();  long left = -1, right = n * 2L;  while (left < right - 1) {  long mid = (left + right) / 2;   if (getSq(n, r, c, mid) >= count) {   right = mid;  } else {   left = mid;  }  }      out.println(right); }  long getSq(int n, int x, int y, long size) {  long cur = (size + 1) * (size + 1) + size * size;   cur -= get(x + size - (n - 1));  cur -= get(y + size - (n - 1));  cur -= get(-(x - size));  cur -= get(-(y - size));   cur += getCorner((x + 1) + (y + 1) - (size + 1));  cur += getCorner((x + 1) + (n - y) - (size + 1));  cur += getCorner((n - x) + (y + 1) - (size + 1));  cur += getCorner((n - x) + (n - y) - (size + 1));   return cur; }  private long getCorner(long min) {  if (min >= 0) {  return 0;  }  min = -min;  return min * (min + 1) / 2; }  long get(long a) {  if (a <= 0) {  return 0;  }  return a * a; }  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 B().run(); } }
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;   }    } }
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);   F solver = new F();   solver.solve(1, in, out);   out.close();  }  static class F {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.ni();    int[] a = in.na(n);    TreeMap<Integer, TreeMap<Integer, Segment>> map = new TreeMap<>();    int[] pref = new int[n + 1];    for (int i = 0; i < n; i++) {     pref[i + 1] = pref[i] + a[i];    }    for (int i = 0; i < n; i++) {     for (int j = i; j >= 0; j--) {      int val = pref[i + 1] - pref[j];      TreeMap<Integer, Segment> dp = map.computeIfAbsent(val, k -> new TreeMap<>());      if (!dp.containsKey(i)) {       Map.Entry<Integer, Segment> lastEntry = dp.lastEntry();       if (lastEntry == null) {        dp.put(i, new Segment(j, i, 1, null));       } else {        Segment lastValue = lastEntry.getValue();        Map.Entry<Integer, Segment> prev = dp.lowerEntry(j);        if (prev == null) {         if (lastValue.dp >= 1)          dp.put(i, lastValue);         else          dp.put(i, new Segment(j, i, 1, null));        } else if (lastValue.dp >= prev.getValue().dp + 1) {         dp.put(i, lastValue);        } else {         dp.put(i, new Segment(j, i, prev.getValue().dp + 1, prev.getValue()));        }       }      }     }    }    Segment best = null;    for (TreeMap<Integer, Segment> segments : map.values()) {     Segment seg = segments.lastEntry().getValue();     if (best == null || best.dp < seg.dp) {      best = seg;     }    }    if (best == null)     throw new RuntimeException("Null best");    out.println(best.dp);    while (best != null) {     out.printf("%d %d%n", best.from + 1, best.to + 1);     best = best.prev;    }   }   class Segment {    int from;    int to;    int dp;    Segment prev;    public Segment(int from, int to, int dp, Segment prev) {     this.from = from;     this.to = to;     this.dp = dp;     this.prev = prev;    }   }  }  static class FastScanner {   private BufferedReader in;   private StringTokenizer st;   public FastScanner(InputStream stream) {    in = new BufferedReader(new InputStreamReader(stream));   }   public String ns() {    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 ni() {    return Integer.parseInt(ns());   }   public int[] na(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++) a[i] = ni();    return a;   }  } }
4	public class R035CRetry {  public void debug(Object... objects) { System.err.println(Arrays.deepToString(objects)); }  public static final int INF = 987654321;  public static final long LINF = 987654321987654321L;  public static final double EPS = 1e-9;   Scanner scanner;  PrintWriter out;  boolean[][] bss;   public R035CRetry() {   try {    this.scanner = new Scanner(new File("input.txt"));    this.out = new PrintWriter("output.txt");   } catch(FileNotFoundException ex) { ex.printStackTrace(); }  }   class Point implements Comparable<Point> {   int x, y, count;   Point(int x, int y) { this.x = x; this.y = y; }   public int hashCode() { return x * 17 + y; }   public boolean equals(Object o) {    if(!(o instanceof Point)) return false;    Point that = (Point)o;    return this.x == that.x && this.y == that.y;   }   public int compareTo(Point that) { return this.count - that.count; }   public String toString() { return "(" + x + ", " + y + ":" + count + ")"; }  }    int[] dx = new int[] { 0, 0, -1, 1 };  int[] dy= new int[] { -1, 1, 0, 0 };  int n, m;   Queue<Point> q;   Point bfs() {   int max = -INF;   Point p = null;   while(!q.isEmpty()) {    Point cur = q.remove();    if(max < cur.count) { max = cur.count; p = cur; }    for(int i=0; i<dx.length; i++) {     int nx = cur.x + dx[i];     int ny = cur.y + dy[i];     if(nx < 0 || nx >= n) { continue; }     if(ny < 0 || ny >= m) { continue; }     Point np = new Point(nx, ny);     if(bss[nx][ny] ) { continue; }     np.count = cur.count+1;     bss[nx][ny] = true;     q.add(np);    }   }   return p;  }   private void solve() {   this.n = scanner.nextInt();   this.m = scanner.nextInt();   this.bss = new boolean[n][m];   int k = scanner.nextInt();   q = new PriorityQueue<Point>();   for(int i=0; i<k; i++) {    int x = scanner.nextInt() - 1;    int y = scanner.nextInt() - 1;    Point init = new Point(x, y);    init.count = 1;    q.add(init);    bss[x][y] = true;   }   Point p = bfs();   out.println((p.x+1) + " " + (p.y+1));  }   private void finish() { this.out.close(); }   public static void main(String[] args) {   R035CRetry obj = new R035CRetry();   obj.solve();   obj.finish();  } }
1	public class B_14 {  @SuppressWarnings("resource") public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int t = input.nextInt();  for(int test = 0; test < t; test++){  int n = input.nextInt();  if(n % 2 == 0){   if(Math.sqrt(n / 2) == (int)(Math.sqrt(n / 2))){   System.out.println("YES");   }else if(n % 4 == 0 && Math.sqrt(n / 4) == (int)(Math.sqrt(n / 4))){   System.out.println("YES");   }else{   System.out.println("NO");   }  }else{   System.out.println("NO");  }  } }  }
0	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 T = sc.nextInt();  if ( T > 0)  System.out.println(T);  else{  String cad = (T + "");  int min = Math.min(cad.charAt(cad.length() - 1) - '0', cad.charAt(cad.length() - 2) - '0');  if (min == 0 && cad.length() == 3)   System.out.println(0);  else   System.out.println(cad.substring(0, cad.length() - 2) + "" + min);  } }  }
5	public class C113A{  static BufferedReader br;  public static void main(String args[])throws Exception{   br=new BufferedReader(new InputStreamReader(System.in));   int nm[]=toIntArray();   int n=nm[0];   int k=nm[1];   Pai p[]=new Pai[n];   for(int i=0;i<n;i++){    nm=toIntArray();    p[i]=new Pai(nm[0],nm[1]);   }   Arrays.sort(p);   int count=0;   for(int i=0;i<n;i++){    if(p[k-1].first==p[i].first && p[k-1].second==p[i].second){     count++;    }   }   System.out.println(count);  }    public static int[] toIntArray()throws Exception{   String str[]=br.readLine().split(" ");   int k[]=new int[str.length];   for(int i=0;i<str.length;i++){    k[i]=Integer.parseInt(str[i]);   }   return k;  }  public static int toInt()throws Exception{   return Integer.parseInt(br.readLine());  }  public static long[] toLongArray()throws Exception{   String str[]=br.readLine().split(" ");   long k[]=new long[str.length];   for(int i=0;i<str.length;i++){    k[i]=Long.parseLong(str[i]);   }   return k;  }  public static long toLong()throws Exception{   return Long.parseLong(br.readLine());  }  public static double[] toDoubleArray()throws Exception{   String str[]=br.readLine().split(" ");   double k[]=new double[str.length];   for(int i=0;i<str.length;i++){    k[i]=Double.parseDouble(str[i]);   }   return k;  }  public static double toDouble()throws Exception{   return Double.parseDouble(br.readLine());  }  public static String toStr()throws Exception{   return br.readLine();  }  public static String[] toStrArray()throws Exception{   String str[]=br.readLine().split(" ");   return str;  }   } class Pai implements Comparable<Pai> {  int first;  int second;  public Pai(int f, int s) {   first = f;   second = s;  }  public int compareTo(Pai p) {   int ret = 0;   if (first < p.first) {    ret = 1;   } else if (first > p.first) {    ret = -1;   } else {    if(second<p.second){     ret=-1;    }    else if(second>p.second){     ret=1;    }    else ret=0;   }   return ret;  } }
1	public class ProblemC {  public static void main(String[] args) {   ProblemC problem = new ProblemC();   problem.solve();  }  private void solve() {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   String s = sc.next();   int ret = n;   int toth = 0;   int tott = 0;   for (int j = 0; j < n; j++) {    if (s.charAt(j) == 'H') {     toth++;    } else {     tott++;    }   }   for (int j = 0; j < n; j++) {    int cnth = 0;    for (int k = 0; k < toth; k++) {     int pos = (j + k) % n;     if (s.charAt(pos) == 'H') {      cnth++;     }    }    int makeh = toth - cnth;    ret = Math.min(ret, makeh);   }   System.out.println(ret);  } }
1	public class IQ {  public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  ArrayList<Integer> e=new ArrayList<Integer>();  ArrayList<Integer> o=new ArrayList<Integer>();  int size=sc.nextInt();  for(int w=0;w<size;w++)  {  int x=sc.nextInt();  if(x%2==0)e.add(w+1);  else o.add(w+1);  }  if(e.size()==1)System.out.println(e.get(0));  else System.out.println(o.get(0));  } }
0	public class Main {  public static void main(String [] args ) {  try{  String str;    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  BufferedOutputStream bos = new BufferedOutputStream(System.out);  String eol = System.getProperty("line.separator");  byte [] eolb = eol.getBytes();  byte[] spaceb= " ".getBytes();   str = br.readLine();   int n = Integer.parseInt(str);  int ans = 0;  if(n>=0) {   ans = n;  } else {   if ( str.length()==2) {   if(str.charAt(0)!='-') {    int a =Integer.parseInt(str.substring(0,1));    int b = Integer.parseInt(str.substring(1,2));    ans = Math.max(a, b);   } else {    ans = Integer.parseInt(str.substring(1,2));   }   } else {   String s1 = str.substring(0,str.length()-2).concat(str.substring(str.length()-2,str.length()-1));   String s2 = str.substring(0,str.length()-2).concat(str.substring(str.length()-1,str.length()));   int a = Integer.parseInt(s1);   int b = Integer.parseInt(s2);   ans = Math.max(a, b);   }  }  bos.write(new Integer(ans).toString().getBytes());  bos.write(eolb);  bos.flush();  } catch(IOException ioe) {  ioe.printStackTrace();  } } }
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"); } }
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); } }  }
5	public class SolA {  static Scanner in; static PrintWriter out;  public static void main(String[] args) {  in = new Scanner(System.in);  out = new PrintWriter(System.out);  new SolA().run();  in.close();  out.close();  }  private void run() {  int n = in.nextInt();  int[] a = new int[n];  int sum = 0;  for(int i = 0; i < n; i++) {  a[i] = in.nextInt();  sum+=a[i];  }  Arrays.sort(a);  int cs = 0;  int kol = 0;  for(int i = n - 1; i>=0; i--) {  cs+=a[i];  kol++;  if (cs > sum - cs) {   break;  }  }  out.print(kol); } }
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());   }  } }
1	public class B14G {  public static void main(String[] args) throws IOException {   init_io();   int t = nint();   while(t-- > 0) {    int N = nint();    if (N % 2 != 0) {     out.println("NO"); continue;    }    N /= 2;    int sqrt = (int)(Math.round(Math.sqrt(N)));    int sqrt2 = (int)(Math.round(Math.sqrt(N/2)));    if (sqrt * sqrt == N || sqrt2 * sqrt2 * 2 == N) {     out.println("YES");    }    else {     out.println("NO");    }   }   out.close();  }  static StreamTokenizer in;  static PrintWriter out;  static BufferedReader br;  static int nint() throws IOException {   in.nextToken();   return (int) in.nval;  }  static void init_io() throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));   in = new StreamTokenizer(br);   out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  } }
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);   E solver = new E();   solver.solve(1, in, out);   out.close();  }  static class E {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.ni(), K = in.ni();    long mod = 998244353;    long[][] dp = new long[n + 1][n + 1];    for (int lim = 1; lim <= n; lim++) {     long sum = 1;     dp[0][lim] = 1;     for (int i = 1; i <= n; i++) {      dp[i][lim] = (dp[i][lim] + sum) % mod;      sum = (sum + dp[i][lim]) % mod;      if (i >= lim)       sum = (sum - dp[i - lim][lim] + mod) % mod;     }    }    long ans = 0;    for (int k = 1; k < Math.min(K, n + 1); k++) {     long h = dp[n][k] - dp[n][k - 1];     int lim = K / k;     if (K % k == 0)      lim--;     if (lim > n)      lim = n;     ans += dp[n][lim] * h % mod;    }    out.println(2 * ans % mod);   }  }  static class FastScanner {   private BufferedReader in;   private StringTokenizer st;   public FastScanner(InputStream stream) {    in = new BufferedReader(new InputStreamReader(stream));   }   public String ns() {    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 ni() {    return Integer.parseInt(ns());   }  } }
2	public class B { static long sumN(long n) {  return n * (n + 1) / 2; }  static int binSearchPuts(int n, int k) {  int L = 1;  int U = n;  int M = (L + U) / 2;  while(L <= U)  {  long left = sumN(M) - (n - M);    if(left < k)  {   L = M + 1;  }  else if(left > k)  {   U = M;  }  else  {   break;  }   M = (L + U) / 2;  }  return M; }  public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int n = input.nextInt();  int k = input.nextInt();  long ate = n - binSearchPuts(n, k);  System.out.println(ate); } }
5	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);   CGlassCarving solver = new CGlassCarving();   solver.solve(1, in, out);   out.close();  }  static class CGlassCarving {   public void solve(int testNumber, FastReader s, PrintWriter out) {    TreeMap<Long, Integer> mapH = new TreeMap<>();    TreeMap<Long, Integer> mapV = new TreeMap<>();    TreeMap<Long, Integer> hDiff = new TreeMap<>();    TreeMap<Long, Integer> vDiff = new TreeMap<>();    long width = s.nextInt();    long height = s.nextInt();    mapH.put(0L, 1);    mapV.put(0L, 1);    mapV.put(width, 1);    mapH.put(height, 1);    vDiff.put(width, 1);    hDiff.put(height, 1);    long maxV = height;    long maxH = width;    int n = s.nextInt();    for (int i = 0; i < n; i++) {     char ch = s.nextCharacter();     long cut = s.nextInt();     if (ch == 'H') {      Long next = mapH.higherKey(cut);      Long prev = mapH.lowerKey(cut);      Long diff = next - prev;      int freq = hDiff.get(diff);      if (freq == 1) {       hDiff.remove(diff);      } else {       hDiff.put(diff, freq - 1);      }      hDiff.put(next - cut, hDiff.getOrDefault(next - cut, 0) + 1);      hDiff.put(cut - prev, hDiff.getOrDefault(cut - prev, 0) + 1);      mapH.put(cut, mapH.getOrDefault(cut, 0) + 1);     } else {      Long next = mapV.higherKey(cut);      Long prev = mapV.lowerKey(cut);      Long diff = next - prev;      int freq = vDiff.get(diff);      if (freq == 1) {       vDiff.remove(diff);      } else {       vDiff.put(diff, freq - 1);      }      vDiff.put(next - cut, vDiff.getOrDefault(next - cut, 0) + 1);      vDiff.put(cut - prev, vDiff.getOrDefault(cut - prev, 0) + 1);      mapV.put(cut, mapV.getOrDefault(cut, 0) + 1);     }     out.println(hDiff.lastKey() * vDiff.lastKey());    }   }  }  static class FastReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private FastReader.SpaceCharFilter filter;   public FastReader(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 char nextCharacter() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    return (char) c;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
0	public class ATestingRound5 {  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int T = in.nextInt();  while(T --> 0) {  int a = in.nextInt();  int b = in.nextInt();  int count = 0;    int[] arr = {a, b};  Arrays.sort(arr);  while(arr[0] != 0) {   count += arr[1] / arr[0];   arr[1] = arr[1] % arr[0];     Arrays.sort(arr);  }  System.out.println(count);  }  in.close(); } }
4	public class Main { public static void main(String args[]) throws IOException {  File f = new File("input.txt");  Scanner sc = new Scanner(f);  BufferedWriter bw = new BufferedWriter(new FileWriter(new File("output.txt")));  int n = sc.nextInt();  int m = sc.nextInt();  boolean[][] grid = new boolean[n][m];  for (int i = 0; i < n; i++) for (int j = 0; j < m; j++)   grid[i][j] = false;  Queue<Pair> q = new LinkedList<>();  int cnt = sc.nextInt();  for (int i = 0; i < cnt; i++) {  int x = sc.nextInt();  int y = sc.nextInt();  x--;  y--;  grid[x][y] = true;  q.add(new Pair(x, y));  }  Pair last = new Pair(-1, -1);  while (!q.isEmpty()) {  Pair current = q.poll();  last = current;  for (int i = -1; i <= 1; i++) {   for (int j = -1; j <= 1; j++) {   if (i != 0 && j != 0) continue;   if (inside(current.x + i, current.y + j, n, m) &&    !grid[current.x + i][current.y + j]) {    grid[current.x + i][current.y + j] = true;    q.add(new Pair(current.x + i, current.y + j));       }   }  }  }   bw.append((last.x + 1) + " " + (last.y + 1) + "\n");  bw.flush();  bw.close();   sc.close(); } static class Pair {  int x;  int y;  Pair(int x, int y) {  this.x = x;  this.y = y;  } } private static boolean inside(int a, int b, int n, int m) {  return (a >= 0 && a < n && b >= 0 && b < m); } }
1	public class C{ static String s; static long val[]; static int N,size; static int index(char c){  if(c <= 'Z'){  return c - 'A';  }else{  return c - 'a' + ('Z' - 'A' + 1);  } }  static int l(int i){  return (i<<1)+1; } static int r(int i){  return (i<<1)+2; }  static void setup(int l, int r, int i){  if(l==r){  val[i] = (1L<<index(s.charAt(l)));  }else{  int mid = (l+r)/2;  setup(l,mid,l(i));  setup(mid+1,r,r(i));  val[i] = val[l(i)] | val[r(i)];  } }  static long query(int min, int max, int l, int r, int i){  if(min <= l && r <= max){  return val[i];  }  if(max < l || r < min)  return 0;  int mid = (l+r)/2;  return query(min,max,l,mid,l(i)) | query(min,max,mid+1,r,r(i)); } static long query(int min, int max){  return query(min,max,0,N-1,0); }  static int binarySearch(int start, long toFind){  int max = N-1;  int min = start;  if(query(start,max) != toFind)  return 1<<29;  if(query(start,start) == toFind){  return 1;  }  int ret = max - min + 1;  while(min + 1 < max){  int mid = (min+max)/2;  if(query(start,mid) == toFind){   max = mid;  }else{   min = mid;  }  }  return max-start+1; }  public static void main(String args[]){  Scanner sc = new Scanner(System.in);  N = sc.nextInt();  s = sc.next();  int size = 1;  while(size <= N) size*=2;  val = new long[size*2];  setup(0,N-1,0);  long toFind = query(0,N-1,0,N-1,0);  long ans = 1L<<29;  for(int i = 0; i < N; i++)  ans = Math.min(ans,binarySearch(i,toFind));  System.out.println(ans); } }
2	public class P {  public static void main(String[] args) throws NumberFormatException, IOException {  Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out);  int N = sc.nextInt(), x = sc.nextInt(), y = sc.nextInt();  long C = sc.nextLong();  int lo = 0, hi = (int) (1e6);  int answer = -1;  while (lo <= hi) {  int L = lo + (hi - lo) / 2;  long area = 0;  for (int steps = 0; steps <= L; ++steps) {   if (y + steps > N)   break;   long up = Math.min(x, 1 + L - steps), down = Math.min(N - x, L - steps);   area += up + down;  }   for (int steps = 1; steps <= L; ++steps) {   if (y - steps < 1)   break;   long up = Math.min(x, 1 + L - steps), down = Math.min(N - x, L - steps);   area += up + down;  }  if (area >= C) {   answer = L;   hi = L - 1;  } else   lo = L + 1;  }  out.println(answer);  out.flush();  out.close(); }  static class Scanner {  BufferedReader br;  StringTokenizer st;  Scanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  Scanner(String file) throws FileNotFoundException {  br = new BufferedReader(new FileReader(file));  }  String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(next());  }  String nextLine() throws IOException {  return br.readLine();  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  } }
5	public class P15A {  public static void main (String [] args)  {   Scanner scan = new Scanner(System.in);   int n = scan.nextInt(), t = scan.nextInt();   TreeMap<Integer,Integer> hm = new TreeMap<Integer, Integer>();   for (int i = 0; i < n; i++) hm.put(scan.nextInt(),scan.nextInt());   int _x = 0, _a = 0, res = 2;   boolean started = false;   for (Integer key : hm.keySet())   {    if (!started)    {     _x = key;     _a = hm.get(_x);     started = true;     continue;    }    if (key - _x - ((Integer)hm.get(key) + _a)/2.0 > t) res +=2;    else if (key - _x - ((Integer)hm.get(key) + _a)/2.0 == t) res++;    _x = key;    _a = hm.get(_x);   }   System.out.println(res);   } }
4	public class Main {  static class Point {   int x;   int y;   Point(int a, int b) {    x = a;    y = b;   }   @Override   public String toString() {    return "Point{" +      "x=" + x +      ", y=" + y +      '}';   }  }  public static void main(String[] args) throws IOException {   File f = new File("input.txt");   Scanner sc = new Scanner(f);   BufferedWriter bw = new BufferedWriter(new FileWriter(new File("output.txt")));   int n = sc.nextInt();   int m = sc.nextInt();   boolean[][] board = new boolean[n][m];   int count = sc.nextInt();   Point[] burningTrees = new Point[count];   for (int i=0; i<count; i++) {    burningTrees[i] = new Point(sc.nextInt() - 1,sc.nextInt() - 1);   }   Point last = findLastPoint(board,burningTrees);   bw.append((last.x + 1) + " " + (last.y + 1) + "\n");   bw.flush();   bw.close();   sc.close();  }   public static Point findLastPoint(boolean[][] board, Point[] burningTree){   Queue<Point> queue = new LinkedList<Point>();   for(int i = 0; i <burningTree.length; i++ ) {    queue.add(burningTree[i]);    board[burningTree[i].x][burningTree[i].y] = true;   }   Point lastPoint = new Point(-1,-1);   while (!queue.isEmpty()) {    Point p = queue.poll();    lastPoint = p;    ArrayList<Point> neighbours = getNeighbours(p,board);    for(int i = 0; i <neighbours.size(); i++ ) {     queue.add(neighbours.get(i));     board[neighbours.get(i).x][neighbours.get(i).y] = true;    }   }   return lastPoint;  }  public static ArrayList<Point> getNeighbours(Point p, boolean[][] board){   ArrayList<Point> neighbours = new ArrayList<>();   for(int i = -1; i <=1; i++ ){    for(int j = -1; j <= 1; j++ ){     if(Math.abs(i) != Math.abs(j)) {      int x = p.x + i;      int y = p.y + j;      if (x >= 0 && x < board.length && y >= 0 && y < board[0].length) {       if (board[x][y] == false) {        neighbours.add(new Point(x,y));       }      }     }    }   }   return neighbours;  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   LightScanner in = new LightScanner(inputStream);   LightWriter out = new LightWriter(outputStream);   APaintTheNumbers solver = new APaintTheNumbers();   solver.solve(1, in, out);   out.close();  }  static class APaintTheNumbers {   public void solve(int testNumber, LightScanner in, LightWriter out) {       int n = in.ints();    int[] a = in.ints(n);    IntroSort.sort(a);    boolean[] done = new boolean[n];    int ans = 0;    for (int i = 0; i < n; i++) {     if (done[i]) continue;     int d = a[i];     ans++;     for (int j = 0; j < n; j++) {      if (a[j] % d == 0) {       done[j] = true;      }     }    }    out.ans(ans).ln();   }  }  static class IntroSort {   private static int INSERTIONSORT_THRESHOLD = 16;   private IntroSort() {   }   static void sort(int[] a, int low, int high, int maxDepth) {    while (high - low > INSERTIONSORT_THRESHOLD) {     if (maxDepth-- == 0) {      HeapSort.sort(a, low, high);      return;     }     int cut = QuickSort.step(a, low, high);     sort(a, cut, high, maxDepth);     high = cut;    }    InsertionSort.sort(a, low, high);   }   public static void sort(int[] a) {    if (a.length <= INSERTIONSORT_THRESHOLD) {     InsertionSort.sort(a, 0, a.length);    } else {     sort(a, 0, a.length, 2 * BitMath.msb(a.length));    }   }  }  static final class ArrayUtil {   private ArrayUtil() {   }   public static void swap(int[] a, int x, int y) {    int t = a[x];    a[x] = a[y];    a[y] = t;   }  }  static class LightScanner {   private BufferedReader reader = null;   private StringTokenizer tokenizer = null;   public LightScanner(InputStream in) {    reader = new BufferedReader(new InputStreamReader(in));   }   public String string() {    if (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      throw new UncheckedIOException(e);     }    }    return tokenizer.nextToken();   }   public int ints() {    return Integer.parseInt(string());   }   public int[] ints(int length) {    return IntStream.range(0, length).map(x -> ints()).toArray();   }  }  static final class BitMath {   private BitMath() {   }   public static int count(int v) {    v = (v & 0x55555555) + ((v >> 1) & 0x55555555);    v = (v & 0x33333333) + ((v >> 2) & 0x33333333);    v = (v & 0x0f0f0f0f) + ((v >> 4) & 0x0f0f0f0f);    v = (v & 0x00ff00ff) + ((v >> 8) & 0x00ff00ff);    v = (v & 0x0000ffff) + ((v >> 16) & 0x0000ffff);    return v;   }   public static int msb(int v) {    if (v == 0) {     throw new IllegalArgumentException("Bit not found");    }    v |= (v >> 1);    v |= (v >> 2);    v |= (v >> 4);    v |= (v >> 8);    v |= (v >> 16);    return count(v) - 1;   }  }  static class HeapSort {   private HeapSort() {   }   private static void heapfy(int[] a, int low, int high, int i, int val) {    int child = 2 * i - low + 1;    while (child < high) {     if (child + 1 < high && a[child] < a[child + 1]) {      child++;     }     if (val >= a[child]) {      break;     }     a[i] = a[child];     i = child;     child = 2 * i - low + 1;    }    a[i] = val;   }   static void sort(int[] a, int low, int high) {    for (int p = (high + low) / 2 - 1; p >= low; p--) {     heapfy(a, low, high, p, a[p]);    }    while (high > low) {     high--;     int pval = a[high];     a[high] = a[low];     heapfy(a, low, high, low, pval);    }   }  }  static class LightWriter implements AutoCloseable {   private final Writer out;   private boolean autoflush = false;   private boolean breaked = true;   public LightWriter(Writer out) {    this.out = out;   }   public LightWriter(OutputStream out) {    this(new BufferedWriter(new OutputStreamWriter(out, Charset.defaultCharset())));   }   public LightWriter print(char c) {    try {     out.write(c);     breaked = false;    } catch (IOException ex) {     throw new UncheckedIOException(ex);    }    return this;   }   public LightWriter print(String s) {    try {     out.write(s, 0, s.length());     breaked = false;    } catch (IOException ex) {     throw new UncheckedIOException(ex);    }    return this;   }   public LightWriter ans(String s) {    if (!breaked) {     print(' ');    }    return print(s);   }   public LightWriter ans(int i) {    return ans(Integer.toString(i));   }   public LightWriter ln() {    print(System.lineSeparator());    breaked = true;    if (autoflush) {     try {      out.flush();     } catch (IOException ex) {      throw new UncheckedIOException(ex);     }    }    return this;   }   public void close() {    try {     out.close();    } catch (IOException ex) {     throw new UncheckedIOException(ex);    }   }  }  static class QuickSort {   private QuickSort() {   }   private static void med(int[] a, int low, int x, int y, int z) {    if (a[z] < a[x]) {     ArrayUtil.swap(a, low, x);    } else if (a[y] < a[z]) {     ArrayUtil.swap(a, low, y);    } else {     ArrayUtil.swap(a, low, z);    }   }   static int step(int[] a, int low, int high) {    int x = low + 1, y = low + (high - low) / 2, z = high - 1;    if (a[x] < a[y]) {     med(a, low, x, y, z);    } else {     med(a, low, y, x, z);    }    int lb = low + 1, ub = high;    while (true) {     while (a[lb] < a[low]) {      lb++;     }     ub--;     while (a[low] < a[ub]) {      ub--;     }     if (lb >= ub) {      return lb;     }     ArrayUtil.swap(a, lb, ub);     lb++;    }   }  }  static class InsertionSort {   private InsertionSort() {   }   static void sort(int[] a, int low, int high) {    for (int i = low; i < high; i++) {     for (int j = i; j > low && a[j - 1] > a[j]; j--) {      ArrayUtil.swap(a, j - 1, j);     }    }   }  } }
3	public class Contest {  final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  BufferedReader in;  PrintWriter out;  StringTokenizer tok = new StringTokenizer("");  public static void main(String[] args) {   new Contest().run();  }  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 void run() {   try {    long t1 = System.currentTimeMillis();    init();    solve();    out.close();    long t2 = System.currentTimeMillis();    System.err.println("Time(ms) = " + (t2 - t1));   } catch (Exception e) {    e.printStackTrace(System.err);    System.exit(-1);   }  }  class MyComparator implements Comparable<MyComparator> {   int x;   int y;   public MyComparator(int x, int y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(MyComparator a) {    if (x == a.x) {     return (y - a.y);    }    return x - a.x;   }  }  public static boolean isPrime(int num) {   if (num > 2 && num % 2 == 0) {       return false;   }   int top = (int) Math.sqrt(num) + 1;   for (int i = 3; i < top; i += 2) {    if (num % i == 0) {         return false;    }   }     return true;  }  private static int lowerBound(int[] a, int low, int high, int element) {   while (low < high) {    int middle = low + (high - low) / 2;    if (element > a[middle]) {     low = middle + 1;    } else {     high = middle;    }   }   return low;  }  private static int upperBound(int[] a, int low, int high, int element) {   while (low < high) {    int middle = low + (high - low) / 2;    if (a[middle] > element) {     high = middle;    } else {     low = middle + 1;    }   }   return low;  }  public void solve() throws IOException {   int num_a = readInt();   int[] array = new int[num_a];   for (int i = 0; i < num_a; i++) {    array[i] = readInt();   }   int result = 0;   Arrays.sort(array);   for (int i = 0; i < array.length; i++) {    if (array[i] == -1) {     continue;    }    for (int j = 0; j < array.length; j++) {     if (array[j] != -1 && array[j] % array[i] == 0 && j != i) {           array[j] = -1;          }    }    result++;   }   System.out.println(result);  }    private BigInteger lcm(BigInteger a, BigInteger b) {   return a.multiply(b.divide(a.gcd(b)));  } }
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; } }
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());   }  } }
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 C { Scanner in; PrintWriter out; String INPUT = "";  void solve() {  int n = ni();  char[] x = in.next().toCharArray();  int t = 0;  for(int i = 0;i < n;i++){  if(x[i] == 'T'){   t++;  }  }   int min = 9999;  for(int i = 0;i < n;i++){  int y = 0;  for(int j = i;j < i + t;j++){   if(x[j % n] == 'T'){   y++;   }  }  min = Math.min(min, t - y);  }  out.println(min); }  void run() throws Exception {  in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);  out = new PrintWriter(System.out);  solve();  out.flush(); }   public static void main(String[] args) throws Exception {  new C().run(); }  int ni() { return Integer.parseInt(in.next()); } void tr(Object... o) { if(INPUT.length() != 0)System.out.println(o.length > 1 || o[0].getClass().isArray() ? Arrays.deepToString(o) : o[0]); } }
5	public class AAA {  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 max = a[0];   int ind = 0;   for (int k = 1; k < n; k++) {    if (a[k] > max) {     max = a[k];     ind = k;    }   }   if (max != 1) {    a[ind] = 1;    Arrays.sort(a);    for (int i = 0; i < a.length - 1; i++)     System.out.print(a[i] + " ");    System.out.println(a[a.length - 1]);   } else {    a[0] = 2;    Arrays.sort(a);    for (int i = 0; i < a.length - 1; i++)     System.out.print(a[i] + " ");    System.out.println(a[a.length - 1]);   }  } }
1	public class Main { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);      int n = in.nextInt();  String line = in.next();  int h = 0;  for (int i = 0; i < line.length(); i++) {  if(line.charAt(i)=='H') h++;  }  line = line + line;   int min = Integer.MAX_VALUE;  for (int i = 0; i < n; i++) {  int ans = 0;  for (int j = i; j < i+h; j++) {   if(line.charAt(j)!='H') ans++;  }  if(min>ans) min = ans;  }   out.print(min);        in.close();  out.close(); } }
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 Paint_The_Numbers {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  ArrayList<Integer> paint = new ArrayList<Integer>();  int num = scan.nextInt();  for(int i = 0; i < num;i++)  paint.add(scan.nextInt());  Collections.sort(paint);  int counter = 0;   while(paint.size()!=0) {  num = paint.remove(0);  for(int i = 0; i<paint.size();i++) {   if(paint.get(i)%num==0) {   paint.remove(i--);   }  }  counter++;  }  System.out.println(counter); } }
0	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);   ASubtractions solver = new ASubtractions();   solver.solve(1, in, out);   out.close();  }  static class ASubtractions {   public void solve(int testNumber, InputReader c, OutputWriter w) {    int tc = c.readInt();    while (tc-- > 0) {     int a = c.readInt(), b = c.readInt();     int op = 0;     while (a != b) {      if (a > b) {       int tm = b;       b = a;       a = tm;      }      int left = b - a;      int rem = (left - 1) / a + 1;      b -= rem * a;      op += rem;     }     op++;     w.printLine(op);    }   }  }  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 close() {    writer.close();   }   public void printLine(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 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);   }  } }
0	public class x {  public static void main(String args[])  {   Scanner obj=new Scanner(System.in);   int n;   String d="0";   n=obj.nextInt();   if(n%4==0 || n%7==0 || n%47==0 || n%74==0 || n%447==0 || n%474==0 || n%747==0)   d="YES";   else if(n%444==0 || n%477==0 || n%744==0 || n%774==0 || n%777==0)   d="YES";   else   d="NO";   System.out.print(d);  } }
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();  } }
5	public class a { static long mod = 1000000007; static boolean[][] blacks; public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(new PrintStream(System.out));    int n = input.nextInt(), t = input.nextInt(); int res = 2; Cottage[] data = new Cottage[n]; int[] xs = new int[n], as = new int[n]; for(int i = 0; i<n; i++) {  data[i] = new Cottage(input.nextInt(), input.nextInt()); } Arrays.sort(data); for(int i = 0; i<n; i++) {  xs[i] = data[i].x;  as[i] = data[i].a; } for(int i = 0; i<n-1; i++) {  if(2*(xs[i+1]-xs[i]) == 2*t+as[i]+as[i+1]) res++;  else if(2*(xs[i+1]-xs[i]) > 2*t+as[i]+as[i+1]) res+=2; } out.println(res);  out.close(); } static class Cottage implements Comparable<Cottage> {   int x, a; public Cottage(int xx, int aa) {  x = xx; a = aa; } @Override public int compareTo(Cottage o) {   return this.x - o.x; } } static long pow(long a, long p) { if(p==0) return 1; if((p&1) == 0) {  long sqrt = pow(a, p/2);  return (sqrt*sqrt)%mod; } else  return (a*pow(a,p-1))%mod; } 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 long nextLong() throws IOException {  return Long.parseLong( next() ); }  static double nextDouble() throws IOException {  return Double.parseDouble( next() ); } static String nextLine() throws IOException {  return reader.readLine(); } } }
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);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); } } class TaskA {  public void solve(int testNumber, Scanner in, PrintWriter out) {   String n = in.nextLine();   int a = Integer.parseInt(n);   int b = Integer.parseInt(n.substring(0, n.length() - 1));   int c = Integer.parseInt(n.substring(0, n.length() - 2) + n.charAt(n.length() - 1));   out.println(Math.max(a, Math.max(b, c)));  } }
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(); } }
4	public class A {  public static void main(String args[])  {   Scanner scan = new Scanner(System.in);     String str = scan.next();     for(int i=str.length();i >= 1;i--)   {    for(int j=0;j + i <= str.length();j++)    {     String sub = str.substring(j, j+i);         int index = str.indexOf(sub, j+1);              if(index > -1)     {      System.out.println(i);      return;     }        }   }     System.out.println(0);  } }
4	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("");  void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  String s = in.readLine();   for (int len = s.length() - 1; len > 0; len--) {  Set<String> set = new HashSet<String>();  for (int i = 0; i + len <= s.length(); i++) {   String ss = s.substring(i, i + len);   if (set.contains(ss)) {   out.println(len);   out.close();   return;   }   set.add(ss);  }  }  out.println(0);  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; } }
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));    }   }  } }
4	public class GivenString {  public static void main(String[] args) {   Scanner input = new Scanner(System.in);     String s = input.nextLine();     int max = 0;     for(int i = 0; i < s.length(); i++) {    for(int j = i + 1; j <= s.length(); j++) {     String tmp = s.substring(i, j);     int match = 0;     for(int k = 0; k + tmp.length() <= s.length(); k++) {      if(tmp.equals(s.substring(k, k + tmp.length()))) {       match++;            }     }     if(match >= 2) {      max = Math.max(max, tmp.length());     }    }   }   System.out.println(max);   System.exit(0);  } }
4	public class Main {    public static void main(String[] args)throws java.lang.Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String s = br.readLine();  int max = 0;   for (int i = 0; i < s.length(); i++) {    for (int j = i+1; j < s.length(); j++) {     if(s.substring(i+1).contains(s.substring(i,j)))      max = Math.max(max, j-i);    }}    System.out.println(max);     } }
2	public class B2 { public static void main (String args[]){  Scanner in = new Scanner(System.in);  long n = in.nextLong();  long k = in.nextLong();  long upn = k;  long tmp=upn;  if(n==1){  System.out.println(0);  return;  }  if(n<=k){  System.out.println(1);  return;  }   if(!bS(n, k, upn)){  System.out.println(-1);  return;  }  boolean flag = false;  while(bS(n, k, upn)){   tmp = upn;   flag = true;   upn=5*upn/6;   if(tmp==upn)   break;  }  long ans = tmp;  if(!flag)   upn=0;  for(int i = (int)tmp;i>=upn;i--){   if(bS(n, k, i)){   ans=i;   }   else   break;  }  System.out.println(ans); }  static boolean bS(long key,long k ,long n)   {  long pipe = (n * (k-n+k+1))/2;  pipe = pipe - n+1;    if(pipe>=key){    return true;    }    else    return false;  } }
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) throws IOException {  final long mod=(long) (1e9+7);  Reader s=new Reader();  PrintWriter pt=new PrintWriter(System.out);     int T=s.nextInt();   while(T-->0)  {    long n=s.nextInt();    long sq1=n/2;       long sq2=n/4;       if(isPerfectSquare(sq1)&&sq1*2==n||isPerfectSquare(sq2)&&sq2*4==n)    pt.println("YES");    else    pt.println("NO");             }  pt.close(); }  static void divideBy2(int arr[], int n) {  for(int i=0;i<n;i++) {  arr[i]=arr[i]>>1;  } }  static boolean isEven(int arr[], int n) {  for(int i=0;i<n;i++) {  if(arr[i]%2==1)   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 int gcd(int a, int 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();   }  } }
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) ); } }
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;  } }
2	public class q5 {         public static void main(String[] args) throws IOException {  Reader.init(System.in); PrintWriter out=new PrintWriter(System.out); long n=Reader.nextInt(); long k=Reader.nextLong(); long v=8*n+8*k+4; long v2=(long) Math.sqrt(v); long v3=2*n+2;  long v5=(v3-v2)/2; out.println(v5);      out.flush(); } }      class Reader {  static BufferedReader reader;  static StringTokenizer tokenizer;   static void init() throws IOException {   reader = new BufferedReader(     new FileReader("detect.in"));  tokenizer = new StringTokenizer("");  }  static void init(InputStream input) {   reader = new BufferedReader(      new InputStreamReader(input) );   tokenizer = new StringTokenizer("");  }   static String nextLine() throws IOException{  return reader.readLine();  }  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() );  } }
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();  } }
6	public class Main {  public static void main(String[] args) {   new Thread(null, new Runnable() {    public void run() {     new Main().solve();    }   }, "1", 1 << 26).start();  }  void solve() {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   FElongatedMatrix solver = new FElongatedMatrix();   solver.solve(1, in, out);   out.close();  }  static class FElongatedMatrix {   int[][] G;   int[][] G1;   public int findIt(int[] map, int n, int start) {    int[][] mask = new int[1 << n][n];    for (int i = 0; i < n; i++) mask[(1 << i)][i] = G[start][map[i]];    for (int i = 1; i < (1 << n); i++) {     for (int j = 0; j < n; j++) {      for (int k = 0; k < n; k++) {       if (k != j && (i & (1 << k)) == 0 && (i & (1 << j)) != 0) {        mask[(i | (1 << k))][k] = Math.max(mask[(i | (1 << k))][k], Math.min(mask[i][j], G[map[j]][map[k]]));       }      }     }    }    int ans = 0;    for (int i = 0; i < n; i++) ans = Math.max(ans, Math.min(mask[(1 << n) - 1][i], G1[start][map[i]]));    return ans;   }   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    int m = in.scanInt();    G = new int[n][n];    G1 = new int[n][n];    int[][] ar = new int[n][m];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      ar[i][j] = in.scanInt();     }    }    if (n == 1) {     int ans = Integer.MAX_VALUE;     for (int i = 0; i < m - 1; i++) ans = Math.min(ans, Math.abs(ar[0][i] - ar[0][i + 1]));     out.println(ans);     return;    }    for (int i = 0; i < n; i++) {     for (int j = i + 1; j < n; j++) {      int min = Integer.MAX_VALUE;      for (int k = 0; k < m; k++) min = Math.min(min, Math.abs(ar[i][k] - ar[j][k]));      G[i][j] = G[j][i] = min;     }    }    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      if (i == j) continue;      int min = Integer.MAX_VALUE;      for (int k = 1; k < m; k++) min = Math.min(min, Math.abs(ar[i][k] - ar[j][k - 1]));      G1[i][j] = min;     }    }    int[] map;    int ans = 0;    for (int i = 0; i < n; i++) {     map = new int[n - 1];     int tl = 0;     for (int temp = 0; temp < n; temp++) {      if (temp == i) continue;      map[tl++] = temp;     }     ans = Math.max(ans, findIt(map, n - 1, i));    }    out.println(ans);    }  }  static class ScanReader {   private byte[] buf = new byte[4 * 1024];   private int index;   private BufferedInputStream in;   private int total;   public ScanReader(InputStream inputStream) {    in = new BufferedInputStream(inputStream);   }   private int scan() {    if (index >= total) {     index = 0;     try {      total = in.read(buf);     } catch (Exception e) {      e.printStackTrace();     }     if (total <= 0) return -1;    }    return buf[index++];   }   public int scanInt() {    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();     }    }    return neg * integer;   }   private boolean isWhiteSpace(int n) {    if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;    else return false;   }  } }
2	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);   BSportMafia solver = new BSportMafia();   solver.solve(1, in, out);   out.close();  }  static class BSportMafia {   private InputReader in;   private OutputWriter out;   public void solve(int testNumber, InputReader in, OutputWriter out) {    this.in = in;    this.out = out;    long n = in.nextInt();    long k = in.nextInt();    for (long i = 1; i * (i + 1) / 2 + i <= n + k; i++) {     if (i * (i + 1) / 2 + i == n + k) {      out.println(n - i);      return;     }    }   }  }  static class InputReader extends InputStream {   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 - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   private static boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  }  static class OutputWriter {   private final PrintWriter out;   public OutputWriter(OutputStream outputStream) {    out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));   }   public OutputWriter(Writer writer) {    this.out = new PrintWriter(writer);   }   public void close() {    out.close();   }   public void println(long i) {    out.println(i);   }  } }
3	public class C{  static long mod=1000000007; static int n; static long w[][]; static void MainMethod()throws Exception{  n=reader.nextInt();  w=new long[n+2][n+2];  for (int i=0;i<=(n+1);i++)  Arrays.fill(w[i], 0);  w[1][0]=1;  String prev,next;  prev=reader.next();  long s[]=new long[n+2];  for (int i=2;i<=n;i++) {  next=reader.next();  if (prev.equals("f"))   for (int lv=0;lv<=n;lv++)    w[i][lv+1]=w[i-1][lv];  else   for (int lv=n;lv>=0;lv--){   w[i][lv]=(w[i-1][lv]+w[i][lv+1])%mod;   }  prev=next;  }  long res=0;  for (int i=0;i<=n;i++)  res=(res+w[n][i])%mod;  printer.print(res); } public static void main(String[] args)throws Exception{  MainMethod();  printer.close(); } static void halt(){  printer.close();  System.exit(0); } static PrintWriter printer=new PrintWriter(new OutputStreamWriter(System.out)); static class reader{  static BufferedReader bReader=new BufferedReader(new InputStreamReader(System.in));  static StringTokenizer token=new StringTokenizer("");  static String readNextLine() throws Exception{  return bReader.readLine();  }  static String next() throws Exception{  while (token.hasMoreTokens()==false){   token=new StringTokenizer(bReader.readLine());  }  return token.nextToken();  }  static int nextInt()throws Exception{  while (token.hasMoreTokens()==false){   token=new StringTokenizer(bReader.readLine());  }  return Integer.parseInt(token.nextToken());  }  static long nextLong()throws Exception{  while (token.hasMoreTokens()==false){   token=new StringTokenizer(bReader.readLine());  }  return Long.parseLong(token.nextToken());  }  static double nextDouble()throws Exception{  while (token.hasMoreTokens()==false){   token=new StringTokenizer(bReader.readLine());  }  return Double.parseDouble(token.nextToken());  } } static class MyMathCompute{  static long [][] MatrixMultiplyMatrix(long [][] A, long [][] B, long mod) throws Exception{  int n=A.length, m=B[0].length;   int p=A[0].length;  int i,j,k;  if (B.length!=p) throw new Exception("invalid matrix input");  long [][] res=new long [n][m];  for (i=0;i<n;i++) for (j=0;j<m;j++){   if (A[i].length!=p) throw new Exception("invalid matrix input");   res[i][j]=0;   for (k=0;k<p;k++)   res[i][j]=(res[i][j]+((A[i][k]*B[k][j])% mod))% mod;  }  return res;  }  static double [][] MatrixMultiplyMatrix(double [][] A, double [][] B ) throws Exception{  int n=A.length, m=B[0].length;   int p=A[0].length;  int i,j,k;  if (B.length!=p) throw new Exception("invalid matrix input");  double [][] res=new double [n][m];  for (i=0;i<n;i++) for (j=0;j<m;j++){   if (A[i].length!=p) throw new Exception("invalid matrix input");   res[i][j]=0;   for (k=0;k<p;k++)   res[i][j]=res[i][j]+(A[i][k]*B[k][j]);  }  return res;  }  static long [][] MatrixPow(long [][] A,long n, long mod) throws Exception{  if (n==1) return A;  long [][] res=MatrixPow(A, n/2, mod);  res=MatrixMultiplyMatrix(res, res, mod);  if ((n % 2) == 1) res=MatrixMultiplyMatrix(A,res, mod);   return res;  }  static double [][] MatrixPow(double [][] A,long n) throws Exception{  if (n==1) return A;  double[][] res=MatrixPow(A, n/2);  res=MatrixMultiplyMatrix(res, res);  if ((n % 2) == 1) res=MatrixMultiplyMatrix(A,res);   return res;  }  static long pow(long a,long n,long mod){  a= a % mod;  if (n==0) return 1;  long k=pow(a,n/2,mod);  if ((n % 2)==0) return ((k*k)%mod);  else return (((k*k) % mod)*a) % mod;  }  static double pow(double a,long n){  if (n==0) return 1;  double k=pow(a,n/2);  if ((n % 2)==0) return (k*k);  else return (((k*k) )*a) ;  } } }
3	public class ProblemC { static long MOD = 1_000_000_007;  public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int n = input.nextInt();  boolean[] isFor = new boolean[n];  for (int a = 0; a < n; a++) {  isFor[a] = input.next().charAt(0) == 'f';  }  long[][] array = new long[n + 1][n + 1];  array[0][0] = 1;  boolean isPreviousFor = false;  for (int idx = 0; idx < n; idx++) {  long heightCache = 0;  for (int height = n-1; height >= 0; height--) {   if (isPreviousFor) {   array[idx + 1][height + 1] += array[idx][height];   array[idx + 1][height + 1] %= MOD;   } else {   heightCache += array[idx][height];   heightCache %= MOD;   array[idx + 1][height] += heightCache;   array[idx + 1][height] %= MOD;   }  }  isPreviousFor = isFor[idx];  }  long sum = 0;  for (int height = 0; height <= n; height++) {  sum += array[n][height];  }  System.out.println(sum % MOD); } }
5	public class A {  class Team implements Comparable<Team>{  int p, t;  public Team(int p, int t) {  this.p = p;  this.t = t;  }  public int compareTo(Team other) {  if (this.p != other.p) return other.p - this.p;  return this.t - other.t;  } }  public void solve() throws IOException {  int n = nextInt();  int K = nextInt() - 1;  Team[] team = new Team[n];  for (int i = 0; i < n; i++)   team[i] = new Team(nextInt(), nextInt());   Arrays.sort(team);  int ans = -1;  int pre = 0;  for (int i = 1; i < n; i++)  if (team[i].compareTo(team[i - 1]) != 0) {   if (K >= pre && K < i) {   ans = i - pre;   break;   }   pre = i;  }  if (ans == -1) ans = n - pre;  writer.println(ans); }  public static void main(String[] args) throws FileNotFoundException {  new A().run(); }  BufferedReader reader; StringTokenizer tokenizer; PrintWriter writer;  public void run() {  try {  long tbegin = System.currentTimeMillis();  reader = new BufferedReader(new InputStreamReader(System.in));    tokenizer = null;  writer = new PrintWriter(System.out);    solve();      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 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 F11141 { static class Solver {  ArrayList<int[]> ranges[];  HashMap<Long, Integer> hm = new HashMap<>();  int id(long s) {  if (!hm.containsKey(s))   hm.put(s, hm.size());  return hm.get(s);  }     int[] memo;  int go(int r) {  memo[N] = 0;  int last = N;  for(int[] a : ranges[r]) {   while(a[0] < last) {   memo[last - 1] = memo[last];   last--;   }   memo[a[0]] = Math.max(memo[a[0]], Math.max(memo[a[0]], 1 + memo[a[1] + 1]));   last = a[0];  }  while(0 < last) {   memo[last - 1] = memo[last];   last--;  }  return memo[0];  }  ArrayDeque<int[]> ans = new ArrayDeque<>();   void go2(int r) {  memo[N] = 0;  int last = N;  int minAt[] = new int[N], oo = 987654321;  Arrays.fill(minAt, oo);  for(int[] a : ranges[r]) {   minAt[a[0]] = Math.min(minAt[a[0]], a[1] - a[0]);   while(a[0] < last) {   memo[last - 1] = memo[last];   last--;   }   memo[a[0]] = Math.max(memo[a[0]], Math.max(memo[a[0]], 1 + memo[a[1] + 1]));   last = a[0];  }  while(0 < last) {   memo[last - 1] = memo[last];   last--;  }  int k = 0;  for(; k < N;) {   if(minAt[k] == oo || memo[k] != 1 + memo[k + minAt[k] + 1]) k++;   else {   ans.push(new int[] {k, k + minAt[k]});   k += minAt[k] + 1;   }  }  }   @SuppressWarnings("unchecked")  Solver() {  ranges = new ArrayList[2250001];  for (int i = 0; i < ranges.length; i++)   ranges[i] = new ArrayList<>();  }  int N, LID;  long[] a;  void solve(Scanner s, PrintWriter out) {  N = s.nextInt();  a = new long[N + 1];  for (int i = 1; i <= N; i++)   a[i] = s.nextLong() + a[i - 1];  for (int i = N; i >= 1; i--)   for (int j = i; j <= N; j++) {   int x = id(a[j] - a[i - 1]);   ranges[x].add(new int[] { i - 1, j - 1 });   }    int best = 0, bid = -1;  memo = new int[N + 1];   for(int i = 0; i < ranges.length; i++, LID++) {   if(ranges[i].size() <= best) continue;   int ans = go(i);   if(ans > best) {   best = ans;   bid = i;   }  }      out.println(best);  go2(bid);      while(!ans.isEmpty()) {   int[] c = ans.pop();   out.println(++c[0] + " " + ++c[1]);  }    }  }  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  Solver solver = new Solver();  solver.solve(s, out);  out.close();  } }
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;  }   } }
6	public class EMatrix{  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskE solver = new TaskE();   solver.solve(1, in, out);   out.flush();out.close();  }   static class TaskE {    final int max = (int)(1E9);    int n , m;    int a[][];    int gm[];    boolean visit[][]; int dp[][];    boolean check(int d){     if(n == 1){      for(int i = 0; i < m - 1; i++){       if(Math.abs(a[0][i] - a[0][i + 1]) < d)return false;      }      return true;     }     int nm[] = new int[n], pm[] = new int[n];     for(int i = 0; i < n; i++){      boolean r;      for(int j = 0; j < n; j++){       if(j == i)continue;       r = true;       for(int k = 0; k < m; k++){        if(Math.abs(a[i][k] - a[j][k]) < d){         r = false; break;        }       }       if(r){        nm[i] |= (1 << j);       }       r = true;       for(int k = 0; k < m - 1; k++){        if(Math.abs(a[i][k + 1] - a[j][k]) < d){         r = false; break;        }       }       if(r){        pm[i] |= (1 << j);       }      }     }                  for(int i = 0; i < n; i++){      gm = new int[n];      gm[i] = nm[i];      for(int j = 0; j < n; j++){       if(j == i)continue;       if((nm[j] & (1 << i)) != 0){        gm[j] = nm[j] ^ (1 << i);       }else{        gm[j] = nm[j];       }      }      for(int j = 0; j < n; j++){       if(j == i)continue;       if((pm[i] >> j) % 2 == 1){        gm[j] |= (1 << i);       }      }      visit = new boolean[n][1 << n]; dp = new int[n][1 << n];           if(dfs(i, i, (1 << i)) == n){       return true;      }     }     return false;    }    int dfs(int u, int r, int mask){         if(u == r && mask == (1 << n) - 1)return 0;     if(visit[u][mask])return dp[u][mask];     visit[u][mask] = true;     int val = 0;     for(int i = 0; i < n; i++){      if((gm[u] >> i) % 2 == 1 && ((i == r && mask == (1 << n) - 1) || (mask >> i) % 2 != 1)){       val = Math.max(val, 1 + dfs(i, r, mask | (1 << i)));      }     }         return dp[u][mask] = val;    }    public void solve(int testNumber, InputReader in, PrintWriter out) {    n = in.nextInt(); m = in.nextInt();    a = new int[n][m];    for(int i = 0; i < n; i++){     for(int j = 0; j < m; j++){      a[i][j] = in.nextInt();     }    }    int l = 0, r = max, ans = 0;    while(l <= r){     int m = (l + r) >> 1;     if(check(m)){      ans = m;      l = m + 1;     }else{      r = m - 1;     }    }    out.println(ans);   }                   }  static class InputReader {   BufferedReader br;   StringTokenizer st;   public InputReader(InputStream stream) {    br = new BufferedReader(new InputStreamReader(stream));    st = null;   }   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;   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }  } }
2	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));     StringTokenizer st = new StringTokenizer(bf.readLine());      long n = Long.parseLong(st.nextToken());   long k = Long.parseLong(st.nextToken());   int mod = 1000000007;   if(n == 0) {   out.println(0);   out.close(); System.exit(0);   }   n %= mod;   long ans = exp(2, (int)((k+1) % (mod-1)), mod);   ans = (1L*ans * n) % mod;   ans = ans + mod + 1 - exp(2, (int)((k) % (mod-1)), mod);   ans %= mod;   out.println(ans);      out.close(); System.exit(0);  }  public static int exp(int base, int e, int mod) {  if(e == 0) return 1;  if(e == 1) return base;  int val = exp(base, e/2, mod);  int ans = (int)(1L*val*val % mod);  if(e % 2 == 1)   ans = (int)(1L*ans*base % mod);  return ans;  } }
1	public class C { public static void main(String args[]) {  Kattio sc = new Kattio(System.in);  int n = sc.getInt();  String s = sc.getWord();  int[] found = new int['z' + 1];  int amount = 0;  for(int i = 0; i<s.length(); i++) {  char c = s.charAt(i);  if(found[c] == 0) amount++;  found[c]++;  }  int contains[] = new int['z' + 1];  int min = n;  int start = 0;  int end = 0;  int in = 0;  while(true) {  if(in<amount) {   if(end == n) break;   char c = s.charAt(end);   if(contains[c] == 0) in++;   contains[c]++;   end++;  } else {   if(min>end-start) min = end-start;   char c = s.charAt(start);   if(contains[c] == 1) in--;   contains[c]--;   start++;  }  }  System.out.println(min);  } } class Kattio extends PrintWriter {  public Kattio(InputStream i) { super(new BufferedOutputStream(System.out)); r = new BufferedReader(new InputStreamReader(i));  }  public Kattio(InputStream i, OutputStream o) { super(new BufferedOutputStream(o)); r = new BufferedReader(new InputStreamReader(i));  }  public boolean hasMoreTokens() { return peekToken() != null;  }  public int getInt() { return Integer.parseInt(nextToken());  }  public double getDouble() {  return Double.parseDouble(nextToken());  }  public long getLong() { return Long.parseLong(nextToken());  }  public String getWord() { return nextToken();  }   private BufferedReader r;  private String line;  private StringTokenizer st;  private String token;  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;  } }
1	public class Main {  public static void main(String[] args) throws Exception {     in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   solve();   in.close();   out.close();  }  private static void solve() throws Exception {   int n = nextInt();   int co = 0, ce = 0;   int[] v = new int[n];   for (int i = 0; i < n; i++) {    v[i] = nextInt();   }   for (int i = 0; i < n; i++) {    if (v[i] % 2 == 0) {     co++;    } else {     ce++;    }   }   if (co == 1) {    for (int i = 0; i < n; i++) {     if (v[i] % 2 == 0) {      out.println(i + 1);      return;     }    }   } else {    for (int i = 0; i < n; i++) {     if (v[i] % 2 != 0) {      out.println(i + 1);      return;     }    }   }  }  private static BufferedReader in;  private static PrintWriter out;  private 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 IOException {   return Integer.parseInt(nextString());  }  static double nextDouble() throws IOException {   return Double.parseDouble(nextString());  } }
1	public class C43 {  static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  static PrintWriter out = new PrintWriter(System.out);   static int nextInt() throws IOException {   in.nextToken();   return Integer.valueOf(in.sval);  }   static double nextDouble() throws IOException {   in.nextToken();   return Double.valueOf(in.sval);  }   static String nextString() throws IOException {   in.nextToken();   return in.sval;  }   static {   in.ordinaryChars('0', '9');   in.wordChars('0', '9');     in.ordinaryChars('.', '.');   in.wordChars('.', '.');     in.ordinaryChars('-', '-');   in.wordChars('-', '-');  }  public static void main(String[] args) throws IOException {   int n = nextInt();   char[] s = nextString().toCharArray();   int h = 0;   for (int i = 0; i < n; i++)    if (s[i] == 'H')     h++;     int ans = Integer.MAX_VALUE;   for (int i = 0; i < n; i++) {    int p = i, t = 0;    for (int j = 0; j < h; j++, p = (p+1)%n)     if (s[p] == 'T')      t++;    ans = Math.min(ans, t);   }     out.println(ans);   out.flush();  } }
5	public class main { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter; private PrintWriter pw; private long mod = 1000000000 + 7;  private StringBuilder ans_sb; private ArrayList<Integer> primes; private long ans;  private void soln() {  int n = nextInt();  long[] arr = new long[n];  for (int i = 0; i < n; i++)  arr[i] = nextLong();  Segment tree = new Segment(n, arr);  long[] ans = new long[n];  BigInteger fa = BigInteger.ZERO;  HashMap<Long, Integer> map = new HashMap<>();  for (int i = 0; i < n; i++)  {  ans[i] = ((long) i + 1) * arr[i] - tree.query(0, i);  if (map.containsKey(arr[i] - 1))  {   long tmp = map.get(arr[i] - 1);   ans[i] -= tmp;  }  if (map.containsKey(arr[i] + 1))  {   long tmp = map.get(arr[i] + 1);   ans[i] += tmp;  }   if (!map.containsKey(arr[i]))   map.put(arr[i], 0);  map.put(arr[i], map.get(arr[i]) + 1);  fa = fa.add(new BigInteger(Long.toString(ans[i])));  }     pw.println(fa.toString());                                                                                                                                                                                  }  public class Segment {  private Node[] tree;  private boolean[] lazy;  private int size;  private int n;  private long[] base;  private class Node  {  private int l;  private int r;  private long ans;  private long ans2;  }  public Segment(int n, long[] arr)  {  this.base = arr;  int x = (int) (Math.ceil(Math.log(n) / Math.log(2)));  size = 2 * (int) Math.pow(2, x) - 1;  tree = new Node[size];  lazy = new boolean[size];  this.n = n;    build(0, 0, n - 1);  }  public void build(int id, int l, int r)  {  if (l == r)  {   tree[id] = new Node();   tree[id].l = l;   tree[id].r = r;   tree[id].ans = base[l];   return;  }  int mid = (l + r) / 2;  build(2 * id + 1, l, mid);  build(2 * id + 2, mid + 1, r);  tree[id] = merge(tree[2 * id + 1], tree[2 * id + 2], l, r);    }  public Node merge(Node n1, Node n2, int l, int r)  {  Node ret = new Node();  if (n1 == null && n2 == null)   return null;  else if (n1 == null)  {   ret.ans = n2.ans;  }   else if (n2 == null)  {   ret.ans = n1.ans;  } else  {   ret.ans = n1.ans + n2.ans;   }   return ret;  }  public long query(int l, int r)  {  Node ret = queryUtil(l, r, 0, 0, n - 1);  if (ret == null)  {   return 0;  } else   return ret.ans;  }  private Node queryUtil(int x, int y, int id, int l, int r)  {  if (l > y || x > r)   return null;  if (x <= l && r <= y)  {   return tree[id];  }  int mid = l + (r - l) / 2;    Node q1 = queryUtil(x, y, 2 * id + 1, l, mid);  Node q2 = queryUtil(x, y, 2 * id + 2, mid + 1, r);   return merge(q1, q2, Math.max(l, x), Math.min(r, y));  }  public void update(int x, int y, int c)  {  update1(x, y, c, 0, 0, n - 1);  }  private void update1(int x, int y, int colour, int id, int l, int r)  {    if (x > r || y < l)   return;  if (x <= l && r <= y)  {   if (colour != -1)   {   tree[id] = new Node();   tree[id].ans = 1;   } else   tree[id] = null;   return;  }  int mid = l + (r - l) / 2;    if (y <= mid)   update1(x, y, colour, 2 * id + 1, l, mid);  else if (x > mid)   update1(x, y, colour, 2 * id + 2, mid + 1, r);  else  {   update1(x, y, colour, 2 * id + 1, l, mid);   update1(x, y, colour, 2 * id + 2, mid + 1, r);  }  tree[id] = merge(tree[2 * id + 1], tree[2 * id + 2], l, r);  }  public void print(int l, int r, int id)  {  if (l == r)  {   if (tree[id] != null)   System.out.println(l + " " + r + " " + tree[id].l + " " + tree[id].r + " " + tree[id].ans + " "    + tree[id].ans2);   return;  }  int mid = l + (r - l) / 2;  print(l, mid, 2 * id + 1);  print(mid + 1, r, 2 * id + 2);  if (tree[id] != null)   System.out.println(    l + " " + r + " " + tree[id].l + " " + tree[id].r + " " + tree[id].ans + " " + tree[id].ans2);  }  public void shift(int id)  {  } }  private class Node implements Comparable<Node> {  int node;  long dist;  @Override  public int compareTo(Node arg0)  {  if (this.dist != arg0.dist)   return (int) (this.dist - arg0.dist);  return this.node - arg0.node;  }  public boolean equals(Object o)  {  if (o instanceof Node)  {   Node c = (Node) o;   return this.node == c.node && this.dist == c.dist;  }  return false;  }  public String toString()  {  return this.node + ", " + this.dist;  } }  private void debug(Object... o) {  System.out.println(Arrays.deepToString(o)); }  private long pow(long a, long b, long c) {  if (b == 0)  return 1;  long p = pow(a, b / 2, c);  p = (p * p) % c;  return (b % 2 == 0) ? p : (a * p) % c; }  private long gcd(long n, long l) {  if (l == 0)  return n;  return gcd(l, n % l); }  public static void main(String[] args) throws Exception {  new Thread(null, new Runnable()  {  @Override  public void run()  {   new main().solve();  }  }, "1", 1 << 26).start(); }  public StringBuilder solve() {  InputReader(System.in);   pw = new PrintWriter(System.out);  ans_sb = new StringBuilder();  soln();  pw.close();   return ans_sb; }  public void InputReader(InputStream stream1) {  stream = stream1; }  private boolean isWhitespace(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  private boolean isEndOfLine(int c) {  return c == '\n' || c == '\r' || c == -1; }  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++]; }  private 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 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 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 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 int[] nextIntArray(int n) {  int[] arr = new int[n];  for (int i = 0; i < n; i++)  {  arr[i] = nextInt();  }  return arr; }  private long[] nextLongArray(int n) {  long[] arr = new long[n];  for (int i = 0; i < n; i++)  {  arr[i] = nextLong();  }  return arr; }  private void pArray(int[] arr) {  for (int i = 0; i < arr.length; i++)  {  System.out.print(arr[i] + " ");  }  System.out.println();  return; }  private void pArray(long[] arr) {  for (int i = 0; i < arr.length; i++)  {  System.out.print(arr[i] + " ");  }  System.out.println();  return; }  private boolean isSpaceChar(int c) {  if (filter != null)  return filter.isSpaceChar(c);  return isWhitespace(c); }  private char nextChar() {  int c = read();  while (isSpaceChar(c))  c = read();  char c1 = (char) c;  while (!isSpaceChar(c))  c = read();  return c1; }  private interface SpaceCharFilter {  public boolean isSpaceChar(int ch); } }
5	public class ProblemA {  public static void main(String[] args) throws IOException {  BufferedReader s = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  String[] line = s.readLine().split(" ");  int n = Integer.valueOf(line[0]);  int ht = Integer.valueOf(line[1]);   int[][] house = new int[n][2];  Set<Integer> candidates = new HashSet<Integer>();  for (int i = 0 ; i < n ; i++) {  String[] data = s.readLine().split(" ");  house[i][0] = Integer.valueOf(data[0]) * 2;  house[i][1] = Integer.valueOf(data[1]);  candidates.add(house[i][0] - house[i][1] - ht);  candidates.add(house[i][0] + house[i][1] + ht);  }   int ans = 0;  for (int p : candidates) {  int f = p - ht;  int t = p + ht;  boolean isok = true;  for (int i = 0 ; i < n ; i++) {   if (house[i][0] + house[i][1] <= f) {   } else if (house[i][0] - house[i][1] >= t) {   } else {   isok = false;   break;   }  }  if (isok) {   ans++;  }  }     out.println(ans);  out.flush(); }  public static void debug(Object... os){  System.err.println(Arrays.deepToString(os)); } }
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();  } }
5	public class Beta97B {  static Scanner in;  static StreamTokenizer st;  static int n;  static int[] a;  static int max = 1;  public static void main(String[] args) throws IOException {     st = new StreamTokenizer(new InputStreamReader(System.in));   n = nextInt();   a = new int[n];   int ind = 0;   for (int i = 0; i < n; ++i) {    a[i] = nextInt();    if (a[i] > max) {     max = a[i];     ind = i;    }   }   if (max == 1) {    a[0] = 2;   } else {    a[ind] = 1;   }   Arrays.sort(a);   for (int i = 0; i < n; ++i)    System.out.print(a[i] + " ");  }  private static int nextInt() throws IOException {   st.nextToken();   return (int) st.nval;  } }
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);   }  }  }  } }
4	public class DoubleWord implements Runnable {  boolean isLocalMode =false;   private void doJob() throws Exception {     String s = nextToken();     int max=0;   for(int i = 0;i<s.length();i++){    for(int j=i+1;j<s.length()+1;j++){     String s1 = s.substring(i, j);     if(s.substring(i+1).contains(s1)){      max = Math.max(max,s1.length());     }    }   }   writer.write(""+max);  }   public static void main(String[] args) {   new DoubleWord().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);   }  }   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);   }  } }
1	public class B {   static char[] digits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; static HashMap<Character, Integer> val = new HashMap<Character, Integer>(); static HashMap<Integer, Character> ch = new HashMap<Integer, Character>(); static StringBuffer strcol = new StringBuffer(); static String s;  static boolean isDigit(char a) {  boolean found = false;  for (int i = 0; i < digits.length; i++)  {  if (found = a == digits[i]) break;  }   return found; }  static String ABtoRC(int pos) {  do  {  ++pos;  }  while(!isDigit(s.charAt(pos)));   int res = 0;  for (int i = pos - 1, pow = 1; i >= 0; i--, pow *= 26)  {  res += val.get(s.charAt(i)) * pow;  }   return new String("R" + s.substring(pos, s.length()) + "C" + String.valueOf(res)); }  static String RCtoAB(int cpos) {  int col = Integer.valueOf(s.substring(cpos + 1, s.length()));  int mod = 0;  strcol.delete(0, strcol.length());   while (col >= 26)  {  int tmp = col / 26;  mod = col - 26 * tmp;  if (mod == 0)   {   mod += 26;   tmp -= 1;     }  col = tmp;  strcol.append(ch.get(mod));  }  if(col != 0)strcol.append(ch.get(col));  strcol.reverse();   return strcol.toString() + s.substring(1, cpos);  } public static void main(String[] args) throws IOException  {    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));  PrintWriter output = new PrintWriter(new OutputStreamWriter(System.out));  StreamTokenizer in = new StreamTokenizer(input);  in.nextToken();  int n = (int)in.nval;   for (int i = 0; i < 26; i++)  {  val.put((char)('A' + i), i + 1);  }   for (int i = 0; i < 26; i++)  {  ch.put(i + 1, (char)('A' + i));  }   input.readLine();  for (int i = 0; i < n; i++) {  s = input.readLine();  int cpos;  if( ((cpos = s.indexOf('C')) > 1) && (isDigit(s.charAt(cpos - 1))) )   {   output.println(RCtoAB(cpos));   }  else  {   output.println(ABtoRC(cpos));  }  }   output.close();  input.close(); } }
4	public class Fire_Again {  static int N;  static int M;  static int K;  private class Pos {   public int r;   public int c;   int last;   public Pos(int r,int c, int last) {    this.r = r;    this.c = c;    this.last = last;   }  }  static ArrayList<Pos> pos = new ArrayList<>();  static boolean[][] used;  static int[] rows = {-1,1,0,0};  static int[] cols = {0,0,-1,1};  int LAST = 0;  int lastRow = 1;  int lastCol = 1;  public static void main(String[] args) throws IOException {   Fire_Again fire_again = new Fire_Again();   BufferedReader bufferedReader =     new BufferedReader(new FileReader("input.txt"));   String[] nm = bufferedReader.readLine().split(" ");   N = Integer.parseInt(nm[0]) + 1;   M = Integer.parseInt(nm[1]) + 1;   K = Integer.parseInt(bufferedReader.readLine());   used = new boolean[N][M];   String[] rc = bufferedReader.readLine().split(" ");   for(int k = 0;k < rc.length;k+=2) {    int r = Integer.parseInt(rc[k]);    int c = Integer.parseInt(rc[k+1]);    pos.add(fire_again.new Pos(r,c,0));   }   fire_again.bfs();   PrintStream ps = new PrintStream("output.txt");   ps.printf("%d %d\n",fire_again.lastRow,fire_again.lastCol);   ps.flush();   ps.close();  }  Queue<Pos> queue = new LinkedList<>();  private void bfs() {  queue.addAll(pos);  for(Pos p : pos) {   used[p.r][p.c] = true;     }  while(!queue.isEmpty()) {   Pos p = queue.poll();   if(p.last > LAST) {    LAST = p.last;    lastRow = p.r;    lastCol = p.c;   }   for(int i = 0;i < rows.length;i++) {    int currR = p.r;    int currC = p.c;    if(currR + rows[i] >= 1 && currR + rows[i] < N &&    currC + cols[i] >= 1 && currC + cols[i] < M &&    !used[currR + rows[i] ] [currC + cols[i] ] ) {         queue.add(new Pos(currR+rows[i],currC+cols[i],p.last+1));     used[currR + rows[i] ] [currC + cols[i] ] = true;    }   }  }  } }
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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    int d = in.nextInt();    int[] a = in.readIntArray(n);    int ans = 1;    for (int i = 0; i < a.length - 1; ++i) {     int left = a[i] + d;     int right = a[i + 1] - d;     if (left < right) {      ans += 2;     } else if (left == right)      ans++;    }    out.println(ans + 1);   }  }  static class OutputWriter extends PrintWriter {   public OutputWriter(OutputStream outputStream) {    super(outputStream);   }   public OutputWriter(Writer writer) {    super(writer);   }   public OutputWriter(String filename) throws FileNotFoundException {    super(filename);   }   public void close() {    super.close();   }  }  static class InputReader extends BufferedReader {   StringTokenizer tokenizer;   public InputReader(InputStream inputStream) {    super(new InputStreamReader(inputStream), 32768);   }   public InputReader(String filename) {    super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));   }   public String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(readLine());     } catch (IOException e) {      throw new RuntimeException();     }    }    return tokenizer.nextToken();   }   public Integer nextInt() {    return Integer.valueOf(next());   }   public int[] readIntArray(int size) {    int[] array = new int[size];    for (int i = 0; i < size; i++)     array[i] = nextInt();    return array;   }  } }
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());   }  } }
6	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   inputClass in = new inputClass(inputStream);   PrintWriter out = new PrintWriter(outputStream);   G1PlaylistForPolycarpEasyVersion solver = new G1PlaylistForPolycarpEasyVersion();   solver.solve(1, in, out);   out.close();  }  static class G1PlaylistForPolycarpEasyVersion {   static final int mod = (int) 1e9 + 7;   public void solve(int testNumber, inputClass sc, PrintWriter out) {    int n = sc.nextInt();    int t = sc.nextInt();    G1PlaylistForPolycarpEasyVersion.Song[] songs = new G1PlaylistForPolycarpEasyVersion.Song[n];    for (int i = 0; i < n; i++) {     songs[i] = new G1PlaylistForPolycarpEasyVersion.Song(sc.nextInt(), sc.nextInt());    }    long ans = 0;    for (int mask = 1; mask < (1 << n); mask++) {     int nb = 0;     int tot = 0;     int type1 = 0;     int type2 = 0;     int type3 = 0;     for (int j = 0; j < n; j++) {      if (((1 << j) & mask) > 0) {       nb++;       tot += songs[j].l;       if (songs[j].type == 1) {        type1++;       } else if (songs[j].type == 2) {        type2++;       } else {        type3++;       }      }     }     if (tot == t) {      long[][][][][] dp = new long[nb + 1][3][type1 + 1][type2 + 1][type3 + 1];      boolean[][][][][] go = new boolean[nb + 1][3][type1 + 1][type2 + 1][type3 + 1];      if (type1 > 0) {       go[1][0][type1 - 1][type2][type3] = true;       dp[1][0][type1 - 1][type2][type3] = type1;      }      if (type2 > 0) {       go[1][1][type1][type2 - 1][type3] = true;       dp[1][1][type1][type2 - 1][type3] = type2;      }      if (type3 > 0) {       go[1][2][type1][type2][type3 - 1] = true;       dp[1][2][type1][type2][type3 - 1] = type3;      }      for (int i = 0; i < nb; i++) {       for (int m = 0; m < 3; m++) {        for (int j = 0; j <= type1; j++) {         for (int k = 0; k <= type2; k++) {          for (int l = 0; l <= type3; l++) {           if (go[i][m][j][k][l]) {            if (m == 0) {             if (k > 0) {              dp[i + 1][1][j][k - 1][l] += dp[i][m][j][k][l] * k;              dp[i + 1][1][j][k - 1][l] %= mod;              go[i + 1][1][j][k - 1][l] = true;             }             if (l > 0) {              dp[i + 1][2][j][k][l - 1] += dp[i][m][j][k][l] * l;              dp[i + 1][2][j][k][l - 1] %= mod;              go[i + 1][2][j][k][l - 1] = true;             }            } else if (m == 1) {             if (j > 0) {              dp[i + 1][0][j - 1][k][l] += dp[i][m][j][k][l] * j;              dp[i + 1][0][j - 1][k][l] %= mod;              go[i + 1][0][j - 1][k][l] = true;             }             if (l > 0) {              dp[i + 1][2][j][k][l - 1] += dp[i][m][j][k][l] * l;              dp[i + 1][2][j][k][l - 1] %= mod;              go[i + 1][2][j][k][l - 1] = true;             }            } else {             if (j > 0) {              dp[i + 1][0][j - 1][k][l] += dp[i][m][j][k][l] * j;              dp[i + 1][0][j - 1][k][l] %= mod;              go[i + 1][0][j - 1][k][l] = true;             }             if (k > 0) {              dp[i + 1][1][j][k - 1][l] += dp[i][m][j][k][l] * k;              dp[i + 1][1][j][k - 1][l] %= mod;              go[i + 1][1][j][k - 1][l] = true;             }            }           }          }         }        }       }      }      long toadd = 0;      for (int i = 0; i < 3; i++) {       toadd += dp[nb][i][0][0][0];      }      ans += toadd;      ans %= (int) 1e9 + 7;     }    }    out.println(ans);   }   static class Song {    int l;    int type;    public Song(int x, int y) {     l = x;     type = y;    }   }  }  static class inputClass {   BufferedReader br;   StringTokenizer st;   public inputClass(InputStream in) {    br = new BufferedReader(new InputStreamReader(in));   }   public String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(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();  } }
2	public class B{  public static void main(String args[]){   Scanner input = new Scanner(System.in);   long n = input.nextLong();   long k = input.nextLong();   System.out.println(solve(n, k));   input.close();  }   public static long solve(long n, long k){   long dis = n - k;   if(n == 1)    return 0;   if((((k - 2) * ((k - 2) + 1)) / 2) + 1 <= dis)    return -1;   if(k >= n)    return 1;     long ans = 2;   long now = (((k - 2) * ((k - 2) + 1)) / 2) + 1 + k;   long dist = Math.abs(now - n);   long delta = 1 + 8 * dist;   double ret = (1 + Math.sqrt(delta)) / 2;     now = (((k - 2) * ((k - 2) + 1)) / 2) + 1 + k;   dist = Math.abs(now - k);   delta = 1 + 8 * dist;   double nret = (1 + Math.sqrt(delta)) / 2;     double back = nret - ret;   ans = (long) back;   return ans + 2;  } }
2	public class MrBenderAndSquare {  static long n, x, y, c;  public static void main(String[] args) throws IOException {  Kattio io = new Kattio(System.in);  n = io.getLong();  x = io.getLong();  y = io.getLong();  c = io.getLong();   long lo = 0;  long hi = c;  while (lo < hi) {  long mid = lo + (hi - lo) / 2;  if (f(mid) >= c) {   hi = mid;  } else {   lo = mid + 1;  }  }  io.println(lo);  io.close(); }  static long f(long t) {  long res = 0;   long left = Math.max(0, t - (x - 1));  res -= left*left;  long right = Math.max(0, t - (n - x));  res -= right*right;  long up = Math.max(0, t - (y - 1));  res -= up*up;  long down = Math.max(0, t - (n - y));  res -= down*down;   res += 1 + 2*t*(t+1);   long upLeft = Math.max(0, t - (x + y) + 1);  long upRight = Math.max(0, t - (n - x + 1 + y) + 1);  long downLeft = Math.max(0, t - (x + n - y + 1) + 1);  long downRight = Math.max(0, t - (n - x + 1 + n - y + 1) + 1);  res += upLeft * (upLeft + 1) / 2;  res += upRight * (upRight + 1) / 2;  res += downLeft * (downLeft + 1) / 2;  res += downRight * (downRight + 1) / 2;  return res; }  static class Kattio extends PrintWriter {  public Kattio(InputStream i) {  super(new BufferedOutputStream(System.out));  r = new BufferedReader(new InputStreamReader(i));  }  public Kattio(InputStream i, OutputStream o) {  super(new BufferedOutputStream(o));  r = new BufferedReader(new InputStreamReader(i));  }  public boolean hasMoreTokens() {  return peekToken() != null;  }  public int getInt() {  return Integer.parseInt(nextToken());  }  public double getDouble() {   return Double.parseDouble(nextToken());  }  public long getLong() {  return Long.parseLong(nextToken());  }  public String getWord() {  return nextToken();  }   private BufferedReader r;  private String line;  private StringTokenizer st;  private String token;  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;  } } }
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;  } }
6	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   MyInput in = new MyInput(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskE solver = new TaskE();   solver.solve(1, in, out);   out.close();  }  static class TaskE {   int n;   int k;   long[] neigibor;   Random random = new Random();   long maxClique;   public void solve(int testNumber, MyInput in, PrintWriter out) {    n = in.nextInt();    k = in.nextInt();    neigibor = new long[n];    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      neigibor[i] |= in.nextLong() << j;     }    }    long maxClique = bronKerbosch();    long a = Long.bitCount(maxClique);    dump(a);    out.printf("%.12f\n", a * (a - 1.0) / 2 * k / a * k / a);   }   static void dump(Object... o) {    System.err.println(Arrays.deepToString(o));   }   long bronKerbosch() {    maxClique = 0;    bronKerbosch2(0, (1L << n) - 1, 0);    return maxClique;   }   void bronKerbosch2(long r, long p, long x) {    if (Long.bitCount(maxClique) >= Long.bitCount(r | p | x)) return;    long px = p | x;    if (px == 0) {     if (Long.bitCount(maxClique) < Long.bitCount(r)) {      maxClique = r;     }     return;    }    int cnt = Long.bitCount(px);    int choice = random.nextInt(cnt);    int u;    for (int i = 0; ; i++) {     if ((px >>> i & 1) != 0 && choice-- == 0) {      u = i;      break;     }    }    long ne = p & ~neigibor[u];    for (int v = 0; v < n; v++)     if ((ne >>> v & 1) != 0) {      bronKerbosch2(r | 1L << v, p & neigibor[v], x & neigibor[v]);      p &= ~(1L << v);      x |= 1L << v;     }   }  }  static class MyInput {   private final BufferedReader in;   private static int pos;   private static int readLen;   private static final char[] buffer = new char[1024 * 8];   private static char[] str = new char[500 * 8 * 2];   private static boolean[] isDigit = new boolean[256];   private static boolean[] isSpace = new boolean[256];   private static boolean[] isLineSep = 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;    isLineSep['\r'] = isLineSep['\n'] = true;   }   public MyInput(InputStream is) {    in = new BufferedReader(new InputStreamReader(is));   }   public int read() {    if (pos >= readLen) {     pos = 0;     try {      readLen = in.read(buffer);     } catch (IOException e) {      throw new RuntimeException();     }     if (readLen <= 0) {      throw new MyInput.EndOfFileRuntimeException();     }    }    return buffer[pos++];   }   public int nextInt() {    int len = 0;    str[len++] = nextChar();    len = reads(len, isSpace);    int i = 0;    int ret = 0;    if (str[0] == '-') {     i = 1;    }    for (; i < len; i++) ret = ret * 10 + str[i] - '0';    if (str[0] == '-') {     ret = -ret;    }    return ret;   }   public long nextLong() {    int len = 0;    str[len++] = nextChar();    len = reads(len, isSpace);    int i = 0;    long ret = 0;    if (str[0] == '-') {     i = 1;    }    for (; i < len; i++) ret = ret * 10 + str[i] - '0';    if (str[0] == '-') {     ret = -ret;    }    return ret;   }   public char nextChar() {    while (true) {     final int c = read();     if (!isSpace[c]) {      return (char) c;     }    }   }   int reads(int len, boolean[] accept) {    try {     while (true) {      final int c = read();      if (accept[c]) {       break;      }      if (str.length == len) {       char[] rep = new char[str.length * 3 / 2];       System.arraycopy(str, 0, rep, 0, str.length);       str = rep;      }      str[len++] = (char) c;     }    } catch (MyInput.EndOfFileRuntimeException e) {    }    return len;   }   static class EndOfFileRuntimeException extends RuntimeException {   }  } }
1	public class C {  public static void main(String[] args)  {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   char[] s = new char[n];   String line = in.next();   int ct=0,ht=0;   for(int i=0;i<n;i++)    if(line.charAt(i)=='T')     ct++;    else     ht++;     int cnt = 1000000000;   int[] c = new int[2];   char[] cc = new char[2];   if(ct<ht)   {    c[0] = ct;    c[1] = ht;    cc[0] = 'T';    cc[1] = 'H';   }else{    c[0] = ht;    c[1] = ct;    cc[0] = 'H';    cc[1] = 'T';   }     for(int i=0;i<n;i++)   {    int ptr = i;    for(int j=0;j<c[0];j++)    {     s[ptr] = cc[0];     ptr = (ptr+1)%n;    }    for(int j=0;j<c[1];j++)    {     s[ptr] = cc[1];     ptr = (ptr+1)%n;    }       int ch = 0;    for(int j=0;j<n;j++)     if(s[j]!=line.charAt(j)&&s[j]==cc[0])      ch++;    cnt = Math.min(cnt,ch);   }     System.out.print(cnt);  } }
1	public class SonyaAndHotels {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int d = sc.nextInt();   int[] locs = new int[n];   for (int i = 0; i < n; i++) {    locs[i] = sc.nextInt();   }   Arrays.sort(locs);   int count = 2;   for (int i = 0; i < locs.length-1; i++) {    if(locs[i+1]-locs[i]==2*d){     count++;    }else if(locs[i+1]-locs[i]>2*d){     count+=2;    }   }   System.out.println(count);  } }
1	public class Main {  public static void main(String[] args) throws NumberFormatException, IOException {    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(in.readLine());  String in1 = in.readLine();  String store = "";  HashSet<Character> contain = new HashSet<Character>();  for(int i = 0; i < n;i++){  if(!contain.contains(in1.charAt(i))){   store += in1.charAt(i);   contain.add(in1.charAt(i));  }  }  int[] index = new int[store.length()];  for(int i = 0; i < store.length(); i++){  index [i] = -1;  }  HashSet<Integer> index2 = new HashSet<Integer>();  ArrayList<Integer> index3 = new ArrayList<Integer>();  int min = Integer.MAX_VALUE;  for(int i = 0; i < n; i++){  int index4 = store.indexOf(in1.charAt(i));  if(index[index4] == -1){   index[index4] = i;   index2.add(i);   index3.add(i);  }  else{   index2.remove(index[index4]);   index2.add(i);   index3.add(i);   index[index4] = i;  }  if(index2.size() == index.length){   while(!index2.contains(index3.get(0))){   index3.remove(0);   }   min = Math.min(min, i - index3.get(0)+ 1);  }    }  System.out.println(min); } }
4	public class CodeF { 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] = nextDouble();  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];  }  public String[] nextStringArray(int n)  {   String[] vals = new String[n];  for(int i = 0; i < n; i++)   vals[i] = next();  return vals;  }   Integer nextInteger()  {  String s = next();  if(s == null)   return null;  return Integer.parseInt(s);  }   int[][] nextIntMatrix(int n, int m)  {  int[][] ans = new int[n][];  for(int i = 0; i < n; i++)   ans[i] = nextIntArray(m);  return ans;  } }  static int[] compute_prefix_function(char[] p) {  int[] pi = new int[p.length]; pi[0] = -1; int k = -1;  for (int i = 1; i < p.length; i++) {   while (k >= 0 && p[k + 1] != p[i]) k = pi[k];   if (p[k + 1] == p[i]) k++; pi[i] = k;  }  return pi; }  static boolean KMP_Matcher(String pattern, String text) {  char[] p = pattern.toCharArray(); char[] t = text.toCharArray();  int[] pi = compute_prefix_function(p); int q = -1;  int cuenta = 0;  for (int i = 0; i < text.length(); i++) {   while (q >= 0 && p[q + 1] != t[i]) q = pi[q];   if (p[q + 1] == t[i]) q++;   if (q == p.length - 1) {    cuenta++;    q = pi[q];   }  }  return cuenta >= 2; }  public static void main(String[] args) {  Scanner sc = new Scanner();  String entrada = sc.next();  int mejor = 0;  for(int i = 0; i < entrada.length(); i++)  {  for(int j = i + 1; j <= entrada.length(); j++)  {   String sub = entrada.substring(i, j);   if(KMP_Matcher(sub, entrada))   mejor = Math.max(j - i, mejor);  }  }  System.out.println(mejor); } }
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)); } }
3	public class Main{  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);   PrintWriter out=new PrintWriter(System.out);   int n=sc.nextInt();   int a[]=new int[n];   for (int i = 0; i <n ; i++) {    a[i]=sc.nextInt();   }   HashMap<Integer,ArrayList<Node>> h=new HashMap<>();   for (int i = 0; i <n ; i++) {    int sum=0;    for (int j = i; j <n ; j++) {     sum+=a[j];     if(h.containsKey(sum)){      h.get(sum).add(new Node(i,j));     }     else{      ArrayList<Node> temp=new ArrayList<>();      temp.add(new Node(i,j));      h.put(sum,temp);     }    }   }   long ans=0;   ArrayList<Integer> ansList=new ArrayList<>();   for(int x:h.keySet()){    Collections.sort(h.get(x), new Comparator<Node>() {     @Override     public int compare(Node o1, Node o2) {      return Integer.compare(o1.r,o2.r);     }    });     ArrayList<Node> l=h.get(x);       ArrayList<Integer> temp=new ArrayList<>();    int lasty=Integer.MIN_VALUE;    for (int i = 0; i <l.size() ; i++) {     if(l.get(i).l>lasty){      lasty=l.get(i).r;      temp.add(l.get(i).l);      temp.add(l.get(i).r);     }    }    if(ans<temp.size()){     ansList=temp;     ans=ansList.size();    }   }   out.println(ans/2);   for (int i = 0; i <ansList.size() ; i++) {    out.print((ansList.get(i)+1)+" ");    i++;    out.println((ansList.get(i)+1)+" ");   }    out.close();  }  static class Node{   int l,r;   public Node(int a,int b){    l=a;    r=b;   }  } }
1	public class Main {  void solve(){   int n=ni();   int c1[]=new int[9];   int c2[]=new int[9];   for(int i=0;i<n;i++){    String s=ns();    if(s.equals("M")) c1[0]++;    else if(s.equals("S")) c1[1]++;    else if(s.equals("L")) c1[2]++;    else if(s.equals("XS")) c1[3]++;    else if(s.equals("XL")) c1[4]++;    else if(s.equals("XXS")) c1[5]++;    else if(s.equals("XXL")) c1[6]++;    else if(s.equals("XXXS")) c1[7]++;    else if(s.equals("XXXL")) c1[8]++;   }   for(int i=0;i<n;i++){    String s=ns();    if(s.equals("M")) c2[0]++;    else if(s.equals("S")) c2[1]++;    else if(s.equals("L")) c2[2]++;    else if(s.equals("XS")) c2[3]++;    else if(s.equals("XL")) c2[4]++;    else if(s.equals("XXS")) c2[5]++;    else if(s.equals("XXL")) c2[6]++;    else if(s.equals("XXXS")) c2[7]++;    else if(s.equals("XXXL")) c2[8]++;   }   int ans=0;   for(int i=0;i<9;i++){    if(c2[i]<c1[i]) ans+=c1[i]-c2[i];   }   pw.println(ans);   }  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 Main().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)); } }
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);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); }  static class TaskA {  public void solve(int testNumber, InputReader in, OutputWriter out) {  int n = in.nextInt();  boolean[] a = new boolean[218];  for (int i = 0; i < n; ++i) {   a[in.nextInt()] = true;  }  int res = 0;  for (int i = 1; i < a.length; ++i) {   if (a[i]) {   ++res;   for (int j = i; j < a.length; j += i) {    a[j] = false;   }   }  }  out.printLine(res);  }  }  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 InputReader {  private InputStream stream;  private byte[] buffer = new byte[10000];  private int cur;  private int count;  public InputReader(InputStream stream) {  this.stream = stream;  }  public static boolean isSpace(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  public int read() {  if (count == -1) {   throw new InputMismatchException();  }  try {   if (cur >= count) {   cur = 0;   count = stream.read(buffer);   if (count <= 0) {    return -1;   }   }  } catch (IOException e) {   throw new InputMismatchException();  }  return buffer[cur++];  }  public int readSkipSpace() {  int c;  do {   c = read();  } while (isSpace(c));  return c;  }  public int nextInt() {  int sgn = 1;  int c = readSkipSpace();  if (c == '-') {   sgn = -1;   c = read();  }  int res = 0;  do {   if (c < '0' || c > '9') {   throw new InputMismatchException();   }   res = res * 10 + c - '0';   c = read();  } while (!isSpace(c));  res *= sgn;  return res;  }  } }
4	public class FireAgain {  public static void main(String[] args){  File in = new File("input.txt"); File out = new File("output.txt"); Scanner sc; PrintWriter pw; try{  sc = new Scanner(in);  pw = new PrintWriter(out); }catch(Exception e){  sc = new Scanner(System.in);  pw = null; }  int max_x = sc.nextInt(); int max_y = sc.nextInt(); int start_num = sc.nextInt(); HashSet<int[]> start = new HashSet<int[]>(); for(int i=0; i<start_num; i++){  int[] cell = new int[2];  cell[0] = sc.nextInt();  cell[1] = sc.nextInt();  start.add(cell); }  int[] result = new int[]{1,1}; int resultLen = 0; for(int i=1; i<=max_x; i++){  for(int j=1; j<=max_y; j++){  int[] sh = new int[]{1,1};  int shLen = Integer.MAX_VALUE;  for(int[] fired: start){   int len = Math.abs(i - fired[0]) + Math.abs(j - fired[1]);   if(len < shLen){  sh[0] = i;  sh[1] = j;  shLen = len;   }  }  if(shLen > resultLen){   result[0] = sh[0];   result[1] = sh[1];   resultLen = shLen;  }  } } pw.print(result[0] + " " + result[1]); pw.close(); return ;  } }
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;   }  } }
4	public class Main { public static Scanner scan = new Scanner(System.in);  int n, m; int[][] x; int[][] y; int k, k2;  int[][] sol0; int[][] sol1;   public Main(int[][] x, int[][] y, int k) {  this.x = x;  this.y = y;  this.k = k;  this.n = x.length;  this.m = x[0].length; }  void go() {  if(k%2 != 0) {  for(int i=0; i<n; ++i) {   for(int j=0; j<m; ++j) {   System.out.print(-1 + " ");   }   System.out.println();  }   return;  }  k2 = k/2;  sol0 = new int[n][m];  sol1 = new int[n][m];   for(int d=0; d<k2; ++d) {  var zzz = sol1;  sol1 = sol0;  sol0 = zzz;    for(int i=0; i<n; ++i)   for(int j=0; j<m; ++j) {   update(i,j);   }  }  for(int i=0; i<n; ++i) {  for(int j=0; j<m; ++j) {   System.out.print(sol1[i][j]*2 + " ");  }  System.out.println();  }  }  void update(int i, int j) {  int ret = Integer.MAX_VALUE;  if(i>0)  ret = Math.min(ret, sol0[i-1][j] + y[i-1][j]);  if(j>0)  ret = Math.min(ret, sol0[i][j-1] + x[i][j-1]);  if(i < n-1)  ret = Math.min(ret, sol0[i+1][j] + y[i][j]);  if(j < m-1)  ret = Math.min(ret, sol0[i][j+1] + x[i][j]);  sol1[i][j] = ret; }   public static void main(String[] args) {  int n = scan.nextInt();  int m = scan.nextInt();  int k = scan.nextInt();  int x[][] = new int[n][m];  int y[][] = new int[n][m];  for(int i=0; i<n; ++i) {  for(int j=0; j<m-1; ++j) {   x[i][j] = scan.nextInt();  }  }  for(int i=0; i<n-1; ++i) {  for(int j=0; j<m; ++j) {   y[i][j] = scan.nextInt();  }  }  Main mm = new Main(x,y,k);  mm.go(); } }
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);   F2BlokiRavnoiSummiUslozhnennayaRedakciya solver = new F2BlokiRavnoiSummiUslozhnennayaRedakciya();   solver.solve(1, in, out);   out.close();  }  static class F2BlokiRavnoiSummiUslozhnennayaRedakciya {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int[] sum = new int[n];    int prev = 0;    for (int i = 0; i < n; i++) {     sum[i] = in.nextInt() + prev;     prev = sum[i];    }    HashMap<Integer, List<Pair<Integer, Integer>>> blocks = new HashMap<>();    int max = 0;    int maxS = 0;    for (int i = 0; i < n; i++) {     for (int h = i; h >= 0; h--) {      int s = sum[i];      if (h > 0) {       s -= sum[h - 1];      }      blocks.putIfAbsent(s, new ArrayList<>());      List<Pair<Integer, Integer>> l = blocks.get(s);      if (l.isEmpty() || l.get(l.size() - 1).sc < h) {       l.add(new Pair<>(h, i));      }      if (l.size() > max) {       max = l.size();       maxS = s;      }     }    }    out.println(max);    for (int i = 0; i < max; i++) {     out.println(String.format("%d %d", blocks.get(maxS).get(i).fs + 1, blocks.get(maxS).get(i).sc + 1));    }   }  }  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());   }  }  static class Pair<T, K> {   T fs;   K sc;   public Pair(T fs, K sc) {    this.fs = fs;    this.sc = sc;   }  } }
5	public class CottageVillage {  static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st;  static String LINE() throws Exception { return stdin.readLine(); } static String TOKEN() throws Exception {  while (st == null || !st.hasMoreTokens())st = new StringTokenizer(LINE());  return st.nextToken(); } static int INT() throws Exception {return Integer.parseInt(TOKEN());} static long LONG() throws Exception {return Long.parseLong(TOKEN());} static double DOUBLE() throws Exception {return Double.parseDouble(TOKEN());}  static DecimalFormat DF = new DecimalFormat("0.000",new DecimalFormatSymbols(Locale.ENGLISH));  public static final double EPSILON = 1E-9;  public static void main(String[] args) throws Exception {  int N = INT(), T = INT();  House[] list = new House[N];  for(int i = 0;i<N;i++) {  list[i] = new House(INT(),INT());  }  Arrays.sort(list);  int cnt = 2;  for(int i = 1;i<N;i++) {  int room = list[i].center-list[i-1].center;  if(2*T<2*room-list[i].side-list[i-1].side)cnt += 2;  else if(2*T==2*room-list[i].side-list[i-1].side)cnt++;  }  System.out.println(cnt);   }  private static class House implements Comparable<House> {  int center, side;  House(int c, int s) {  this.center = c;  this.side = s;  }  public int compareTo(House h) {  return this.center-h.center;  } } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   F2SameSumBlocksHard solver = new F2SameSumBlocksHard();   solver.solve(1, in, out);   out.close();  }  static class F2SameSumBlocksHard {   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    long arr[] = new long[n];    for (int i = 0; i < n; i++) {     arr[i] = in.scanLong();    }     HashMap<Long, ArrayList<pair>> hm = new HashMap<>();    for (int i = 0; i < n; i++) {     long sum = 0;     for (int j = i; j < n; j++) {      sum += arr[j];      if (hm.containsKey(sum)) {       hm.get(sum).add(new pair(i + 1, j + 1));      } else {       hm.put(sum, new ArrayList<>());       hm.get(sum).add(new pair(i + 1, j + 1));      }     }    }     long maxi_sum = -1;    long sum = 0;    for (Map.Entry<Long, ArrayList<pair>> k : hm.entrySet()) {     Collections.sort(k.getValue(), new Comparator<pair>() {      public int compare(pair o1, pair o2) {       return o1.r - o2.r;      }     });     int count = k.getValue().size() > 0 ? 1 : 0;     int index = 0;     for (int i = 1; i < k.getValue().size(); i++) {      if (k.getValue().get(i).l > k.getValue().get(index).r) {       count++;       index = i;      }     }      if (count > maxi_sum) {      maxi_sum = count;      sum = k.getKey();     }    }    out.println(maxi_sum);    ArrayList<pair> tt = hm.get(sum);    Collections.sort(tt, new Comparator<pair>() {     public int compare(pair o1, pair o2) {      return o1.r - o2.r;     }    });     out.println(tt.size() > 0 ? (tt.get(0).l + " " + tt.get(0).r) : (" "));    int index = 0;    for (int i = 1; i < tt.size(); i++) {     if (tt.get(i).l > tt.get(index).r) {      out.println(tt.get(i).l + " " + tt.get(i).r);      index = i;     }    }    }   class pair {    int l;    int r;    public pair(int l, int r) {     this.l = l;     this.r = r;    }   }  }  static class ScanReader {   private byte[] buf = new byte[4 * 1024];   private int INDEX;   private BufferedInputStream in;   private int TOTAL;   public ScanReader(InputStream inputStream) {    in = new BufferedInputStream(inputStream);   }   private int scan() {    if (INDEX >= TOTAL) {     INDEX = 0;     try {      TOTAL = in.read(buf);     } catch (Exception e) {      e.printStackTrace();     }     if (TOTAL <= 0) return -1;    }    return buf[INDEX++];   }   public int scanInt() {    int I = 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') {      I *= 10;      I += n - '0';      n = scan();     }    }    return neg * I;   }   private boolean isWhiteSpace(int n) {    if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;    else return false;   }   public long scanLong() {    long I = 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') {      I *= 10;      I += n - '0';      n = scan();     }    }    return neg * I;   }  } }
5	public class Solution implements Runnable{  public static BufferedReader br;  public static PrintWriter out;  public static StringTokenizer stk;  public static boolean isStream = true;  public static void main(String[] args) throws IOException {  if (isStream) {    br = new BufferedReader(new InputStreamReader(System.in));   } else {    br = new BufferedReader(new FileReader("in.txt"));   }   out = new PrintWriter(System.out);   new Thread(new Solution()).start();  }  public void loadLine() {   try {    stk = new StringTokenizer(br.readLine());   } catch (IOException e) {    e.printStackTrace();   }  }  public String nextLine() {   try {    return br.readLine();   } catch (IOException e) {    e.printStackTrace();    return "";   }  }  public String nextWord() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return stk.nextToken();  }  public Integer nextInt() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return Integer.valueOf(stk.nextToken());  }  public Long nextLong() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return Long.valueOf(stk.nextToken());  }  public Double nextDouble() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return Double.valueOf(stk.nextToken());  }   public Float nextFloat() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return Float.valueOf(stk.nextToken());  }   public void run() {  int n = nextInt();  int[] arr = new int[n];  for (int i = 0; i < n;i++) {   arr[i] = nextInt();  }  Arrays.sort(arr);  if (arr[n-1] != 1) arr[n-1] = 1;  else arr[n-1] = 2;  Arrays.sort(arr);  for (int i = 0; i < n; i++) {   out.print(arr[i]+" ");  }  out.println();  out.flush();  } }
2	public class Main {  long k;  private void solve() throws IOException {  long n = nl();  k = nl();   if (n == 1) {   prln(0);   return;  }   if (n <= k) {   prln(1);   return;  }   long l = 1, r = k - 1;  long mid = (l + r + 1) / 2;  long old = -1;   while (old != mid) {   old = mid;    if (take(mid) >= n)    r = mid;   if (take(mid) < n)    l = mid;    mid = (l + r + 1) / 2;  }   if (mid >= k || mid <= 0) {   prln(-1);   return;  }   if (take(mid) == n) {   prln(mid);   return;  }   if (mid == k - 1)   prln(-1);  else   if (take(mid) < n)    prln(mid + 1);   else    prln(mid);  }  long take(long t) {  return k * t - t * (t - 1) / 2 - (t - 1);  }  public static void main(String[] args) {  new Main().run();  }  public void run() {  try {   if (isFileIO) {    pw = new PrintWriter(new File("output.out"));    br = new BufferedReader(new FileReader("input.in"));   } else {    pw = new PrintWriter(System.out);    br = new BufferedReader(new InputStreamReader(System.in));   }   solve();   pw.close();   br.close();  } catch (IOException e) {   System.err.println("IO Error");  }  }  private int[] nia(int n) throws IOException {  int arr[] = new int[n];  for (int i = 0; i < n; ++i)   arr[i] = Integer.parseInt(nextToken());  return arr;  }  private int[] niam1(int n) throws IOException {  int arr[] = new int[n];  for (int i = 0; i < n; ++i)   arr[i] = Integer.parseInt(nextToken()) - 1;  return arr;  }  private long[] nla(int n) throws IOException {  long arr[] = new long[n];  for (int i = 0; i < n; ++i)   arr[i] = Long.parseLong(nextToken());  return arr;  }  private void pr(Object o) {  pw.print(o);  }  private void prln(Object o) {  pw.println(o);  }  private void prln() {  pw.println();  }  int ni() throws IOException {  return Integer.parseInt(nextToken());  }  long nl() throws IOException {  return Long.parseLong(nextToken());  }  double nd() throws IOException {  return Double.parseDouble(nextToken());  }  private String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {   tokenizer = new StringTokenizer(br.readLine());  }   return tokenizer.nextToken();  }                                                            private BufferedReader br;  private StringTokenizer tokenizer;  private PrintWriter pw;  private final boolean isFileIO = false; }
5	public class ProblemOne {  public static void main(String [] args) {   Scanner scanner = new Scanner(System.in);   int problemCount = scanner.nextInt();   int petrCount = scanner.nextInt();   int vasCount = scanner.nextInt();   int [] problems = new int[problemCount];   for (int i = 0; i < problemCount; i++) {    problems[i] = scanner.nextInt();       }   Arrays.sort(problems);   System.out.println(-problems[vasCount - 1] + problems[vasCount]);  } }
0	@SuppressWarnings("unused") public class A { public static void main(String[] args) throws Exception {  Scanner in = new Scanner(System.in);  long n = in.nextLong();  System.out.println("0 0 " + n); } }
4	public class Main { static int n, m, k; static int[][] horW, verW; static int[][][] dp = new int[505][505][15];  public static void main(String[] args) throws IOException {  for (int i = 0; i < 505; i++) {  for (int j = 0; j < 505; j++) {   for (int k = 0; k < 15; k++) {   dp[i][j][k] = -1;   }  }  }  n = in.iscan(); m = in.iscan(); k =in.iscan();  horW = new int[n+1][m]; verW = new int[n][m+1];  for (int i = 1; i <= n; i++) {  for (int j = 1; j <= m-1; j++) {   horW[i][j] = in.iscan();  }  }  for (int i = 1; i <= n-1; i++) {  for (int j = 1; j <= m; j++) {   verW[i][j] = in.iscan();  }  }  int min = Integer.MAX_VALUE;  for (int i = 1; i <= n; i++) {  for (int j = 1; j <= m; j++) {   if (k % 2 == 1) {   out.print(-1 + " ");   continue;   }   out.print(dfs(i, j, k/2) * 2 + " ");  }  out.println();  }  out.close(); }   static int dfs(int r, int c, int k) {  if (dp[r][c][k] != -1) {  return dp[r][c][k];  }  if (k == 0) {  return dp[r][c][k] = 0;  }  int min = Integer.MAX_VALUE;  if (r - 1 >= 1) {  min = Math.min(min, verW[r-1][c] + dfs(r-1, c, k-1));  }  if (r + 1 <= n) {  min = Math.min(min, verW[r][c] + dfs(r+1, c, k-1));  }  if (c - 1 >= 1) {  min = Math.min(min, horW[r][c-1] + dfs(r, c-1, k-1));  }  if (c + 1 <= m) {  min = Math.min(min, horW[r][c] + dfs(r, c+1, k-1));  }  return dp[r][c][k] = min; }  static INPUT in = new INPUT(System.in); static PrintWriter out = new PrintWriter(System.out); private static class INPUT {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar, numChars;  public INPUT (InputStream stream) {  this.stream = stream;  }  public INPUT (String file) throws IOException {  this.stream = new FileInputStream (file);  }  public int cscan () throws IOException {  if (curChar >= numChars) {   curChar = 0;   numChars = stream.read (buf);  }    if (numChars == -1)   return numChars;   return buf[curChar++];  }  public int iscan () throws IOException {  int c = cscan (), sgn = 1;    while (space (c))   c = cscan ();   if (c == '-') {   sgn = -1;   c = cscan ();  }   int res = 0;   do {   res = (res << 1) + (res << 3);   res += c - '0';   c = cscan ();  }  while (!space (c));   return res * sgn;  }  public String sscan () throws IOException {  int c = cscan ();    while (space (c))   c = cscan ();   StringBuilder res = new StringBuilder ();   do {   res.appendCodePoint (c);   c = cscan ();  }  while (!space (c));   return res.toString ();  }  public double dscan () throws IOException {  int c = cscan (), sgn = 1;    while (space (c))   c = cscan ();   if (c == '-') {   sgn = -1;   c = cscan ();  }   double res = 0;   while (!space (c) && c != '.') {   if (c == 'e' || c == 'E')   return res * UTILITIES.fast_pow (10, iscan ());     res *= 10;   res += c - '0';   c = cscan ();  }   if (c == '.') {   c = cscan ();   double m = 1;   while (!space (c)) {   if (c == 'e' || c == 'E')    return res * UTILITIES.fast_pow (10, iscan ());    m /= 10;   res += (c - '0') * m;   c = cscan ();   }  }   return res * sgn;  }  public long lscan () throws IOException {  int c = cscan (), sgn = 1;    while (space (c))   c = cscan ();   if (c == '-') {   sgn = -1;   c = cscan ();  }   long res = 0;   do {   res = (res << 1) + (res << 3);   res += c - '0';   c = cscan ();  }  while (!space (c));   return res * sgn;  }  public boolean space (int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  } }  public static class UTILITIES {  static final double EPS = 10e-6;  public static int lower_bound (int[] arr, int x) {  int low = 0, high = arr.length, mid = -1;   while (low < high) {   mid = (low + high) / 2;   if (arr[mid] >= x)   high = mid;   else   low = mid + 1;  }   return low;  }  public static int upper_bound (int[] arr, int x) {  int low = 0, high = arr.length, mid = -1;   while (low < high) {   mid = (low + high) / 2;   if (arr[mid] > x)   high = mid;   else   low = mid + 1;  }   return low;  }  public static long gcd (long a, long b) {  return b == 0 ? a : gcd (b, a % b);  }  public static long lcm (long a, long b) {  return a * b / gcd (a, b);  }  public static long fast_pow_mod (long b, long x, int mod) {  if (x == 0) return 1;  if (x == 1) return b;  if (x % 2 == 0) return fast_pow_mod (b * b % mod, x / 2, mod) % mod;   return b * fast_pow_mod (b * b % mod, x / 2, mod) % mod;  }  public static int fast_pow (int b, int x) {  if (x == 0) return 1;  if (x == 1) return b;  if (x % 2 == 0) return fast_pow (b * b, x / 2);   return b * fast_pow (b * b, x / 2);  }  public static long choose (long n, long k) {  k = Math.min (k, n - k);  long val = 1;   for (int i = 0; i < k; ++i)   val = val * (n - i) / (i + 1);   return val;  }  public static long permute (int n, int k) {  if (n < k) return 0;  long val = 1;   for (int i = 0; i < k; ++i)   val = (val * (n - i));   return val;  } } }
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;  }  }
2	public class Main { static long MOD=1000000007; public static long pow(long x,long k){  long base=x%MOD;  long res=1;  while(k>0){  if((k&1)==1){   res=(res*base)%MOD;  }  base=(base*base)%MOD;  k>>=1;  }  return res; }  public static void main (String[] args) throws java.lang.Exception {  Scanner scan=new Scanner(System.in);  long x=scan.nextLong();  long k=scan.nextLong();  long MOD=1000000007;  if(x==0){System.out.println(0);return;}  x %= MOD;  long a=pow(2L,k+1);  long b=pow(2L,k);  long res=(a*x)%MOD-b+1;  if(res<0){res+=MOD;}  System.out.println(res%MOD); } }
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();  int a=NextInt();  int b=NextInt();  int ret=0;  readNextLine();  int [] p = new int[n];  for(int i=0; i<n; i++)  {  p[i]=NextInt();  }  Arrays.sort(p);  int id=0,cnt=0;  while(id<n&&cnt<b)  {  cnt++;  id++;  }  if(id<n)  {  ret=p[id]-p[id-1];  }   System.out.print(ret);   closeInput();  }  }
3	public class C {  InputStream in; PrintWriter out;  void solve()  {  int n=ni();  long dp[]=new long[n+1];   dp[0]=1;  for (int i=0;i<n;)  {  i++;  if (nc()=='f')  {     i++;   int k=1;   while (nc()!='s')   {   i++;k++;   }     for (int j=n-1;j>=0;j--)   {   dp[j]=add(dp[j],dp[j+1]);   }     for (int j=n;j>=k;j--)   {   dp[j]=dp[j-k];   }   for (int j=0;j<k;j++)   dp[j]=0;  }  else  {   for (int j=n-1;j>=0;j--)   {   dp[j]=add(dp[j],dp[j+1]);   }  }    }  long sum=0;  for (int i=0;i<=n;i++)  sum=add(sum,dp[i]);  out.println(sum); }  class LazyPropagation  {  long tree[];  long lazy[];  long A[];  public LazyPropagation(int n,long arr[])   {   tree=new long[4*n];   lazy=new long[4*n];   A=arr;   buildSum(1,1,n);  }    public LazyPropagation(int n)   {   tree=new long[4*n];   lazy=new long[4*n];  }    void buildSum(int node,int start,int end)  {   if (start==end)   {   tree[node]=A[start];   }   else   {   int mid=(start+end)>>1;   buildSum(node*2, start, mid);   buildSum(node*2+1, mid+1, end);   tree[node]=tree[node*2]+tree[2*node+1];   }  }    void updateRangeSum(int node, int start, int end,int l,int r,long val)  {   if (lazy[node]!=0)   {   tree[node]=add(tree[node],mul((end-start+1),lazy[node]));   if (start!=end)   {    lazy[2*node]=add(lazy[2*node],lazy[node]);    lazy[node*2+1]=add(lazy[2*node+1],lazy[node]);   }   lazy[node]=0;   }   if (start>end||start>r||end<l)   return;     if (start>=l&&end<=r)   {   tree[node]=add(tree[node],mul((end-start+1),val));   if (start!=end)   {    lazy[2*node]=add(lazy[2*node],val);    lazy[node*2+1]=add(lazy[2*node+1],val);   }   return;   }   int mid=(start+end)>>1;   updateRangeSum(node*2, start, mid, l, r, val);   updateRangeSum(node*2+1, mid+1, end, l, r, val);   tree[node]=add(tree[node*2],tree[node*2+1]);     }    long queryRangeSum(int node,int start,int end,int l,int r)  {   if (start>r||end<l||start>end)   return 0;   if (lazy[node]!=0)   {   tree[node]=add(tree[node],mul((end-start+1),lazy[node]));   if (start!=end)   {    lazy[2*node]=add(lazy[2*node],lazy[node]);    lazy[node*2+1]=add(lazy[2*node+1],lazy[node]);   }   lazy[node]=0;   }     if (start>=l&&end<=r)   return tree[node];     int mid=(start+end)>>1;   return add(queryRangeSum(node*2, start, mid, l, r),queryRangeSum(node*2+1, mid+1, end, l, r));  }  }  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;   }  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 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 = 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)); }  }
3	public class PythonIndentation { public static void main(String args[]) {  Scanner in = new Scanner(System.in) ;  int n = in.nextInt() ;  boolean[] lst = new boolean[n] ;  for(int i=0;i<n;i++)  {  lst[i] = (in.next().equals("s"))?false:true ;  }  System.out.println(dp(lst)) ; } static long dp(boolean[] lst) {  long[][] dp = new long[lst.length][lst.length] ;  dp[0][0] = 1 ;  for(int i=1;i<lst.length;i++)  {    for(int j=0;j<lst.length;j++)  {   if(lst[i-1])   {   if(j==0)    dp[i][j] = 0 ;   else    dp[i][j] = dp[i-1][j-1] ;   }     else   {   if(j==0)   {    for(int k=0;k<lst.length;k++)    dp[i][j] = (dp[i][j]+dp[i-1][k])%1000000007 ;   }   else    dp[i][j] = (dp[i][j-1]-dp[i-1][j-1])%1000000007 ;   }  }  }  long ans = 0 ;  for(int i=0;i<lst.length;i++)  {  ans = (ans + dp[lst.length-1][i])%1000000007 ;  }  if(ans<0)  ans = ans + 1000000007 ;  return ans ; } }
5	public class Main {  static Map<BigInteger, BigInteger> mp = new HashMap<BigInteger, BigInteger>();  public static void main(String[] args) {   mp.clear();   Scanner cin = new Scanner(new BufferedInputStream(System.in));   BigInteger n = cin.nextBigInteger();   BigInteger x = cin.nextBigInteger();   mp.put(x, BigInteger.ONE);   BigInteger sum = x;   BigInteger ans = BigInteger.ZERO;   for (int i = 2;i <= n.intValue(); i++) {    x=cin.nextBigInteger();    BigInteger tmp = x.multiply(BigInteger.valueOf(i-1)).subtract(sum);    if (mp.containsKey(x.subtract(BigInteger.ONE))) tmp = tmp.subtract(mp.get(x.subtract(BigInteger.ONE)));    if (mp.containsKey(x.add(BigInteger.ONE))) tmp = tmp.add(mp.get(x.add(BigInteger.ONE)));    ans = ans.add(tmp);    sum = sum.add(x);    BigInteger xx;    if (mp.containsKey(x)) xx = mp.get(x);    else xx = BigInteger.ZERO;    mp.put(x, xx.add(BigInteger.ONE));   }   System.out.println(ans);  } }
3	public class Main {  public static void main(String[] args) {   Scanner scan = new Scanner(System.in);   int n = scan.nextInt();   int[] nums = new int[n];   for(int i = 0; i < n; i++){    nums[i] = scan.nextInt();   }   Arrays.sort(nums);   boolean[] div = new boolean[n];   int count = 0;   for(int i = 0; i < n; i++) {    if (!div[i]) {     count++;     div[i] = true;     for(int j = i+1; j < n; j++) {      if (nums[j] % nums[i] == 0) {       div[j] = true;      }     }    }   }   System.out.println(count);  } }
4	public class MainF {  public static void main(String[]args) throws IOException{   BufferedReader br = new BufferedReader(new FileReader(new File("input.txt")));   BufferedWriter bw = new BufferedWriter(new FileWriter(new File("output.txt")));   String S = br.readLine();   String[]J = S.split(" ");   int N = Integer.parseInt(J[0]);   int M = Integer.parseInt(J[1]);   int K = Integer.parseInt(br.readLine());   int[]x = new int[K];   int[]y = new int[K];   S = br.readLine();   J = S.split(" ");     for(int i = 0; i<2*K; i = i + 2){    x[i/2] = Integer.parseInt(J[i]);    y[i/2] = Integer.parseInt(J[i+1]);   }     int ans = -1;   int ansX = -1;   int ansY = -1;     for (int i = 1; i<=N; i++){    for (int j = 1; j<=M; j++){     int W = M + N;     for (int k = 0; k<K; k++){      W = Math.min(W, Math.abs(i-x[k]) + Math.abs(j-y[k]));     }     if (W < ans)continue;     ans = W;     ansX = i;     ansY = j;        }   }   bw.write(Integer.toString(ansX)+" "+Integer.toString(ansY));   br.close();   bw.close();   } }
6	public class C {  static int n, m, a[][]; static int[][] memo; static Integer[] indices;  static int[] getCol(int col, int shift) {  int[] ans = new int[n];  for (int i = 0, j = shift; i < n; i++, j = (j + 1) % n) {  ans[i] = a[j][col];  }  return ans;  }  static int dp(int col, int msk) {  if (col == n||col==m)  return 0;  if (memo[msk][col] != -1)  return memo[msk][col];  int ans = 0;  for (int shift = 0; shift < n; shift++) {  int[] currCol = getCol(indices[col], shift);  for (int nxtMsk = 0; nxtMsk < 1 << n; nxtMsk++) {   if ((nxtMsk & msk) != msk)   continue;   int curr = 0;   int diff = msk ^ nxtMsk;   for (int i = 0; i < n; i++)   if ((diff & 1 << i) != 0)    curr += currCol[i];   ans = Math.max(ans, dp(col + 1, nxtMsk) + curr);  }  }  return memo[msk][col] = ans; }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out);  int tc = sc.nextInt();  while (tc-- > 0) {  n = sc.nextInt();  m = sc.nextInt();  indices = new Integer[m];   memo = new int[1 << n][m];  for (int[] x : memo)   Arrays.fill(x, -1);  a = new int[n][m];  int[] max = new int[m];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++) {   a[i][j] = sc.nextInt();   max[j] = Math.max(max[j], a[i][j]);   }  for (int j = 0; j < m; j++) {   indices[j] = j;  }  Arrays.sort(indices, Comparator.comparingInt(i -> -max[i]));  out.println(dp(0, 0));  }  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();  }  }  static void sort(int[] a) {  shuffle(a);  Arrays.sort(a); }  static void shuffle(int[] a) {  int n = a.length;  Random rand = new Random();  for (int i = 0; i < n; i++) {  int tmpIdx = rand.nextInt(n);  int tmp = a[i];  a[i] = a[tmpIdx];  a[tmpIdx] = tmp;  } } }
6	public class Test { static PrintWriter writer =  new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  static int readInt() {  int ans = 0;  boolean neg = false;  try {  boolean start = false;  for (int c = 0; (c = System.in.read()) != -1; ) {   if (c == '-') {   start = true;   neg = true;   continue;   } else if (c >= '0' && c <= '9') {   start = true;   ans = ans * 10 + c - '0';   } else if (start) break;  }  } catch (IOException e) {  }  return neg ? -ans : ans; }  static long readLong() {  long ans = 0;  boolean neg = false;  try {  boolean start = false;  for (int c = 0; (c = System.in.read()) != -1; ) {   if (c == '-') {   start = true;   neg = true;   continue;   } else if (c >= '0' && c <= '9') {   start = true;   ans = ans * 10 + c - '0';   } else if (start) break;  }  } catch (IOException e) {  }  return neg ? -ans : ans; }  static String readLine() {  StringBuilder b = new StringBuilder();  try {  boolean start = false;  for (int c = 0; (c = System.in.read()) != -1; ) {   if (Character.isLetterOrDigit(c)) {   start = true;   b.append((char) c);   } else if (start) break;  }  } catch (IOException e) {  }  return b.toString(); }  public static void main(String[] args) {  Test te = new Test();  te.start();  writer.flush(); }  void start() {  int t = readInt();  while (t-- > 0) {  int n = readInt(), m = readInt();  int[][] a = new int[n][m];  int[][] e = new int[n*m][];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++) {   a[i][j] = readInt();   e[i*m+j] = new int[]{a[i][j], j};   }  Arrays.sort(e, (x, y) -> x[0] == y[0] ? Integer.compare(x[1], y[1])   : Integer.compare(y[0], x[0]));  Set<Integer> cols = new HashSet<>();  for (int[] x : e) {   cols.add(x[1]);   if (cols.size() >= n) break;  }  int[] dp = new int[1<<n];  Arrays.fill(dp, -1);  dp[0] = 0;  for (int c : cols) {   for (int i = (1 << n) - 1; i >= 0; i--) {   int u = (1 << n) - 1 - i;   int p = u;   if (dp[i] >= 0)    while (p > 0) {    for (int r = 0; r < n; r++) {     int sum = 0;     for (int j = 0; j < n; j++) if (((p >> j) & 1) != 0) sum += a[(j + r) % n][c];     dp[i | p] = Math.max(dp[i | p], dp[i] + sum);     }    p = (p - 1) & u;    }   }  }  writer.println(dp[(1<<n) - 1]);  } } }
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");  }  } } }
3	public class Hack{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n=sc.nextInt(); int[] arr = new int[n]; for(int i=0;i<n;i++) arr[i]=sc.nextInt(); Arrays.sort(arr); Set<Integer> set = new TreeSet<Integer>(); for(int i=0;i<n;i++){ boolean flag=false; for(Integer x:set){ if(arr[i]%x==0){ flag=true; break; } } if(!flag) set.add(arr[i]); } System.out.println(set.size()); } }
3	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)));  int n = nextInt();  int[]dp1 = new int[n+1];  int[]dp2 = new int[n+1];  dp1[1] = 1;  int mod = (int) (1e9+7);  char[]instruction = new char[n+1];  instruction[0] = 's';  int[]sum = new int[n+1];  for (int i = 1; i <= n; i++) {  instruction[i] = next().charAt(0);  for (int j = 1; j <= i; j++) {   sum[j] = sum[j-1] + dp1[j];   if (sum[j] >= mod)   sum[j] -= mod;  }  for (int j = 1; j <= i; j++) {   if (instruction[i-1]=='f')   dp2[j] = dp1[j-1];   else {   dp2[j] = sum[i] - sum[j-1];   if (dp2[j] < 0)    dp2[j] += mod;   }  }  for (int j = 1; j <= i; j++) {   dp1[j] = dp2[j];  }  }  int ans = 0;  for (int i = 1; i <= n; i++) {  ans += dp1[i];  if (ans >= mod)   ans -= mod;  }  System.out.println(ans);  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(); } }
4	public class Main {  public static void main(String[] args) throws IOException {   Main m = new Main();   m.run();   m.out.close();  }  void run() throws IOException {   int n = nextInt();   int m = nextInt();   int k = nextInt();   long[][] r = new long[n][m - 1];   long[][] d = new long[n - 1][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m - 1; j++) {     r[i][j] = nextInt();    }   }   for (int i = 0; i < n - 1; i++) {    for (int j = 0; j < m; j++) {     d[i][j] = nextInt();    }   }   if (k % 2 != 0) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      out.print(-1+" ");     }     out.println();    }    return;   }   long[][][] dp = new long[n][m][k + 1];   for (int kk = 2; kk <= k; kk += 2)    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      long ans = (long) 1e18;      if (i + 1 < n) {       ans = Math.min(ans, dp[i + 1][j][kk - 2] + d[i][j]*2);      }      if (i - 1 > -1) ans = Math.min(ans, dp[i - 1][j][kk - 2] + d[i - 1][j]*2);      if (j + 1 < m) ans = Math.min(ans, dp[i][j + 1][kk - 2] + r[i][j]*2);      if (j - 1 > -1) ans = Math.min(ans, dp[i][j - 1][kk - 2] + r[i][j - 1]*2);      dp[i][j][kk] = ans;     }    }   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     out.print(dp[i][j][k] + " ");    }    out.println();   }  }   int gcd(int a, int b) {   while (a % b != 0) {    int h = a % b;    a = b;    b = h;   }   return b;  }  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  StringTokenizer in = new StringTokenizer("");    class pil implements Comparable<pil> {   int first;   long second;   pil(int f, long s) {    this.first = f;    this.second = s;   }   public int compareTo(pil o) {    if (first != o.first) return Integer.compare(first, o.first);    return Long.compare(second, o.second);   }  }  class pii implements Comparable<pii> {   int fi;   int se;   pii(int f, int s) {    se = s;    fi = f;   }   public int compareTo(pii o) {    if (fi != o.fi) return Integer.compare(fi, o.fi);    return Integer.compare(se, o.se);   }  }  class pis implements Comparable<pis> {   int fi;   String s;   pis(int f, String s) {    this.s = s;    fi = f;   }   public int compareTo(pis o) {    return Integer.compare(fi, o.fi);   }  }  class vert {   int to;   int iter;   int idx;   int ed;   vert(int s, int f, int zz, int gg) {    to = s;    iter = f;    idx = zz;    ed = gg;   }  }   class pll implements Comparable<pll> {   long first;   long second;   pll(long f, long s) {    this.first = f;    this.second = s;   }   public int compareTo(pll o) {    if (first != o.first) return Long.compare(first, o.first);    return Long.compare(second, o.second);   }  }  class pli implements Comparable<pli> {   long first;   int second;   pli(long f, int s) {    this.first = f;    this.second = s;   }   public int compareTo(pli o) {    if (first != o.first) return Long.compare(first, o.first);    return Integer.compare(second, o.second);   }  }  boolean hasNext() throws IOException {   if (in.hasMoreTokens()) return true;   String s;   while ((s = br.readLine()) != null) {    in = new StringTokenizer(s);    if (in.hasMoreTokens()) return true;   }   return false;  }  String nextToken() throws IOException {   while (!in.hasMoreTokens()) {    in = new StringTokenizer(br.readLine());   }   return in.nextToken();  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  } }
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);   TaskF solver = new TaskF();   solver.solve(1, in, out);   out.close();  }  static class TaskF {   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();    }    Map<Integer, List<Range>> rgs = new HashMap<Integer, List<Range>>();    for (int i = 0; i < n; i++) {     int s = 0;     for (int j = i; j < n; j++) {      s += a[j];      if (rgs.get(s) == null) {       rgs.put(s, new ArrayList<Range>());      }      rgs.get(s).add(new Range(i, j));     }    }    Iterator it = rgs.entrySet().iterator();    List<Range> ans = new ArrayList<Range>();    while (it.hasNext()) {     Map.Entry pair = (Map.Entry) it.next();     int sum = (int) pair.getKey();     Object[] intermediate = ((List<Object[]>) pair.getValue()).toArray();     Range[] ranges = new Range[intermediate.length];     for (int i = 0; i < intermediate.length; i++) {      ranges[i] = (Range) intermediate[i];     }     Arrays.sort(ranges);     List<Range> cand = new ArrayList<Range>();     for (Range r : ranges) {      if (cand.size() == 0) {       cand.add(r);       continue;      }      if (cand.get(cand.size() - 1).j < r.i) {       cand.add(r);      } else {       if (cand.get(cand.size() - 1).j > r.j) {        cand.remove(cand.size() - 1);        cand.add(r);       }      }     }     if (cand.size() > ans.size()) {      ans = cand;     }    }    out.println(ans.size());    for (Range r : ans) {     out.println((r.i + 1) + " " + (r.j + 1));    }   }   public class Range implements Comparable {    public int i;    public int j;    public Range(int i, int j) {     this.i = i;     this.j = j;    }    public int compareTo(Object o) {     Range t = (Range) o;     if (this.i == t.i) {      if (this.j < t.j) return 1;      else return 0;     }     if (this.i < t.i) return 1;     return 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 int nextInt() {    return Integer.parseInt(next());   }  } }
1	public class B {  public static void main(String[] args) {  Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(   System.in)));  int nc = sc.nextInt();  while (nc-- > 0) {  String s = sc.next();  StringTokenizer st = new StringTokenizer(s, "0123456789");  if (st.countTokens() > 1) {   int k = s.indexOf('C');   int r = Integer.parseInt(s.substring(1, k));   int c = Integer.parseInt(s.substring(k + 1));   int len = 1;   int p = 26;   while (c > p) {   c -= p;   len++;   p *= 26;   }   String col = Integer.toString(--c, 26).toUpperCase();   while (col.length() < len)   col = "0" + col;   StringBuilder sb = new StringBuilder();   for (int i = 0; i < col.length(); i++) {   if (col.charAt(i) < 'A') {    sb.append((char) (col.charAt(i) - '0' + 'A'));   } else {    sb.append((char) (col.charAt(i) + 10));   }   }   System.out.printf("%s%d\n", sb.toString(), r);  } else {   int k = 0;   while (s.charAt(k) > '9')   k++;   char[] col = s.substring(0, k).toCharArray();   int r = Integer.parseInt(s.substring(k));   int c = 1;   int p = 26;   int cnt = 1;   while (cnt++ < col.length) {   c += p;   p *= 26;   }   StringBuilder sb = new StringBuilder();   for (int i = 0; i < col.length; i++) {   if (s.charAt(i) < 'K') {    sb.append((char) ('0' + col[i] - 'A'));   } else {    sb.append((char) (col[i] - 10));   }   }   c += Integer.parseInt(sb.toString(), 26);   System.out.printf("R%dC%d\n", r, c);  }  }  System.out.close(); } }
5	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);  } } int N, T; void solve() throws IOException {  StringTokenizer st = tokens();  N = nextInt(st); T = nextInt(st);  T *= 2;  ArrayList<Pair> list = new ArrayList<Pair>();  for(int i = 0; i < N; i++)  {  st = tokens();  int c = nextInt(st), L = nextInt(st);  c *= 2; L *= 2;  list.add(new Pair(c - L / 2, c + L / 2));  }  Collections.sort(list);  HashSet<Integer> set = new HashSet<Integer>();  for(int i = 0; i < list.size(); i++)  {  if(i == 0 || list.get(i).x - list.get(i - 1).y >= T)  {   set.add(list.get(i).x - T / 2);  }  if(i == list.size() - 1 || list.get(i + 1).x - list.get(i).y >= T)  {   set.add(list.get(i).y + T / 2);  }  }  System.out.println(set.size()); } class Pair implements Comparable<Pair> {  int x, y;  public Pair(int x, int y)  {  this.x = x;  this.y = y;  }  public int compareTo(Pair p)  {  if(x != p.x) return x - p.x;  return y - p.y;  } }  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 F1141 {  private static class Interval {  public int l;  public int r;   public Interval(int l,int r) {  this.l = l;  this.r = r;  } }  public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String s = br.readLine();  int n = Integer.parseInt(s);  long[] a = new long[n];  String[] as = br.readLine().split(" ");  for(int i=0;i<n;i++) {  a[i] = Long.parseLong(as[i]);  }  StringBuffer sb = solve(a,n);  System.out.println(sb.toString()); }  private static StringBuffer solve(long[] a, int n) {  StringBuffer ret = new StringBuffer("");  Map<Long,List<Interval>> mp = new HashMap<Long,List<Interval>>();  long max = 0,maxId = -1;  for(int i=n-1;i>=0;i--) {  long s=0;  long prev = 1;  for(int j=i;j<n;j++) {   s+=a[j];   Interval inter = new Interval(i,j);    List<Interval> ints = mp.get(s);   if(ints==null) ints = new ArrayList<Interval>();   if(ints.size()==0 || ints.get(0).l>j) {    ints.add(0,inter);   }   if(ints.size()>max) {    max = ints.size();    maxId = s;   }   mp.put(s, ints);   if(j<n-1) prev = a[j+1]-a[j];  }  }  List<Interval> l = mp.get(maxId);  ret.append(l.size()+ "\n");  for(Interval inter : l) {  ret.append((inter.l+1) + " " + (inter.r+1) + "\n");  }  return ret; } }
5	public class A {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int t = in.nextInt() * 2;   Point[] A = new Point[n];   for (int i = 0; i < n; i++) {    int center = in.nextInt() * 2;    int side = in.nextInt();    A[i] = new Point(center - side, center + side);   }   Arrays.sort(A, new Comparator<Point>() {    public int compare(Point x, Point y) {     return x.x - y.x;    }   });   int ans = 2;   for (int i = 1; i < n; i++) {    if (A[i].x - A[i - 1].y > t)     ans += 2;    else if (A[i].x - A[i - 1].y == t)     ans++;   }   System.out.println(ans);  } }
4	public class P035C {  private class Pair {   private int x;   private int y;     private Pair(int x, int y) {    this.x = x;    this.y = y;   }     public int hashCode() {    return 37 * x + y;   }     public boolean equals(Object other) {    if (other instanceof Pair) {     Pair otherPair = (Pair)other;     return x == otherPair.x && y == otherPair.y;    }       return false;   }  }   private boolean[][] visited;  private final int N;  private final int M;  private final int k;  private ArrayList<Pair> fires = new ArrayList<Pair>();  private ArrayList<Pair> neighbors = new ArrayList<Pair>();   public P035C() throws IOException {   Scanner sc = new Scanner(new File("input.txt"));   N = sc.nextInt();   M = sc.nextInt();   visited = new boolean[N][M];   k = sc.nextInt();   for (int i = 0; i < k; i++) {    int x = sc.nextInt() - 1;    int y = sc.nextInt() - 1;    fires.add(new Pair(x, y));   }   bfs();  }   private void bfs() throws IOException{   java.util.Queue<Pair> queue = new ArrayDeque<Pair>();   for (Pair p : fires) {    queue.add(p);    visited[p.x][p.y] = true;   }     Pair last = fires.get(0);   while (!queue.isEmpty()) {    Pair p = last = queue.poll();       for (Pair pn : getNeighbors(p)) {     if (!visited[pn.x][pn.y]) {      queue.add(pn);      visited[pn.x][pn.y] = true;     }    }   }     PrintWriter output = new PrintWriter(new FileWriter(new File("output.txt")));   output.printf("%d %d\n", last.x + 1, last.y + 1);   output.close();  }   private Collection<Pair> getNeighbors(Pair p) {   neighbors.clear();   if (p.x > 0) neighbors.add(new Pair(p.x-1, p.y));   if (p.x < N-1) neighbors.add(new Pair(p.x+1, p.y));   if (p.y > 0) neighbors.add(new Pair(p.x, p.y-1));   if (p.y < M-1) neighbors.add(new Pair(p.x, p.y+1));     return neighbors;  }   public static void main(String[] args) throws IOException {   P035C solution = new P035C();  } }
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;    }   }  } }
4	@SuppressWarnings("unchecked") public class P35C {  final static int [] DX = {-1, 1, 0, 0}; final static int [] DY = { 0, 0, -1, 1};  public void run() throws Exception {  int m = nextInt();  int n = nextInt();  boolean [][] burned = new boolean [n][m];  List<Integer> burn = new ArrayList();  for (int k = nextInt(); k > 0; k--) {  int x = nextInt() - 1;  int y = nextInt() - 1;  burned[y][x] = true;  burn.add(x * 10000 + y);  }  int lastXY = 0;  List<Integer> newBurn = null;  do {  lastXY = burn.get(0);  newBurn = new ArrayList();   for (int xy : burn) {   int x = xy / 10000;   int y = xy % 10000;   for (int i = 0; i < 4; i++) {   int nx = x + DX[i];   int ny = y + DY[i];    if ((ny >= 0) && (ny < n) && (nx >= 0) && (nx < m) && (!burned[ny][nx])) {    burned[ny][nx] = true;    newBurn.add(nx * 10000 + ny);   }   }  }   burn = newBurn;  } while (newBurn.size() > 0);  println((lastXY / 10000 + 1) + " " + (lastXY % 10000 + 1)); }  public static void main(String... args) throws Exception {  br = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));  pw = new PrintWriter(new BufferedOutputStream(new FileOutputStream("output.txt")));  new P35C().run();  br.close();  pw.close();  System.err.println("\n[Time : " + (System.currentTimeMillis() - startTime) + " ms]"); }  static long startTime = System.currentTimeMillis(); static BufferedReader br; static PrintWriter pw; StringTokenizer stok;  String nextToken() throws IOException {  while (stok == null || !stok.hasMoreTokens()) {  String s = br.readLine();  if (s == null) { return null; }  stok = new StringTokenizer(s);  }  return stok.nextToken(); }  void print(byte b) { print("" + b); } void print(int i) { print("" + i); } void print(long l) { print("" + l); } void print(double d) { print("" + d); } void print(char c) { print("" + c); } void print(Object o) {  if (o instanceof int[]) { print(Arrays.toString((int [])o));  } else if (o instanceof long[]) { print(Arrays.toString((long [])o));  } else if (o instanceof char[]) { print(Arrays.toString((char [])o));  } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));  } else if (o instanceof short[]) { print(Arrays.toString((short [])o));  } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));  } else if (o instanceof float[]) { print(Arrays.toString((float [])o));  } else if (o instanceof double[]) { print(Arrays.toString((double [])o));  } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));  } else { print("" + o); } } void print(String s) { pw.print(s); } void println() { println(""); } void println(byte b) { println("" + b); } void println(int i) { println("" + i); } void println(long l) { println("" + l); } void println(double d) { println("" + d); } void println(char c) { println("" + c); } void println(Object o) { print(o); println(); } void println(String s) { pw.println(s); } int nextInt() throws IOException { return Integer.parseInt(nextToken()); } long nextLong() throws IOException { return Long.parseLong(nextToken()); } double nextDouble() throws IOException { return Double.parseDouble(nextToken()); } char nextChar() throws IOException { return (char) (br.read()); } String next() throws IOException { return nextToken(); } String nextLine() throws IOException { return br.readLine(); } int [] readInt(int size) throws IOException {  int [] array = new int [size];  for (int i = 0; i < size; i++) { array[i] = nextInt(); }  return array; } long [] readLong(int size) throws IOException {  long [] array = new long [size];  for (int i = 0; i < size; i++) { array[i] = nextLong(); }  return array; } double [] readDouble(int size) throws IOException {  double [] array = new double [size];  for (int i = 0; i < size; i++) { array[i] = nextDouble(); }  return array; } String [] readLines(int size) throws IOException {  String [] array = new String [size];  for (int i = 0; i < size; i++) { array[i] = nextLine(); }  return array; } }
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();    }   }  } }
2	public class Main { public static void main(String[] args) {  FastReader reader = new FastReader();  PrintWriter writer = new PrintWriter(System.out);  long n = reader.nextLong();  long k = reader.nextLong();  long s=0;  long e=n;  long ans = -1;  while (s<=e) {  long m = (s+e)/2;  long temp = ((n-m)*(n-m+1))/2 - m;   if (temp < k)   e = m-1;  else if (temp > k)   s = m+1;  else {   ans = m;   break;  }  }  writer.println(ans);  writer.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;  } } }
1	public class HamstersAndTigers { Scanner in; PrintWriter out;  HamstersAndTigers() {  in = new Scanner(System.in);  out = new PrintWriter(System.out); }  HamstersAndTigers(String i, String o) throws FileNotFoundException {  in = new Scanner(new File(i));  out = new PrintWriter(new File(o)); }  public void finalize() {  out.flush();  in.close();  out.close(); }  void solve() {  int i = 0,  h = 0,  n = in.nextInt();   String buf = "";  char[] ht = in.next().toCharArray();   for(i = 0; i < n; ++i)  if(ht[i] == 'H')   ++h;   for(i = 0; i < h; ++i)  buf += 'H';   for(i = 0; i < n - h; ++i)  buf += 'T';   int diff = (1 << 28);  for(i = 0; i < n; ++i)  {  int tmp = 0;    for(int j = 0; j < n; ++j)   if(buf.charAt(j) != ht[(i + j) % n])   ++tmp;    diff = Math.min(tmp, diff);  }   out.println(diff / 2); }  public static void main(String[] args) throws FileNotFoundException {  HamstersAndTigers t = new HamstersAndTigers();  t.solve();  t.finalize(); } }
0	public class Main {    public static void main(String[] args) {   Scanner scan = new Scanner(System.in);   int x = scan.nextInt();  solve(x);  }  public static void solve (int x){   int z = 0 ;   System.out.print(z+" ");   System.out.print(z+" ");   System.out.print(x);    } }
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 E {   public static void main(String[] args) throws IOException {  Scanner sc=new Scanner(System.in);  PrintWriter out=new PrintWriter(System.out);  int n=sc.nextInt(),k=sc.nextInt();  boolean [][]adj=new boolean[n][n];  for(int i=0;i<n;i++)  for(int j=0;j<n;j++)   adj[i][j]=sc.nextInt()==1;  int n1=n/2,n2=n-n1;  int []clique=new int [1<<n1];  for(int msk=1;msk<1<<n1;msk++)  {  boolean ok=true;  for(int i=0;i<n1;i++) if((msk & 1<<i) !=0)   for(int j=i+1;j<n1;j++)   if((msk & 1<<j) !=0 && !adj[i][j])    ok=false;  if(ok)   clique[msk]=Integer.bitCount(msk);  }   int []edges=new int [n2];  for(int i=0;i<n2;i++)  {  int msk=0;  for(int j=0;j<n1;j++)   if(adj[i+n1][j])   msk|=1<<j;  edges[i]=msk;  }  int max=0;  for(int msk=1;msk<1<<n1;msk++)  for(int i=0;i<n1;i++)   if((msk & 1<<i) !=0)   max=Math.max(max, clique[msk]=Math.max(clique[msk], clique[msk^(1<<i)]));   for(int msk=1;msk<1<<n2;msk++)  {  int all=(1<<n1)-1;  for(int j=0;j<n2;j++)   if((msk & 1<<j) !=0)   all &=edges[j];  boolean ok=true;  for(int i=0;i<n2;i++) if((msk & 1<<i) !=0)   for(int j=i+1;j<n2;j++)   if((msk & 1<<j) !=0 && !adj[i+n1][j+n1])    ok=false;  if(ok)   max=Math.max(max, Integer.bitCount(msk)+clique[all]);      }   out.printf("%.9f\n",k*1.0*k*(max-1)/(2*max));   out.close();    } static class Scanner {   StringTokenizer st;   BufferedReader br;    public Scanner(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }    public Scanner(FileReader s) {    br = new BufferedReader(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 boolean ready() throws IOException {return br.ready();}   public double nextDouble() throws IOException {return Double.parseDouble(next());}    } }
1	public class Main {  public static void main(String[] args) {   ConsoleIO io = new ConsoleIO();   new Main(io).solve();   io.close();  }  ConsoleIO io;  Main(ConsoleIO io) {   this.io = io;  }  ArrayList<ArrayList<Integer>> gr;  boolean[] visit;  class Edge {   public Edge(int u, int v, int c) {    this.u = u;    this.v = v;    this.c = c;   }   public int u;   public int v;   public int c;  }  long MOD = 1_000_000_007;  int N, M, K;  double[][] map;  public void solve() {   String s = io.readLine();   N = Integer.parseInt(s);   char[] a = io.readLine().toCharArray();   int[] look = new int[256];   Arrays.fill(look, 10000);   int k = 0;   for (int i = 0; i < a.length; i++) {    if (look[a[i]] == 10000) {     look[a[i]] = k;     k++;    }   }   int res = N;   long need = (1L << k) - 1;   long mask = 0;   int head = 0;   int tail = 0;   int[] c = new int[k];   while (head < a.length) {    while (head < a.length && mask != need) {     int v = look[a[head]];     if (c[v] == 0)      mask |= (1L << v);     c[v]++;     head++;    }    while (tail < head && mask == need) {     res = Math.min(res, head - tail);     int v = look[a[tail]];     c[v]--;     if (c[v] == 0)      mask ^= (1L << v);      tail++;    }   }   io.writeLine(res + "");  }   long gcd(long a, long b) {   if (a < b) return gcd(b, a);   if (b == 0) return a;   return gcd(b, a % b);  } } class ConsoleIO {  BufferedReader br;  PrintWriter out;  public ConsoleIO(){br = new BufferedReader(new InputStreamReader(System.in));out = new PrintWriter(System.out);}  public void flush(){this.out.flush();}  public void close(){this.out.close();}  public void writeLine(String s) {this.out.println(s);}  public void writeInt(int a) {this.out.print(a);this.out.print(' ');}  public void writeWord(String s){   this.out.print(s);  }  public int read(char[] buf, int len){try {return br.read(buf,0,len);}catch (Exception ex){ return -1; }}  public String readLine() {try {return br.readLine();}catch (Exception ex){ return "";}}  public long readLong() {   return Long.parseLong(this.readLine());  }  public long[] readLongArray() {   String[]n=this.readLine().trim().split("\\s+");long[]r=new long[n.length];   for(int i=0;i<n.length;i++)r[i]=Long.parseLong(n[i]);   return r;  }  public int[] readIntArray() {   String[]n=this.readLine().trim().split("\\s+");int[]r=new int[n.length];   for(int i=0;i<n.length;i++)r[i]=Integer.parseInt(n[i]);   return r;  }  public int[] readIntArray(int n) {   int[] res = new int[n];   char[] all = this.readLine().toCharArray();   int cur = 0;boolean have = false;   int k = 0;   boolean neg = false;   for(int i = 0;i<all.length;i++){    if(all[i]>='0' && all[i]<='9'){     cur = cur*10+all[i]-'0';     have = true;    }else if(all[i]=='-') {     neg = true;    }    else if(have){     res[k++] = neg?-cur:cur;     cur = 0;     have = false;     neg = false;    }   }   if(have)res[k++] = neg?-cur:cur;   return res;  }  public int readInt() {   try {    int r = 0;    boolean start = false;    boolean neg = false;    while (true) {     int c = br.read();     if (c >= '0' && c <= '9') {      r = r * 10 + c - '0';      start = true;     } else if (!start && c == '-') {      start = true;      neg = true;     } else if (start || c == -1) return neg ? -r : r;    }   } catch (Exception ex) {    return -1;   }  }  public void writeIntArray(int[] a) {   StringBuilder sb = new StringBuilder();   for (int i = 0; i < a.length; i++) {if (i > 0) sb.append(' ');sb.append(a[i]);}   this.writeLine(sb.toString());  } } class Pair {  public Pair(int a, int b) {this.a = a;this.b = b;}  public int a;  public int b; } class Tri {  public Tri(int a, int b, int c) {this.a = a;this.b = b;this.c = c;}  public int a;  public int b;  public int c; } class PairLL {  public PairLL(long a, long b) {this.a = a;this.b = b;}  public long a;  public long b; }
5	public class Main {  BufferedReader reader;  FastScanner sc;   void solve() throws Exception  {   int n = sc.nextInt();   int[] arr = new int[n];   for (int i = 0; i < n; i++)   {    arr[i] = sc.nextInt();   }   Arrays.sort(arr);   if (arr[n - 1] == 1)    arr[n - 1] = 2;   else    arr[n - 1] = 1;   Arrays.sort(arr);   for (int i = 0; i < n; i++)   {    System.out.print(arr[i] + " ");   }   System.out.println();  }    public static void main(String[] args) throws Exception  {   new Main().solve();  }   Main() throws Exception  {   if (System.getProperty("ONLINE_JUDGE") == null)   {          }     reader = new BufferedReader(new InputStreamReader(System.in));   sc = new FastScanner(reader);  } } class FastScanner {  BufferedReader reader;  StringTokenizer strTok;   public FastScanner(BufferedReader reader)  {   this.reader = reader;  }   public String nextToken() throws IOException  {   if (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());  }   public BigInteger nextBigInteger() throws IOException  {   return new BigInteger(nextToken());  }   public BigDecimal nextBigDecimal() throws IOException  {   return new BigDecimal(nextToken());  } }
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();    } }
1	public class Main { Scanner in; PrintWriter out; StreamTokenizer ST; BufferedReader br;  int nextInt() throws IOException {  ST.nextToken();  return (int) ST.nval; }  double nextDouble() throws IOException {  ST.nextToken();  return ST.nval; }  String next() throws IOException {  ST.nextToken();  return ST.sval; }  String nextLine() throws IOException {  return br.readLine(); }  void solve() throws IOException {  br.readLine();  char[]s = br.readLine().toCharArray();  int n = s.length;  int h=0;  for(int i=0;i<n;++i)if (s[i]=='H')++h;  int res=1000000;  for(int i=0;i<n;++i)  {  int t=0;  for(int j=0;j<h;++j)  {   if (s[(i+j)%n]=='T')++t;  }  res=Math.min(res,t);  }  out.println(res); }  public void run() throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));  ST = new StreamTokenizer(br);  in = new Scanner(br);  out = new PrintWriter(System.out);   solve();  in.close();  out.close();  br.close(); }  public static void main(String[] args) throws Exception {  new Main().run(); } }
5	public class C {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(in.readLine());   String[] S = in.readLine().split(" ");   int[] A = new int[n];   boolean allOnes = true;   for (int i = 0; i < n; i++) {    A[i] = Integer.parseInt(S[i]);    allOnes &= A[i] == 1;   }   Arrays.sort(A);   if (A[A.length - 1] > 1)    A[A.length - 1] = 1;   else    A[A.length - 1] = 2;   Arrays.sort(A);   for (int i = 0; i < A.length; i++)    System.out.print(A[i] + " ");   System.out.println();  } }
1	public class main {  public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);   br = new BufferedReader(new InputStreamReader(System.in));   PrintWriter pw = new PrintWriter(System.out);   int n = nextInt();   int d = nextInt();   int ans = 2;   int b[] = new int [n];   Arrays.sort(b);   for (int i = 0; i < n; i++) {    b[i] = nextInt();   }   for (int i = 1; i < n; i++) {    if (b[i] - b[i - 1] >= d * 2) {     ans++;    }    if (b[i] - b[i - 1] > d * 2) {     ans++;    }   }   pw.println(ans);   pw.close();  }  static BufferedReader br;  static StringTokenizer st = new StringTokenizer("");  public static int nextInt() throws IOException {   if (!st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return Integer.parseInt(st.nextToken());  }  public static String next() throws IOException {   if (!st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return st.nextToken();  }  public static double nextDouble() throws IOException {   if (!st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return Double.parseDouble(st.nextToken());  }  public static long nextLong() throws IOException {   if (!st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return Long.parseLong(st.nextToken());  } }
5	public class A {    public static void main(String[] args) {   HomeWorks hw = new HomeWorks();   hw.sol();   hw.print();  } } class HomeWorks {  HomeWorks(){   Scanner scr = new Scanner(System.in);     n = scr.nextInt();   a = scr.nextInt();   b = scr.nextInt();   h = new int[n];     for (int i = 0; i < n; i++){    h[i] = scr.nextInt();   }   scr.close();  }   void sol() {   Arrays.sort(h);   int Vasya = h[b-1];   int Petya = h[b];      ans = Petya - Vasya;   if (ans < 0){    ans = 0;   }    }   void print(){   PrintWriter pw = new PrintWriter(System.out);   pw.println(ans);   pw.flush();   pw.close();  }   int ans;   int[] h;   int n;  int a;  int b; }
0	public class Main {  static class Task {   int NN = 500005;  int MOD = 1000000007;  int INF = 2000000000;  long INFINITY = 2000000000000000000L;   public void solve(InputReader in, PrintWriter out) {  int t = in.nextInt();  while(t-->0) {   long n =in.nextLong();   long m = in.nextLong();   long x1 = in.nextLong();   long y1 = in.nextLong();   long x2 = in.nextLong();   long y2 = in.nextLong();   long x3 = in.nextLong();   long y3 = in.nextLong();   long x4 = in.nextLong();   long y4 = in.nextLong();   long w = white(1, 1, m, n);   long b = black(1, 1, m, n);   long whited = 0;   if(x3 > x2 || x4 < x1 || y3 > y2 || y4 < y1) {   whited = black(x1, y1, x2, y2);   } else {   whited = black(x1, y1, x2, y2);   long xm1 = Math.max(x1, x3);   long ym1 = Math.max(y1, y3);   long xm2 = Math.min(x2, x4);   long ym2 = Math.min(y2, y4);   whited -= black(xm1, ym1, xm2, ym2);   }   b -= whited;w += whited;   long blacked = white(x3, y3, x4, y4);   w-= blacked;b += blacked;   out.println(w + " " + b);  }  }   long black(long x1, long y1, long x2, long y2) {  long dx = (x2 - x1) + 1;  long dy = (y2 - y1) + 1;  if((x1+y1)%2!=0) {   return ((dy+1)/2)*((dx+1)/2)+(dy/2)*(dx/2);  }  return ((dy+1)/2)*((dx)/2)+(dy/2)*((dx+1)/2);  }   long white(long x1, long y1, long x2, long y2) {  long dx = (x2 - x1) + 1;  long dy = (y2 - y1) + 1;  if((x1+y1)%2==0) {   return ((dy+1)/2)*((dx+1)/2)+(dy/2)*(dx/2);  }  return ((dy+1)/2)*(dx/2)+(dy/2)*((dx+1)/2);  }   }  static void prepareIO(boolean isFileIO) {   Task solver = new Task();   if(!isFileIO) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   solver.solve(in, out);      out.close();  }    else {  String IPfilePath = System.getProperty("user.home") + "/Downloads/ip.in";   String OPfilePath = System.getProperty("user.home") + "/Downloads/op.out";   InputReader fin = new InputReader(IPfilePath);   PrintWriter fout = null;   try {   fout = new PrintWriter(new File(OPfilePath));  } catch (FileNotFoundException e) {   e.printStackTrace();  }   solver.solve(fin, fout);      fout.close();  } }  public static void main(String[] args) {   prepareIO(false); }  static class InputReader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public InputReader(InputStream stream) {    reader = new BufferedReader(new InputStreamReader(stream), 32768);    tokenizer = null;   }     public InputReader(String filePath) {   File file = new File(filePath);    try {   reader = new BufferedReader(new FileReader(file));  } catch (FileNotFoundException e) {     e.printStackTrace();  }    tokenizer = null;   }     public String nextLine() {   String str = "";   try {   str = reader.readLine();  } catch (IOException e) {     e.printStackTrace();  }   return str;   }     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());   }    } }
0	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputStreamReader in = new InputStreamReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); } } class TaskA {  StreamTokenizer in;  PrintWriter out;  BufferedReader re;  Scanner sc;  public void solve (int testNumber, InputStreamReader in, PrintWriter out) {    this.in = new StreamTokenizer(new BufferedReader(in));   this.re = new BufferedReader(in);   this.sc = new Scanner(in);   this.out = out;   try {      this.solve();     } catch (IOException e) {      e.printStackTrace();      }   out.flush();  }    void solve() throws IOException   {   long a=sc.nextLong(),b=sc.nextLong();    long ans=0,t;   while(Math.min(a,b)!=1){    if(a>b){     ans+=a/b;     a%=b;     }    else{     t=b;     b=a;     a=t;     long g=gcd(a,b);     a/=g;b/=g;    }    }    ans+=Math.max(a,b);    out.println(ans);   }  public static long gcd(long a, long b) {   long c = 0;   if(a<0) a=-a;   if(b<0) b=-b;   while (b>0) {   c = a % b;   a = b;   b = c;   }   return a;  }     }
6	public class Main{  public static void main(String args[]){   Scanner sc=new Scanner(System.in);   int n=sc.nextInt();   int m=sc.nextInt();   int x,y;   boolean graph[][]=new boolean[n][n];   for(int i=0;i<m;i++){    x=sc.nextInt()-1;    y=sc.nextInt()-1;    graph[x][y]=graph[y][x]=true;   }   long dp[][]=new long[1<<n][n];   long res=0;   for(int i=0;i<n;i++){    dp[1<<i][i]=1;   }   for(int mask=1;mask<(1<<n);mask++){    int first=-1;    for(int f=0;f<n;f++){     if((mask&(1<<f))!=0){      first=f;      break;     }    }    for(int i=0;i<n;i++){     if((mask&(1<<i))!=0&&i!=first){      for(int j=0;j<n;j++){       if(graph[j][i]&&((mask&1<<j)!=0)){        dp[mask][i]+=dp[mask^1<<i][j];       }      }     }     if(Integer.bitCount(mask)>2&&graph[first][i]){      res+=dp[mask][i];     }    }   }     System.out.println(res/2);  }  }
5	public class Main {  static int N;  static int[] U, V;  static int[] A;  public static void main(String[] args) {   FastScanner sc = new FastScanner(System.in);   N = sc.nextInt();   U = new int[N-1];   V = new int[N-1];   for (int i = 0; i < N - 1; i++) {    U[i] = sc.nextInt()-1;    V[i] = sc.nextInt()-1;   }   A = sc.nextIntArray(N, -1);   System.out.println(solve() ? "Yes" : "No");  }  static boolean solve() {   if( A[0] != 0 ) return false;   int[][] G = adjB(N, U, V);   Map<Integer, Integer> parents = new HashMap<>();   for (Node node : orderFromRoot(N, G, 0)) {    parents.put(node.a, node.parent);   }   ArrayDeque<Integer> q = new ArrayDeque<>();   for (int next : G[0]) {    q.add(0);   }   int idx = 1;   while(!q.isEmpty()) {    int p = q.poll();    int a = A[idx++];    if( parents.get(a) != p ) {     return false;    }    for (int next : G[a]) {     if( next == p ) continue;     q.add(a);    }   }   return true;  }  static int[][] adjB(int n, int[] from, int[] to) {   int[][] adj = new int[n][];   int[] cnt = new int[n];   for (int f : from) {    cnt[f]++;   }   for (int t : to) {    cnt[t]++;   }   for (int i = 0; i < n; i++) {    adj[i] = new int[cnt[i]];   }   for (int i = 0; i < from.length; i++) {    adj[from[i]][--cnt[from[i]]] = to[i];    adj[to[i]][--cnt[to[i]]] = from[i];   }   return adj;  }  static Node[] orderFromRoot(int N, int[][] G, int root) {   ArrayDeque<Node> q = new ArrayDeque<>();   Node[] ret = new Node[N];   int idx = 0;   q.add(new Node(-1, root));   while(!q.isEmpty()) {    Node n = q.poll();    ret[idx++] = n;    for (int next : G[n.a]) {     if( next == n.parent ) continue;     q.add(new Node(n.a, next));    }   }   return ret;  }  static class Node {   int parent, a;   public Node(int parent, int a) {    this.parent = parent;    this.a = a;   }  }  @SuppressWarnings("unused")  static class FastScanner {   private BufferedReader reader;   private StringTokenizer tokenizer;   FastScanner(InputStream in) {    reader = new BufferedReader(new InputStreamReader(in));    tokenizer = null;   }   String next() {    if (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }   String nextLine() {    if (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      return reader.readLine();     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken("\n");   }   long nextLong() {    return Long.parseLong(next());   }   int nextInt() {    return Integer.parseInt(next());   }   int[] nextIntArray(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }   int[] nextIntArray(int n, int delta) {    int[] a = new int[n];    for (int i = 0; i < n; i++)     a[i] = nextInt() + delta;    return a;   }   long[] nextLongArray(int n) {    long[] a = new long[n];    for (int i = 0; i < n; i++)     a[i] = nextLong();    return a;   }  }  static <A> void writeLines(A[] as, Function<A, String> f) {   PrintWriter pw = new PrintWriter(System.out);   for (A a : as) {    pw.println(f.apply(a));   }   pw.flush();  }  static void writeLines(int[] as) {   PrintWriter pw = new PrintWriter(System.out);   for (int a : as) pw.println(a);   pw.flush();  }  static void writeLines(long[] as) {   PrintWriter pw = new PrintWriter(System.out);   for (long a : as) pw.println(a);   pw.flush();  }  static int max(int... as) {   int max = Integer.MIN_VALUE;   for (int a : as) max = Math.max(a, max);   return max;  }  static int min(int... as) {   int min = Integer.MAX_VALUE;   for (int a : as) min = Math.min(a, min);   return min;  }  static void debug(Object... args) {   StringJoiner j = new StringJoiner(" ");   for (Object arg : args) {    if (arg instanceof int[]) j.add(Arrays.toString((int[]) arg));    else if (arg instanceof long[]) j.add(Arrays.toString((long[]) arg));    else if (arg instanceof double[]) j.add(Arrays.toString((double[]) arg));    else if (arg instanceof Object[]) j.add(Arrays.toString((Object[]) arg));    else j.add(arg.toString());   }   System.err.println(j.toString());  } }
4	public class A23 {  static int solve(String s) {   for(int i = s.length(); i > 0; --i) {    for(int start = 0; start < s.length() - i; ++start) {     String str = s.substring(start, start + i);     int firstIndex = s.indexOf(str);     int lastIndex = s.lastIndexOf(str);     if(firstIndex != lastIndex)      return i;    }   }   return 0;  }  public static String[] EX = new String[] { "abcd", "ababa", "zzz", "qwertyuiopasdfghjklzxcvbnmqwepriuwpoep"};  public static int[] EX_A = new int[] { 0, 3, 2, 3};   public static void main(String[] args) throws IOException {   if(true) {    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));    String s = br.readLine();    System.out.println(solve(s));   }   else {    for(int i = 0; i < EX.length; ++i) {     int result = solve(EX[i]);     System.out.println(i + ": " + result + " " + (result == EX_A[i]? "ja" : "NEJ"));    }   }  } }
4	public class Main {  public static void main(String[] args) {   InputStream inputStream;   try {    inputStream = new FileInputStream("input.txt");   } catch (IOException e) {    throw new RuntimeException(e);   }   OutputStream outputStream;   try {    outputStream = new FileOutputStream("output.txt");   } catch (IOException e) {    throw new RuntimeException(e);   }   FastReader in = new FastReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   FireAgain solver = new FireAgain();   solver.solve(1, in, out);   out.close();  }  static class FireAgain {   public void solve(int testNumber, FastReader in, PrintWriter out) {    int n = in.nextInt();    int m = in.nextInt();    int k = in.nextInt();    int INF = 10000000;    int[][] g = new int[n][m];    for (int[] temp : g) Arrays.fill(temp, -1);    ArrayDeque<IntPair> q = new ArrayDeque<>();    for (int i = 0; i < k; i++) {     int x = in.nextInt() - 1;     int y = in.nextInt() - 1;     g[x][y] = 0;     q.add(new IntPair(x, y));    }    while (!q.isEmpty()) {     IntPair cur = q.poll();     int x = cur.getFirst();     int y = cur.getSecond();     for (int i = -1; i <= 1; i++) {      for (int j = -1; j <= 1; j++) {       if (i == 0 && j == 0 || Math.abs(i) + Math.abs(j) != 1) continue;       int xx = x + i;       int yy = y + j;       if (xx < 0 || xx >= n || yy < 0 || yy >= m) continue;       if (g[xx][yy] != -1) continue;       g[xx][yy] = g[x][y] + 1;       q.add(new IntPair(xx, yy));      }     }    }    int ans = 0, x = -1, y = -1;    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      if (g[i][j] >= ans) {       ans = g[i][j];       x = i + 1;       y = j + 1;      }     }    }    out.println(x + " " + y);   }  }  static class IntPair implements Comparable<IntPair> {   int first;   int second;   public IntPair(int first, int second) {    this.first = first;    this.second = second;   }    public int compareTo(IntPair a) {    if (second == a.second) {     return Integer.compare(first, a.first);    }    return Integer.compare(second, a.second);   }    public String toString() {    return "<" + first + ", " + second + ">";   }    public boolean equals(Object o) {    if (this == o) return true;    if (o == null || getClass() != o.getClass()) return false;    IntPair a = (IntPair) o;    if (first != a.first) return false;    return second == a.second;   }    public int hashCode() {    int result = first;    result = 31 * result + second;    return result;   }   public int getFirst() {    return first;   }   public int getSecond() {    return second;   }  }  static class FastReader {   BufferedReader reader;   StringTokenizer st;   public FastReader(InputStream stream) {    reader = new BufferedReader(new InputStreamReader(stream));    st = null;   }   public String next() {    while (st == null || !st.hasMoreTokens()) {     try {      String line = reader.readLine();      if (line == null) {       return null;      }      st = new StringTokenizer(line);     } catch (Exception e) {      throw new RuntimeException();     }    }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }  } }
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());   }  } }
3	public class icpc {  public static void main(String[] args) throws IOException  {   Reader in = new Reader();   int n = in.nextInt();   boolean[] A = new boolean[n];   int count = 0;   int[] B = new int[n];   for (int i=0;i<n;i++)    B[i] = in.nextInt();   Arrays.sort(B);   for (int i=0;i<n;i++)   {    if (!A[i])    {     int gcd = B[i];     for (int j=0;j<n;j++)     {      if(!A[j])      {       gcd = gcd(B[j], gcd);       if(gcd == B[i])       {        A[j] = true;       }       else       {        gcd = B[i];       }      }     }     count++;     A[i] = true;    }   }   System.out.println(count);  }  public static int gcd(int a, int b)  {   if (b == 0)    return a;   return gcd(b, a % b);  } } class DSU {  int[] parent;  int[] size;   DSU(int n)  {   this.parent = new int[n];   this.size = new int[n];   Arrays.fill(parent, -1);  }  public void makeSet(int v)  {   parent[v] = v;   size[v] = 1;  }  public int findSet(int v)  {   if (v == parent[v]) return v;   return parent[v] = findSet(parent[v]);  }  public void unionSets(int a, int b)  {   a = findSet(a);   b = findSet(b);   if (a != b)   {    if (size[a] < size[b])    {     int temp = a;     a = b;     b = temp;    }    parent[b] = a;    size[a] += size[b];   }  } } class FastFourierTransform {  private void fft(double[] a, double[] b, boolean invert)  {   int count = a.length;   for (int i = 1, j = 0; i < count; i++)   {    int bit = count >> 1;    for (; j >= bit; bit >>= 1)     j -= bit;    j += bit;    if (i < j)    {     double temp = a[i];     a[i] = a[j];     a[j] = temp;     temp = b[i];     b[i] = b[j];     b[j] = temp;    }   }   for (int len = 2; len <= count; len <<= 1)   {    int halfLen = len >> 1;    double angle = 2 * Math.PI / len;    if (invert)     angle = -angle;    double wLenA = Math.cos(angle);    double wLenB = Math.sin(angle);    for (int i = 0; i < count; i += len)    {     double wA = 1;     double wB = 0;     for (int j = 0; j < halfLen; j++)     {      double uA = a[i + j];      double uB = b[i + j];      double vA = a[i + j + halfLen] * wA - b[i + j + halfLen] * wB;      double vB = a[i + j + halfLen] * wB + b[i + j + halfLen] * wA;      a[i + j] = uA + vA;      b[i + j] = uB + vB;      a[i + j + halfLen] = uA - vA;      b[i + j + halfLen] = uB - vB;      double nextWA = wA * wLenA - wB * wLenB;      wB = wA * wLenB + wB * wLenA;      wA = nextWA;     }    }   }   if (invert)   {    for (int i = 0; i < count; i++)    {     a[i] /= count;     b[i] /= count;    }   }  }  public long[] multiply(long[] a, long[] b)  {   int resultSize = Integer.highestOneBit(Math.max(a.length, b.length) - 1) << 2;   resultSize = Math.max(resultSize, 1);   double[] aReal = new double[resultSize];   double[] aImaginary = new double[resultSize];   double[] bReal = new double[resultSize];   double[] bImaginary = new double[resultSize];   for (int i = 0; i < a.length; i++)    aReal[i] = a[i];   for (int i = 0; i < b.length; i++)    bReal[i] = b[i];   fft(aReal, aImaginary, false);   fft(bReal, bImaginary, false);   for (int i = 0; i < resultSize; i++)   {    double real = aReal[i] * bReal[i] - aImaginary[i] * bImaginary[i];    aImaginary[i] = aImaginary[i] * bReal[i] + bImaginary[i] * aReal[i];    aReal[i] = real;   }   fft(aReal, aImaginary, true);   long[] result = new long[resultSize];   for (int i = 0; i < resultSize; i++)    result[i] = Math.round(aReal[i]);   return result;  } } class NumberTheory {  public boolean isPrime(long n)  {   if(n < 2)    return false;   for(long x = 2;x * x <= n;x++)   {    if(n % x == 0)     return false;   }   return true;  }  public ArrayList<Long> primeFactorisation(long n)  {   ArrayList<Long> f = new ArrayList<>();   for(long x=2;x * x <= n;x++)   {    while(n % x == 0)    {     f.add(x);     n /= x;    }   }   if(n > 1)    f.add(n);   return f;  }  public int[] sieveOfEratosthenes(int n)  {     int[] sieve = new int[n + 1];   for(int x=2;x * x <= n;x++)   {    if(sieve[x] != 0)     continue;    for(int u=x*x;u<=n;u+=x)    {     if(sieve[u] == 0)     {      sieve[u] = x;     }    }   }   return sieve;  }  public long gcd(long a, long b)  {   if(b == 0)    return a;   return gcd(b, a % b);  }  public long phi(long n)  {   double result = n;   for(long p=2;p*p<=n;p++)   {    if(n % p == 0)    {     while (n % p == 0)      n /= p;     result *= (1.0 - (1.0 / (double)p));    }   }   if(n > 1)    result *= (1.0 - (1.0 / (double)n));   return (long)result;  }  public Name extendedEuclid(long a, long b)  {   if(b == 0)    return new Name(a, 1, 0);   Name n1 = extendedEuclid(b, a % b);   Name n2 = new Name(n1.d, n1.y, n1.x - (long)Math.floor((double)a / b) * n1.y);   return n2;  }  public long modularExponentiation(long a, long b, long n)  {   long d = 1L;   String bString = Long.toBinaryString(b);   for(int i=0;i<bString.length();i++)   {    d = (d * d) % n;    if(bString.charAt(i) == '1')     d = (d * a) % n;   }   return d;  } } class Name {  long d;  long x;  long y;  public Name(long d, long x, long y)  {   this.d = d;   this.x = x;   this.y = y;  } } class SuffixArray {  int ALPHABET_SZ = 256, N;  int[] T, lcp, sa, sa2, rank, tmp, c;  public SuffixArray(String str)  {   this(toIntArray(str));  }  private static int[] toIntArray(String s)  {   int[] text = new int[s.length()];   for (int i = 0; i < s.length(); i++) text[i] = s.charAt(i);   return text;  }  public SuffixArray(int[] text)  {   T = text;   N = text.length;   sa = new int[N];   sa2 = new int[N];   rank = new int[N];   c = new int[Math.max(ALPHABET_SZ, N)];   construct();   kasai();  }  private void construct()  {   int i, p, r;   for (i = 0; i < N; ++i) c[rank[i] = T[i]]++;   for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];   for (i = N - 1; i >= 0; --i) sa[--c[T[i]]] = i;   for (p = 1; p < N; p <<= 1)   {    for (r = 0, i = N - p; i < N; ++i) sa2[r++] = i;    for (i = 0; i < N; ++i) if (sa[i] >= p) sa2[r++] = sa[i] - p;    Arrays.fill(c, 0, ALPHABET_SZ, 0);    for (i = 0; i < N; ++i) c[rank[i]]++;    for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];    for (i = N - 1; i >= 0; --i) sa[--c[rank[sa2[i]]]] = sa2[i];    for (sa2[sa[0]] = r = 0, i = 1; i < N; ++i)    {     if (!(rank[sa[i - 1]] == rank[sa[i]]       && sa[i - 1] + p < N       && sa[i] + p < N       && rank[sa[i - 1] + p] == rank[sa[i] + p])) r++;     sa2[sa[i]] = r;    }    tmp = rank;    rank = sa2;    sa2 = tmp;    if (r == N - 1) break;    ALPHABET_SZ = r + 1;   }  }  private void kasai()  {   lcp = new int[N];   int[] inv = new int[N];   for (int i = 0; i < N; i++) inv[sa[i]] = i;   for (int i = 0, len = 0; i < N; i++)   {    if (inv[i] > 0)    {     int k = sa[inv[i] - 1];     while ((i + len < N) && (k + len < N) && T[i + len] == T[k + len]) len++;     lcp[inv[i] - 1] = len;     if (len > 0) len--;    }   }  } } class ZAlgorithm {  public int[] calculateZ(char input[])  {   int Z[] = new int[input.length];   int left = 0;   int right = 0;   for(int k = 1; k < input.length; k++) {    if(k > right) {     left = right = k;     while(right < input.length && input[right] == input[right - left]) {      right++;     }     Z[k] = right - left;     right--;    } else {         int k1 = k - left;         if(Z[k1] < right - k + 1) {      Z[k] = Z[k1];     } else {      left = k;      while(right < input.length && input[right] == input[right - left]) {       right++;      }      Z[k] = right - left;      right--;     }    }   }   return Z;  }  public ArrayList<Integer> matchPattern(char text[], char pattern[])  {   char newString[] = new char[text.length + pattern.length + 1];   int i = 0;   for(char ch : pattern) {    newString[i] = ch;    i++;   }   newString[i] = '$';   i++;   for(char ch : text) {    newString[i] = ch;    i++;   }   ArrayList<Integer> result = new ArrayList<>();   int Z[] = calculateZ(newString);   for(i = 0; i < Z.length ; i++) {    if(Z[i] == pattern.length) {     result.add(i - pattern.length - 1);    }   }   return result;  } } class KMPAlgorithm {  public int[] computeTemporalArray(char[] pattern)  {   int[] lps = new int[pattern.length];   int index = 0;   for(int i=1;i<pattern.length;)   {    if(pattern[i] == pattern[index])    {     lps[i] = index + 1;     index++;     i++;    }    else    {     if(index != 0)     {      index = lps[index - 1];     }     else     {      lps[i] = 0;      i++;     }    }   }   return lps;  }  public ArrayList<Integer> KMPMatcher(char[] text, char[] pattern)  {   int[] lps = computeTemporalArray(pattern);   int j = 0;   int i = 0;   int n = text.length;   int m = pattern.length;   ArrayList<Integer> indices = new ArrayList<>();   while(i < n)   {    if(pattern[j] == text[i])    {     i++;     j++;    }    if(j == m)    {     indices.add(i - j);     j = lps[j - 1];    }    else if(i < n && pattern[j] != text[i])    {     if(j != 0)      j = lps[j - 1];     else      i = i + 1;    }   }   return indices;  } } class Hashing {  public long[] computePowers(long p, int n, long m)  {   long[] powers = new long[n];   powers[0] = 1;   for(int i=1;i<n;i++)   {    powers[i] = (powers[i - 1] * p) % m;   }   return powers;  }  public long computeHash(String s)  {   long p = 31;   long m = 1_000_000_009;   long hashValue = 0L;   long[] powers = computePowers(p, s.length(), m);   for(int i=0;i<s.length();i++)   {    char ch = s.charAt(i);    hashValue = (hashValue + (ch - 'a' + 1) * powers[i]) % m;   }   return hashValue;  } } class BasicFunctions {  public long min(long[] A)  {   long min = Long.MAX_VALUE;   for(int i=0;i<A.length;i++)   {    min = Math.min(min, A[i]);   }   return min;  }  public long max(long[] A)  {   long max = Long.MAX_VALUE;   for(int i=0;i<A.length;i++)   {    max = Math.max(max, A[i]);   }   return max;  } } class MergeSortInt {      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++;   }  }     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);   }  } } class MergeSortLong {      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++;   }  }     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);   }  } } class Node {  String s;  Node(String s)  {   this.s = s;  }  @Override  public boolean equals(Object ob)  {   if(ob == null)    return false;   if(!(ob instanceof Node))    return false;   if(ob == this)    return true;   Node obj = (Node)ob;   if(this.s.equals(obj.s))    return true;   return false;  }  @Override  public int hashCode()  {   return (int)this.s.length();  } } 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();  } } class FenwickTree {  public void update(long[] fenwickTree,long delta,int index)  {   index += 1;   while(index < fenwickTree.length)   {    fenwickTree[index] += delta;    index = index + (index & (-index));   }  }  public long prefixSum(long[] fenwickTree,int index)  {   long sum = 0L;   index += 1;   while(index > 0)   {    sum += fenwickTree[index];    index -= (index & (-index));   }   return sum;  } } class SegmentTree {  public int nextPowerOfTwo(int num)  {   if(num == 0)    return 1;   if(num > 0 && (num & (num - 1)) == 0)    return num;   while((num &(num - 1)) > 0)   {    num = num & (num - 1);   }   return num << 1;  }  public int[] createSegmentTree(int[] input)  {   int np2 = nextPowerOfTwo(input.length);   int[] segmentTree = new int[np2 * 2 - 1];   for(int i=0;i<segmentTree.length;i++)    segmentTree[i] = Integer.MIN_VALUE;   constructSegmentTree(segmentTree,input,0,input.length-1,0);   return segmentTree;  }  private void constructSegmentTree(int[] segmentTree,int[] input,int low,int high,int pos)  {   if(low == high)   {    segmentTree[pos] = input[low];    return;   }   int mid = (low + high)/ 2;   constructSegmentTree(segmentTree,input,low,mid,2*pos + 1);   constructSegmentTree(segmentTree,input,mid+1,high,2*pos + 2);   segmentTree[pos] = Math.max(segmentTree[2*pos + 1],segmentTree[2*pos + 2]);  }  public int rangeMinimumQuery(int []segmentTree,int qlow,int qhigh,int len)  {   return rangeMinimumQuery(segmentTree,0,len-1,qlow,qhigh,0);  }  private int rangeMinimumQuery(int segmentTree[],int low,int high,int qlow,int qhigh,int pos)  {   if(qlow <= low && qhigh >= high){    return segmentTree[pos];   }   if(qlow > high || qhigh < low){    return Integer.MIN_VALUE;   }   int mid = (low+high)/2;   return Math.max(rangeMinimumQuery(segmentTree, low, mid, qlow, qhigh, 2 * pos + 1),     rangeMinimumQuery(segmentTree, mid + 1, high, qlow, qhigh, 2 * pos + 2));  } } class Trie {  private class TrieNode  {   Map<Character, TrieNode> children;   boolean endOfWord;   public TrieNode()   {    children = new HashMap<>();    endOfWord = false;   }  }  private final TrieNode root;  public Trie()  {   root = new TrieNode();  }  public void insert(String word)  {   TrieNode current = root;   for (int i = 0; i < word.length(); i++)   {    char ch = word.charAt(i);    TrieNode node = current.children.get(ch);    if (node == null)    {     node = new TrieNode();     current.children.put(ch, node);    }    current = node;   }   current.endOfWord = true;  }  public boolean search(String word)  {   TrieNode current = root;   for (int i = 0; i < word.length(); i++)   {    char ch = word.charAt(i);    TrieNode node = current.children.get(ch);    if (node == null)    {     return false;    }    current = node;   }   return current.endOfWord;  }  public void delete(String word)  {   delete(root, word, 0);  }  private boolean delete(TrieNode current, String word, int index)  {   if (index == word.length())   {    if (!current.endOfWord)    {     return false;    }    current.endOfWord = false;    return current.children.size() == 0;   }   char ch = word.charAt(index);   TrieNode node = current.children.get(ch);   if (node == null)   {    return false;   }   boolean shouldDeleteCurrentNode = delete(node, word, index + 1);   if (shouldDeleteCurrentNode)   {    current.children.remove(ch);    return current.children.size() == 0;   }   return false;  } } class SegmentTreeLazy {  public int nextPowerOfTwo(int num)  {   if(num == 0)    return 1;   if(num > 0 && (num & (num - 1)) == 0)    return num;   while((num &(num - 1)) > 0)   {    num = num & (num - 1);   }   return num << 1;  }  public int[] createSegmentTree(int input[])  {   int nextPowOfTwo = nextPowerOfTwo(input.length);   int segmentTree[] = new int[nextPowOfTwo*2 -1];   for(int i=0; i < segmentTree.length; i++){    segmentTree[i] = Integer.MAX_VALUE;   }   constructMinSegmentTree(segmentTree, input, 0, input.length - 1, 0);   return segmentTree;  }  private void constructMinSegmentTree(int segmentTree[], int input[], int low, int high,int pos)  {   if(low == high)   {    segmentTree[pos] = input[low];    return;   }   int mid = (low + high)/2;   constructMinSegmentTree(segmentTree, input, low, mid, 2 * pos + 1);   constructMinSegmentTree(segmentTree, input, mid + 1, high, 2 * pos + 2);   segmentTree[pos] = Math.min(segmentTree[2*pos+1], segmentTree[2*pos+2]);  }  public void updateSegmentTreeRangeLazy(int input[], int segmentTree[], int lazy[], int startRange, int endRange, int delta)  {   updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, 0, input.length - 1, 0);  }  private void updateSegmentTreeRangeLazy(int segmentTree[], int lazy[], int startRange, int endRange, int delta, int low, int high, int pos)  {   if(low > high)   {    return;   }   if (lazy[pos] != 0)   {    segmentTree[pos] += lazy[pos];    if (low != high)    {     lazy[2 * pos + 1] += lazy[pos];     lazy[2 * pos + 2] += lazy[pos];    }    lazy[pos] = 0;   }   if(startRange > high || endRange < low)   {    return;   }   if(startRange <= low && endRange >= high)   {    segmentTree[pos] += delta;    if(low != high) {     lazy[2*pos + 1] += delta;     lazy[2*pos + 2] += delta;    }    return;   }   int mid = (low + high)/2;   updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, low, mid, 2*pos+1);   updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, mid+1, high, 2*pos+2);   segmentTree[pos] = Math.min(segmentTree[2*pos + 1], segmentTree[2*pos + 2]);  }  public int rangeMinimumQueryLazy(int segmentTree[], int lazy[], int qlow, int qhigh, int len)  {   return rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, 0, len - 1, 0);  }  private int rangeMinimumQueryLazy(int segmentTree[], int lazy[], int qlow, int qhigh, int low, int high, int pos)  {   if(low > high)   {    return Integer.MAX_VALUE;   }   if (lazy[pos] != 0)   {    segmentTree[pos] += lazy[pos];    if (low != high)    {     lazy[2 * pos + 1] += lazy[pos];     lazy[2 * pos + 2] += lazy[pos];    }    lazy[pos] = 0;   }   if(qlow > high || qhigh < low)   {    return Integer.MAX_VALUE;   }   if(qlow <= low && qhigh >= high)   {    return segmentTree[pos];   }   int mid = (low+high)/2;   return Math.min(rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, low, mid, 2 * pos + 1), rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, mid + 1, high, 2 * pos + 2));  } }
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; } }
1	public class SonyaExhibition { static BufferedReader br; static StringTokenizer tokenizer;  public static void main(String[] args) throws Exception {  br = new BufferedReader(new InputStreamReader(System.in));  int n = nextInt();  int[] arr = {0,1};  for(int i = 0; i < n; i++) {  System.out.print(arr[i % 2]);  }  System.out.println(); }  public static String next() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  String line = br.readLine();  if (line == null)   throw new IOException();  tokenizer = new StringTokenizer(line);  }  return tokenizer.nextToken(); }  public static int nextInt() throws IOException {  return Integer.parseInt(next()); } }
2	public class Main{   public long power(long x, long y, long p)  {   long res = 1;       while (y > 0)   {    if((y & 1)==1)     res = (res * x) % p;    y = y >> 1;    x = (x * x) % p;   }   return res;  }  public static void main(String[] args) throws IOException{     Scanner sc=new Scanner(System.in);   Main mm=new Main();   long x=sc.nextLong();    long k=sc.nextLong();    if(x==0) {     System.out.println(0);    }    else {    long temp=mm.power(2, k, 1000000007);    long temp1=(2*x-1)%(1000000007);    long temp3=(temp1*temp)%(1000000007);    System.out.println((temp3+1)%1000000007);    }  } }  class trienode{  trienode[] next=new trienode[26];  int count;  char value;  boolean last;  trienode() {   this.value='0';   this.count=0;  }  trienode(char x) {   this.value=x;   this.count=1;  }  } class trie{  trienode root=new trienode();  public void insert(String s) {   trienode temp=root;   int length=s.length();   for(int i=0;i<length;i++) {    char c=s.charAt(i);    int index=c-'a';    if(temp.next[index]==null) {     temp.next[index]=new trienode(c);    }    else {     temp.next[index].count++;    }    if(i==length-1) {     temp.next[index].last=true;    }    temp=temp.next[index];    }   }  public String find(String s) {   trienode temp=root;   String ans="";   int pos=0;   char c=s.charAt(pos);   int index=c-'a';   while(temp.next[index]!=null) {    temp=temp.next[index];    ans+=temp.value;    if(pos==s.length()-1) {     break;    }    c=s.charAt(++pos);    index=c-'a';      }   while(temp.last!=true) {    int position=-1;    for(int i=0;i<26;i++) {    if(temp.next[i]!=null) {     ans+=temp.next[i].value;     position=i+0;     break;    }       }    temp=temp.next[position];   }   return ans;  } } class node{  int index;  int a;  int b;  node(int index,int a,int b){   this.a=a;   this.b=b;this.index=index;    } } class comp implements Comparator<node>{  public int compare(node n1,node n2) {   if(n1.b>n2.b) {    return 1;   }   else if(n1.b<n2.b) {    return -1;   }   else {    return 0;   }  } } class cc implements Comparator<node>{  public int compare(node n1,node n2) {   if(n1.index>n2.index) {    return 1;   }   else if(n1.index<n2.index) {    return -1;   }   else {    return 0;   }  } }     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() );  } }
4	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() {    String s = in.readString();  Set<String> m = new HashSet<String>();  int ans = 0;  for (int i = 0; i < s.length(); i++) {  for (int j = i + 1; j <= s.length(); j++) {   if (m.contains(s.substring(i, j)))   ans = Math.max(ans, j - i);   else   m.add(s.substring(i, j));  }  }  out.print(ans);  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;  } } }
1	public class CodehorsesTShirt {  public static void main(String args[]) throws IOException {   FastReader in = new FastReader();   OutputStream outputStream = System.out;   PrintWriter out = new PrintWriter(outputStream);   Task.solve(in, out);   out.close();  }  static class Task {   public static void solve(FastReader in, PrintWriter out) {    int n = in.nextInt();    HashMap<String , Integer> hm1 = new HashMap<>();    HashMap<String , Integer> hm2 = new HashMap<>();    for(int i=0;i<n;i++){     String val = in.next();     if(hm1.containsKey(val)){      hm1.put(val, hm1.get(val)+1);     }else{      hm1.put(val,1);     }    }    for(int i=0;i<n;i++){     String val = in.next();     if(hm1.containsKey(val)){      int x = hm1.get(val);      if(x==1){       hm1.remove(val);      }else{       hm1.put(val,hm1.get(val)-1);      }     }else{      if(hm2.containsKey(val)){       hm2.put(val, hm2.get(val)+1);      }else{       hm2.put(val,1);      }     }    }    int ans = 0;    for(Map.Entry<String , Integer> row: hm1.entrySet()){     ans += row.getValue();    }    System.out.println(ans);   }  }  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;   }  } }
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 [] input = new int[n];  int total = 0;  for (int i = 0; i < n; ++i){  input[i] = in.nextInt();  total +=input[i];  }  Arrays.sort(input);  int res = 0;  int now = 0;  for (int i = n - 1; i >= 0; --i){  now += input[i];  int left = total - now;  ++res;  if (now > left){   break;  }  }  out.println(res);  return; } }
5	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();    TaskD.Pair[] p = new TaskD.Pair[n];    for (int i = 0; i < n; ++i) {     p[i] = new TaskD.Pair(in.nextLong(), in.nextLong());    }    Arrays.sort(p);    int last = 0;    int ans = 1;    for (int i = 1; i < n; ++i) {     if (p[i].x - p[i].w >= p[last].x + p[last].w) {      last = i;      ++ans;     }    }    out.println(ans);   }   static class Pair implements Comparable<TaskD.Pair> {    long x;    long w;    public Pair(long x, long w) {     this.x = x;     this.w = w;    }    public int compareTo(TaskD.Pair o) {     return Long.compare(x + w, o.x + o.w);    }    public String toString() {     return x + " " + w;    }   }  }  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 long nextLong() {    int c = pread();    while (isSpaceChar(c))     c = pread();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = pread();    }    long res = 0;    do {     if (c < '0' || c > '9') {      throw new InputMismatchException();     }     res *= 10;     res += c - '0';     c = pread();    } while (!isSpaceChar(c));    return res * sgn;   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
4	public class A {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   String s = in.readLine();   for (int i = s.length() - 1; i > 0; i--)    for (int j = 0; j <= s.length() - i; j++)     if (s.substring(0, j + i - 1).contains(s.substring(j, j + i))       || s.substring(j + 1).contains(s.substring(j, j + i))) {      System.out.println(i);      return;     }   System.out.println(0);  } }
3	public class Main{ class Node implements Comparable<Node>{  int l;  int r;  public Node(int l,int r){   this.l=l;   this.r=r;  }  public int compareTo(Node c){   int t=Integer.compare(this.r,c.r);   if(t!=0) return t;   t=Integer.compare(this.l,c.l);   return t;  } }  void solve() {   int n=ni();   int a[]=new int[n+1];   long pref[]=new long[n+1];   for(int i=1;i<=n;i++){    a[i]=ni();    pref[i]=pref[i-1]+a[i];   }   PriorityQueue<Long> q=new PriorityQueue<>();   for(int i=1;i<=n;i++){    for(int j=i;j<=n;j++) q.offer(pref[j]-pref[i-1]);   }   int sz=1;   while(!q.isEmpty()){    long val=q.poll();    if(!mp.containsKey(val)){     mp.put(val,sz++);    }   }   vec=new Node[sz][];   int size[]=new int[sz];   for(int i=1;i<=n;i++){    for(int j=i;j<=n;j++) size[mp.get(pref[j]-pref[i-1])]++;   }   for(int i=1;i<sz;i++) vec[i]=new Node[size[i]];   for(int i=1;i<=n;i++){    for(int j=i;j<=n;j++) {     int idx=mp.get(pref[j]-pref[i-1]);     vec[idx][--size[idx]]=new Node(i,j);    }   }   for(int i=1;i<sz;i++) Arrays.sort(vec[i]);   for(int i=1;i<sz;i++){    solve(vec[i]);   }   pw.println(ans.size());   for(Node p : ans) pw.println(p.l+" "+p.r);   }  HashMap<Long,Integer> mp=new HashMap<>();  Node vec[][];  int cnt=0;  ArrayList<Node> ans=new ArrayList<>();  void solve(Node [] v){   int n=v.length;   if(n==0) return;   int dp[]=new int[n+1];   int prev[]=new int[n+1];   int mx[]=new int[n+1];   int mxid[]=new int[n+1];   for(int i=1;i<=n;i++){    Node p=v[i-1];    dp[i]=dp[i-1];    prev[i]=-1;    int l=1,r=i-1;    int idx=0;    while(l<=r){     int mid=(l+r)>>1;     if(v[mid-1].r<p.l){      idx=mid;      l=mid+1;     }else r=mid-1;    }    if(1+mx[idx]>dp[i]){     dp[i]=1+mx[idx];     prev[i]=mxid[idx];    }    mx[i]=mx[i-1];    mxid[i]=mxid[i-1];    if(dp[i]>mx[i]){     mx[i]=dp[i];     mxid[i]=i;    }    }   if (dp[n] > cnt){    cnt=dp[n];    ans.clear();    int id=n;    while(id>0){     if(dp[id]==dp[id-1]){      id--;      continue;     }     ans.add(new Node(v[id-1].l,v[id-1].r));     id=prev[id];    }   }  }  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 Main().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 (INPUT.length() > 0) System.out.println(Arrays.deepToString(o));  } }
1	public class B implements Runnable { public static void main(String[] args) {  new Thread(new B()).start(); }  StringTokenizer st; PrintWriter out; BufferedReader br; boolean eof = false, in_out = false, std = false;  String nextToken() {  while (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(br.readLine());  } catch (Exception e) {   eof = true;   return "0";  }  }  return st.nextToken(); }  String nextLine() {  String ret = "";  try {  ret = br.readLine();  } catch (Exception e) {  ret = "";  }  if (ret == null) {  eof = true;  return "$";  }  return ret; }  String nextString() {  return nextToken(); }  int nextInt() {  return Integer.parseInt(nextToken()); }  long nextLong() {  return Long.parseLong(nextToken()); }  double nextDouble() {  return Double.parseDouble(nextToken()); }  BigInteger nextBigInteger() {  return new BigInteger(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(111);  }   }  void solve() {  int n = nextInt();  for (int i = 0; i < n; i++) {  solve2();  } }  void solve2() {  String s = nextToken();  boolean wasNum = false, isFirst = false;  for (int i = 0; i < s.length(); i++) {  if (s.charAt(i) >= '0' && s.charAt(i) <= '9') {   wasNum = true;  } else if (wasNum) {   isFirst = true;   break;  }  }  if (isFirst) {  StringTokenizer e = new StringTokenizer(s, "RC");  int y = Integer.parseInt(e.nextToken());  int x = Integer.parseInt(e.nextToken()) - 1;  go1(x, y);  } else {  go2(s);  } }  void go1(int x, int y) {  long cur = 26;  int len = 1;  while (x >= cur) {  x -= cur;  cur *= 26;  len++;  }  StringBuilder sb = new StringBuilder();  for (int i = 0; i < len; i++) {  sb.append((char) ('A' + x % 26));  x /= 26;  }  out.println(sb.reverse().toString() + y); }  void go2(String s) {  int id = -1;  for (int i = 0; i < s.length(); i++) {  if (s.charAt(i) <= '9' && s.charAt(i) >= '0') {   id = i;   break;  }  }  String s1 = s.substring(0, id);  String s2 = s.substring(id);  int x = 0;  int cur = 26;  for (int i = 1; i < s1.length(); i++) {  x += cur;  cur *= 26;  }  int d = 0;  for (int i = 0; i < s1.length(); i++) {  d *= 26;  d += s1.charAt(i) - 'A';  }  x += d;  out.println("R" + s2 + "C" + (x + 1)); } }
3	public class Main extends PrintWriter {  static BufferedReader s = new BufferedReader(new InputStreamReader(System.in));   Main () { super(System.out); }  public static void main(String[] args) throws IOException{   Main d1=new Main ();d1.main();d1.flush();  }  void main() throws IOException {   BufferedReader s = new BufferedReader(new InputStreamReader(System.in));   StringBuffer sb = new StringBuffer();   StringBuffer sb1 = new StringBuffer();   PrintWriter out = new PrintWriter(System.out);   int t=1;   while(t-->0) {       String[] s1 = s();    int n = i(s1[0]);    long[] a=new long[n];    arr(a,n);    HashMap<Long,Integer>[] dp=new HashMap[n];     long[] presum=new long[n];    for(int i=0;i<n;i++){     if(i==0){      presum[i]=a[i];     }else{      presum[i]=a[i]+presum[i-1];     }    }HashMap<Long,TreeMap<Integer,Long> > tm=new HashMap<>();int ans=0;long maxsum=0;    for(int i=0;i<n;i++){     dp[i]=new HashMap<>();     for(int j=-1;j<i;j++){      long sum=0;      if(j==-1) sum=presum[i];else sum=presum[i]-presum[j];       if(tm.containsKey(sum)&&tm.get(sum).floorKey(j)!=null){       dp[i].put(sum,Math.max(dp[i].getOrDefault(sum,0),dp[tm.get(sum).floorKey(j)].getOrDefault(sum,0)+1));       if(dp[i].get(sum)>ans){        maxsum=sum;       }       ans=Math.max(ans,dp[i].get(sum));      }else if(dp[i].containsKey(sum)==false){       if(dp[i].getOrDefault(sum,0)<1) dp[i].put(sum,1);       if(dp[i].get(sum)>ans){        maxsum=sum;       }       ans=Math.max(ans,1);      }      long val=dp[i].getOrDefault(sum,0);        if(!tm.containsKey(sum)||tm.get(sum).floorKey(i-1)==null||dp[tm.get(sum).floorKey(i-1)].getOrDefault(sum,0)<val) {         TreeMap<Integer, Long> tt = new TreeMap<>();        tt.put(i, val);        tm.put(sum, tt);       }       }    }int cnt=0;int last=-1;    for(int i=0;i<n;i++){     for(int j=i-1;j>=-1;j--){      long sum=0;      if(j==-1) sum=presum[i];      else sum=presum[i]-presum[j];      if(dp[i].getOrDefault(maxsum,0)>cnt&&maxsum==sum){       sb.append(j+2+" "+(i+1)+"\n");cnt++;       break;      }     }    } System.out.println(ans);    System.out.println(sb);   }  }   long[] st;  void buildtree(int i,int s,int e,long[] a){   if(s==e){    st[i]=a[s];    return;   }   int mid=(s+e)/2;   buildtree(2*i,s,mid,a);   buildtree(2*i+1,mid+1,e,a);   st[i]=Math.min(st[2*i],st[2*(i)+1]);  }  long query(int i,int s,int e,int qs,int qe){   if(qs>e||qe<s) return Integer.MIN_VALUE;   if(s>=qs&&e<=qe) return st[i];   int mid=(s+e)/2;   long l=query(2*i,s,mid,qs,qe);   long r=query(2*i+1,mid+1,e,qs,qe);   return Math.max(l,r);  }  void pointupdate(int i,int s,int e,int qi,long [] a){   if(s==e){    st[i]=a[s];return;   }   int mid=(s+e)/2;   if(qi<=mid) pointupdate(2*i,s,mid,qi,a);   else pointupdate(2*(i)+1,mid+1,e,qi,a);   st[i]=Math.max(st[2*i],st[2*i+1]);  }  public void arr(long[] a,int n) throws IOException{     String[] s2=s();   for(int i=0;i<n;i++){    a[i]=i(s2[i]);   }  }  public void sort(int[] a,int l,int h){   if(l==h) return;   int mid=(l+h)/2;   sort(a,l,mid);   sort(a,mid+1,h);   merge(a,l,(l+h)/2,h);  }  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 long gcd(long a, long b) {   if (b == 0)    return a;   return gcd(b, a % b);  }  static String[] s() throws IOException {   return s.readLine().trim().split("\\s+");  }  static int i(String ss) {   return Integer.parseInt(ss);  }  static long l(String ss) {   return Long.parseLong(ss);  } } class Student {  long a;int b;int c;  public Student(int a,int b) {   this.a=a;this.c=c;this.b=b;  } } class Pair {  int a,b,c;  public Pair(int a,int b){   this.a=a;this.b=b;this.c=c;} } class Sortbyroll implements Comparator<Student> {  public int compare(Student a, Student b){   if(a.b==b.b) return (int)b.a-(int)a.a;   return a.b-b.b;} }
3	public class Solution1{  static class Node{  int start,end;  Node(int start, int end){  this.start=start;  this.end=end;  }  public String toString(){  return start+" "+end;  } }  public static void sameSumBlock(int a[],int n){  HashMap<Long,ArrayList<Node>> map=new HashMap<>();  long sum;  for(int i=0;i<n;i++){  sum=0;  for(int j=i;j<n;j++){   sum+=a[j];   if(!map.containsKey(sum))   map.put(sum,new ArrayList<>());   map.get(sum).add( new Node(i+1, j+1) );  }  }       int max=0; LinkedList<Node> list=new LinkedList<>();  for(Map.Entry<Long,ArrayList<Node>> pair: map.entrySet()){   ArrayList<Node> arr=pair.getValue();  Collections.sort(arr, (Node x, Node y)->{ return x.end-y.end; });   int count=0,end=0;  LinkedList<Node> temp=new LinkedList<>();  for(Node item: arr){   if(end<item.start){   end=item.end;   count+=1;   temp.add(new Node(item.start, item.end));   }  }   if(count>max){   max=count;   list=temp;  }  }  System.out.println(max);  for(Node item: list)  System.out.println(item.start+" "+item.end); }  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();  sameSumBlock(a,n); } }
6	public class E2 { InputStream is; PrintWriter out; String INPUT = "";   void solve() {  int n = ni(), K = ni();  long[] g = new long[n];  for(int i = 0;i < n;i++){  for(int j = 0;j < n;j++){   g[i] |= nl()<<j;  }  g[i] |= 1L<<i;  }      int mc = solveMaximumClique(g);  out.printf("%.14f\n", (double)K*K*(mc-1)/2/mc); }  public static int solveMaximumClique(long[] g) {  int n = g.length;  int h = n/2;  int[] dp = new int[1<<n-h];  for(int i = 0;i < 1<<h;i++){  long cover = (1L<<n)-1;  for(int j = 0;j < h;j++){   if(i<<~j<0)cover &= g[j];  }  if((cover&i) == i){   dp[(int)(cover>>>h)] = Math.max(dp[(int)(cover>>>h)], Integer.bitCount(i));  }  }  for(int i = 0;i < n-h;i++){  for(int j = 0;j < 1<<n-h;j++){   if(j<<~i>=0){   dp[j] = Math.max(dp[j], dp[j|1<<i]);   }  }  }   int ret = 0;  for(int i = 0;i < 1<<n-h;i++){  long cover = (1L<<n)-1;  for(int j = 0;j < n-h;j++){   if(i<<~j<0)cover &= g[j+h];  }  if((cover&(long)i<<h) == (long)i<<h){   ret = Math.max(ret, Integer.bitCount(i) + dp[i]);  }  }  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 E2().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)); } }
6	public class codeforces {  public static long cnt = 0;  public static void f(int g1, int g2, int g3, int last) {   if (g1 == 0 && g2 == 0 && g3 == 0) cnt++;   if (g1 > 0 && last != 1) f(g1 - 1, g2, g3, 1);   if (g2 > 0 && last != 2) f(g1, g2 - 1, g3, 2);   if (g3 > 0 && last != 3) f(g1, g2, g3 - 1, 3);  }  public static void main(String[] args) throws IOException {   BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(scan.readLine());   int n = Integer.parseInt(st.nextToken());   int t = Integer.parseInt(st.nextToken());   int T[] = new int[n];   int G[] = new int[n];   for (int i = 0; i < n; i++) {    st = new StringTokenizer(scan.readLine());    T[i] = Integer.parseInt(st.nextToken());    G[i] = Integer.parseInt(st.nextToken());   }   long ans = 0;   for (int mask = 1; mask < (1 << n); mask++) {    int sum = 0;    int g1 = 0;    int g2 = 0;    int g3 = 0;    for (int i = 0; i < n; i++) {     if (((1 << i) & mask) > 0) {      sum += T[i];      if (G[i] == 1) g1++;      if (G[i] == 2) g2++;      if (G[i] == 3) g3++;     }    }    cnt = 0;    if (sum == t) f(g1, g2, g3, -1);    for (long i = 1; i <= g1; i++) cnt *= i;    for (long i = 1; i <= g2; i++) cnt *= i;    for (long i = 1; i <= g3; i++) cnt *= i;    ans += cnt;   }   System.out.println(ans % 1000000007);  } }
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");  } }
1	public class Main {   public static void main(String[] args) {   Scanner cin = new Scanner(System.in);  int n;  n = cin.nextInt();  String s = cin.next();  int ans = n;  int cntH = 0,cntT = 0;  for(int i=0;i<n;i++)  {  if(s.charAt(i)=='H')cntH++;  }  cntT = n - cntH;  for(int i=0;i+cntH<n;i++)  {  int tmp = 0;  for(int j=i;j<i+cntH;j++)   if(s.charAt(j)=='T')tmp++;  if(ans>tmp)ans = tmp;  }  for(int i=0;i+cntT<n;i++)  {  int tmp = 0;  for(int j=i;j<i+cntT;j++)   if(s.charAt(j)=='H')tmp++;  if(ans>tmp)ans = tmp;  }  System.out.println(ans); } }
3	public class Main {  static Scanner console; public static void main(String[] args) {  console = new Scanner(System.in);  int n = console.nextInt();  List<Integer> arr= new ArrayList<>();   for(int i = 0; i < n; i++) arr.add( console.nextInt());  Collections.sort(arr);  List<Integer> groups = new ArrayList<>();  for(int i = 0; i < arr.size() - 1; i++) {  int j = i+1;  groups.add(arr.get(i));   while(j < arr.size()) {   if(arr.get(j) % arr.get(i) == 0) {   arr.remove(j);      }   else {    j++;   }  }  }  System.out.println(arr.size()); } }
6	public class Solution{  public static long mod = 1000000007;  public static void main(String[] args)throws IOException{   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(System.out);   StringTokenizer st = new StringTokenizer(br.readLine());   int n = Integer.parseInt(st.nextToken());   int t = Integer.parseInt(st.nextToken());   int[] d = new int[n];   int[] g = new int[n];   for(int i=0;i<n;i++){    st = new StringTokenizer(br.readLine());    d[i] = Integer.parseInt(st.nextToken());    g[i] = Integer.parseInt(st.nextToken())-1;   }   long[][] dp = new long[(1<<n)][3];   for(int i=0;i<n;i++){    dp[(1<<i)][g[i]] = 1;   }   long res = 0;   for(int i=1;i<(1<<n);i++){    int k = i;    int sum = 0;    for(int j=n-1;j>=0;j--){     if(k>=(1<<j)){      k-=(1<<j);      sum += d[j];     }     else{      for(int r=0;r<3;r++) if(r!=g[j]) dp[i+(1<<j)][g[j]] += dp[i][r];      dp[i+(1<<j)][g[j]] %= mod;     }    }    if(sum==t){     res += dp[i][0] +dp[i][1] +dp[i][2];     res %= mod;    }   }   out.println(res);   out.flush();  } }
1	public class ProblemA {  public static void main(String[] args) throws Exception{  BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  PrintWriter writer = new PrintWriter(System.out);  int n = Integer.parseInt(reader.readLine());  String [] split = reader.readLine().split("\\s+");  int value;  int [] count = new int[2];  int [] pos = new int[2];  for(int i = 0; i < split.length; i++){  value = Integer.parseInt(split[i]);  count[value % 2] ++;  pos[value % 2] = i + 1;  }  writer.println((count[0] == 1) ? pos[0] : pos[1]);  writer.flush();  writer.close(); } }
2	public class Main{ public static void main(String[]args){  Scanner cin=new Scanner(System.in);  long z=cin.nextLong()-1<<1,n=cin.nextInt(),l=-1,r=1+n,m;  while(l<(m=l+r>>1)) if(z>(m+n-1)*(n-m)) r=m;else l=m;  if(0<l) l=n-l;  System.out.print(l); } }
5	public class test {  public static void main(String[] args) {  new test().run(); }  PrintWriter out = null;  void run() {  Scanner in = new Scanner(System.in);  out = new PrintWriter(System.out);  int n = in.nextInt();  int a = in.nextInt();  int b = in.nextInt();  int[] h = new int[n];  for (int i = 0; i < n; i++)  h[i] = in.nextInt();  Arrays.sort(h);  if (h[b] == h[b - 1])  out.println(0);  else  out.println(h[b] - h[b - 1]);  out.close(); } }
3	public class x1141F  {  public static void main(String omkar[]) throws Exception  {   BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));    StringTokenizer st = new StringTokenizer(infile.readLine());   int N = Integer.parseInt(st.nextToken());   int[] arr = new int[N];   st = new StringTokenizer(infile.readLine());   for(int i=0; i < N; i++)    arr[i] = Integer.parseInt(st.nextToken());      HashMap<Long, ArrayList<Range>> map = new HashMap<Long, ArrayList<Range>>();   for(int r=0; r < N; r++)   {    long sum = 0L;    for(int i=r; i >= 0; i--)    {     sum += arr[i];     if(!map.containsKey(sum))     map.put(sum, new ArrayList<Range>());     map.get(sum).add(new Range(i, r));    }   }   ArrayList<Range> res = new ArrayList<Range>();   for(long key: map.keySet())   {    ArrayList<Range> ls = map.get(key);    ArrayList<Range> temp = new ArrayList<Range>();    temp.add(ls.get(0));    int r = ls.get(0).r;    for(int i=1; i < ls.size(); i++)     if(r < ls.get(i).l)     {     r = ls.get(i).r;     temp.add(ls.get(i));     }    if(res.size() < temp.size())     res = temp;   }   System.out.println(res.size());   StringBuilder sb = new StringBuilder();   for(Range x: res)   {    sb.append(x.l+" "+x.r);    sb.append("\n");   }   System.out.print(sb);  }  }  class Range  {  public int l;  public int r;    public Range(int a, int b)  {   l = a+1;   r = b+1;  }  }
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;   }  } }
4	public class FireAgain { static int n; static int m;  public static void main(String[] args) throws IOException {   BufferedReader r = new BufferedReader(new FileReader("input.txt"));  String s = r.readLine();  String[] sp = s.split(" ");  n = new Integer(sp[0]);  m = new Integer(sp[1]);  boolean[][] v = new boolean[n][m];  r.readLine();  s = r.readLine();  sp = s.split(" ");  Queue<Integer> q = new LinkedList<Integer>();  for (int i = 0; i < sp.length; i += 2) {  v[new Integer(sp[i]) - 1][new Integer(sp[i + 1]) - 1] = true;  q.add(new Integer(sp[i]) - 1);  q.add(new Integer(sp[i + 1]) - 1);  }  int[] dx = { 1, -1, 0, 0 };  int[] dy = { 0, 0, 1, -1 };  int lx = -1;  int ly = -1;  while (!q.isEmpty()) {  int x = q.remove();  int y = q.remove();  lx = x;  ly = y;  for (int i = 0; i < dy.length; i++) {   int nx = x + dx[i];   int ny = y + dy[i];   if (valid(nx, ny) && !v[nx][ny]) {   v[nx][ny] = true;   q.add(nx);   q.add(ny);   }  }  }  lx++;  ly++;  BufferedWriter wr=new BufferedWriter(new FileWriter("output.txt"));  wr.write(""+lx + " " + ly);  wr.newLine();  wr.close();   }  private static boolean valid(int nx, int ny) {  return nx >= 0 && nx < n && ny >= 0 && ny < m; } }
1	public class Main {  static MyScanner scan;  static PrintWriter pw;  public static void main(String[] args) {   new Thread(null,null,"_",1<<25)   {    public void run()    {     try     {      solve();     }     catch(Exception e)     {      e.printStackTrace();      System.exit(1);     }    }   }.start();  }  static void solve() throws IOException {   scan = new MyScanner();   pw = new PrintWriter(System.out, true);   StringBuilder sb = new StringBuilder();   int n = ni();   int d = ni();   int arr[] = new int[n];   int cnt = 2;   for(int i=0;i<n;++i)    arr[i] = ni();   for(int i=0;i<n-1;++i)   {    if(arr[i+1]-d==arr[i]+d)    {     ++cnt;     continue;    }    if(arr[i+1]-(arr[i]+d)>d)     ++cnt;    if((arr[i+1]-d)-arr[i]>d)     ++cnt;   }   pl(cnt);   pw.flush();   pw.close();  }  static long MMI(long A,long MOD)  {   return modpow(A,MOD-2,MOD);  }  static long modpow(long x,long y,long MOD)  {   if(y==0)    return 1;   if((y&1)==0)    return modpow((x*x)%MOD,y>>1,MOD);   else return (x*modpow(x,y-1,MOD))%MOD;  }  static class Pair implements Comparable<Pair>  {   int x,y;   Pair(int x,int y)   {    this.x=x;    this.y=y;   }   public int compareTo(Pair other)   {    if(this.x!=other.x)     return this.x-other.x;    return this.y-other.y;   }   public String toString()   {    return "{"+x+","+y+"}";   }  }  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 class MyScanner  {   BufferedReader br;   StringTokenizer st;   MyScanner()   {    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());   }  } }
3	public class _909C { int mod = (int) 1e9 + 7;  public void solve() throws FileNotFoundException {  InputStream inputStream = System.in;  InputHelper in = new InputHelper(inputStream);    int n = in.readInteger();  char[] a = new char[n];  for (int i = 0; i < n; i++) {  a[i] = in.read().charAt(0);  }  int[][][] dp = new int[2][n + 1][2];  dp[0][0][0] = dp[0][0][1] = 1;  for (int i = 1; i < n; i++) {  for (int j = n; j >= 0; j--) {   if (a[i - 1] == 's') {   dp[1][j][0] = dp[1][j][1] = dp[0][j][1];   } else {   if (j > 0)    dp[1][j][0] = dp[1][j][1] = dp[0][j - 1][0];   }  }   for (int j = 0; j <= n; j++) {   dp[0][j][0] = dp[1][j][0];   dp[0][j][1] = dp[1][j][1];   dp[1][j][0] = 0;   dp[1][j][1] = 0;  }  for (int j = n - 1; j >= 0; j--) {   dp[0][j][1] += dp[0][j + 1][1];   dp[0][j][1] %= mod;  }  }  System.out.println(dp[0][0][1]);   }  public static void main(String[] args) throws FileNotFoundException {  (new _909C()).solve(); }  class InputHelper {  StringTokenizer tokenizer = null;  private BufferedReader bufferedReader;  public InputHelper(InputStream inputStream) {  InputStreamReader inputStreamReader = new InputStreamReader(inputStream);  bufferedReader = new BufferedReader(inputStreamReader, 16384);  }  public String read() {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {   try {   String line = bufferedReader.readLine();   if (line == null) {    return null;   }   tokenizer = new StringTokenizer(line);   } catch (IOException e) {   e.printStackTrace();   }  }   return tokenizer.nextToken();  }  public Integer readInteger() {  return Integer.parseInt(read());  }  public Long readLong() {  return Long.parseLong(read());  } } }
4	public class FireAgain implements Runnable {  private BufferedReader in;  private PrintWriter out;  private StringTokenizer tok;  private void solve() throws IOException {   int n = nextInt(), m = nextInt();   int[][] sources = readIntMatrix(nextInt(), 2);   int max = -1, maxI = 0, maxJ = 0;   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     int min = Integer.MAX_VALUE;     for (int[] source : sources) {      int dist = abs(source[0] - i) + abs(source[1] - j);      if (dist < min) {       min = dist;      }     }     if (min > max) {      max = min;      maxI = i;      maxJ = j;     }    }   }   out.print((maxI + 1) + " " + (maxJ + 1));  }    public static void main(String[] args) {   new FireAgain().run();  }  @Override  public void run() {   try {    in = new BufferedReader(new FileReader("input.txt"));    out = new PrintWriter(new FileWriter("output.txt"));    tok = null;    solve();    in.close();    out.close();   } catch (IOException e) {    System.exit(0);   }  }  private String nextToken() throws IOException {   while (tok == null || !tok.hasMoreTokens()) {    tok = new StringTokenizer(in.readLine());   }   return tok.nextToken();  }  private int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  private int[][] readIntMatrix(int n, int m) throws IOException {   int[][] mx = new int[n][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     mx[i][j] = nextInt() - 1;    }   }   return mx;  } }
6	public class Main2 {  static long mod = 998244353;  static FastScanner scanner;  static StringBuilder result = new StringBuilder();  public static void main(String[] args) {   scanner = new FastScanner();   int t = scanner.nextInt();   for (int i = 0; i < t; i++) {    solve();    result.append("\n");   }   System.out.print(result.toString());  }   static void solve() {   int n = scanner.nextInt();   int m = scanner.nextInt();   PriorityQueue<WithIdx2> queue = new PriorityQueue<>();   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     queue.add(new WithIdx2(scanner.nextInt(), i, j));    }   }   if (n <= 3) {    int res = 0;    for (int k = 0; k < n; k++) {     res += queue.poll().val;    }    result.append(res);   } else {    List<WithIdx2> a = new ArrayList<>();    for (int i = 0; i < 9; i++) {     if (!queue.isEmpty()) a.add(queue.poll());    }    int[] offsets = new int[m];    best = -1;    Arrays.fill(offsets, -100);    put(0, a, offsets, new int[4]);    result.append(best);   }  }  static int best = -1;  static void put(int current, List<WithIdx2> vals, int[] offsets, int[] rows) {   if (current == vals.size()) {    for (int i = 0; i < rows.length; i++) if (rows[i] == 0) return;    int sum = IntStream.of(rows).sum();    best = Math.max(best, sum);    return;   }   for (int row = 0; row < 4; row++) {    if (rows[row] == 0) {     WithIdx2 c = vals.get(current);     if (offsets[c.y] == -100) {      rows[row] = c.val;      offsets[c.y] = row - c.x;      put(current + 1, vals, offsets, rows);      rows[row] = 0;      offsets[c.y] = -100;     } else {      int bind = c.x + offsets[c.y];      if (bind < 0) bind += 4;      if (bind >= 4) bind -= 4;      if (row == bind) {       rows[row] = c.val;       put(current + 1, vals, offsets, rows);       rows[row] = 0;      }     }    }   }   put(current + 1, vals, offsets, rows);  }  static class WithIdx2 implements Comparable<WithIdx2>{   int x, y, val;   public WithIdx2(int val, int x, int y) {    this.val = val;    this.x = x;    this.y = y;   }   @Override   public int compareTo(WithIdx2 o) {    return -Integer.compare(val, o.val);   }  }   static class WithIdx implements Comparable<WithIdx>{   int val, idx;   public WithIdx(int val, int idx) {    this.val = val;    this.idx = idx;   }   @Override   public int compareTo(WithIdx o) {    return Integer.compare(val, o.val);   }  }  public static class FastScanner {   BufferedReader br;   StringTokenizer st;   public FastScanner() {    br = new BufferedReader(new InputStreamReader(System.in));   }   String nextToken() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {           e.printStackTrace();     }    }    return st.nextToken();   }   String nextLine() {    try {     return br.readLine();    } catch (Exception e) {     e.printStackTrace();     throw new RuntimeException();    }   }   int nextInt() {    return Integer.parseInt(nextToken());   }   long nextLong() {    return Long.parseLong(nextToken());   }   double nextDouble() {    return Double.parseDouble(nextToken());   }   int[] nextIntArray(int n) {    int[] res = new int[n];    for (int i = 0; i < n; i++) res[i] = nextInt();    return res;   }   long[] nextLongArray(int n) {    long[] res = new long[n];    for (int i = 0; i < n; i++) res[i] = nextLong();    return res;   }   String[] nextStringArray(int n) {    String[] res = new String[n];    for (int i = 0; i < n; i++) res[i] = nextToken();    return res;   }  }  static class PrefixSums {   long[] sums;   public PrefixSums(long[] sums) {    this.sums = sums;   }   public long sum(int fromInclusive, int toExclusive) {    if (fromInclusive > toExclusive) throw new IllegalArgumentException("Wrong value");    return sums[toExclusive] - sums[fromInclusive];   }   public static PrefixSums of(int[] ar) {    long[] sums = new long[ar.length + 1];    for (int i = 1; i <= ar.length; i++) {     sums[i] = sums[i - 1] + ar[i - 1];    }    return new PrefixSums(sums);   }   public static PrefixSums of(long[] ar) {    long[] sums = new long[ar.length + 1];    for (int i = 1; i <= ar.length; i++) {     sums[i] = sums[i - 1] + ar[i - 1];    }    return new PrefixSums(sums);   }  }  static class ADUtils {   static void sort(int[] ar) {    Random rnd = ThreadLocalRandom.current();    for (int i = ar.length - 1; i > 0; i--)    {     int index = rnd.nextInt(i + 1);         int a = ar[index];     ar[index] = ar[i];     ar[i] = a;    }    Arrays.sort(ar);   }   static void reverse(int[] arr) {    int last = arr.length / 2;    for (int i = 0; i < last; i++) {     int tmp = arr[i];     arr[i] = arr[arr.length - 1 - i];     arr[arr.length - 1 - i] = tmp;    }   }   static void sort(long[] ar) {    Random rnd = ThreadLocalRandom.current();    for (int i = ar.length - 1; i > 0; i--)    {     int index = rnd.nextInt(i + 1);         long a = ar[index];     ar[index] = ar[i];     ar[i] = a;    }    Arrays.sort(ar);   }  }  static class MathUtils {   static long[] FIRST_PRIMES = {     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, 1009, 1013,     1019, 1021, 1031, 1033, 1039, 1049, 1051};   static long[] primes(int to) {    long[] all = new long[to + 1];    long[] primes = new long[to + 1];    all[1] = 1;    int primesLength = 0;    for (int i = 2; i <= to; i ++) {     if (all[i] == 0) {      primes[primesLength++] = i;      all[i] = i;     }     for (int j = 0; j < primesLength && i * primes[j] <= to && all[i] >= primes[j]; j++) {      all[(int) (i * primes[j])] = primes[j];     }    }    return Arrays.copyOf(primes, primesLength);   }   static long modpow(long b, long e, long m) {    long result = 1;    while (e > 0) {     if ((e & 1) == 1) {           result = (result * b) % m;     }     b = (b * b) % m;     e >>= 1;    }    return result;   }   static long submod(long x, long y, long m) {    return (x - y + m) % m;   }  } }
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");   } }
2	public class CodeForces {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt();   int ans = 0;   long x = n;   x = x*(x+1)/2;   while (x!=k) {    x-=n;    n--;    ans++;    k++;   }   System.out.println(ans);  } }
0	public class Sol122A {  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 {  long x = nextLong();  out.println((x % 4) * (x % 7) * (x % 74) * (x % 47) * (x % 44) * (x % 77) * (x % 444) * (x % 447) * (x % 474) * (x % 477) * (x % 744) * (x % 747) * (x % 774) * (x % 777) == 0 ? "YES" : "NO"); }  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 Sol122A().run(); } }
1	public class TheyAreEverywhere {  static StringTokenizer st;  static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in), 325678);  static int[] id = new int[100000];  public static void main(String[] args) throws IOException {   int n = in();   String s = next();   int total = 0;   int[] seq = new int[n];   boolean[] c = new boolean[100000];   for (int i = 0; i < n; i++) {    seq[i] = s.charAt(i);    if (!c[seq[i]]) {     total++;     c[seq[i]] = true;    }   }   Arrays.fill(id, -1);   int best = Integer.MAX_VALUE;   TreeSet<Integer> q = new TreeSet<Integer>(new Comparator<Integer>() {    @Override    public int compare(Integer o1, Integer o2) {     return id[o1] - id[o2];    }   });   for (int i = 0; i < n; i++) {    q.remove(seq[i]);    id[seq[i]] = i;    q.add(seq[i]);    if (q.size() == total) {         best = Math.min(best, i - id[q.first()] + 1);    }      }   System.out.println(best);  }  public static int in() throws IOException {   return Integer.parseInt(next());  }  public static long inl() throws IOException {   return Long.parseLong(next());  }  public static String next() throws IOException {   if (st == null || !st.hasMoreTokens())    st = new StringTokenizer(bf.readLine());   return st.nextToken();  } }
6	public class MaeDosDragoes {   public static PrintWriter saida = new PrintWriter(System.out, false);            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;   }  }   public static void main(String[] args) {  FastScanner fastScanner = new FastScanner();   int proximoInt = fastScanner.nextInt();   double proximoDouble = fastScanner.nextInt();   long[] graph = new long[proximoInt];   for(Integer i = 0; i < proximoInt; i++) {    for(Integer j =0; j < proximoInt; j++) {     Integer val = fastScanner.nextInt();     if (val.equals(1) || i.equals(j)) {   graph[i] |= 1L << j;   }    }   }   int szLeft = proximoInt/2;   int szRight = proximoInt - szLeft;   int[] dp = new int[1 << szLeft];   int maxMask = 1 << szLeft;   for(int mask = 1; mask <maxMask; mask++) {    int curMask = mask;    for(int j = 0; j < szLeft; j++) {     if (((1 << j) & mask) > 0) {      curMask &= graph[j + szRight] >> szRight;      dp[mask] = Math.max(dp[mask], dp[mask ^ (1 << j)]);     }    }    if (mask == curMask) {     dp[mask] = Math.max(dp[mask],Integer.bitCount(mask));    }   }   int ans = 0;   int rmaxMask = 1 << szRight;   for(int mask = 0; mask < rmaxMask; mask++) {    int curMask = mask;    int oMask = maxMask -1;    for(int j = 0; j < szRight; j++) {     if (((1 << j) & mask) > 0) {      curMask &= (graph[j] & (rmaxMask-1));      oMask &= graph[j] >> szRight;     }    }    if (curMask != mask) continue;    ans = Math.max(ans, Integer.bitCount(mask) + dp[oMask]);   }   proximoDouble/=ans;   saida.println(proximoDouble * proximoDouble * (ans * (ans-1))/2);   saida.flush();  } }
4	public class Main { public static void main(String[] args) {  InputStream inputStream;  try {  inputStream = new FileInputStream("input.txt");  } catch (IOException e) {  throw new RuntimeException(e);  }  OutputStream outputStream;  try {  outputStream = new FileOutputStream("output.txt");  } catch (IOException e) {  throw new RuntimeException(e);  }  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskC solver = new TaskC();  solver.solve(1, in, out);  out.close(); } } class TaskC {  public void solve(int testNumber, InputReader in, PrintWriter out) {   int N = in.nextInt();   int M = in.nextInt();   int K = in.nextInt();   int[][] dist = new int[N+1][M+1];   for(int[] ini : dist) Arrays.fill(ini,1 << 30);   int best = 0;   ArrayList<Integer> result = new ArrayList<Integer>();   Queue<Integer> q = new LinkedList<Integer>();   for(int k = 0; k < K; ++k) {    int x = in.nextInt();    int y = in.nextInt();    dist[x][y] = 0;    q.offer(x);    q.offer(y);   }   int[] dx = new int[] { 1,-1,0,0 };   int[] dy = new int[] {0,0,1,-1};   while(!q.isEmpty()) {    int a = q.poll();    int b = q.poll();    for(int r = 0; r < 4; ++r) {     int x = a + dx[r];     int y = b + dy[r];     if(x >= 1 && x <= N && y >=1 && y <= M && dist[x][y] > dist[a][b] + 1) {      dist[x][y] = dist[a][b] + 1;      q.offer(x);      q.offer(y);     }    }   }   for(int i = 1; i <= N; ++i)    for(int j = 1; j <= M; ++j) best = Math.max(best,dist[i][j]);   for(int a = 1; a <= N; ++a)    for(int b = 1; b <= M; ++b) if(dist[a][b] == best) {     result.add(a);     result.add(b);    }   if(result.size() > 0) {    out.print(result.get(0) + " " + result.get(1));   }   out.println();  } } class InputReader {  public BufferedReader reader;  public 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());  } }
6	public class ASimpleTask {    static long memo[][]; static int graph[]; static long hamiltonianPath(int mask , int u) {  if(memo[mask][u] != -1)  return memo[mask][u];  else if(u == Integer.numberOfTrailingZeros(mask))  return 0;  else {  long sum = 0;  for(int fromSet = mask ^ (1 << u);fromSet > 0; fromSet ^= Integer.lowestOneBit(fromSet)) {   int v = Integer.numberOfTrailingZeros(fromSet);     if((graph[u] & (1 << v)) != 0)    sum += hamiltonianPath(mask ^ (1 << u), v);  }    return memo[mask][u] = sum;  } }  private static void solveBottomUp(FastScanner s1, PrintWriter out){  int V = s1.nextInt();  int E = s1.nextInt();  graph = new int[V];  long DP[][] = new long[1 << V][V];  while(E-->0) {  int u = s1.nextInt() - 1;  int v = s1.nextInt() - 1;  graph[u] |= (1 << v);  graph[v] |= (1 << u);  }  for(int i=0;i<V;i++)  DP[1 << i][i] = 1;  for(int mask = 1 , end = 1 << V;mask < end;mask++) {  for(int set = mask;Integer.bitCount(set) > 1;set ^= Integer.highestOneBit(set)) {   int u = Integer.numberOfTrailingZeros(Integer.highestOneBit(set));   for(int fromSet = mask ^ (1 << u);fromSet > 0; fromSet ^= Integer.lowestOneBit(fromSet)) {   int v = Integer.numberOfTrailingZeros(fromSet);      if((graph[u] & (1 << v)) != 0)    DP[mask][u] += DP[mask ^ (1 << u)][v];      }  }  }  long totalCycles = 0;  for(int mask = 1 , end = 1 << V;mask < end;mask++) {  if(Integer.bitCount(mask) >= 3) {   int start = Integer.numberOfTrailingZeros(mask);   for(int set = mask;Integer.bitCount(set) > 1;set ^= Integer.highestOneBit(set)) {   int u = Integer.numberOfTrailingZeros(Integer.highestOneBit(set));   if((graph[u] & (1 << start)) != 0)    totalCycles += DP[mask][u];   }  }  }  totalCycles /= 2;  out.println(totalCycles); }  private static void solveTopDown(FastScanner s1, PrintWriter out){  int V = s1.nextInt();  int E = s1.nextInt();  graph = new int[V];  memo = new long[1 << V][V];   for(long l[] : memo)  Arrays.fill(l, -1);   while(E-->0) {  int u = s1.nextInt() - 1;  int v = s1.nextInt() - 1;  graph[u] |= (1 << v);  graph[v] |= (1 << u);  }  for(int i=0;i<V;i++)  memo[1 << i][i] = 1;   long totalCycles = 0;  for(int mask = 1 , end = 1 << V;mask < end;mask++) {  if(Integer.bitCount(mask) >= 3) {   int start = Integer.numberOfTrailingZeros(mask);   for(int set = mask;Integer.bitCount(set) > 1;set ^= Integer.highestOneBit(set)) {   int u = Integer.numberOfTrailingZeros(Integer.highestOneBit(set));   if((graph[u] & (1 << start)) != 0)    totalCycles += hamiltonianPath(mask, u);   }  }  }  totalCycles /= 2;   out.println(totalCycles); }       public static void main(String []args) throws IOException {  FastScanner in = new FastScanner(System.in);  PrintWriter out =   new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);  solveTopDown(in, out);  in.close();  out.close(); }   static class FastScanner{  BufferedReader reader;  StringTokenizer st;  FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}  String next()  {while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}    st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}  String nextLine() {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}     int nextInt() {return Integer.parseInt(next());}  long nextLong() {return Long.parseLong(next());}   double nextDouble(){return Double.parseDouble(next());}  char nextChar() {return next().charAt(0);}  int[] nextIntArray(int n)   {int[] a= new int[n]; int i=0;while(i<n){a[i++]=nextInt();} return a;}  long[] nextLongArray(int n)  {long[]a= new long[n]; int i=0;while(i<n){a[i++]=nextLong();} return a;}  int[] nextIntArrayOneBased(int n) {int[] a= new int[n+1]; int i=1;while(i<=n){a[i++]=nextInt();} return a;}    long[] nextLongArrayOneBased(int n){long[]a= new long[n+1];int i=1;while(i<=n){a[i++]=nextLong();}return a;}    void close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}   }  }
2	public class Main implements Runnable {  int n;  boolean inBound (int x, int y) {  return x >= 1 && y >= 1 && x <= n && y <= n; }  void solve() throws Exception {  n = sc.nextInt();  int y = sc.nextInt();  int x = sc.nextInt();  int c = sc.nextInt();   int yu = y;  int yd = y;  int xl = x;  int xr = x;    int current = 1;  int time = 0;  while (current < c) {  time++;  yu--;  yd++;  xl--;  xr++;    {   int cur = time - 1;   if (yu < 1) {   cur -= (-yu);   }   if (xl < 1) {   cur -= (-xl);   }   if (cur > 0) {   current += cur;   }  }    {   int cur = time - 1;   if (yu < 1) {   cur -= (-yu);   }   if (xr > n) {   cur -= (xr - n - 1);   }   if (cur > 0) {   current += cur;   }  }    {   int cur = time - 1;   if (yd > n) {   cur -= (yd - n - 1);   }   if (xl < 1) {   cur -= (-xl);   }   if (cur > 0) {   current += cur;   }  }    {   int cur = time - 1;   if (yd > n) {   cur -= (yd - n - 1);   }   if (xr > n) {   cur -= (xr - n - 1);   }   if (cur > 0) {   current += cur;   }  }    if (inBound(x, yd)) current++;  if (inBound(x, yu)) current++;  if (inBound(xl, y)) current++;  if (inBound(xr, y)) current++;  }   out.println(time); }  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(), "", (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()); } }
1	public class Round1TaskB implements Runnable {  static PrintWriter pw = null;  static BufferedReader br = null;  StringTokenizer st = null;  public static void main(String[] args) throws IOException {   pw = new PrintWriter(new OutputStreamWriter(System.out));   br = new BufferedReader(new InputStreamReader(System.in));   (new Thread(new Round1TaskB())).start();  }  void nline() {   try {    st = new StringTokenizer(br.readLine());   } catch (IOException e) {   }  }  int ni() {   while (st == null || !st.hasMoreTokens())    nline();   return Integer.valueOf(st.nextToken());  }  double nd() {   while (st == null || !st.hasMoreTokens())    nline();   return Double.valueOf(st.nextToken());  }  long nl() {   while (st == null || !st.hasMoreTokens())    nline();   return Long.valueOf(st.nextToken());  }  String nwrd() {   while (st == null || !st.hasMoreTokens())    nline();   return st.nextToken();  }  String nextLine() {   try {    return br.readLine();   } catch (IOException e) {   }   return null;  }  boolean isDigit(char c) {   if (c <= '9' && c >= '0')    return true;   return false;  }   void rec(int t, int length) {   if (length == 0) {    return;   }   rec(t / 26, length - 1);   pw.print((char) ('A' + (t % 26)));  }  void RC(int i, int j) {   int num = 0;   for (int t = i; t < j; t++) {    num = num * 10 + format[t] - '0';   }   int len = 0, base = 1, total = 0;   while (true) {    base *= 26;    total += base;    len++;    if (num <= total)     break;   }   num -= total / 26;   rec(num, len);  }  void BC(int i, int j) {   int total = 0, base = 1, rest = 0;   for (int k = i; k< j; k++) {    total += base;    base *= 26;    rest = rest * 26 + format[k] - 'A';   }   pw.print(total + rest);  }  char format[];  public void solve() {   format = nwrd().toCharArray();   int L = format.length;   for (int i = 0; i < L - 1; i++) {    if (isDigit(format[i]) && (format[i + 1] == 'C')) {     RC(i + 2, L);     for (int j = 1; j <= i; j++) {      pw.print(format[j]);     }     pw.println();     return;    }   }   for (int i = 0; i < L; i++) {    if (isDigit(format[i])) {     pw.print('R');     for (int j = i; j < L; j++) {      pw.print(format[j]);     }     pw.print('C');     BC(0, i);     pw.println();     return;    }   }  }  public void run() {   int n = ni();   while (n-- > 0) {    solve();   }   pw.close();  } }
1	public class D527A2 {  public static void main(String[] args) {  FastScanner in = new FastScanner(System.in);  int N = in.nextInt();  Stack<Integer> stack = new Stack<>();  for(int i = 0; i < N; i++) {  int num = in.nextInt() % 2;  if(stack.size() >= 1 && stack.lastElement() == num)   stack.pop();  else   stack.add(num);  }   System.out.println(stack.size() <= 1 ? "YES" : "NO"); }   static class FastScanner {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int chars;  public FastScanner(InputStream stream) {  this.stream = stream;  }  int read() {  if (chars == -1)   throw new InputMismatchException();  if (curChar >= chars) {   curChar = 0;   try {   chars = stream.read(buf);   } catch (IOException e) {   throw new InputMismatchException();   }   if (chars <= 0)   return -1;  }  return buf[curChar++];  }  boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  boolean isEndline(int c) {  return c == '\n' || c == '\r' || c == -1;  }  public int nextInt() {  return Integer.parseInt(next());  }  public long nextLong() {  return Long.parseLong(next());  }  public double nextDouble() {  return Double.parseDouble(next());  }  public String next() {  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 (isEndline(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isEndline(c));  return res.toString();  } } }
3	public class A961_Tetris {  public static void main(String[] args) {   Scanner input = new Scanner(System.in);  int platforms = input.nextInt();  int in = input.nextInt();  int[] cols = new int[platforms];  int[] squares = new int[in];   for (int i = 0; i < in; i ++) {  squares[i] = input.nextInt();  }   boolean hi = false;  int score = 0;   for (int i = 0; i < in; i ++) {  cols[squares[i] - 1] ++;  hi = checkscore(cols);  if (hi == true) {   hi = false;   score ++;   for (int j = 0; j < cols.length; j ++) {   cols[j] --;   }     }    }   System.out.println(score);   }  public static boolean checkscore(int[] cols) {  for (int i = 0; i < cols.length; i ++) {  if (cols[i] == 0) {   return false;  }    }   return true;   } }
1	public class IQTest {  public static void main(String[] args)  {   try   {    BufferedReader in = new BufferedReader(     new InputStreamReader(System.in));    String str = in.readLine();    int n = Integer.parseInt(str);    int odd = -1, even = -1, odds = 0, evens = 0;            str = in.readLine();     String[] numbers = str.split(" ");     int index = 1;     for (String number: numbers)     {      int i = Integer.parseInt(number);      if (i % 2 == 0)      {       ++evens;       if (even == -1)        even = index;      }      else      {       ++odds;       if (odd == -1)        odd = index;      }      ++index;     }           System.out.println((evens > odds ? odd : even));   }   catch (Exception e)   {    e.printStackTrace();   }  } }
6	public class F531 {  public static void main(String[] args) {   MyScanner sc = new MyScanner();   PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));   int n = sc.nextInt(); int m = sc.nextInt();   long [][] mn1 = new long[n][n];   long [][] mn2 = new long[n][n];   long [][] grid = new long[n][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) grid[i][j] = sc.nextInt();   }   if (n == 1) {    long ans = Integer.MAX_VALUE;    for (int i = 0; i < m - 1; i++) ans = Math.min(ans, Math.abs(grid[0][i] - grid[0][i + 1]));    out.println(ans);    out.close();    return;   }   for (int i = 0; i < n; i++) {    for (int j = 0; j < n; j++) {     if (i == j) continue;     long min = Long.MAX_VALUE;     for (int k = 0; k < m; k++) min = Math.min(min, Math.abs(grid[i][k] - grid[j][k]));     mn1[i][j] = min;    }   }   for (int i = 0; i < n; i++) {    for (int j = 0; j < n; j++) {     if (i == j) continue;     long min = Long.MAX_VALUE;     for (int k = 0; k < m - 1; k++) min = Math.min(min, Math.abs(grid[i][k] - grid[j][k + 1]));     mn2[i][j] = min;    }   }   long [][] dp = new long[1 << n][n];      long ans = 0;   for (int i = 0; i < n; i++) {    for (long [] a: dp) Arrays.fill(a, -1);    for (int j = 0; j < n; j++) {     if (j == i) dp[1 << j][j] = Long.MAX_VALUE;     else dp[1 << j][j] = 0;    }    for (int mask = 1; mask < (1 << n); mask++) {     for (int last = 0; last < n; last++) {      if (dp[mask][last] != -1) continue;      for (int prev = 0; prev < n; prev++) {       if (prev == last) continue;       if (((mask >> prev) & 1) == 1) {        dp[mask][last] = Math.max(dp[mask][last], Math.min(mn1[prev][last], dp[mask ^ (1 << last)][prev]));       }      }     }    }       for (int j = 0; j < n; j++) {         long end = mn2[j][i];     ans = Math.max(ans, Math.min(dp[(1 << n) - 1][j], end));    }   }   out.println(ans);   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;   }   } }
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();  } }
2	public class Main {   long mod = 1000000007;  long pow(long x,long y) {  if(y==0)  return 1;  else if(y==1)  return x%mod;  else if(y%2==0)  return pow((x*x)%mod,y/2)%mod;  else  return (x*pow((x*x)%mod,y/2)%mod)%mod; }  void solve() {  FastReader sc =new FastReader();  long x = sc.nextLong();  long k = sc.nextLong();   if(x == 0) {  System.out.println(0);  return;  }  long ans = pow(2, k);  x = (2*x)%mod;  x = (x - 1 + mod)%mod;  ans = (ans*x)%mod;  ans = (ans + 1)%mod;   System.out.println(ans); }  public static void main(String[] args)  {   new Main().solve();  }   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;   }  } }
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;  }  } }
1	public class SpreadSheet {  public void run() {  try {  Scanner s = new Scanner(System.in);  int tests = s.nextInt();  for (int i = 0; i < tests; i++) {   String line = s.next();   String regex = "R[\\d]+C[\\d]+";   Pattern pattern = Pattern.compile(regex);   Matcher matcher = pattern.matcher(line);     if (matcher.matches()){   int r = Integer.parseInt(line.substring(1, line.indexOf("C")));   int c = Integer.parseInt(line.substring(line.indexOf("C") +1));   System.out.println(toFormula(r, c));   }   else {   int index = -1;   for (int j = 0; j < line.length(); j++) {    if (line.charAt(j) >= '0' && line.charAt(j) <= '9') {    index = j;    break;    }   }   String c = line.substring(0, index);   int r = Integer.parseInt(line.substring(index));   System.out.println(fromFormula(c, r));   }  }  } catch (Exception e) {  e.printStackTrace();  } }  private String toFormula(int r, int c) {  StringBuffer buff = new StringBuffer();     char ch;     while (c != 0) {       int m = c%26;       if(m==0)       {         ch = 'Z';         c = c/26 - 1;       }       else       {         ch = (char)(m+'A'-1);         c /= 26;       }       buff.append(ch);           }     return buff.reverse().toString() + r;        }  private String fromFormula(String c, int r) {  int ret = 0;  int power = 1;  for (int i = c.length()-1; i >= 0; i--) {  ret += ((c.charAt(i) - 'A' + 1) * power);  power *= 26;  }  return "R" + r + "C" + ret; }  public static void main(String[] args) {  new SpreadSheet().run(); } }
6	public class Main{     void pre() throws Exception{}  void solve(int TC)throws Exception{   int n = ni(), m = ni();   long[][] a = new long[n][m];   long[] col = new long[m];   for(int i = 0; i< n; i++){    for(int j = 0; j< m; j++){     a[i][j] = nl();     col[j] = Math.max(a[i][j], col[j]);    }   }   Integer[] p = new Integer[m];   for(int i = 0; i< m; i++)p[i] = i;   Arrays.sort(p, (Integer i1, Integer i2) -> Long.compare(col[i2], col[i1]));   long[][] mat = new long[n][Math.min(m, 6)];   for(int i = 0; i< Math.min(m, 6); i++){    for(int j = 0; j< n; j++)mat[j][i] = a[j][p[i]];   }   long pow = 1;   for(int i = 0; i< Math.min(m, 6); i++)pow *= n;   int[] sh = new int[Math.min(m, 6)];   long ans = 0;   for(int i = 0; i< pow; i++){    int x = i;    for(int j = 0; j< Math.min(m, 6); j++){     sh[j] = x%n;     x/=n;    }    long cur = 0;    for(int ro = 0; ro < n; ro++){     long cR = 0;     for(int j = 0; j < Math.min(m, 6); j++)cR = Math.max(cR, mat[(ro+sh[j])%n][j]);     cur += cR;    }    ans = Math.max(ans, cur);   }   pn(ans);  }   void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}  void exit(boolean b){if(!b)System.exit(0);}  long IINF = (long)1e18, mod = (long)1e9+7;  final int INF = (int)1e9, MX = (int)2e6+5;  DecimalFormat df = new DecimalFormat("0.00000000");  double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-6;  static boolean multipleTC = true, memory = false, fileIO = false;  FastReader in;PrintWriter out;  void run() throws Exception{   if(fileIO){    in = new FastReader("input.txt");    out = new PrintWriter("output.txt");   }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();  }  public static void main(String[] args) throws Exception{   if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();   else new Main().run();  }   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){out.print(o);}  void pn(Object o){out.println(o);}  void pni(Object o){out.println(o);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;   }  } }
1	public class Main {  public static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  public static int read() throws IOException {   tokenizer.nextToken();   return (int) tokenizer.nval;  }  public static void main(String[] args) throws IOException {   Scanner scanner=new Scanner(System.in);   int n=scanner.nextInt();   ArrayList<String> list1=new ArrayList<String>();   ArrayList<String> list2=new ArrayList<String>();   for (int i=0; i<n; i++){    String s=scanner.next();    list1.add(s);   }   for (int i=0; i<n; i++){    String s=scanner.next();    list2.add(s);   }   for (int i=0; i<list1.size(); i++){    for (int j=0; j<list2.size(); j++){     if (list1.get(i).equals(list2.get(j))){      list1.remove(i);      list2.remove(j);      i--;      break;     }    }   }   System.out.println(list1.size());  } }
5	public class Main {   public static void main(String[] args) {   FastScanner sc = new FastScanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int N = sc.nextInt();   long dest = sc.nextLong();   long max = (long)N * ((long)N + 1L) / 2L;   if (dest < 2 * N - 1 || dest > max) {    out.println("No");    out.close();    return;   }   int[] d = new int[N + 1];   int[] f = new int[N + 1];   int K = 1;   for (; K <= N; K++) {    long dep = 1L, cnt = 1L, c = 1L;    long t = 1L;    while (cnt < N) {     c = c * K;     dep++;     t += (dep * Math.min(c, N - cnt));     cnt += c;    }    if (t <= dest) break;   }   out.println("Yes");   int dep = 1; long cnt = 1L, c = 1L;   long t = 1L;   d[1] = 1;   while (cnt < N) {    dep++; c = c * K;    long x = (long)N - cnt;    int min;    if (c >= x) min = (int)x;    else min = (int)c;    d[dep] = min;    t += (dep * Math.min(c, (long)N - cnt)); cnt += c;   }   dest -= t;   int curDep = dep; int nextDep = dep + 1;   while (dest > 0) {    if (d[curDep] <= 1) curDep--;    d[curDep]--;    long next = Math.min(nextDep++, dest + curDep);    dest -= ((int)next - curDep);    d[(int)next]++;   }   int first = 1;   for (int i = 2; i < nextDep; i++) {    int p = 0, fn = first - d[i - 1] + 1;    for (int j = first + 1; j <= first + d[i]; j++) {     if (p == K) {      fn++; p = 0;     }     p++; f[j] = fn;    }    first += d[i];   }   for (int i = 2; i <= N; i++)    out.format("%d ", f[i]);   out.close();  }        static class FastScanner {   private BufferedReader reader = null;   private StringTokenizer tokenizer = null;     public FastScanner(InputStream in) {    reader = new BufferedReader(new InputStreamReader(in));    tokenizer = null;   }     public String next() {    if (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }     public String nextLine() {    if (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      return reader.readLine();     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken("\n");   }     public long nextLong() {    return Long.parseLong(next());   }     public int nextInt() {    return Integer.parseInt(next());   }       } }
1	public class Main {  static class Task {   void solve(int test, FastScanner in, PrintWriter out) throws IOException {    int n = in.nextInt();    int d = in.nextInt();    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = in.nextInt();    }    Arrays.sort(a);    int ans = 2;    for (int i = 0; i < n - 1; i++) {     if (a[i + 1] - d > a[i] + d) {      ans += 2;     } else if (a[i + 1] - d >= a[i] + d) {      ans++;     }    }    out.println(ans);   }  }  public static void main(String[] args) throws IOException {   FastScanner in = new FastScanner(System.in);   PrintWriter out = new PrintWriter(System.out);    new Task().solve(1, in, out);   out.close();  }  static class FastScanner {   BufferedReader br;   StringTokenizer token;   public FastScanner(InputStream is) {    br = new BufferedReader(new InputStreamReader(System.in));   }   public FastScanner(String s) {    try {     br = new BufferedReader(new FileReader(s));    } catch (FileNotFoundException e) {     e.printStackTrace();    }   }   public String nextToken() {    while (token == null || !token.hasMoreTokens()) {     try {      token = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return token.nextToken();   }   public int nextInt() {    return Integer.parseInt(nextToken());   }   public long nextLong() {    return Long.parseLong(nextToken());   }   public double nextDouble() {    return Double.parseDouble(nextToken());   }  } }
3	public class F11141 { static class Solver {  ArrayList<int[]> ranges[];  HashMap<Long, Integer> hm = new HashMap<>();  int id(long s) {  if (!hm.containsKey(s))   hm.put(s, hm.size());  return hm.get(s);  }     int[] memo;  int go(int r) {  memo[N] = 0;  int last = N;  for(int[] a : ranges[r]) {   while(a[0] < last) {   memo[last - 1] = memo[last];   last--;   }   memo[a[0]] = Math.max(memo[a[0]], Math.max(memo[a[0]], 1 + memo[a[1] + 1]));   last = a[0];  }  return memo[last];  }  ArrayDeque<int[]> ans = new ArrayDeque<>();   void go2(int r) {  memo[N] = 0;  int last = N;  int minAt[] = new int[N], oo = 987654321;  Arrays.fill(minAt, oo);  for(int[] a : ranges[r]) {   minAt[a[0]] = Math.min(minAt[a[0]], a[1] - a[0]);   while(a[0] < last) {   memo[last - 1] = memo[last];   last--;   }   memo[a[0]] = Math.max(memo[a[0]], Math.max(memo[a[0]], 1 + memo[a[1] + 1]));   last = a[0];  }  while(0 < last) {   memo[last - 1] = memo[last];   last--;  }  int k = 0;  for(; k < N;) {   if(minAt[k] == oo || memo[k] != 1 + memo[k + minAt[k] + 1]) k++;   else {   ans.push(new int[] {k, k + minAt[k]});   k += minAt[k] + 1;   }  }  }   @SuppressWarnings("unchecked")  Solver() {  ranges = new ArrayList[2250001];  for (int i = 0; i < ranges.length; i++)   ranges[i] = new ArrayList<>();  }  int N, LID;  long[] a;  void solve(Scanner s, PrintWriter out) {  N = s.nextInt();  a = new long[N + 1];  for (int i = 1; i <= N; i++)   a[i] = s.nextLong() + a[i - 1];  for (int i = N; i >= 1; i--)   for (int j = i; j <= N; j++) {   int x = id(a[j] - a[i - 1]);   ranges[x].add(new int[] { i - 1, j - 1 });   }    int best = 0, bid = -1;  memo = new int[N + 1];  Arrays.sort(ranges, (a, b) -> b.size() - a.size());  for(int i = 0; i < ranges.length; i++, LID++) {   if(ranges[i].size() <= best) break;   int ans = go(i);   if(ans > best) {   best = ans;   bid = i;   }  }      out.println(best);  go2(bid);      while(!ans.isEmpty()) {   int[] c = ans.pop();   out.println(++c[0] + " " + ++c[1]);  }    }  }  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  Solver solver = new Solver();  solver.solve(s, out);  out.close();  } }
6	public class G1_PlaylistForPolycarp {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader inp = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   Solver solver = new Solver();   solver.solve(inp, out);   out.close();  }  private static class Solver {   private void solve(InputReader inp, PrintWriter out) {    int n = inp.nextInt(), t = inp.nextInt();    int[][] tracks = new int[n][2];    long MOD = 1000000007;    for (int i = 0; i < n; i++) {     tracks[i][0] = inp.nextInt();     tracks[i][1] = inp.nextInt() - 1;    }    long[][] dp = new long[2 << n][4];    dp[0][3] = 1;        int curr = 1;    while (curr <= n) {     int mask = 0;     for (int i = 0; i < curr; i++) mask |= (1 << i);          while (mask < 2 << n) {           for (int i = 0; i < n; i++) {             if ((mask & (1 << i)) != 0) {               for (int j = 0; j < 4; j++) {         if (j == tracks[i][1]) continue;         dp[mask][tracks[i][1]] += dp[mask - (1 << i)][j];        }       }      }            mask = nextNumberXBits(mask);     }     curr++;    }    long res = 0;    for (int i = 0; i < (2 << n); i++) {     int time = 0;     for (int j = 0; j < n; j++) {      if ((i & (1 << j)) != 0) time += tracks[j][0];     }     if (time == t) {      for (int j = 0; j < 4; j++) {       res += dp[i][j];      }      res %= MOD;     }    }    out.print(res);   }   private static int nextNumberXBits(int mask) {    int c = mask & -mask;    int r = mask + c;    return (((r ^ mask) >> 2) / c) | r;   }  }  static class InputReader {   BufferedReader reader;   StringTokenizer tokenizer;   InputReader(InputStream stream) {    reader = new BufferedReader(new InputStreamReader(stream), 32768);    tokenizer = null;   }   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 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();}  } }
1	public class A {  static double eps=(double)1e-15; static long mod=(int)1e9+7; public static void main(String args[]){  InputReader in = new InputReader(System.in);  OutputStream outputStream = System.out;  PrintWriter out = new PrintWriter(outputStream);   int n=in.nextInt();  int l=0,r=0;  String s=in.nextLine();  HashSet<Character> size=new HashSet<>();  for(int i=0;i<n;i++){  char p=s.charAt(i);  size.add(p);  }  int chk=size.size();  HashMap<Character, Integer> hm=new HashMap<>();  int ans=Integer.MAX_VALUE;  while(l<n){  if(hm.size()<chk && r<n){   char p=s.charAt(r);   if(hm.containsKey(p)){   hm.put(p, hm.get(p)+1);   }   else{   hm.put(p, 1);   }   r++;  }  else{   char p=s.charAt(l);   if(hm.get(p)==1){   hm.remove(p);   }   else{   hm.put(p, hm.get(p)-1);   }   l++;  }  if(hm.size()==chk){   ans=Math.min(ans, r-l);  }  }  out.println(ans);  out.close();    } static class Pair implements Comparable<Pair> {  int u;  int v;   public Pair(int u, int v) {  this.u = u;  this.v = v;  }   public int hashCode() {  int hu = (int) (u ^ (u >>> 32));  int hv = (int) (v ^ (v >>> 32));  return 31 * hu + hv;  }   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(v, other.v);  }   public String toString() {  return "[u=" + u + ", v=" + v + "]";  } } public static void debug(Object... o) {  System.out.println(Arrays.deepToString(o)); } static long modulo(long a,long b,long c) {  long x=1;  long y=a;  while(b > 0){  if(b%2 == 1){   x=(x*y)%c;  }  y = (y*y)%c;   b /= 2;  }  return x%c; } static long gcd(long x, long y) {  if(x==0)  return y;  if(y==0)  return x;  long r=0, a, b;  a = (x > y) ? x : y;  b = (x < y) ? x : y;  r = b;  while(a % b != 0)  {  r = a % b;  a = b;  b = r;  }  return r; } 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());  } } }
1	public class A { public static void main(String[] args) throws Exception {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  List<Integer> list = new ArrayList<Integer>(), list2;  for (; n-- > 0;) {  list.add(scan.nextInt());  }  list2 = new ArrayList<Integer>(list);  Collections.sort(list2, new Comparator<Integer>() {  public int compare(Integer o1, Integer o2) {   return o1 % 2 - o2 % 2;  }  });  System.out.println(list.indexOf(list2.get(list2.get(1) % 2 > 0 ? 0   : list2.size() - 1)) + 1); } }
4	public class Main {  public static Scanner scan = new Scanner(System.in);  public static boolean bg = true;  public static void main(String[] args) throws Exception {   String k1 = scan.next();   HashSet<String> met = new HashSet();   String ans = "";   for (int i=1;i<=k1.length()-1;i++){    for (int j=0;j+i<=k1.length();j++){     String cur = k1.substring(j, j+i);     if (!met.contains(cur)){      met.add(cur);     }     else {      if (cur.length()>ans.length())ans=cur;     }    }   }   System.out.println(ans.length());    } }
4	public class A { private Scanner in; private PrintWriter out;  private String INPUT = "";  public void solve() {  String str = in.next();  int n = str.length();  for(int k = n - 1;k >= 1;k--){  HashSet<String> set = new HashSet<String>();  for(int i = 0;i < str.length() - k + 1;i++){   if(!set.add(str.substring(i, i + k))){   out.println(k);   return;   }  }  }  out.println(0); }  public void run() throws Exception {  in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(new StringReader(INPUT));  out = new PrintWriter(System.out);   solve();  out.flush(); }  public static String add(String str, int k) {  StringBuilder mul = new StringBuilder(str);  StringBuilder ret = new StringBuilder();  for(int i = k;i > 0;i >>= 1){  if((i & 1) == 1)ret.append(mul);  mul.append(mul);  }  return ret.toString(); }  public static void main(String[] args) throws Exception {  new A().run(); }  private int ni() { return Integer.parseInt(in.next()); } private static void tr(Object... o) { System.out.println(o.length == 1 ? o[0] : Arrays.toString(o)); } }
5	public class Solution {  public static void main(String [] args) {   Scanner scan = new Scanner(System.in);   int n = scan.nextInt();   int [] a = new int [n];   int i;   int s = 0;   for (i = 0; i < n; i++) {    a[i] = scan.nextInt();    s += a[i];   }   Arrays.sort(a);   int sum = 0;   for (i = n - 1; i > -1; i--) {    sum += a[i];    if (s - sum < sum) {     System.out.println(n - i);     return;    }   }  } }
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(); } }
0	public class ProblemB {    public static void main(String[] args) {   Scanner s = new Scanner(System.in);     int a = s.nextInt();     int f1 = a/10;     int b = a;   int last = a%10;     b/=10;   b/=10;   b*=10;   b+=last;     System.out.println(Math.max(a, Math.max(f1, b)));         } }
2	public class CodeforcesRound176B {   public static void main(String[] args)  {  Scanner kde =new Scanner (System.in);  Long n = kde.nextLong();  Long k = kde.nextLong();  if(((k-1)*(k-2)+2*k)<(n*(long)2))  {  System.out.println(-1);  return;  }  Long a,b;  if(n==1)  {   System.out.println(0);   return;  }    if(k>=n)  {   System.out.println(1);   return;  }  else  {  a=(long)2;  b=k-1;   }   boolean flag =false;  while(true)  {  if(a>=b)  {     break;       }   long c =(a+b)/2;   if(2*(k-c+1)+(k-1+k-c+1)*(c-1)<(n*2))   {   a=c+1;   }   else   {   b=c;   }   flag=true;  }  if(flag==true )  {  System .out.println(a);  }  else  {  System .out.println(a);  }     } }
4	public class j { public static void main(String a[])throws IOException { BufferedReader b=new BufferedReader(new InputStreamReader(System.in)); int n=0,i=0,k=2; String s="\0",r="\0"; s=b.readLine(); n=s.length()-1; while(k<=s.length()) { for(i=0;i<k;i++) { r=s.substring(i,i+n); if(s.indexOf(r)!=s.lastIndexOf(r)) { System.out.print(n); System.exit(0); } } k++; n--; } System.out.print("0"); } }
2	public class C { static final int M = 1000000007;   public static void main(String[] args) throws IOException{  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(in.readLine());   long x = Long.parseLong(st.nextToken());  if(x == 0){  System.out.println(0);  System.exit(0);  }  final long k = Long.parseLong(st.nextToken());  x = x%M;   long ans = (exp(2, k+1)*x - (exp(2, k) - 1))%M;  if(ans < 0) ans += M;  System.out.println(ans);   }  public static long exp(long a, long n){  if(n == 0) return 1;  if(n == 1) return a%M;  if(n%2 == 0) return exp((a*a)%M, n/2);  else return (a*exp((a*a)%M, (n-1)/2))%M; } }
6	public class MaeDosDragoes { public static PrintWriter saida = new PrintWriter(System.out, false); public static class Escanear {   BufferedReader reader;   StringTokenizer tokenizer;  public Escanear() {    this(new InputStreamReader(System.in));   }  public Escanear(Reader in) {    reader = new BufferedReader(in);   }   String proximo() {    if (tokenizer == null || !tokenizer.hasMoreElements()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return tokenizer.nextToken();   }     int proximoNum() {    return Integer.parseInt(proximo());   }  }  public static void main(String[] args) {  Escanear escanear = new Escanear();  int proximoInt = escanear.proximoNum();   long[] aux = new long[proximoInt];   double proximoDouble = escanear.proximoNum();   for(Integer i = 0; i < proximoInt; i++) {    for(Integer j =0; j < proximoInt; j++) {     Integer val = escanear.proximoNum();     if (val.equals(1) || i.equals(j)) {   aux[i] |= 1L << j;   }    }   }   int esquerda = proximoInt/2;   int direita = proximoInt - esquerda;  int maiorMascara = 1 << esquerda;  int[] depois = new int[1 << esquerda];  Integer mascara = 1;  while (mascara < maiorMascara) {  int mascaraAtual = mascara;    for(int j = 0; j < esquerda; j++) {     if (((1 << j) & mascara) > 0) {      mascaraAtual &= aux[j + direita] >> direita;      depois[mascara] = Math.max(depois[mascara], depois[mascara ^ (1 << j)]);     }    }    if (mascara.equals(mascaraAtual)) {     depois[mascara] = Math.max(depois[mascara],Integer.bitCount(mascara));  }  mascara++;  }                                 int auxiliar = 0;   int mascaraMaxima = 1 << direita;   for(int masc = 0; masc < mascaraMaxima; masc++) {    int mascaraCorrente = masc;    int mascaraValor = maiorMascara -1;    for(int j = 0; j < direita; j++) {     if (((1 << j) & masc) > 0) {      mascaraCorrente &= (aux[j] & (mascaraMaxima-1));      mascaraValor &= aux[j] >> direita;     }    }    if (mascaraCorrente != masc) continue;    auxiliar = Math.max(auxiliar, Integer.bitCount(masc) + depois[mascaraValor]);   }   proximoDouble/=auxiliar;   saida.println(proximoDouble * proximoDouble * (auxiliar * (auxiliar-1))/2);   saida.flush();  } }
2	public class virtual1{  static InputReader in = new InputReader();  static PrintWriter out = new PrintWriter(System.out);   public static void main(String[] args) {    long x = in.nextLong();    long k = in.nextLong();    long mod = (long)1e9+7l;       long mul1 = 1;    long mul2 = 2*x-1;    mul2 = mul2%mod;    long pow = k;    long to = 2;    while(pow>0l){     if(pow%2l==1l){      mul1 = mul1*to;      mul1%=mod;     }     to=to*to;     to%=mod;     pow = pow/2l;    }    mul1 = mul1*mul2;    mul1%=mod;    mul1+=1;    if(x!=0)    out.println(mul1%mod);    else    out.println(0);     out.close();   }  static class InputReader  {   BufferedReader br;   StringTokenizer st;    public InputReader()   {    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;   }  } }
1	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 boolean isSq(int x) {   int sq = (int) Math.sqrt(x);   return sq * sq == x;  }  static void solve() {   int n = in.nextInt();   if ((n % 2 == 0 && isSq(n / 2)) || (n % 4 == 0 && isSq(n / 4)))    out.println("YES");   else    out.println("NO");  }  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;   }  } }
4	public class A_YoureGivenAString {     public static void main(String[] args) {   Scanner s = new Scanner(System.in);   String str = s.nextLine();     for (int l = str.length()-1; l >= 1; l--) {    for (int i = 0; i < str.length()-l+1; i++) {     String subs = str.substring(i, i+l);     if(str.lastIndexOf(subs) != i){      System.out.println(l);      return;     }    }   }   System.out.println(0);  } }
2	public class D {   public static void main(String[] args) throws Exception {    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));    PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));       StringTokenizer st = new StringTokenizer(bf.readLine());    int n = Integer.parseInt(st.nextToken());    int k = Integer.parseInt(st.nextToken());       for(int i=0; i<100000; i++) {    long mult = 1L*i*(i+1)/2;    long b = 1L*mult - k;    if(i+b == n*1L) {     out.println(b);     out.close(); System.exit(0);    }    }       out.close(); System.exit(0);   }  }
6	public class ELR {  public static void main(String[] args) {new Thread(null, new Runnable() { public void run() {try {  sol(); } catch (Throwable e) {  e.printStackTrace(); }}}, "2",1<<26).start();}  static int n,k; static boolean adj[][]; static int dp1[],dp2[]; static int myMask[]; static int next1[]; static int m1,m2; public static int solve1(int msk) {  if (dp1[msk] != -1) {  return dp1[msk];  }  int ret = 0;  int tmp = msk;  for (int i = 0 ; i < m1 ; ++i) {  if ( ((msk & (1 << i)) > 0)) {   tmp &= (myMask[i]);  }  }  if (tmp == msk) {  ret = Integer.bitCount(msk);  }  for (int i = 0 ; i < m1 ; ++i) {  if ( (msk & (1 << i)) > 0) {   ret = Math.max(ret, solve1(msk & ~(1 << i)));  }  }  return dp1[msk] = ret; } public static int solve2(int msk) {  if (dp2[msk] != -1) {  return dp2[msk];  }  int ret = 0;  int tmp = msk;  for (int i = 0 ; i < m2 ; ++i) {  if ( ((msk & (1 << i)) > 0)) {   tmp &= (myMask[i + m1]);  }  }  if (tmp == msk) {  ret = Integer.bitCount(msk);  }  for (int i = 0 ; i < m2 ; ++i) {  if ( (msk & (1 << i)) > 0) {   ret = Math.max(ret, solve2(msk & ~(1 << i)));  }  }  return dp2[msk] = ret; } public static void sol() throws Throwable {  Scanner sc = new Scanner(System.in);  n = sc.nextInt();  k = sc.nextInt();  adj = new boolean[n][n];  for (int i = 0 ; i < n ; ++i) {  for (int j = 0 ; j < n ; ++j) {   adj[i][j] = sc.nextInt() == 1;  }  }  m1= (n + 1) / 2;  m2 = n - m1;  dp1 = new int[1 << m1];  dp2 = new int[1 << m2];  next1 = new int[1 << m2];  Arrays.fill(dp1, -1);  Arrays.fill(dp2, -1);  myMask = new int[n];  for (int i = 0 ; i < n ; ++i) {  if (i >= m1) {   for (int j = m1 ; j < n ; ++j) {   if (adj[i][j] || i == j) {    myMask[i] |= (1 << (j - m1));   }   }  } else {   for (int j = m1 ; j < n ; ++j) {   if (adj[i][j]) {    next1[i] |= (1 << (j - m1));   }   }   for (int j = 0 ; j < m1 ; ++j) {   if (adj[i][j] || i == j) {    myMask[i] |= (1 << j);   }   }  }  }  for (int i = 0 ; i < (1 << m1) ; ++i) {  solve1(i);  }  for (int i = 0 ; i < (1 << m2) ; ++i) {  solve2(i);  }  int ans = 0;  for (int msk = 0 ; msk < (1 << m1) ; ++msk) {  int next = (1 << (m2)) - 1;  if (dp1[msk] != Integer.bitCount(msk)) {   continue;  }  for (int i = 0 ; i < m1 ; ++i) {   if ( (msk & (1 << i)) > 0) {   next &= next1[i];   }  }  ans = Math.max(ans, dp1[msk] + dp2[next]);  }  double cont = (k / (ans*1.0));  double edges = (ans) * (ans - 1) / 2.0;  double res = cont * cont * edges;  System.out.println(res);  }  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 {  return Double.parseDouble(next());  }  public boolean ready() throws IOException {  return br.ready();  } } }
5	public class a implements Comparable<a>{   int x, y, id;        public a(int x1, int y1, int id1){   this.x = x1; this.y = y1; this.id = id1;  }   public int compareTo(a o) {   return x - o.x;  }   static int n;  static int arr[];   public static void main(String[] args) {   Scanner in = new Scanner(System.in);        int n = in.nextInt();   arr = new int[n];   int sum = 0;   for (int i=0; i<n; i++){    arr[i] = in.nextInt();    sum +=arr[i];   }   Arrays.sort(arr);   int sum2= 0;   int ans = 0;   for (int i=n-1; i>=0; i--){    sum2+=arr[i];       if (sum2>sum-sum2){     ans = n - i;     break;    }   }   System.out.println(ans);  } }
4	public class Main { private static BufferedReader br; private static StringTokenizer st; private static PrintWriter pw;  public static void main(String[] args) throws Exception {  br = new BufferedReader(new FileReader("input.txt"));  pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));   int qq = Integer.MAX_VALUE;   for(int casenum = 1; casenum <= qq; casenum++) {  int r = readInt();  int c = readInt();  int n = readInt();  int[][] dist = new int[r][c];  for(int i = 0; i < r; i++) {   Arrays.fill(dist[i], 1 << 25);  }  LinkedList<State> q = new LinkedList<State>();  while(n-- > 0) {   q.add(new State(readInt()-1, readInt()-1));   dist[q.peekLast().x][q.peekLast().y] = 0;  }  int[] dx = new int[]{-1,1,0,0};  int[] dy = new int[]{0,0,-1,1};  State ret = q.peekLast();  while(!q.isEmpty()) {   State curr = q.removeFirst();   ret = curr;   for(int k = 0; k < dx.length; k++) {   int nx = curr.x + dx[k];   int ny = curr.y + dy[k];   if(nx >= 0 && nx < r && ny >= 0 && ny < c && dist[nx][ny] > 1 + dist[curr.x][curr.y]) {    dist[nx][ny] = 1 + dist[curr.x][curr.y];    q.add(new State(nx, ny));   }   }  }  pw.println(ret.x+1 + " " + (ret.y+1));  }  exitImmediately(); }  static class State {  public int x,y;  public State(int x, int y) {  super();  this.x = x;  this.y = y;  }   }  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 {  if(!br.ready()) {  exitImmediately();  }  st = null;  return br.readLine(); }  private static String nextToken() throws IOException {  while(st == null || !st.hasMoreTokens()) {  if(!br.ready()) {   exitImmediately();  }  st = new StringTokenizer(br.readLine().trim());  }  return st.nextToken(); } }
5	public class A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   int n = sc.nextInt();   int a = sc.nextInt();   int b = sc.nextInt();   int[] h = new int[n];   for (int i = 0; i < n; i++)    h[i] = sc.nextInt();   Arrays.sort(h);     pw.print(h[b]-h[b-1]);   pw.close();  } }
4	public class x1517D2 {  static final int INF = Integer.MAX_VALUE/3;  public static void main(String hi[]) throws Exception  {   FastScanner infile = new FastScanner();   int N = infile.nextInt();   int M = infile.nextInt();   int K = infile.nextInt();   int[][] weights1 = new int[N][M-1];   for(int r=0; r < N; r++)    weights1[r] = infile.nextInts(M-1);   int[][] weights2 = new int[N-1][M];   for(int r=0; r < N-1; r++)    weights2[r] = infile.nextInts(M);     int[][] res = new int[N][M];   if(K%2 == 1)   {    StringBuilder sb = new StringBuilder();    for(int r=0; r < N; r++)    {     for(int c=0; c < M; c++)      sb.append("-1 ");     sb.append("\n");    }    System.out.print(sb);    return;   }   int[][] dp = new int[N][M];   StringBuilder sb = new StringBuilder();   for(int k=0; k < K/2; k++)   {    int[][] next = new int[N][M];    for(int r=0; r < N; r++)     Arrays.fill(next[r], INF);    for(int r=0; r < N; r++)     for(int c=0; c < M; c++)     {      if(r > 0)       next[r-1][c] = min(next[r-1][c], dp[r][c]+weights2[r-1][c]);      if(r+1 < N)       next[r+1][c] = min(next[r+1][c], dp[r][c]+weights2[r][c]);      if(c > 0)       next[r][c-1] = min(next[r][c-1], dp[r][c]+weights1[r][c-1]);      if(c+1 < M)       next[r][c+1] = min(next[r][c+1], dp[r][c]+weights1[r][c]);     }    dp = next;   }   for(int r=0; r < N; r++)   {    for(int x: dp[r])     sb.append((2*x)+" ");    sb.append("\n");   }   System.out.print(sb);  } } class FastScanner {  private int BS = 1 << 16;  private char NC = (char) 0;  private byte[] buf = new byte[BS];  private int bId = 0, size = 0;  private char c = NC;  private double cnt = 1;  private BufferedInputStream in;  public FastScanner() {   in = new BufferedInputStream(System.in, BS);  }  public FastScanner(String s) {   try {    in = new BufferedInputStream(new FileInputStream(new File(s)), BS);   } catch (Exception e) {    in = new BufferedInputStream(System.in, BS);   }  }  private char getChar() {   while (bId == size) {    try {     size = in.read(buf);    } catch (Exception e) {     return NC;    }    if (size == -1) return NC;    bId = 0;   }   return (char) buf[bId++];  }  public int nextInt() {   return (int) nextLong();  }  public int[] nextInts(int N) {   int[] res = new int[N];   for (int i = 0; i < N; i++) {    res[i] = (int) nextLong();   }   return res;  }  public long[] nextLongs(int N) {   long[] res = new long[N];   for (int i = 0; i < N; i++) {    res[i] = nextLong();   }   return res;  }  public long nextLong() {   cnt = 1;   boolean neg = false;   if (c == NC) c = getChar();   for (; (c < '0' || c > '9'); c = getChar()) {    if (c == '-') neg = true;   }   long res = 0;   for (; c >= '0' && c <= '9'; c = getChar()) {    res = (res << 3) + (res << 1) + c - '0';    cnt *= 10;   }   return neg ? -res : res;  }  public double nextDouble() {   double cur = nextLong();   return c != '.' ? cur : cur + nextLong() / cnt;  }  public double[] nextDoubles(int N) {   double[] res = new double[N];   for (int i = 0; i < N; i++) {    res[i] = nextDouble();   }   return res;  }  public String next() {   StringBuilder res = new StringBuilder();   while (c <= 32) c = getChar();   while (c > 32) {    res.append(c);    c = getChar();   }   return res.toString();  }  public String nextLine() {   StringBuilder res = new StringBuilder();   while (c <= 32) c = getChar();   while (c != '\n') {    res.append(c);    c = getChar();   }   return res.toString();  }  public boolean hasNext() {   if (c > 32) return true;   while (true) {    c = getChar();    if (c == NC) return false;    else if (c > 32) return true;   }  } }
3	public class C455 { static int N; static final int mod = 1_000_000_007; static int[][] memo; static int[] list; public static void main(String[] args) {  FS scan = new FS(System.in);   N = scan.nextInt();  list = new int[N];  for(int i=0;i<N;i++) {  list[i] = scan.next().equals("s")?0:1;  }  if(list[N-1] == 1) {  System.out.println(0);  return;  }  memo = new int[N+1][N+2];  Arrays.fill(memo[N], 1);  int[] sum = new int[N+2];   for(int i=N-1;i>=0;i--) {  sum[0] = memo[i+1][0];  for(int j=1;j<sum.length;j++) {   sum[j] = sum[j-1] + memo[i+1][j];   sum[j] %= mod;  }  for(int j=0;j<=N;j++) {   if (list[i]==1 && (i==0 || list[i-1]==1))   memo[i][j] = memo[i+1][j+1];   else if(i==0 || list[i-1] == 1)   memo[i][j] = memo[i+1][j];   else if (list[i]==1){     memo[i][j] = sum[j+1] - sum[0] + mod;   memo[i][j] %= mod;      }   else if (list[i]==0) {   memo[i][j] = sum[j];   }  }  }       System.out.println(memo[0][0]); }  private static class FS {  BufferedReader br;  StringTokenizer st;  public FS(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());} } }
1	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();   long d = sc.nextLong();   long a[] = new long[n];   for(int i = 0; i < n; ++i)    a[i] = sc.nextLong();   int ans = 0;   for(int i = 1; i < n; ++i) {    if(a[i] - a[i - 1] > 2 * d)     ans += 2;    else if(a[i] - a[i - 1] == 2 * d)     ans++;   }   ans += 2;   w.print(ans);   w.close();   } }
4	public class A {  public static void main(String[] args)  {  new A(new Scanner(System.in));  }  public A(Scanner in)  {  TreeSet<String> ts = new TreeSet<String>();  ArrayList<String> sr = new ArrayList<String>();   String s = in.next();  for (int i=0; i<s.length(); i++)  {   for (int j=i+1; j<=s.length(); j++)   {    String ss = s.substring(i, j);    if (ts.contains(ss))    {     sr.add(ss);    }    ts.add(ss);   }  }   int res = 0;  for (String ss : sr)  {   if (ss.length() > res)    res = ss.length();  }   System.out.printf("%d%n", res);  } }
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()); } }
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);  } } }
6	public class A {  static MyScanner sc;  static PrintWriter pw;  public static void main(String[] args) throws Throwable {   sc = new MyScanner();   pw = new PrintWriter(System.out);   n = sc.nextInt();   int m = sc.nextInt();   int[][] a = new int[n][m];   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     a[i][j] = sc.nextInt();   val = new int[n][n];   for (int i = 0; i < n; i++)    Arrays.fill(val[i], Integer.MAX_VALUE);   for (int i = 0; i < n; i++)    for (int j = i; j < n; j++) {     for (int k = 0; k < m; k++)      val[i][j] = val[j][i] = Math.min(val[i][j], Math.abs(a[i][k] - a[j][k]));    }   val2 = new int[n][n];   for (int i = 0; i < n; i++)    Arrays.fill(val2[i], Integer.MAX_VALUE);   for (int i = 0; i < n; i++)    for (int j = 0; j < n; j++) {     for (int k = 0; k < m - 1; k++)      val2[i][j] = Math.min(val2[i][j], Math.abs(a[i][k] - a[j][k + 1]));    }   mem = new Integer[n][n][1 << n];   int ans = 0;   for (int i = 0; i < n; i++) {    ans = Math.max(ans, dp(i, i, 1 << i));   }   if (n == 1)    pw.println(val2[0][0]);   else    pw.println(ans);    pw.flush();   pw.close();  }  static int n;  static int[][] val, val2;  static Integer[][][] mem;  static int dp(int st, int lst, int msk) {   int bits = Integer.bitCount(msk);   if (mem[st][lst][msk] != null)    return mem[st][lst][msk];   int ans = 0;   for (int i = 0; i < n; i++)    if ((msk & (1 << i)) == 0) {     int newMsk = (msk | (1 << i));     if (bits < n - 1)      ans = Math.max(ans, Math.min(val[lst][i], dp(st, i, newMsk)));     else      ans = Math.max(ans, Math.min(val[lst][i], val2[i][st]));    }   return mem[st][lst][msk] = ans;  }  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;   }  } }
1	public class C364 { static HashMap<Character, Integer> freq; static int unique = 0; public static void main(String[] args) throws Exception {  FastScanner in = new FastScanner();  PrintWriter pw = new PrintWriter(System.out);   int n = in.nextInt();  char[] s = in.next().toCharArray();  freq = new HashMap<Character, Integer>();  for(int i = 0; i < n; i++) {  char c = s[i];  if(!freq.containsKey(c))   freq.put(c, 0);  }   int k = freq.size();  int l = 0, r = 0, best = n;  inc(s[0]);   while(r < n) {  if(unique == k) {   best = Math.min(best, r+1-l);   dec(s[l++]);  }  else {   if(++r == n)   break;   inc(s[r]);  }  }   pw.println(best);   pw.flush();  pw.close(); }  static void inc(char c) {  int cur = freq.get(c);  if(cur == 0)  unique++;  freq.put(c, cur+1); }  static void dec(char c) {  int cur = freq.get(c);  if(cur == 1)  unique--;  freq.put(c, cur-1); }  static class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner() {  br = new BufferedReader(new InputStreamReader(System.in));  st = new StringTokenizer("");  }   String next() throws Exception {  while(!st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }   int nextInt() throws Exception {  return Integer.parseInt(next());  } } }
1	public class A {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   while (s.hasNext()) {    int n = s.nextInt();    int[] a = new int[n];    int odd = 0;    int even = 0;    int po = -1;    int ev = -1;    for(int i=0;i<n;i++){     a[i] = s.nextInt();     if(a[i] % 2 == 0) {      even ++;      ev = i + 1;     } else {      odd++;      po = i + 1;     }    }    if(odd == 1) {     System.out.println(po);    }else{     System.out.println(ev);    }   }  } }
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(); } }
2	public class Main {    public static void main(String[] args) {     Scanner scan=new Scanner(System.in);   long n=scan.nextLong(),k=scan.nextLong();   if(n>((k-2)*(k-1))/2+k){    System.out.println("-1");   } else if(n==1){    System.out.println("0");  } else if(n<=k&&n>1){    System.out.println("1"); } else{    n-=k;    long start=k-2;    long x;    long left=1,right=k-2;       while(left<=right){    x=(left+right)/2;            if(n>cumSum(x, start)){    left=x+1;       } else if(n<cumSum(x-1, start)){ right=x-1;     } else{     System.out.println(1+x);     break; }    }  }  }  public static long cumSum(long x,long start){  return (x*(2*start+1-x))/2;  } }
0	public class p343A {  static long n = 0;  static void resistance(long a, long b)  {   n += a/b;   a %= b;   if(a!=0) resistance(b, a);  }  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   long a = in.nextLong();   long b = in.nextLong();   resistance(a, b);   System.out.println(n);  } }
5	public class Problem111A implements Runnable {  void solve() throws NumberFormatException, IOException {     final int n = nextInt();   final int[] a = new int[n];     long sum = 0;   for (int i = 0; i < n; i++) {    final int nextInt = nextInt();    sum += nextInt;    a[i] = nextInt;   }   Arrays.sort(a);   int currSum = 0;   int maxCoins = 0;   for (int j = a.length - 1; j >= 0; j--) {    currSum += a[j];    maxCoins++;    if (sum - currSum < currSum) {     break;    }   }   System.out.println(maxCoins);  }  StringTokenizer st;  BufferedReader in;  PrintWriter out;  public static void main(String[] args) {     new Problem111A().run();  }  public void run() {   try {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();   } catch (Exception e) {    System.exit(9000);   } 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());  } }
4	public class Main {  static FastReader sc=new FastReader();  static long dp[][][];  static int mod=1000000007;   public static void main(String[] args) throws IOException {                   PrintWriter out=new PrintWriter(System.out);    int ttt=1;       outer :while (ttt-- > 0)   {    int n=i();    int m=i();    int k=i();    int A[][]=input(n,m-1);    int B[][]=input(n-1, m);    dp=new long[n+1][m+1][k+1];    for(int ii=0;ii<n;ii++) {    for(int jj=0;jj<m;jj++) {     Arrays.fill(dp[ii][jj],-1);    }    }    if(k%2!=0) {    for(int i=0;i<n;i++) {     for(int j=0;j<m;j++) {     System.out.print("-1 ");     }     System.out.println();    }    }    else {    go(A, B, 0, 0, k/2, n, m);    for(int i=0;i<n;i++) {    for(int j=0;j<m;j++) {     System.out.print(dp[i][j][k/2]*2+" ");    }    System.out.println();    }    }      }   out.close();                          }  static long go(int A[][],int B[][],int i,int j,int k,int l,int p) {  if(k==0)   return 0;  if(i>=l || j>=p)   return Integer.MAX_VALUE;  if(dp[i][j][k]!=-1)   return dp[i][j][k];    long op1=Long.MAX_VALUE;  if(i+1<l)  op1=Math.min(op1,go(A, B, i+1, j, k-1,l,p)+B[i][j]);  if(i-1>=0)  op1=Math.min(op1,go(A, B, i-1, j, k-1,l,p)+B[i-1][j]);  if(j+1<p)  op1=Math.min(op1,go(A, B, i, j+1, k-1,l,p)+A[i][j]);  if(j-1>=0)   op1=Math.min(op1,go(A, B, i, j-1, k-1,l,p)+A[i][j-1]);  go(A, B, i+1, j, k, l, p);  go(A, B, i, j+1, k, l, p);  return dp[i][j][k]=op1;  }         static int[] input(int n) { int A[]=new int[n];  for(int i=0;i<n;i++) {   A[i]=sc.nextInt();  }  return A;  } static long[] inputL(int n) { long A[]=new long[n];  for(int i=0;i<n;i++) {   A[i]=sc.nextLong();  }  return A;  } static String[] inputS(int n) { String A[]=new String[n];  for(int i=0;i<n;i++) {   A[i]=sc.next();  }  return A;  } static long sum(int A[]) { long 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 void reverse(long A[]) { int n=A.length; long B[]=new long[n]; for(int i=0;i<n;i++) {  B[i]=A[n-i-1]; } for(int i=0;i<n;i++)  A[i]=B[i];  } static void reverse(int A[]) { int n=A.length; int B[]=new int[n]; for(int i=0;i<n;i++) {  B[i]=A[n-i-1]; } for(int i=0;i<n;i++)  A[i]=B[i];  } static void input(int A[],int B[]) {  for(int i=0;i<A.length;i++) {   A[i]=sc.nextInt();   B[i]=sc.nextInt();  } } static int[][] input(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]=i();  } } return A; } static char[][] charinput(int n,int m){ char A[][]=new char[n][m]; for(int i=0;i<n;i++) {  String s=s();  for(int j=0;j<m;j++) {  A[i][j]=s.charAt(j);  } } return A; } static int max(int A[]) { int max=Integer.MIN_VALUE; for(int i=0;i<A.length;i++) {  max=Math.max(max, A[i]); } return max; } static int min(int A[]) { int min=Integer.MAX_VALUE; for(int i=0;i<A.length;i++) {  min=Math.min(min, A[i]); } return min; } static long max(long A[]) { long max=Long.MIN_VALUE; for(int i=0;i<A.length;i++) {  max=Math.max(max, A[i]); } return max; } static long min(long A[]) { long min=Long.MAX_VALUE; for(int i=0;i<A.length;i++) {  min=Math.min(min, A[i]); } return min; } static long [] prefix(long A[]) { long p[]=new long[A.length]; p[0]=A[0]; for(int i=1;i<A.length;i++)  p[i]=p[i-1]+A[i]; return p; } static long [] prefix(int A[]) { long p[]=new long[A.length]; p[0]=A[0]; for(int i=1;i<A.length;i++)  p[i]=p[i-1]+A[i]; return p; } static long [] suffix(long A[]) { long p[]=new long[A.length]; p[A.length-1]=A[A.length-1]; for(int i=A.length-2;i>=0;i--)  p[i]=p[i+1]+A[i]; return p; } static long [] suffix(int A[]) { long p[]=new long[A.length]; p[A.length-1]=A[A.length-1]; for(int i=A.length-2;i>=0;i--)  p[i]=p[i+1]+A[i]; return p; } static void print(int A[]) { for(int i : A) {  System.out.print(i+" "); } System.out.println(); } static void print(long A[]) { for(long i : A) {  System.out.print(i+" "); } System.out.println(); } static long mod(long x) {  int mod=1000000007;  return ((x%mod + mod)%mod); } static String reverse(String s) { StringBuffer p=new StringBuffer(s); p.reverse(); return p.toString(); }   static int i() {   return sc.nextInt();  }  static String s() {   return sc.next();  }  static long l() {   return sc.nextLong();  }   static void sort(int[] A){   int n = A.length;   Random rnd = new Random();   for(int i=0; i<n; ++i){    int tmp = A[i];    int randomPos = i + rnd.nextInt(n-i);    A[i] = A[randomPos];    A[randomPos] = tmp;   }   Arrays.sort(A);  }  static void sort(long[] A){   int n = A.length;   Random rnd = new Random();   for(int i=0; i<n; ++i){    long tmp = A[i];    int randomPos = i + rnd.nextInt(n-i);    A[i] = A[randomPos];    A[randomPos] = tmp;   }   Arrays.sort(A);   } static String sort(String s) {  Character ch[]=new Character[s.length()];  for(int i=0;i<s.length();i++) {   ch[i]=s.charAt(i);  }  Arrays.sort(ch);  StringBuffer st=new StringBuffer("");  for(int i=0;i<s.length();i++) {   st.append(ch[i]);  }  return st.toString(); } static HashMap<Integer,Integer> hash(int A[]){  HashMap<Integer,Integer> map=new HashMap<Integer, Integer>();  for(int i : A) {  if(map.containsKey(i)) {   map.put(i, map.get(i)+1);  }  else {   map.put(i, 1);  }  }  return map; } static TreeMap<Integer,Integer> tree(int A[]){  TreeMap<Integer,Integer> map=new TreeMap<Integer, Integer>();  for(int i : A) {  if(map.containsKey(i)) {   map.put(i, map.get(i)+1);  }  else {   map.put(i, 1);  }  }  return map; }  static boolean prime(int n)   {    if (n <= 1)     return false;    if (n <= 3)     return true;    if (n % 2 == 0 || n % 3 == 0)     return false;    double sq=Math.sqrt(n);     for (int i = 5; i <= sq; i = i + 6)     if (n % i == 0 || n % (i + 2) == 0)      return false;    return true;   }   static boolean prime(long n)   {    if (n <= 1)     return false;    if (n <= 3)     return true;    if (n % 2 == 0 || n % 3 == 0)     return false;    double sq=Math.sqrt(n);     for (int i = 5; i <= sq; i = i + 6)     if (n % i == 0 || n % (i + 2) == 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 class Pair implements Comparable<Pair>  {   int x;   int y;   int z;   Pair(int x,int y,int z){   this.x=x;   this.y=y;   this.z=z;   }  @Override            public int compareTo(Pair o) {  int p=this.x-this.y;  int q=o.x-o.y;  if(p>q)  return 1;  else if(p<q)  return -1;     return 0;   }  }    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;   }  } }
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;   }  } }
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; }
6	public class Main {   static int N, M; static long[] C; static int[][] g; static long[][] DP; public static void main(String[] args) {  InputReader r = new InputReader(System.in);   N = r.nextInt();  M = r.nextInt();   g = new int[N][N];   C = new long[N + 1];   DP = new long[1 << N][N];   for(int k = 0; k < M; k++){  int i = r.nextInt() - 1;  int j = r.nextInt() - 1;    g[i][j] = g[j][i] = 1;  }   for(long[] i : DP)  Arrays.fill(i, -1);   long ret = 0;  for(int s = 0; s < N; s++){  ret += go(s, 1 << s, s);  }   System.out.println(ret / 2); }  private static long go(int s, int m, int e) {  if(DP[m][e] != -1)return DP[m][e];   long cnt = 0;  for(int j = s; j < N; j++)if(g[e][j] == 1){  if((m & (1 << j)) != 0){   if(s == j && Integer.bitCount(m) >= 3){   cnt++;   }  }else{   cnt += go(s, m | 1 << j, j);  }  }  return DP[m][e] = cnt; }  static class InputReader {  private BufferedReader reader;  private StringTokenizer tokenizer;  public InputReader(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());  } } }
3	public class Main {     static BufferedReader in;   static PrintStream out;   static StringTokenizer tok;     @SuppressWarnings("empty-statement") public static void main(String[] args) throws NumberFormatException, IOException, Exception {    in = new BufferedReader(new InputStreamReader(System.in));       out = System.out;       long mod = (long)1e9 + 7;    int n = nextInt();    long[][] dp = new long[n+1][n+1];    Character[] line = new Character[n+1];    line[0] = 'a';    for (int i = 1; i <= n; i++) {     line[i] = nextToken().charAt(0);     if(line[i-1] == 'f')     {      for (int j = 0; j < i; j++) {       dp[i][j+1] = dp[i-1][j];      }     }     else if(line[i-1] == 's')     {      long temp = 0;      for(int j = i; j >=0; j--)      {       temp = (temp + dp[i-1][j]) % mod;       dp[i][j] = temp;      }     }     else dp[i][0] = 1;    }    long total = 0;    for(int j = 0; j <= n; j++)     total = (total + dp[n][j]) % mod;    out.println(total);   }   static String nextToken() throws IOException   {     String line = "";     while(tok == null || !tok.hasMoreTokens()) {       if((line = in.readLine()) != null)         tok = new StringTokenizer(line);       else         return null;     }     return tok.nextToken();   }   static int nextInt() throws NumberFormatException, IOException   {     return Integer.parseInt(nextToken());   }   static long nextLong() throws NumberFormatException, IOException   {     return Long.parseLong(nextToken());   } }
4	public class Main {  static FastScanner sc = new FastScanner(System.in);  static PrintWriter pw = new PrintWriter(System.out);  static StringBuilder sb = new StringBuilder();  static long mod = (long) 1e9 + 7;  public static void main(String[] args) throws Exception {   solve();   pw.flush();  }   static ArrayList<ArrayList<ArrayList<int[]>>> kruscal = new ArrayList<>();  static long ans = Integer.MAX_VALUE;  static int[][][] map;  public static void solve() {   int n = sc.nextInt(), m = sc.nextInt(), k = sc.nextInt();   for(int i = 0; i < n; i++){    kruscal.add(new ArrayList<>());    for(int j = 0; j < m; j++){     kruscal.get(i).add(new ArrayList<>());    }   }   map = new int[n][m][k+1];   for(int i = 0; i < n; i++){    for(int j = 0; j < m-1; j++){         int now = sc.nextInt();     kruscal.get(i).get(j).add(new int[]{now,i,j+1});     kruscal.get(i).get(j+1).add(new int[]{now,i,j});    }   }   for(int i = 0; i < n-1; i++){    for(int j = 0; j < m; j++){         int now = sc.nextInt();     kruscal.get(i).get(j).add(new int[]{now,i+1,j});     kruscal.get(i+1).get(j).add(new int[]{now,i,j});    }   }   if(k % 2 != 0){    for(int i = 0; i < n; i++){     for(int j = 0; j < m; j++){      sb.append(-1).append(" ");     }     pw.println(sb.toString().trim());     sb.setLength(0);    }    return;   }   for(int i = 0; i < n; i++){    for(int j = 0; j < m; j++){     Arrays.fill(map[i][j],Integer.MAX_VALUE/2);     map[i][j][k/2] = 0;    }   }   for(int kk = k/2; kk > 0; kk--){    for(int i = 0; i < n; i++){     for(int j = 0; j < m; j++){      for(int[] next : kruscal.get(i).get(j)){       int d = next[0], i2 = next[1], j2 = next[2];       map[i2][j2][kk-1] = Math.min(map[i2][j2][kk-1],map[i][j][kk]+d);      }     }    }   }   for(int i = 0; i < n; i++){    for(int j = 0; j < m; j++){     sb.append(map[i][j][0]*2).append(" ");    }    pw.println(sb.toString().trim());    sb.setLength(0);   }  }   static void dfs(Stack<Integer> st, int y, int x, int cnt, long total){   if(st.size() == cnt){    ans = Math.min(total,ans);   }   for(int[] next : kruscal.get(y).get(x)){    int d = next[0], i = next[1], j = next[2];    if(Math.abs(i-y)+Math.abs(j-x)-st.size() < 0){     continue;    }    Stack<Integer> stk = (Stack<Integer>)st.clone();    stk.push(d);    dfs(stk,i,j,cnt,total + d);   }   int rem = cnt - st.size();   long tmp = 0;   int c = 0;   while(st.size() > 0){    tmp += st.pop();    c++;    if(rem % c == 0){     ans = Math.min(ans,total + tmp * (rem/c));    }   }  }   static class ArrayComparator implements Comparator<int[]> {   @Override   public int compare(int[] a1, int[] a2) {    for (int i = 0; i < a1.length; i++) {     if (a1[i] < a2[i]) {      return -1;     } else if (a1[i] > a2[i]) {      return 1;     }    }    if (a1.length < a2.length) {     return -1;    } else if (a1.length > a2.length) {     return 1;    } else {     return 0;    }   }  }   private static String ArraysToString(int[] arr){   String s = Arrays.toString(arr);   s = s.replaceAll(",","");   s = s.substring(1,s.length()-1);   return s;  }  static class GeekInteger {   public static void save_sort(int[] array) {    shuffle(array);    Arrays.sort(array);   }   public static int[] shuffle(int[] array) {    int n = array.length;    Random random = new Random();    for (int i = 0, j; i < n; i++) {     j = i + random.nextInt(n - i);     int randomElement = array[j];     array[j] = array[i];     array[i] = randomElement;    }    return array;   }   public static void save_sort(long[] array) {    shuffle(array);    Arrays.sort(array);   }   public static long[] shuffle(long[] array) {    int n = array.length;    Random random = new Random();    for (int i = 0, j; i < n; i++) {     j = i + random.nextInt(n - i);     long randomElement = array[j];     array[j] = array[i];     array[i] = randomElement;    }    return array;   }  } } class DSU {  private int n;  private int[] parentOrSize;  private java.util.ArrayList<java.util.ArrayList<Integer>> map;  public DSU(int n) {   this.n = n;   this.map = new java.util.ArrayList<java.util.ArrayList<Integer>>();   for (int i = 0; i < n; i++) {    this.map.add(new java.util.ArrayList<Integer>());    this.map.get(i).add(i);   }   this.parentOrSize = new int[n];   java.util.Arrays.fill(parentOrSize, -1);  }  int merge(int a, int b) {   if (!(0 <= a && a < n))    throw new IndexOutOfBoundsException("a=" + a);   if (!(0 <= b && b < n))    throw new IndexOutOfBoundsException("b=" + b);   int x = leader(a);   int y = leader(b);   if (x == y)    return x;   if (-parentOrSize[x] < -parentOrSize[y]) {    int tmp = x;    x = y;    y = tmp;   }   parentOrSize[x] += parentOrSize[y];   parentOrSize[y] = x;   this.map.get(x).addAll(this.map.get(y));   return x;  }  boolean same(int a, int b) {   if (!(0 <= a && a < n))    throw new IndexOutOfBoundsException("a=" + a);   if (!(0 <= b && b < n))    throw new IndexOutOfBoundsException("b=" + b);   return leader(a) == leader(b);  }  int leader(int a) {   if (parentOrSize[a] < 0) {    return a;   } else {    parentOrSize[a] = leader(parentOrSize[a]);    return parentOrSize[a];   }  }  int size(int a) {   if (!(0 <= a && a < n))    throw new IndexOutOfBoundsException("" + a);   return -parentOrSize[leader(a)];  }  java.util.ArrayList<java.util.ArrayList<Integer>> groups() {   int[] leaderBuf = new int[n];   int[] groupSize = new int[n];   for (int i = 0; i < n; i++) {    leaderBuf[i] = leader(i);    groupSize[leaderBuf[i]]++;   }   java.util.ArrayList<java.util.ArrayList<Integer>> result = new java.util.ArrayList<>(n);   for (int i = 0; i < n; i++) {    result.add(new java.util.ArrayList<>(groupSize[i]));   }   for (int i = 0; i < n; i++) {    result.get(leaderBuf[i]).add(i);   }   result.removeIf(java.util.ArrayList::isEmpty);   return result;  }  java.util.ArrayList<Integer> getArray(int n) {   return this.map.get(n);  } } class FastScanner {  private BufferedReader reader = null;  private StringTokenizer tokenizer = null;  public FastScanner(InputStream in) {   reader = new BufferedReader(new InputStreamReader(in));   tokenizer = null;  }  public FastScanner(FileReader in) {   reader = new BufferedReader(in);   tokenizer = null;  }  public String next() {   if (tokenizer == null || !tokenizer.hasMoreTokens()) {    try {     tokenizer = new StringTokenizer(reader.readLine());    } catch (IOException e) {     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }  public String nextLine() {   if (tokenizer == null || !tokenizer.hasMoreTokens()) {    try {     return reader.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }   return tokenizer.nextToken("\n");  }  public long nextLong() {   return Long.parseLong(next());  }  public int nextInt() {   return Integer.parseInt(next());  }  public double nextDouble() {   return Double.parseDouble(next());  }  public String[] nextArray(int n) {   String[] a = new String[n];   for (int i = 0; i < n; i++)    a[i] = next();   return a;  }  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;  } }
2	public class Main { public static void main(String args[]) throws IOException  {  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   String S[]=br.readLine().split(" ");  int N=Integer.parseInt(S[0]);  int x=Integer.parseInt(S[1]);  int y=Integer.parseInt(S[2]);  int c=Integer.parseInt(S[3]);  int lo=0;   int hi=1000000000;  while(hi-lo>=10)  {  int steps=(hi+lo)/2;    long total=f(x,y,steps)+f(N-x+1,y,steps)+f(N-x+1,N-y+1,steps)+f(x,N-y+1,steps);    total-=3;    total-=Math.min(steps,x-1);    total-=Math.min(steps,y-1);    total-=Math.min(steps,N-x);    total-=Math.min(steps,N-y);      if(total>=c)   hi=steps+1;  else   lo=steps-1;  }  for(int steps=lo;steps<=hi;steps++)  {    long total=f(x,y,steps)+f(N-x+1,y,steps)+f(N-x+1,N-y+1,steps)+f(x,N-y+1,steps);  total-=3;    total-=Math.min(steps,x-1);    total-=Math.min(steps,y-1);    total-=Math.min(steps,N-x);    total-=Math.min(steps,N-y);      if(total>=c)   {   System.out.println(steps);   return;   }  }  } public static long f(long a, long b, long steps)  {   steps++;  long A=Math.min(a,b);  long B=Math.max(a,b);  long ans=0;  if(steps>=(A+B))  {    ans= A*B;  }  else if(steps<=A)  {    ans= (steps*(steps+1))/2;  }  else if(steps>A&&steps<=B)  {    ans= (A*(A+1))/2+(steps-A)*A;  }  else if(steps>B)  {    ans= (A*(A+1))/2+(B-A)*A+(steps-B)*A-((steps-B)*(steps-B+1))/2;  }   return ans;  } }
5	public class TaskA {  public static void main(String[] args) throws Exception {   Scanner scanner = new Scanner(System.in);   int n = scanner.nextInt();   scanner.nextLine();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = scanner.nextInt();   }   Arrays.sort(a);   int sum = 0;   for (int i = 0; i < n; i++) {    sum += a[i];   }   int take = 0, num = 0;   for (int i = n - 1; i > -1; i--) {    num++;    take += a[i];    sum -= a[i];    if (take > sum) {     break;    }   }   System.out.println(num);  } }
2	public class Solution {  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 fang(int s, int x, int y) {  if (x > y) { int t = x; x = y; y = t; }  if (s + 1 <= x) {  return (long)(s + 1) * (s + 2) / 2;  }  if (s + 1 <= y) {  return (long)x * (x + 1) / 2 + (long)(s + 1 - x) * x;  }  if (s + 1 >= x + y - 1) {  return (long)x * y;  }  long q = x + y - 1 - s - 1;  return (long)x * y - q * (q + 1) / 2; }  long f(int s, int n, int x, int y) {  long ans = fang(s, n - x + 1, n - y + 1) + fang(s, n - x + 1, y) + fang(s, x, n - y + 1) + fang(s, x, y);  ans -= Math.min(s + 1, n - x + 1) + Math.min(s + 1, x) + Math.min(s + 1, n - y + 1) + Math.min(s + 1, y);  return ans + 1; }  void solve() throws Exception {  int n = nextInt();  int x = nextInt(), y = nextInt();  long c = nextInt();  if (c == 1) {  out.println(0);  return;  }  int bg = 0, ed = 2 * n;  while (ed > bg + 1) {  int mm = (bg + ed) / 2;  if (f(mm, n, x, y) >= c) ed = mm; else bg = mm;  }  out.println(ed); }  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();  System.exit(1);  } finally {  out.close();  } }  public static void main(String[] args) {   new Solution().run(); } }
3	public class Main {   public static void main(String[] args) throws Exception{  BufferedReader jk = new BufferedReader(new InputStreamReader( System.in)) ;  PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)) ;  StringTokenizer ana = new StringTokenizer(jk.readLine()) ;  int n = Integer.parseInt(ana.nextToken()) ;    int t[]= new int[101] ;  ArrayList<Integer> v = new ArrayList<>() ;  ana = new StringTokenizer(jk.readLine()) ;  for(int i=0 ; i<n ;i++)  {    int y = Integer.parseInt(ana.nextToken()) ;  t[y]=1 ;   v.add(y) ;  }  Collections.sort(v);  int c= 0;  for(int ele : v)  {  if(t[ele]==1)  {     for(int i=ele ; i<=100 ; i+=ele)   {   t[i]=2 ;   }   c++ ;   }   }  out.println(c);           out.flush(); } }
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; } }
5	public class A {  private void solve() throws IOException {   int n = nextInt();   int a = nextInt();   int b = nextInt();     int[] h = new int[n];     for (int i = 0; i < n; i++)    h[i] = nextInt();     Arrays.sort(h);     int fstB = h[h.length - a];   int lstA = h[h.length - a - 1];     pl((fstB - lstA) > 0 ? (fstB - lstA) : 0);  }  public static void main(String[] args) {   new A().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 {  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}};    static final int MO = 1200;   public static void main(String[] args) {   sc = new FastScanner();   pw = new PrintWriter(System.out);   int N = sc.ni();   int M = sc.ni();   int K = sc.ni();   int[][] LR = new int[N][M-1];   for (int i = 0; i < N; i++) {    LR[i] = sc.intArray(M-1,0);   }   int[][] UD = new int[N-1][M];   for (int i = 0; i < N-1; i++) {    UD[i] = sc.intArray(M,0);   }   if (K%2==0) {    int T = K/2;    int[][] dist = new int[N][M];    for (int step = 1; step <= T; step++) {     int[][] newDist = new int[N][M];     for (int i = 0; i < N; i++) {      for (int j = 0; j < M; j++) {       newDist[i][j] = INF;              if (i > 0) {        newDist[i][j] = Math.min(newDist[i][j],UD[i-1][j]+dist[i-1][j]);       }              if (i < N-1) {        newDist[i][j] = Math.min(newDist[i][j],UD[i][j]+dist[i+1][j]);       }              if (j > 0) {        newDist[i][j] = Math.min(newDist[i][j],LR[i][j-1]+dist[i][j-1]);       }              if (j < M-1) {        newDist[i][j] = Math.min(newDist[i][j],LR[i][j]+dist[i][j+1]);       }      }     }     dist = newDist;    }       for (int i = 0; i < N; i++) {     for (int j = 0; j < M; j++) {      pw.print((2*dist[i][j]) + " ");     }     pw.println();    }   } else {    for (int i = 0; i < N; i++) {     for (int j = 0; j < M; j++) {      pw.print("-1 ");     }     pw.println();    }   }   pw.close();  }   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) {     int ablock = a[0]/MO;     int bblock = b[0]/MO;     if (ablock != bblock)      return ablock-bblock;     else      return a[1]-b[1];    }   });  }   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;   }    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;   }  } }
0	public class CF {   BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st=null;   private void solution() throws IOException{  int n=nextInt();  if((n % 4==0 && n>=4)||(n % 7==0 && n>=7) || (n % 44==0 && n>=44) || (n % 47==0 && n>=47) || (n % 77==0 && n>=77) || (n % 74==0 && n>=74)  || (n % 444==0 && n>=444) || (n % 447==0 && n>=447) || (n % 474==0 && n>=74) || (n % 477==0 && n>=477) || (n % 744==0 && n>=744)  || (n % 747==0 && n>=747) || (n % 777==0 && n>=777) || (n % 774==0 && n>=774)){    System.out.println("YES");  }else{     System.out.println("NO");}   }   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 static void main(String args[]) throws IOException {     new CF().solution();   } }
3	public class ROUGH {  public static class FastReader {  BufferedReader br;  StringTokenizer st;     public FastReader() {  br = new BufferedReader(new InputStreamReader(System.in));  }  String next() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (Exception r) {   r.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  long nextLong() {  return Long.parseLong(next());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (Exception r) {   r.printStackTrace();  }  return str;  } }  public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out)); static long mod = (long) (1e9+7); static int N = (int) 1e5;  public static void main(String[] args) {  FastReader sc = new FastReader();  int n = sc.nextInt();  int[] a = new int[n];  TreeSet<Integer> set = new TreeSet<Integer>();  for(int i=0;i<n;++i) {   a[i] = sc.nextInt();   set.add(a[i]);  }  long ans = 0;  while(set.size() > 0) {   ++ans;   int min = set.first();   TreeSet<Integer> temp = new TreeSet<>();   for(int x : set) {   if(x%min != 0) temp.add(x);   }   set = temp;     }  out.print(ans);    out.close(); }  }
3	public class Solution {   public static void main(String[] args) {    Scanner s=new Scanner(System.in);  int n=s.nextInt();  char[] seq=new char[n];  for(int i=0;i<n;i++){  seq[i]=s.next().charAt(0);  }  long mod=(long)Math.pow(10,9)+7;  long[][] arr=new long[n][n];  arr[0][0]=1;  for(int i=1;i<n;i++){  if(seq[i-1]=='f'){   for(int j=1;j<n;j++){   arr[i][j]=arr[i-1][j-1];   }  }else{   long sum=0;   for(int j=n-1;j>=0;j--){   sum=(sum+arr[i-1][j])%mod;   arr[i][j]=sum;   }  }  }  long ans=0;  for(int i=0;i<n;i++){  ans=(ans+arr[n-1][i])%mod;  }  System.out.println(ans); } }
4	public class FireAgain {  int k, i, j,n,m,x,y;  void run() {   try {    BufferedReader bfd = new BufferedReader(new FileReader("input.txt"));    BufferedWriter out = new BufferedWriter(new FileWriter("output.txt"));    StringTokenizer tk = new StringTokenizer(bfd.readLine());       n = Integer.parseInt(tk.nextToken());    m = Integer.parseInt(tk.nextToken());    boolean vis[][] = new boolean[n][m];    k = Integer.parseInt(bfd.readLine());    tk = new StringTokenizer(bfd.readLine());    Queue<Point> q = new LinkedList<Point>();    Point last = new Point(0,0);    while(k-->0){     x = Integer.parseInt(tk.nextToken())-1;     y = Integer.parseInt(tk.nextToken())-1;     q.add(new Point(x,y));     vis[x][y] = true;    }    while(!q.isEmpty()) {     Point frnt = q.poll();     for(i=frnt.x-1;i<=frnt.x+1;++i)      for(j=frnt.y-1;j<=frnt.y+1;++j)       if(val(i,j)&& !vis[i][j]&&(frnt.x==i||frnt.y==j)){        q.add(new Point(i,j));        last = new Point(i,j);        vis[i][j] = true;       }    }    out.write(last.x+1 + " " +(last.y+1)+"\n");    out.flush();    out.close();   } catch (Exception e) {   }  }   boolean val(int x,int y){   return x>=0&&x<n&&y>=0&&y<m;  }  public static void main(String[] args) {   new FireAgain().run();  } }
6	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();  }  static long gcd(long a,long b){ if(b==0)return a;return gcd(b,a%b); }  static long modPow(long a,long p,long m){ if(a==1)return 1;long ans=1;while (p>0){ if(p%2==1)ans=(ans*a)%m;a=(a*a)%m;p>>=1; }return ans; }  static long modInv(long a,long m){return modPow(a,m-2,m);}  static long sol_x,sol_y,gcd_a_b;  static void extendedEuclid(long a,long b){ if(b==0){gcd_a_b=a;sol_x=1;sol_y=0; } else{ extendedEuclid(b,a%b);long temp = sol_x;sol_x=sol_y;sol_y = temp - (a/b)*sol_y; } }  static class Bhavansort{ Random random;Bhavansort(int a[]){ randomArray(a); sort(a);}Bhavansort(long a[]){ randomArray(a); sort(a);}static int[] sort(int a[]){ Arrays.sort(a);return a;}static long[] sort(long a[]){ Arrays.sort(a);return a; }void randomArray(long a[]){ int n=a.length;for(int i=0;i<n;i++){ int p=random.nextInt(n)%n;long tm=a[i];a[i]=a[p];a[p]=tm; } }void randomArray(int a[]){ int n=a.length;for(int i=0;i<n;i++){ int p=random.nextInt(n)%n;int tm=a[i];a[i]=a[p];a[p]=tm; } }}   public void run() {   InputReader sc = new InputReader(System.in);   PrintWriter out = new PrintWriter(System.out);   int n=sc.nextInt();   int m=sc.nextInt();   int a[][]=new int[n][m];   for (int i = 0; i <n ; i++) {    for (int j = 0; j <m ; j++) {     a[i][j]=sc.nextInt();    }   }   int cost[][]=new int[n][n];   for (int i = 0; i < n; i++) {    for (int j = 0; j <n ; j++) {     cost[i][j]=Integer.MAX_VALUE;     for (int k = 0; k <m ; k++) {      cost[i][j]=Math.min(cost[i][j],Math.abs(a[i][k]-a[j][k]));     }    }   }   int costRight[][]=new int[n][n];   for (int i = 0; i <n ; i++) {    for (int j = 0; j <n ; j++) {     costRight[i][j]=Integer.MAX_VALUE;     for (int k = 0; k <m-1 ; k++) {      costRight[i][j]=Math.min(Math.abs(a[i][k+1]-a[j][k]),costRight[i][j]);     }    }   }      if(n==1){    int ans=Integer.MAX_VALUE;    for (int i = 0; i <m-1 ; i++) {     ans=Math.min(ans,Math.abs(a[0][i]-a[0][i+1]));    }    out.println(ans);    out.close();    return;   }   Long dp[][][]=new Long[n+1][n+1][1<<n];   long max=0;   for (int i = 0; i <n ; i++) {       max=Math.max(max,f(i,i,1<<i,dp,n,cost,costRight));   }   out.println(max);   out.close();  }  long f(int start,int end,int mask,Long dp[][][],int n,int cost[][],int costRight[][]){   if(dp[start][end][mask]!=null)return dp[start][end][mask];   long ans=Integer.MIN_VALUE;   for (int i = 0; i <n ; i++) {    if((mask&(1<<i))==0){     int newMask=mask|(1<<i);     if((1<<n)-1!=(mask|(1<<i))){      ans = Math.max(ans, Math.min(cost[end][i], f(start, i, newMask, dp, n, cost, costRight)));     }     else{      ans=Math.max(ans,Math.min(cost[end][i],costRight[start][i]));     }    }   }   return dp[start][end][mask]=ans;  } }
1	public class Homyak implements Runnable {  private void solve() throws IOException {   int n = nextInt();   String seq = nextToken();   int nh = 0;   int nt = 0;   for (int i = 0; i < n; ++i)    if (seq.charAt(i) == 'H')     ++nh;    else     ++nt;   int res = n;   for (int delta = 0; delta < n; ++delta) {    int changed = 0;    int at = delta;    for (int i = 0; i < nh; ++i) {     if (seq.charAt(at) != 'H')      ++changed;     ++at;     if (at >= n)      at = 0;    }    for (int i = 0; i < nt; ++i) {     if (seq.charAt(at) != 'T')      ++changed;     ++at;     if (at >= n)      at = 0;    }    res = Math.min(res, changed / 2);   }   writer.println(res);  }  public static void main(String[] args) {   new Homyak().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 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));   }  } }
2	public class C {  static long x, k; static long mod = 1000000007; public static void main(String[] args) {  JS in = new JS();  x = in.nextLong();  k = in.nextLong();   if(x==0) {  System.out.println(0);  return;  }   long c = pow(2,k);  if(c==0) c = mod;  long sub = c-1;   long low = ((c*(x%mod))%mod - sub);  while(low < 0) low += mod;  long res = ((low*2)%mod + sub)%mod;   System.out.println(res);    }  static long pow(long a, long p) {  if(p==0) return 1;  if(p==1) return a;  if(p%2==0) {  long res = pow(a,p/2)%mod;  return (res*res)%mod;  }  else {  return (pow(a,p-1)*a)%mod;  }   }  static class JS{  public int BS = 1<<16;  public char NC = (char)0;  byte[] buf = new byte[BS];  int bId = 0, size = 0;  char c = NC;  double num = 1;  BufferedInputStream in;   public JS() {  in = new BufferedInputStream(System.in, BS);  }   public JS(String s) throws FileNotFoundException {  in = new BufferedInputStream(new FileInputStream(new File(s)), BS);  }   public char nextChar(){  while(bId==size) {   try {   size = in.read(buf);   }catch(Exception e) {   return NC;   }     if(size==-1)return NC;   bId=0;  }  return (char)buf[bId++];  }   public int nextInt() {  return (int)nextLong();  }   public long nextLong() {  num=1;  boolean neg = false;  if(c==NC)c=nextChar();  for(;(c<'0' || c>'9'); c = nextChar()) {   if(c=='-')neg=true;  }  long res = 0;  for(; c>='0' && c <='9'; c=nextChar()) {   res = (res<<3)+(res<<1)+c-'0';   num*=10;  }  return neg?-res:res;  }   public double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }   public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }   public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  } } }
3	public class PaintTheNumber {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);  int n=sc.nextInt();   ArrayList<Integer> l=new ArrayList<Integer>();   for(int i=0; i<n; i++) {  l.add(sc.nextInt());  }   boolean c=false;     for(int i=0; i<l.size(); i++) {   if(l.get(i)==-1)   continue;   for(int j=0; j<l.size(); j++) {      if(i==j || l.get(j)==-1)    continue;   else {    if(l.get(j)%l.get(i)==0) {    l.set(j, -1);    }   }   }  }    int nbr=0;  for(int i=0; i<l.size(); i++)   if(l.get(i)!=-1)   nbr++;  System.out.println(nbr); } }
0	public class TaskA extends Thread {  public TaskA(String inputFileName, String outputFileName) {   try {    if (inputFileName != null) {     this.input = new BufferedReader(new FileReader(inputFileName));    } else {     this.input = new BufferedReader(new InputStreamReader(System.in));    }    if (outputFileName != null) {     this.output = new PrintWriter(outputFileName);    } else {     this.output = new PrintWriter(System.out);    }    this.setPriority(Thread.MAX_PRIORITY);   } catch (Throwable e) {    System.err.println(e.getMessage());    e.printStackTrace();    System.exit(666);   }  }  private void solve() throws Throwable {   long n = nextLong();   output.println("0 0 " + n);  }  public void run() {   try {    solve();   } catch (Throwable e) {    System.err.println(e.getMessage());    e.printStackTrace();    System.exit(666);   } finally {    output.close();   }  }  public static void main(String... args) {   new TaskA(null, null).start();  }  private int nextInt() throws IOException {   return Integer.parseInt(next());  }  private double nextDouble() throws IOException {   return Double.parseDouble(next());  }  private long nextLong() throws IOException {   return Long.parseLong(next());  }  private String next() throws IOException {   while (tokens == null || !tokens.hasMoreTokens()) {    tokens = new StringTokenizer(input.readLine());   }   return tokens.nextToken();  }  private StringTokenizer tokens;  private BufferedReader input;  private PrintWriter output; }
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");   }  } }
0	public class A { public static void main(String[] args) throws Throwable{  BufferedReader in=new BufferedReader(new InputStreamReader(System.in));  String ln=in.readLine().trim();  System.out.println(max(parseInt(ln),max(parseInt(ln.substring(0,ln.length()-1)),parseInt(ln.substring(0, ln.length()-2)+ln.substring(ln.length()-1))))); } }
5	public class Solver {  StringTokenizer st;  BufferedReader in;  PrintWriter out;   public long result = 0;  public int k = 0;  public static void main(String[] args) throws NumberFormatException,    IOException {   Solver solver = new Solver();   solver.open();   solver.solve();   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 a = nextInt();   int b = nextInt();     int[] ar = new int[n];     for(int i=0;i<n;i++){    ar[i] = nextInt();   }     Arrays.sort(ar);     out.println(ar[b]-ar[b-1]);  }  public void close() {   out.flush();   out.close();  } }
5	public class Solver {  StringTokenizer st;  BufferedReader in;  PrintWriter out;  public static void main(String[] args) throws NumberFormatException, IOException {   Solver solver = new Solver();   solver.open();   solver.solve();   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[] ar = new int[n];   int sum = 0;     for (int i=0;i<n;i++){    ar[i]=nextInt();    sum+=ar[i];      }     Arrays.sort(ar);     int me = 0;   int k = 0;   while (me<=sum){    k++;    int coin = ar[ar.length-k];    me += coin;    sum -= coin;   }     out.println(k);  }  public void close() {   out.flush();   out.close();  } }
5	public class a { public static void main(String[] args) throws Exception {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int t = sc.nextInt();  int[][] xa = new int[n][2];  for(int i=0; i<n; ++i) {  xa[i][0] = sc.nextInt();  xa[i][1] = sc.nextInt();  }  Arrays.sort(xa, new Comparator<int[]>(){    @Override    public int compare(int[] a0, int[] a1){     return a0[0]-a1[0];    }   });  int ans=2;   for(int i=0; i<n-1; i++){    int s=(xa[i+1][0]*2-xa[i+1][1])-(xa[i][0]*2+xa[i][1]);    if(s>t*2){     ans+=2;    }else if(s==t*2){     ans++;    }   }   System.out.println(ans+""); } }
3	public class C { static final long MOD = 1_000_000_007; public static void main(String[] args) throws Exception {  FastScanner sc = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int N = sc.nextInt();  long[][] dp = new long[N][N];  dp[0][0] = 1L;  for(int i = 0; i < N-1; i++) {  char oper = sc.next().charAt(0);  if(oper == 'f') {   dp[i+1][0] = 0L;   for(int j = 1; j < N; j++) {   dp[i+1][j] = dp[i][j-1];   }  }  else {   dp[i+1][N-1] = dp[i][N-1];   for(int j = N-2; j >= 0; j--) {   dp[i+1][j] = (dp[i+1][j+1] + dp[i][j]) % MOD;   }  }  }  long res = 0;  for(int i = 0; i < N; i++) {  res += dp[N-1][i];  res %= MOD;  }  out.println(res);  out.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);  }  }  } }
5	public class A implements Runnable{  BufferedReader in;  PrintWriter out;  StringTokenizer st;  public static final String filename = "a";  class I implements Comparable<I>{   int x;   int a;   I(int x, int a){    this.x = x;    this.a = a;   }   public int compareTo(I o){    return Double.compare(x, o.x);   }  }  public void solve() throws IOException{   int n = nextInt();   int t = nextInt();   I[] a = new I[n];   for(int i = 0;i < n;i ++){    a[i] = new I(nextInt(), nextInt());   }   int res = 2;   Arrays.sort(a);   for(int i = 1;i < n;i ++){    if((a[i].x - a[i - 1].x - 1.0 * (a[i].a + a[i - 1].a) / 2) >= t)res ++;    if((a[i].x - a[i - 1].x - 1.0 * (a[i].a + a[i - 1].a) / 2) > t)res ++;   }   out.println(res);  }  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());  } }
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(); } }
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);   F2SameSumBlocksHard solver = new F2SameSumBlocksHard();   solver.solve(1, in, out);   out.close();  }  static class F2SameSumBlocksHard {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    long[] a = in.nextLongArray(n);    HashMap<Long, ArrayList<Pair>> hm = new HashMap<>();    long sum;    for (int j = 0; j < n; j++) {     sum = 0;     for (int i = j; i >= 0; i--) {      sum += a[i];      if (!hm.containsKey(sum))       hm.put(sum, new ArrayList<>());      hm.get(sum).add(new Pair(i + 1, j + 1));     }    }    ArrayList<Pair> al1 = new ArrayList<>();    ArrayList<Pair> al2 = new ArrayList<>();    int prev;    for (ArrayList<Pair> al : hm.values()) {     prev = 0;     al1.clear();     for (Pair p : al) {      if (p.x > prev) {       al1.add(p);       prev = p.y;      }     }     if (al1.size() > al2.size())      al2 = new ArrayList<>(al1);    }    out.println(al2.size());    for (Pair p : al2)     out.println(p.x + " " + p.y);   }  }  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[8192];   private int curChar;   private int snumChars;   private InputReader.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 long[] nextLongArray(int n) {    long a[] = new long[n];    for (int i = 0; i < n; i++)     a[i] = nextLong();    return a;   }   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);   }  }  static class Pair implements Comparable<Pair> {   public int x;   public int y;   public Pair(int x, int y) {    this.x = x;    this.y = y;   }   public boolean equals(Object obj) {    if (obj == null)     return false;    if (obj == this)     return true;    if (!(obj instanceof Pair))     return false;    Pair o = (Pair) obj;    return o.x == this.x && o.y == this.y;   }   public int hashCode() {    return this.x + this.y;   }   public int compareTo(Pair p) {    if (x == p.x)     return Integer.compare(y, p.y);    return Integer.compare(x, p.x);   }  }  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();   }  } }
0	public class Problem1 {   public static void main(String[] args) {   Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  if (n < 0) {    int first = n / 10;  int second = (n / 100)*10 + (n % 10);  if (first > second)   System.out.println(first);  else   System.out.println(second);  } else {  System.out.println(n);  } } }
2	public class Main { public static void main(String[] args) throws Exception {  Scanner scan = new Scanner(System.in);  long n = scan.nextLong();  long k = scan.nextLong();  long total = k * (k - 1) / 2 + 1;  if (total < n) {  System.out.println(-1);  return;  }   long left = total - n;  long low = 1;  long high = k - 1;  while (low < high) {  long mid = (low + high) / 2;  long temp = mid * (mid + 1) / 2;  if (temp < left) {   low = mid + 1;  } else {   high = mid;  }  }  long temp = low * (low + 1) / 2;  if (temp == left) {  System.out.println(k - 1 - low);  } else {  System.out.println(k - low);  } } }
6	public class Main {  public static void main(String[] args) throws IOException {   FastScanner scanner = new FastScanner();   int n = scanner.nextInt();   int m = scanner.nextInt();   boolean graph[][] = new boolean[n][n];   for (int i = 0; i < m; i++) {    int a = scanner.nextInt();    int b = scanner.nextInt();    graph[a-1][b-1] = true;    graph[b-1][a-1] = true;   }   if(n <= 2) {    System.out.println(0);    return;   }   long dp[][] = new long[1<<n][n];   for (int i = 0; i < (1<<n); i++) {    Arrays.fill(dp[i], -1);   }   for (int i = 1; i < (1<<n); i++) {    for (int j = 0; j < n; j++) {     f(i, j, dp, graph, n);    }   }   long sum = 0;          for (int i = 0; i < n; i++) {    for (int j = 0; j < (1 << n); j++) {     if(Integer.bitCount(j) >= 3 && graph[Integer.numberOfTrailingZeros(j)][i]) {      sum += dp[j][i];     }    }   }   System.out.println(sum/2);  }  private static long f(int mask, int i, long[][] dp, boolean[][] graph, int n) {   if(dp[mask][i] != -1) return dp[mask][i];   if(Integer.bitCount(mask) == 1 && (mask&(1<<i)) != 0) {    dp[mask][i] = 1;   } else if(Integer.bitCount(mask) > 1 && (mask&(1<<i)) != 0 && i != Integer.numberOfTrailingZeros(mask)) {    dp[mask][i] = 0;    for (int j = 0; j < n; j++) {     if(graph[i][j]) dp[mask][i] = dp[mask][i] + f(mask^(1<<i), j, dp, graph, n);    }   } else {    dp[mask][i] = 0;   }       return dp[mask][i];  }  static class FastScanner {   BufferedReader br;   StringTokenizer st;   FastScanner() {    br = new BufferedReader(new InputStreamReader(System.in));   }   String next() throws IOException {    while (st == null || !st.hasMoreTokens()) {     st = new StringTokenizer(br.readLine());    }    return st.nextToken();   }   int nextInt() throws IOException {    return Integer.parseInt(next());   }  } }
0	public class Arbuz {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   if (n % 4 == 0 || n % 7 == 0 || n % 47 == 0 || n % 74 == 0 || n % 444 == 0 || n % 447 == 0 || n % 474 == 0 || n % 477 == 0) {    System.out.println("YES");   } else {    System.out.println("NO");   }  } }
2	public class B { public static void main(String[] args){  FastScanner sc = new FastScanner();  long n = sc.nextLong();  int k = sc.nextInt();   if(n==1){  System.out.println(0);  return;  }  n=n-1;  int count = 0;  long nextK = k-1;  while(true){      if(nextK < 1 || (nextK <= 1 && n >1)){   System.out.println(-1);   return;  }    nextK = Math.min(n, nextK);  if(n==nextK){   System.out.println(count+1);   return;  }        long bSum = nextK * (nextK+1)/2;  long a = nextK;  long decrement = 1;  while(bSum - (a-1)*a/2 <= n && a>=1){   a-= decrement;   decrement *= 2;  }  a+=decrement/2;        count += nextK-a+1;    long nDecr = bSum-a*(a-1)/2;      n -= nDecr;  nextK = a-1;  if(n==0){   System.out.println(count);   return;  }  } }  public static class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner(String s) {  try {   br = new BufferedReader(new FileReader(s));  } catch (FileNotFoundException e) {     e.printStackTrace();  }  }  public FastScanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  String nextToken() {  while (st == null || !st.hasMoreElements()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {      e.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(nextToken());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  } } }
5	public class Village {  private class House implements Comparable<House> {  Double Coordinate;  Double Sidelength;  private House(double coordinate, double sidelength) {  Coordinate = coordinate;  Sidelength = sidelength;  }  public int compareTo(House o) {  return Coordinate.compareTo(o.Coordinate);  } }  private void solve() {  Scanner in = new Scanner(System.in);  in.next();  double requireside = in.nextDouble();  ArrayList<House> coordinate = new ArrayList<House>();  while (in.hasNext()) {  double coo = in.nextDouble();  double side = in.nextDouble();  coordinate.add(new House(coo, side));  }  Collections.sort(coordinate);  ArrayList<Double> edges = new ArrayList<Double>();  int count = 2;  for (int i = 0; i < coordinate.size(); i++) {  edges.add(coordinate.get(i).Coordinate   - (double) coordinate.get(i).Sidelength / (double) 2);  edges.add(coordinate.get(i).Coordinate   + (double) coordinate.get(i).Sidelength / (double) 2);  }  ArrayList<Double> difference = new ArrayList<Double>();  for (int i = 1; i < edges.size() - 1; i++) {  difference.add(Math.abs(edges.get(i) - edges.get(i + 1)));  }  for (int i = 0; i < difference.size(); i += 2) {  if (difference.get(i) == requireside)   count++;  else if (difference.get(i) > requireside)   count += 2;  }  System.out.println(count); }  public static void main(String args[]) {  Village v = new Village();  v.solve(); } }
1	public class _1036_B_DiagonalWalkingV2 {  public static void main(String[] args) throws IOException {  int Q = readInt();  while(Q-- > 0) {  long n = readLong(), m = readLong(), k = readLong();  if(Math.max(n, m) > k) println(-1);  else {   long ans = k;   if(n%2 != k%2) ans--;   if(m%2 != k%2) ans--;   println(ans);  }  }  exit(); }  final private static int BUFFER_SIZE = 1 << 16; private static DataInputStream din = new DataInputStream(System.in); private static byte[] buffer = new byte[BUFFER_SIZE]; private static int bufferPointer = 0, bytesRead = 0; static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  public static 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 static String read() throws IOException {  byte[] ret = new byte[1024];  int idx = 0;  byte c = Read();  while (c <= ' ') {  c = Read();  }  do {  ret[idx++] = c;  c = Read();  } while (c != -1 && c != ' ' && c != '\n' && c != '\r');  return new String(ret, 0, idx); }  public static int readInt() 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 static long readLong() 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 static double readDouble() 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 static void fillBuffer() throws IOException {  bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);  if (bytesRead == -1)  buffer[0] = -1; }  private static byte Read() throws IOException {  if (bufferPointer == bytesRead)  fillBuffer();  return buffer[bufferPointer++]; }  static void print(Object o) {  pr.print(o); }  static void println(Object o) {  pr.println(o); }  static void flush() {  pr.flush(); }  static void println() {  pr.println(); }  static void exit() throws IOException {  din.close();  pr.close();  System.exit(0); } }
3	public class SameSumBlocks {  public static void main(String[] args) throws Exception {   FastScanner sc = new FastScanner();   PrintWriter out = new PrintWriter(System.out);   int N = sc.nextInt();   int[] pre = new int[N + 1];   for (int i = 1; i <= N; i++) {    pre[i] = pre[i - 1] + sc.nextInt();   }    Pair[] sums = new Pair[N * (N + 1) / 2];   int k = 0;   for (int i = 1; i <= N; i++) {    for (int j = i; j <= N; j++) {     int sum = pre[j] - pre[i - 1];     sums[k++] = new Pair(i, j, sum);    }   }   Arrays.sort(sums, (p1, p2) -> p1.sum - p2.sum != 0 ? p1.sum - p2.sum : p1.r - p2.r);   var ans = new ArrayList<Pair>();   int i = 0;   while (i < k) {    var group = new ArrayList<Pair>();    int last = 0;    int j = i;    while (j < k && sums[j].sum == sums[i].sum) {     if (sums[j].l > last) {      group.add(sums[j]);      last = sums[j].r;     }     j++;    }    if (group.size() > ans.size()) {     ans = group;    }    i = j;   }   out.println(ans.size());   for (Pair p : ans) {    out.println(p);   }   out.close();  }  static class Pair {   int l, r, sum;   public Pair(int ll, int rr, int ss) {    l = ll; r = rr; sum = ss;   }   public String toString() {    return l + " " + r;   }  }  static class FastScanner {   private int BS = 1<<16;   private char NC = (char)0;   private byte[] buf = new byte[BS];   private int bId = 0, size = 0;   private char c = NC;   private double cnt = 1;   private BufferedInputStream in;   public FastScanner() {    in = new BufferedInputStream(System.in, BS);   }   public FastScanner(String s) {    try {     in = new BufferedInputStream(new FileInputStream(new File(s)), BS);    }    catch (Exception e) {     in = new BufferedInputStream(System.in, BS);    }   }   private char getChar(){    while(bId==size) {     try {      size = in.read(buf);     }catch(Exception e) {      return NC;     }     if(size==-1)return NC;     bId=0;    }    return (char)buf[bId++];   }   public int nextInt() {    return (int)nextLong();   }   public int[] nextInts(int N) {    int[] res = new int[N];    for (int i = 0; i < N; i++) {     res[i] = (int) nextLong();    }    return res;   }   public long[] nextLongs(int N) {    long[] res = new long[N];    for (int i = 0; i < N; i++) {     res[i] = nextLong();    }    return res;   }   public long nextLong() {    cnt=1;    boolean neg = false;    if(c==NC)c=getChar();    for(;(c<'0' || c>'9'); c = getChar()) {     if(c=='-')neg=true;    }    long res = 0;    for(; c>='0' && c <='9'; c=getChar()) {     res = (res<<3)+(res<<1)+c-'0';     cnt*=10;    }    return neg?-res:res;   }   public double nextDouble() {    double cur = nextLong();    return c!='.' ? cur:cur+nextLong()/cnt;   }   public String next() {    StringBuilder res = new StringBuilder();    while(c<=32)c=getChar();    while(c>32) {     res.append(c);     c=getChar();    }    return res.toString();   }   public String nextLine() {    StringBuilder res = new StringBuilder();    while(c<=32)c=getChar();    while(c!='\n') {     res.append(c);     c=getChar();    }    return res.toString();   }   public boolean hasNext() {    if(c>32)return true;    while(true) {     c=getChar();     if(c==NC)return false;     else if(c>32)return true;    }   }  } }
1	public class Main {  static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));  static StringTokenizer tok;  static boolean hasNext()  {   while(tok==null||!tok.hasMoreTokens())    try{     tok=new StringTokenizer(in.readLine());    }    catch(Exception e){     return false;    }   return true;  }  static String next()  {   hasNext();   return tok.nextToken();  }  static long nextLong()  {   return Long.parseLong(next());  }  static int nextInt()  {   return Integer.parseInt(next());  }  static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));  public static void main(String[] args) {   int n = nextInt();   int a[] = new int[9];   int b[] = new int[9];   for(int i=0;i<n;i++){    String s = next();    if(s.equals("M")){     a[0]++;    }else if (s.equals("L")){     a[1]++;    }    else if (s.equals("XL")){     a[2]++;    }    else if (s.equals("XXL")){     a[3]++;    }    else if (s.equals("XXXL")){     a[4]++;    }    else if (s.equals("S")){     a[5]++;    }    else if (s.equals("XS")){     a[6]++;    }    else if (s.equals("XXS")){     a[7]++;    }    else if (s.equals("XXXS")){     a[8]++;    }   }   for(int i=0;i<n;i++){    String s = next();    if(s.equals("M")){     b[0]++;    }else if (s.equals("L")){     b[1]++;    }    else if (s.equals("XL")){     b[2]++;    }    else if (s.equals("XXL")){     b[3]++;    }    else if (s.equals("XXXL")){     b[4]++;    }    else if (s.equals("S")){     b[5]++;    }    else if (s.equals("XS")){     b[6]++;    }    else if (s.equals("XXS")){     b[7]++;    }    else if (s.equals("XXXS")){     b[8]++;    }   }   int ans = 0;   ans+=Math.abs(a[2]-b[2]);   ans+=Math.abs(a[3]-b[3]);   ans+=Math.abs(a[4]-b[4]);   int max = Math.abs(a[0]-b[0]);   max = max(max,Math.abs(a[1]-b[1]));   max = max(max,Math.abs(a[5]-b[5]));   ans+=max;   out.print(ans);   out.flush();  }  public static int max(int a,int b){   return a>b?a:b;  } }
3	public class A{     public static int mod = 1000000007;     public static void main(String args[]){    Scanner sc = new Scanner(System.in);    int n = sc.nextInt();    char s[] = new char[n];    for(int i = 0; i < n; i++)      s[i] = sc.next().charAt(0);    int dp[][] = new int[5001][5001];    int sum[][] = new int[5001][5001];    dp[0][0] = 1;    sum[0][0] = 1;    for(int i = 1; i < n; i++){      for(int j = n - 1; j >= 0; j--){        if(s[i-1] == 'f' && j > 0){          dp[i][j] = dp[i-1][j-1] % mod;        }else if(s[i-1] == 's'){          dp[i][j] = sum[i-1][j] % mod;        }        sum[i][j] = (sum[i][j+1] + dp[i][j]) % mod;      }    }    System.out.println(sum[n-1][0]);   } }
3	public class Q3 {  static class Pair {   int a;   int b;   Pair(int p, int q) {    a = p;    b = q;   }  }  public static void main(String[] args) {   InputReader in = new InputReader();   int N = in.nextInt();   int arr[] = new int[N];   for (int i = 0; i < N; i++)    arr[i] = in.nextInt();   HashMap<Integer, ArrayList<Pair>> name = new HashMap<>();   for (int i = 0; i < N; i++) {    int sum = 0;    for (int j = i; j < N; j++) {     sum += arr[j];     if (name.get(sum) == null)      name.put(sum, new ArrayList());     name.get(sum).add(new Pair(i+1, j+1));    }   }   HashSet<Pair> ans = new HashSet<>();   for (ArrayList<Pair> n : name.values()) {    Collections.sort(n, new Comparator<Pair>() {     @Override     public int compare(Pair o1, Pair o2) {      if (Integer.compare(o1.b, o2.b) == 0)       return Integer.compare(o1.a, o2.a);      return Integer.compare(o1.b, o2.b);     }    });     HashSet<Pair> temp = new HashSet<>();    temp.add(n.get(0));    int num = 1;    int r = n.get(0).b;    for (int i = 1; i < n.size(); i++) {     if (n.get(i).a > r) {      num++;      r = n.get(i).b;      temp.add(n.get(i));     }    }     if (num > ans.size())     ans = temp;   }   System.out.println(ans.size());   for (Pair val : ans)    System.out.println(val.a + " " + val.b);   }  static class InputReader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public int[] shuffle(int[] arr) {    Random r = new Random();    for (int i = 1, j; i < arr.length; i++) {     j = r.nextInt(i);     arr[i] = arr[i] ^ arr[j];     arr[j] = arr[i] ^ arr[j];     arr[i] = arr[i] ^ arr[j];    }    return arr;   }   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 int gcd(int a, int b) {    return b == 0 ? a : gcd(b, a % b);   }   public static int[] uwiSieve(int n) {    if (n <= 32) {     int[] primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31};     for (int i = 0; i < primes.length; i++) {      if (n < primes[i]) {       return Arrays.copyOf(primes, i);      }     }     return primes;    }    int u = n + 32;    double lu = Math.log(u);    int[] ret = new int[(int) (u / lu + u / lu / lu * 1.5)];    ret[0] = 2;    int pos = 1;    int[] isp = new int[(n + 1) / 32 / 2 + 1];    int sup = (n + 1) / 32 / 2 + 1;    int[] tprimes = {3, 5, 7, 11, 13, 17, 19, 23, 29, 31};    for (int tp : tprimes) {     ret[pos++] = tp;     int[] ptn = new int[tp];     for (int i = (tp - 3) / 2; i < tp << 5; i += tp)      ptn[i >> 5] |= 1 << (i & 31);     for (int i = 0; i < tp; i++) {      for (int j = i; j < sup; j += tp)       isp[j] |= ptn[i];     }    }           int[] magic = {0, 1, 23, 2, 29, 24, 19, 3, 30, 27, 25, 11, 20, 8, 4, 13, 31, 22, 28, 18, 26, 10, 7, 12, 21, 17,      9, 6, 16, 5, 15, 14};    int h = n / 2;    for (int i = 0; i < sup; i++) {     for (int j = ~isp[i]; j != 0; j &= j - 1) {      int pp = i << 5 | magic[(j & -j) * 0x076be629 >>> 27];      int p = 2 * pp + 3;      if (p > n)       break;      ret[pos++] = p;      for (int q = pp; q <= h; q += p)       isp[q >> 5] |= 1 << (q & 31);     }    }    return Arrays.copyOf(ret, pos);   }   public static int[] radixSort(int[] f) {    return radixSort(f, f.length);   }   public static int[] radixSort(int[] f, int n) {    int[] to = new int[n];    {     int[] b = new int[65537];     for (int i = 0; i < n; i++) b[1 + (f[i] & 0xffff)]++;     for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];     for (int i = 0; i < n; 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 < n; i++) b[1 + (f[i] >>> 16)]++;     for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];     for (int i = 0; i < n; i++) to[b[f[i] >>> 16]++] = f[i];     int[] d = f;     f = to;     to = d;    }    return f;   }  } }
4	public class a23 {  public static void main(String args[])throws IOException  {   InputStreamReader read=new InputStreamReader(System.in);   BufferedReader in=new BufferedReader(read);   String s,subs;     s=in.readLine();   int i,j,k,l=0,a=1,sl=0;   for(i=0;i<s.length();i++)   {    a=1;    for(j=i;j<s.length();j++)    {     subs=s.substring(i,i+a);     for(k=i;k<(s.length()-a+1);k++)     {      if(subs.compareTo(s.substring(k,k+a))==0)      l++;      if(l==2)      {       if(a>sl)       sl=a;       l=0;       break;      }     }     l=0;     a++;    }   }   System.out.println(sl);  } }
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); } }
3	public class Main { HashMap<Integer,Pair> map; int n,a[]; private void solve()throws IOException {  n=nextInt();  a=new int[n+1];  for(int i=1;i<=n;i++)  a[i]=nextInt();  map=new HashMap<>();  for(int i=1;i<=n;i++)  {  int sum=0;  for(int j=i;j>=1;j--)  {   sum+=a[j];   if(!map.containsKey(sum))   map.put(sum,new Pair(i,1));   else   {   Pair p=map.get(sum);   if(p.pos<j)    map.put(sum,new Pair(i,p.cnt+1));   }  }  }  int sum=0,ans=0;  for(int i:map.keySet())  if(map.get(i).cnt>ans)  {   ans=map.get(i).cnt;   sum=i;  }  out.println(ans);  ArrayList<String> list=new ArrayList<>();  for(int i=1,prev=0;i<=n;i++)  {  int s=0;  for(int j=i;j>=1;j--)  {   s+=a[j];   if(s==sum && j>prev)   {   list.add(j+" "+i);   prev=i;   }  }  }  for(String s:list)  out.println(s); } class Pair{  int pos,cnt;  Pair(int a,int b){   pos=a;   cnt=b;  } }    public void run()throws IOException {  br=new BufferedReader(new InputStreamReader(System.in));  st=null;  out=new PrintWriter(System.out);  solve();   br.close();  out.close(); } public static void main(String args[])throws IOException{  new Main().run(); } BufferedReader br; StringTokenizer st; PrintWriter out; String nextToken()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(nextToken()); } long nextLong()throws IOException{  return Long.parseLong(nextToken()); } double nextDouble()throws IOException{  return Double.parseDouble(nextToken()); } }
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);  } }
3	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[] arr = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = in.nextInt();   }   Arrays.sort(arr);   int cnt = 0;   int pos = 0;   while (true) {    while (pos < n && arr[pos] == -1) pos++;    if (pos == n) break;    int min = arr[pos];    arr[pos] = -1;    cnt++;    for (int i = pos + 1; i < n; i++) {     if (arr[i] % min == 0) {      arr[i] = -1;     }    }   }   System.out.println(cnt);  } }
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;    }   }  } }
6	public class cf2{ static int x0; static int y0; static int x1; static int y1; static HashMap<Integer,HashSet<Integer>>allowed; static HashMap<Integer,HashMap<Integer,Integer>>cost; static int []dx= {-1,-1,-1,0,0,0,1,1,1}; static int []dy= {-1,0,1,-1,0,1,-1,0,1}; static int highbound=(int)1e9; static boolean valid(int i,int j) {  if(i>=1 && i<=highbound && j>=1 && j<=highbound && allowed.containsKey(i) && allowed.get(i).contains(j))return true;  return false; } static long ans; static class Triple implements Comparable<Triple> {  int i,j,cost;  Triple(int x, int y, int z){i = x; j = y; cost = z;}   public int compareTo(Triple t) {  return this.cost - t.cost;  }  public String toString() {  return i+" "+j+" "+cost;  }   } public static int dijkstra() {  PriorityQueue<Triple> q = new PriorityQueue<Triple>();  q.add(new Triple(x0,y0,0));  HashMap<Integer,Integer>z=new HashMap<Integer,Integer>();z.put(y0,0);  cost.put(x0,z);  while(!q.isEmpty())  {   Triple cur = q.remove();    if(cur.cost > cost.getOrDefault(cur.i,new HashMap<Integer,Integer>()).getOrDefault(cur.j,1000000000))   continue;  for(int k = 0; k < 9; k++)  {   int x = cur.i + dx[k];   int y = cur.j + dy[k];   int c=cost.getOrDefault(x,new HashMap<Integer,Integer>()).getOrDefault(y,1000000000);   if(valid(x,y) && cur.cost +1 < c)   {   HashMap<Integer,Integer>zz=new HashMap<Integer,Integer>();zz.put(y,cur.cost+1);   cost.put(x,zz);   q.add(new Triple(x,y,cur.cost+1));   }  }  }     return cost.getOrDefault(x1,new HashMap<Integer,Integer>()).getOrDefault(y1,-1); } static int t;static int n; static int []ds; static int []gs; static int [][]memo; static int dp(int lastg,int msk,int sum) {  if(sum==t)return 1;  if(msk==(1<<n)-1) {  return 0;  }  if(memo[lastg][msk]!=-1)return memo[lastg][msk];  int tot=0;  for(int i=0;i<n;i++) {  if(((1<<i)&msk)==0 && gs[i]!=lastg) {   tot=(tot+dp(gs[i],msk|(1<<i),sum+ds[i]))%(1000000007);  }  }  return memo[lastg][msk]=tot; }  public static void main(String[] args) throws IOException{   MScanner sc = new MScanner(System.in);   PrintWriter pw=new PrintWriter(System.out);   n=sc.nextInt();   t=sc.nextInt();   ds=new int[n];gs=new int[n];   for(int i=0;i<n;i++) {   ds[i]=sc.nextInt();gs[i]=sc.nextInt();   }   memo=new int[4][1<<n];   for(int []i:memo)Arrays.fill(i,-1);   pw.println(dp(0, 0,0));   pw.flush();  }  static long gcd(long a, long b) {   if (b == 0)  return a;  return gcd(b, a % b); }  static int[]primes;  static int sizeofp=0; static int[] isComposite;  static void sieve(int N)  {  isComposite = new int[N+1];    isComposite[0] = isComposite[1] = 1;   primes = new int[N];   for (int i = 2; i <= N; ++i)     if (isComposite[i] == 0)     {   primes[sizeofp++]=i;;   if(1l * i * i <= N)   for (int j = i * i; j <= N; j += i)    isComposite[j] = 1;  }  }  static class pair implements Comparable<pair>{  int num;int idx;  pair(int x,int y){   num=x;idx=y;  }  @Override  public int compareTo(pair o) {  if(num!=o.num) {   return num-o.num;  }  return idx-o.idx;  }  @Override   public int hashCode()   {    return Objects.hash(num,idx) ;   }  public boolean equals(pair o) {  if(this.compareTo(o)==0)return true;  return false;  }  public String toString() {  return "("+0+" "+0+")";  }  } static class MScanner  {  StringTokenizer st;  BufferedReader br;   public MScanner(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();}   } }
1	public class A implements Runnable { String file = "input";  void init() throws IOException {   input = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new BufferedOutputStream(System.out)); }  void solve() throws IOException {  int odd = 0, even = 0;  int n = nextInt();  int[] a = new int[n];  for(int i = 0; i < n; i++)  {  a[i] = nextInt();  if(a[i] % 2 == 0) even++;  else odd++;  }  if(even >= 2)  {  for(int i = 0; i < n; i++) if(a[i] % 2 == 1)  {   System.out.println(i + 1);   return;  }  }  else  {  for(int i = 0; i < n; i++) if(a[i] % 2 == 0)  {   System.out.println(i + 1);   return;  }  } }  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;  public static void main(String[] args) throws IOException {  new Thread(null, new A(), "", 1 << 20).start(); }  public void run() {  try  {  init();  solve();  out.close();   }  catch(Exception e)  {  e.printStackTrace();  System.exit(1);  } } }
5	public class ProblemA {  static ArrayList<Point2> houses = new ArrayList<Point2>();   public static void main(String[] args) {   ProblemA a = new ProblemA();   Scanner in = new Scanner(System.in);   while(in.hasNextInt()){    int n = in.nextInt();    double t = in.nextDouble();    for (int k=0;k<n;k++){     houses.add(a.new Point2(in.nextDouble(),in.nextDouble()));    }    Collections.sort(houses);    int ans = 2;    for (int k=0;k<n-1;k++){     Point2 cur = houses.get(k);     Point2 next = houses.get(k+1);     double dist = (next.x - next.y/2) - (cur.x + cur.y/2);     if (dist == t) ans ++;     if (dist > t ) ans+=2;    }    System.out.println(ans);   }  }   public class Point2 implements Comparable<Point2>{   public double x;   public double y;   public Point2(double one, double two){    x = one;    y = two;   }     public int compareTo(Point2 other){    if (x - other.x > 0) return 1;    if (x - other.x < 0) return -1;    return 0;   }     public String toString(){    return "x:" + x + " y:" + y;   }  } }
5	public class TaskA implements Runnable { private InputReader in; private PrintWriter out;  public static void main(String[] args) {  new TaskA().run(); }  public TaskA() {      in = new InputReader(System.in);  out = new PrintWriter(System.out); }  public void run() {    int n = in.readInt();  int min = 101;  int[] a = new int[n];  for (int i = 0; i < n; i++)  min = Math.min(min, a[i] = in.readInt());  int ans = 101;  for (int i = 0; i < n; i++) {  if (a[i] > min)   ans = Math.min(ans, a[i]);  }  if (ans == 101)  out.println("NO");  else  out.println(ans);  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;  } } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static  @SuppressWarnings("Duplicates")  class TaskC {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int MAX = 6000;    int MOD = 1000000007;    int n = in.nextInt();    int[][] dp = new int[n][MAX];    dp[0][0] = 1;    char next;    int current;    for (int i = 0; i < n; i++) {     next = in.next().charAt(0);     if (i == n - 1) continue;     current = 0;     for (int j = MAX - 1; j >= 0; j--) {      if (dp[i][j] != 0) {       if (next == 'f') {        if (j < MAX - 1) dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % MOD;       } else {        current = (current + dp[i][j]) % MOD;       }      }      if (next == 's') dp[i + 1][j] = current;     }    }    int res = 0;    for (int i = 0; i < MAX; i++) {     res = (res + dp[n - 1][i]) % MOD;    }    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 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;   }  } }
0	public class Main {  public static void main(String args[])  {   Scanner scan=new Scanner(System.in);   int n=scan.nextInt();   System.out.println((n%4==0||n%7==0||n%47==0||n%74==0||n%447==0||n%474==0||n%477==0||n%744==0||n%747==0||n%774==0)?"YES":"NO");  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader sc = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   Task solver = new Task();   solver.solve(1, sc, out);   out.close();  }  static class Task {   public void solve(int testNumber, InputReader sc, PrintWriter out) {    int n=sc.nextInt();    int[] a=new int[n];    boolean[] jud=new boolean[101];       for(int i=0;i<n;i++)    a[i]=sc.nextInt();    Arrays.sort(a);    int ans=0;    for(int i=0;i<n;i++) {    if(jud[a[i]])     continue;    ans++;    for(int j=a[i];j<=100;j+=a[i])     jud[j]=true;    }    out.println(ans);   }  }  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());   }  } }
5	public class Main {  public static void main(String[] args)throws Exception {   File _=new File("chores.in");   BufferedReader br=_.exists()? new BufferedReader(new FileReader(_)):new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st;   String str;     st=new StringTokenizer(br.readLine());   int n,a,b;   n=Integer.parseInt(st.nextToken());   a=Integer.parseInt(st.nextToken());   b=Integer.parseInt(st.nextToken());     ArrayList<Integer> chores=new ArrayList<Integer>();   int k;   st=new StringTokenizer(br.readLine());   for (int i = 0; i < n; i++) {    k=Integer.parseInt(st.nextToken());    chores.add(k);   }   Collections.sort(chores);     System.out.println(chores.get(b)-chores.get(b-1));    } }
6	public class Main implements Runnable { private void solution() throws IOException {  int n = in.nextInt();  int m = in.nextInt();  boolean[][] adj = new boolean[n][n];  long res = 0;  for (int i = 0; i < m; ++i) {  int x = in.nextInt();  int y = in.nextInt();  adj[x - 1][y - 1] = true;  adj[y - 1][x - 1] = true;  }  for (int i = 0; i < n; ++i) {  for (int j = i + 1; j < n; ++j) {   if (adj[i][j]) {   --res;   }  }  }  final long[][] dp = new long[1 << n][n];  for (int i = 0; i < n; ++i) {  for (int mask = 0; mask < (1 << (n - i)); ++mask) {   for (int j = 0; j < n - i; ++j) {   dp[mask][j] = 0;   }  }  dp[0][0] = 1;  for (int mask = 0; mask < (1 << (n - i)); ++mask) {   for (int j = 0; j < n - i; ++j) {   if (dp[mask][j] != 0) {    for (int k = 0; k < n - i; ++k) {    if (((mask >> k) & 1) == 0 && adj[j + i][k + i]) {     dp[mask | (1 << k)][k] += dp[mask][j];    }    }   }   }   if (((mask >> 0) & 1) != 0) {   res += dp[mask][0];   }  }  }  out.println(res / 2); }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  private class Scanner {  BufferedReader reader;  StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  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 int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
3	public final class PythonIndentation { public static void main(String[] args) {  new PythonIndentation(System.in, System.out); }  static class Solver implements Runnable {  static final int MOD = (int) 1e9 + 7;  int n;  char[] arr;  long[][] dp;  BufferedReader in;  PrintWriter out;  void solve() throws IOException  {  n = Integer.parseInt(in.readLine());  arr = new char[n];  dp = new long[n + 1][n + 1];   for (int i = 0; i < n; i++)   arr[i] = in.readLine().charAt(0);   for (int i = 0; i <= n; i++)   Arrays.fill(dp[i], -1);   dp[0][0] = 1;   if (arr[0] == 's')   out.println(find(1, 0));  else   out.println(find(1, 1));   }  long find(int curr, int backIndents)  {   if (backIndents < 0)   return 0;   if (curr == n)   return dp[curr][backIndents] = 1;   if (dp[curr][backIndents] != -1)   return dp[curr][backIndents];   long ans;   if (arr[curr] == 's')  {   if (arr[curr - 1] == 'f')   ans = find(curr + 1, backIndents);   else   ans = CMath.mod(find(curr + 1, backIndents) + find(curr, backIndents - 1), MOD);  }  else  {   ans = find(curr + 1, backIndents + 1);   if (arr[curr - 1] != 'f')   {    ans = CMath.mod(ans + find(curr, backIndents - 1), MOD);   }  }   return dp[curr][backIndents] = ans;  }  public Solver(BufferedReader in, PrintWriter out)  {  this.in = in;  this.out = out;  }  @Override public void run()  {  try  {   solve();  }  catch (IOException e)  {   e.printStackTrace();  }  }  }  static class CMath {  static long mod(long number, long mod)  {  return number - (number / mod) * mod;  }  }  private PythonIndentation(InputStream inputStream, OutputStream outputStream) {  BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));  PrintWriter out = new PrintWriter(outputStream);  Thread thread = new Thread(null, new Solver(in, out), "PythonIndentation", 1 << 29);  try  {  thread.start();  thread.join();  }  catch (InterruptedException e)  {  e.printStackTrace();  }  finally  {  try  {   in.close();  }  catch (IOException e)  {   e.printStackTrace();  }   out.flush();  out.close();  } } }
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()+" "); } }
3	public class C {  private static final int MOD = (int) 1e9 + 7;  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[][] DP = new int[n][n + 1];   DP[0][0] = 1;   for (int i = 0; i < n - 1; i++) {    if (in.next().charAt(0) == 'f') {     for (int j = 1; j < n; j++)      DP[i+1][j] = DP[i][j-1];    } else {     for (int j = n - 1; j >= 0; j--)      DP[i+1][j] = (DP[i][j] + DP[i+1][j+1]) % MOD;    }   }   int answer = 0;   for (int i = 0; i < n; i++)    answer = (answer + DP[n-1][i]) % MOD;   System.out.println(answer);  } }
0	public class CF {   BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st=null;   private void solution() throws IOException{  int n=nextInt();  if((n % 4==0 && n>=4)||(n % 7==0 && n>=7) || (n % 44==0 && n>=44) || (n % 47==0 && n>=47) || (n % 77==0 && n>=77) || (n % 74==0 && n>=74)  || (n % 444==0 && n>=444) || (n % 447==0 && n>=447) || (n % 474==0 && n>=74) || (n % 477==0 && n>=477) || (n % 744==0 && n>=744)  || (n % 747==0 && n>=747) || (n % 777==0 && n>=777)){    System.out.println("YES");  }else{     System.out.println("NO");}   }   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 static void main(String args[]) throws IOException {     new CF().solution();   } }
4	public class Main { public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader(new FileReader(new File("input.txt")));  PrintWriter pw = new PrintWriter(new File("output.txt"));  StringTokenizer st;  st = new StringTokenizer(in.readLine());   int n = Integer.parseInt(st.nextToken()),  m = Integer.parseInt(st.nextToken()),  k = Integer.parseInt(in.readLine());   int[][] A = new int[n][m];   st = new StringTokenizer(in.readLine());  for (int i = 0 ; i < k ; i++) {  int x1 = Integer.parseInt(st.nextToken()) - 1,   y1 = Integer.parseInt(st.nextToken()) - 1;    A[x1][y1] = -10000000;    for (int j = 0 ; j < n ; j++) {   for (int g = 0 ; g < m ; g++) {   if (A[j][g] == 0 || (A[j][g] > (Math.abs(y1 - g) + Math.abs(x1 - j)))) {    A[j][g] = (Math.abs(y1 - g) + Math.abs(x1 - j));   }   }  }  }   int f = 0, h = 0;   for (int i = 0 ; i < n ; i++) {  for (int j = 0 ; j < m ; j++) {   if (A[i][j] != -10000000) {   f = i;   h = j;   }  }  }   for (int i = 0 ; i < n ; i++) {  for (int j = 0 ; j < m ; j++) {   if (A[i][j] > A[f][h] && A[i][j] != -10000000) {   f = i;   h = j;   }  }  }   pw.println((f + 1) + " " + (h + 1));  pw.close(); } }
4	public class FireAgain {  public static void main(String[] args) throws IOException  {   FileInputStream in = null;   FileOutputStream out = null;    try   {    in = new FileInputStream("input.txt");    out = new FileOutputStream("output.txt");       Scanner sc = new Scanner(in);     int h = sc.nextInt();  int w = sc.nextInt();   int k = sc.nextInt();   int[] xk = new int[k];  int[] yk = new int[k];   for(int i = 0; i < k; i++)  {  int y = sc.nextInt()-1;  int x = sc.nextInt()-1;    xk[i] = x;  yk[i] = y;  }  int best = -1;  int bestx = -1;  int besty = -1;  for(int x = 0; x < w; x++)  {  for(int y = 0; y < h; y++)  {   int cur = 99999;   for(int f = 0; f < k; f++)   {   cur = Math.min(cur, Math.abs(xk[f] - x)+Math.abs(yk[f] - y));   }     if(cur > best)   {   best = cur;   bestx = x;   besty = y;   }  }  }    String s = (besty+1) + " " + (bestx+1);  out.write(s.getBytes());    }finally   {    if (in != null)    {    in.close();    }    if (out != null)    {    out.close();    }   }  } }
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);  } } }
0	public class Soal3 {  public static void main(String[] args) throws IOException{   BufferedReader baca = new BufferedReader(new InputStreamReader(System.in));   String[] masukan = baca.readLine().split(" ");   BigInteger a = new BigInteger(masukan[0]);   BigInteger b = new BigInteger(masukan[1]);          BigInteger i=new BigInteger("0");   while(a.compareTo(new BigInteger("1"))!=0){    if(a.compareTo(b)==1){     i=i.add(a.divide(b));     if(a.mod(b)==new BigInteger("0")){      a=new BigInteger("1");      b=new BigInteger("0");     }     else{      a=a.mod(b);     }        }    else{     BigInteger temp =a;     a=b;     b=temp;       }   }   if(a.compareTo(new BigInteger("1"))==0){    i=i.add(b);   }   System.out.println(i.toString());  } }
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(); } }
5	public class Main implements Runnable {  public void _main() throws IOException {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = nextInt();  Arrays.sort(a);  for (int i = 1; i < n; i++)  if (a[i] != a[0]) {   out.print(a[i]);   return;  }  out.print("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);  } } }
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));  } }
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);   }  }    }
3	public class Main { public static void main(String[] args) {  Main main = new Main();  main.solveC(); }  private void solveA() {  Scanner sc = new Scanner(System.in);  String first = sc.next();  String last = sc.next();  String answer = first.substring(0, 1) + last.substring(0, 1);  for (int i = 2; i <= first.length(); i++) {  String current = first.substring(0, i) + last.substring(0, 1);  if (answer.compareTo(current) > 0) {   answer = current;  }  }  System.out.println(answer); }  private void solveB() {  Scanner sc = new Scanner(System.in);  int N = sc.nextInt();  int layer = 0;  for (int i = 1; i <= N; i++) {  int max = N - i + 1;  layer += i < max ? i : max;  }  System.out.println(layer); }  private void solveC() {  Scanner sc = new Scanner(System.in);  final long MOD_NUM = 1000000007L;  int N = sc.nextInt();  long[] level = new long[N + 2];  level[0] = 1;  sc.nextLine();  String pre = "s";  for (int i = 0; i < N; i++) {  String line = sc.nextLine();  long[] next_level = new long[N + 2];  if (pre.equals("f")) {   for (int j = 1; j < N + 1; j++) {   next_level[j] = level[j - 1];   }  }  if (pre.equals("s")) {   for (int j = N; j >= 0; j--) {   next_level[j] = (next_level[j + 1] + level[j]) % MOD_NUM;   }  }  pre = line;  level = next_level;  }  long answer = 0L;  for (int i = 0; i < N + 1; i++) {  answer = (answer + level[i]) % MOD_NUM;  }  System.out.println(answer); }  private void solveD() {  Scanner sc = new Scanner(System.in);  int N = sc.nextInt();  System.out.println(N); }  private void solveE() {  Scanner sc = new Scanner(System.in);  int N = sc.nextInt();  System.out.println(N); }  private void solveF() {  Scanner sc = new Scanner(System.in);  int N = sc.nextInt();  System.out.println(N); }  interface Graph {  void link(int from, int to, long cost);  Optional<Long> getCost(int from, int to);  int getVertexNum(); }  interface FlowResolver {  long maxFlow(int from, int to); }   class ArrayGraph implements Graph {  private Long[][] costArray;  private int vertexNum;  public ArrayGraph(int n) {  costArray = new Long[n][];  for (int i = 0; i < n; i++) {   costArray[i] = new Long[n];  }  vertexNum = n;  }  @Override  public void link(int from, int to, long cost) {  costArray[from][to] = new Long(cost);  }  @Override  public Optional<Long> getCost(int from, int to) {  return Optional.ofNullable(costArray[from][to]);  }  @Override  public int getVertexNum() {  return vertexNum;  } }   class DfsFlowResolver implements FlowResolver {  private Graph graph;  public DfsFlowResolver(Graph graph) {  this.graph = graph;  }    public long maxFlow(int from, int to) {  long sum = 0L;  long currentFlow;  do {   currentFlow = flow(from, to, Long.MAX_VALUE / 3, new boolean[graph.getVertexNum()]);   sum += currentFlow;  } while (currentFlow > 0);  return sum;  }    private long flow(int from, int to, long current_flow, boolean[] passed) {  passed[from] = true;  if (from == to) {   return current_flow;  }  for (int id = 0; id < graph.getVertexNum(); id++) {   if (passed[id]) {   continue;   }   Optional<Long> cost = graph.getCost(from, id);   if (cost.orElse(0L) > 0) {   long nextFlow = current_flow < cost.get() ? current_flow : cost.get();   long returnFlow = flow(id, to, nextFlow, passed);   if (returnFlow > 0) {    graph.link(from, id, cost.get() - returnFlow);    graph.link(id, from, graph.getCost(id, from).orElse(0L) + returnFlow);    return returnFlow;   }   }  }  return 0L;  } }   class BinaryIndexedTree {  private long[] array;  public BinaryIndexedTree(int size) {  this.array = new long[size + 1];  }    public void add(int index, long value) {  for (int i = index; i < array.length; i += (i & -i)) {   array[i] += value;  }  }    public long getSum(int index) {  long sum = 0L;  for (int i = index; i > 0; i -= (i & -i)) {   sum += array[i];  }  return sum;  } } }
0	public class Main {  final int INF = Integer.MAX_VALUE / 2;  private void doit(){   Scanner sc = new Scanner(System.in);      int n = sc.nextInt();    if(n == 0){     System.out.println("0 0 0");    }    else if(n == 1){     System.out.println("0 0 1");    }    else{         ArrayList<Integer> fibList = new ArrayList<Integer>();     int pre = 0;     int next = 1;     fibList.add(pre);     fibList.add(next);     while(next != n){      int temp = next;      next +=pre;      fibList.add(next);      pre = temp;     }     int len = fibList.size();     int a = fibList.get(len-4);     int b = fibList.get(len-3);     int c = fibList.get(len-3);     System.out.println(a + " " + b + " " + c);    }    }  public static void main(String[] args) {   Main obj = new Main();   obj.doit();  } }
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);   BPhoenixAndPuzzle solver = new BPhoenixAndPuzzle();   int testCount = Integer.parseInt(in.next());   for (int i = 1; i <= testCount; i++)    solver.solve(i, in, out);   out.close();  }  static class BPhoenixAndPuzzle {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    if (n % 2 == 1) {     out.println("NO");     return;    }    n /= 2;    int h = (int) Math.sqrt(n + 0.5);    if (h * h == n) {     out.println("YES");     return;    }    if (n % 2 == 1) {     out.println("NO");     return;    }    n /= 2;    h = (int) Math.sqrt(n + 0.5);    if (h * h == n) {     out.println("YES");    } else out.println("NO");   }  }  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 println(Object... objects) {    for (int i = 0; i < objects.length; i++) {     if (i != 0) {      writer.print(' ');     }     writer.print(objects[i]);    }    writer.print('\n');   }   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 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();   }   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);   }  } }
1	public class Main {  public static void main (String[] argv)  {  new Main(); }       boolean test = false;     public Main() {  FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));    int n = in.nextInt();  int nM = 0;  int[] nS = new int[4];  int[] nL = new int[4];  for (int i = 0; i < n; i++) {   String s = in.next();   int ns = s.length();   if (s.charAt(0) == 'M') nM++;   else if (s.charAt(ns - 1) == 'S') nS[ns-1]++;   else nL[ns-1]++;  }  int c = 0;  int[] nSr = new int[4];  int[] nLr = new int[4];  int nMr = 0;  for (int i = 0; i < n; i++) {   String s = in.next();   int ns = s.length();   if (s.charAt(0) == 'M') {    if (nM > 0) --nM;    else ++nMr;   }else if (s.charAt(ns - 1) == 'S') {    if (nS[ns-1] > 0) --nS[ns-1];    else ++nSr[ns-1];   }else {    if (nL[ns-1] > 0) --nL[ns-1];    else ++nLr[ns-1];   }    }    for (int i = 0; i < 4; i++) c += nS[i] + nL[i];  c += nM;    System.out.println(c); }      private int nBit1(int v) {  int v0 = v;  int c = 0;  while (v != 0) {   ++c;   v = v & (v - 1);  }  return c; }  private int common(int v) {  int c = 0;  while (v != 1) {   v = (v >>> 1);   ++c;  }    return c; }  private void reverse(char[] a, int i, int j) {  while (i < j) {   swap(a, i++, j--);  } }  private void swap(char[] a, int i, int j) {  char t = a[i];  a[i] = a[j];  a[j] = t; }   private long gcd(long x, long y) {  if (y == 0) return x;  return gcd(y, x % y); } private int max(int a, int b) {  return a > b ? a : b; }  private int min(int a, int b) {  return a > b ? b : a; }   static class FastReader  {   BufferedReader br;   StringTokenizer st;    public FastReader(BufferedReader in)   {       br = in;   }    String next()   {    while (st == null || !st.hasMoreElements())    {     try     {      String line = br.readLine();      if (line == null || line.length() == 0) return "";      st = new StringTokenizer(line);     }     catch (IOException e)     {      return "";          }    }    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)    {     return "";        }    return str;   }  } }
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);  } }
3	public class Main {  public static void main(String[] args) throws IOException {   PrintWriter out = new PrintWriter(System.out);     Reader in = new Reader();   Main solver = new Main();   solver.solve(out, in);   out.flush();   out.close();   }   static int INF = (int)1e9;  static int maxn = (int)2e5+5;  static int mod= 998244353 ;  static int n,m,k,t,q,d,cnt=2;   void solve(PrintWriter out, Reader in) throws IOException{   n = in.nextInt();     Integer[] arr = new Integer[n];   for(int i=0;i<n;i++) arr[i] = in.nextInt();     boolean[] vis = new boolean[n];     Arrays.sort(arr);   int cnt=0;   for(int i=0;i<n;i++){    if(vis[i]) continue;    cnt++;    vis[i]=true;    for(int j=i+1;j<n;j++){     if(!vis[j]){      if(arr[j]%arr[i]==0){       vis[j]=true;      }     }    }   }        out.println(cnt);    }      static class Reader {  private InputStream mIs;  private byte[] buf = new byte[1024];  private int curChar;  private int 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 next() {   int c = read();   while (isSpaceChar(c)) {    c = read();   }   StringBuilder res = new StringBuilder();   do {    res.appendCodePoint(c);    c = read();   } while (!isSpaceChar(c));   return res.toString();  }  double nextDouble()  {   return Double.parseDouble(next());  }  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 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;  }  } }
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; } }
2	public class Main{ public static void main(String[] args) {  long n,k;  Scanner s= new Scanner(System.in); n=s.nextInt(); k=s.nextInt(); System.out.println((int)(n-((-3+Math.sqrt(9+8*(n+k)))/2)));  } }
1	public class CF111111 { BufferedReader in; StringTokenizer as; int nums[],nums2[]; int[] nums1[]; boolean con = true;  ArrayList < Integer > ar = new ArrayList < Integer >(); ArrayList < Integer > fi = new ArrayList < Integer >(); Map<Integer,Integer > map = new HashMap<Integer, Integer>(); public static void main (String[] args) {  new CF111111 (); }  public int GCD(int a, int b) {  if (b==0) return a;  return GCD(b,a%b); }  public int LIS(int arr[]) {  int n = arr.length;  int sun[] = new int [n];  int cur = 0;  for(int x = 0;x<n;x++)  {  int temp = Arrays.binarySearch(sun,0,cur,arr[x]);  if(temp < 0)   temp = -temp -1;  sun[temp] = arr[x];  if(temp == cur)   cur++;  }  return cur;   }     public CF111111 () {  try  {    in = new BufferedReader (new InputStreamReader (System.in));  int a = nextInt();  for(int xx1 = 0;xx1<a;xx1++)  {   int b = nextInt();   nums = new int [b];   for(int x = 0;x<b;x++)   {   nums[x] = nextInt();   }   int max = 0;   int max2 = -1;   for(int x = 0;x<b;x++)   {    if(nums[x] >= max)    {    max2 = max;    max = nums[x];    }    else if(nums[x] >= max2)    max2 = nums[x];   }   System.out.println(Math.min(max2, b-1)-1);  }  }  catch(IOException e)  {  } }        String next () throws IOException {  while (as == null || !as.hasMoreTokens ())  {  as = new StringTokenizer (in.readLine ().trim ());  }     return as.nextToken (); }    long nextLong () throws IOException {  return Long.parseLong (next ()); }   int nextInt () throws IOException {  return Integer.parseInt (next ()); }   double nextDouble () throws IOException {  return Double.parseDouble (next ()); }   String nextLine () throws IOException {  return in.readLine ().trim (); } }
4	public class Main {  public static void main(String[] args)  {   InputStream inputStream;   try   {    inputStream = new FileInputStream("input.txt");   } catch (IOException e)   {    throw new RuntimeException(e);   }   OutputStream outputStream;   try   {    outputStream = new FileOutputStream("output.txt");   } catch (IOException e)   {    throw new RuntimeException(e);   }   FastScanner in = new FastScanner(inputStream);   FastPrinter out = new FastPrinter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC  {   private final static int[] dx = {-1, 0, +1, 0};   private final static int[] dy = {0, +1, 0, -1};   private final static int WHITE = 123456789;   public void solve(int testNumber, FastScanner in, FastPrinter out)   {    int n = in.nextInt();    int m = in.nextInt();    int[][] map = new int[n][m];    for (int i = 0; i < n; i++)    {     Arrays.fill(map[i], WHITE);    }    int k = in.nextInt();    int qh = 0;    int qt = 0;    int[] q = new int[((int) 7e6)];    for (int i = 0; i < k; i++)    {     int x = in.nextInt() - 1;     int y = in.nextInt() - 1;     map[x][y] = 0;     q[qh++] = x * m + y;    }    int d = 0;    int X = q[0] / m;    int Y = q[0] % m;    while (qt < qh)    {     int pos = q[qt++];     int x = pos / m;     int y = pos % m;     for (int i = 0; i < 4; i++)     {      int xx = x + dx[i];      int yy = y + dy[i];      if (isValid(xx, n) && isValid(yy, m) && map[xx][yy] == WHITE)      {       map[xx][yy] = map[x][y] + 1;       q[qh++] = (xx * m) + yy;       if (d < map[xx][yy])       {        d = map[xx][yy];        X = xx;        Y = yy;       }      }     }    }        out.println((X + 1) + " " + (Y + 1));   }   private boolean isValid(int x, int X)   {    return x >= 0 && x < X;   }  }  static class FastScanner  {   public BufferedReader br;   public StringTokenizer st;   public FastScanner(InputStream is)   {    br = new BufferedReader(new InputStreamReader(is));   }   public FastScanner(File f)   {    try    {     br = new BufferedReader(new FileReader(f));    } catch (FileNotFoundException e)    {     e.printStackTrace();    }   }   public String next()   {    while (st == null || !st.hasMoreElements())    {     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(next());   }  }  static class FastPrinter extends PrintWriter  {   public FastPrinter(OutputStream out)   {    super(out);   }   public FastPrinter(Writer out)   {    super(out);   }  } }
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);    }   }  } }
1	public class A {  public static void main(String[] args) throws Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   br.readLine();   String[] ss = br.readLine().split(" ");   int n = ss.length;   int[] a = new int[n];   for (int i = 0; i < n; ++i)    a[i] = Integer.parseInt(ss[i]);   for (int i = 0; i < n; ++i) {    boolean ok = true;    for (int j = 0; j < n; ++j)     if (j != i && a[j] % 2 == a[i] % 2)      ok = false;    if (ok)     System.out.println(i + 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);    StreamTokenizer st = new StreamTokenizer(reader);    PrintWriter out = new PrintWriter(writer);    int n = Integer.valueOf(br.readLine());    String s = br.readLine();    MyTokenizer tok = new MyTokenizer(s);    int[] a = new int[2];    int[] ind = new int[2];    int[] c = new int[2];    for(int i=0;i<n;i++) {     int p = (int)tok.getNum();     c[p%2]++;     a[p%2] = p;     ind[p%2] = i;    }    int b = ind[0];    if (c[0] > c[1])     b = ind[1];    out.printf("%d", b + 1);    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) == '.' || 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')) || ((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();   }  } }
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();  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   inputClass in = new inputClass(inputStream);   PrintWriter out = new PrintWriter(outputStream);   F2SameSumBlocksHard solver = new F2SameSumBlocksHard();   solver.solve(1, in, out);   out.close();  }  static class F2SameSumBlocksHard {   public void solve(int testNumber, inputClass sc, PrintWriter out) {    int n = sc.nextInt();    int[] tab = new int[n];    int[] s = new int[n];    for (int i = 0; i < n; i++) {     tab[i] = sc.nextInt();     if (i > 0)      s[i] = s[i - 1] + tab[i];     else      s[0] = tab[0];    }    HashMap<Integer, F2SameSumBlocksHard.Pair> sums = new HashMap<>();    F2SameSumBlocksHard.Pair p;    for (int i = 0; i < n; i++) {     for (int j = 0; j <= i; j++) {      if (j > 0) {       if (sums.get(s[i] - s[j - 1]) != null) {        if (sums.get(s[i] - s[j - 1]).last < j) {         sums.get(s[i] - s[j - 1]).sum++;         sums.get(s[i] - s[j - 1]).last = i;        }       } else {        p = new F2SameSumBlocksHard.Pair();        p.sum = 1;        p.last = i;        sums.put(s[i] - s[j - 1], p);       }      } else {       if (sums.get(s[i]) != null) {        if (sums.get(s[i]).last < j) {         sums.get(s[i]).sum++;         sums.get(s[i]).last = i;        }       } else {        p = new F2SameSumBlocksHard.Pair();        p.sum = 1;        p.last = i;        sums.put(s[i], p);       }      }     }    }    Iterator<Map.Entry<Integer, F2SameSumBlocksHard.Pair>> it = sums.entrySet().iterator();    Map.Entry<Integer, F2SameSumBlocksHard.Pair> t;    int maxsum = 0;    int cnt = 0;    while (it.hasNext()) {     t = it.next();     if (t.getValue().sum > cnt) {      maxsum = t.getKey();      cnt = t.getValue().sum;     }    }    out.println(cnt);    int start = 0;    for (int i = 0; i < n; i++) {     for (int j = start; j <= i; j++) {      if (j > 0) {       if (s[i] - s[j - 1] == maxsum) {        out.println((j + 1) + " " + (i + 1));        start = i + 1;        break;       }      } else {       if (s[i] == maxsum) {        out.println((j + 1) + " " + (i + 1));        start = i + 1;        break;       }      }     }    }    }   static class Pair {    int sum;    int last;   }  }  static class inputClass {   BufferedReader br;   StringTokenizer st;   public inputClass(InputStream in) {    br = new BufferedReader(new InputStreamReader(in));   }   public String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }  } }
4	public class P19 {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   Map<Integer, Integer> mapa = new HashMap<Integer, Integer>();   String str = in.next();   int len = str.length();   int maxCurrent = 0;   for (int i = 0; i < len; ++i) {    for (int j = 1; j <= len; ++j) {     if (i + j > len) continue;         int hashCode = str.substring(i, i + j).hashCode();     Integer current = mapa.get(hashCode);     if (current == null)      current = 0;     current++;     mapa.put(hashCode, current);     if (current > 1)      maxCurrent = Math.max(maxCurrent, j);    }   }   out.println(maxCurrent);   out.flush();   out.close();  } }
5	public class Main {  static Scanner in = new Scanner(System.in);  public static  void main(String[] args) {   int n = in.nextInt();   int t = in.nextInt();   List<Integer> v = new ArrayList<Integer>(n);   for(int i = 0; i < n; i++) {    int a = in.nextInt();    int b = in.nextInt();    v.add(2 * a - b);    v.add(2 * a + b);   }   Collections.sort(v);   int ans = 2;   for(int i = 2; i < v.size(); i += 2) {    if(v.get(i) - v.get(i - 1) > 2 * t) ans += 2;    if(v.get(i) - v.get(i - 1) == 2 * t) ans++;   }   System.out.println(ans);  } }
6	public class Template {  public static void main(String[] args) throws IOException {   final Scanner in = new Scanner(System.in);   final PrintStream out = System.out;   int n = in.nextInt(), m = in.nextInt();   boolean[][] g = new boolean[n][n];   for (int i = 0; i < m; ++i) {    int a = in.nextInt(), b = in.nextInt();    --a; --b;    g[a][b] = g[b][a] = true;   }   final int mx = 1<<n;   long[][] dp = new long[mx][n];   long res = 0;   for (int mask = 0; mask < mx; ++mask)    for (int i = 0; i < n; ++i) {     if (mask == (1 << i)) {      dp[mask][i] = 1;     } else if (((mask & (1 << i)) != 0) && ((mask & ((1 << i) - 1)) != 0)) {      long r = 0;      int next = mask ^ (1<<i);      for (int j = 0; j < n; ++j) if (g[i][j]) {       r += dp[next][j];      }      dp[mask][i] = r;     } else {      dp[mask][i] = 0;     }     if ((mask & (mask-1)) != 0 && g[i][lowestBit(mask)]) {      res += dp[mask][i];     }    }   System.out.println((res-m)/2);  }  private static int lowestBit(int mask) {   for (int i = 0;;++i) {    if ((mask & (1<<i)) > 0) {     return i;    }   }  } }
3	public class CFA {  private static final String INPUT = "8\n" +    "7 6 5 4 3 2 2 3\n";  private static final int MOD = 1_000_000_007;  private PrintWriter out;  private FastScanner sc;  public static void main(String[] args) {   new CFA().run();  }  public void run() {   sc = new FastScanner(oj ? System.in : new ByteArrayInputStream(INPUT.getBytes()));   out = new PrintWriter(System.out);   long s = System.currentTimeMillis();   solve();   out.flush();   tr(System.currentTimeMillis() - s + "ms");  }  static class Color {   int nr;   boolean used;   public Color(int nr) {    this.nr = nr;   }  }  private void solve() {   int n = sc.nextInt();   Color[] a = new Color[n];   for (int i = 0; i < n; i++) {    a[i] = new Color(sc.nextInt());   }   Arrays.sort(a, Comparator.comparingInt(c -> c.nr));   int ans = 0;   for (int i = 0; i < n; i++) {    if (a[i].used) continue;    ans++;    for (int j = i+1; j < n; j++) {     if (a[j].nr % a[i].nr == 0) {      a[j].used = true;     }    }   }   out.println(ans);  }    static class SolutionFailedException extends Exception {   int code;   public SolutionFailedException(int code) {    this.code = code;   }  }  int [] sort(int [] a) {   final int SHIFT = 16, MASK = (1 << SHIFT) - 1, SIZE = (1 << SHIFT) + 1;   int n = a.length, ta [] = new int [n], ai [] = new int [SIZE];   for (int i = 0; i < n; ai[(a[i] & MASK) + 1]++, i++);   for (int i = 1; i < SIZE; ai[i] += ai[i - 1], i++);   for (int i = 0; i < n; ta[ai[a[i] & MASK]++] = a[i], i++);   int [] t = a; a = ta; ta = t;   ai = new int [SIZE];   for (int i = 0; i < n; ai[(a[i] >> SHIFT) + 1]++, i++);   for (int i = 1; i < SIZE; ai[i] += ai[i - 1], i++);   for (int i = 0; i < n; ta[ai[a[i] >> SHIFT]++] = a[i], i++);   return ta;  }  private static void shuffle(int[] array) {   Random random = new Random();   for (int i = array.length - 1; i > 0; i--) {    int index = random.nextInt(i + 1);    int temp = array[index];    array[index] = array[i];    array[i] = temp;   }  }    private static int lowerBound(long[] arr, long key) {   int lo = 0;   int hi = arr.length - 1;   while (lo < hi) {    int mid = (lo + hi) / 2;    if (key <= arr[mid]) {     hi = mid - 1;    } else {     lo = mid + 1;    }   }   return arr[lo] < key ? lo + 1 : lo;  }    private static int upperBound(long[] arr, long key) {   int lo = 0;   int hi = arr.length - 1;   while (lo < hi) {    int mid = (lo + hi) / 2;    if (key >= arr[mid]) {     lo = mid + 1;    } else {     hi = mid;    }   }   return arr[lo] <= key ? lo + 1 : lo;  }  private static int ceil(double d) {   int ret = (int) d;   return ret == d ? ret : ret + 1;  }  private static int round(double d) {   return (int) (d + 0.5);  }  private static int gcd(int a, int b) {   BigInteger b1 = BigInteger.valueOf(a);   BigInteger b2 = BigInteger.valueOf(b);   BigInteger gcd = b1.gcd(b2);   return gcd.intValue();  }  private static long gcd(long a, long b) {   BigInteger b1 = BigInteger.valueOf(a);   BigInteger b2 = BigInteger.valueOf(b);   BigInteger gcd = b1.gcd(b2);   return gcd.longValue();  }  private int[] readIntArray(int n) {   int[] res = new int[n];   for (int i = 0; i < n; i++) {    res[i] = sc.nextInt();   }   return res;  }  private long[] readLongArray(int n) {   long[] res = new long[n];   for (int i = 0; i < n; i++) {    res[i] = sc.nextLong();   }   return res;  }  @SuppressWarnings("unused")  static class FastScanner {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   FastScanner(InputStream stream) {    this.stream = stream;   }   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++];   }   boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   boolean isEndline(int c) {    return c == '\n' || c == '\r' || c == -1;   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String next() {    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 (isEndline(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isEndline(c));    return res.toString();   }  }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null;  private void tr(Object... o) {   if (!oj) System.out.println(Arrays.deepToString(o));  } }
6	public class Main {  static long[][] memo; static boolean[][] adjMat; static int N, endNode; static ArrayList<Integer>[] bits;  static long dp(int idx, int msk)  {  if(memo[idx][msk] != -1)  return memo[idx][msk];  long ret = adjMat[idx][endNode] ? 1 : 0;  for(int i = 0, sz = bits[msk].size(); i < sz; ++i)  {  int j = bits[msk].get(i);  if(j > endNode)   break;  if(adjMat[idx][j])   ret += dp(j, msk | 1 << j);  }  return memo[idx][msk] = ret; }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  N = sc.nextInt();  adjMat = new boolean[N][N];   bits = new ArrayList[1 << N];  for(int i = 0; i < 1 << N; ++i)  {  bits[i] = new ArrayList<>(1);  for(int j = 0; j < N; ++j)   if((i & 1 << j) == 0)   bits[i].add(j);  }  int M = sc.nextInt();  while(M-->0)  {  int u = sc.nextInt() - 1, v = sc.nextInt() - 1;  adjMat[u][v] = adjMat[v][u] = true;  }  long ans = 0;  for(int i = N; i > 1; --i)  {  memo = new long[i][1 << i];  for(long[] x: memo)   Arrays.fill(x, -1);  ans += dp(endNode = i - 1, 1 << endNode);  }  for(int i = 0; i < N; ++i)  for(int j = i + 1; j < N; ++j)   if(adjMat[i][j])   --ans;  out.println(ans >> 1);  out.flush();  out.close(); }    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();}  } }
0	public class LuckyDivision {  public LuckyDivision(Scanner in)  {  int n;   n = in.nextInt();   if ( (n % 4 == 0) ||    (n % 7 == 0) ||    (n % 44 == 0) ||    (n % 47 == 0) ||    (n % 74 == 0) ||    (n % 77 == 0) ||    (n % 444 == 0) ||    (n % 447 == 0) ||    (n % 474 == 0) ||    (n % 477 == 0) ||    (n % 744 == 0) ||    (n % 747 == 0) ||    (n % 774 == 0) ||    (n % 777 == 0) )   System.out.printf("YES%n");  else   System.out.printf("NO%n");  }   public static void main(String[] args)  {  new LuckyDivision(new Scanner(System.in));  } }
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;  } }  }
0	public class Main{ public static void main(String[] args) throws IOException{ BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in)); String a=buffer.readLine(); int b=Integer.parseInt(a); if(b%4==0 || b%7==0 || b%44==0 || b%47==0 || b%74==0 || b%77==0 || b%444==0 || b%447==0 || b%474==0 || b%477==0 || b%744==0 || b%747==0 || b%774==0 || b%777==0) System.out.println("YES"); else System.out.println("NO"); }}
2	public class Main {  long mod = (long) (1e9 + 7);  void solve() throws Throwable {   long x = readLong(), k = readLong();   if (x == 0) {    System.out.println(0);    return;   }   long r = solveFast(x, k);     System.out.println(r);    }  private long solveSlow(long x, long k) {   List<Long> a = new ArrayList<>();   a.add(x);   for (int i = 0; i < k; i++) {    dodouble(a);    a = eat(a);   }   dodouble(a);   long sum = 0;   for (Long v : a) {    sum = (sum + v) % mod;   }   return sum * rev(a.size(), mod) % mod;  }  private List<Long> eat(List<Long> a) {   List<Long> r = new ArrayList<>();   for (Long v : a) {    r.add(v);    r.add((v - 1 + mod) % mod);   }   return r;  }  private void dodouble(List<Long> a) {   for (int i = 0; i < a.size(); i++) {    a.set(i, a.get(i) * 2 % mod);   }  }  private long solveFast(long x, long k) {   long n = binpow(2, k, mod);   long ma = (binpow(2, k + 1, mod) * (x % mod)) % mod;   long mi = (ma - n * 2 + 2 + mod * 100) % mod;   return ((ma + mi) * rev(2, mod)) % mod;  }  private long rev(long a, long mod) {   return binpow(a, mod - 2, mod);  }    final boolean ONLINE_JUDGE = !new File("input.txt").exists();  BufferedReader in;  PrintWriter out;  StringTokenizer tok;  public void run() {   Runnable run = () -> {    try {     long startTime = System.currentTimeMillis();     Locale.setDefault(Locale.US);     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");     }     tok = new StringTokenizer("");     solve();     in.close();     out.close();     long endTime = System.currentTimeMillis();     long totalMemory = Runtime.getRuntime().totalMemory();     long freeMemory = Runtime.getRuntime().freeMemory();     System.err.println();     System.err.println("Time = " + (endTime - startTime) + " ms");        } catch (Throwable e) {     e.printStackTrace(System.err);     System.exit(-1);    }   };   new Thread(null, run, "run", 256 * 1024 * 1024).start();   min(0, 0);  }  String readString() {   while (!tok.hasMoreTokens()) {    String line;    try {     line = in.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }    if (line == null) return null;    tok = new StringTokenizer(line);   }   return tok.nextToken();  }  int readInt() {   return Integer.parseInt(readString());  }  long readLong() throws IOException {   return Long.parseLong(readString());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  void debug(Object... o) {   if (!ONLINE_JUDGE) {    System.err.println(Arrays.deepToString(o));   }  }    long binpow(long a, long n, long mod) {   long r = 1;   while (n > 0) {    if ((n & 1) > 0) {     r = (r * a) % mod;    }    a = (a * a) % mod;    n /= 2;   }   return r;  }  static long gcd(long x, long y) {   return y == 0 ? x : gcd(y, x % y);  }  private long[] readLongArray(int n) throws IOException {   long[] a = new long[n];   for (int i = 0; i < n; i++) {    a[i] = readLong();   }   return a;  }  public static void main(String[] args) {   new Main().run();  } }
3	public class paintTheNumbers {  public static void main (String [] args){   Scanner scanner = new Scanner(System.in);   int n = scanner.nextInt();   int [] arr = new int[n];   for(int i = 0; i < n; i++){    arr[i] = scanner.nextInt();   }   System.out.print(paint(arr));  }  public static int paint(int [] arr){   Arrays.sort(arr);   HashSet<Integer> set = new HashSet<>();   int num = arr[0];   set.add(num);   for(int i = 1; i < arr.length; i++){    if(!divBySet(set, arr[i])){     set.add(arr[i]);    }   }   return set.size();  }    public static boolean divBySet(HashSet<Integer> set, int a){   for(int s: set){    if(a % s == 0){     return true;    }   }   return false;  } }
4	public class Abra {  public static void main(String[] args) throws IOException {   new Abra().run();  }  StreamTokenizer in;  PrintWriter out;  boolean oj;  void init() throws IOException {   oj = System.getProperty("ONLINE_JUDGE") != null;   Reader reader = oj ? new InputStreamReader(System.in) : new FileReader(     "input.txt");   Writer writer = oj ? new OutputStreamWriter(System.out)     : new FileWriter("output.txt");   in = new StreamTokenizer(new BufferedReader(reader));   out = new PrintWriter(writer);  }  void run() throws IOException {   long beginTime = System.currentTimeMillis();   init();   solve();   out.flush();  }  void printMem() {   if (!oj) {    System.out.println("Memory used = "      + (Runtime.getRuntime().totalMemory() - Runtime        .getRuntime().freeMemory()));   }  }  int nextInt() throws IOException {   in.nextToken();   return (int) in.nval;  }  long nextLong() throws IOException {   in.nextToken();   return (long) in.nval;  }  String nextString() throws IOException {   in.nextToken();   return in.sval;  }  double nextDouble() throws IOException {   in.nextToken();   return in.nval;  }  long deg(long x, long y) {   long a = x;   for (long i = 2; i <= y; i++) {    a *= x;   }   return a;  }  long fact(long x) {   long a = 1;   for (long i = 2; i <= x; i++) {    a *= i;   }   return a;  }  long digitSum(String x) {   long a = 0;   for (int i = 0; i < x.length(); i++) {    a += x.codePointAt(i) - 48;   }   return a;  }  long digitSum(long x) {   long a = 0;   while (x > 0) {    a += x % 10;    x /= 10;   }   return a;  }  long digitMul(long x) {   long a = 1;   while (x > 0) {    a *= x % 10;    x /= 10;   }   return a;  }   int digitCubesSum(int x) {   int a = 0;   while (x > 0) {    a += (x % 10) * (x % 10) * (x % 10);    x /= 10;   }   return a;  }  double pif(double ax, double ay, double bx, double by) {   return Math.sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));  }  double getPosPart(double x) {   if (x <= 0)    return 0;   else    return x;  }  double max(double x, double y) {   if (x > y)    return x;   else    return y;  }  long gcd(long a, long b) {   if (a < b) {    long c = b;    b = a;    a = c;   }   while (a % b != 0) {    a = a % b;    if (a < b) {     long c = b;     b = a;     a = c;    }   }   return b;  }  int gcd(int a, int b) {   if (a < b) {    int c = b;    b = a;    a = c;   }   while (a % b != 0) {    a = a % b;    if (a < b) {     int c = b;     b = a;     a = c;    }   }   return b;  }  long lcm(long a, long b) throws IOException {   return a * b / gcd(a, b);  }  int lcm(int a, int b) throws IOException {   return a * b / gcd(a, b);  }  int countOccurences(String x, String y) {   int a = 0, i = 0;   while (true) {    i = y.indexOf(x);    if (i == -1)     break;    a++;    y = y.substring(i + 1);   }   return a;  }  int[] primes;  int findPrimes(int x) {   boolean[] forErato = new boolean[x];   primes = new int[x];   int l = 0, j = 0;   for (int i = 2; i < x; i++) {    if (forErato[i])     continue;    l++;    primes[l] = i;    j = i * 2;    while (j < x) {     forErato[j] = true;     j += i;    }   }   return l;  }  int rev(int x) {   int a = 0;   while (x > 0) {    a = a * 10 + x % 10;    x /= 10;   }   return a;  }  class myDate {   int d, m, y;   public myDate(int da, int ma, int ya) {    d = da;    m = ma;    y = ya;   }   int[] ml = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };   void inc() {    if ((d == 31) && (m == 12)) {     y++;     d = 1;     m = 1;    } else {     if (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)) {      ml[1] = 29;     }     if (d == ml[m - 1]) {      m++;      d = 1;     } else      d++;    }   }  }  int partition(int n, int l, int m) {     if (n < l)    return 0;   if (n < l + 2)    return 1;   if (l == 1)    return 1;   int c = 0;   for (int i = Math.min(n - l + 1, m); i >= (n + l - 1) / l; i--) {    c += partition(n - i, l - 1, i);   }   return c;  }   String s;  int l;   void solve() throws IOException {   s = nextString();   l = s.length();   int max = 0;   for (int i = 0; i < l - 1; i++) {    for (int j = i + 1; j < l; j++) {     if (countOccurences(s.substring(i, j), s) > 1)      if (j - i > max) max = j - i;    }   }   out.println(max);  } }
3	public class ProblemF {  private static boolean debug = false;  private static int N;  private static int[] A;  private static void solveProblem(InputStream instr) throws Exception {   InputReader sc = new InputReader(instr);   int testCount = 1;   if (debug) {    testCount = sc.nextInt();   }   for (int t = 1; t <= testCount; t++) {    printDebug("------ " + t + " ------");    N = sc.nextInt();    A = readInts(sc, N);    Object result = solveTestCase();    System.out.println(result);   }  }  private static Object solveTestCase() {   int sum[] = new int[N];   sum[0] = A[0];   for (int i = 1; i < N; i++) {    sum[i] = sum[i - 1] + A[i];   }   Map<Integer, List<int[]>> map = new HashMap<>();   for (int i = 0; i < N; i++) {    for (int j = i; j < N; j++) {     int groupSum = sum[j] - (i == 0 ? 0 : sum[i - 1]);     map.putIfAbsent(groupSum, new ArrayList<>());     map.get(groupSum).add(new int[]{i, j});    }   }   int max = -1;   List<int[]> maxAnswer = null;   for (Map.Entry<Integer, List<int[]>> entry : map.entrySet()) {    List<int[]> values = entry.getValue();    if (values.size() <= max) {     continue;    }    List<int[]> curr = findMax(values);    if (curr.size() > max) {     max = curr.size();     maxAnswer = curr;    }   }   List<String> answer = new ArrayList<>();   for (int[] value : maxAnswer) {    answer.add((value[0] + 1) + " " + (value[1] + 1));   }   return max + "\n" + joinValues(answer, "\n");  }  private static List<int[]> findMax(List<int[]> values) {   values.sort(new Comparator<int[]>() {    @Override    public int compare(int[] o1, int[] o2) {     return o1[1] - o2[1];    }   });   List<int[]> answer = new ArrayList<>();   int right = -1;   for (int i = 0; i < values.size(); i++) {    int[] value = values.get(i);    if (value[0] > right) {     answer.add(value);     right = value[1];    }   }   return answer;  }  private static int[] readInts(InputReader sc, int N) throws Exception {   int[] arr = new int[N];   for (int i = 0; i < N; i++) {    arr[i] = sc.nextInt();   }   return arr;  }  private static String joinValues(List<? extends Object> list, String delim) {   return list.stream().map(Object::toString).collect(Collectors.joining(delim));  }  private static String joinValues(int[] arr, String delim) {   List<Object> list = new ArrayList<>();   for (Object value : arr) {    list.add(value);   }   return list.stream().map(Object::toString).collect(Collectors.joining(delim));  }  public static void printDebug(Object str) {   if (debug) {    System.out.println("DEBUG: " + str);   }  }  private static final class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[1024];   private int curChar;   private int Chars;   public InputReader(InputStream stream) {    this.stream = stream;   }   private int read() throws Exception {    if (curChar >= Chars) {     curChar = 0;     Chars = stream.read(buf);     if (Chars <= 0)      return -1;    }    return buf[curChar++];   }   public final int nextInt() throws Exception {    return (int)nextLong();   }   public final long nextLong() throws Exception {    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 {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += (c - '0');     c = read();    } while (!isSpaceChar(c));    return negative ? (-res) : (res);   }   public final int[] nextIntBrray(int size) throws Exception {    int[] arr = new int[size];    for (int i = 0; i < size; i++)     arr[i] = nextInt();    return arr;   }   public final String next() throws Exception {    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();   }   public final String nextLine() throws Exception {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.append((char)c);     c = read();    } while (c != '\n' && c != -1);    return res.toString();   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  }  public static void main(String[] args) throws Exception {   long currTime = System.currentTimeMillis();   if (debug) {    solveProblem(new FileInputStream(new File("input.in")));    System.out.println("Time: " + (System.currentTimeMillis() - currTime));   } else {    solveProblem(System.in);   }  } }
3	public class SameSumBlock { static BufferedReader br; static StringTokenizer tokenizer;  public static void main(String[] args) throws Exception {  br = new BufferedReader(new InputStreamReader(System.in));  int n = nextInt();  int[] arr = new int[n];  int[] pSum = new int[n];  for(int i = 0; i< n; i++) {  arr[i] = nextInt();  if(i != 0)   pSum[i] += pSum[i - 1];  pSum[i] += arr[i];  }  ArrayList<Interval> sorted = new ArrayList<Interval>();  for(int i = 0; i < n; i++)  sorted.add(new Interval(pSum[i],0, i));  for(int i = 1; i < n; i++) {  for(int j = i; j < n; j++) {   sorted.add(new Interval(pSum[j] - pSum[i - 1], i, j));  }  }  sorted.sort(null);  int i = 0;  int max = 0, idx = 0, end = 0;  while(i < sorted.size()) {  int last = i;  int curr = 1;  int start = i;  sorted.get(i).marked = true;  while(i < sorted.size() - 1 && sorted.get(i).val == sorted.get(i + 1).val) {   i++;   if(sorted.get(i).l > sorted.get(last).r) {   sorted.get(i).marked = true;   curr++;   last = i;   }  }  if(curr > max) {   max = curr;   idx = start;   end = i;  }  i++;  }  System.out.println(max);  for(int j = idx; j <= end; j++) {  if(sorted.get(j).marked)   System.out.println(sorted.get(j).l + 1 + " " + (sorted.get(j).r + 1));  } }  public static String next() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  String line = br.readLine();  if (line == null)   throw new IOException();  tokenizer = new StringTokenizer(line);  }  return tokenizer.nextToken(); }  public static int nextInt() throws IOException {  return Integer.parseInt(next()); } } class Interval implements Comparable<Interval> { int val, l, r; boolean marked; public Interval(int val, int l, int r) {  super();  this.val = val;  this.l = l;  this.r = r; }  @Override public int compareTo(Interval o) {  if(val != o.val)  return val - o.val;  return r - o.r; }  }
3	public class Main {  public static void main(String[] args) throws IOException{   BufferedReader f = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(new PrintStream(System.out));   int n=Integer.parseInt(f.readLine());   StringTokenizer st=new StringTokenizer(f.readLine());   int[]arr=new int[n];   for(int i=0;i<n;i++){    arr[i]=Integer.parseInt(st.nextToken());   }   Arrays.sort(arr);   int ans=0;   boolean[]used=new boolean[n];   for(int i=0;i<n;i++){    if(!used[i]){     ans++;     for(int j=i+1;j<n;j++){      if(!used[j] && arr[j]%arr[i]==0){       used[j]=true;      }     }     used[i]=true;    }   }   System.out.print(ans);   f.close();   out.close();  } } class pair implements Comparable <pair>{  int num;  int idx;  public int compareTo(pair other){   return num- other.num;  }   pair(int a, int b)  {   num=a;   idx=b;  } }
5	public class ProblemA {  public static void main(String[] args) {  Scanner s = new Scanner(System.in);   int n = s.nextInt();  int t = s.nextInt();  TreeMap<Integer,Integer> map = new TreeMap<Integer,Integer>();    while(s.hasNextInt())  {  int i = s.nextInt();  int j = s.nextInt();  map.put(i,j);   }   int count = 0;  double left = -100000;  double right;  int size;  for(Integer i : map.keySet())  {  size = map.get(i);  right = (double)i - (double)size/2.0;    if(right - left > t)  {   count+=2;  }  if(right - left == t)  {   count++;  }    left = (double)i + (double)size/2.0;  }   System.out.println(count); } }
6	public class r568p8{  private static InputReader sc;  private static PrintWriter pw;  private static long mod;  static class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar, snumChars;   private SpaceCharFilter filter;   InputReader(InputStream stream) {    this.stream = stream;   }   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++];   }   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;   }   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;   }   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();   }   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();   }   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 {    boolean isSpaceChar(int ch);   }  }  public static void main(String args[]) {   sc = new InputReader(System.in);   pw = new PrintWriter(System.out);   int t = 1;   while(t-->0)    solve();   pw.flush();   pw.close();  }  private static void fill_matrix(long dp[][][][], int a, int b, int c, int end){   if((a == 0 && b == 0 && c == 0) || (a == 0 && end == 0) || (b == 0 && end == 1) || (c == 0 && end == 2)){    dp[a][b][c][end] = 0;    return;   }   if(a > 1 && b == 0 && c == 0){    dp[a][b][c][end] = 0;    return;   }   if(b > 1 && a == 0 && c == 0){    dp[a][b][c][end] = 0;    return;   }   if(c > 1 && a == 0 && b == 0){    dp[a][b][c][end] = 0;    return;   }   if(a == 1 && end == 0 && b == 0 && c == 0){    dp[a][b][c][end] = 1;    return;   }   if(b == 1 && end == 1 && a == 0 && c == 0){    dp[a][b][c][end] = 1;    return;   }   if(c == 1 && end == 2 && b == 0 && a == 0){    dp[a][b][c][end] = 1;    return;   }   if(end == 0){    fill_matrix(dp, a-1, b, c, 1);    fill_matrix(dp, a-1, b, c, 2);    dp[a][b][c][0] = (dp[a-1][b][c][1]%mod + dp[a-1][b][c][2]%mod)%mod;   }   else if(end == 1){    fill_matrix(dp, a, b-1, c, 0);    fill_matrix(dp, a, b-1, c, 2);    dp[a][b][c][1] = (dp[a][b-1][c][0]%mod + dp[a][b-1][c][2]%mod)%mod;   }   else{    fill_matrix(dp, a, b, c-1, 0);    fill_matrix(dp, a, b, c-1, 1);    dp[a][b][c][2] = (dp[a][b][c-1][0]%mod + dp[a][b][c-1][1]%mod)%mod;   }  }  private static long cal(int count[]){   int a = count[0], b = count[1], c = count[2];   long dp[][][][] = new long[a+1][b+1][c+1][3];   long factorial[] = new long[20];   factorial[0] = 1;   factorial[1] = 1;   for(int i=2; i<20; i++)    factorial[i] = (factorial[i-1]%mod*i%mod)%mod;   fill_matrix(dp, a, b, c, 0);   fill_matrix(dp, a, b, c, 1);   fill_matrix(dp, a, b, c, 2);    long p = (dp[a][b][c][0]%mod + dp[a][b][c][1]%mod + dp[a][b][c][2]%mod)%mod;    long ans = (((p%mod * factorial[a]%mod)%mod * factorial[b]%mod)%mod * factorial[c]%mod)%mod;    return ans;  }  private static void solve(){   int n = sc.nextInt(), T = sc.nextInt();   int len[] = new int[n], genre[] = new int[n];   for(int i=0; i<n; i++){    len[i] = sc.nextInt();    genre[i] = sc.nextInt();   }   int sum[] = new int[(1<<n)];   mod = (long)1e9 + 7;   long ans = 0;   for(int i=1; i<(1<<n); i++){    for(int j=0; j<15; j++){     if((i&(1<<j)) != 0){      sum[i] = sum[i^(1<<j)] + len[j];      break;     }    }    if(sum[i] == T) {     int count[] = {0, 0, 0};     for (int j = 0; j < 15; j++) {      if ((i & (1 << j)) != 0)       count[genre[j] - 1]++;     }     ans = (ans % mod + cal(count) % mod) % mod;    }   }   pw.println(+ans);  } }
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) {   }  }  }.start(); }  BufferedReader in; PrintWriter out; StringTokenizer st = new StringTokenizer("");  int MAXDEG = 5;  private void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  int n = nextInt();  int[] sumDegs = new int[MAXDEG + 1];  sumDegs[0] = 1;  int deg = 1;  for (int i = 1; i <= MAXDEG; i++) {  deg *= 26;  sumDegs[i] = sumDegs[i - 1] + deg;  }  for (int i = 0; i < n; i++) {  String s = nextLine();  String pref = "";  int endPos = -1;  for (int j = 0; j < s.length(); j++) {   if (!isLet(s.charAt(j))) {   endPos = j;   break;   }   pref += s.charAt(j);  }  int num = -1;  try {   num = Integer.parseInt(s.substring(endPos));  } catch (Exception e) {  }  if (num != -1) {   int col = sumDegs[pref.length() - 1];   int val = 0;   for (int j = 0; j < pref.length(); j++) {   val = val * 26 + (pref.charAt(j) - 'A');   }   col += val;   out.println("R" + num + "C" + col);  } else {   int row = Integer.parseInt(s.substring(1, s.indexOf('C')));   int col = Integer.parseInt(s.substring(s.indexOf('C') + 1));   int len = MAXDEG;   while (col < sumDegs[len])   len--;   len++;   col -= sumDegs[len - 1];   String res = "";   while (col > 0) {   res = (char) (col % 26 + 'A') + res;   col /= 26;   }   while (res.length() < len)   res = "A" + res;   out.println(res + row);  }  }  in.close();  out.close(); }  private boolean isLet(char c) {  return c >= 'A' && c <= 'Z'; }  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; } }
4	public class Main {  public static void main(String args[])  {   FastReader input=new FastReader();   PrintWriter out=new PrintWriter(System.out);   int T=1;   while(T-->0)   {    int n=input.nextInt();    int m=input.nextInt();    int k=input.nextInt();    int arr1[][]=new int[n+1][m];    for(int i=1;i<=n;i++)    {     for(int j=1;j<m;j++)     {      arr1[i][j]=input.nextInt();     }    }    int arr2[][]=new int[n][m+1];    for(int i=1;i<n;i++)    {     for(int j=1;j<=m;j++)     {      arr2[i][j]=input.nextInt();     }    }    if(k%2==0)    {     int dp[][][]=new int[n+1][m+1][k+1];     for(int l=2;l<=k;l+=2)     {      for(int i=1;i<=n;i++)      {       for(int j=1;j<=m;j++)       {        int min=Integer.MAX_VALUE;        if(j+1<=m)        {         min=Math.min(min,dp[i][j+1][l-2]+2*arr1[i][j]);        }        if(i+1<=n)        {         min=Math.min(min,dp[i+1][j][l-2]+2*arr2[i][j]);        }        if(j-1>=1)        {         min=Math.min(min,dp[i][j-1][l-2]+2*arr1[i][j-1]);        }        if(i-1>=1)        {         min=Math.min(min,dp[i-1][j][l-2]+2*arr2[i-1][j]);        }        dp[i][j][l]=min;       }      }     }     for(int i=1;i<=n;i++)     {      for(int j=1;j<=m;j++)      {       out.print(dp[i][j][k]+" ");      }      out.println();     }    }    else    {     for(int i=1;i<=n;i++)     {      for(int j=1;j<=m;j++)      {       out.print(-1+" ");      }      out.println();     }    }   }   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;   }  } }
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); } }
1	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 static void main(String args[])  {   Reader sc=new Reader();   PrintWriter out=new PrintWriter(System.out);   int n=sc.i();   String s1=sc.s();   String s2=sc.s();   int pos1=-1;   int pos2=-1;   int arr[][][]=new int[100][100][2];   for(int i=0;i<n;i++)   {    if(s1.charAt(i)!=s2.charAt(i))    {     if(arr[s2.charAt(i)-97][s1.charAt(i)-97][0]==1)     {      pos2=i;      pos1=arr[s2.charAt(i)-97][s1.charAt(i)-97][1];      break;     }     arr[s1.charAt(i)-97][s2.charAt(i)-97][0]=1;     arr[s1.charAt(i)-97][s2.charAt(i)-97][1]=i;    }   }   int ham=0;   for(int i=0;i<n;i++)   {    if(s1.charAt(i)!=s2.charAt(i))    ham++;   }   if(pos1!=-1&&pos2!=-1)   {    System.out.println(ham-2);    System.out.println(pos1+1+" "+(pos2+1));    System.exit(0);   }     int arr1[][]=new int[100][2];   int arr2[][]=new int[100][2];   for(int i=0;i<n;i++)   {    if(s1.charAt(i)!=s2.charAt(i))    {     if(arr1[s1.charAt(i)-97][0]==1)     {      pos2=i;      pos1=arr1[s1.charAt(i)-97][1];      break;     }     if(arr2[s2.charAt(i)-97][0]==1)     {      pos2=i;      pos1=arr2[s2.charAt(i)-97][1];      break;     }     arr1[s2.charAt(i)-97][0]=1;     arr1[s2.charAt(i)-97][1]=i;     arr2[s1.charAt(i)-97][0]=1;     arr2[s1.charAt(i)-97][1]=i;    }   }   if(pos1!=-1&&pos2!=-1)   {    System.out.println(ham-1);    System.out.println(pos1+1+" "+(pos2+1));    System.exit(0);   }   System.out.println(ham);   System.out.println(pos1+" "+pos2);  } }
2	public class Main {  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int n = sc.nextInt(), k = sc.nextInt();   long rhs = 2l * (n + k);   for (int x = 1; ; x++) {    long lhs = 1l * x * x + 3l * x;    if (rhs == lhs) {     out.println(n - x);     break;    }   }   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 int[] nextIntArray(int n) throws IOException {    int[] a = new int[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    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 Integer[] nextIntegerArray(int n) throws IOException {    Integer[] a = new Integer[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }   public double[] nextDoubleArray(int n) throws IOException {    double[] ans = new double[n];    for (int i = 0; i < n; i++)     ans[i] = nextDouble();    return ans;   }   public short nextShort() throws IOException {    return Short.parseShort(next());   }  } }
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");   }    } }
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());  } }  }
5	public class A { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni(), k = ni();  int[][] d = new int[n][2];  for(int i = 0;i < n;i++){  d[i][0] = ni();  d[i][1] = ni();  }   Arrays.sort(d, new Comparator<int[]>() {  public int compare(int[] a, int[] b) {   if(a[0] - b[0] != 0)return -(a[0] - b[0]);   return a[1] - b[1];  }  });   int b;  for(b = k-1;b >= 0 && d[k-1][0] == d[b][0] && d[k-1][1] == d[b][1];b--);  b++;  int a;  for(a = k-1;a < n && d[k-1][0] == d[a][0] && d[k-1][1] == d[a][1];a++);  a--;  out.println(a-b+1); }  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 Hotels {  public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int n = input.nextInt();  int[] cities = new int[n];  int d = input.nextInt();  for (int i = 0; i<n; i++) {  cities[i] = input.nextInt();  }  int possibilities = 0;  ArrayList<Integer> newHotels = new ArrayList<Integer>();  for (int i = 0; i<n; i++) {  int plusD = cities[i]+d;  if (newHotels.indexOf(cities[i]+d)==-1 && minDist(plusD,cities)==d) {   possibilities++;   newHotels.add(cities[i]+d);  }  if (newHotels.indexOf(cities[i]-d)==-1 && minDist(cities[i]-d,cities)==d) {   possibilities++;   newHotels.add(cities[i]-d);  }  }  System.out.println(possibilities); } public static int minDist(int a, int[] arr) {  int minDist = Integer.MAX_VALUE;  for (int i=0; i<arr.length; i++) {  minDist = Math.min(Math.abs(arr[i]-a), minDist); }  return minDist; } }
0	public class lucky {  public static void main(String args[]) throws IOException  {  BufferedReader cin=new BufferedReader(new InputStreamReader(System.in));   String s=cin.readLine();  int l=s.length();  int n=Integer.parseInt(s);  if(s.equals("47") || s.equals("4") || s.equals("7") || s.equals("74") || s.equals("447") || s.equals("477") || s.equals("474") || s.equals("44") || s.equals("77") || s.equals("444") || s.equals("777") || s.equals("747") || s.equals("774") || s.equals("744"))      System.out.println("YES");  else if(n%(47)==0 || n%(4)==0 || n%(7)==0 || n%(74)==0 || n%(447)==0 || n%(477)==0 || n%(474)==0 || n%(44)==0 || n%(77)==0 || n%(444)==0 || n%(777)==0 || n%(747)==0 || n%(774)==0 || n%(744)==0)    System.out.println("YES");  else    System.out.println("NO");    } }
2	public class B { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni(), x = ni(), y = ni();  long c = nl();  int l = x-1, r = n-x;  int u = y-1, d = n-y;  long low = -1, high = 2*n+3;  while(high - low > 1){  long t = (high + low) / 2;  long num = diag(t, l, u) + diag(t, r, u) + diag(t, l, d) + diag(t, r, d)   + hor(t, l) + hor(t, r) + hor(t, u) + hor(t, d) + 1;  if(num >= c){   high = t;  }else{   low = t;  }  }  out.println(high); }  long hor(long t, int n) {  return Math.min(t, n); }  long diag(long t, long r, long u) {  if(t > 2+r+u-2){  return r*u;  }   long ret = t*(t-1)/2;  if(t > r)ret -= (t-r)*(t-r-1)/2;  if(t > u)ret -= (t-u)*(t-u-1)/2;  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 B().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)); } }
5	public class codeforces {  public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  int n=sc.nextInt();  int[] data=new int[n];  for(int i=0;i<n;i++)  data[i]=sc.nextInt();  Arrays.sort(data);  if(data[n-1]!=1)  data[n-1]=1;  else  data[n-1]=2;  Arrays.sort(data);  for(int i=0;i<n;i++)  {  System.out.print(data[i]);  if(i!=n-1)   System.out.print(" ");  }     return; } }
6	public class Main implements Runnable {  private int n;  private int nn;  private boolean[][] gr;  private long[][] D;      private void solve() throws Throwable {   n = nextInt();   nn = 1 << n;   gr = new boolean[n][n];   int m = nextInt();   for (int i = 0; i < m; i++) {    int a = nextInt() - 1, b = nextInt() - 1;    gr[a][b] = gr[b][a] = true;   }   D = new long[n][nn];   for (int i = 0; i < n; i++) {    Arrays.fill(D[i], -1);   }   long count = 0;   for (int i = 0; i < n; i++) {    count += getD(i, i, 1, 1 << i);   }   pw.println(count / 2);  }   private long getD(int first, int last, int cnt, int mask) {   if (D[last][mask] != -1) return D[last][mask];   long ans = 0;   if (cnt >= 3 && gr[first][last])    ans++;   for (int i = first + 1; i < n; i++) {    if (gr[last][i] && (mask & (1 << i)) == 0) {     ans += getD(first, i, cnt + 1, mask | (1 << i));    }   }   D[last][mask] = ans;   return ans;  }      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 {   Thread t = new Thread(new Main());   t.start();   t.join();   if (sError != null) {    throw sError;   }  }  public void run() {   try {    initStreams();    solve();   } catch (Throwable e) {    sError = e;   } finally {    if (pw != null)     pw.close();   }  } }
5	public class A {  static class Entity implements Comparable {   public Entity(int x, int a) {    this.x = x;    this.a = a;   }   public int x, a;   public int compareTo(Object t) {    Entity o = (Entity) t;    return x == o.x ? 0 : x < o.x ? -1 : 1;   }  }  public static void main(String[] args) {   Scanner scanner = new Scanner(System.in);   int n = scanner.nextInt(), t = 2 * scanner.nextInt();   if (1 == n) {    System.out.println(2);   } else {    int rez = 2;    ArrayList<Entity> list = new ArrayList<Entity>();    for (int i = 0; i < n; i++) {     list.add(new Entity(scanner.nextInt(), scanner.nextInt()));    }    Collections.sort(list);    for (int i = 1; i < n; i++) {     int num = 2 * (list.get(i).x - list.get(i - 1).x)       - list.get(i).a - list.get(i - 1).a;     if (t < num) {      rez += 2;     } else if (t == num) {      rez++;     }    }    System.out.println(rez);   }  } }
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);  }  } }
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);   ACodehorsesTShirts solver = new ACodehorsesTShirts();   solver.solve(1, in, out);   out.close();  }  static class ACodehorsesTShirts {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.nextInt();    Map<String, Integer> map = new HashMap<>();    for (int i = 0; i < n; i++) {     String ch = in.next();     if (map.containsKey(ch)) {      map.put(ch, map.get(ch) + 1);     } else {      map.put(ch, 1);     }    }    int s = n;    for (int i = 0; i < n; i++) {     String ch = in.next();     if (map.containsKey(ch)) {      if (map.get(ch) == 1) {       map.remove(ch);      } else {       map.put(ch, map.get(ch) - 1);      }      s--;     }    }    out.println(s);   }  }  static class FastScanner {   private BufferedReader br;   private StringTokenizer st;   public FastScanner(InputStream inputStream) {    br = new BufferedReader(new InputStreamReader(inputStream));   }   public String next() {    while (st == null || !st.hasMoreElements()) {     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;   Scanner in = new Scanner(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskF2 solver = new TaskF2();   solver.solve(1, in, out);   out.close();  }  static class TaskF2 {   public void solve(int testNumber, Scanner in, PrintWriter out) {    int n = in.nextInt();    int[] arr = new int[n];    for (int i = 0; i < n; i++) {     arr[i] = in.nextInt();    }    Map<Long, List<Pair>> map = new HashMap<>();    for (int r = 0; r < n; r++) {     long sum = 0;     for (int l = r; l >= 0; l--) {      sum += arr[l];      if (map.containsKey(sum)) {       map.get(sum).add(new Pair(l, r));      } else {       map.put(sum, new ArrayList<>());       map.get(sum).add(new Pair(l, r));      }     }    }    int ans = -1;    List<Pair> ansPairs = new ArrayList<>();    for (long sum : map.keySet()) {     List<Pair> pairs = map.get(sum);     int count = 0;     int idx = -1;     List<Pair> tempPairs = new ArrayList<>();     for (Pair pair : pairs) {      if (pair.i > idx) {       idx = pair.j;       tempPairs.add(pair);       count++;      }     }     if (ans < count) {      ans = count;      ansPairs = tempPairs;     }    }    out.println(ans);    for (Pair pair : ansPairs) {     out.print((pair.i + 1) + " " + (pair.j + 1));     out.println();    }   }   class Pair {    int i;    int j;    Pair(int p, int q) {     i = p;     j = q;    }   }  } }
6	public class Main implements Runnable { private void solution() throws IOException {  int n = in.nextInt();  int m = in.nextInt();  boolean[][] adj = new boolean[n][n];  long res = 0;  for (int i = 0; i < m; ++i) {  int x = in.nextInt();  int y = in.nextInt();  adj[x - 1][y - 1] = true;  adj[y - 1][x - 1] = true;  }  for (int i = 0; i < n; ++i) {  for (int j = i + 1; j < n; ++j) {   if (adj[i][j]) {   --res;   }  }  }  long[][] dp = new long[1 << n][n];  for (int i = 0; i < n; ++i) {  for (int mask = 0; mask < (1 << (n - i)); ++mask) {   for (int j = 0; j < n - i; ++j) {   dp[mask][j] = 0;   }  }  dp[0][0] = 1;  for (int mask = 0; mask < (1 << (n - i)); ++mask) {   for (int j = 0; j < n - i; ++j) {   if (dp[mask][j] != 0) {    for (int k = 0; k < n - i; ++k) {    if (((mask >> k) & 1) == 0 && adj[j + i][k + i]) {     dp[mask | (1 << k)][k] += dp[mask][j];    }    }   }   }   if (((mask >> 0) & 1) != 0) {   res += dp[mask][0];   }  }  }  out.println(res / 2); }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  private class Scanner {  BufferedReader reader;  StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  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 int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
6	public class SimpleTask {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int m = scan.nextInt();  boolean[][] graph = new boolean[n][n];  for (int i = 0; i < m; i++) {  int u = scan.nextInt() - 1;  int v = scan.nextInt() - 1;  graph[u][v] = true;  graph[v][u] = true;  }  long[][] dp = new long[1 << n][n];  long sum = 0;  for (int i = 0; i < n; i++)  dp[1 << i][i] = 1;  for (int mask = 1; mask < (1 << n); mask++) {   int first = Integer.numberOfTrailingZeros(mask);   for (int i = 0; i < n; i++) {   if ((mask & (1 << i)) == 0 || first == i)   continue;   for (int j = 0; j < n; j++) {   if (graph[i][j] && (mask & (1 << j)) != 0)    dp[mask][i] += dp[mask ^ 1 << i][j];   }   if (Integer.bitCount(mask) >= 3 && graph[i][first])   sum += dp[mask][i];  }  }  System.out.println(sum / 2);  scan.close(); } }
2	public class B {  static long n, k;  static long sum(long mid) {  long tmpSum = k * (k + 1) / 2;  long nsum = (mid - 1) * (mid) / 2;  return tmpSum - nsum; }  public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  StringTokenizer sc = new StringTokenizer(br.readLine());  n = Long.parseLong(sc.nextToken()) - 1;  k = Long.parseLong(sc.nextToken()) - 1;  if (n == 0)  out.println(0);  else if (sum(1) < n)  out.println(-1);  else {  long lo = 1;  long hi = k;  long mid;  while (lo < hi) {   mid = (lo + hi) / 2;   long sum = sum(mid);   if (n - sum < 0)   lo = mid + 1;   else if (n - sum < mid) {   hi = mid;   } else   hi = mid - 1;  }  out.println((k - lo + 1) + (n - sum(lo) == 0 ? 0 : 1));  }  br.close();  out.close(); } }
1	public class Main {   private MyScanner scan = new MyScanner();  private PrintWriter out = new PrintWriter(System.out);  private final double PI = Math.PI;  private final int INF = (int)(1e9);  private final double EPS = 1e-6;  private final int SIZEN = (int)(1e7);  private final int MOD = (int)(1e9 + 7);  private final long MODH = 10000000007L, BASE = 10007;  private final int[] DX = {0, 1, 0, -1}, DY = {-1, 0, 1, 0};  int n;  int[] sum;  int[][] a;  public void foo1() {   int n = scan.nextInt();   int sum = 0;   int[] a = new int[n];   for (int i = 0;i < n;++i) {    a[i] = scan.nextInt();    sum += a[i];   }   int avg = sum * 2 / n;   for (int i = 0;i < n;++i) {    if (a[i] == 0) {     continue;    }    for (int j = i + 1;j < n;++j) {     if (a[i] + a[j] == avg) {      a[j] = 0;      System.out.println((i + 1) + " " + (j + 1));      break;     }    }   }  }  public void foo2() {   int n = scan.nextInt();   int m = scan.nextInt();   HashSet<Integer> row = new HashSet<Integer>();   HashSet<Integer> col = new HashSet<Integer>();   for (int i = 0;i < m;++i) {    int x = scan.nextInt();    int y = scan.nextInt();    row.add(x);    col.add(y);    out.print((long) (n - row.size()) * (n - col.size()) + " ");   }  }  public int getId(char c) {   return (c >= 'a' && c <= 'z') ? c - 'a': c - 'A' + 26;  }  public boolean isOk(int len) {   for (int i = 0;i + len <= n;++i) {    boolean flag = true;    for (int j = 0;j < 52;++j) {     if (a[i + len][j] - a[i][j] == 0 && sum[j] != 0) {      flag = false;      break;     }    }    if (flag) {     return true;    }   }   return false;  }  public void foo() {   n = scan.nextInt();   char[] s = scan.next().toCharArray();   a = new int[n + 1][52];   sum = new int[52];   for (int i = 0;i < n;++i) {    for (int j = 0;j < 52;++j) a[i + 1][j] = a[i][j];    ++a[i + 1][getId(s[i])];    ++sum[getId(s[i])];   }   int left = 1, right = n, ans = n;   while (left <= right) {    int mid = (left + right) >> 1;    if (isOk(mid)) {     ans = mid;     right = mid - 1;    } else {     left = mid + 1;    }   }   out.println(ans);  }  public static void main(String[] args)  {   Main m = new Main();   m.foo();   m.out.close();  }     public long gcd(long a, long b)  {   return 0 == b ? a : gcd(b, a % b);  }    public double getDist(long x1, long y1, long x2, long y2, long x, long y)  {   long a = y2 - y1;   long b = x1 - x2;   long c = y1 * (x2 - x1) - x1 * (y2 - y1);   return Math.abs(a * x + b * y + c) / Math.sqrt(a * a + b * b);  }    public double ptToSeg(long x1, long y1, long x2, long y2, long x, long y)  {   double cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);   if(cross <= 0)   {    return (x - x1) * (x - x1) + (y - y1) * (y - y1);   }   double d = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);   if(cross >= d)   {    return (x - x2) * (x - x2) + (y - y2) * (y - y2);   }   double r = cross / d;   double px = x1 + (x2 - x1) * r;   double py = y1 + (y2 - y1) * r;   return (x - px) * (x - px) + (y - py) * (y - py);  }    public int kmpMatch(char[] t, char[] p)  {   int n = t.length;   int m = p.length;   int[] next = new int[m + 1];   next[0] = -1;   int j = -1;   for(int i = 1;i < m;++i)   {    while(j >= 0 && p[i] != p[j + 1])    {     j = next[j];    }    if(p[i] == p[j + 1])    {     ++j;    }    next[i] = j;   }   j = -1;   for(int i = 0;i < n;++i)   {    while(j >= 0 && t[i] != p[j + 1])    {     j = next[j];    }    if(t[i] == p[j + 1])    {     ++j;    }    if(j == m - 1)    {     return i - m + 1;    }   }   return -1;  }    public long hash(String s)  {   long key = 0, t = 1;   for(int i = 0;i < s.length();++i)   {    key = (key + s.charAt(i) * t) % MODH;    t = t * BASE % MODH;   }   return key;  }    public long quickMod(long x, long n)  {   long ans = 1;   while(n > 0)   {    if(1 == n % 2)    {     ans = ans * x % MOD;    }    x = x * x % MOD;    n >>= 1;   }   return ans;  }       public boolean isOnSeg(long x1, long y1, long x2, long y2, long x, long y)  {   return (x - x1) * (y2 - y1) == (x2 - x1) * (y - y1) &&     x >= Math.min(x1, x2) && x <= Math.max(x1, x2) &&     y >= Math.min(y1, y2) && y <= Math.max(y1, y2);  }        class MyScanner  {   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   BufferedInputStream bis = new BufferedInputStream(System.in);   public int read()   {    if (-1 == numChars)    {     throw new InputMismatchException();    }    if (curChar >= numChars)    {     curChar = 0;     try     {      numChars = bis.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 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 & 15;     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 & 15) * m;      c = read();     }    }    return res * sgn;   }   public String next()   {    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 boolean isSpaceChar(int c)   {    return ' ' == c || '\n' == c || '\r' == c || '\t' == c || -1 == c;   }  } }
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(); } }
3	public class C {  static ArrayList<Integer> statements; static final int MOD = (int) 1e9 + 7;  static int[][] memo;  static int solve(int i, int c) {  if(i == statements.size())  return 1;  if(memo[i][c] != -1)  return memo[i][c];  long ans = solve(i + 1, c + statements.get(i));  if(c > 0)  ans += solve(i, c - 1);  return memo[i][c] = (int) (ans % MOD);  }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = sc.nextInt();  statements = new ArrayList<>();  char[] c = new char[n];  for (int i = 0; i < n; i++) {  c[i] = sc.next().charAt(0);  }  if(c[0] == 's')  statements.add(0);  else  statements.add(1);  for (int i = 1; i < n; i++) {  if(c[i - 1] == 'f') {   if(c[i] == 'f')   statements.set(statements.size() - 1, statements.get(statements.size() - 1) + 1);  }else {   if(c[i] == 's')   statements.add(0);   else   statements.add(1);  }  }   memo = new int[statements.size()][n + 1];  for(int[] a : memo)  Arrays.fill(a, -1);  out.println(solve(0, 0));  out.flush();  out.close(); }  static class Scanner {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s));  }  public Scanner(String file) throws FileNotFoundException {  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 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();  }  } }
0	public class A {  BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof;  long f(int x, int y) {  if (x == 0 || y == 0)  return 0;  if (x >= y) {  return x / y + f(y, x % y);  } else {  return y / x + f(x, y % x);  } }  A() throws IOException {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  int t = nextInt();  while (t-- > 0) {  int a = nextInt();  int b = nextInt();  out.println(f(a, b));  }  out.close(); }  public static void main(String[] args) throws IOException {  new A(); }  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()); } }
0	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 = readInt();  while(qq-- > 0) {  pw.println(solve(readInt(), readInt()));  }  pw.close(); }  public static int solve(int a, int b) {  if(a < b) {  return solve(b,a);  }  if(a%b == 0) {  return a / b;  }  return a/b + solve(b,a%b); }    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 nextToken() throws IOException {  while(st == null || !st.hasMoreTokens()) {  if(!br.ready()) {   pw.close();   System.exit(0);  }  st = new StringTokenizer(br.readLine().trim());  }  return st.nextToken(); } }
4	public class C implements Runnable{          private final static Random rnd = new Random();  private final static String fileName = "";  private void solve() {   int n = readInt();   int m = readInt();   int k = readInt();   Point[] starts = readPointArray(k);   for (Point start : starts) {    start.x--;    start.y--;   }   Point furthest = bfs(n, m, starts);   out.println((furthest.x + 1) + " " + (furthest.y + 1));  }  private Point bfs(int n, int m, Point[] starts) {   final int INF = n * m + 1;   boolean[][] used = new boolean[n][m];   Queue<Integer> queue = new ArrayDeque<>();   for (Point start : starts) {    used[start.x][start.y] = true;    queue.add(start.x * m + start.y);   }   int last = -1;   while (queue.size() > 0) {    int from = queue.poll();    last = from;    int fromX = from / m, fromY = from % m;    for (int[] step : steps) {     int toX = fromX + step[0];     int toY = fromY + step[1];     if (!checkCell(toX, n, toY, m)) continue;     if (used[toX][toY]) continue;     used[toX][toY] = true;     queue.add(toX * m + toY);    }   }   return new Point(last / m, last % m);  }    private final static boolean FIRST_INPUT_STRING = false;  private final static boolean MULTIPLE_TESTS = true;  private final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  private final static int MAX_STACK_SIZE = 128;  private final static boolean OPTIMIZE_READ_NUMBERS = false;    public void run(){   try{    timeInit();    Locale.setDefault(Locale.US);    init();    if (ONLINE_JUDGE) {     solve();    } else {     do {      try {       timeInit();       solve();       time();       out.println();      } catch (NumberFormatException e) {       break;      } catch (NullPointerException e) {       if (FIRST_INPUT_STRING) break;       else throw e;      }     } while (MULTIPLE_TESTS);    }    out.close();    time();   }catch (Exception e){    e.printStackTrace(System.err);    System.exit(-1);   }  }    private BufferedReader in;  private OutputWriter out;  private StringTokenizer tok = new StringTokenizer("");  public static void main(String[] args){   new Thread(null, new C(), "", MAX_STACK_SIZE * (1L << 20)).start();  }    private void init() throws FileNotFoundException{   Locale.setDefault(Locale.US);   in = new BufferedReader(new FileReader("input.txt"));   out = new OutputWriter("output.txt");  }    private long timeBegin;  private void timeInit() {   this.timeBegin = System.currentTimeMillis();  }  private void time(){   long timeEnd = System.currentTimeMillis();   System.err.println("Time = " + (timeEnd - timeBegin));  }  private void debug(Object... objects){   if (ONLINE_JUDGE){    for (Object o: objects){     System.err.println(o.toString());    }   }  }    private String delim = " ";  private String readLine() {   try {    return in.readLine();   } catch (IOException e) {    throw new RuntimeIOException(e);   }  }  private String readString() {   try {    while(!tok.hasMoreTokens()){     tok = new StringTokenizer(readLine());    }    return tok.nextToken(delim);   } catch (NullPointerException e) {    return null;   }  }    private final char NOT_A_SYMBOL = '\0';  private char readChar() {   try {    int intValue = in.read();    if (intValue == -1){     return NOT_A_SYMBOL;    }    return (char) intValue;   } catch (IOException e) {    throw new RuntimeIOException(e);   }  }  private char[] readCharArray() {   return readLine().toCharArray();  }  private char[][] readCharField(int rowsCount) {   char[][] field = new char[rowsCount][];   for (int row = 0; row < rowsCount; ++row) {    field[row] = readCharArray();   }   return field;  }    private long optimizedReadLong() {   int sign = 1;   long result = 0;   boolean started = false;   while (true) {    try {     int j = in.read();     if (-1 == j) {      if (started) return sign * result;      throw new NumberFormatException();     }     if (j == '-') {      if (started) throw new NumberFormatException();      sign = -sign;     }     if ('0' <= j && j <= '9') {      result = result * 10 + j - '0';      started = true;     } else if (started) {      return sign * result;     }    } catch (IOException e) {     throw new RuntimeIOException(e);    }   }  }  private int readInt() {   if (!OPTIMIZE_READ_NUMBERS) {    return Integer.parseInt(readString());   } else {    return (int) optimizedReadLong();   }  }  private int[] readIntArray(int size) {   int[] array = new int[size];   for (int index = 0; index < size; ++index){    array[index] = readInt();   }   return array;  }  private int[] readSortedIntArray(int size) {   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;  }  private int[] readIntArrayWithDecrease(int size) {   int[] array = readIntArray(size);   for (int i = 0; i < size; ++i) {    array[i]--;   }   return array;  }    private int[][] readIntMatrix(int rowsCount, int columnsCount) {   int[][] matrix = new int[rowsCount][];   for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) {    matrix[rowIndex] = readIntArray(columnsCount);   }   return matrix;  }  private int[][] readIntMatrixWithDecrease(int rowsCount, int columnsCount) {   int[][] matrix = new int[rowsCount][];   for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) {    matrix[rowIndex] = readIntArrayWithDecrease(columnsCount);   }   return matrix;  }    private long readLong() {   if (!OPTIMIZE_READ_NUMBERS) {    return Long.parseLong(readString());   } else {    return optimizedReadLong();   }  }  private long[] readLongArray(int size) {   long[] array = new long[size];   for (int index = 0; index < size; ++index){    array[index] = readLong();   }   return array;  }    private double readDouble() {   return Double.parseDouble(readString());  }  private double[] readDoubleArray(int size) {   double[] array = new double[size];   for (int index = 0; index < size; ++index){    array[index] = readDouble();   }   return array;  }    private BigInteger readBigInteger() {   return new BigInteger(readString());  }  private BigDecimal readBigDecimal() {   return new BigDecimal(readString());  }    private Point readPoint() {   int x = readInt();   int y = readInt();   return new Point(x, y);  }  private Point[] readPointArray(int size) {   Point[] array = new Point[size];   for (int index = 0; index < size; ++index){    array[index] = readPoint();   }   return array;  }    @Deprecated  private List<Integer>[] readGraph(int vertexNumber, int edgeNumber) {   @SuppressWarnings("unchecked")   List<Integer>[] graph = new List[vertexNumber];   for (int index = 0; index < vertexNumber; ++index){    graph[index] = new ArrayList<>();   }   while (edgeNumber-- > 0){    int from = readInt() - 1;    int to = readInt() - 1;    graph[from].add(to);    graph[to].add(from);   }   return graph;  }  private static class GraphBuilder {   final int size;   final List<Integer>[] edges;   static GraphBuilder createInstance(int size) {    List<Integer>[] edges = new List[size];    for (int v = 0; v < size; ++v) {     edges[v] = new ArrayList<>();    }    return new GraphBuilder(edges);   }   private GraphBuilder(List<Integer>[] edges) {    this.size = edges.length;    this.edges = edges;   }   public void addEdge(int from, int to) {    addDirectedEdge(from, to);    addDirectedEdge(to, from);   }   public void addDirectedEdge(int from, int to) {    edges[from].add(to);   }   public int[][] build() {    int[][] graph = new int[size][];    for (int v = 0; v < size; ++v) {     List<Integer> vEdges = edges[v];     graph[v] = castInt(vEdges);    }    return graph;   }  }    private static class IntIndexPair {   static Comparator<IntIndexPair> increaseComparator = new Comparator<C.IntIndexPair>() {    @Override    public int compare(C.IntIndexPair indexPair1, C.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<C.IntIndexPair>() {    @Override    public int compare(C.IntIndexPair indexPair1, C.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 IntIndexPair[] from(int[] array) {    IntIndexPair[] iip = new IntIndexPair[array.length];    for (int i = 0; i < array.length; ++i) {     iip[i] = new IntIndexPair(array[i], i);    }    return iip;   }   int value, index;   IntIndexPair(int value, int index) {    super();    this.value = value;    this.index = index;   }   int getRealIndex() {    return index + 1;   }  }  private IntIndexPair[] readIntIndexArray(int size) {   IntIndexPair[] array = new IntIndexPair[size];   for (int index = 0; index < size; ++index) {    array[index] = new IntIndexPair(readInt(), index);   }   return array;  }    private static class OutputWriter extends PrintWriter {   final int DEFAULT_PRECISION = 12;   private int precision;   private String format, formatWithSpace;   {    precision = DEFAULT_PRECISION;    format = createFormat(precision);    formatWithSpace = format + " ";   }   OutputWriter(OutputStream out) {    super(out);   }   OutputWriter(String fileName) throws FileNotFoundException {    super(fileName);   }   int getPrecision() {    return precision;   }   void setPrecision(int precision) {    precision = max(0, precision);    this.precision = precision;    format = createFormat(precision);    formatWithSpace = format + " ";   }   String createFormat(int precision){    return "%." + precision + "f";   }   @Override   public void print(double d){    printf(format, d);   }   void printWithSpace(double d){    printf(formatWithSpace, d);   }   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);   }   void printlnAll(double... d){    printAll(d);    println();   }  }    private static class RuntimeIOException extends RuntimeException {      private static final long serialVersionUID = -6463830523020118289L;   RuntimeIOException(Throwable cause) {    super(cause);   }  }       private static final int[][] steps = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};  private static final int[][] steps8 = {    {-1, 0}, {1, 0}, {0, -1}, {0, 1},    {-1, -1}, {1, 1}, {1, -1}, {-1, 1}  };  private static boolean checkCell(int row, int rowsCount, int column, int columnsCount) {   return checkIndex(row, rowsCount) && checkIndex(column, columnsCount);  }  private static boolean checkIndex(int index, int lim){   return (0 <= index && index < lim);  }    private static boolean checkBit(int mask, int bit){   return (mask & (1 << bit)) != 0;  }  private static boolean checkBit(long mask, int bit){   return (mask & (1L << bit)) != 0;  }    private static long getSum(int[] array) {   long sum = 0;   for (int value: array) {    sum += value;   }   return sum;  }  private static 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);  }    private static int[] getPrimes(int n) {   boolean[] used = new boolean[n];   used[0] = used[1] = true;   int size = 0;   for (int i = 2; i < n; ++i) {    if (!used[i]) {     ++size;     for (int j = 2 * i; j < n; j += i) {      used[j] = true;     }    }   }   int[] primes = new int[size];   for (int i = 0, cur = 0; i < n; ++i) {    if (!used[i]) {     primes[cur++] = i;    }   }   return primes;  }    private static long lcm(long a, long b) {   return a / gcd(a, b) * b;  }  private static long gcd(long a, long b) {   return (a == 0 ? b : gcd(b % a, a));  }    private static class MultiSet<ValueType> {   public static <ValueType> MultiSet<ValueType> createMultiSet() {    Map<ValueType, Integer> multiset = new HashMap<>();    return new MultiSet<>(multiset);   }   private final Map<ValueType, Integer> multiset;   private int size;   public MultiSet(Map<ValueType, Integer> multiset) {    this.multiset = multiset;    this.size = 0;   }   public int size() {    return size;   }   public void inc(ValueType value) {    int count = get(value);    multiset.put(value, count + 1);    ++size;   }   public void dec(ValueType value) {    int count = get(value);    if (count == 0) return;    if (count == 1) multiset.remove(value);    else multiset.put(value, count - 1);    --size;   }   public int get(ValueType value) {    Integer count = multiset.get(value);    return (count == null ? 0 : count);   }  }    private static class IdMap<KeyType> extends HashMap<KeyType, Integer> {      private static final long serialVersionUID = -3793737771950984481L;   public IdMap() {    super();   }   int getId(KeyType key) {    Integer id = super.get(key);    if (id == null) {     super.put(key, id = size());    }    return id;   }  }    private static int[] castInt(List<Integer> list) {   int[] array = new int[list.size()];   for (int i = 0; i < array.length; ++i) {    array[i] = list.get(i);   }   return array;  }  private static long[] castLong(List<Long> list) {   long[] array = new long[list.size()];   for (int i = 0; i < array.length; ++i) {    array[i] = list.get(i);   }   return array;  } }
5	public class Main implements Runnable {   boolean TEST = System.getProperty("ONLINE_JUDGE") == null;   void solve() throws IOException {  int n = nextInt();  Pair[] ps = new Pair[n];  for (int i = 0; i < n; i++) {   ps[i] = new Pair(nextInt(), i + 1);  }  sort(ps, new Comparator<Pair>() {   public int compare(Pair a, Pair b) {   return a.x - b.x;   }  });  BigInteger res = find(ps, n);  for (int i = 0; i * 2 < n; i++) {   Pair t = ps[i];   ps[i] = ps[n - i - 1];   ps[n - i - 1] = t;  }  res = res.add(find(ps, n));  out.println(res);  }   BigInteger find(Pair[] ps, int n) {  BigInteger res = ZERO;  int i = 0;  FenwickTree ft = new FenwickTree(n + 1);  boolean[] added = new boolean[n + 1];  for (int j = 0; j < n; j++) {   if (abs(ps[j].x - ps[i].x) <= 1) continue;   while (abs(ps[j].x - ps[i].x) > 1) {   if (!added[ps[i].i]) ft.add(ps[i].i, 1);   added[ps[i].i] = true;   i++;   }   i--;   long total = ft.sum(n);   long left = ft.sum(ps[j].i - 1);   long right = total - left;   res = res.add(valueOf(ps[j].x).multiply(valueOf(left)));   res = res.add(valueOf(-ps[j].x).multiply(valueOf(right)));  }  return res;  }   class Pair implements Comparable<Pair> {  int x, i;    Pair(int x, int i) {   this.x = x;   this.i = i;  }    public int compareTo(Pair p) {   return x - p.x;  }    public String toString() {   return "(" + x + ", " + i + ")";  }  }   class FenwickTree {  int n;  int[] tree;     public FenwickTree(int n) {   this.n = n;   tree = new int[n];  }     public int sum(int id) {   int res = 0;   while (id > 0) {   res += tree[id];   id -= id & -id;   }   return res;  }     public void add(int id, int v) {   while (id < n) {   tree[id] += v;   id += id & -id;   }  }   int findkth(int k) {   int low = 1, high = n;   while (low < high) {   int mid = (low + high) / 2;   int val = sum(mid);   if(val < k) low = mid + 1;   else high = mid;   }   return low;  }  }    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 debug(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("input.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 Main(), "", 1 << 20).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 Solution{  public static void main(String[] args)throws IOException{   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int t = Integer.parseInt(br.readLine());   StringTokenizer st;   for(int z=0;z<t;z++){    st = new StringTokenizer(br.readLine());    int n = Integer.parseInt(st.nextToken());    st = new StringTokenizer(br.readLine());    int min=1;    int max=1;    for(int i=0;i<n;i++){     int k = Integer.parseInt(st.nextToken());     if(max<k){      min = max;      max = k;     }else if(min<k){      min = k;     }    }    int res = Math.min(n-2,min-1);    System.out.println(res);   }  } }
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 E {  void solve(BufferedReader in) throws Exception {   int[] xx = toInts(in.readLine());   int n = xx[0];   double k = xx[1];   int[][] board = new int[n][n];   for(int i = 0; i<n; i++) board[i] = toInts(in.readLine());   int fst = n/2;   int snd = n - fst;   int[] maxc = new int[1<<fst];   int max = 1;   for(int i = 0; i<(1<<fst); i++) {    for(int j = 0; j<fst; j++) {     if((i&1<<j) != 0) maxc[i] = Math.max(maxc[i], maxc[i^(1<<j)]);    }    boolean ok = true;    for(int a = 0; a<fst; a++) if((i&1<<a) != 0) {     for(int b = a+1; b<fst; b++) if((i&1<<b) != 0) {      if(board[a][b] == 0) ok = false;     }    }    if(ok) {     maxc[i] = Integer.bitCount(i);     max = Math.max(max, maxc[i]);    }   }   for(int i = 0; i<(1<<snd); i++) {    boolean ok = true;    for(int a = 0; a<snd; a++) if((i&1<<a) != 0) {     for(int b = a+1; b<snd; b++) if((i&1<<b) != 0) {      if(board[a+fst][b+fst] == 0) ok = false;     }    }    if(!ok) continue;    int mask = 0;    for(int a = 0; a<fst; a++) {     ok = true;     for(int b = 0; b<snd; b++) {      if((i&1<<b) != 0) {       if(board[a][b+fst] == 0) ok = false;      }     }     if(ok) mask |= (1<<a);    }    max = Math.max(Integer.bitCount(i) + maxc[mask], max);   }   System.out.println(k*k*(max-1.0)/(2*max));  }  int toInt(String s) {return Integer.parseInt(s);}  int[] toInts(String s) {   String[] a = s.split(" ");   int[] o = new int[a.length];   for(int i = 0; i<a.length; i++) o[i] = toInt(a[i]);   return o;  }  void e(Object o) {   System.err.println(o);  }  public static void main(String[] args) throws Exception{   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   (new E()).solve(in);  } }
2	public class icpc {  public static void main(String[] args) throws IOException  {   Reader in = new Reader();   long n = in.nextLong();   long k = in.nextLong();   long val = 2 * n + 2 * k;   long D = 9 + 4 * val;   long sqrtD = (long)Math.sqrt((double)D);   double r1 = (-3 + sqrtD) / 2;   long r1DAsh = (long)r1;   System.out.println(n - r1DAsh);  } } class NumberTheory {  public boolean isPrime(long n)  {   if(n < 2)    return false;   for(long x = 2;x * x <= n;x++)   {    if(n % x == 0)     return false;   }   return true;  }  public ArrayList<Integer> primeFactorisation(int n)  {   ArrayList<Integer> f = new ArrayList<>();   for(int x=2;x * x <= n;x++)   {    while(n % x == 0)    {     f.add(x);     n /= x;    }   }   if(n > 1)    f.add(n);   return f;  }  public int[] sieveOfEratosthenes(int n)  {   int[] sieve = new int[n + 1];   for(int x=2;x<=n;x++)   {    if(sieve[x] != 0)     continue;    sieve[x] = x;    for(int u=2*x;u<=n;u+=x)     if(sieve[u] == 0)      sieve[u] = x;   }   return sieve;  }  public long gcd(long a, long b)  {   if(b == 0)    return a;   return gcd(b, a % b);  }  public long phi(long n)  {   double result = n;   for(long p=2;p*p<=n;p++)   {    if(n % p == 0)    {     while (n % p == 0)      n /= p;     result *= (1.0 - (1.0 / (double)p));    }   }   if(n > 1)    result *= (1.0 - (1.0 / (double)n));   return (long)result;  }  public Name extendedEuclid(long a, long b)  {   if(b == 0)    return new Name(a, 1, 0);   Name n1 = extendedEuclid(b, a % b);   Name n2 = new Name(n1.d, n1.y, n1.x - (long)Math.floor((double)a / b) * n1.y);   return n2;  }  public long modularExponentiation(long a, long b, long n)  {   long d = 1L;   String bString = Long.toBinaryString(b);   for(int i=0;i<bString.length();i++)   {    d = (d * d) % n;    if(bString.charAt(i) == '1')     d = (d * a) % n;   }   return d;  } } class Name {  long d;  long x;  long y;  public Name(long d, long x, long y)  {   this.d = d;   this.x = x;   this.y = y;  } } class SuffixArray {  int ALPHABET_SZ = 256, N;  int[] T, lcp, sa, sa2, rank, tmp, c;  public SuffixArray(String str)  {   this(toIntArray(str));  }  private static int[] toIntArray(String s)  {   int[] text = new int[s.length()];   for (int i = 0; i < s.length(); i++) text[i] = s.charAt(i);   return text;  }  public SuffixArray(int[] text)  {   T = text;   N = text.length;   sa = new int[N];   sa2 = new int[N];   rank = new int[N];   c = new int[Math.max(ALPHABET_SZ, N)];   construct();   kasai();  }  private void construct()  {   int i, p, r;   for (i = 0; i < N; ++i) c[rank[i] = T[i]]++;   for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];   for (i = N - 1; i >= 0; --i) sa[--c[T[i]]] = i;   for (p = 1; p < N; p <<= 1)   {    for (r = 0, i = N - p; i < N; ++i) sa2[r++] = i;    for (i = 0; i < N; ++i) if (sa[i] >= p) sa2[r++] = sa[i] - p;    Arrays.fill(c, 0, ALPHABET_SZ, 0);    for (i = 0; i < N; ++i) c[rank[i]]++;    for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];    for (i = N - 1; i >= 0; --i) sa[--c[rank[sa2[i]]]] = sa2[i];    for (sa2[sa[0]] = r = 0, i = 1; i < N; ++i)    {     if (!(rank[sa[i - 1]] == rank[sa[i]]       && sa[i - 1] + p < N       && sa[i] + p < N       && rank[sa[i - 1] + p] == rank[sa[i] + p])) r++;     sa2[sa[i]] = r;    }    tmp = rank;    rank = sa2;    sa2 = tmp;    if (r == N - 1) break;    ALPHABET_SZ = r + 1;   }  }  private void kasai()  {   lcp = new int[N];   int[] inv = new int[N];   for (int i = 0; i < N; i++) inv[sa[i]] = i;   for (int i = 0, len = 0; i < N; i++)   {    if (inv[i] > 0)    {     int k = sa[inv[i] - 1];     while ((i + len < N) && (k + len < N) && T[i + len] == T[k + len]) len++;     lcp[inv[i] - 1] = len;     if (len > 0) len--;    }   }  } } class ZAlgorithm {  public int[] calculateZ(char input[])  {   int Z[] = new int[input.length];   int left = 0;   int right = 0;   for(int k = 1; k < input.length; k++) {    if(k > right) {     left = right = k;     while(right < input.length && input[right] == input[right - left]) {      right++;     }     Z[k] = right - left;     right--;    } else {         int k1 = k - left;         if(Z[k1] < right - k + 1) {      Z[k] = Z[k1];     } else {      left = k;      while(right < input.length && input[right] == input[right - left]) {       right++;      }      Z[k] = right - left;      right--;     }    }   }   return Z;  }  public ArrayList<Integer> matchPattern(char text[], char pattern[])  {   char newString[] = new char[text.length + pattern.length + 1];   int i = 0;   for(char ch : pattern) {    newString[i] = ch;    i++;   }   newString[i] = '$';   i++;   for(char ch : text) {    newString[i] = ch;    i++;   }   ArrayList<Integer> result = new ArrayList<>();   int Z[] = calculateZ(newString);   for(i = 0; i < Z.length ; i++) {    if(Z[i] == pattern.length) {     result.add(i - pattern.length - 1);    }   }   return result;  } } class KMPAlgorithm {  public int[] computeTemporalArray(char[] pattern)  {   int[] lps = new int[pattern.length];   int index = 0;   for(int i=1;i<pattern.length;)   {    if(pattern[i] == pattern[index])    {     lps[i] = index + 1;     index++;     i++;    }    else    {     if(index != 0)     {      index = lps[index - 1];     }     else     {      lps[i] = 0;      i++;     }    }   }   return lps;  }  public ArrayList<Integer> KMPMatcher(char[] text, char[] pattern)  {   int[] lps = computeTemporalArray(pattern);   int j = 0;   int i = 0;   int n = text.length;   int m = pattern.length;   ArrayList<Integer> indices = new ArrayList<>();   while(i < n)   {    if(pattern[j] == text[i])    {     i++;     j++;    }    if(j == m)    {     indices.add(i - j);     j = lps[j - 1];    }    else if(i < n && pattern[j] != text[i])    {     if(j != 0)      j = lps[j - 1];     else      i = i + 1;    }   }   return indices;  } } class Hashing {  public long[] computePowers(long p, int n, long m)  {   long[] powers = new long[n];   powers[0] = 1;   for(int i=1;i<n;i++)   {    powers[i] = (powers[i - 1] * p) % m;   }   return powers;  }  public long computeHash(String s)  {   long p = 31;   long m = 1_000_000_009;   long hashValue = 0L;   long[] powers = computePowers(p, s.length(), m);   for(int i=0;i<s.length();i++)   {    char ch = s.charAt(i);    hashValue = (hashValue + (ch - 'a' + 1) * powers[i]) % m;   }   return hashValue;  } } class BasicFunctions {  public long min(long[] A)  {   long min = Long.MAX_VALUE;   for(int i=0;i<A.length;i++)   {    min = Math.min(min, A[i]);   }   return min;  }  public long max(long[] A)  {   long max = Long.MAX_VALUE;   for(int i=0;i<A.length;i++)   {    max = Math.max(max, A[i]);   }   return max;  } } class Matrix {  long a;  long b;  long c;  long d;  public Matrix(long a, long b, long c, long d)  {   this.a = a;   this.b = b;   this.c = c;   this.d = d;  } } class MergeSortInt {      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++;   }  }     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);   }  } } class MergeSortLong {      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++;   }  }     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);   }  } } class Node {  String a;  String b;  Node(String s1,String s2)  {   this.a = s1;   this.b = s2;  }  @Override  public boolean equals(Object ob)  {   if(ob == null)    return false;   if(!(ob instanceof Node))    return false;   if(ob == this)    return true;   Node obj = (Node)ob;   if(this.a.equals(obj.a) && this.b.equals(obj.b))    return true;   return false;  }  @Override  public int hashCode()  {   return (int)this.a.length();  } } 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();  } } class FenwickTree {  public void update(long[] fenwickTree,long delta,int index)  {   index += 1;   while(index < fenwickTree.length)   {    fenwickTree[index] += delta;    index = index + (index & (-index));   }  }  public long prefixSum(long[] fenwickTree,int index)  {   long sum = 0L;   index += 1;   while(index > 0)   {    sum += fenwickTree[index];    index -= (index & (-index));   }   return sum;  } } class SegmentTree {  public int nextPowerOfTwo(int num)  {   if(num == 0)    return 1;   if(num > 0 && (num & (num - 1)) == 0)    return num;   while((num &(num - 1)) > 0)   {    num = num & (num - 1);   }   return num << 1;  }  public int[] createSegmentTree(int[] input)  {   int np2 = nextPowerOfTwo(input.length);   int[] segmentTree = new int[np2 * 2 - 1];   for(int i=0;i<segmentTree.length;i++)    segmentTree[i] = Integer.MIN_VALUE;   constructSegmentTree(segmentTree,input,0,input.length-1,0);   return segmentTree;  }  private void constructSegmentTree(int[] segmentTree,int[] input,int low,int high,int pos)  {   if(low == high)   {    segmentTree[pos] = input[low];    return;   }   int mid = (low + high)/ 2;   constructSegmentTree(segmentTree,input,low,mid,2*pos + 1);   constructSegmentTree(segmentTree,input,mid+1,high,2*pos + 2);   segmentTree[pos] = Math.max(segmentTree[2*pos + 1],segmentTree[2*pos + 2]);  }  public int rangeMinimumQuery(int []segmentTree,int qlow,int qhigh,int len)  {   return rangeMinimumQuery(segmentTree,0,len-1,qlow,qhigh,0);  }  private int rangeMinimumQuery(int segmentTree[],int low,int high,int qlow,int qhigh,int pos)  {   if(qlow <= low && qhigh >= high){    return segmentTree[pos];   }   if(qlow > high || qhigh < low){    return Integer.MIN_VALUE;   }   int mid = (low+high)/2;   return Math.max(rangeMinimumQuery(segmentTree, low, mid, qlow, qhigh, 2 * pos + 1),     rangeMinimumQuery(segmentTree, mid + 1, high, qlow, qhigh, 2 * pos + 2));  } }
0	public class Solution{  public static void main(String[] args){   Scanner in = new Scanner(System.in);   int pairs = in.nextInt();   while (pairs > 0){    in.nextLine();    int a = in.nextInt();    int b = in.nextInt();    int count = 0;    while (a != 0 && b != 0){     if (b >= a && a != 0){      count += b/a;      b = b%a;     }     if (a > b && b != 0){      count += a/b;      a = a%b;     }    }    System.out.println(count);    pairs--;   }  } }
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());   }  } }
5	public class R113A {  public static void main(String[] args){   Scanner in = new Scanner(System.in);   int n = in.nextInt(), k = in.nextInt();   int[] ind = new int[n];   int[] p = new int[n];   int[] t = new int[n];   for (int i = 0; i < n; i++){    ind[i] = i;    p[i] = in.nextInt();    t[i] = in.nextInt();   }     for (int i = 0; i < n - 1; i++)   for (int j = i + 1; j < n; j++){    if (p[i] < p[j] || (p[i] == p[j] && t[i] > t[j])){     int tmp = p[i];     p[i] = p[j];     p[j] = tmp;     tmp = t[i];     t[i] = t[j];     t[j] = tmp;    }   }     int i = k - 1;   while (i > 0 && p[i] == p[i - 1] && t[i] == t[i - 1]) i--;    int j = 0;   while (i < n - 1 && p[i] == p[i + 1] && t[i] == t[i + 1]) {    i++;    j++;   }   System.out.println(j + 1);       } }
4	public class Main{  private static Parser in;  private static PrintWriter out;   public static void main(String[] args){   in = new Parser(System.in);   out = new PrintWriter(System.out);          String s = in.nextString(100);   int len = 0;   String ss = "";        l:for (int i = 1; i<=s.length(); i++){    for(int j = 0; j+i<=s.length();j++){     char[] c = new char[i];     char[] cc = new char[i];     s.getChars(j, j+i, c, 0);     String sss = new String(c);         for(int k = j+1; k+i<=s.length();k++){            s.getChars(k, k+i, cc, 0);      String ssss = new String(cc);      if(sss.equals(ssss)) {len = i; continue l;}     }    }   }        System.out.println(len);    } }  class Parser {  final private int BUFFER_SIZE = 1 << 16;  private DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;   public Parser(InputStream in) {    din = new DataInputStream(in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;  }  public String nextString(int size) {   byte[] ch = new byte[size];   int point = 0;   try {    byte c = read();    while (c == ' ' || c == '\n' || c=='\r')     c = read();    while (c != ' ' && c != '\n' && c!='\r') {     ch[point++] = c;     c = read();    }   } catch (Exception e) {}   return new String(ch,0,point);   }  public int nextInt() {  int ret = 0;  boolean neg;  try {   byte c = read();   while (c <= ' ')    c = read();   neg = c == '-';   if (neg)    c = read();   do {    ret = ret * 10 + c - '0';    c = read();   } while (c > ' ');   if (neg) return -ret;  } catch (Exception e) {}  return ret;  }  public long nextLong() {   long ret = 0;   boolean neg;   try {    byte c = read();    while (c <= ' ')     c = read();    neg = c == '-';    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';     c = read();    } while (c > ' ');     if (neg) return -ret;   } catch (Exception e) {}   return ret;   }  private void fillBuffer() {   try {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);   } catch (Exception e) {}   if (bytesRead == -1) buffer[0] = -1;  }   private byte read() {   if (bufferPointer == bytesRead) fillBuffer();   return buffer[bufferPointer++];  } }
6	public class MotherOfDragons {  public static void main(String[] args) {   FastScanner scanner = new FastScanner();   PrintWriter out = new PrintWriter(System.out, false);   int n = scanner.nextInt();   double k = scanner.nextInt();   long[] graph = new long[n];   for(Integer i = 0; i < n; i++) {    for(Integer j =0; j < n; j++) {     Integer val = scanner.nextInt();     if (val.equals(1) || i.equals(j)) {   graph[i] |= 1L << j;   }    }   }   int szLeft = n/2;   int szRight = n - szLeft;   int[] dp = new int[1 << szLeft];   int maxMask = 1 << szLeft;   for(int mask = 1; mask <maxMask; mask++) {    int curMask = mask;    for(int j = 0; j < szLeft; j++) {     if (((1 << j) & mask) > 0) {      curMask &= graph[j + szRight] >> szRight;      dp[mask] = Math.max(dp[mask], dp[mask ^ (1 << j)]);     }    }    if (mask == curMask) {     dp[mask] = Math.max(dp[mask],Integer.bitCount(mask));    }   }   int ans = 0;   int rmaxMask = 1 << szRight;   for(int mask = 0; mask < rmaxMask; mask++) {    int curMask = mask;    int oMask = maxMask -1;    for(int j = 0; j < szRight; j++) {     if (((1 << j) & mask) > 0) {      curMask &= (graph[j] & (rmaxMask-1));      oMask &= graph[j] >> szRight;     }    }    if (curMask != mask) continue;    ans = Math.max(ans, Integer.bitCount(mask) + dp[oMask]);   }   k/=ans;   out.println(k * k * (ans * (ans-1))/2);   out.flush();  }  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;   }  } }
5	public class A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int N = sc.nextInt();   int first = Integer.MAX_VALUE, second = Integer.MAX_VALUE;   for (int i = 0, x; i < N; ++i) {    x = sc.nextInt();    if (x < first) {     second = first;     first = x;    } else if (x > first && x < second) {     second = x;    }   }   if (second == Integer.MAX_VALUE)    System.out.println("NO");   else    System.out.println(second);  } }
0	public class Main implements Runnable {  public void _main() throws IOException {  long a = nextLong();  long b = nextLong();  long res = 0;  while (b > 0) {  res += a / b;  long t = a % b;  a = b;  b = t;  }  out.println(res); }  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) {  Locale.setDefault(Locale.UK);  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);  } } }
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();  int k=NextInt()-1;  int ret=0;  Team [] t = new Team[n];  for(int i=0; i<n; i++)  {  readNextLine();  t[i]=new Team(NextInt(), NextInt());  }  Arrays.sort(t);  int ti=t[k].t, p=t[k].p;   for(int i=0; i<n; i++)  if(t[i].t==ti&&t[i].p==p)ret++;        System.out.print(ret);   closeInput();  }  private class Team implements Comparable<Team> {  int p,t;  Team(int p, int t)  {  this.p=p;  this.t=t;  }   public int compareTo(Team d)  {  return 10000*(d.p-p)+t-d.t;  } } }
5	public class Main{ public static void main(String []args){  Scanner cin = new Scanner( System.in );  int n = cin.nextInt();  int [] num = new int [ n ];   for (int i=0; i<n; i++)  num[i] = cin.nextInt();   Arrays.sort( num );   int i = 0;  while ( i < n ){  if ( num[i] != num[0] ) break;  i++;  }   if ( i == n ) System.out.println("NO");  else System.out.println(num[i]); } }
3	public class C {  static int N; static char[] a; static int[][] memo; static int[] ind; static final int MOD = (int) 1e9 + 7;  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  N = sc.nextInt(); a = new char[N];  for(int i = 0; i < N; i++) a[i] = sc.nextChar();   if(N == 1){out.println(1); out.flush(); return;}  memo = new int[N][N + 5];  for(int[] a : memo) Arrays.fill(a, -1);   out.println(dp(0, 1));  out.flush();  out.close(); }  static int dp(int i, int ind) {  if(i == N - 1) return a[i - 1] == 'f'? 1 : ind;  if(i == 0) return dp(i + 1, a[i] == 's'? 1 : 2);  if(memo[i][ind] != -1) return memo[i][ind];  int ans = 0;  if(a[i - 1] == 'f')  ans = dp(i + 1, a[i] == 's'? ind : ind + 1);  else  {  if(ind > 1)   ans = (ans + dp(i, ind -1)) % MOD;  ans = (ans + dp(i + 1, a[i] == 's'? ind : ind + 1)) % MOD;  }  return memo[i][ind] = ans; }  static class Scanner  {  StringTokenizer st;  BufferedReader br;  Scanner(InputStream system) {br = new BufferedReader(new InputStreamReader(system));}  Scanner(String file) throws FileNotFoundException {br = new BufferedReader(new FileReader(file));}  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());}  double nextDouble() throws IOException {return Double.parseDouble(next());}  char nextChar()throws IOException{return next().charAt(0);}  Long nextLong()throws IOException{return Long.parseLong(next());}  boolean ready() throws IOException{return br.ready();}  void waitForInput(){for(long i = 0; i < 3e9; i++);} } }
4	public class A {  public static void main(String[] args){   try{    Scanner scanner = new Scanner(System.in);    String in = scanner.next();    int max = 0;    for(int j=0;j<in.length()-1;j++){     for(int i=j;i<in.length();i++){      if(in.indexOf(in.substring(j, i)) != in.lastIndexOf(in.substring(j, i)) && (i-j)>max){       max = i-j;      }     }    }    System.out.println(max);   }catch(Exception e){    e.printStackTrace();   }  } }
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");    } }   }
5	public class Main {  static double eps = 1e-8;  public static void main(String[] args) {   Scanner r = new Scanner(System.in);     int n = r.nextInt();   int t = r.nextInt();     House[] a = new House[n];   for(int i = 0; i < n; i++){    double c = r.nextInt();    double l = r.nextInt();    a[i] = new House(c-l/2, l);   }     Arrays.sort(a);     int res = 0;   for(int i = 0; i < n-1; i++){    double dist = a[i+1].s - (a[i].s+a[i].l);       if(Math.abs(dist - t) < eps)res++;    else if(dist > t)res += 2;   }     System.out.println(res+2);  } } class House implements Comparable<House>{  double s, l;  public House(double si, double li){   s = si;   l = li;  }  @Override  public int compareTo(House b) {   if(s < b.s)return -1;   else return 1;  } }
3	public class A {  public static void main(String[] args) {  FastReader scan = new FastReader();  PrintWriter out = new PrintWriter(System.out);  Task solver = new Task();  int t = 1;  while(t-->0) solver.solve(1, scan, out);  out.close(); }  static class Task {   public void solve(int testNumber, FastReader scan, PrintWriter out) {  int n = scan.nextInt();  int[] a = new int[n];  boolean[] b = new boolean[n];  int count = 0;  for(int i = 0; i < n; i++) a[i] = scan.nextInt();  Arrays.sort(a);  for(int i = 0; i < n; i++) {   if(b[i]) continue;   count++;   for(int j = i; j < n; j++) {   if(a[j]%a[i] == 0) b[j] = true;   }  }  out.println(count);  } }  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 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;  } }  }
2	public class ehsan { public static BigInteger f(BigInteger m,BigInteger n){  BigInteger s,l;  s=n.multiply(m.add(BigInteger.valueOf(1)));  l=m.multiply(m.add(BigInteger.valueOf(1)));  l=l.divide(BigInteger.valueOf(2));  s=s.subtract(l);  s=s.subtract(m);  return s; } public static BigInteger bs(BigInteger a,BigInteger b,BigInteger n,BigInteger d){  BigInteger c,e;  c=a.add(b);  c=c.divide(BigInteger.valueOf(2));  e=f(c,n);  if(e.equals(d))  return c.add(BigInteger.valueOf(1));  if(a.equals(b.add(BigInteger.valueOf(-1))))  return b.add(BigInteger.valueOf(1));  if(e.compareTo(d)>0)  return bs(a,c,n,d);  return bs(c,b,n,d); } public static void main(String[] args)  {  Scanner sc = new Scanner(System.in);  BigInteger bi1 = sc.nextBigInteger();  BigInteger bi2 = sc.nextBigInteger();  BigInteger i,n=bi2;  BigInteger i2=BigInteger.valueOf(1);  BigInteger sum=BigInteger.valueOf(0);  if(bi1.compareTo(bi2)<0){  System.out.println(0);  return;  }  if(bi1.compareTo(bi2)==0){  System.out.println(1);  return;  }  bi2=((n.multiply(n.add(BigInteger.valueOf(1)))).divide(BigInteger.valueOf(2))).subtract(n.subtract(BigInteger.valueOf(1)));  if(bi1.compareTo(bi2)>0)  System.out.println(-1);  else{  System.out.println(bs(BigInteger.valueOf(0),n.add(BigInteger.valueOf(-2)),n,bi1));  } } }
1	public class C701 {  static FastReader in = null;  static PrintWriter out = null;  public static void solve()  {   int n = in.nint();   String pk = in.next();   boolean[] occ = new boolean[52];   for(int i=0; i<n; i++)   {    char c = pk.charAt(i);    int val = Character.isUpperCase(c)? (int)(c-'A') : (int)(c-'a'+26);    occ[val] = true;   }   int[][] next = new int[n][52];   for(int i=0; i<n; i++) for(int j=0; j<52; j++) next[i][j] = -1;   for(int i= n-1; i>=0; i--) {    char c = pk.charAt(i);    int val = Character.isUpperCase(c)? (int)(c-'A') : (int)(c-'a'+26);    next[i][val] = i;    if(i<n-1)    for(int j=0; j<52; j++)    {     if(j!=val)     {      next[i][j] = next[i+1][j];     }    }   }   int min = Integer.MAX_VALUE;   for(int i=0; i<n; i++)   {    int maxd = 0;    boolean endearly = false;    for(int j=0; j<52; j++)    {     if(occ[j] && next[i][j] == -1)     {      endearly = true;      break;     }     else if(occ[j])     {      maxd = Math.max(maxd, next[i][j]-i+1);     }    }    if(endearly) break;    min = Math.min(min, maxd);   }   out.println(min);   }  public static void main(String[] args)  {   in = new FastReader(System.in);   out = new PrintWriter(System.out);   solve();   out.flush();   out.close();  }  static class FastReader {   BufferedReader read;   StringTokenizer tokenizer;   public FastReader(InputStream in)   {    read = new BufferedReader(new InputStreamReader(in));   }   public String next()   {    while(tokenizer == null || !tokenizer.hasMoreTokens())    {     try{      tokenizer = new StringTokenizer(read.readLine());     }catch(Exception e){      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }   public int nint()   {    return Integer.parseInt(next());   }   public long nlong()   {    return Long.parseLong(next());   }   public double ndouble()   {    return Double.parseDouble(next());   }   public int[] narr(int n)   {    int[] a = new int[n];    for(int i=0; i<n; ++i)    {     a[i] = nint();    }    return a;   }   public long[] nlarr(int n)   {    long[] a = new long[n];    for(int i=0; i<n; ++i)    {     a[i] = nlong();    }    return a;   }  }  }
3	public class Main {  private static class Interval implements Comparable<Interval> {  public int start , end;  public Interval(int start , int end) {  this.start = start;  this.end = end;   }  @Override  public int compareTo(Interval interval) {  return this.end - interval.end;   }  }  private static int getTotal(List<Interval> list) {  int ans = 0 , i , n = list.size();  for (i = 0;i < n;i ++) {  int end = list.get(i).end;  while (i < n && list.get(i).start <= end) {   i ++;    }  i --;  ans ++;  }   return ans; }  private static void solve(List<Interval> list) {  List<int[]> ans = new ArrayList<>();  int i , n = list.size();  for (i = 0;i < n;i ++) {  int start = list.get(i).start , end = list.get(i).end;  while (i < n && list.get(i).start <= end) {   i ++;    }  i --;  ans.add(new int[] {start , end});  }  System.out.println(ans.size());  for (int[] array : ans) {  System.out.println(array[0] + " " + array[1]);  } }  private static long[] a = new long[2000];   public static void main(String[] args) {           Scanner scan = new Scanner(System.in);    Map<Long , List<Interval>> map = new HashMap<>();   int i , j , n = scan.nextInt() , max = 0;  long ans = 0;  for (i = 1;i <= n;i ++) {  a[i] = scan.nextLong();  }  for (i = 1;i <= n;i ++) {  long sum = 0;  for (j = i;j <= n;j ++) {     sum += a[j];   if (!map.containsKey(sum)) {   map.put(sum , new ArrayList<>());   }   map.get(sum).add(new Interval(i , j));    }  }  for (List<Interval> list : map.values()) {  Collections.sort(list);   }   for (Map.Entry<Long , List<Interval>> entry : map.entrySet()) {  int total = getTotal(entry.getValue());  if (total > max) {   max = total;   ans = entry.getKey();    }  }  solve(map.get(ans));   }  }
4	public class Main {  public static void main(String ...args) throws Throwable {   Scanner in = new Scanner(System.in);   String init = in.nextLine();   HashSet<String> h = new HashSet<String>();   for (int len = init.length() - 1; len >= 1; --len) {    h.clear();    for (int pos = 0; pos + len <= init.length(); ++pos) {     String now = init.substring(pos, pos + len);     if (h.contains(now)) {      System.out.println(len);      return;     }     h.add(now);    }   }   System.out.println(0);  } }
5	public class ProblemA {  private final BufferedReader in;  private final PrintStream out;  private StringTokenizer tok = new StringTokenizer("");  private String nextLine = null;  public static void main(String[] args) throws Exception {   new ProblemA();  }  private ProblemA() throws Exception {   in = new BufferedReader(new InputStreamReader(System.in));   out = System.out;   start();   end();  }  private int nextInt() {   return Integer.parseInt(nextWord());  }  private String nextWord() {   if (tok.hasMoreTokens()) {    return tok.nextToken();   } else {    while (!tok.hasMoreTokens()) {     try {      nextLine = in.readLine();      if (nextLine == null) {       return null;      } else {       tok = new StringTokenizer(nextLine);      }     } catch (IOException ex) {      Logger.getLogger(ProblemA.class.getName()).log(Level.SEVERE, null, ex);     }    }    return tok.nextToken();   }  }  private void start() {   int n = nextInt();   int[] a = new int[n];   boolean allOne = true;   for (int i = 0; i < n; i++) {    a[i] = nextInt();    if (a[i] != 1) {     allOne = false;    }   }   Arrays.sort(a);   int[] res = new int[n];   res[0] = 1;   for (int i = 1; i < n; i++) {    res[i] = a[i - 1];   }   if (allOne) {    for (int i = 0; i < n - 1; i++) {     out.print(a[i] + " ");    }    out.print(2);   } else {    for (int i = 0; i < n; i++) {     out.print(res[i] + " ");    }   }  }  private void end() {   out.close();  } }
2	public class Contest176B {  public static void main(String[] args) throws IOException{   Scanner sc = new Scanner(System.in);   long n = sc.nextLong();   int k = sc.nextInt();     if( ((long)k * (long)(k + 1))/2 - 1 - (k - 2) < n){    System.out.println(-1);    return;   }     if(n == 1) {    System.out.println(0);    return;   }     if(n <= k) {    System.out.println(1);    return;      }     int ans = rek(2, k, n, k);     System.out.println(ans);  }   private static int rek(int s, int e, long n, int k){     if(s == e){    return k - s + 1;   }   if(s + 1 == e){    if(sum(e, k) >= n) return k - e + 1;    return k - s + 1;   }   int m = (s + e)/2;     long ans = sum(m, k);     if(ans == n) return k - m + 1;   if(ans < n) return rek(s, m - 1, n, k);   else return rek(m , e, n, k);       }  private static long sum(int a, int b ){   long sum1 = ((long)a * (long)(a - 1))/2;   long sum2 = ((long)b * (long)(b + 1))/2;   int numelement = b - a + 1;     return sum2 - sum1 - (numelement - 1);  }    }
4	public class C { Scanner in; PrintWriter out;  String INPUT = "";  void solve() {  int n = ni();  int m = ni();  int k = ni();  int[][] f=new int[k][2];       for(int i=0;i<k;i++) {    f[i][0]=ni()-1;    f[i][1]=ni()-1;    }    int mx=-1;    int resx=0;    int resy=0;          for(int i=0;i<n;i++) {    for(int j=0;j<m;j++) {     int min=Integer.MAX_VALUE;     for(int l=0;l<k;l++) {     min=Math.min(min, Math.abs(f[l][0]-i)+Math.abs(f[l][1]-j));     }     if(min>mx) {     mx=min;     resx=i;     resy=j;     }    }        }    out.println((resx+1)+" "+(resy+1));     }  void run() throws Exception {  in = INPUT.isEmpty() ? new Scanner(new File("input.txt")) : new Scanner(INPUT);  out = INPUT.isEmpty() ? new PrintWriter("output.txt") : new PrintWriter(System.out);   solve();  out.flush(); }   public static void main(String[] args) throws Exception {  new C().run(); }  int ni() { return Integer.parseInt(in.next()); } void tr(Object... o) { if(INPUT.length() != 0)System.out.println(o.length > 1 || o[0].getClass().isArray() ? Arrays.deepToString(o) : o[0]); } static String join(int[] a, int d){StringBuilder sb = new StringBuilder();for(int v : a){sb.append(v + d + " ");}return sb.toString();} }
1	public class CF_1029E_Tree_with_Small_Distances { static ArrayList<Integer> adj[]; static int dist[]; static boolean visitParent[]; static int ans=0; public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int n =sc.nextInt(); adj=new ArrayList[n+1]; dist = new int[n+1]; visitParent = new boolean[n+1]; for(int i=0;i<=n;i++) adj[i]=new ArrayList<Integer>(); int max=0;  for(int i=1;i<n;i++){  int u = sc.nextInt(),v=sc.nextInt();  adj[u].add(v);  adj[v].add(u); } dist[1]=0; dfs(1,1); System.out.println(ans);   } private static void dfs(int i , int j) {  boolean f = false; for(int k=0;k<adj[i].size();k++){  int x = adj[i].get(k);  if(x!=j){  dist[x]=dist[i]+1;  dfs(x,i);  if(visitParent[x])   f=true;  } }  if(dist[i]>2&&!visitParent[j]&&!f&&!visitParent[i]){  visitParent[j]=true;  ans++;  for(int v=0;v<adj[i].size();v++){    } }  } 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 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 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 boolean ready() throws IOException {return br.ready(); }  }  }
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();  } }
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);  }  }
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());   }  } }
1	public class Main{  public static void main(String[] args) {   new Main().run();  }  Scanner sc=new Scanner(System.in);  void run() {   int n=sc.nextInt();   char[] cs=sc.next().toCharArray();   int h=0;   for(int i=0;i<n;i++)if(cs[i]=='H')h++;   int res=n;   for(int i=0;i<n;i++) {    int val=0;    for(int j=0;j<h;j++)if(cs[(i+j)%n]=='T')val++;    res=min(res,val);   }   System.out.println(res);  } }
2	public class ProblemB {  InputReader in; PrintWriter out;  void solve() {   int n = in.nextInt();   int x = in.nextInt();   int y = in.nextInt();   int c = in.nextInt();   int cur = 1;   for (int k = 1; k <= c; k++) {    if (cur >= c) {     out.println(k - 1);     return;    }       int iLess = n - x;    int iMore = y + k - n;    if (iLess > k)     iLess = k;    if (iMore < 0)     iMore = 0;    int add = iLess - iMore + 1;    if (add < 0)     add = 0;    cur += add;       iLess = n - x;    iMore = 1 + k - y;    if (iLess > k)     iLess = k;    if (iMore < 0)     iMore = 0;       add = iLess - iMore + 1;    if (add < 0)     add = 0;    cur += add;       iLess = x - 1;    iMore = 1 + k - y;    if (iLess > k)     iLess = k;    if (iMore < 0)     iMore = 0;    add = iLess - iMore + 1;    if (add < 0)     add = 0;    cur += add;       iLess = x - 1;    iMore = y + k - n;    if (iLess > k)     iLess = k;    if (iMore < 0)     iMore = 0;    add = iLess - iMore + 1;    if (add < 0)     add = 0;    cur += add;        if (x + k <= n)     cur--;    if (y - k >= 1)     cur--;    if (x - k >= 1)     cur--;    if (y + k <= n)     cur--;   }  }   ProblemB(){   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 ProblemB();  } } 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());  } }
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 B {   public static void main(String[] args) throws NumberFormatException,  IOException {  Scanner sc = new Scanner(System.in);  long n = sc.nextLong(), k = sc.nextLong();        if (n == 1) {  System.out.println(0);  return;  }  if (n <= k) {  System.out.println(1);  return;  }  long seg = (((k + 1) * (k) / 2) - 1);  seg += (2 - k);  if (seg < n) {  System.out.println(-1);  return;  }     long s = 1, f = k;  long mid = (s + f) / 2;  while (s + 1 < f) {  long seg_m = (((mid + k - 1) * (k - mid) / 2));      if (seg_m >= n - 1) {          s = mid;  } else   f = mid;  mid = (s + f) / 2;  }           System.out.println(k - s); } }
0	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);     int n = in.nextInt();     out.println(n+" 0 0");     in.close();   out.close();    } }
4	public class Answer23A{  public static void main(String[] args){ BufferedReader reader=new BufferedReader(new InputStreamReader(System.in)); new Kai(reader).solve();  } } class Kai{  BufferedReader reader;  public Kai(BufferedReader reader){ this.reader=reader;  }  public void solve(){  String s=read(); int max=0; for(int i=1;i<=s.length()-1;i++){  for(int j=0;j<=s.length()-i;j++){  String h=s.substring(j,j+i);  for(int k=j+1;k<=s.length()-i;k++){   if(h.equals(s.substring(k,k+i))){  max=i;   }  }  } } pln(max);    }   public String read(){ String s=null; try{  s=reader.readLine(); }catch(IOException e){  e.printStackTrace(); } return s;  }  public int[] to_i(String[] s){ int[] tmp=new int[s.length]; for(int i=0;i<s.length;i++){  tmp[i]=to_i(s[i]); } return tmp;  }  public long[] to_l(String[] s){ long[] tmp=new long[s.length]; for(int i=0;i<s.length;i++){  tmp[i]=to_l(s[i]); } return tmp;  }  public int to_i(String s){ return Integer.parseInt(s);  }  public long to_l(String s){ return Long.parseLong(s);  }  public void p(Object s){ System.out.print(s);  }  public void pln(Object s){ System.out.println(s);  }  public void debug(Object s){ System.err.print(s);  }  public void debugln(Object s){ System.err.println(s);  } }
0	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());  StringTokenizer tok = new StringTokenizer(br.readLine());  int ax = Integer.parseInt(tok.nextToken());  int ay = Integer.parseInt(tok.nextToken());  tok = new StringTokenizer(br.readLine());  int bx = Integer.parseInt(tok.nextToken());  int by = Integer.parseInt(tok.nextToken());  tok = new StringTokenizer(br.readLine());  int cx = Integer.parseInt(tok.nextToken());  int cy = Integer.parseInt(tok.nextToken());  boolean ans = (bx < ax && cx < ax && by < ay && cy < ay) ||  (bx < ax && cx < ax && by > ay && cy > ay) ||  (bx > ax && cx > ax && by < ay && cy < ay) ||  (bx > ax && cx > ax && by > ay && cy > ay);  System.out.print(ans?"YES":"NO"); } }
1	public class B1 {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int testCount = in.nextInt();   for (int test = 0; test < testCount; test++) {    String src = in.next();    if (src.matches("^R\\d+C\\d+$")) {     Pattern p = Pattern.compile("\\d+");     Matcher m = p.matcher(src);     m.find();     int r = Integer.parseInt(m.group(0));     m.find();     int c = Integer.parseInt(m.group(0));     System.out.println(toBase26(c) + r);    } else {     Pattern p = Pattern.compile("[A-Z]+");     Matcher m = p.matcher(src);     m.find();     String c = m.group(0);     p = Pattern.compile("\\d+");     m = p.matcher(src);     m.find();     int r = Integer.parseInt(m.group(0));     System.out.println("R" + r + "C" + toBase10(c));    }   }  }  private static String toBase26(int n) {   String res = "";   do {    n -= 1;    res = (char)('A' + (n % 26)) + res;    n /= 26;      } while (n > 0);   return res;  }  private static int toBase10(String x) {   int n = 0;   char[] digits = x.toCharArray();   for (int i = 0; i < digits.length; i++) {    n *= 26;    n += digits[i] - 'A' + 1;   }   return n;  } }
3	public class A {  String filename = "";  final int INF = 1_000_000_000;  void solve() {   int n = readInt();   int[] a = new int[n];   for(int i = 0;i<n;i++){    a[i] = readInt();   }   Map<Integer, Integer>[] maps = new Map[n];   Map<Integer, Integer> sums = new HashMap();   for(int i = 0;i<n;i++){    maps[i] = new HashMap<>();   }   for(int i = 0;i<n;i++){    int summ = 0;    for(int j = i;j<n;j++){     summ += a[j];     if(!maps[i].containsKey(summ)) maps[i].put(summ, j);     int x = sums.getOrDefault(summ, 0);     sums.put(summ, x + 1);    }   }   int max = 0;   int goodSumm = 0;   for(int summ : sums.keySet()){    if(sums.get(summ) <= max) continue;    int right = -1;    int ans = 0;    for(int j = 0;j<n;j++){     if(!maps[j].containsKey(summ)) continue;     int end = maps[j].get(summ);     if(right == -1){      right = end;      ans++;      continue;     }     if(j > right){      right = end;      ans++;      continue;     }     if(end < right){      right = end;     }    }    if(max < ans){     max = ans;     goodSumm = summ;    }   }   int left = -1;   int right = -1;   List<Integer> ans = new ArrayList<>();   for(int j = 0;j<n;j++){    if(!maps[j].containsKey(goodSumm)) continue;    int start = j;    int end = maps[j].get(goodSumm);    if(right == -1){     left = j;     right = end;     continue;    }    if(start > right){     ans.add(left + 1);     ans.add(right + 1);     left = start;     right = end;     continue;    }    if(end < right){     left = start;     right = end;    }   }   ans.add(left + 1);   ans.add(right + 1);   out.println(max);   for(int i = 0;i<ans.size();i+=2){    out.println(ans.get(i) + " " + ans.get(i + 1));   }  }  public static void main(String[] args) throws FileNotFoundException {   new A().run();  }  void run() throws FileNotFoundException {   init();   solve();   out.close();  }  BufferedReader in;  PrintWriter out;  StringTokenizer tok = new StringTokenizer("");  void init() throws FileNotFoundException {   if(!filename.equals("")) {    in = new BufferedReader(new FileReader(new File(filename + ".in")));    out = new PrintWriter(new File(filename + ".out"));    return;   }   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);  }  String readLine(){   try{    return in.readLine();   }catch (Exception e){    throw new RuntimeException(e);   }  }  String readString(){   while(!tok.hasMoreTokens()){    String nextLine = readLine();    if(nextLine == null) return null;    tok = new StringTokenizer(nextLine);   }   return tok.nextToken();  }  int readInt(){   return Integer.parseInt(readString());  }  long readLong(){   return Long.parseLong(readString());  } }
5	public class Solution {  private BufferedReader in; private PrintWriter out; private StringTokenizer st;  static class House implements Comparable<House> {  int x, a;  @Override  public int compareTo(House o) {  return x - o.x;  }  public House(int x, int a) {  this.x = x;  this.a = a;  } }  void solve() throws IOException {  int n = nextInt();  int t = nextInt();  House[] hs = new House[n];  for (int i = 0; i < n; ++i) {  hs[i] = new House(nextInt(), nextInt());  }  Arrays.sort(hs);  int ans = 2;  for (int i = 0; i < n - 1; ++i) {  if (hs[i].a + hs[i + 1].a + 2 * t < 2 * (hs[i + 1].x - hs[i].x)) {   ans += 2;  } else if (hs[i].a + hs[i + 1].a + 2 * t == 2 * (hs[i + 1].x - hs[i].x)) {   ans++;  }  }  out.println(ans); }  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(); } }
6	public class CF11D { 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 m = Integer.parseInt(st.nextToken());  boolean[][] ee = new boolean[n][n];  while (m-- > 0) {  st = new StringTokenizer(br.readLine());  int i = Integer.parseInt(st.nextToken()) - 1;  int j = Integer.parseInt(st.nextToken()) - 1;  ee[i][j] = ee[j][i] = true;  }  long cnt = 0;   for (int i = 2; i < n; i++) {  long[][] dp = new long[1 << i][i];  for (int j = 0; j < i; j++)   dp[0][j] = ee[i][j] ? 1 : 0;    for (int b = 1; b < 1 << i; b++)   for (int j = 0; j < i; j++) {   if ((b & 1 << j) > 0)    continue;   for (int k = 0; k < i; k++) {    if ((b & 1 << k) == 0)    continue;    if (ee[k][j])    dp[b][j] += dp[b ^ 1 << k][k];   }   if (dp[b][j] > 0 && ee[j][i])    cnt += dp[b][j];   }  }  System.out.println(cnt / 2); } }
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;} } }
1	public class b { public static void main(String[] args) throws Exception {   BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  StringTokenizer st = new StringTokenizer(f.readLine());  int T = Integer.parseInt(st.nextToken());   for (int t = 0; t < T; t++) {  st = new StringTokenizer(f.readLine());  int n = Integer.parseInt(st.nextToken());  int sqrt = (int)Math.sqrt(n);  int sqrt2 = (int)Math.sqrt(n/2);  if (sqrt*sqrt == n && sqrt%2 == 0) {   out.println("YES");  } else if (2*sqrt2*sqrt2 == n) {   out.println("YES");  } else {   out.println("NO");  }  }   out.close(); } }
5	public class ProblemA_15 {   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());  }   public static void main(String[] args){   new ProblemA_15().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{   int n=readInt();   int t=readInt();   Point[] a=new Point[n];   for (int i=0; i<n; i++){    a[i]=new Point(readInt(), readInt());   }   int count=2;   Arrays.sort(a, new Comparator<Point>(){    @Override    public int compare(Point p1, Point p2) {     return p1.x-p2.x;    }      });   for (int i=1; i<n; i++){    double li=a[i-1].x+(double)a[i-1].y/2;    double ri=a[i].x-(double)a[i].y/2;    if (ri-li>t){     count+=2;    }    if (ri-li==t){     count++;    }   }   out.print(count);  }   }
3	public class Main {  static class Node implements Comparable<Node>{   public int l,r;   public long s;   Node(int l,int r,long s){    this.l=l;    this.r=r;    this.s=s;   }   public int compareTo(Node o) {    if(o.s==s){     if(r>o.r) return 1;     else if(r==o.r) {      return 0;     }     else return -1;    } else if(s>o.s){     return 1;    } else {     return -1;    }   }  }  static long[] sum=new long[1550];  public static void main(String[] args) {   TreeMap<Long, ArrayList<Node> > mp = new TreeMap<>();   Scanner cin = new Scanner(System.in);   int N=cin.nextInt();   for(int i=1;i<=N;i++){    int x=cin.nextInt();    sum[i]=sum[i-1]+x;   }     ArrayList<Node> arr = new ArrayList<>();   for(int l=1;l<=N;l++){    for(int r=l;r<=N;r++){     arr.add(new Node(l,r,sum[r]-sum[l-1]));    }   }   Collections.sort(arr);   for(int i=0;i<arr.size();i++){    ArrayList<Node> a=mp.get(arr.get(i).s);    if(a==null) {     a=new ArrayList<>();     mp.put(arr.get(i).s,a);    }    a.add(arr.get(i));   }   int mx=-1;   long mxv=-1;   Iterator<Long> it=mp.keySet().iterator();   while(it.hasNext()){    int ans=0,t=0;    long v=it.next();    ArrayList<Node> vec= mp.get(v);    for(int i=0;i<vec.size();i++){     if(t<vec.get(i).l){      ans++;      t=vec.get(i).r;     }    }       if(ans>mx){     mx=ans;     mxv=v;        }   }   ArrayList<Node> vec=mp.get(mxv);   System.out.println(mx);   int t=0;   for(int i=0;i<vec.size();i++){           if(t<vec.get(i).l){     System.out.println(vec.get(i).l+" "+vec.get(i).r);     t=vec.get(i).r;    }   }  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   APaintTheNumbers solver = new APaintTheNumbers();   solver.solve(1, in, out);   out.close();  }  static class APaintTheNumbers {   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    int arr[] = new int[n];    in.scanInt(arr);    CodeX.sort(arr);    int ans = 0;    boolean vissited[] = new boolean[n];    for (int i = 0; i < n; i++) {     if (!vissited[i]) {      ans++;      for (int j = 0; j < n; j++) {       if (arr[j] % arr[i] == 0) {        vissited[j] = true;       }      }     }    }     out.println(ans);   }  }  static class CodeX {   public static void sort(int arr[]) {    merge_sort(arr, 0, arr.length - 1);   }   private static void merge_sort(int A[], int start, int end) {    if (start < end) {     int mid = (start + end) / 2;     merge_sort(A, start, mid);     merge_sort(A, mid + 1, end);     merge(A, start, mid, end);    }   }   private static void merge(int A[], int start, int mid, int end) {    int p = start, q = mid + 1;    int Arr[] = new int[end - start + 1];    int k = 0;    for (int i = start; i <= end; i++) {     if (p > mid)      Arr[k++] = A[q++];     else if (q > end)      Arr[k++] = A[p++];     else if (A[p] < A[q])      Arr[k++] = A[p++];     else      Arr[k++] = A[q++];    }    for (int i = 0; i < k; i++) {     A[start++] = Arr[i];    }   }  }  static class ScanReader {   private byte[] buf = new byte[4 * 1024];   private int INDEX;   private BufferedInputStream in;   private int TOTAL;   public ScanReader(InputStream inputStream) {    in = new BufferedInputStream(inputStream);   }   private int scan() {    if (INDEX >= TOTAL) {     INDEX = 0;     try {      TOTAL = in.read(buf);     } catch (Exception e) {      e.printStackTrace();     }     if (TOTAL <= 0) return -1;    }    return buf[INDEX++];   }   public int scanInt() {    int I = 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') {      I *= 10;      I += n - '0';      n = scan();     }    }    return neg * I;   }   private boolean isWhiteSpace(int n) {    if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;    else return false;   }   public void scanInt(int[] A) {    for (int i = 0; i < A.length; i++) A[i] = scanInt();   }  } }
3	public class C {  static int MOD = 1_000_000_007;  public static void main(String[] args) {   MyScanner in = new MyScanner();   PrintWriter out = new PrintWriter(System.out);   int n = in.nextInt();   char prev = ' ';      int[][] dp = new int[n+1][n+2];   dp[0][0] = 1;   for(int i=0;i<n;++i){    char ch = in.next().charAt(0);    if(prev == 's'){     int sum = 0;     for(int j=n;j>=0;--j){      sum = (sum + dp[i-1][j]) % MOD;      dp[i][j] = sum;     }    }else if(prev == 'f'){     for(int j=0;j<n;++j){      dp[i][j+1] = dp[i-1][j];     }    }    prev = ch;   }   int result = 0;   for(int i=0;i<=n;++i){    result = (result + dp[n-1][i]) % MOD;   }    out.println(result);   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;   }  }   }
1	public class Solution {  private BufferedReader in; private PrintWriter out; private StringTokenizer st;  void solve() throws IOException {  String s = next();  int u = s.indexOf('R');  int v = s.indexOf('C');  if (u == 0 && v != -1 && u < v) {  String a = s.substring(u + 1, v);  String b = s.substring(v + 1);  try {   int aa = Integer.parseInt(a);   int bb = Integer.parseInt(b) - 1;   int pow = 26, len = 1;   while (bb >= pow) {   bb -= pow;   pow *= 26;   ++len;   }   String r = "";   for (int i = 0; i < len; ++i) {   r = ((char)(bb % 26 + 'A')) + r;   bb /= 26;   }   out.println(r + aa);   return;  } catch (NumberFormatException e) {  }  }  u = 0;  while (u < s.length() && Character.isLetter(s.charAt(u))) {  ++u;  }  String a = s.substring(0, u);  String b = s.substring(u);  out.println("R" + b + "C" + toInt(a)); }  private int toInt(String a) {  int r = 0;  for (int i = 0; i < a.length(); ++i) {  r *= 26;  r += a.charAt(i) - 'A';  }  int pow = 1;  for (int i = 0; i < a.length(); ++i) {  r += pow;  pow *= 26;  }  return r; }  Solution() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   eat("");   int tests = nextInt();  for (int test = 0; test < tests; ++test) {  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(); } }
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;  } }
5	public class TaskA { void Run() throws IOException {  int n=ReadInt();  int[] arr=new int[n];  for(int i=0;i<n;++i)  arr[i]=ReadInt();  Arrays.sort(arr);  boolean one=true;  for(int x : arr)  if(x!=1) {   one=false;   break;  }  if(one) {  for(int i=1;i<n;++i)   output.print("1 ");  output.print("2");  return;  }  int prev=1;  for(int x : arr)  if(x==prev) {   output.print(prev);   output.print(" ");  } else {   output.print(prev);   output.print(" ");   prev=x;  } }  public static void main(String[] args) throws IOException {  boolean oj = System.getProperty("ONLINE_JUDGE") != null;  Reader reader;  reader=oj ? new InputStreamReader(System.in) : new FileReader("input.txt");  input=new BufferedReader(reader);  Writer writer=new OutputStreamWriter(System.out);  writer=new BufferedWriter(writer);  output=new PrintWriter(writer);  new TaskA().Run();  output.close(); }  static int ReadInt() throws IOException {  return Integer.parseInt(ReadString()); }  static long ReadLong() throws IOException {  return Long.parseLong(ReadString()); }  static String ReadString() throws IOException {  while(tokenizer==null || !tokenizer.hasMoreTokens())  tokenizer=new StringTokenizer(input.readLine());  return tokenizer.nextToken(); }  static StringTokenizer tokenizer; static BufferedReader input; static PrintWriter output; }
6	public class ASimpleTask {    static long memo[][]; static int graph[]; static long hamiltonianPath(int mask , int u) {  if(memo[mask][u] != -1)    return memo[mask][u];  else if(u == Integer.numberOfTrailingZeros(mask))    return 0;  else {  long sum = 0;  for(int fromSet = mask ^ (1 << u);fromSet > 0; fromSet ^= Integer.lowestOneBit(fromSet)) {   int v = Integer.numberOfTrailingZeros(fromSet);     if((graph[u] & (1 << v)) != 0)    sum += hamiltonianPath(mask ^ (1 << u), v);  }    return sum;  } }  private static void solveBottomUp(FastScanner s1, PrintWriter out){  int V = s1.nextInt();  int E = s1.nextInt();  graph = new int[V];  long DP[][] = new long[1 << V][V];  while(E-->0) {  int u = s1.nextInt() - 1;  int v = s1.nextInt() - 1;  graph[u] |= (1 << v);  graph[v] |= (1 << u);  }  for(int i=0;i<V;i++)  DP[1 << i][i] = 1;  for(int mask = 1 , end = 1 << V;mask < end;mask++) {  for(int set = mask;Integer.bitCount(set) > 1;set ^= Integer.highestOneBit(set)) {   int u = Integer.numberOfTrailingZeros(Integer.highestOneBit(set));   for(int fromSet = mask ^ (1 << u);fromSet > 0; fromSet ^= Integer.lowestOneBit(fromSet)) {   int v = Integer.numberOfTrailingZeros(fromSet);      if((graph[u] & (1 << v)) != 0)    DP[mask][u] += DP[mask ^ (1 << u)][v];      }  }  }  long totalCycles = 0;  for(int mask = 1 , end = 1 << V;mask < end;mask++) {  if(Integer.bitCount(mask) >= 3) {   int start = Integer.numberOfTrailingZeros(mask);   for(int set = mask;Integer.bitCount(set) > 1;set ^= Integer.highestOneBit(set)) {   int u = Integer.numberOfTrailingZeros(Integer.highestOneBit(set));   if((graph[u] & (1 << start)) != 0)    totalCycles += DP[mask][u];   }  }  }  totalCycles /= 2;  out.println(totalCycles); }  private static void solveTopDown(FastScanner s1, PrintWriter out){  int V = s1.nextInt();  int E = s1.nextInt();  graph = new int[V];  memo = new long[1 << V][V];   for(long l[] : memo)  Arrays.fill(l, -1);   while(E-->0) {  int u = s1.nextInt() - 1;  int v = s1.nextInt() - 1;  graph[u] |= (1 << v);  graph[v] |= (1 << u);  }  for(int i=0;i<V;i++)  memo[1 << i][i] = 1;   long totalCycles = 0;  for(int mask = 1 , end = 1 << V;mask < end;mask++) {  if(Integer.bitCount(mask) >= 3) {   int start = Integer.numberOfTrailingZeros(mask);   for(int set = mask;Integer.bitCount(set) > 1;set ^= Integer.highestOneBit(set)) {   int u = Integer.numberOfTrailingZeros(Integer.highestOneBit(set));   if((graph[u] & (1 << start)) != 0)    totalCycles += hamiltonianPath(mask, u);   }  }  }  totalCycles /= 2;   out.println(totalCycles); }       public static void main(String []args) throws IOException {  FastScanner in = new FastScanner(System.in);  PrintWriter out =   new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);  solveBottomUp(in, out);  in.close();  out.close(); }   static class FastScanner{  BufferedReader reader;  StringTokenizer st;  FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}  String next()  {while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}    st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}  String nextLine() {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}     int nextInt() {return Integer.parseInt(next());}  long nextLong() {return Long.parseLong(next());}   double nextDouble(){return Double.parseDouble(next());}  char nextChar() {return next().charAt(0);}  int[] nextIntArray(int n)   {int[] a= new int[n]; int i=0;while(i<n){a[i++]=nextInt();} return a;}  long[] nextLongArray(int n)  {long[]a= new long[n]; int i=0;while(i<n){a[i++]=nextLong();} return a;}  int[] nextIntArrayOneBased(int n) {int[] a= new int[n+1]; int i=1;while(i<=n){a[i++]=nextInt();} return a;}    long[] nextLongArrayOneBased(int n){long[]a= new long[n+1];int i=1;while(i<=n){a[i++]=nextLong();}return a;}    void close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}   }  }
3	public class A { public static void main(String[] args) {  MyScanner sc = new MyScanner();  int n = sc.nextInt();  Integer[] a = new Integer[n];  for(int i = 0; i < n; i++)  a[i] = sc.nextInt();  Arrays.sort(a);  boolean[] b = new boolean[n];  int ans = 0;  for(int i = 0; i < n; i++)  if(!b[i]) {   ans++;   for(int j = i + 1; j < n; j++)   if(a[j] % a[i] == 0)    b[j] = true;  }  out.println(ans);  out.close(); } public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static class MyScanner {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st;  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 D { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni();  int[] a = na(n);  int[] xs = new int[3*n];  for(int i = 0;i < n;i++){  xs[3*i] = a[i];  xs[3*i+1] = a[i]-1;  xs[3*i+2] = a[i]+1;  }  xs = shuffle(xs, new Random());  int[] imap = shrinkX(xs);   BigInteger ans = BigInteger.valueOf(0L);  {  int[] ft = new int[3*n+3];  for(int i = 0;i < n;i++){   int y = Arrays.binarySearch(imap, a[i]);   int num =    i - sumFenwick(ft, y + 1) + sumFenwick(ft, y - 2);   ans = ans.add(BigInteger.valueOf((long)a[i] * num));   addFenwick(ft, y, 1);  }  }   {  int[] ft = new int[3*n+3];  for(int i = n-1;i >= 0;i--){   int y = Arrays.binarySearch(imap, a[i]);   int num =    n-1-i - sumFenwick(ft, y + 1) + sumFenwick(ft, y - 2);   ans = ans.subtract(BigInteger.valueOf((long)a[i] * num));   addFenwick(ft, y, 1);  }  }  out.println(ans); }  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[] 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; }   public static int[] shrinkX(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;  ret[0] = (int) (b[0] >> 32);  for (int i = 0; i < n; i++) {  if (i > 0 && (b[i] ^ b[i - 1]) >> 32 != 0) {   p++;   ret[p] = (int) (b[i] >> 32);  }  a[(int) b[i]] = p;  }  return Arrays.copyOf(ret, p + 1); }   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)); } }
2	public class ehsan { public static BigInteger f(BigInteger m,BigInteger n){  BigInteger s,l;  s=n.multiply(m.add(BigInteger.valueOf(1)));  l=m.multiply(m.add(BigInteger.valueOf(1)));  l=l.divide(BigInteger.valueOf(2));  s=s.subtract(l);  s=s.subtract(m);  return s; } public static BigInteger bs(BigInteger a,BigInteger b,BigInteger n,BigInteger d){  BigInteger c,e;  c=a.add(b);  c=c.divide(BigInteger.valueOf(2));  e=f(c,n);  if(e.equals(d))  return c.add(BigInteger.valueOf(1));  if(a.equals(b.add(BigInteger.valueOf(-1))))  return b.add(BigInteger.valueOf(1));  if(e.compareTo(d)>0)  return bs(a,c,n,d);  return bs(c,b,n,d); } public static void main(String[] args)  {  Scanner sc = new Scanner(System.in);  BigInteger bi1 = sc.nextBigInteger();  BigInteger bi2 = sc.nextBigInteger();  BigInteger i,n=bi2;  BigInteger i2=BigInteger.valueOf(1);  BigInteger sum=BigInteger.valueOf(0);  if(bi1.compareTo(bi2)<0){  System.out.println(0);  return;  }  else if( bi1.compareTo(bi2) == 0 )  {  System.out.println(1);  return;  }  bi2=((n.multiply(n.add(BigInteger.valueOf(1)))).divide(BigInteger.valueOf(2))).subtract(n.subtract(BigInteger.valueOf(1)));  if(bi1.compareTo(bi2)>0)  System.out.println(-1);  else{  System.out.println(bs(BigInteger.valueOf(0),n.add(BigInteger.valueOf(-2)),n,bi1));  } } }
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(); } }
6	public class P11D{ static long mod=1000000007;   public static void main(String[] args) throws Exception{      InputReader in = new InputReader(System.in);    PrintWriter pw=new PrintWriter(System.out);                 int n=in.readInt();   int m=in.readInt();   boolean v[][]=new boolean[n][n];   for(int i=0;i<m;i++)   {   int x=in.readInt()-1;   int y=in.readInt()-1;   v[x][y]=true;   v[y][x]=true;   }     long dp[][]=new long[1<<n][n];   for(int i=0;i<n;i++)   {   dp[1<<i][i]=1;   }   long ans=0;  for(int mask=1;mask<(1<<n);mask++)  {   int s=-1;   for(int i=0;i<n;i++)   {   if((mask&(1<<i))!=0)   {    s=i;    break;   }   }   for(int i=0;i<n;i++)   {   if(i!=s&&((1<<i)&mask)!=0)   {    for(int j=0;j<n;j++)    {    if((1<<j)!=0&&i!=j&&v[i][j])    {     int rem=(1<<i)^mask;     dp[mask][i]+=dp[rem][j];    }    }         int c=Integer.bitCount(mask);    if(c>=3&&v[i][s])    {    ans+=dp[mask][i];    }   }   }  }  ans/=2;  pw.println(ans);           pw.close();  }    public static long gcd(long x,long y) { if(x%y==0)  return y; else  return gcd(y,x%y); } public static int gcd(int x,int y) { if(x%y==0)  return y; else  return gcd(y,x%y); } 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; } static class Pair implements Comparable<Pair> { int a,b; Pair (int a,int b) {  this.a=a;  this.b=b; }  public int compareTo(Pair o) {   if(this.a!=o.a)  return Integer.compare(this.a,o.a);  else  return Integer.compare(this.b, o.b);   } public boolean equals(Object o) {   if (o instanceof Pair) {    Pair p = (Pair)o;    return p.a == a && p.b == b;   }   return false;  }  public int hashCode() {   return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();  }  }   static long sort(int a[]) { int n=a.length; int b[]=new int[n];  return mergeSort(a,b,0,n-1);} static long mergeSort(int a[],int b[],long left,long right) { long c=0;if(left<right) { long mid=left+(right-left)/2;  c= mergeSort(a,b,left,mid);  c+=mergeSort(a,b,mid+1,right);  c+=merge(a,b,left,mid+1,right); }  return c; } static long merge(int a[],int b[],long left,long mid,long right) {long c=0;int i=(int)left;int j=(int)mid; int k=(int)left; while(i<=(int)mid-1&&j<=(int)right) { if(a[i]<=a[j]) {b[k++]=a[i++]; } else { b[k++]=a[j++];c+=mid-i;}} while (i <= (int)mid - 1) b[k++] = a[i++]; while (j <= (int)right) b[k++] = a[j++]; for (i=(int)left; i <= (int)right; i++)  a[i] = b[i]; return c; }  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; }  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 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();   StringBuilder res = new StringBuilder();   do   {    res.appendCodePoint(c);    c = read();   } while (!isSpaceChar(c));   return res.toString();  }  public String readLine() {   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 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 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 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 boolean isEndOfLine(int c) {   return c == '\n' || c == '\r' || c == -1;  } }                           }
0	public class TaskA {  public void run() {   InputReader reader = new InputReader(System.in);   PrintWriter writer = new PrintWriter(System.out, true);   reader.nextLine();   String statement = reader.next();   if (!statement.startsWith("-")) {    writer.println(statement);   } else {    try {     int statement1 = Integer.parseInt(statement.substring(0, statement.length() - 1));     int statement2 = Integer.parseInt(statement.substring(0, statement.length() - 2) + statement.charAt(statement.length() - 1));     writer.println(Math.max(statement1, statement2));    } catch (Exception e) {     writer.println(statement);    }   }   writer.close();  }  public static void main(String[] args) {   new TaskA().run();  }  private class InputReader {   BufferedReader reader;   StringTokenizer token;   private InputReader(InputStream stream) {    reader = new BufferedReader(new InputStreamReader(stream));   }   private String next() {    return token.nextToken();   }   private int nextInt() {    return Integer.parseInt(this.next());   }   private double nextDouble() {    return Double.parseDouble(this.next());   }   private long nextLong() {    return Long.parseLong(this.next());   }   private String nextLine() {    String line = "";    try {     line = reader.readLine();     token = new StringTokenizer(line, " ");    } catch(IOException e) {    }    return line;   }  } }
3	public class A {  public static void main(String[] args) throws Exception {   Scanner in = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   int n = in.nextInt();   int a[] = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }   Arrays.sort(a);   int vis[] = new int[n];   Arrays.fill(vis, -1);   int c = 0;   for (int i = 0; i < n; i++) {    if (vis[i] != -1) continue;    c++;    for (int j = i; j < n; j++) {     if (vis[j] == -1 && a[j] % a[i] == 0) {      vis[j] = c;     }    }   }     pw.println(c);   pw.close();  }  static void debug(Object... obj) {   System.err.println(Arrays.deepToString(obj));  } }
0	public class MainClass {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int arr[] = {4,7,47,74,447,474,477,744,747,774};   int i=0, x = in.nextInt();   while (i<arr.length)   if (x%arr[i++] == 0)   {    System.out.print("YES");    return;   }   System.out.print("NO");  } }
3	public class PythonIndentation { public static void main(String args[]) {  Scanner in = new Scanner(System.in) ;  int n = in.nextInt() ;  boolean[] lst = new boolean[n] ;  for(int i=0;i<n;i++)  {  lst[i] = (in.next().equals("s"))?false:true ;  }  System.out.println(dp(lst)) ; }                     static long dp(boolean[] lst) {  long[][] dp = new long[lst.length][lst.length] ;  dp[0][0] = 1 ;  for(int i=1;i<lst.length;i++)  {           for(int j=0;j<lst.length;j++)  {   if(lst[i-1])   {   if(j==0)    dp[i][j] = 0 ;   else    dp[i][j] = dp[i-1][j-1] ;   }     else   {   if(j==0)   {    for(int k=0;k<lst.length;k++)    dp[i][j] = (dp[i][j]+dp[i-1][k])%1000000007 ;   }   else    dp[i][j] = (dp[i][j-1]-dp[i-1][j-1])%1000000007 ;                }  }  }       long ans = 0 ;  for(int i=0;i<lst.length;i++)  {  ans = (ans + dp[lst.length-1][i])%1000000007 ;  }  if(ans<0)  ans = ans + 1000000007 ;  return ans ; } }
4	public class A23 {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  String s = sc.next();  Map<String, Boolean> map = new HashMap<String, Boolean>();  for (int i = s.length(); i >= 1; i--) {  map.clear();  for (int j = 0; j < s.length()-i+1; j++) {   String temp = s.substring(j, j+i);   if (map.containsKey(temp)) {   System.out.println(i);   return;   }   map.put(temp, true);  }  }  System.out.println(0); } }
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();  } }
6	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);   TaskF solver = new TaskF();   solver.solve(1, in, out);   out.close();  }  static class TaskF {   public void solve(int testNumber, Scanner in, PrintWriter out) {    int n = in.nextInt();    int m = in.nextInt();    int[][] graph = new int[n][m];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++)      graph[i][j] = in.nextInt();    }    int[][] mn1 = new int[n][n];    int[][] mn2 = new int[n][n];    for (int i = 0; i < n; i++)     for (int j = 0; j < n; j++) {      int min_val = Integer.MAX_VALUE;      for (int k = 0; k < m; k++)       min_val = Math.min(min_val, Math.abs(graph[i][k] - graph[j][k]));      mn1[i][j] = min_val;      min_val = Integer.MAX_VALUE;      for (int k = 0; k < m - 1; k++) {       min_val = Math.min(min_val, Math.abs(graph[i][k] - graph[j][k + 1]));      }      mn2[i][j] = min_val;     }    int[][] dp = new int[(1 << (n + 2))][n];    int ans = 0;    for (int i = 0; i < n; i++) {     for (int[] temp : dp)      Arrays.fill(temp, -1);     for (int j = 0; j < n; j++) {      dp[1 << j][j] = (j == i ? Integer.MAX_VALUE : 0);     }     for (int j = 0; j < n; j++) {      ans = Math.max(ans, Math.min(mn2[j][i], calc((1 << n) - 1, j, dp, mn1, n)));     }    }    out.println(ans);   }   public int calc(int mask, int v, int[][] dp, int[][] mn1, int n) {    if (dp[mask][v] != -1)     return dp[mask][v];    dp[mask][v] = 0;    for (int u = 0; u < n; u++) {     if (u != v && (((mask >> u) & 1) == 1))      dp[mask][v] = Math.max(dp[mask][v], Math.min(mn1[u][v], calc(mask ^ (1 << v), u, dp, mn1, n)));    }    return dp[mask][v];   }  } }
1	public class A {  public static void main(String[] args)throws Throwable {   MyScanner sc=new MyScanner();   PrintWriter pw=new PrintWriter(System.out);   int n=sc.nextInt();   int d=sc.nextInt();   int [] a=new int [n];   for(int i=0;i<n;i++)    a[i]=sc.nextInt();   int ans=2;   for(int i=0;i<n-1;i++){    if(a[i+1]-a[i]<2*d)     continue;    if(a[i+1]-a[i]==2*d)     ans++;    else     ans+=2;   }   pw.println(ans);   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;}  } }
6	public class Main {  static PrintWriter out; static InputReader ir;  static void solve() {  int n = ir.nextInt();  int t = ir.nextInt();  int[][] a = new int[n][];  for (int i = 0; i < n; i++)  a[i] = ir.nextIntArray(2);  long[] f = fact(15);  long res = 0;  for (int i = 0; i < 1 << n; i++) {  int[] ct = new int[4];  int tot = 0;  for (int j = 0; j < n; j++) {   if (((1 << j) & i) != 0) {   tot += a[j][0];   ct[a[j][1]]++;   }  }  if (tot != t)   continue;  long[][][][] dp = new long[ct[1] + 1][ct[2] + 1][ct[3] + 1][4];  dp[0][0][0][0] = 1;  for (int j = 0; j < ct[1] + ct[2] + ct[3]; j++) {   for (int k = 0; k <= ct[1]; k++) {   for (int l = 0; l <= ct[2]; l++) {    if (k + l > j || j - k - l > ct[3])    continue;    for (int m = 0; m <= 3; m++) {    for (int o = 0; o <= 3; o++) {     if (m == o)     continue;     if (o == 1 && k == ct[1])     continue;     if (o == 2 && l == ct[2])     continue;     if (o == 3 && j - k - l == ct[3])     continue;     if (o == 1) {     dp[k + 1][l][j - k - l][1] = add(dp[k + 1][l][j - k - l][1],      dp[k][l][j - k - l][m]);     }     if (o == 2) {     dp[k][l + 1][j - k - l][2] = add(dp[k][l + 1][j - k - l][2],      dp[k][l][j - k - l][m]);     }     if (o == 3) {     dp[k][l][j - k - l + 1][3] = add(dp[k][l][j - k - l + 1][3],      dp[k][l][j - k - l][m]);     }     }    }   }   }  }  for (int m = 0; m <= 3; m++)   res = add(res, mul(mul(f[ct[1]], f[ct[2]]), mul(f[ct[3]], dp[ct[1]][ct[2]][ct[3]][m])));  }  out.println(res); }  static long mod = (long) 1e9 + 7;  static long add(long a, long b) {  return (a + b) % mod; }  static long sub(long a, long b) {  long d = a - b;  while (d < 0)  d += mod;  return d; }  static long mul(long a, long b) {  return a * b % mod; }  static long div(long a, long b) {  return a * mod_inverse(b) % mod; }  private static long[] fact(int n) {  long[] ret = new long[n + 1];  ret[0] = 1 % mod;  for (int i = 1; i <= n; i++) {  ret[i] = mul(ret[i - 1], i);  }  return ret; }  private static long[] factInv(int n) {  long[] ret = new long[n + 1];  ret[0] = 1;  for (int i = 1; i <= n; i++) {  ret[i] = div(ret[i - 1], i);  }  return ret; }  public static long comb(int n, int m, long[] fact, long[] factInv) {  long ret = fact[n];  ret = mul(ret, factInv[m]);  ret = mul(ret, factInv[n - m]);  return ret; }  public static long[][] stirling(int n) {  long[][] ret = new long[n + 1][n + 1];  ret[0][0] = 1;  for (int i = 1; i <= n; i++)  for (int j = 1; j <= i; j++)   ret[i][j] = add(ret[i - 1][j - 1], mul(ret[i - 1][j], j));  return ret; }  public static long mod_inverse(long a) {  long[] ret = extgcd(a, mod);  return add(mod, ret[0] % mod); }  public static long[] extgcd(long a, long b) {  long[] ret = new long[3];  ret[2] = _extgcd(a, b, ret);  return ret; }  private static long _extgcd(long a, long b, long[] x) {  long g = a;  x[0] = 1;  x[1] = 0;  if (b != 0) {  g = _extgcd(b, a % b, x);  long temp = x[0];  x[0] = x[1];  x[1] = temp;  x[1] -= (a / b) * x[0];  }  return g; }  static long modpow(long a, long n) {  long res = 1;  while (n > 0) {  if ((n & 1) != 0)   res = res * a % mod;  a = a * a % mod;  n >>= 1;  }  return res; }  public static void main(String[] args) {  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;  } }  static void tr(Object... o) {  out.println(Arrays.deepToString(o)); } }
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));  } }
3	public class Solution {   public static void main(String[] args) {   class Pair {    int start;    int end;    public Pair(int start, int end) {     this.start = start;     this.end = end;    }   }   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 maxLen = 0;   int key = -1;   HashMap<Integer, List<Pair>> ans = new HashMap<>();   for (int i=0; i<n; i++){    int currSum = 0;    for (int j=i; j>=0; j--){     currSum = currSum + array[j];     if (!ans.containsKey(currSum)){      ans.put(currSum, new ArrayList<>());     }     List<Pair> pairs = ans.get(currSum);     if (pairs.size() == 0 || pairs.get(pairs.size()-1).end <= j){      pairs.add(new Pair(j+1, i+1));     }     if (pairs.size() > maxLen){      maxLen = pairs.size();      key = currSum;     }    }   }   System.out.println(maxLen);   for (Pair pair : ans.get(key)){    System.out.println(pair.start + " " + pair.end);   }  } }
0	public class A {  public static void main(String[] args) {   OutputStream outputStream = System.out;   PrintWriter out = new PrintWriter(outputStream);   Application solver = new Application();   solver.solve(System.in, out);   out.close();  } }  class Application {  int max(int a, int b) { return a > b ? a : b; }  public void solve(InputStream in, PrintWriter out) {   Scanner scanner = new Scanner(in);   int n = scanner.nextInt();   int n1 = n/10;   int n2 = (n/100)*10+(n%10);   int m = max(max(n1, n2), n);   out.println(m);  } }
0	public class A122 { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  if (n % 4 == 0 || n % 7 == 0 || n % 44 == 0 || n % 47 == 0   || n % 74 == 0 || n % 77 == 0 || n % 444 == 0 || n % 447 == 0   || n % 474 == 0 || n % 477 == 0 || n % 744 == 0 || n % 747 == 0   || n % 774 == 0 || n % 777 == 0)  System.out.println("YES");  else  System.out.println("NO");  } }
3	public class D {  private void solve() {   br = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   int n = nextInt(), m = nextInt(), u = 1, d = n;   while (u < d) {    for (int i = 1; i <= m; i++) {     out.println(u + " " + i);     out.println(d + " " + (m - i + 1));    }    u++;    d--;   }   if (u == d) {    int l = 1, r = m;    while (l < r) {     out.println(u + " " + l++);     out.println(d + " " + r--);    }    if (l == r) out.println(u + " " + l);   }   out.close();  }  public static void main(String[] args) {   new D().solve();  }  private BufferedReader br;  private StringTokenizer st;  private PrintWriter out;  private String next() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     throw new RuntimeException(e);    }   }   return st.nextToken();  }  private int nextInt() {   return Integer.parseInt(next());  }  private long nextLong() {   return Long.parseLong(next());  }  private double nextDouble() {   return Double.parseDouble(next());  } }
4	public class Main1 {  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; }  }                    static class pair  {   int x;   int y;   public pair (int k, int p)   {    x = k;    y = p;   }   @Override   public boolean equals(Object o) {    if (this == o) return true;    if (o == null || getClass() != o.getClass()) return false;    pair pair = (pair) o;    return x == pair.x && y == pair.y;   }    @Override   public int hashCode() {    return Objects.hash(x, y);   }  }  public static void main(String[] args)throws IOException  {     Scanner sc = new Scanner(new File("input.txt"));  PrintWriter out = new PrintWriter("output.txt");   Queue<pair> q=new LinkedList<>();   int n=sc.nextInt();   int m=sc.nextInt();   int t=sc.nextInt();   int mark[][]=new int[n+2][m+2];   while(t-->0)   {    int a=sc.nextInt();int b=sc.nextInt();    mark[a][b]=1;    q.add(new pair(a,b));   }   int ansx=1;int ansy=1;   while(q.size()!=0)   {    pair p=q.remove();    if(mark[Math.max(1,p.x-1)][p.y]==0)    {     q.add(new pair(Math.max(1,p.x-1),p.y));     mark[Math.max(1,p.x-1)][p.y]=1;     ansx=Math.max(1,p.x-1);     ansy=p.y;    }    if(mark[Math.min(n,p.x+1)][p.y]==0)    {     q.add(new pair(Math.min(n,p.x+1),p.y));     mark[Math.min(n,p.x+1)][p.y]=1;     ansx=Math.min(n,p.x+1);     ansy=p.y;    }    if(mark[p.x][Math.max(1,p.y-1)]==0)    {     q.add(new pair(p.x,Math.max(1,p.y-1)));     mark[p.x][Math.max(1,p.y-1)]=1;     ansx=p.x;     ansy=Math.max(1,p.y-1);    }    if(mark[p.x][Math.min(m,p.y+1)]==0)    {     q.add(new pair(p.x,Math.min(m,p.y+1)));     mark[p.x][Math.min(m,p.y+1)]=1;     ansx=p.x;     ansy=Math.min(m,p.y+1);    }   }   out.println(ansx+" "+ansy);   out.flush();  } }
3	public class c implements Runnable{ int N; int[] arr; public static void main(String[] args) { new Thread(null, new c(), "", 1<<27).start(); } public void run() {  arr = new int[N = nextInt()];  for(int n=0;n<N;n++) {   if(nextString().charAt(0) == 'f') {   arr[n] = 1;  }  }  long[][] dp = new long[N+1][N+1];  dp[0][0] = 1;  for(int i = 0; i < N; i++) {    if(arr[i] == 0) {        long sum = 0;   for(int j = N; j >= 0; j--) {   sum += dp[i][j];   sum %= 1_000_000_007L;   dp[i+1][j] += sum;   dp[i+1][j] %= 1_000_000_007L;   }  }    else {     for(int j = 1; j <= N; j++) {   dp[i+1][j] += dp[i][j-1];   dp[i+1][j] %= 1_000_000_007L;   }  }  }     long ans = 0;  for(long l : dp[N-1]) ans = (ans + l) % 1_000_000_007;  System.out.println(ans); }    BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line = null; int line_ptr = 0; void read() {  try {  line = br.readLine().split(" ");  }  catch(IOException ioe) {  System.err.println("bad input");  line = null;  } } void ensure() {  while(line == null || line.length <= line_ptr) {  read();  line_ptr = 0;  } } int nextInt() {  ensure();  return Integer.parseInt(line[line_ptr++]); } long nextLong() {  ensure();  return Integer.parseInt(line[line_ptr++]); } String nextString() {  ensure();  return line[line_ptr++]; } }
0	public class A {  long gcd(long a, long b) {  if (b == 0) {  return a;  } else {  return gcd(b, a % b);  } }  long solve(long a,long b) {  if (a == 0 || b ==0) {  return 0;  }  long t = gcd(a,b);  a /= t;  b /= t;  if (a>b) {  return solve(a%b,b)+a/b;  } else {  return solve(a,b%a)+b/a;  }   }  void solve() throws IOException {  long a = nextLong();  long b = nextLong();  out.println(solve(a, b)); }  void run() 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 A().run(); }  BufferedReader br; PrintWriter out; StringTokenizer str;  String next() throws IOException {  while (str == null || !str.hasMoreTokens()) {  str = new StringTokenizer(br.readLine());  }  return str.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()); } }
6	public class D11 {  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);  n = nextInt();  m = nextInt();   g = new boolean[n][n];  for (int i = 0; i < m; i++) {  int a = nextInt()-1, b = nextInt()-1;  g[a][b] = g[b][a] = true;  }   long ans = 0;  for (int i = n-1; i >= 0; i--) {  long cur = solve(i);  ans += cur;  }   out.println(ans/2);   out.flush(); }  static int n, m; static boolean[][] g;  static long solve(int v) {  long[][] memo = new long[v][1 << v];   for (int i = 0; i < v; i++)  if (g[v][i])   memo[i][1 << i] = 1;   for (int mask = 1; mask < (1 << v); mask++)  for (int i = 0; i < v; i++) if ((mask&(1 << i)) != 0)   for (int j = 0; j < v; j++) if (g[i][j] && (mask&(1 << j)) == 0)   memo[j][mask|(1 << j)] += memo[i][mask];   long res = 0;  for (int mask = 1; mask < (1 << v); mask++)  for (int i = 0; i < v; i++)   if (Integer.bitCount(mask) > 1 && g[v][i]) res += memo[i][mask];  return res; } }
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();  }  }
2	public class A{ static long mod = 1000000000+7; static int arr[]; static HashMap<Long,Long> map = new HashMap<>(); public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  long x = scan.nextLong();  long k = scan.nextLong();  if(x == 0)  {  System.out.println(0);  return;  }  x = x%mod;  long power = pow(2,k + 1)%mod;  power = (power*x)%mod;  long num = (pow(2,k) - 1 + mod)%mod;  long ans = (power - num + mod)%mod;  System.out.println((ans)); } public static long pow(long a,long b) {  if(b == 0)  return 1;  if(b == 1)  return a;  long x1,x2;  if(map.containsKey(b - b/2))  x1 = map.get(b - b/2);  else  {  x1 = pow(a,b - b/2)%mod;  map.put(b - b/2,x1);  }  if(map.containsKey(b/2))  x2 = map.get(b/2);  else  {  x2 = pow(a,b/2)%mod;  map.put(b/2,x2);  }  return (x1*x2)%mod; } }
0	public class Solution {  private static int n;  private static PrintWriter writer;  private static int maxstep;   private static void g(int src, int step) {   if (step != 0 && n % src == 0) {    writer.print("YES");    writer.close();    System.exit(0);   }     if (step == maxstep) return;     int p = (int)Math.pow(10, step);     g(src + 4 * p, step + 1);   g(src + 7 * p, step + 1);  }   public static void main(String[] args) throws Exception {          Scanner reader = new Scanner(System.in);   writer = new PrintWriter(System.out);     n = reader.nextInt();   maxstep = String.valueOf(n).length() + 1;     g(0, 0);     writer.print("NO");   writer.close();  } }
1	public class Trains1_2 implements Runnable {  private BufferedReader br = null;  private PrintWriter pw = null;  private StringTokenizer stk = new StringTokenizer("");  public static void main(String[] args) {   new Thread(new Trains1_2()).run();  }  public void run() {     br = new BufferedReader(new InputStreamReader(System.in));   pw = new PrintWriter(new OutputStreamWriter(System.out));   solver();   pw.close();  }  private void nline() {   try {    if (!stk.hasMoreTokens())     stk = new StringTokenizer(br.readLine());   } catch (IOException e) {    throw new RuntimeException("KaVaBUnGO!!!", e);   }  }  private String nstr() {   while (!stk.hasMoreTokens())    nline();   return stk.nextToken();  }  private int ni() {   return Integer.valueOf(nstr());  }  private long nl() {   return Long.valueOf(nstr());  }  private double nd() {   return Double.valueOf(nstr());  }  boolean isNumber(char c) {   if (c <= '9' && c >= '0')    return true;   return false;  }  String to10(String s) {   long ans = 0;   for (int i = s.length() - 1; i >= 0; i--) {    ans += (s.charAt(i) - 'A' + 1) * Math.pow(26, s.length() - i - 1);   }   return String.valueOf(ans);  }   String to26(String s){   String ans="";   int a = Integer.valueOf(s);   while(a>26){    a--;    int k = a%26;    ans=ans+(char)((int)'A'+k);    a/=26;   }   ans+=(char)(a+'A'-1);   String ans1 = "";   for(int i = ans.length()-1; i>=0; i--)ans1+=ans.charAt(i);     return ans1;    }  String rev(String s) {   String ans = "";   int format = 0;   int git = 0;   String token1 = "";   String token2 = "";   String token3 = "", token4 = "";   for (int i = 0; i < s.length(); i++) {    if (!isNumber(s.charAt(i)))     token1 += s.charAt(i);    else     break;    git++;   }   for (int i = git; i < s.length(); i++) {    if (isNumber(s.charAt(i)))     token2 += s.charAt(i);    else     break;    git++;   }   if (s.length() == git)    format = 1;   else {    format = 2;       for (int i = git; i < s.length(); i++) {     if (!isNumber(s.charAt(i)))      token3 += s.charAt(i);     else      break;     git++;    }    for (int i = git; i < s.length(); i++)     if (isNumber(s.charAt(i)))      token4 += s.charAt(i);     else      break;   }   if (format == 1) {    ans += "R";    ans += token2;    ans += "C";    ans += to10(token1);   }else{    ans+=to26(token4);    ans+=token2;   }   return ans;  }  private void solver() {   int n = ni();   for (int i = 0; i < n; i++)    System.out.println(rev(nstr()));  }  void exit() {   System.exit(0);  } }
2	public class Main { public static void main(String[] args) {  FastReader fr =new FastReader();  PrintWriter op =new PrintWriter(System.out);  long n =fr.nextLong() ,k =fr.nextLong() ,d =(long)Math.sqrt(9l+8l*(n+k)) ;  d -= 3l ; d /=2l ;op.println(n-d) ;  op.flush(); op.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();  }  String nextLine() {  String str ="";   try  {   str =br.readLine();  }  catch(IOException e)  {   e.printStackTrace();  }   return str;  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next()) ;  } } }
2	public class D {  static long n;  static long x;  static long y;  static long c;  static long f(long t){   long s=0;   if(t==0)    s=1;   else{    s=(4+4*t)/2*t+1;   }   if(x+t>n){    long c=x+t-n;    s-=c*c;   }   if(x-t<=0){    long c=t-x+1;    s-=c*c;   }   if(y+t>n){    long c=y+t-n;    s-=c*c;   }   if(y-t<=0){    long c=t-y+1;    s-=c*c;   }   if(t>x+y-1){    long m=t-x-y+1;    s+=m*(m+1)/2;   }   if (t>x+n-y) {    long m=t-x-n+y;    s+=m*(m+1)/2;   }   if (t>n-x+y) {    long m=t-n-y+x;    s+=m*(m+1)/2;   }   if (t>n-x+n-y+1) {    long m=t-2*n+x+y-1;    s+=m*(m+1)/2;   }   return s;  }  public static void main(String[] args) {     Scanner in=new Scanner(new InputStreamReader(System.in));   PrintWriter out=new PrintWriter(System.out);     n=in.nextLong();   x=in.nextLong();   y=in.nextLong();   c=in.nextLong();             long l=0;   long r=2*n;   while(l<r){    long m=(l+r)/2;    long ff=f(m);    if(ff<c){     l=m+1;    }    else{     r=m;    }   }   out.println(l);   out.close();  } }
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;  }  }
1	public class tr { static int[][] ad;  static boolean []vis;  static int []goods;  static int[][]sol; public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int n=sc.nextInt();  int []a=new int [n];  int max=0;  for(int i=0;i<n;i++)  a[i]=sc.nextInt();  Stack<Integer> s=new Stack<>();  boolean f=true;   for(int i=0;i<n;i++) {   max=Math.max(max,a[i]);   if(!s.isEmpty() && a[i]>s.peek())    f=false;   s.push(a[i]);   while(!s.isEmpty()) {    int high=s.pop();    if(s.isEmpty() || s.peek()!=high) {    s.push(high);    break;    }    s.pop();   }     }     if(f && s.size()==0)   out.println("YES");   else if(f && s.size()==1 && s.peek()==max)   out.println("YES");   else   out.println("NO");  out.flush(); } static int gcd(int a, int b) {  if (b == 0) {  return a;  }  return gcd(b, a % b); }  static class pair implements Comparable<pair> {  int a;  int b;  pair(int a, int b) {  this.a = a;  this.b = b;  }  public String toString() {  return a + " " + b;  }  @Override  public int compareTo(pair o) {  return o.a-a ;  } }  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);  } } }
5	public class A {  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 r = 0, an = 0;  Arrays.sort(a);  int t = 0;  for(int z : a) t += z;  for(int i=a.length-1;i>=0;i--){  r += a[i];  an++;  if (r > t - r) break;  }  System.out.println(an); } }
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] + " ");  } } }
3	public class Fingerprints {  public static void main(String[] args) {  Scanner scanner = new Scanner(System.in);  int[] code = new int[scanner.nextInt()];  int[] prints = new int[scanner.nextInt()];  for (int i = 0; i < code.length; i++) {  code[i] = scanner.nextInt();  }  for (int i = 0; i < prints.length; i++) {  prints[i] = scanner.nextInt();  }  for (int i = 0; i < code.length; i++) {  for (int j = 0; j < prints.length; j++) {   if (code[i] == prints[j]) {   System.out.print(prints[j] + " ");   }  }  }  scanner.close(); } }
2	public class Main {  static long TIME_START, TIME_END;  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);    Runtime runtime = Runtime.getRuntime();   long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();   TIME_START = System.currentTimeMillis();   Task t = new Task();   t.solve(sc, pw);   TIME_END = System.currentTimeMillis();   long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();   pw.close();   System.out.println("Memory increased:" + (usedMemoryAfter-usedMemoryBefore) / 1000000 );   System.out.println("Time used: " + (TIME_END - TIME_START) + ".");  }  public static class Task {   int mod = 1_000_000_007;   public long pow(long a, long b) {    if (b == 0) return 1L;    if (b % 2 == 0) return pow(a * a % mod, b >> 1);    return a * pow(a * a % mod, b >> 1) % mod;   }   public void solve(Scanner sc, PrintWriter pw) throws IOException {    long T = sc.nextLong();    long k = sc.nextLong();    if (T == 0) {     pw.println(0);     return;    }    long a1 = pow(2, k + 1);    long a2 = pow(2, k);    long s = a1 * (T % mod) % mod;    long t = ((1 - a2) + mod) % mod;    long y = (s + t) % mod;    pw.println((y + 5L * mod) % mod);   }    }  static class Scanner {   StringTokenizer st;   BufferedReader br;   public Scanner(InputStream s){ br = new BufferedReader(new InputStreamReader(s));}   public Scanner(FileReader s) throws FileNotFoundException {br = new BufferedReader(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 A { public static final boolean DEBUG = false; Scanner sc;  public void debug(Object o) {  if (DEBUG) {  int ln = Thread.currentThread().getStackTrace()[2].getLineNumber();  String fn = Thread.currentThread().getStackTrace()[2].getFileName();  System.out.println("(" + fn + ":" + ln+ "): " + o);  } }  public void pln(Object o) {  System.out.println(o); }   public void run() {  sc = new Scanner(System.in);   long a = sc.nextLong();  long b = sc.nextLong();  long nr = 0;  if (a < b) {  long aux = a;  a = b;  b = aux;  }  while (a != 0 && b != 0) {  nr += a / b;  long c = a % b;  a = b;  b = c;  }   pln(nr);  return;   } public static void main(String[] args) {  A t = new A();  t.run(); } }
6	public class ASimpleTask {     private static void solve(FastScanner s1, PrintWriter out){  int V = s1.nextInt();  int E = s1.nextInt();  int graph[] = new int[V];  long DP[][] = new long[1 << V][V];  while(E-->0) {  int u = s1.nextInt() - 1;  int v = s1.nextInt() - 1;  graph[u] |= (1 << v);  graph[v] |= (1 << u);  }  for(int i=0;i<V;i++)  DP[1 << i][i] = 1;  for(int mask = 1 , end = 1 << V;mask < end;mask++) {  for(int set = mask;Integer.bitCount(set) > 1;set ^= Integer.highestOneBit(set)) {   int u = Integer.numberOfTrailingZeros(Integer.highestOneBit(set));   for(int fromSet = mask ^ (1 << u);fromSet > 0; fromSet ^= Integer.lowestOneBit(fromSet)) {   int v = Integer.numberOfTrailingZeros(fromSet);      if((graph[u] & (1 << v)) != 0)    DP[mask][u] += DP[mask ^ (1 << u)][v];      }  }  }  long totalCycles = 0;  for(int mask = 1 , end = 1 << V;mask < end;mask++) {  if(Integer.bitCount(mask) >= 3) {   int start = Integer.numberOfTrailingZeros(mask);   for(int set = mask;Integer.bitCount(set) > 1;set ^= Integer.highestOneBit(set)) {   int u = Integer.numberOfTrailingZeros(Integer.highestOneBit(set));   if((graph[u] & (1 << start)) != 0)    totalCycles += DP[mask][u];   }  }  }  totalCycles /= 2;  out.println(totalCycles); }        public static void main(String []args) throws IOException {  FastScanner in = new FastScanner(System.in);  PrintWriter out =   new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);  solve(in, out);  in.close();  out.close(); }   static class FastScanner{  BufferedReader reader;  StringTokenizer st;  FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}  String next()  {while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}    st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}  String nextLine() {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}     int nextInt() {return Integer.parseInt(next());}  long nextLong() {return Long.parseLong(next());}   double nextDouble(){return Double.parseDouble(next());}  char nextChar() {return next().charAt(0);}  int[] nextIntArray(int n)   {int[] a= new int[n]; int i=0;while(i<n){a[i++]=nextInt();} return a;}  long[] nextLongArray(int n)  {long[]a= new long[n]; int i=0;while(i<n){a[i++]=nextLong();} return a;}  int[] nextIntArrayOneBased(int n) {int[] a= new int[n+1]; int i=1;while(i<=n){a[i++]=nextInt();} return a;}    long[] nextLongArrayOneBased(int n){long[]a= new long[n+1];int i=1;while(i<=n){a[i++]=nextLong();}return a;}    void close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}   }  }
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);       }    }
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 a = in.nextLong();   long b = in.nextLong();   out.println(go(a, b));  }  private long go(long a, long b) {   if (b == 0) return 0;   return a / b + go(b, a % b);  } } 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 (Exception e) {     throw new UnknownError();    }   }   return tokenizer.nextToken();  }  public long nextLong() {   return Long.parseLong(next());  }  }
0	public class NewEmpty {  public static void main(String[] args)  {   Scanner blabla=new Scanner(System.in);   long a,b,c=0,d;   a=blabla.nextLong();   b=blabla.nextLong();   while (b!=0){    c+=(a/b);    a=a%b;    d=a;    a=b;    b=d;   }   System.out.println(c);  } }
0	public class Task343A {  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 {  private static long r(long a, long b) {  if (a == 0 || b == 0) {   return 0;  }  if (a > b) {   return a / b + r(b, a % b);  }  return b / a + r(a, b % a);  }  public static void main(InputStream is, OutputStream os)   throws NumberFormatException, IOException {  PrintWriter pw = new PrintWriter(os);  Scanner sc = new Scanner(is);   long a = sc.nextLong();  long b = sc.nextLong();   pw.println(r(a, b));   pw.flush();  sc.close();  } } }
0	public class A{ public static void main(String[] args){  Scanner s = new Scanner(System.in);  int n = s.nextInt();  int prev2=0;  int prev1=1;  int prev=1;  int curr = 2;  if(n == 0) {System.out.println("0 0 0"); return;}  else if(n == 1) {System.out.println("0 0 1");return;}  while(true){  if(curr == n) break;  prev2 = prev1;  prev1 = prev;  int temp = prev + curr;  prev = curr;  curr = temp;  }  System.out.println(prev2 + " " + prev1 + " " + prev1); } }
1	public class IQTest { public static void main(String args[]) throws Exception {  BufferedReader stdin =  new BufferedReader(new InputStreamReader(System.in));  String line;  line = stdin.readLine();  int n = Integer.parseInt(line);  line = stdin.readLine();  List even = new ArrayList();  List odd = new ArrayList();  String[] kk = line.split(" ");  for(int i=0;i<n;i++) {   if(Integer.parseInt(kk[i])%2==0)   even.add(i);   else   odd.add(i);  }  if(even.size()==1)   System.out.println((Integer)even.get(0)+1);  else   System.out.println((Integer)odd.get(0)+1); } }
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);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); } } class TaskA {  public void solve(int testNumber, Scanner in, PrintWriter out) {   int balance = in.nextInt();   if (balance >= 0) {    out.println(balance);    return;   }   balance = -balance;   int a = balance / 100;   int b = Math.min(balance % 10, (balance / 10) % 10);   balance = -(a * 10 + b);   out.println(balance);  } }
2	public class Main {  public static void main(String[] args) {   Scanner scan = new Scanner(System.in);   long n = scan.nextLong();   long k = scan.nextLong();   long D = 9 + 4 * (2 * k + 2 * n);   long y = (- 3 + (long)Math.sqrt(D)) / 2;   System.out.println(n - y);  } }
2	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);   _992C solver = new _992C();   solver.solve(1, in, out);   out.close();  }  static class _992C {   static int mod = (int) 1e9 + 7;   public void solve(int testNumber, InputReader in, OutputWriter out) {    long x = in.nextLong();    long k = in.nextLong();    if (x == 0) {     out.println(0);     return;    }    long[][] base = new long[][]{{2, 0}, {1, 1}};    _992C.Matrix.N = 2;    base = _992C.Matrix.matrixPower(base, base, k);    x %= mod;    long ans = 2 * base[0][0] * x - base[1][0];    ans %= mod;    if (ans < 0)     ans += mod;    out.println(ans);   }   static public class Matrix {    static int N;    static long[][] id = new long[][]{{1, 0}, {0, 1}};    static long[][] matrixPower(long[][] mat, long[][] base, long pow) {     if (pow == 0) {      return id;     }     if (pow == 1) {      return base;     }     long[][] t = matrixPower(mat, base, pow / 2);     t = multiplyMatrix(t, t);     if (pow % 2 == 1) {      t = multiplyMatrix(t, base);     }     return t;    }    static long[][] multiplyMatrix(long[][] m, long[][] m2) {     long[][] ans = new long[N][N];     for (int i = 0; i < N; i++)      for (int j = 0; j < N; j++) {       ans[i][j] = 0;       for (int k = 0; k < N; k++) {        ans[i][j] += m[i][k] * m2[k][j];        ans[i][j] %= mod;       }      }     return ans;    }   }  }  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 close() {    writer.close();   }   public void println(long i) {    writer.println(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 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 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 interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
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);  TaskB solver = new TaskB();  solver.solve(1, in, out);  out.close(); } } class TaskB {  public void solve(int testNumber, InputReader in, PrintWriter out) {   long n = in.nextInt();   long x = in.nextInt();   long y = in.nextInt();   long c = in.nextInt();   if (c == 1) {    out.println(0);    return;   }   long left = 1, right = 2 * n, middle, res = -1;   long val = getNumberOfCells(x, y, n, 2);   while (left <= right) {    middle = (left + right) / 2;    long numberOfCells = getNumberOfCells(x, y, n, middle);    if (numberOfCells < c) {     left = middle + 1;    } else {     res = middle;     right = middle - 1;    }   }   out.println(res);  }  private long getNumberOfCells(long x, long y, long n, long middle) {   long res = 0;   res += calc(x, y, middle + 1);   res += calc(n - x + 1, y, middle + 1);   res += calc(x, n - y + 1, middle + 1);   res += calc(n - x + 1, n - y + 1, middle + 1);   res -= calcX(x, n, middle);   res -= calcX(y, n, middle);   --res;   return res;  }  private long calcX(long x, long n, long size) {   long left = x - size;   long right = x + size;   left = Math.max(left, 1);   right = Math.min(right, n);   if (left <= right) {    return right - left + 1;   }   return 0;  }  private long calc(long x, long y, long size) {   if (size <= Math.min(x, y)) {    return (1 + size) * size / 2;   }   if (size >= x + y - 1) {    return x * y;   }   if (size > Math.max(x, y)) {    return x * y - calc(x, y, x + y - 1 - size);   }   long min = Math.min(x, y);   long res = (1 + min) * min / 2;   long rest = size - min;   res += rest * min;   return res;  } } 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 nextString() {   while (stt == null || !stt.hasMoreTokens()) {    stt = new StringTokenizer(nextLine());   }   return stt.nextToken();  }  public int nextInt() {   return Integer.parseInt(nextString());  } }
3	public class Main {  private static void solve(InputReader in, OutputWriter out) {   int n = in.nextInt();   int m = in.nextInt();   String[] sa = new String[n];   for (int i = 0; i < n; i++) {    sa[i] = in.next();   }   Set<Integer> switches = new HashSet<>();   for (int i = 0; i < m; i++) {    int cnt = 0, swtch = -1;    for (int j = 0; j < n; j++) {     if (sa[j].charAt(i) == '1') {      cnt++;      swtch = j;      if (cnt > 1)       break;     }    }    if (cnt == 1) {     switches.add(swtch);    }   }   out.print(switches.size() == n ? "NO" : "YES");  }  private static void shuffleArray(int[] array) {   int index;   Random random = new Random();   for (int i = array.length - 1; i > 0; i--) {    index = random.nextInt(i + 1);    if (index != i) {     array[index] ^= array[i];     array[i] ^= array[index];     array[index] ^= array[i];    }   }  }  public static void main(String[] args) {   InputReader in = new InputReader(System.in);   OutputWriter out = new OutputWriter(System.out);   solve(in, out);   in.close();   out.close();  }  private static class InputReader {   private BufferedReader br;   private StringTokenizer st;   InputReader(InputStream is) {    br = new BufferedReader(new InputStreamReader(is));    st = null;   }   String nextLine() {    String line = null;    try {     line = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return line;   }   String next() {    while (st == null || !st.hasMoreTokens()) {     String line = nextLine();     if (line == null) return null;     st = new StringTokenizer(line);    }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   void close() {    try {     br.close();    } catch (IOException e) {     e.printStackTrace();    }   }  }  private static class OutputWriter {   BufferedWriter bw;   OutputWriter(OutputStream os) {    bw = new BufferedWriter(new OutputStreamWriter(os));   }   void print(int i) {    print(Integer.toString(i));   }   void println(int i) {    println(Integer.toString(i));   }   void print(long l) {    print(Long.toString(l));   }   void println(long l) {    println(Long.toString(l));   }   void print(double d) {    print(Double.toString(d));   }   void println(double d) {    println(Double.toString(d));   }   void print(boolean b) {    print(Boolean.toString(b));   }   void println(boolean b) {    println(Boolean.toString(b));   }   void print(char c) {    try {     bw.write(c);    } catch (IOException e) {     e.printStackTrace();    }   }   void println(char c) {    println(Character.toString(c));   }   void print(String s) {    try {     bw.write(s);    } catch (IOException e) {     e.printStackTrace();    }   }   void println(String s) {    print(s);    print('\n');   }   void close() {    try {     bw.close();    } catch (IOException e) {     e.printStackTrace();    }   }  } }
5	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st;   st = new StringTokenizer(in.readLine());     int n = Integer.parseInt(st.nextToken()),    a = Integer.parseInt(st.nextToken()),    b = Integer.parseInt(st.nextToken());     st = new StringTokenizer(in.readLine());     ArrayList<Integer> A = new ArrayList<Integer>();     for (int i = 0 ; i < n ; i++) {    A.add(Integer.parseInt(st.nextToken()));   }     Collections.sort(A);     System.out.println(A.get(b) - A.get(b - 1));  } }
1	public class Main {  public static void process()throws IOException  {   long n=nl();   if(n%2==0)   {    long a1=(long)Math.sqrt(n);    long a2=(long)Math.sqrt(n/2);    if(a1*a1==n || a2*a2*2==n)     {pn("YES");return;}   }   pn("NO");  }   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;}}   }
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);  } } }
0	public class Main {  private static BufferedReader reader;  private static BufferedWriter out;  private static StringTokenizer tokenizer;    private static void init(InputStream input, OutputStream output) {   reader = new BufferedReader(new InputStreamReader(input));   out = new BufferedWriter(new OutputStreamWriter(output));        tokenizer = new StringTokenizer("");  }  private static String nextLine() throws IOException {   return reader.readLine();  }  private static String next() throws IOException {   while (!tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(nextLine());   }   return tokenizer.nextToken();  }  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());  }    public static void main(String[] args) throws IOException {   init(System.in, System.out);   int n = nextInt();     if (n > 0) {    out.write(n + "\n");   } else {    String s = n + "";    String s2 = s.substring(0, s.length() - 1);    String s3 = s.substring(0, s.length() - 2) + s.charAt(s.length() - 1);    int a = Integer.parseInt(s2);    int b = Integer.parseInt(s3);    int ans = Math.max(a, b);    out.write(ans + "\n");   }        out.flush();  } }
5	public class j { public static void main(String a[])throws IOException { BufferedReader b=new BufferedReader(new InputStreamReader(System.in)); int k=0,i=0,j=0,n=0,p=0,t=0; String s; s=b.readLine(); StringTokenizer c=new StringTokenizer(s); n=Integer.parseInt(c.nextToken()); k=Integer.parseInt(c.nextToken()); int d[]=new int[n]; int e[]=new int[n]; for(i=0;i<n;i++) { s=b.readLine(); StringTokenizer z=new StringTokenizer(s); d[i]=Integer.parseInt(z.nextToken()); e[i]=Integer.parseInt(z.nextToken()); } for(i=0;i<n-1;i++) { for(j=i+1;j<n;j++) { if(d[j]<d[i]) { t=d[j]; d[j]=d[i]; d[i]=t; t=e[j]; e[j]=e[i]; e[i]=t; } } } for(i=0;i<n-1;i++) { if(((d[i+1]-e[i+1]/2.0)-(d[i]+e[i]/2.0))>k) p+=2; if(((d[i+1]-e[i+1]/2.0)-(d[i]+e[i]/2.0))==k) p++; } System.out.print(p+2); } }
3	public class c {  static boolean seq[]; static long memo[][], mod = (long)1e9 + 7; static long go(int n, int d) {  long ans = 0;  if(d < 0) return 0;  if(n == seq.length) return 1;  int f = 1;  if(n > 0) f = seq[n-1]?1:0;  if(memo[n][d] != -1) return memo[n][d];  if(f == 0) {  ans += go(n + 1, d + (seq[n]?1:0));  ans %= mod;  ans += go(n, d-1);  ans %= mod;  }  if(f == 1) {  ans += go(n + 1, d + (seq[n]?1:0));  ans %= mod;  }  return memo[n][d] = ans; }  public static void main(String args[]) throws IOException {  FastScanner in = new FastScanner(System.in);  PrintWriter out = new PrintWriter(System.out);   int n = in.nextInt();  seq = new boolean[n];  for (int i = 0; i < n; i++ ) {  seq[i] = (in.next().charAt(0) == 'f');  }  memo = new long[n][n+1];  for(int i = 0; i < n; i++) {   Arrays.fill(memo[i], -1);  }  System.out.println(go(0, 0));  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)];  } }; }
4	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);    StreamTokenizer st = new StreamTokenizer(reader);    PrintWriter out = new PrintWriter(writer);    String s = br.readLine();    int n = s.length();    int max = 0;    for (int i = 0; i < n; i++)     for (int j = i; j < n; j++) {      int len = j - i + 1;      int count = 0;      for (int k = 0; k < n - len + 1; k++) {       boolean eq = true;       for(int l = 0; l < len;l++) {        if (s.charAt(i + l) != s.charAt(k + l)) {         eq = false;         break;        }       }       if (eq) {        count++;       }      }      if (count >= 2 && len > max) {       max = len;      }     }    out.printf("%d", max);    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) == '.' || 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')) || ((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();   }  } }
0	public class A267 {  static public long _solve(long a,long b){   long result = -1;   while(a!=0 && b!=0){    if(a>b){     result +=(a/b);     a = a%b;    }    else{     result +=(b/a);     b = b%a;    }   }   return result+1;  }  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int t = in.nextInt();   long a,b;   while(t-- > 0){    a = in.nextLong();    b = in.nextLong();    System.out.println(_solve(a,b));   }  }   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() {    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());   }   public long nextLong() {    return Long.parseLong(next());   }   public String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   public double nextDouble() {    return Double.parseDouble(next());   }   public boolean ready() throws IOException {    return br.ready();   }  } }
3	public class newProgram5 {  public static void main(String[] args) throws IOException {     FastIO in = new FastIO();   int n = in.ni();   int a[] = in.gia(n);   int freq[] = new int[100 + 1];   for (int i = 0; i < n; i++) {    freq[a[i]]++;   }   int k = 0;   for (int i = 1; i <= 100; i++) {    if (freq[i] > 0) {     for (int j = i; j <= 100; j += i) {      freq[j] = 0;     }     k++;        }   }   System.out.println(k);   in.bw.flush();  }  static class FastIO {   private final BufferedReader br;   private final BufferedWriter bw;   private String s[];   private int index;   private final StringBuilder sb;   public FastIO() throws IOException {    br = new BufferedReader(new InputStreamReader(System.in));    bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));    s = br.readLine().split(" ");    sb = new StringBuilder();    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 int[][][] gwtree(int n) throws IOException {    int m = n - 1;    int adja[][] = new int[n + 1][];    int weight[][] = new int[n + 1][];    int from[] = new int[m];    int to[] = new int[m];    int count[] = new int[n + 1];    int cost[] = new int[n + 1];    for (int i = 0; i < m; i++) {     from[i] = i + 1;     to[i] = ni();     cost[i] = ni();     count[from[i]]++;     count[to[i]]++;    }    for (int i = 0; i <= n; i++) {     adja[i] = new int[count[i]];     weight[i] = new int[count[i]];    }    for (int i = 0; i < m; i++) {     adja[from[i]][count[from[i]] - 1] = to[i];     adja[to[i]][count[to[i]] - 1] = from[i];     weight[from[i]][count[from[i]] - 1] = cost[i];     weight[to[i]][count[to[i]] - 1] = cost[i];     count[from[i]]--;     count[to[i]]--;    }    return new int[][][] { adja, weight };   }   public int[][][] gwg(int n, int m) throws IOException {    int adja[][] = new int[n + 1][];    int weight[][] = new int[n + 1][];    int from[] = new int[m];    int to[] = new int[m];    int count[] = new int[n + 1];    int cost[] = new int[n + 1];    for (int i = 0; i < m; i++) {     from[i] = ni();     to[i] = ni();     cost[i] = ni();     count[from[i]]++;     count[to[i]]++;    }    for (int i = 0; i <= n; i++) {     adja[i] = new int[count[i]];     weight[i] = new int[count[i]];    }    for (int i = 0; i < m; i++) {     adja[from[i]][count[from[i]] - 1] = to[i];     adja[to[i]][count[to[i]] - 1] = from[i];     weight[from[i]][count[from[i]] - 1] = cost[i];     weight[to[i]][count[to[i]] - 1] = cost[i];     count[from[i]]--;     count[to[i]]--;    }    return new int[][][] { adja, weight };   }   public int[][] gtree(int n) throws IOException {    int adja[][] = new int[n + 1][];    int from[] = new int[n - 1];    int to[] = new int[n - 1];    int count[] = new int[n + 1];    for (int i = 0; i < n - 1; i++) {     from[i] = i + 1;     to[i] = ni();     count[from[i]]++;     count[to[i]]++;    }    for (int i = 0; i <= n; i++) {     adja[i] = new int[count[i]];    }    for (int i = 0; i < n - 1; i++) {     adja[from[i]][--count[from[i]]] = to[i];     adja[to[i]][--count[to[i]]] = from[i];    }    return adja;   }   public int[][] gg(int n, int m) throws IOException {    int adja[][] = new int[n + 1][];    int from[] = new int[m];    int to[] = new int[m];    int count[] = new int[n + 1];    for (int i = 0; i < m; i++) {     from[i] = ni();     to[i] = ni();     count[from[i]]++;     count[to[i]]++;    }    for (int i = 0; i <= n; i++) {     adja[i] = new int[count[i]];    }    for (int i = 0; i < m; i++) {     adja[from[i]][--count[from[i]]] = to[i];     adja[to[i]][--count[to[i]]] = from[i];    }    return adja;   }   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();    }   }  }  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;    }   }  } }
6	public class E {  static InputStream is;   public static void main(String[] args) throws IOException {  is = System.in;  int n = ni();  int k = ni();   int[][] aj = new int[n][n];   for (int i = 0; i < aj.length; i++) {  aj[i] = na(n);  }   int F = (n+1)/2;  int B = n-F;   int[] spanftf = new int[F];  int[] spanftb = new int[F];  for(int i =0; i < F; i++){  for(int j =0; j < F; j++){   if(i == j || aj[i][j] == 1){   spanftf[i] |= 1<<j;   }  }  for(int j =0; j< B; j++){   if(aj[i][F+j] == 1){   spanftb[i] |= 1<<j;   }  }  }  int[] maxes = new int[1<<B];  for(int bm = 0; bm < (1<<F); bm++){  int anded = (1<<F)-1;  int spanToBack = (1<<B)-1;    for(int i =0; i < F; i++){   if((1<<i & bm) != 0){   anded &= spanftf[i];   spanToBack &= spanftb[i];   }  }    if((anded & bm) == bm){   maxes[spanToBack] = Math.max(maxes[spanToBack], Integer.bitCount(bm));  }  }  int[] spanbtb = new int[B];  for(int i =0; i < B; i++){  for(int j =0; j< B; j++){   if(aj[F+i][F+j] == 1 || i == j){   spanbtb[i] |= 1<<j;   }  }  }  boolean[] isgood = new boolean[1<<B];  for(int bm =0; bm < (1<<B); bm++){  int anded = (1<<B)-1;    for(int i =0; i < B; i++){   if((1<<i & bm) != 0){   anded &= spanbtb[i];   }  }    if((anded & bm) == bm){   isgood[bm] = true;  }    }  bybc[] tosort = new bybc[1<<B];  for (int i = 0; i < tosort.length; i++) {  tosort[i]= new bybc(i);  }  Arrays.sort(tosort);   int best = 1;  for (int i = 0; i < tosort.length; i++) {  int at =tosort[i].mask;  if(isgood[at]){   best = Math.max(best, maxes[at]+Integer.bitCount(at));  }    for(int j =0; j < B; j++){   if((1<<j & at) != 0){   int to = at - (1<<j);   maxes[to] = Math.max(maxes[to], maxes[at]);   }  }    }      double ans= best*(best-1)/2.0 * (k*k/(double)(best*best));  System.out.println(ans); }  static class bybc implements Comparable<bybc>{  int mask;  public bybc(int mask) {  super();  this.mask = mask;  }   @Override  public int compareTo(bybc o) {  return Integer.bitCount(o.mask) - Integer.bitCount(mask);  } }  private static byte[] inbuf = new byte[1024]; public static int lenbuf = 0, ptrbuf = 0;  private static 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 static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private static int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }  private static double nd() { return Double.parseDouble(ns()); } private static char nc() { return (char)skip(); }  private static String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private static 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 static 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 static int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private static 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 static 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 TwoSquares {   int INF = 1000;   void solve() {   int[][] s1 = new int[4][2];   for (int i = 0; i < 4; i++) {    s1[i][0] = in.nextInt();    s1[i][1] = in.nextInt();   }     int[][] s2 = new int[4][2];   for (int i = 0; i < 4; i++) {    s2[i][0] = in.nextInt();    s2[i][1] = in.nextInt();   }     if (ok(s1, s2)) {    out.println("Yes");    return;   }     rotate(s1);   rotate(s2);     if (ok(s2, s1)) {    out.println("Yes");    return;   }     out.println("No");  }   void rotate(int[][] s) {   for (int i = 0; i < 4; i++) {    int x = s[i][0], y = s[i][1];    s[i][0] = x - y;    s[i][1] = x + y;   }  }   boolean ok(int[][] s1, int[][] s2) {   int xmin = INF, xmax = -INF, ymin = INF, ymax = -INF;   for (int i = 0; i < 4; i++) {    xmin = Math.min(xmin, s1[i][0]);    xmax = Math.max(xmax, s1[i][0]);    ymin = Math.min(ymin, s1[i][1]);    ymax = Math.max(ymax, s1[i][1]);   }     for (int i = 0; i < 4; i++) {    if (s2[i][0] >= xmin && s2[i][0] <= xmax && s2[i][1] >= ymin && s2[i][1] <= ymax) return true;   }     int[] mid2 = new int[]{s2[0][0] + s2[2][0], s2[0][1] + s2[2][1]};   return mid2[0] >= xmin * 2 && mid2[0] <= xmax * 2 && mid2[1] >= ymin * 2 && mid2[1] <= ymax * 2;  }   public static void main(String[] args) {   in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));   out = new PrintWriter(System.out);   new TwoSquares().solve();   out.close();  }   static FastScanner in;  static PrintWriter out;   static class FastScanner {   BufferedReader in;   StringTokenizer st;     public FastScanner(BufferedReader in) {    this.in = in;   }     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());   }     public long nextLong() {    return Long.parseLong(nextToken());   }     public double nextDouble() {    return Double.parseDouble(nextToken());   }  } }
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;  }  }
4	public class Main { static final FastReader FR = new FastReader(); static final PrintWriter PW = new PrintWriter(new OutputStreamWriter(System.out));  public static void main(String[] args) {  StringBuilder solution = new StringBuilder();  int rows = FR.nextInt();  int cols = FR.nextInt();  int moves = FR.nextInt();  Map<Integer, Integer> horizontalEdgeWeights = new HashMap<Integer, Integer>();  for (int r = 0; r < rows; r++) {  for (int c = 0; c < cols - 1; c++) {   int hash = getHash(r, c);   horizontalEdgeWeights.put(hash, FR.nextInt());  }  }  Map<Integer, Integer> verticalEdgeWeights = new HashMap<Integer, Integer>();  for (int r = 0; r < rows - 1; r++) {  for (int c = 0; c < cols; c++) {   int hash = getHash(r, c);   verticalEdgeWeights.put(hash, FR.nextInt());  }  }   List<List<Integer>> result = getResult(rows, cols, moves, horizontalEdgeWeights, verticalEdgeWeights);  for (int r = 0; r < rows; r++) {  for (int c = 0; c < cols; c++) {   int value = (result != null ? result.get(r).get(c) : -1);   solution.append(value + " ");  }  solution.append("\n");  }  PW.print(solution.toString());  PW.close(); }  static List<List<Integer>> getResult(int rows, int cols, int moves, Map<Integer, Integer> horizontalEdgeWeights, Map<Integer, Integer> verticalEdgeWeights) {  if ((moves & 1) == 1) {  return null;  }  int mid = moves >> 1;  List<List<List<Integer>>> minForDistance = new ArrayList<List<List<Integer>>>(rows);  for (int r = 0; r < rows; r++) {  minForDistance.add(new ArrayList<List<Integer>>(cols));   for (int c = 0; c < cols; c++) {   minForDistance.get(r).add(new ArrayList<Integer>(Collections.nCopies(mid+1, Integer.MAX_VALUE)));   minForDistance.get(r).get(c).set(0, 0);  }  }  for (int m = 1; m <= mid; m++) {  for (int r = 0; r < rows; r++) {   for (int c = 0; c < cols; c++) {   int minBoredom = minForDistance.get(r).get(c).get(m);   int hash = getHash(r, c);    if (r > 0) {    if (minForDistance.get(r-1).get(c).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r-1).get(c).get(m-1) + verticalEdgeWeights.get(getHash(r-1, c));    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }    if (c > 0) {    if (minForDistance.get(r).get(c-1).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r).get(c-1).get(m-1) + horizontalEdgeWeights.get(getHash(r, c-1));    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }      if (r + 1 < rows) {    if (minForDistance.get(r+1).get(c).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r+1).get(c).get(m-1) + verticalEdgeWeights.get(hash);    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }     if (c + 1 < cols) {    if (minForDistance.get(r).get(c+1).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r).get(c+1).get(m-1) + horizontalEdgeWeights.get(hash);    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }    minForDistance.get(r).get(c).set(m, minBoredom);   }  }  }  List<List<Integer>> result = new ArrayList<List<Integer>>(rows);  for (int r = 0; r < rows; r++) {  result.add(new ArrayList<Integer>(cols));   for (int c = 0; c < cols; c++) {   result.get(r).add(minForDistance.get(r).get(c).get(mid) << 1);  }  }  return result; }  static int getHash(int row, int col) {  return (row * 1000 + col); } static int getRow(int hash) {  return hash / 1000; } static int getCol(int hash) {  return hash % 1000; }  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;  } } }
4	public class Main implements Runnable {  public void _main() throws IOException {  String s = next();  for (int len = s.length(); len >= 1; len--) {  for (int i = 0; i + len <= s.length(); i++)   for (int j = i + 1; j + len <= s.length(); j++)   if (s.substring(i, i + len).equals(s.substring(j, j + len))) {    out.print(len);    return;   }  }  out.print(0); }  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);  } } }
4	public class D2 { InputStream is; FastWriter out; String INPUT = "";  void solve() {  int n = ni(), m = ni(), K = ni();  int[][] a = new int[2*n+1][2*m+1];  for(int i = 0;i < n;i++){  int[] u = na(m-1);  for(int j = 0;j < m-1;j++){   a[2*i][2*j+1] = u[j];  }  }  for(int i = 0;i < n-1;i++){  int[] u = na(m);  for(int j = 0;j < m;j++){   a[2*i+1][2*j] = u[j];  }  }  if(K % 2 == 1){  for(int i = 0;i < n;i++){   for(int j = 0;j < m;j++){   out.print(-1 + " ");   }   out.println();  }  return;  }  int[][][] dp = new int[K/2+1][n][m];  int[] dr = {1, 0, -1, 0};  int[] dc = {0, 1, 0, -1};  for(int i = 1;i <= K/2;i++){  for(int j = 0;j < n;j++){   for(int k = 0;k < m;k++){   dp[i][j][k] = Integer.MAX_VALUE;   for(int l = 0;l < 4;l++){    int jj = j + dr[l], kk = k + dc[l];    if(jj >= 0 && jj < n && kk >= 0 && kk < m){    dp[i][j][k] = Math.min(dp[i][j][k], dp[i-1][jj][kk] + a[j+jj][k+kk]);    }   }   }  }  }  for(int i = 0;i < n;i++){  for(int j = 0;j < m;j++){   out.print(dp[K/2][i][j] * 2 + " ");  }  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 D2().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)); } }
1	public class B { int mod=1000_000_007; public static void main(String[] args) throws Exception {   PrintWriter out=new PrintWriter(System.out);  FastScanner fs=new FastScanner();  int t=fs.nextInt();  while(t-->0) {   double n=fs.nextInt();   if(isp(n/2)||isp(n/4)) {   System.out.println("YES");   }   else System.out.println("NO");  } } static boolean isp(double n) {  if(n==0) return false;  double a=Math.ceil(Math.sqrt(n));  double b=Math.floor(Math.sqrt(n));  return a==b; } static void mysort(long[] a) {   int n=a.length;  Random r=new Random();  for (int i=0; i<a.length; i++) {  int oi=r.nextInt(n);  long temp=a[i];  a[i]=a[oi];  a[oi]=temp;  }     Arrays.sort(a); }   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());  } }  }
5	public class Main{  Scanner sc=new Scanner(System.in);   void run(){   int n = sc.nextInt();     int x[] = new int [n];     for (int i=0;i<n;i++)    x[i] = sc.nextInt();     java.util.Arrays.sort(x);     int i = 0;     for(i=0;i<n-1;i++) {    if (x[i] != x[i+1]) {     System.out.println( x[i+1] );     return;    }   }   System.out.println("NO");     return;    }   public static void main(String[] args){   new Main().run();  } }
3	public class Main {  static final long MOD = 1_000_000_007, INF = 1_000_000_000_000_000_000L;  static final int INf = 1_000_000_000;  static FastReader reader;  static PrintWriter writer;  public static void main(String[] args) {   Thread t = new Thread(null, new O(), "Integer.MAX_VALUE", 100000000);   t.start();  }  static class O implements Runnable {   public void run() {    try {     magic();    }    catch (Exception e) {     e.printStackTrace();     System.exit(1);    }   }  }  static class FastReader {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;   public FastReader() {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public FastReader(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[1000000];    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 void magic() throws IOException {   reader = new FastReader();   writer = new PrintWriter(System.out, true);   Map<Integer, ArrayList<Pair>> map = new HashMap<>();   int n = reader.nextInt();   int arr[] = new int[n];   for(int i=0;i<n;++i) {    arr[i] = reader.nextInt();   }   for(int i=0;i<n;++i) {    int sum = 0;    for(int j=i;j<n;++j) {     sum+=arr[j];     ArrayList<Pair> list = map.get(sum);     if(list==null) {      list = new ArrayList<>();     }     list.add(new Pair(i+1,j+1));     map.put(sum, list);    }   }   int ans = 0,at = -1;   for(int e : map.keySet()) {    ArrayList<Pair> list = map.get(e);    Collections.sort(list);       int ispe = 0;    int len = list.size();    for(int i=0;i<len;++i) {     ispe++;     int r = list.get(i).y;     while(i+1<len && list.get(i+1).x<=r) {      i++;     }    }    if(ans<ispe) {     ans = ispe;     at = e;    }   }   writer.println(ans);   ArrayList<Pair> list = map.get(at);   Collections.sort(list);   int len = list.size();   for(int i=0;i<len;++i) {    writer.println(list.get(i).x+" "+list.get(i).y);    int r = list.get(i).y;    while(i+1<len && list.get(i+1).x<=r) {     i++;    }   }  }  static class Pair implements Comparable<Pair> {   int x,y;   Pair(int x, int y) {    this.x = x;    this.y = y;   }   public int compareTo(Pair other) {    if(this.y!=other.y) {     return this.y - other.y;    }    return this.x - other.x;   }   public String toString() {    return "{" + x + "," + y + "}";   }  } }
2	public class Contest {  public static void main(String[] args)throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   String[] s=br.readLine().split(" ");  BigInteger x = new BigInteger(s[0]);  BigInteger k = new BigInteger(s[1]);  BigInteger mod = new BigInteger(String.valueOf((int) (Math.pow(10, 9) + 7)));  BigInteger two = new BigInteger("2");  BigInteger interm = two.modPow(k, mod);  BigInteger res = interm.multiply(two.multiply(x).subtract(BigInteger.ONE)).add(BigInteger.ONE).mod(mod);  if(x.equals(BigInteger.ZERO)) {  System.out.println("0");  return;  }  System.out.println(res); } }
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);   TaskE2 solver = new TaskE2();   int testCount = Integer.parseInt(in.next());   for (int i = 1; i <= testCount; i++)    solver.solve(i, in, out);   out.close();  }  static class TaskE2 {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int m = in.nextInt();    TaskE2.Column[] columns = new TaskE2.Column[m];    for (int i = 0; i < m; ++i) columns[i] = new TaskE2.Column(new int[n]);    for (int i = 0; i < n; ++i) {     for (int j = 0; j < m; ++j) {      columns[j].vals[i] = in.nextInt();     }    }    for (int i = 0; i < m; ++i) columns[i].initMax();    Arrays.sort(columns, new Comparator<TaskE2.Column>() {     public int compare(TaskE2.Column o1, TaskE2.Column o2) {      return o2.max - o1.max;     }    });    if (columns.length > n) {     columns = Arrays.copyOf(columns, n);    }    out.println(solveOne(columns));   }   private int solveOne(TaskE2.Column[] columns) {    int n = columns[0].vals.length;    int[] best = new int[1 << n];    int[] next = new int[1 << n];    int[] tmp = new int[1 << n];    for (TaskE2.Column c : columns) {     System.arraycopy(best, 0, next, 0, best.length);     for (int rot = 0; rot < n; ++rot) {      System.arraycopy(best, 0, tmp, 0, best.length);      for (int i = 0, pos = rot; i < n; ++i, ++pos) {       if (pos >= n) pos = 0;       int val = c.vals[pos];       for (int j = 0; j < tmp.length; ++j)        if ((j & (1 << i)) == 0) {         tmp[j ^ (1 << i)] = Math.max(tmp[j ^ (1 << i)], tmp[j] + val);        }      }      for (int j = 0; j < tmp.length; ++j) {       next[j] = Math.max(next[j], tmp[j]);      }     }     int[] aa = best;     best = next;     next = aa;    }    return best[best.length - 1];   }   static class Column {    int[] vals;    int max;    public Column(int[] vals) {     this.vals = vals;    }    void initMax() {     max = 0;     for (int x : vals) max = Math.max(max, x);    }   }  }  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());   }  } }
6	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);   TaskE1 solver = new TaskE1();   solver.solve(1, in, out);   out.close();  }  static class TaskE1 {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int numTests = in.nextInt();    for (int test = 0; test < numTests; test++) {     int n = in.nextInt();     int m = in.nextInt();     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();      }     }     int[] d = new int[1 << n];     int[] nd = new int[1 << n];     for (int j = 0; j < m; j++) {      System.arraycopy(d, 0, nd, 0, d.length);      for (int mask = 0; mask < 1 << n; mask++) {       for (int submask = mask; submask > 0; submask = (submask - 1) & mask) {        for (int shift = 0; shift < n; shift++) {         int sum = 0;         for (int i = 0; i < n; i++) {          if ((submask & (1 << i)) > 0) {           sum += a[(i + shift) % n][j];          }         }         nd[mask] = Math.max(nd[mask], d[mask ^ submask] + sum);        }       }      }      int[] t = d;      d = nd;      nd = t;     }     int ans = 0;     for (int x : d) {      ans = Math.max(ans, x);     }     out.println(ans);    }   }  }  static 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 {      st = new StringTokenizer(in.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }  } }
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);   }  } }
4	public class P {  static int N, M, K; static int dx[] = { 0, 0, 1, -1, 1, 1, -1, -1 }; static int dy[] = { 1, -1, 0, 0, 1, -1, 1, -1 }; static Pair[] b;  static boolean isValid(int x, int y) {  return x >= 0 && y >= 0 && x < N && y < M; }  static class Pair {  int x, y;  Pair(int i, int j) {  x = i;  y = j;  } }  static Pair bfs() {  Queue<Pair> q = new LinkedList<Pair>();  int[][] dist = new int[N][M];  for (int i = 0; i < N; i++)  for (int j = 0; j < M; j++)   dist[i][j] = -1;  for (int i = 0; i < K; i++) {  dist[b[i].x][b[i].y] = 0;  q.add(b[i]);  }  while (!q.isEmpty()) {  Pair cur = q.remove();  for (int d = 0; d < 4; d++) {   int X = cur.x + dx[d];   int Y = cur.y + dy[d];   if (isValid(X, Y) && dist[X][Y] == -1) {   dist[X][Y] = dist[cur.x][cur.y] + 1;   Pair P = new Pair(X, Y);   q.add(P);   }  }  }  int max = -1;  Pair MX = null;  for (int i = 0; i < N; i++)  for (int j = 0; j < M; j++) {   if (dist[i][j] > max) {   max = dist[i][j];   MX = new Pair(i + 1, j + 1);   }  }  return MX; }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner("input.txt");  PrintWriter out = new PrintWriter("output.txt");     N = sc.nextInt();  M = sc.nextInt();  K = sc.nextInt();  b = new Pair[K];  for (int i = 0; i < K; i++)  b[i] = new Pair(sc.nextInt() - 1, sc.nextInt() - 1);  Pair last = bfs();  out.println((last.x) + " " + (last.y));  out.flush();  out.close(); }  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[] nextIntArraySorted(int n) throws IOException {  int[] a = nextIntArray(n);  Random r = new Random();  for (int i = 0; i < n; i++) {   int j = i + r.nextInt(n - i);   int t = a[i];   a[i] = a[j];   a[j] = t;  }  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;  } } }
1	public class TaskA { public static void main(String[] args) {  new TaskA(System.in, System.out); }  static class Solver implements Runnable {  int n;  String[] last, curr;  BufferedReader in;  PrintWriter out;  void solve() throws IOException  {  n = Integer.parseInt(in.readLine());  last = new String[n];  curr = new String[n];   for (int i = 0; i < n; i++)   last[i] = in.readLine();   for (int i = 0; i < n; i++)   curr[i] = in.readLine();   int changes = 0;  String[] sizes = new String[]{"S", "M", "L", "XS", "XXS", "XXXS", "XL", "XXL", "XXXL"};  int[] old = count(last, sizes);  int[] now = count(curr, sizes);   for (int i= 0; i < sizes.length; i++)  {   changes += Math.abs(old[i] - now[i]);  }   out.println(changes / 2);   }  int[] count(String[] s, String[] sizes)  {  int len = sizes.length;  int[] cnt = new int[len];   for (int i = 0; i < len; i++)  {   for (String str : s)   {   if (str.equals(sizes[i]))    cnt[i]++;   }  }   return cnt;  }  void debug(Object... o)  {  System.err.println(Arrays.deepToString(o));  }  public Solver(BufferedReader in, PrintWriter out)  {  this.in = in;  this.out = out;  }  @Override  public void run()  {  try  {   solve();  }  catch (IOException e)  {   e.printStackTrace();  }  }  }  static class CMath {  static long power(long number, long power)  {  if (number == 1 || number == 0 || power == 0)   return 1;   if (power == 1)   return number;   if (power % 2 == 0)   return power(number * number, power / 2);  else   return power(number * number, power / 2) * number;  }  static long modPower(long number, long power, long mod)  {  if (number == 1 || number == 0 || power == 0)   return 1;   number = mod(number, mod);   if (power == 1)   return number;   long square = mod(number * number, mod);   if (power % 2 == 0)   return modPower(square, power / 2, mod);  else   return mod(modPower(square, power / 2, mod) * number, mod);  }  static long moduloInverse(long number, long mod)  {  return modPower(number, mod - 2, mod);  }  static long mod(long number, long mod)  {  return number - (number / mod) * mod;  }  static int gcd(int a, int b)  {  if (b == 0)   return a;  else   return gcd(b, a % b);  }  static long min(long... arr)  {  long min = arr[0];   for (int i = 1; i < arr.length; i++)   min = Math.min(min, arr[i]);   return min;  }  static long max(long... arr)  {  long max = arr[0];   for (int i = 1; i < arr.length; i++)   max = Math.max(max, arr[i]);   return max;  }  static int min(int... arr)  {  int min = arr[0];   for (int i = 1; i < arr.length; i++)   min = Math.min(min, arr[i]);   return min;  }  static int max(int... arr)  {  int max = arr[0];   for (int i = 1; i < arr.length; i++)   max = Math.max(max, arr[i]);   return max;  }  }  static class Utils {  static boolean nextPermutation(int[] arr)  {  for (int a = arr.length - 2; a >= 0; --a)  {   if (arr[a] < arr[a + 1])   {   for (int b = arr.length - 1; ; --b)   {    if (arr[b] > arr[a])    {    int t = arr[a];     arr[a] = arr[b];    arr[b] = t;     for (++a, b = arr.length - 1; a < b; ++a, --b)    {     t = arr[a];     arr[a] = arr[b];     arr[b] = t;    }     return true;    }   }   }  }   return false;  }  }  public TaskA(InputStream inputStream, OutputStream outputStream) {  BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));  PrintWriter out = new PrintWriter(outputStream);  Thread thread = new Thread(null, new Solver(in, out), "TaskA", 1 << 29);  try  {  thread.start();  thread.join();  }  catch (InterruptedException e)  {  e.printStackTrace();  }  finally  {  try  {   in.close();  }  catch (IOException e)  {   e.printStackTrace();  }   out.flush();  out.close();  } } }
3	public class C {  public static void main(String[] args){  try(Scanner sc = new Scanner(System.in)){  final int N = sc.nextInt();    String[] ins = new String[N];  for(int i = 0; i < N; i++){   ins[i] = sc.next();  }    final long MOD = 1000000007;  long[] DP = new long[N];  long[] nextDP = new long[N];    DP[0] = 1;    for(int i = 1; i < N; i++){   Arrays.fill(nextDP, 0);   if("f".equals(ins[i - 1])){   for(int j = 0; j < N - 1; j++){    nextDP[j + 1] += DP[j];    nextDP[j + 1] %= MOD;   }   }else{   for(int j = N - 1; j >= 0; j--){    nextDP[j] += DP[j];    nextDP[j] %= MOD;       if(j < N - 1){    nextDP[j] += nextDP[j + 1];    nextDP[j] %= MOD;    }   }   }     {   long[] tmp = DP;   DP = nextDP;   nextDP = tmp;   }  }    long answer = 0;  for(int i = 0; i < N; i++){   answer += DP[i];   answer %= MOD;  }    System.out.println(answer);  } }  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) {   }  } } }
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());  }       }
4	public class Solution {   final InputReader in = new InputReader(System.in);   final PrintWriter out = new PrintWriter(System.out);  int n,m;  void solve() {   n = in.nextInt();   m = in.nextInt();   int k = in.nextInt();   int[][] hor = new int[n][m-1];   int[][] ver = new int[n-1][m];   for(int i=0; i<n; i++) {    for(int j=0; j<m-1; j++) {     hor[i][j] = in.nextInt();    }   }   for(int i=0; i<n-1; i++) {    for(int j=0; j<m; j++) {     ver[i][j] = in.nextInt();    }   }   int[][] ans = new int[n][m];   if(k%2==1) {    for(int i=0; i<n; i++)     Arrays.fill(ans[i], -1);   } else {    for(int dummy=0; dummy<k>>1; dummy++) {     int[][] newAns = new int[n][m];     for(int i=0; i<n; i++) {      Arrays.fill(newAns[i], Integer.MAX_VALUE);      for(int j=0; j<m; j++) {       if(isGood(i+1, j)) {        newAns[i][j] = Math.min(newAns[i][j], 2*ver[i][j] + ans[i+1][j]);       }       if(isGood(i, j+1)) {        newAns[i][j] = Math.min(newAns[i][j], 2*hor[i][j] + ans[i][j+1]);       }       if(isGood(i, j-1)) {        newAns[i][j] = Math.min(newAns[i][j], 2*hor[i][j-1] + ans[i][j-1]);       }       if(isGood(i-1, j)) {        newAns[i][j] = Math.min(newAns[i][j], 2*ver[i-1][j] + ans[i-1][j]);       }      }     }     ans = newAns;    }   }   for(int i=0; i<n; i++) {    for(int j=0; j<m; j++) {     out.print(ans[i][j] + " ");    }    out.println();   }  }  boolean isGood(int i, int j) {   return i>=0 && i<n && j>=0 && j<m;  }  private void shuffle(int[] a) {   int n = a.length;   Random random = new Random();   random.nextInt();   for (int i = 0; i < n; i++) {    int change = i + random.nextInt(n - i);    swap(a, i, change);   }  }  private static void swap(int[] a, int i, int change) {   int helper = a[i];   a[i] = a[change];   a[change] = helper;  }  public static void main(final String[] args) throws FileNotFoundException {   final Solution s = new Solution();   final Long t1 = System.currentTimeMillis();   s.solve();   System.err.println(System.currentTimeMillis() - t1 + " ms");   s.out.close();  }  public Solution() throws FileNotFoundException {  }  private static class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[1024];   private int curChar;   private int numChars;   Random r = new Random();   InputReader(final InputStream stream) {    this.stream = stream;   }   InputReader(final String fileName) {    InputStream stream = null;    try {     stream = new FileInputStream(fileName);    } catch (final FileNotFoundException e) {     e.printStackTrace();    }    this.stream = stream;   }   int[] nextArray(final int n) {    final int[] arr = new int[n];    for (int i = 0; i < n; i++)     arr[i] = nextInt();    return arr;   }   int[][] nextMatrix(final int n, final int m) {    final int[][] matrix = new int[n][m];    for (int i = 0; i < n; i++)     for (int j = 0; j < m; j++)      matrix[i][j] = nextInt();    return matrix;   }   String nextLine() {    int c = read();    while (isSpaceChar(c))     c = read();    final StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isEndOfLine(c));    return res.toString();   }   String nextString() {    int c = read();    while (isSpaceChar(c))     c = read();    final StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   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;   }   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;   }   double nextDouble() {    return Double.parseDouble(nextString());   }   private int read() {    if (numChars == -1)     throw new InputMismatchException();    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     } catch (final IOException e) {      throw new InputMismatchException();     }     if (numChars <= 0)      return -1;    }    return buf[curChar++];   }   private boolean isSpaceChar(final int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   private boolean isEndOfLine(final int c) {    return c == '\n' || c == '\r' || c == -1;   }  }  }
4	public class Main {  int n,m; int d[][]; Queue<int[]> q = new LinkedList<int[]>(); int cur[];  public void run() throws Exception{  Scanner in = new Scanner(new File("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  n = in.nextInt();  m = in.nextInt();  int k = in.nextInt();  d = new int[n][m];  for(int i=0;i<n;i++) Arrays.fill(d[i], Integer.MAX_VALUE/2);  for(int i=0;i<k;i++){  int x = in.nextInt()-1;  int y = in.nextInt()-1;  d[x][y] = 0;  q.add(new int[]{x,y});  }     while(q.size() > 0){  cur = q.poll();  int x = cur[0];  int y = cur[1];  add(x, y+1);  add(x+1, y);  add(x-1, y);  add(x, y-1);  }  int max = 0;  int x = 0;  int y = 0;  for(int i=0;i<n;i++)  for(int j=0;j<m;j++)   if (max < d[i][j]){   max = d[i][j];   x = i;   y = j;   }  out.println((x+1) + " " + (y+1));  out.close(); }  private void add(int x, int y){  if (x < 0 || y < 0) return;  if (x >=n || y >=m) return;  if (d[x][y] > d[cur[0]][cur[1]] + 1){  d[x][y] = d[cur[0]][cur[1]] + 1;  q.add(new int[]{x,y});  } }  public static void main(String[] args) throws Exception{  new Main().run(); } }
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();  } }
6	public class TaskE {  static int[][] transpose(int[][] a, int n, int m) {   int[][] t = new int[m][n];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     t[j][i] = a[i][j];    }   }   return t;  }  public static void main(String[] args) {   FastReader in = new FastReader(System.in);   PrintWriter out = new PrintWriter(System.out);    int t = in.nextInt();   while (t-- > 0) {    int n = in.nextInt();    int m = in.nextInt();    int[][] a = new int[n + 1][m];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      a[i][j] = in.nextInt();      a[n][j] = Math.max(a[n][j], a[i][j]);     }    }    a = transpose(a, n, m);    Arrays.sort(a, new Comparator<int[]>() {     @Override     public int compare(int[] o1, int[] o2) {      int max1 = 0;      for (int i = 0; i < o1.length; i++) {       max1 = Math.max(max1, o1[i]);      }      int max2 = 0;      for (int i = 0; i < o2.length; i++) {       max2 = Math.max(max2, o2[i]);      }      return max2 - max1;     }    });    a = transpose(a, m, n);    int[] dp = new int[1 << n];    for (int i = 0; i < Math.min(n, m); i++) {     int[] best = new int[1 << n];     for (int j = 1; j < (1 << n); j++) {      for (int k = 0; k < n; k++) {       int sum = 0;       for (int l = 0; l < n; l++) {        if ((j & (1 << l)) != 0)         sum += a[(l + k) % n][i];       }       best[j] = Math.max(best[j], sum);      }     }     int[] dp1 = dp.clone();     for (int j = 0; j < (1 << n); j++) {      for (int k = j; k > 0; k = (k - 1) & j) {       dp[j] = Math.max(dp[j], dp1[k ^ j] + best[k]);      }     }    }    out.println(dp[(1 << n) - 1]);   }     out.close();  }  static class FastReader {   BufferedReader br;   StringTokenizer st;   FastReader(InputStream is) {    br = new BufferedReader(new InputStreamReader(is));   }   Integer 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 s = "";    try {     s = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return s;   }  } }
0	public class Main {  StreamTokenizer in; int n, k;  public void run() {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  read();  print(solve()); }  void read() {  n = nextInt();  }  int solve() {  int result = n;  if (result < 0) {  int res1 = n / 10;  int mod = n % 10;    int res2 = res1 / 10 * 10 + mod;  if (res1 > res2)   result = res1;  else   result = res2;  }   return result; }  void print(int result) {  System.out.println(result); }   public static void main(String[] Args) {  new Main().run(); }  public int nextInt() {  try {  in.nextToken();  }  catch (Exception e) {}  return (int)in.nval; }  public String nextString() {  try {  in.nextToken();  }  catch (Exception e) {}  return in.sval; } }
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 {  static final long MODULO = (int) (1e9 + 7);  public void solve(int testNumber, Scanner in, PrintWriter out) {  long x = in.nextLong();  long k = in.nextLong();   if (x == 0) {   out.println(0);  } else {   long e = modPow(2, k, MODULO);   long y = 2 * x - 1;   long w = ((e % MODULO) * (y % MODULO)) % MODULO;   long z = (w + 1) % MODULO;   out.println(z);  }  }  private long modPow(long a, long b, long m) {  if (b == 0) return 1 % m;  if (b == 1) return a % m;  long res = modPow(a, b / 2, m);  res = (res * res) % m;  if (b % 2 == 1) res = (res * a) % m;  return res;  } } }
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; } }
5	public class C implements Runnable {  private void Solution() throws IOException {  int n = nextInt(), max = 0, maxi = 0;  ArrayList<Integer> mas = new ArrayList<Integer>();  for (int i = 0; i < n; i++) {  int num = nextInt();  if (num > max) {   max = num;   maxi = i;  }  mas.add(num);  }  mas.remove(maxi);  mas.add(max == 1 ? 2 : 1);  Collections.shuffle(mas);  Collections.sort(mas);  for (int i = 0; i < n; i++)  System.out.print(mas.get(i) + " "); }  public static void main(String[] args) {  new C().run(); }  BufferedReader in; StringTokenizer tokenizer;  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  tokenizer = null;  Solution();  in.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens())  tokenizer = new StringTokenizer(in.readLine());  return tokenizer.nextToken(); } }
2	public class Div2_489C {  static final long MOD = 1_000_000_007;  public static void main(String[] args) throws IOException {  BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  PrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  StringTokenizer inputData = new StringTokenizer(reader.readLine());  long st = Long.parseLong(inputData.nextToken());  if(st == 0) {  printer.println(0);  printer.close();  return;  }  st %= MOD;  long years = Long.parseLong(inputData.nextToken());  long[][] res = exp(years);  long ans = (res[0][0] * st % MOD * 2 % MOD + res[0][1] * (-1 + MOD) % MOD) % MOD;  printer.println(ans);  printer.close(); }  static long[][] exp(long pow) {  long[][] cBase = base;  long[][] res = { { 1, 0 }, { 0, 1 } };  while (pow != 0) {  if ((pow & 1) != 0) {   res = mult(res, cBase);  }  cBase = mult(cBase, cBase);  pow >>= 1;  }  return res; }  static long[][] base = { { 2, 1 }, { 0, 1 } };  static long[][] mult(long[][] a, long[][] b) {  long[][] res = new long[2][2];  for (int i = 0; i < 2; i++) {  for (int j = 0; j < 2; j++) {   res[i][j] = (a[i][0] * b[0][j] % MOD + a[i][1] * b[1][j] % MOD) % MOD;  }  }  return res; } }
0	public class j { public static void main(String aa[])throws IOException { BufferedReader b=new BufferedReader(new InputStreamReader(System.in)); int i=0,m=0,p=0,n=0,k=0,j=0; String s,r; s=b.readLine(); r=s; n=Integer.parseInt(s); s=s.substring(0,s.length()-2); s+=r.charAt(r.length()-1); r=r.substring(0,r.length()-1); m=Integer.parseInt(s); p=Integer.parseInt(r); System.out.print((long)Math.max(Math.max(m,n),p)); } }
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 + " ");  } } }
4	public class Main {  public static void main(String[] args) {   InputStream inputStream;   try {    inputStream = new FileInputStream("input.txt");   } catch (IOException e) {    throw new RuntimeException(e);   }   OutputStream outputStream;   try {    outputStream = new FileOutputStream("output.txt");   } catch (IOException e) {    throw new RuntimeException(e);   }   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) {    int N = in.nextInt();    int M = in.nextInt();    int[][] dist = new int[N][M];    for (int[] ini : dist) Arrays.fill(ini, (1 << 30));     int K = in.nextInt();    Queue<Integer> q = new LinkedList<Integer>();    for (int k = 0; k < K; ++k) {     int r = in.nextInt() - 1;     int c = in.nextInt() - 1;     dist[r][c] = 0;     q.offer(r);     q.offer(c);    }    int[] dx = new int[]{1, -1, 0, 0};    int[] dy = new int[]{0, 0, 1, -1};    while (!q.isEmpty()) {     int rr = q.poll();     int cc = q.poll();     for (int a = 0; a < 4; ++a) {      int x = dx[a] + rr;      int y = dy[a] + cc;      if (x >= 0 && x < N && y >= 0 && y < M) {       if (dist[x][y] > dist[rr][cc] + 1) {        dist[x][y] = dist[rr][cc] + 1;        q.offer(x);        q.offer(y);       }      }     }    }    int max = 0;    for (int i = 0; i < N; ++i)     for (int j = 0; j < M; ++j)      max = Math.max(max, dist[i][j]);    for (int i = 0; i < N; ++i) {     for (int j = 0; j < M; ++j) {      if (max == dist[i][j]) {       out.println((i + 1) + " " + (j + 1));       return;      }     }    }   }  }  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 {  private static boolean marked[][] ;     public static void main(String[] args) throws Exception {              File file = new File("input.txt") ;    Scanner s = new Scanner(file) ;      int n = s.nextInt();   int m = s.nextInt();      marked = new boolean [n + 1 ][m + 1] ;      int k = s.nextInt();     Queue<Point> queue = new LinkedList<Point>();        for(int i =0 ; i < k ; ++i){    int tempX = s.nextInt() ;    int tempY = s.nextInt() ;    marked[tempX][tempY] = true ;    queue.add(new Point(tempX , tempY));      }      Point c = null ;      while(!queue.isEmpty()){    c = queue.poll() ;        if(c.x>1 && !marked[c.x-1][c.y]){     marked[c.x -1 ][c.y] = true ;     queue.add(new Point(c.x-1,c.y));    }       if(c.y>1 && !marked[c.x][c.y-1]){     marked[c.x][c.y-1] = true ;     queue.add(new Point(c.x,c.y-1));    }       if(c.x < n && !marked[c.x+1][c.y]){     marked[c.x + 1 ][c.y] = true ;     queue.add(new Point(c.x + 1,c.y));    }       if(c.y < m && !marked[c.x][c.y+1]){     marked[c.x][c.y+1] = true ;     queue.add(new Point(c.x,c.y+1));    }   }   PrintWriter out = new PrintWriter(new File("output.txt"));   out.println(c.x+" "+c.y);   out.close();  }   static class Point {   int x ;   int y ;   public Point(int x ,int y ){    this.x = x ;    this.y = y ;   }  } }              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());  } }
3	public class Main {  public static void main(String[] args) {  Scanner s=new Scanner(System.in);   int n=s.nextInt();   long[] arr=new long[n];   for(int i=0;i<n;i++)  {  arr[i]=s.nextInt();  }   long[] pre=new long[n];   pre[0]=arr[0];   for(int i=1;i<n;i++)  {  pre[i]=pre[i-1]+arr[i];  }   HashMap<Long,ArrayList<pair>> map=new HashMap<>();   for(int i=0;i<n;i++)  {  for(int j=i;j<n;j++)  {   long key=pre[j]-pre[i]+arr[i];     if(map.containsKey(key))   {   pair p=new pair(i+1,j+1);   ArrayList<pair> temp=map.get(key);   temp.add(p);      map.put(key,temp);   }   else   {   ArrayList<pair> list=new ArrayList<>();   pair p=new pair(i+1,j+1);   list.add(p);      map.put(key,list);   }  }  }   for(Map.Entry<Long,ArrayList<pair>> entry:map.entrySet())  {  ArrayList<pair> curr=entry.getValue();    Collections.sort(curr,new comp());  }   long ans=0;  long max=-1000000000000l;   for(Map.Entry<Long,ArrayList<pair>> entry:map.entrySet())  {  ArrayList<pair> curr=entry.getValue();    int count=1;  int l=curr.get(0).l;  int r=curr.get(0).r;    for(int i=1;i<curr.size();i++)  {   if(curr.get(i).l>r)   {   count++;   l=curr.get(i).l;   r=curr.get(i).r;   }  }    if(count>max)  {   max=count;   ans=entry.getKey();  }    }   System.out.println(max);   ArrayList<pair> list=map.get(ans);   System.out.println(list.get(0).l+" "+list.get(0).r);   int l=list.get(0).l;  int r=list.get(0).r;   for(int i=1;i<list.size();i++)  {  if(list.get(i).l>r)  {   System.out.println(list.get(i).l+" "+list.get(i).r);   l=list.get(i).l;   r=list.get(i).r;  }  }   }  } class pair { int l; int r;  public pair(int l,int r) {  this.l=l;  this.r=r; } } class comp implements Comparator<pair> { public int compare(pair a,pair b) {  if(a.r<b.r)  return -1;  else if(a.r==b.r)  {  return b.l-a.l;  }  else  return 1; } }
1	public class algo121 {  public static void main(String args[])  {   Scanner ex=new Scanner(System.in);   int n=ex.nextInt();   String a[]=new String[n];   String b[]=new String[n];   for(int i=0;i<n;i++)   a[i]=ex.next();   for(int i=0;i<n;i++)   b[i]=ex.next();   String valid[]={"S","M","L","XS","XL","XXS","XXL","XXXS","XXXL"};   int ai[]=new int[9];   int bi[]=new int[9];   for(int i=0;i<n;i++)   {    for(int j=0;j<9;j++)    {     if(a[i].equals(valid[j]))     ai[j]++;     if(b[i].equals(valid[j]))     bi[j]++;    }   }   int ans=0;   for(int i=0;i<9;i++)   {    if(ai[i]>bi[i])    ans=ans+ai[i]-bi[i];   }   System.out.println(ans);  } }
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+")";  }  }  }
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;  } }
3	public class Main {  private static void solve() {  int n = ni();  String[] lines = new String[n];  for(int i = 0; i < n; i ++) {  lines[i] = next();  }  int mod = 1000000000 + 7;   long[][] dp = new long[2][n + 1];  dp[0][0] = 1;  for (int i = 0; i < n; i ++) {  int from = i % 2;  int to = (i + 1) % 2;  boolean flg = i == 0 || lines[i - 1].equals("s");  if (flg) {   long v = Arrays.stream(dp[from]).sum();   for (int j = 0; j <= n; j ++) {   dp[to][j] += v;   dp[to][j] %= mod;   v -= dp[from][j];   }  } else {   for (int j = 0; j < n; j ++) {   dp[to][j + 1] += dp[from][j];   dp[to][j + 1] %= mod;   }  }  Arrays.fill(dp[from], 0);  }  long ret = Arrays.stream(dp[n % 2]).sum() % mod;  System.out.println(ret); }   public static void main(String[] args) {  new Thread(null, new Runnable() {  @Override  public void run() {   long start = System.currentTimeMillis();   String debug = args.length > 0 ? args[0] : null;   if (debug != null) {   try {    is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));   } catch (Exception e) {    throw new RuntimeException(e);   }   }   reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);   solve();   out.flush();   tr((System.currentTimeMillis() - start) + "ms");  }  }, "", 64000000).start(); }  private static java.io.InputStream is = System.in; private static java.io.PrintWriter out = new java.io.PrintWriter(System.out); private static java.util.StringTokenizer tokenizer = null; private static java.io.BufferedReader reader;  public static String next() {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  try {   tokenizer = new java.util.StringTokenizer(reader.readLine());  } catch (Exception e) {   throw new RuntimeException(e);  }  }  return tokenizer.nextToken(); }  private static double nd() {  return Double.parseDouble(next()); }  private static long nl() {  return Long.parseLong(next()); }  private static int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = ni();  return a; }  private static char[] ns() {  return next().toCharArray(); }  private static long[] nal(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)  a[i] = nl();  return a; }  private static int[][] ntable(int n, int m) {  int[][] table = new int[n][m];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   table[i][j] = ni();  }  }  return table; }  private static int[][] nlist(int n, int m) {  int[][] table = new int[m][n];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   table[j][i] = ni();  }  }  return table; }  private static int ni() {  return Integer.parseInt(next()); }  private static void tr(Object... o) {  if (is != System.in)  System.out.println(java.util.Arrays.deepToString(o)); } }
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();  } }
2	public class solution 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);   }  } static int mod = (int)1e9+7; public static long fastexpo(long pow) {  long expo = 2;  long ans = 1;  while(pow!=0)  {  if((pow&1)==1)  {   ans = (ans*expo)%mod;  }  expo = (expo*expo)%mod;  pow = pow>>1;  }  return ans; } public static void main(String args[]) throws Exception {   new Thread(null, new solution(),"Main",1<<26).start();  } public void run() {   InputReader sc = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out);  long x = sc.nextLong();  if(x==0)  {  out.println(0);  out.close();  return;  }  long k = sc.nextLong();  long a = ((fastexpo(k+1)%mod)*(x%mod))%mod;  long b = (-1*fastexpo(k)%mod+mod)%mod;  long ans = (a+b+1)%mod;  out.println(ans);  out.close();  } }
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 code839E {  public static void main(String[] args) throws Exception{   BufferedReader bff=new BufferedReader(new InputStreamReader(System.in));   PrintWriter wff=new PrintWriter(System.out);   String[] st=bff.readLine().split(" ");   int V=Integer.parseInt(st[0]);   int K=Integer.parseInt(st[1]);   BronKerbosch bk=new BronKerbosch(V);   for(int i=0;i<V;i++){    st=bff.readLine().split(" ");    for(int j=0;j<V;j++){     if(st[j].equals("1")){      bk.anadir(i,j);     }    }   }   long num=bk.numeroCamarilla();   wff.printf("%.12f\n", num * (num - 1.0) / 2 * K / num * K / num);   wff.flush();  }     static class BronKerbosch {  int V;  long[] neig;  Random random = new Random();  long maxClique;  public BronKerbosch(int v){   V=v;   neig=new long[V];  }  public void anadir(int a,int b){   long aux=1;   neig[a] |= aux << (long)b;  }   public long numeroCamarilla(){   long numero = Long.bitCount(bronKerbosch());   return numero;  }   public long bronKerbosch() {   maxClique = 0;   bronKerbosch2(0, (1L << V) - 1, 0);   return maxClique;  }  public void bronKerbosch2(long r, long p, long x) {   if (Long.bitCount(maxClique) >= Long.bitCount(r | p | x)) return;   long px = p | x;   if (px == 0) {    if (Long.bitCount(maxClique) < Long.bitCount(r)) {     maxClique = r;    }    return;   }   int cnt = Long.bitCount(px);   int choice = random.nextInt(cnt);   int u;   for (int i = 0; ; i++) {    if ((px >>> i & 1) != 0 && choice-- == 0) {     u = i;     break;    }   }   long ne = p & ~neig[u];   for (int v = 0; v < V; v++){    if ((ne >>> v & 1) != 0) {     bronKerbosch2(r | 1L << v, p & neig[v], x & neig[v]);     p &= ~(1L << v);     x |= 1L << v;    }   }  } }   }
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();  }  } }
3	public class algo_2701 {  public static void main(String args[])  {   Scanner ex=new Scanner(System.in);   int n=ex.nextInt();   int arr[]=new int[n];   for(int i=0;i<n;i++)   arr[i]=ex.nextInt();   Arrays.sort(arr);   int ans=0;   int check[]=new int[n];   for(int i=0;i<n;i++)   {    if(check[i]==0)    {     ans++;     for(int j=i;j<n;j++)     {      if(arr[j]%arr[i]==0)      check[j]=1;     }    }   }   System.out.println(ans);  } }
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();  } }
0	public class Main {  StreamTokenizer in;  BufferedReader inb;  PrintWriter out;  public static void main(String[] args) throws Exception {   new Main().run();  }  public void run() throws Exception {   in = new StreamTokenizer(new BufferedReader(new InputStreamReader(     System.in)));   inb = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(new OutputStreamWriter(System.out));   solve();   out.flush();  }  public int nextInt() throws Exception {   in.nextToken();   return (int) in.nval;  }  public int parseInt() throws Exception {   return Integer.parseInt(inb.readLine());  }  public String nextLine() throws Exception {   return inb.readLine();  }    public void solve() throws Exception {   int n = nextInt();   if ((n%4==0)||(n%44==0)||(n%47==0)||(n%74==0)     ||(n%744==0)||(n%747==0)||(n%774==0)||(n%777==0)     ||(n%7==0)||(n%444==0)||(n%447==0)||(n%474==0)||(n%477==0)||(n%77==0))   {    out.print("YES");   }   else   {    out.print("NO");   }  } }
0	public class Main {   public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  while (n-- > 0) {  int a = in.nextInt();  int b = in.nextInt();  int k = 0;  while (a != 0 && b != 0) {   if (a > b) {   int t = a / b;   k += t;   a = a - b * t;   } else {   int t = b / a;   k += t;   b = b - a * t;   }  }  System.out.println(k);  }  } }
4	public class substring { static BufferedReader br; static StringTokenizer st; static PrintWriter out; public static void main(String[] args) throws IOException {  InputStream input = System.in;   OutputStream output = System.out;   br = new BufferedReader(new InputStreamReader(input));  out = new PrintWriter(output);  String in = br.readLine();  int len = in.length();  int doub = len;  boolean found = false;  while (!found)   {   int count = 0;   String[] parts = new String[len - doub + 1];   for (int i = 0; i < len - doub + 1; i++)    parts[i] = in.substring(i,i+doub);   for (int i = 1; i < len - doub + 1; i++)    for (int j = 0; j < i; j++)     if (parts[i].equals(parts[j]))     count++;   if (count >= 1)    found = true;   doub--;   }  out.println(doub+1);  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");  } }
6	public class G_PlaylistForPolycarp {  static final int mod = 1000000007;  static int dp[][];  public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));  String[] dat = br.readLine().split(" ");  int n = Integer.parseInt(dat[0]);  int T = Integer.parseInt(dat[1]);  int[] st = new int[n];  byte[] sg = new byte[n];  dp = new int[1 << (n + 1)][4];  for (int j = 0; j < 1 << (n + 1); j++) {  for (int k = 0; k < 4; k++) {   dp[j][k] = -1;  }  }  for (int i = 0; i < n; i++) {  dat = br.readLine().split(" ");  st[i] = Integer.parseInt(dat[0]);  sg[i] = Byte.parseByte(dat[1]);  }  short visited = 0;  int count = recur(0, visited, st, sg, T, 0);  bw.write(count + "\n");  bw.close();  }  private static int recur(int time, short visited, int[] st, byte[] sg, int T, int last) {  int count = 0;  if (dp[visited][last] != -1) {  return dp[visited][last];  }  for (int i = 0; i < st.length; i++) {   if ((visited & (1 << i)) == 0 && sg[i] != last) {   if (time + st[i] == T) {   count += 1;   } else if (time + st[i] < T) {   short visitedc = (short) (visited | (1 << i));   count += recur(time + st[i], visitedc, st, sg, T, sg[i]);   if (count > mod) {    count = count % mod;   }   }   }  }  return dp[visited][last] = count % mod; } }
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;  }     } } } }
5	public class A15 {  final double eps = 10e-9;  class Pair implements Comparable<Pair>{  int x;  int length;   Pair(int x, int length) {  this.x = x;  this.length = length;  }  public int compareTo(Pair p) {  return x - p.x;  } }  private void Solution() throws IOException {  int n = nextInt(), t = nextInt(), ans = 2;  Pair[] pairs = new Pair[n];  for (int i = 0; i < n; i ++) {  int x = nextInt(), length = nextInt();  pairs[i] = new Pair(x, length);  }  Arrays.sort(pairs);  for (int i = 0; i < n-1; i ++) {  double place = pairs[i+1].x - pairs[i].x - (double) pairs[i+1].length/2 - (double) pairs[i].length/2;  if (place > t)   ans += 2; else   if ((int) (place+eps) == t)    ans ++;  }  System.out.println(ans); }  public static void main(String[] args) {  new A15().run(); }  BufferedReader in; StringTokenizer tokenizer;  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  tokenizer = null;  Solution();  in.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens())  tokenizer = new StringTokenizer(in.readLine());  return tokenizer.nextToken(); } }
0	public class Ideone { static long ans=0; public static void Stepgcd(long a,long b) {  if (b!=0) {ans+=(a/b);Stepgcd(b,a%b);}  } public static void main (String[] args) throws java.lang.Exception {  Scanner in=new Scanner(System.in);  long a=in.nextLong(),b=in.nextLong();  Stepgcd(a,b);  System.out.println(ans); } }
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(); } }
0	public class A_122 { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(bf.readLine());  System.out.println((n%4==0||n%7==0||n%47==0||n%74==0||n%447==0||n%474==0||n%477==0||n%744==0||n%747==0||n%774==0)?"YES":"NO"); } }
6	public class MotherOfDragons {  public static void main(String[] args) {   FastScanner scanner = new FastScanner();   PrintWriter out = new PrintWriter(System.out, false);   int n = scanner.nextInt();   double k = scanner.nextInt();   long[] graph = new long[n];   for(int i = 0; i < n; i++) {    for(int j =0; j < n; j++) {     int val = scanner.nextInt();     if (val == 1 || i == j) graph[i] |= 1L << j;    }   }     int szLeft = n/2;   int szRight = n - szLeft;     int[] dp = new int[1 << szLeft];   int maxMask = 1 << szLeft;     for(int mask = 1; mask <maxMask; mask++) {    int curMask = mask;       for(int j = 0; j < szLeft; j++) {     if (((1 << j) & mask) > 0) {           curMask &= graph[j + szRight] >> szRight;                 dp[mask] = Math.max(dp[mask], dp[mask ^ (1 << j)]);     }    }       if (mask == curMask) {     dp[mask] = Math.max(dp[mask],Integer.bitCount(mask));    }   }   int ans = 0;   int rmaxMask = 1 << szRight;   for(int mask = 0; mask < rmaxMask; mask++) {       int curMask = mask;       int oMask = maxMask -1;    for(int j = 0; j < szRight; j++) {     if (((1 << j) & mask) > 0) {           curMask &= (graph[j] & (rmaxMask-1));           oMask &= graph[j] >> szRight;     }    }       if (curMask != mask) continue;       ans = Math.max(ans, Integer.bitCount(mask) + dp[oMask]);   }   k/=ans;   out.println(k * k * (ans * (ans-1))/2);   out.flush();  }   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;   }  } }
5	public class CottageVillage {  public static void main(String[] args){  Scanner scan = new Scanner(System.in);  while(scan.hasNext()){  int counter = 0;  int numbCottages = scan.nextInt();  int t = scan.nextInt();  House[] cottages = new House[numbCottages];  for(int i =0; i<numbCottages; i++){   int centre = scan.nextInt();   int length = scan.nextInt();   double beginning = centre - ((double)length)/2;   double end = centre + ((double)length)/2;   cottages[i]= new House(beginning, end);     }    Arrays.sort(cottages);            for(int i =0; i<numbCottages-1; i++){     if(cottages[i].end + t <= cottages[i+1].beginning){   counter++;   }     if (cottages[i+1].beginning - t >= cottages[i].end){   counter++;   }     if (Math.abs((cottages[i].end + t - cottages[i+1].beginning)) < 1e-8){   counter--;         }      }    System.out.println(counter+2);    } }  static class House implements Comparable<House>{  double beginning;  double end;  House(double _beginning, double _end){  beginning = _beginning;  end = _end;  }  @Override  public int compareTo(House house) {       return Double.valueOf(beginning).compareTo(house.beginning);  }    } }
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 {  class Team implements Comparable<Team> {   int solved = 0;   int penalty = 0;   Team(int solved, int penalty) {    this.solved = solved;    this.penalty = penalty;   }   public int compareTo(Team o) {    return this.solved == o.solved ? this.penalty - o.penalty : -(this.solved - o.solved);   }   public boolean equals(Object obj) {    if (obj instanceof Team) {     Team o = (Team) obj;     return ((this.solved == o.solved) && (this.penalty == o.penalty));    }    return false;   }  }  public void solve(int testNumber, InputReader in, OutputWriter out) {   int n = in.nextInt();   int k = in.nextInt();   Team[] teams = new Team[n];   for (int i = 0; i < n; i++)    teams[i] = new Team(in.nextInt(), in.nextInt());   Arrays.sort(teams);   int[] top = new int[n];   int[] map = new int[n];   int cur = -1;   for (int i = 0; i < n; i++) {    if (i == 0 || !teams[i].equals(teams[i - 1])) cur = i;    top[cur]++;    map[i] = cur;   }   out.println(top[map[k - 1]]);  } } 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());  }   } class OutputWriter {  private final PrintWriter writer;  public OutputWriter(OutputStream outputStream) {   writer = new PrintWriter(outputStream);  }  public OutputWriter(Writer writer) {   this.writer = new PrintWriter(writer);  }  public void print(Object... objects) {   for (int i = 0; i < objects.length; i++) {    writer.print(objects[i]);   }  }  public void println(Object... objects) {   print(objects);   writer.println();  }  public void close() {   writer.close();  } }
5	public class Flatville {  public static void main( String args[] )  {   class SquareHouse implements Comparable<SquareHouse>   {    public SquareHouse( double posLeft, double sideLen )    {     _posLeft = posLeft;     _sideLen = sideLen;    }    public double posLeft()    { return _posLeft; }    public double posRight()    { return _posLeft + _sideLen; }    public int compareTo( SquareHouse house )    {     double dist = _posLeft - house.posLeft();     if ( dist < 0 )      return -1;     else if ( dist > 0 )      return 1;     else return 0;    }    private double _posLeft;    private double _sideLen;   }   Scanner scanner = new Scanner( System.in );      final int nHouses = scanner.nextInt();   final double sideLen = scanner.nextDouble();   ArrayList<SquareHouse> houses = new ArrayList<SquareHouse>();      for ( int iHouse = 0; iHouse < nHouses; ++iHouse )   {    double pos = scanner.nextDouble();    double size = scanner.nextDouble();    double posLeft = pos - size / 2.0;    houses.add( new SquareHouse( posLeft, size ) );   }      Collections.sort( houses );   int nPositions = 2;   for ( int iHouse = 0; iHouse < nHouses - 1; ++iHouse )   {    double space = houses.get( iHouse + 1 ).posLeft() - houses.get( iHouse ).posRight();    if ( sideLen < space )     nPositions += 2;    else if ( sideLen == space )     nPositions++;   }   out.println( nPositions );  } }
4	public class CodeForces {  public void solve() throws IOException {   String s = nextToken();     Set<String> set = new HashSet<String>();   int counter = 0;   for (int i = 0, l = s.length(); i < l; i++) {    for (int j = i + 1; j < l; j++) {     String subst = s.substring(i, j);     if (!set.contains(subst)) {      set.add(subst);      if (counts(s.toCharArray(), subst.toCharArray()) > 1) {       counter = Math.max(counter, subst.length());      }     }    }   }    writer.print(counter);  }  private int counts(char[] s, char[] r) {   int l = s.length;   int rl = r.length;   int arr[] = new int[26];   Arrays.fill(arr, rl);   for (int i = rl - 2; i > -1; i--) {    int margin = (r[i] - 'a');    if (arr[margin] == rl) {     arr[margin] = rl - i - 1;    }   }     int sp = 0;   int counter = 0;   while (sp <= l - rl) {    int oldsp = sp;    for (int i = rl - 1; i > -1; i--) {     if (r[i] != s[sp + i]) {      if (i == rl - 1) {       sp += arr[s[sp + i] - 'a'];      } else {       sp++;      }      break;     }    }    if (oldsp == sp) {     counter++;     sp++;    }   }   return counter;  }   public static void main(String[] args) {   new CodeForces().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 {  static Scanner scanner = new Scanner(System.in); static int s;  public static void main(String[] args) {  s = scanner.nextInt();  if (s >= 0) {  System.out.println(s);  }  else {  if (s >= -10) {   System.out.println(0);  }  else {   int ss = -s;   int a, b;   a = ss % 10;   b = (ss % 100) / 10;   if (a > b) {   ss = ss / 10;   }   else {   ss = (ss / 100) * 10 + a;   }   if (ss == 0) {   System.out.println(0);   }   else {   System.out.println("-" + ss);   }  }  } } }
0	public class Main { public static void main(String[] args) {  Scanner in=new Scanner(new BufferedInputStream(System.in));  PrintStream out=System.out;  int n=in.nextInt();  if (n>=0) out.println(n);  else out.println(Math.max(-((-n)/10), -((-n)/100*10+(-n)%10)));  out.close();  in.close(); } }
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);  }  } }
4	public class Solution35C {     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 FileReader("input.txt"));      out = new PrintWriter("output.txt");     }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 Solution35C().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);     }   }     static class Utils {      private Utils() {}      public static void mergeSort(int[] a) {       mergeSort(a, 0, a.length - 1);     }      private static void mergeSort(int[] a, int leftIndex, int rightIndex) {       final int MAGIC_VALUE = 50;       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 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;       }     }   }     void solve() throws IOException{   int n = readInt();   int m = readInt();   int k = readInt();   Point[] focuses = new Point[k];   for(int i = 0; i < k; i++){    int a = readInt() - 1;    int b = readInt() - 1;    focuses[i] = new Point(a,b);   }   int maxI = 0, maxJ = 0;   int max = 0;   for(int i = 0; i < n; i++)    for(int j = 0; j < m; j++){    int curMin = 1000000;    for(int r = 0; r < k; r++)     if(abs(focuses[r].x - i) + abs(focuses[r].y - j) < curMin){     curMin = abs(focuses[r].x - i) + abs(focuses[r].y - j);     if(curMin < max) break;     }    if(curMin > max){    max = curMin;    maxI = i;    maxJ = j;    }         }   maxI++;   maxJ++;   out.println(maxI + " " + maxJ);   }     static double distance(long x1, long y1, long x2, long y2){   return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));   }     static long gcd(long a, long b){   while(a != b){    if(a < b) a -=b;    else b -= a;   }   return a;   }     static long lcm(long a, long b){   return a * b /gcd(a, b);   } }
3	public class Main { public static class node implements Comparable<node> {  int l,r;  node(){}  node(int l,int r) {  this.l=l;  this.r=r;  }  @Override  public int compareTo(node rhs) {  return r-rhs.r;  } } public static void main(String[] args) throws IOException {  BufferedReader in=new BufferedReader(new InputStreamReader(System.in));  PrintWriter out=new PrintWriter(System.out);  StringTokenizer sa=new StringTokenizer(in.readLine());  int n=Integer.parseInt(sa.nextToken());  sa=new StringTokenizer(in.readLine());  int[] a=new int[n];  TreeMap<Integer,ArrayList<node>> mp=new TreeMap();  for (int i=0;i<n;++i) a[i]=Integer.parseInt(sa.nextToken());  ArrayList<node> ans=new ArrayList<node>();  for (int i=0;i<n;++i) {  int tmp=0;  for (int j=i;j<n;++j) {   tmp+=a[j];   if (!mp.containsKey(tmp)) {   ArrayList<node> t=new ArrayList();   t.add(new node(i,j));   mp.put(tmp,t);   } else {   ArrayList<node> t=mp.get(tmp);   int left=0,right=t.size()-1,res=t.size();   while (left<=right) {    int mid=(left+right)>>1;    if (t.get(mid).r>=i) {    res=mid;    right=mid-1;    } else left=mid+1;   }   if (res==t.size()) t.add(new node(i,j));   else if (t.get(res).r>j) t.set(res,new node(i,j));   }   if (mp.get(tmp).size()>ans.size()) ans=mp.get(tmp);  }  }  out.println(ans.size());  for (int i=0;i<ans.size();++i)  out.printf("%d %d\n",ans.get(i).l+1,ans.get(i).r+1);  out.flush(); } }
3	public class Test {  static class Pair {   int f,s;   public Pair(int x, int y) {f = x; s = y;}  }  public static void main(String[] args) throws Exception{   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(br.readLine());   String[] s = br.readLine().split(" ");   int[] arr = new int[n];   for(int i = 0; i<n; i++) arr[i] = Integer.parseInt(s[i]);   HashMap<Integer, ArrayList<Pair>> map = new HashMap<>();   for(int i = 0; i<n; i++) {    int sum = 0;    for(int j = i; j>=0; j--) {     sum += arr[j];     ArrayList<Pair> list = map.get(sum);     if(list == null) {      list = new ArrayList<>();      map.put(sum, list);     }     list.add(new Pair(j, i));    }   }   Iterator it = map.entrySet().iterator();   ArrayList<Pair> ans = new ArrayList<>();   for(;it.hasNext();){    Map.Entry<Integer, ArrayList<Pair>> entry = (Map.Entry<Integer, ArrayList<Pair>>)it.next();    ArrayList<Pair> list = entry.getValue();    ArrayList<Pair> pre = new ArrayList<>();    int r = -1;    for(Pair p : list) {     if(p.f > r) {      pre.add(p);      r = p.s;     }    }    if(ans.size()<pre.size()) ans = pre;   }   StringBuilder sb = new StringBuilder();   sb.append(ans.size()).append('\n');   for(Pair p : ans) {    sb.append(p.f+1).append(' ').append(p.s+1).append('\n');   }   System.out.print(sb);  } }
4	public class D {  public static void main(String[] args) {  FastScanner fs=new FastScanner();  int h=fs.nextInt(), w=fs.nextInt(), k=fs.nextInt();  PrintWriter out=new PrintWriter(System.out);  if (k%2==1) {  for (int y=0; y<h; y++) {   for (int x=0; x<w; x++) {   if (x!=0) out.print(" ");   out.print(-1);   }   out.println();  }  out.close();  return;  }  k/=2;   int[][] rightCost=new int[w-1][h];  int[][] downCost=new int[w][h-1];  for (int y=0; y<h; y++)   for (int x=0; x<w-1; x++)   rightCost[x][y]=fs.nextInt();  for (int y=0; y<h-1; y++)  for (int x=0; x<w; x++)   downCost[x][y]=fs.nextInt();   long[][] dp=new long[w][h];  long[][] dpNext=new long[w][h];  for (int i=0; i<k; i++) {  for (int x=0; x<w; x++) {   for (int y=0; y<h; y++) {   long ans=(long)1e18;   if (x!=0) ans=Math.min(ans, dp[x-1][y]+rightCost[x-1][y]);   if (y!=0) ans=Math.min(ans, dp[x][y-1]+downCost[x][y-1]);   if (x!=w-1) ans=Math.min(ans, dp[x+1][y]+rightCost[x][y]);   if (y!=h-1) ans=Math.min(ans, dp[x][y+1]+downCost[x][y]);   dpNext[x][y]=ans;   }  }  dp=dpNext;  dpNext=new long[w][h];  }   for (int y=0; y<h; y++) {  for (int x=0; x<w; x++) {   if (x!=0) out.print(" ");   out.print(2*dp[x][y]);  }  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());  } }  }
5	public class Solution {  static class Team implements Comparable<Team> {   int pr;   int time;   int id;   public Team(int P, int T, int I) {    pr = P;    time = T;    id = I;   }   @Override   public int compareTo(Team t) {    return pr != t.pr ? t.pr - pr : time != t.time ? time - t.time : id - t.id;   }  }  public static void main(String[] args) throws Exception {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(System.out);   StringTokenizer st = new StringTokenizer(in.readLine());   int n = Integer.parseInt(st.nextToken());   int k = Integer.parseInt(st.nextToken());   Team[] a = new Team[n];   int[] c = new int[n + 1];   for (int i = 0; i < n; i++) {    st = new StringTokenizer(in.readLine());    int p = Integer.parseInt(st.nextToken());    int t = Integer.parseInt(st.nextToken());    a[i] = new Team(p, t, i);   }   Arrays.sort(a);   int prev = 1;   c[1]++;   for (int i = 1; i < n; i++) {    if (a[i].pr == a[i - 1].pr && a[i].time == a[i - 1].time)     for (int j = i + 1; j >= prev; j--)      c[j] = i + 2 - prev;    else {     prev = i + 1;     c[prev] = 1;    }   }   out.println(c[k]);   out.close();  } }
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 Main {  static final long mod=(int)1e9+7;  public static void main(String[] args) throws Exception  {  FastReader in=new FastReader();  PrintWriter pw=new PrintWriter(System.out);  int n=in.nextInt();  int[] arr=new int[n+1];  for(int i=1;i<=n;i++)   arr[i]=in.nextInt();  Map<Integer,TreeMap<Integer,Integer>> map=new HashMap();  for(int i=1;i<=n;i++)  {   int sum=0;   for(int j=i;j<=n;j++)   {   sum+=arr[j];   if(map.containsKey(sum))   {    TreeMap<Integer,Integer> t=map.get(sum);       Map.Entry<Integer,Integer> e=t.lastEntry();    if(e.getKey()>j)    {    t.remove(e.getKey());    t.put(j,i);    map.put(sum,t);    }    else if(e.getKey()<i)    {    t.put(j,i);    map.put(sum,t);    }   }   else   {    TreeMap<Integer,Integer> t=new TreeMap();    t.put(j,i);    map.put(sum,t);   }   }  }  int ans=0,size=0;  for(Map.Entry<Integer,TreeMap<Integer,Integer>> e:map.entrySet())  {   if(e.getValue().size()>size)   {   ans=e.getKey();   size=e.getValue().size();   }  }  pw.println(size);  for(Map.Entry e:map.get(ans).entrySet())   pw.println(e.getValue()+" "+e.getKey());  pw.flush();  } } class pair { int f,s; } class FastReader {  BufferedReader br;  StringTokenizer st;   public FastReader()  {   br=new BufferedReader(new InputStreamReader(System.in));  }   public String next() throws IOException  {   if(st==null || !st.hasMoreElements())   {    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());  } }
0	public class KingEscape {  public static void main(String[] args) {   Reader read = new Reader();   int n = read.nextInt();   int a1 = read.nextInt();   int a2 = read.nextInt();   int b1 = read.nextInt();   int b2 = read.nextInt();   int c1 = read.nextInt();   int c2 = read.nextInt();   if (b1 > a1 && b2 > a2 && c1 > a1 && c2 > a2)    System.out.print("YES");   else if (b1 > a1 && b2 < a2 && c1 > a1 && c2 < a2)    System.out.print("YES");   else if (b1 < a1 && b2 > a2 && c1 < a1 && c2 > a2)    System.out.print("YES");   else if (b1 < a1 && b2 < a2 && c1 < a1 && c2 < a2)    System.out.print("YES");   else    System.out.print("NO");  }  private static class Reader {   private final BufferedReader reader;   private final String separator;   private String ln;   private String[] tokens;   private int ptr;   Reader(String separator, InputStream input) {    this.reader = new BufferedReader(new InputStreamReader(input));    this.separator = separator;    this.ptr = -1;   }   Reader(String separator) { this(separator, System.in); }   Reader() { this(" "); }   String nextStr(){    if (Objects.isNull(ln)) {     try {      ln = reader.readLine();     } catch (IOException e) {      System.out.println(e.getMessage());     }     if (Objects.nonNull(ln)) {      tokens = ln.split(separator);      ptr = 0;     } else {      throw new NoSuchElementException("no next element");     }    } else if (ptr == tokens.length) {     ln = null;     tokens = null;     ptr = -1;     return nextStr();    }    return tokens[ptr++];   }   int nextInt() { return Integer.parseInt(nextStr()); }   long nextLong() { return Long.parseLong(nextStr()); }   double nextDouble() { return Double.parseDouble(nextStr()); }  } }
5	public class A {  public static double EPS = .001;  public class House implements Comparable<House> {  int x;  int a;   public House(int mx, int ma) {  x = mx;  a = ma;  }  public int compareTo(House o) {  return x - o.x;  }   public double right() {  return (double)x + ((double)a)/2.0;  }   public double left() {  return (double)x - ((double)a)/2.0;  } }  public static void main(String[] args) {  new A().solve(); }   public void solve() {  Scanner in = new Scanner(System.in);   int n = in.nextInt();  int t = in.nextInt();   ArrayList<House> houses = new ArrayList<House>();   for(int i=0;i<n;i++) {  int x = in.nextInt();  int a = in.nextInt();  houses.add(new House(x,a));  }   Collections.sort(houses);     int total = 2;   for(int i=0;i<houses.size()-1;i++) {  House me = houses.get(i);  House next = houses.get(i+1);  double meright = me.right();  double nextleft = next.left();  double diff = nextleft - meright;  if(diff-EPS > ((double)t)) {   total += 2;  }  else if(diff+EPS > ((double)t)) {   total += 1;  }  }   System.out.println(total); }  }
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;  } } }
1	public class Round1B {  public static void main(String[] args) throws Exception {  new Round1B().run(); }  private void run() throws Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int tc = Integer.parseInt(br.readLine().trim());  while (tc > 0) {  String s = br.readLine().trim();  if (s.matches("R[0-9]+C[0-9]+")) {   Pattern p = Pattern.compile("R([0-9]+)C([0-9]+)");   Matcher m = p.matcher(s);   if (m.matches()) {   int rows = Integer.parseInt(m.group(1));   int cols = Integer.parseInt(m.group(2));   String col = "";   while (cols > 0) {    int mod = (cols - 1) % 26;    col = (char)('A' + mod) + col;    cols = (cols - 1) / 26;   }   System.out.println(col + rows);   } else {   throw new Exception();   }  } else {   Pattern p = Pattern.compile("([A-Z]+)([0-9]+)");   Matcher m = p.matcher(s);   if (m.matches()) {      int rows = Integer.parseInt(m.group(2));   int cols = 0;   int mul = 1;   for (int i = m.group(1).length() - 1; i >= 0; i--) {    cols += mul * (m.group(1).charAt(i) - 'A' + 1);    mul *= 26;   }   System.out.printf("R%dC%d\n", rows, cols);   }   else {   throw new Exception();   }  }   tc--;  }  br.close(); } }
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));   }  } }
4	public class C {  private static int[] dx = {1, -1, 0, 0}; private static int[] dy = {0, 0, -1, 1};  public static void main(String[] args) throws Exception{  Thread t = new Thread(null, null, "~", Runtime.getRuntime().maxMemory()){  @Override  public void run(){   try {   solve();   } catch(Exception e) {   System.err.println("ERROR");   }  }  };  t.start();  t.join();  }  public static void solve() throws Exception {  Scanner in = new Scanner(new File("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  int n = in.nextInt();  int m = in.nextInt();  int[][] time = new int[n][m];  for(int i = 0; i < n; ++i) {  Arrays.fill(time[i], Integer.MAX_VALUE);  }  int qq = in.nextInt();  int[] xs = new int[qq];  int[] ys = new int[qq];  for(int i = 0; i < qq; ++i){  xs[i] = in.nextInt() - 1;  ys[i] = in.nextInt() - 1;  }   for(int i = 0; i < n; ++i) {  for(int j = 0; j < m; ++j) {   for(int k = 0; k < qq; ++k) {   int dist = Math.abs(i - xs[k]) + Math.abs(j - ys[k]);   time[i][j] = Math.min(time[i][j], dist);   }  }  }  int max = -1;  int x = -1;  int y = -1;  for(int i = 0; i < n; ++i) {  for(int j = 0; j < m; ++j) if(max < time[i][j]) {   max = time[i][j];   x = i + 1;   y = j + 1;  }  }  out.println(x + " " + y);  out.flush();  out.close(); }  private static class Pair {  int f, s;  int time;  public Pair(int f, int s) {  this.f = f;  this.s = s;  }  public Pair(int f, int s, int time) {  this(f, s);  this.time = time;  }  } }
4	public class cf1517d {  public static void main(String[] args) throws IOException {   int n = rni(), m = ni(), k = ni(), ans[][] = new int[n][m];   WGraph g = wgraph(n * m);   for (int i = 0; i < n; ++i) {    r();    for (int j = 0; j < m - 1; ++j) {     g.c(i * m + j, i * m + j + 1, ni());    }   }   for (int i = 0; i < n - 1; ++i) {    r();    for (int j = 0; j < m; ++j) {     g.c(i * m + j, (i + 1) * m + j, ni());    }   }   if (k % 2 == 1) {    for (int[] row : ans) {     fill(row, -1);     prln(row);    }    close();    return;   }   k >>= 1;   for (int l = 0; l < k; ++l) {    int nans[][] = new int[n][m];    for (int[] row : nans) {     fill(row, IBIG);    }    for (int i = 0; i < n * m; ++i) {     for (int ed[] : g.get(i)) {      int j = ed[0], d = ed[1];      if (ans[i / m][i % m] + d < nans[j / m][j % m]) {       nans[j / m][j % m] = ans[i / m][i % m] + d;      }     }    }    ans = nans;   }   for (int i = 0; i < n; ++i) {    for (int j = 0; j < m; ++j) {     ans[i][j] *= 2;    }   }   for (int[] row : ans) {    prln(row);   }   close();  }  static int solve(WGraph g, int i, int k) {   List<Map<Integer, Integer>> cost = new ArrayList<>();   for (int j = 0; j <= k; ++j) {    cost.add(new HashMap<>());   }   PriorityQueue<int[]> dijk = new PriorityQueue<>((a, b) -> a[2] - b[2]);   dijk.offer(new int[] {i, 0, 0});   cost.get(0).put(i, 0);   while (!dijk.isEmpty()) {    int e[] = dijk.poll(), node = e[0], dist = e[1], co = e[2];    if (co > cost.get(dist).get(node)) {     continue;    }    if (dist == k) {     return 2 * co;    }    if (dist < k) {     for (int ed[] : g.get(node)) {      int j = ed[0], c = ed[1];      if (co + c < cost.get(dist + 1).getOrDefault(j, IBIG)) {       cost.get(dist + 1).put(j, co + c);       dijk.offer(new int[] {j, dist + 1, co + c});      }     }    }   }   return -1;  }  static WGraph wgraph(int n) {   WGraph g = new WGraph();   for (int i = 0; i < n; ++i) {    g.add(new ArrayList<>());   }   return g;  }  static WGraph wgraph(int n, int m) throws IOException {   WGraph g = wgraph(n);   for (int i = 0; i < m; ++i) {    g.c(rni() - 1, ni() - 1, ni());   }   return g;  }  static WGraph wdigraph(int n, int m) throws IOException {   WGraph g = wgraph(n);   for (int i = 0; i < m; ++i) {    g.cto(rni() - 1, ni() - 1, ni());   }   return g;  }  static class WGraph extends ArrayList<List<int[]>> {   void cto(int u, int v, int w) {    get(u).add(new int[] {v, w});   }   void c(int u, int v, int w) {    cto(u, v, w);    cto(v, u, w);   }  }  static BufferedReader __i = new BufferedReader(new InputStreamReader(System.in));  static PrintWriter __o = new PrintWriter(new OutputStreamWriter(System.out));  static StringTokenizer input;  static Random __r = new Random();          static final int IBIG = 1000000007;  static final int IMAX = 2147483647;  static final long LMAX = 9223372036854775807L;   static int minof(int a, int b, int c) {return min(a, min(b, c));}  static int minof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); int min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static long minof(long a, long b, long c) {return min(a, min(b, c));}  static long minof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); long min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static int maxof(int a, int b, int c) {return max(a, max(b, c));}  static int maxof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); int max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static long maxof(long a, long b, long c) {return max(a, max(b, c));}  static long maxof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); long max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static int powi(int a, int b) {if (a == 0) return 0; int ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static long powl(long a, int b) {if (a == 0) return 0; long ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static int fli(double d) {return (int) d;}  static int cei(double d) {return (int) ceil(d);}  static long fll(double d) {return (long) d;}  static long cel(double d) {return (long) ceil(d);}  static int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}  static long gcd(long a, long b) {return b == 0 ? a : gcd(b, a % b);}  static int[] exgcd(int a, int b) {if (b == 0) return new int[] {1, 0}; int[] y = exgcd(b, a % b); return new int[] {y[1], y[0] - y[1] * (a / b)};}  static long[] exgcd(long a, long b) {if (b == 0) return new long[] {1, 0}; long[] y = exgcd(b, a % b); return new long[] {y[1], y[0] - y[1] * (a / b)};}  static int randInt(int min, int max) {return __r.nextInt(max - min + 1) + min;}  static long mix(long x) {x += 0x9e3779b97f4a7c15L; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9L; x = (x ^ (x >> 27)) * 0x94d049bb133111ebL; return x ^ (x >> 31);}   static void reverse(int[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {int swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(long[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {long swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(double[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {double swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(char[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {char swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void shuffle(int[] a) {int n = a.length - 1; for (int i = 0; i < n; ++i) {int ind = randInt(i, n); int swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}  static void shuffle(long[] a) {int n = a.length - 1; for (int i = 0; i < n; ++i) {int ind = randInt(i, n); long swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}  static void shuffle(double[] a) {int n = a.length - 1; for (int i = 0; i < n; ++i) {int ind = randInt(i, n); double swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}  static void rsort(int[] a) {shuffle(a); sort(a);}  static void rsort(long[] a) {shuffle(a); sort(a);}  static void rsort(double[] a) {shuffle(a); sort(a);}  static int[] copy(int[] a) {int[] ans = new int[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static long[] copy(long[] a) {long[] ans = new long[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static double[] copy(double[] a) {double[] ans = new double[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static char[] copy(char[] a) {char[] ans = new char[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}   static void r() throws IOException {input = new StringTokenizer(rline());}  static int ri() throws IOException {return Integer.parseInt(rline());}  static long rl() throws IOException {return Long.parseLong(rline());}  static double rd() throws IOException {return Double.parseDouble(rline());}  static int[] ria(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni(); return a;}  static int[] riam1(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni() - 1; return a;}  static long[] rla(int n) throws IOException {long[] a = new long[n]; r(); for (int i = 0; i < n; ++i) a[i] = nl(); return a;}  static double[] rda(int n) throws IOException {double[] a = new double[n]; r(); for (int i = 0; i < n; ++i) a[i] = nd(); return a;}  static char[] rcha() throws IOException {return rline().toCharArray();}  static String rline() throws IOException {return __i.readLine();}  static String n() {return input.nextToken();}  static int rni() throws IOException {r(); return ni();}  static int ni() {return Integer.parseInt(n());}  static long rnl() throws IOException {r(); return nl();}  static long nl() {return Long.parseLong(n());}  static double rnd() throws IOException {r(); return nd();}  static double nd() {return Double.parseDouble(n());}   static void pr(int i) {__o.print(i);}  static void prln(int i) {__o.println(i);}  static void pr(long l) {__o.print(l);}  static void prln(long l) {__o.println(l);}  static void pr(double d) {__o.print(d);}  static void prln(double d) {__o.println(d);}  static void pr(char c) {__o.print(c);}  static void prln(char c) {__o.println(c);}  static void pr(char[] s) {__o.print(new String(s));}  static void prln(char[] s) {__o.println(new String(s));}  static void pr(String s) {__o.print(s);}  static void prln(String s) {__o.println(s);}  static void pr(Object o) {__o.print(o);}  static void prln(Object o) {__o.println(o);}  static void prln() {__o.println();}  static void pryes() {prln("yes");}  static void pry() {prln("Yes");}  static void prY() {prln("YES");}  static void prno() {prln("no");}  static void prn() {prln("No");}  static void prN() {prln("NO");}  static boolean pryesno(boolean b) {prln(b ? "yes" : "no"); return b;};  static boolean pryn(boolean b) {prln(b ? "Yes" : "No"); return b;}  static boolean prYN(boolean b) {prln(b ? "YES" : "NO"); return b;}  static void prln(int... a) {for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i); if (a.length > 0) prln(a[a.length - 1]); else prln();}  static void prln(long... a) {for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i); if (a.length > 0) prln(a[a.length - 1]); else prln();}  static void prln(double... a) {for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i); if (a.length > 0) prln(a[a.length - 1]); else prln();}  static <T> void prln(Collection<T> c) {int n = c.size() - 1; Iterator<T> iter = c.iterator(); for (int i = 0; i < n; pr(iter.next()), pr(' '), ++i); if (n >= 0) prln(iter.next()); else prln();}  static void h() {prln("hlfd"); flush();}  static void flush() {__o.flush();}  static void close() {__o.close();} }
6	public class MaeDosDragoes {   public static PrintWriter saida = new PrintWriter(System.out, false);            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());   }  }   public static void main(String[] args) {  FastScanner fastScanner = new FastScanner();   int proximoInt = fastScanner.nextInt();   double proximoDouble = fastScanner.nextInt();   long[] graph = new long[proximoInt];   for(Integer i = 0; i < proximoInt; i++) {    for(Integer j =0; j < proximoInt; j++) {     Integer val = fastScanner.nextInt();     if (val.equals(1) || i.equals(j)) {   graph[i] |= 1L << j;   }    }   }   int szLeft = proximoInt/2;   int szRight = proximoInt - szLeft;   int[] dp = new int[1 << szLeft];   int maxMask = 1 << szLeft;   for(int mask = 1; mask <maxMask; mask++) {    int curMask = mask;    for(int j = 0; j < szLeft; j++) {     if (((1 << j) & mask) > 0) {      curMask &= graph[j + szRight] >> szRight;      dp[mask] = Math.max(dp[mask], dp[mask ^ (1 << j)]);     }    }    if (mask == curMask) {     dp[mask] = Math.max(dp[mask],Integer.bitCount(mask));    }   }   int ans = 0;   int rmaxMask = 1 << szRight;   for(int mask = 0; mask < rmaxMask; mask++) {    int curMask = mask;    int oMask = maxMask -1;    for(int j = 0; j < szRight; j++) {     if (((1 << j) & mask) > 0) {      curMask &= (graph[j] & (rmaxMask-1));      oMask &= graph[j] >> szRight;     }    }    if (curMask != mask) continue;    ans = Math.max(ans, Integer.bitCount(mask) + dp[oMask]);   }   proximoDouble/=ans;   saida.println(proximoDouble * proximoDouble * (ans * (ans-1))/2);   saida.flush();  } }
1	public class Main {  static PrintWriter out; static BufferedReader in;  public static void main(String[] args) throws Exception {  out = new PrintWriter(System.out);  in = new BufferedReader(new InputStreamReader(System.in));   int n = new Integer(in.readLine());  for (int i = 0; i < n; i++) {  String s = in.readLine();  int x = 0;  while (s.charAt(x) - 'A' >= 0 && s.charAt(x) - 'Z' <= 0) x++;  int y = s.length() - 1;  while (s.charAt(y) - '0' >= 0 && s.charAt(y) - '9' <= 0) y--;   if (x > y) {   int k = 1;   int a = 1;   for (int j = 1; j < x; j++) {   k *= 26;   a += k;   }   for (int j = 0; j < x; j++) {   a += k*(s.charAt(j) - 'A');   k /= 26;   }   int b = Integer.parseInt(s.substring(x));   out.println("R" + b + "C" + a);  } else {   while (s.charAt(x) - '0' >= 0 && s.charAt(x) - '9' <= 0) x++;   int b = Integer.parseInt(s.substring(1, x));   int a = Integer.parseInt(s.substring(x + 1));   int num = 0;   int k = 1;   while (a >= k) {   a -= k;   k *= 26;   }   k /= 26;   while (k > 0) {    out.print((char)('A' + (a/k)));   a %= k;   k /= 26;   }   out.println(b);  }  }  out.close(); } }
0	public class A {   static StringTokenizer st;  static BufferedReader in;  static PrintWriter pw;   public static void main(String[] args) throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   int n = nextInt();   int n1 = n/10;   int s = n % 10;   int n2 = n / 100 * 10+s;   System.out.println(Math.max(n, Math.max(n1, n2)));   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();  } }
0	public class Main {    public static void main(String[] args) {   Scanner cin = new Scanner (System.in);   int n = cin.nextInt();   long res = 2;   long[] a = new long[4];   a[0] = 0;   a[1] = 1;   a[2] = 1;   a[3] = 2;   if (n == 1){    System.out.println("0 0 1");    return;   }   if (n == 2){    System.out.println("0 1 1");    return;   }   if (n == 0){    System.out.println("0 0 0");    return;   }     if (n == 3){    System.out.println("1 1 1");    return;   }   do{    a[3] = res;    res = a[2] + a[3];    if (res == n){     System.out.println (a[0] + " " + a[1] + " " + a[3]);     return;    }    a[0] = a[1];    a[1] = a[2];    a[2] = a[3];      }while (true);  } }
0	public class Main {    public static void main(String[] args) {     Scanner scanner = new Scanner(System.in);   int T = scanner.nextInt();   while(T-->0){    int m , n , count=0;    m = scanner.nextInt();    n = scanner.nextInt();    while(m!=0&&n!=0){     int tmp;     if(m<n) {      tmp = n;      n = m;      m = tmp;     }     count+=m/n;     m = m%n;    }    if(T!=0)System.out.println(count);    else System.out.print(count);   }  } }
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 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 t = in.readInt();    while (t-- > 0) {     int[] a = new int[]{in.readInt(), in.readInt()};     Arrays.sort(a);     int ans = 0;     while (a[0] > 0) {      int x = a[1] / a[0];      ans += x;      a[1] -= a[0] * x;      Arrays.sort(a);     }     out.println(ans);    }   }  }  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);   }  } }
2	public class B {   public static void main(String[] args) {  Pipes pipes = new Pipes();  pipes.solve();  pipes.print(); } } class Pipes {  Pipes() {  Scanner scr = new Scanner(System.in);  n = scr.nextLong();  k = scr.nextLong(); }  long bs(long nb, long nk) {   long left = 2;  long ls = (nk - left + 1) * (nk + left) / 2 - (nk - left);  long right = nk;  long rs = nk;   if (nb > ls) {  return -1;  }    long mid = left;   while (rs < ls){  mid = (left + right)/2;  long ms = (nk - mid + 1) * (nk + mid) / 2 - (nk - mid);  if (nb > ms) {   right = mid;   rs = ms;  }  else if (nb < ms){   left = mid+1;   ls = (nk - left + 1) * (nk + left) / 2 - (nk - left);  }  else {   left = mid;   break;  }    }   return left;   }  void solve() {  long nn = n;  long kk = k;  ans = 0;  long ps = 1;  long add;   if (n == 1) {  ans = 0;  return;  }   nn = n - (ps - 1);  while (nn > kk){  add = bs(nn, kk);  if (add == -1) {   ans = -1;   return;  }  else {   ans = ans + (kk - add + 1);  }      long addn = (kk - add + 1) * (kk + add) / 2 - (kk - add);   ps = ps - 1 + addn;  if (ps == n)   return;  nn = nn - (ps - 1);  kk = add - 1;  }   if (nn > 0) {  ans++;  }   }   void print() {  System.out.println(ans); }  long ans; long n; long k; }
5	public class main {   static Scanner in; static int next() throws Exception {return in.nextInt();};     static PrintWriter out;  public static void main(String[] args) throws Exception {   in = new Scanner(System.in);    out = new PrintWriter(System.out);   int n = next();   int a = next();   int b = next();   int k = 0;   int i;   int[] ar = new int[n];   for(i=0;i<n;i++)    ar[i]=next();   Arrays.sort(ar);   k = ar[n-a]-ar[b-1];   if(k<0)    out.print(0);   else out.print(k);   out.close();  } }
5	public class A{   void solve()throws Exception  {  int n=nextInt();  int[]a=new int[n];   for(int i=0;i<n;i++)    a[i]=nextInt();   Arrays.sort(a);   int[]res=new int[n];   for(int i=0;i<n;i++)   {    if(i==0)     res[i]=1;    else     res[i]=a[i-1];   }   if(a[n-1]==1)    res[n-1]=2;   for(int i=0;i<n;i++)   {    if(i==n-1)     writer.println(res[i]);    else     writer.print(res[i]+" ");   }   }    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 A().run();  }  }
4	public class Task {  private static final boolean readFromFile = false;  public static void main(String args[]){  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FileOutputStream fileOutputStream;  FileInputStream fileInputStream;  if (readFromFile){  try{   fileInputStream = new FileInputStream(new File("input.txt"));   fileOutputStream = new FileOutputStream(new File("output.txt"));  }catch (FileNotFoundException e){   throw new RuntimeException(e);  }  }  PrintWriter out = new PrintWriter((readFromFile)?fileOutputStream:outputStream);  InputReader in = new InputReader((readFromFile)?fileInputStream:inputStream);   Solver s = new Solver(in,out);  s.solve();   out.close(); } } class Solver{ InputReader in; PrintWriter out;  public void solve(){  String s = in.nextLine();  for (int len=s.length()-1;len>=1;len--)  for (int i=0;i<s.length()-len+1;i++)   for (int j=i+1;j<s.length()-len+1;j++)   if (s.substring(i,i+len).equals(s.substring(j,j+len))){    out.println(len);    return;   }  out.println(0); }   Solver(InputReader in, PrintWriter out){  this.in=in;  this.out=out; } } class InputReader{ private BufferedReader buf; private StringTokenizer tok;  InputReader(InputStream in){  tok = null;  buf = new BufferedReader(new InputStreamReader(in)); }  InputReader(FileInputStream in){  tok = null;  buf = new BufferedReader(new InputStreamReader(in)); }  public String next(){  while (tok==null || !tok.hasMoreTokens()){  try{   tok = new StringTokenizer(buf.readLine());  }catch (IOException e){   throw new RuntimeException(e);  }  }  return tok.nextToken(); }  public int nextInt(){  return Integer.parseInt(next()); }  public long nextLong(){  return Long.parseLong(next()); }  public double nextDouble(){  return Double.parseDouble(next()); }  public float nextFloat(){  return Float.parseFloat(next()); }  public String nextLine(){  try{  return buf.readLine();  }catch (IOException e){  return null;  } }  }
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"); } }
5	public class A113 {  public static void main(String[] args) {   new A113().run();  }   public void run() {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int k = in.nextInt();   Team[] teams = new Team[n];   for (int i = 0; i < teams.length; i++) {    teams[i] = new Team(in.nextInt(), in.nextInt());   }   Arrays.sort(teams);   int counter = 1;   int index = k-2;   while (index >= 0 && teams[index].p == teams[k-1].p && teams[index].t == teams[k-1].t) {    index--;    counter++;   }   index = k;   while (index < n && teams[index].p == teams[k-1].p && teams[index].t == teams[k-1].t) {    index++;    counter++;   }   System.out.println(counter);  }   private class Team implements Comparable<Team> {   int p;   int t;     public Team(int pp, int tt) {    p = pp; t = tt;   }   @Override   public int compareTo(Team o) {    if (o.p - this.p == 0)     return this.t - o.t;    return o.p - this.p;   }  } }
2	public class Main { public static void main (String[] args) throws java.lang.Exception {   FastReader sc=new FastReader();  long n=sc.L();  long k=sc.L();  long x=8*(n+k);  x+=9;  x=(long)Math.sqrt(x)-3;  x/=2;   System.out.println(n-x);  }  static int binarysearch(int x,int[] b,int n)  {   int l=0,r=n-1,m=(l+r)/2;   if(x<b[0]||x>b[r])   return -1;   while(l<=r)   {    m=(l+r)/2;    if(b[m]==x)    return m;    if(b[m]>x)    r=m-1;    else    l=m+1;   }   return -1;  }  static int lower(int x,int b[],int n)  {   if(x<b[0])   return -1;   else if(x==b[0])   return 0;   if(x>=b[n-1])   return n-1;   int l=0,r=n-1,m=(l+r)/2;   while(l<=r)   {    m=(l+r)/2;    if(b[m]<=x&&b[m+1]>x)    return m;    else if(b[m]>x&&b[m-1]<=x)    return m-1;    if(b[m]>x)    r=m-1;    else if(b[m]<x)    l=m+1;   }   return -1;  }  static int upper(int x,int b[],int n)  {   if(x<=b[0])   return 0;   else if(x==b[n-1])   return n-1;   if(x>b[n-1])   return -1;   int l=0,r=n-1,m=(l+r)/2;   while(l<=r)   {    m=(l+r)/2;    if(b[m]<x&&b[m+1]>=x)    return m+1;    else if(b[m]>=x&&b[m-1]<x)    return m;    if(b[m]>x)    r=m-1;    else if(b[m]<x)    l=m+1;   }   return -1;  }   static long power(long x, long y, long p)  {      long res = 1;            x = x % p;     while (y > 0)   {           if((y & 1)==1)     res = (res * x) % p;             y = y >> 1;    x = (x * x) % p;   }   return res;  }  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 I()   {    return Integer.parseInt(next());   }    long L()   {    return Long.parseLong(next());   }    double D()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  }  static int gcd(int a,int b)  {   if(a%b==0)   return b;   return gcd(b,a%b);  } static float power(float x, int y)  {   float temp;   if( y == 0)    return 1;   temp = power(x, y/2);      if (y%2 == 0)    return temp*temp;   else   {    if(y > 0)     return x * temp * temp;    else     return (temp * temp) / x;   }  }  static long pow(int a,int b)  {   long result=1;   if(b==0)   return 1;   long x=a;   while(b>0)   {    if(b%2!=0)    result*=x;       x=x*x;    b=b/2;   }   return result;  }   static ArrayList<Integer> sieveOfEratosthenes(int n)  {   ArrayList<Integer> arr=new ArrayList<Integer>();   boolean prime[] = new boolean[n+1];   for(int i=2;i<n;i++)    prime[i] = true;      for(int p = 2; p*p <=n; p++)   {    if(prime[p] == true)    {     arr.add(p);     for(int i = p*p; i <= n; i += p)      prime[i] = false;    }   }   return arr;  } }
4	public class Mulitple { public static void main(String[] args) throws IOException {  BufferedReader r = new BufferedReader(new InputStreamReader(System.in));   String s = r.readLine();  System.out.println(num(s)); }  public static int num(String s) {  int answer = 0;  Set<String> set = new HashSet<String>();  for(int j = s.length()-1; j>=1; j--)  {  for(int i = 0; i<s.length()-j+1; i++)  {   if(set.contains(s.substring(i,i+j)))   {   return s.substring(i,i+j).length();   }   else   {   set.add(s.substring(i,i+j));   }  }  }  return 0;  } }
2	public class ProblemB {   public static void main(String[] args) throws IOException {   BufferedReader s = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(System.out);   String[] line = s.readLine().split(" ");   long n = Long.valueOf(line[0]);   long y = Long.valueOf(line[1]);   long x = Long.valueOf(line[2]);   long c = Long.valueOf(line[3]);     long min = 0;   long max = n*2L+20;   for (int cnt = 0 ; cnt < 300 ; cnt++) {    long med = (min+max) / 2L;    long ct = isok(med, n, x, y, c);    if (ct >= c) {     max = med;    } else {     min = med+1;    }   }     long lst = max;   for (long d = -2 ; d <= 2 ; d++) {    if (max+d >= 0 && isok(max+d, n, x, y, c) >= c) {     lst = Math.min(lst, max+d);    }   }     out.println(lst);   out.flush();  }    private static long isok(long time, long n, long x, long y, long c) {   long total = time * 2 * (time + 1) + 1;   long top = y - time;   if (top <= 0) {    long dy = Math.abs(top)+1;    total -= dy*dy;    long over = dy - x;    if (over >= 1) {     total += (1L + over) * over / 2;    }    over = dy - ((n + 1) - x);    if (over >= 1) {     total += (1L + over) * over / 2;    }   }     long bottom = y + time;   if (bottom > n) {    long dy = Math.abs(bottom-n);    total -= dy*dy;    long over = dy - x;    if (over >= 1) {     total += (1L + over) * over / 2;    }    over = dy - ((n + 1) - x);    if (over >= 1) {     total += (1L + over) * over / 2;    }   }     long left = x - time;   if (left <= 0) {    long dy = Math.abs(left)+1;    total -= dy*dy;   }   long right = x + time;   if (right > n) {    long dy = Math.abs(right-n);    total -= dy*dy;   }   return total;  }  public static void debug(Object... os){   System.err.println(Arrays.deepToString(os));  } }
1	public class Main{   public static void main(String[] args){   Scanner in = new Scanner(System.in);   int[] a=new int[1010];   while(in.hasNext()){    int n=in.nextInt();    String s=in.next();    int sum=0;    for(int i=0;i<n;++i){     if(s.charAt(i)=='H'){      a[i]=1;      ++sum;     }     else a[i]=0;    }    int min=10010;    for(int i=0;i<n-sum;++i){     int count=0;     for(int j=i+sum;j<n;++j){      if(a[j]==1)++count;     }     for(int j=0;j<i;++j){      if(a[j]==1)++count;     }     if(count<min)min=count;    }    sum=n-sum;    for(int i=0;i<n-sum;++i){     int count=0;     for(int j=i+sum;j<n;++j){      if(a[j]==0)++count;     }     for(int j=0;j<i;++j){      if(a[j]==0)++count;     }     if(count<min)min=count;    }    System.out.println(min);   }  } }
3	public class SameSumBlocks {  public static void main(String[] args) throws Exception {   FastScanner sc = new FastScanner();   PrintWriter out = new PrintWriter(System.out);   int N = sc.nextInt();   int[] pre = new int[N + 1];   for (int i = 1; i <= N; i++) {    pre[i] = pre[i - 1] + sc.nextInt();   }   var sumMap = new HashMap<Integer, ArrayList<Pair>>();   for (int i = 1; i <= N; i++) {    for (int j = i; j <= N; j++) {     int sum = pre[j] - pre[i - 1];     sumMap.computeIfAbsent(sum, val -> new ArrayList<>()).add(new Pair(i, j));    }   }   var ans = new ArrayList<Pair>();   for (var list : sumMap.values()) {    Collections.sort(list, Comparator.comparingInt(p -> p.r));       int last = 0;    var group = new ArrayList<Pair>();    for (Pair p : list) {     if (p.l > last) {      group.add(p);      last = p.r;     }    }    if (group.size() > ans.size()) {     ans = group;    }   }   out.println(ans.size());   for (Pair p : ans) {    out.println(p);   }   out.close();  }  static class Pair {   int l, r;   public Pair(int ll, int rr) {    l = ll; r = rr;   }   public String toString() {    return l + " " + r;   }  }  static class FastScanner {   private int BS = 1<<16;   private char NC = (char)0;   private byte[] buf = new byte[BS];   private int bId = 0, size = 0;   private char c = NC;   private double cnt = 1;   private BufferedInputStream in;   public FastScanner() {    in = new BufferedInputStream(System.in, BS);   }   public FastScanner(String s) {    try {     in = new BufferedInputStream(new FileInputStream(new File(s)), BS);    }    catch (Exception e) {     in = new BufferedInputStream(System.in, BS);    }   }   private char getChar(){    while(bId==size) {     try {      size = in.read(buf);     }catch(Exception e) {      return NC;     }     if(size==-1)return NC;     bId=0;    }    return (char)buf[bId++];   }   public int nextInt() {    return (int)nextLong();   }   public int[] nextInts(int N) {    int[] res = new int[N];    for (int i = 0; i < N; i++) {     res[i] = (int) nextLong();    }    return res;   }   public long[] nextLongs(int N) {    long[] res = new long[N];    for (int i = 0; i < N; i++) {     res[i] = nextLong();    }    return res;   }   public long nextLong() {    cnt=1;    boolean neg = false;    if(c==NC)c=getChar();    for(;(c<'0' || c>'9'); c = getChar()) {     if(c=='-')neg=true;    }    long res = 0;    for(; c>='0' && c <='9'; c=getChar()) {     res = (res<<3)+(res<<1)+c-'0';     cnt*=10;    }    return neg?-res:res;   }   public double nextDouble() {    double cur = nextLong();    return c!='.' ? cur:cur+nextLong()/cnt;   }   public String next() {    StringBuilder res = new StringBuilder();    while(c<=32)c=getChar();    while(c>32) {     res.append(c);     c=getChar();    }    return res.toString();   }   public String nextLine() {    StringBuilder res = new StringBuilder();    while(c<=32)c=getChar();    while(c!='\n') {     res.append(c);     c=getChar();    }    return res.toString();   }   public boolean hasNext() {    if(c>32)return true;    while(true) {     c=getChar();     if(c==NC)return false;     else if(c>32)return true;    }   }  } }
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);   TaskB solver = new TaskB();   solver.solve(1, in, out);   out.close();  } } class TaskB {  public void solve(int testNumber, Scanner in, PrintWriter out) {   long N = in.nextLong();   int K = in.nextInt();   long pipes = 1;   if(N == 1){    out.println(0);return;   }   long left = 0, right = K - 1, find = -1;   while (left <= right){    long mid = (left + right) / 2;    if(mid * mid + (1 - 2 * K) * mid + 2 * (N - 1) <= 0){     find = mid;     right = mid - 1;    }    else     left = mid + 1;   }   out.println(find);  } }
6	public class MaeDosDragoes { public static PrintWriter saida = new PrintWriter(System.out, false); public static class Escanear {   BufferedReader reader;   StringTokenizer tokenizer;  public Escanear() {    this(new InputStreamReader(System.in));   }  public Escanear(Reader in) {    reader = new BufferedReader(in);   }   String proximo() {    if (tokenizer == null || !tokenizer.hasMoreElements()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return tokenizer.nextToken();   }     int proximoNum() {    return Integer.parseInt(proximo());   }  }  public static void main(String[] args) {  Escanear escanear = new Escanear();  int proximoInt = escanear.proximoNum();   long[] aux = new long[proximoInt];   double proximoDouble = escanear.proximoNum();   for(Integer i = 0; i < proximoInt; i++) {    for(Integer j =0; j < proximoInt; j++) {     Integer val = escanear.proximoNum();     if (val.equals(1) || i.equals(j)) {   aux[i] |= 1L << j;   }    }   }   int esquerda = proximoInt/2;   int direita = proximoInt - esquerda;  int maiorMascara = 1 << esquerda;  int[] depois = new int[1 << esquerda];  Integer mascara = 1;  while (mascara < maiorMascara) {  int mascaraAtual = mascara;    for(int j = 0; j < esquerda; j++) {     if (((1 << j) & mascara) > 0) {      mascaraAtual &= aux[j + direita] >> direita;      depois[mascara] = Math.max(depois[mascara], depois[mascara ^ (1 << j)]);     }    }    if (mascara.equals(mascaraAtual)) {     depois[mascara] = Math.max(depois[mascara],Integer.bitCount(mascara));  }  mascara++;  }   int auxiliar = 0;   int mascaraMaxima = 1 << direita;   for(int i = 0; i < mascaraMaxima; i++) {    int mascaraCorrente = i;    int mascaraValor = maiorMascara -1;    for(int j = 0; j < direita; j++) {     if (((1 << j) & i) > 0) {      mascaraCorrente &= (aux[j] & (mascaraMaxima-1));      mascaraValor &= aux[j] >> direita;     }    }    if (mascaraCorrente != i) continue;    auxiliar = Math.max(auxiliar, Integer.bitCount(i) + depois[mascaraValor]);   }   proximoDouble/=auxiliar;   saida.println(proximoDouble * proximoDouble * (auxiliar * (auxiliar-1))/2);   saida.flush();  } }
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()); } }
2	public class Test {  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 1024 * 48);   BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));   String str = br.readLine();   StringTokenizer st = new StringTokenizer(str, " ");   long x = Long.parseLong(st.nextToken());   long k = Long.parseLong(st.nextToken());   if (x == 0) {    bw.write(0 + "\n");   } else {    int power = power(k, 1000000007);    long answer = (((power * 2) % 1000000007) * (x % 1000000007)) % 1000000007;    answer -= power - 1;    answer = (answer + 1000000007) % 1000000007;    bw.write(answer + "\n");   }   bw.flush();  }  public static int power(long a, int m) {   if (a == 0) {    return 1;   }   long pow = power(a / 2, m);   if (a % 2 == 1) {    return (int)(((pow * pow) % m) * 2) % m;   } else {    return (int)((pow * pow) % m);   }  } }
5	public class TaskD {  public static void main (String[] args) throws IOException {   FastScanner fs = new FastScanner(System.in);   PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));   int n = fs.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = fs.nextInt();   }     HashMap<Integer,Integer> h = new HashMap<Integer,Integer>(n);   BigInteger s = new BigInteger(""+a[0]);   BigInteger x = new BigInteger("0");   h.put(a[0], 1);   for (int i = 1; i < n; i++) {          x = x.add(new BigInteger(""+(((long)i)*((long)a[i]))));    x = x.subtract(s);    s = s.add(new BigInteger(""+a[i]));    Integer q = null;    q = h.get(a[i]-1);       if (q != null) {     x = x.subtract(new BigInteger(""+q));    }    q = h.get(a[i]+1);       if (q != null) {     x = x.add(new BigInteger(""+q));    }    q = h.get(a[i]);       if (q != null) {     h.put(a[i], q + 1);    } else {     h.put(a[i], 1);    }   }   pw.println(x);   pw.close();  }  static class FastScanner {   BufferedReader reader;   StringTokenizer tokenizer;   FastScanner(InputStream i) {    reader = new BufferedReader(new InputStreamReader(i));    tokenizer = new StringTokenizer("");   }   String next() throws IOException {    while(!tokenizer.hasMoreTokens()) tokenizer = new StringTokenizer(reader.readLine());    return tokenizer.nextToken();   }   int nextInt() throws IOException {    return Integer.parseInt(next());   }   long nextLong() throws IOException {    return Long.parseLong(next());   }  } }
0	public class Round125ProblemA {  public static void main(String[] args) {   InputStream in = System.in;   OutputStream out = System.out;   InputReader reader = new InputReader(in);   PrintWriter writer = new PrintWriter(out);   solve(reader, writer);   writer.close();  }  static void solve(InputReader in, PrintWriter out) {   long fib = in.nextLong();   out.write("" + 0 + " " + 0 + " " + fib);  }  static 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 long nextLong() {    return Long.parseLong(next());   }   public int nextInt() {    return Integer.parseInt(next());   }  } }
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);  } } }
6	public class Main { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  while ( sc.hasNextInt() ) {  int n = sc.nextInt();  long m = sc.nextInt();  boolean edge[][] = new boolean[n][n];  long dp[][] = new long[1<<n][n];  for ( long i = 1 ; i<=m ; ++i ) {   int u = sc.nextInt();    int v = sc.nextInt();   -- u;   -- v;   edge[u][v] = edge[v][u] = true;  }  for ( int i = 0 ; i<n ; ++i ) {   dp[1<<i][i] = 1;  }  long res = 0;  for ( int i = 1 ; i<(1<<n) ; ++i ) {   int first = cal(i);   for ( int j = first ; j<n ; ++j ) {   if ( dp[i][j]==0 ) {    continue;   }   for ( int k = first ; k<n ; ++k ) {    if ( j==k || !edge[j][k] ) {    continue;    }    if ( k==first && judge(i) ) {    res += dp[i][j];    }    if ( (i&(1<<k))==0 ) {    dp[i|(1<<k)][k] += dp[i][j];    }   }   }  }  System.out.println(res/2);   } } public static int cal( int x ) {  int ord = 0;  while ( true ) {  if ( (x&(1<<ord))!=0 ) {   break;  }  ++ ord;  }  return ord; } public static boolean judge( int x ) {  int cnt = 0;  while ( x>=1 ) {  if ( (x&1)==1 ) {   ++ cnt;  }  x >>= 1;  }  return cnt >= 3; } }
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;  } } }
1	public class Solution1 implements Runnable      {       static final long MAX = 1000000007L;       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 Solution1(),"Solution1",1<<26).start();       }       long gcd(long a, long b)       {        if (a == 0)         return b;                 return gcd(b%a, a);       }              long lcm(long a, long b)        {         return (a*b)/gcd(a, b);        }       int root(int a){        while(arr[a] != a){        arr[a] = arr[arr[a]];        a = arr[a];        }        return a;       }       void union(int a,int b){        int xroot = root(a);        int yroot = root(b);        if(arr[xroot] < arr[yroot]){        arr[xroot] = yroot;        }else{        arr[yroot] = xroot;        }       }       boolean find(int a,int b){        int roota = root(a);        int rootb = root(b);        if(roota == rootb){        return true;        }else{        return false;        }       }       int[] arr;       final int level = 20;              public void run()       {       InputReader sc= new InputReader(System.in);       PrintWriter w= new PrintWriter(System.out);       int n = sc.nextInt();       char[] ch = new char[n];       char[] ch2 = new char[n];       ch = sc.next().toCharArray();       ch2 = sc.next().toCharArray();       HashSet<Integer> hset[] = new HashSet[26];       for(int i = 0;i < 26;i++){        hset[i] =new HashSet();       }       int count = 0;       for(int i = 0;i < ch.length;i++){        if(ch[i] != ch2[i]){        hset[ch[i]-97].add(ch2[i]-97);        count++;        }       }       boolean flag = false;       int swap1 = -1;       int swap2 = -1;       int rem = -1;       for(int i = 0;i < ch.length;i++){        if(ch[i] != ch2[i]){        if(hset[ch2[i]-97].size() != 0){         swap1 = i;         flag = true;         if(hset[ch2[i]-97].contains(ch[i]-97)){         rem = i;         count-=2;         flag = false;         break;         }        }        }       }       if(flag){        count--;        w.println(count);        for(int i = 0;i < n;i++){        if(i != swap1 && ch[i] == ch2[swap1] && ch[i] != ch2[i]){         w.println((swap1+1) + " " + (i+1));         w.close();         System.exit(0);        }        }       }else{        if(rem == -1){        w.println(count);        w.println("-1 -1");        }else{        w.println(count);        for(int i = 0;i < n;i++){         if(i != rem && ch[i] == ch2[rem] && ch[rem] == ch2[i] && ch[i] != ch2[i]){         w.println((rem+1) + " " + (i+1));         w.close();         System.exit(0);         }        }        }       }       w.close();       }       boolean fun(long[] prefix,long mid,long temp,long[] arr){       if(temp >= prefix[(int)mid]){        return true;       }       return false;       }       static class Pair implements Comparable<Pair>{       int x;       int y;              Pair(){}        Pair(int x,int y){        this.x = x;        this.y = y;                      }       public int compareTo(Pair p){               return Long.compare(this.x,p.x);       }       }     }
3	public class A {  static int countColors(List<Integer> colors) {  Collections.sort(colors);  int k = 0;  while (!colors.isEmpty()) {  Integer c = colors.get(0);  colors.remove(0);  k++;   List<Integer> toRemove = new ArrayList<>();  for (int i = 0; i < colors.size(); i++) {   if (colors.get(i) % c == 0) toRemove.add(i);  }   Collections.reverse(toRemove);  for (Integer integer : toRemove) {   colors.remove(integer.intValue());  }  }  return k; }  public static void main(String[] args) {  try (Scanner scanner = new Scanner(System.in)) {  int n = scanner.nextInt();  scanner.nextLine();  List<Integer> integers = Arrays.stream(scanner.nextLine().split(" ")).map(Integer::parseInt).collect(Collectors.toList());  System.out.println(countColors(integers));  } } }
6	public class Main {  public static int n, m;  public static int[][] arr;  public static class Item implements Comparable<Item> {   int i, x;   public Item(int i, int x) {    this.i = i;    this.x = x;   }   public int compareTo(Item other) {    if (x == other.x) {     return i - other.i;    }    return other.x - x;   }  }  public static int calc(int[] cols, int k, String mask) {   if (k == cols.length) {    int res = 0;    for (int i = 0; i < n; i++) {     int max = 0;     for (int j = 0; j < cols.length; j++) {      int shift = mask.charAt(j) - '0';      max = Math.max(max, arr[(shift + i) % n][cols[j]]);     }     res += max;    }    return res;   } else {    int best = 0;    for (int i = 0; i < n; i++) {     best = Math.max(best, calc(cols, k + 1, mask + i));    }    return best;   }  }  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int t = in.nextInt();   for (int i = 0; i < t; i++) {    n = in.nextInt();    m = in.nextInt();    arr = new int[n][m];    for (int j = 0; j < n; j++) {     for (int k = 0; k < m; k++) {      arr[j][k] = in.nextInt();     }    }    Item[] max = new Item[m];    for (int j = 0; j < m; j++) {     max[j] = new Item(j, 0);     for (int k = 0; k < n; k++) {      max[j].x = Math.max(max[j].x, arr[k][j]);     }    }    Arrays.sort(max);    int[] cols = new int[Math.min(n, m)];    for (int j = 0; j < cols.length; j++) {     cols[j] = max[j].i;    }    System.out.println(calc(cols, 0, ""));   }  } }
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;  } } }
4	public class Main {  public static void main(String[] args) throws FileNotFoundException {   Scanner read = new Scanner(new FileInputStream(new File("input.txt")));  PrintWriter out = new PrintWriter(new File("output.txt"));  int n = read.nextInt(), m = read.nextInt(), k = read.nextInt(), tree[][] = new int[n][m], a[] = new int[k],   b[] = new int[k], x = 0, y = 0, max = -1, d = 0;  for (int i = 0; i < k; i++) {  a[i] = read.nextInt() - 1;  b[i] = read.nextInt() - 1;   tree[a[i]][b[i]] = 0;  }  for(int i = 0; i < n; i++){  Arrays.fill(tree[i], Integer.MAX_VALUE);  }  for (int o = 0; o < k; o++) {  for(int i = 0; i < n; i++){   for(int j = 0; j < m; j++){   d = Math.abs(a[o] - i) + Math.abs(b[o] - j);   if(d < tree[i][j])    tree[i][j] = d;   }  }  }  for(int i = 0; i<n; i++){  for(int j = 0; j < m ; j ++){   if(tree[i][j] > max){   max= tree[i][j];   x= i;   y = j;   }  }  }  out.println(x + 1 + " " + (y + 1));  out.close(); } }
3	public class a1 {  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  int n = s.nextInt();  int a[] = new int[n];  HashMap<Integer,ArrayList<Integer>> h = new HashMap<>();  boolean visited[] = new boolean[n];  for(int i=0;i<n;i++)  {  a[i] = s.nextInt();      }  Arrays.sort(a);  for(int i=0;i<n;i++) {  if(h.containsKey(a[i])) {        ArrayList<Integer> temp = h.get(a[i]);    temp.add(i);    h.put(a[i],temp);    }    else {    ArrayList<Integer> k =new ArrayList<>();    k.add(i);    h.put(a[i], k);    }  }  int ctr=0;  for(int i=0;i<n;i++) {  if(!visited[i]) {     ctr++;   for(int j=a[i];j<=100;j+=a[i]) {   if(h.containsKey(j)) {    ArrayList<Integer> m = h.get(j);    for(int k=0;k<m.size();k++) {    visited[m.get(k)]=true;    }    h.remove(j);   }   }  }  }  System.out.println(ctr); } }
4	public class Solution {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   String s = in.nextLine();   int ans = 0;   outer: for (int i = s.length() - 1; i >= 1; i--)    for (int j = 0; j < s.length() - i; j++) {     String sub = s.substring(j, j + i);     String str = s.substring(j + 1);     if (str.contains(sub)) {      ans = i;      break outer;     }    }   out.print(ans);   out.close();  } }
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();  } }
1	public class D999 {  public static void main(String args[])throws IOException  {   Scanner sc=new Scanner(System.in);   int n=sc.nextInt();   int m=sc.nextInt();   int req=n/m;   int arr[]=new int[n+1];   int size[]=new int[m];   List<Integer> list[]=new ArrayList[m];   for(int i=0;i<m;i++)   {    list[i]=new ArrayList<>();   }   for(int i=1;i<=n;i++)   {    arr[i]=sc.nextInt();    size[arr[i]%m]++;    list[arr[i]%m].add(i);   }   long tot=0;int x=0,y=0;   List<Integer> idx=new ArrayList<>();   for(int i=0;i < 2*m;i++)   {       if(size[i%m]>req)    {     for(int j=0;j<size[i%m]-req;j++)     {      idx.add(list[i%m].get(j));      y++;          }     size[i%m]=req;        }    else if(size[i%m]<req)    {         while(x!=y && size[i%m]<req)     {      int num=arr[idx.get(x)];      int gg=i-num%m;      tot+=gg;      arr[idx.get(x)]+=gg;      x++;      size[i%m]++;     }    }   }   System.out.println(tot);   for(int i=1;i<=n;i++)   {    System.out.print(arr[i]+" ");   }  } }
3	public class PythonIndentiation { PrintWriter pw = new PrintWriter(System.out); final static boolean debugmode = true; public static int k = 7;  public static int STMOD = 1000000000 + k;  public static Reader sc = new Reader();  public static void main(String[] args) throws IOException {  int commands = sc.nextInt();  int[][] dp = new int[5000][5000];  int interesting = 0;  String prgm = "";  while (interesting < commands){  byte q = sc.read();  if (q == 115 ){   interesting += 1;   prgm += "s";  }  else if (q == 102){   prgm += "f";   interesting += 1;  }  }   dp[0][0] = 1;  for(int line = 1;line<commands;line++){  if(prgm.charAt(line-1) == 'f'){   for(int indent = 1;indent<Math.min(2*line + 1, 5000);indent++){   dp[line][indent] = dp[line-1][indent-1];   }  }  else if(prgm.charAt(line-1) == 's'){   int w = 0;   for(int indent = Math.min(2*line + 1, 4999);indent >= 0;indent--){   w = (w + dp[line-1][indent])% STMOD;      dp[line][indent] = w ;   }  }  }  int q = 0;  for(int i = 0;i<5000;i++){  q = ( q + dp[commands-1][i] ) % STMOD;  }  System.out.println(q);     } public static String parseIt(int commands) throws IOException{  String c = "";  System.out.println(sc.read());  return c; } 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();   }  }   }
5	public class AA {  static class Pair implements Comparable<Pair> {  public int x, y;  public Pair(int x, int y) {  this.x = x;  this.y = y;  }  public int compareTo(Pair p) {  if (p.x != x)   return x - p.x;  return y - p.y;  } }  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  int t = in.nextInt() * 2;  List<Pair> l = new ArrayList<Pair>();  for (int i = 0; i < n; i++) {  int c = in.nextInt() * 2;  int a = in.nextInt();  l.add(new Pair(c - a, c + a));  }  Collections.sort(l);  int ret = 2;  for (int i = 1; i < n; i++) {  if (l.get(i).x - l.get(i-1).y > t)   ret += 2;  else if (l.get(i).x - l.get(i-1).y == t)   ret += 1;  }  System.out.println(ret); } }
6	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int V = in.nextInt();   int E = in.nextInt();   boolean [][] G = new boolean [V][V];   for (int i = 0; i < E; i++) {    int u = in.nextInt()-1;    int v = in.nextInt()-1;    G[u][v] = true;    G[v][u] = true;   }     int pset = 1 << V;     long [][] dp = new long [pset][V];   long cycles = 0;     for (int set = 1; set < pset; set++) {    int bit = Integer.bitCount(set);    int src = first(set);       if (bit == 1) {     dp[set][src] = 1;    }    else if(bit > 1) {     for (int i = 0; i < V; i++) {      if(i == src) continue;           if ((set & (1 << i)) != 0) {       int S_1 = set ^ (1 << i);       for (int v = 0; v < V; v++) {        if (G[v][i] == true) {         dp[set][i] += dp[S_1][v];        }       }      }           if (bit >= 3 && G[src][i]) {       cycles += dp[set][i];      }      }        }              }   System.out.println(cycles/2);  }   public static int first(int n) {   int cnt = 0;   while ((n & 1) != 1) {    cnt++;    n >>= 1;   }   return cnt;  } }
3	public class Codeshefcode{ public static void main(String[] args) throws IOException{  Solver Machine = new Solver() ;  Machine.Solve() ;  Machine.Finish() ;                           } } 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) ; long dp[][] ; public void Solve() throws IOException{  int n = ip.i() ;  int arr[] = new int[n] ;  dp = new long[n][n] ;  for(int i=0 ; i<n ; i++)  for(int j=0 ; j<n ; j++)   dp[i][j]=-1 ;  for(int i=0 ; i<n ; i++){  String s = ip.s() ;  if(s.compareTo("s")==0) arr[i]=0 ;  else if(s.compareTo("f")==0) arr[i]=1 ;  else throw new IOException() ;  }  for(int j=0 ; j<n ; j++) dp[n-1][j] = 1 ;  for(int i=(n-2) ; i>=0 ; i--){  long cuml[] = new long[n] ;  for(int j=0 ; j<n ; j++) cuml[j] = (dp[i+1][j]+(j==0 ? 0 : cuml[j-1]))%Mod.mod ;  for(int j=0 ; j<n ; j++)   dp[i][j] = (arr[i]==0 ? cuml[j] : (j==(n-1) ? -1 : dp[i+1][j+1])) ;  }  pln(dp[0][0]) ; } void Finish(){  op.flush();  op.close(); } void p(Object o){  op.print(o) ; } void pln(Object o){  op.println(o) ; }  } class mylist extends ArrayList<String>{} 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()) ; } }
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));  }  }
5	public class Main {  protected static final double EPS = 1e-11;  private static StreamTokenizer in;  private static Scanner ins;  private static PrintWriter out;  protected static final Double[] BAD = new Double[]{null, null};  private boolean[][] layouts;  private int c;  private int b;  private int a;  private String word;  public static void main(String[] args) {   try {    in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));    ins = new Scanner(new BufferedReader(new InputStreamReader(System.in)));    out = new PrintWriter(System.out);    try {     if (System.getProperty("xDx") != null) {      in = new StreamTokenizer(new BufferedReader(new FileReader("input.txt")));      ins = new Scanner(new FileReader("input.txt"));      out = new PrintWriter(new FileWriter("output.txt"));     }    } catch (Exception e) {     in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));     ins = new Scanner(new BufferedReader(new InputStreamReader(System.in)));     out = new PrintWriter(System.out);    }    new Main().run();   } catch (Throwable e) {    throw new RuntimeException(e);   } finally {    out.close();   }  }  private int nextInt() throws IOException {   in.nextToken();   return (int) in.nval;  }  private long nextLong() throws IOException {   in.nextToken();   return (long) in.nval;  }  private double nextDouble() throws IOException {   in.nextToken();   return in.nval;  }  private String nextString() throws IOException {   in.nextToken();   return in.sval;  }  private char nextChar() throws IOException {   in.nextToken();   return (char) in.ttype;  }  private void run() throws Exception {     solve();  }  private void solve() throws IOException {   int n = nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = nextInt();   }   Map<Long, Integer> map = new HashMap<>();   BigInteger res = BigInteger.ZERO;   long sum = 0;   long amount = 0;   for (int i = n - 1; i >= 0; i--) {    long cur = a[i];    Pair same = getZeroAmount(cur, map);    res = res.add(BigInteger.valueOf((sum - same.sum) - cur * (amount - same.amount)));    amount++;    sum += cur;    map.put(cur, map.getOrDefault(cur, 0) + 1);   }   out.println(res);  }  class Pair {   long amount;   long sum;   public Pair(long amount, long sum) {    this.amount = amount;    this.sum = sum;   }  }  private Pair getZeroAmount(long cur, Map<Long, Integer> map) {   long amount = 0;   long sum = 0;   for (long i = cur - 1; i <= cur + 1; i++) {    long amountI = map.getOrDefault(i, 0);    amount += amountI;    sum += amountI * i;   }   return new Pair(amount, sum);  }  private List<Integer> iterate(List<Integer> a) {   ArrayList<Integer> b = new ArrayList<>();   int prev = -1;   for (int x : a) {    if (x == prev) {     b.add(x);    } else {     prev = x;    }   }   return b;  }  private long gcd(long a, long b) {   while (a > 0 && b > 0) {    long k = a % b;    a = b;    b = k;   }   return a | b;  } }
2	public class Main{   public static void main(String[] args){  Scanner ak=new Scanner(System.in);  long n,k,x;  n=ak.nextLong();  k=ak.nextLong();  x=(long)((-3+Math.sqrt(9+8*(n+k)))/2);  System.out.println(n-x); } }
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 {   BigInteger mod = new BigInteger("1000000007");   public void solve(int testNumber, InputReader in, PrintWriter out) {    BigInteger x = new BigInteger(in.next());    BigInteger k = new BigInteger(in.next());    if (x.longValue() == 0) {     out.print(x);     return;    }    BigInteger pow = powerWithMod(new BigInteger("2"), k);    BigInteger current = x.mod(mod).multiply(pow).mod(mod);    BigInteger result = current.multiply(new BigInteger("2")).mod(mod)      .subtract(pow.subtract(new BigInteger("1")).mod(mod))      .mod(mod);    out.print(result);   }   BigInteger powerWithMod(BigInteger base, BigInteger exponent) {    if (exponent.longValue() == 0) {     return new BigInteger("1");    }    BigInteger temp = powerWithMod(base, exponent.divide(new BigInteger("2")));    BigInteger term = temp.mod(mod);    if (exponent.mod(new BigInteger("2")).intValue() == 0) {     return term.multiply(term.mod(mod)).mod(mod);    } else {     return term.multiply(term.mod(mod)).multiply(base.mod(mod)).mod(mod);    }   }  }  static 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();   }  } }
1	public class Main {    void run() throws IOException {   int n = in.nextInt();   char[] c = in.next().toCharArray();   int[][] t = new int[n][n];   int[][] h = new int[n][n];   int allt = 0, allh = 0;   for (int i = 0; i < n; i++) {    if (c[i] == 'T') {     allt++;    } else {     allh++;    }   }   for (int i = 0; i < n; i++) {    if (c[i] == 'T') {     t[i][i] = 1;     h[i][i] = 0;    } else {     t[i][i] = 0;     h[i][i] = 1;    }    for (int j = i + 1; j < n; j++) {     if (c[j] == 'T') {      t[i][j] = t[i][j - 1] + 1;      h[i][j] = h[i][j - 1];     } else {      h[i][j] = h[i][j - 1] + 1;      t[i][j] = t[i][j - 1];     }    }   }   for (int i = 1; i < n; i++) {    t[i][i - 1] = allt;    h[i][i - 1] = allh;    for (int j = 0; j < i - 1; j++) {     t[i][j] = allt - t[j + 1][i - 1];     h[i][j] = allh - h[j + 1][i - 1];    }   }   int r = Integer.MAX_VALUE;   for (int i = 0; i < n; i++) {    for (int j = 0; j < n; j++) {         if (h[i][j] == t[(j + 1) % n][(i - 1 + n) % n]) {      r = min(r, h[i][j]);     }     if (t[i][j] == h[(j + 1) % n][(i - 1 + n) % n]) {      r = min(r, t[i][j]);     }    }   }   out.println(r);    }  class pair implements Comparable <pair> {   int x, y;   pair(int x, int y) {    this.x = x;    this.y = y;      }   public int compareTo (pair p) {    if (x != p.x) {     return x - p.x;    } else {     return y - p.y;    }   }  }  static PrintWriter out;  static Scanner in;  public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);     in = new Scanner (System.in); out = new PrintWriter (System.out);   new Main().run();     out.close();  } }
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();    }   }  } }
5	public class Abra {  public static void main(String[] args) throws IOException {   new Abra().run();  }  StreamTokenizer in;  PrintWriter out;  boolean oj;  void init() throws IOException {   oj = System.getProperty("ONLINE_JUDGE") != null;   Reader reader = oj ? new InputStreamReader(System.in) : new FileReader(     "input.txt");   Writer writer = oj ? new OutputStreamWriter(System.out)     : new FileWriter("output.txt");     in = new StreamTokenizer(new BufferedReader(reader));   out = new PrintWriter(writer);  }  void run() throws IOException {   long beginTime = System.currentTimeMillis();   init();   solve();   out.flush();  }  void printMem() {   if (!oj) {    System.out.println("Memory used = "      + (Runtime.getRuntime().totalMemory() - Runtime        .getRuntime().freeMemory()));   }  }  int nextInt() throws IOException {   in.nextToken();   return (int) in.nval;  }  long nextLong() throws IOException {   in.nextToken();   return (long) in.nval;  }  String nextString() throws IOException {   in.nextToken();   return in.sval;  }  double nextDouble() throws IOException {   in.nextToken();   return in.nval;  }  long deg(long x, long y) {   long a = x;   for (long i = 2; i <= y; i++) {    a *= x;   }   return a;  }  long fact(long x) {   long a = 1;   for (long i = 2; i <= x; i++) {    a *= i;   }   return a;  }  long digitSum(String x) {   long a = 0;   for (int i = 0; i < x.length(); i++) {    a += x.codePointAt(i) - 48;   }   return a;  }  long digitSum(long x) {   long a = 0;   while (x > 0) {    a += x % 10;    x /= 10;   }   return a;  }  long digitMul(long x) {   long a = 1;   while (x > 0) {    a *= x % 10;    x /= 10;   }   return a;  }  double pif(double ax, double ay, double bx, double by) {   return Math.sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));  }  double getPosPart(double x) {   if (x <= 0)    return 0;   else    return x;  }  double max(double x, double y) {   if (x > y)    return x;   else    return y;  }  long gcd(long a, long b) {   if (a < b) {    long c = b;    b = a;    a = c;   }   while (a % b != 0) {    a = a % b;    if (a < b) {     long c = b;     b = a;     a = c;    }   }   return b;  }  int gcd(int a, int b) {   if (a < b) {    int c = b;    b = a;    a = c;   }   while (a % b != 0) {    a = a % b;    if (a < b) {     int c = b;     b = a;     a = c;    }   }   return b;  }  long lcm(long a, long b) throws IOException {   return a * b / gcd(a, b);  }  int lcm(int a, int b) throws IOException {   return a * b / gcd(a, b);  }  int countOccurences(String x, String y) {   int a = 0, i = 0;   while (true) {    i = y.indexOf(x);    if (i == -1)     break;    a++;    y = y.substring(i + 1);   }   return a;  }  int[] primes;  int findPrimes(int x) {   boolean[] forErato = new boolean[x];   primes = new int[x];   int l = 0, j = 0;   for (int i = 2; i < x; i++) {    if (forErato[i])     continue;    l++;    primes[l] = i;    j = i * 2;    while (j < x) {     forErato[j] = true;     j += i;    }   }   return l;  }  int rev(int x) {   int a = 0;   while (x > 0) {    a = a * 10 + x % 10;    x /= 10;   }   return a;  }  class myDate {   int d, m, y;   public myDate(int da, int ma, int ya) {    d = da;    m = ma;    y = ya;   }   int[] ml = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };   void inc() {    if ((d == 31) && (m == 12)) {     y++;     d = 1;     m = 1;    } else {     if (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)) {      ml[1] = 29;     }     if (d == ml[m - 1]) {      m++;      d = 1;     } else      d++;    }   }  }  int partition(int n, int l, int m) {     if (n < l)    return 0;   if (n < l + 2)    return 1;   if (l == 1)    return 1;   int c = 0;   for (int i = Math.min(n - l + 1, m); i >= (n + l - 1) / l; i--) {    c += partition(n - i, l - 1, i);   }   return c;  }  void solve() throws IOException {   int n = nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = nextInt();   }   Arrays.sort(a);   int min = a[0];   for (int i = 1; i < n; i++) {    if (a[i] != min) {     out.print(a[i]);     return;    }   }   out.print("NO");  } }
3	public class A {  public void realMain() throws Exception {  BufferedReader fin = new BufferedReader(new InputStreamReader(System.in), 1000000);  String in = fin.readLine();  String[] ar = in.split(" ");  int n = Integer.parseInt(ar[0]);   int[] a = new int[n];  for(int i = 0; i < n; i++) {  int ret = 0;  boolean dig = false;  for (int ch = 0; (ch = fin.read()) != -1; ) {    if (ch >= '0' && ch <= '9') {      dig = true;      ret = ret * 10 + ch - '0';    } else if (dig) break;   }   a[i] = ret;    }  int ret = 0;  Arrays.sort(a);  boolean[] colored = new boolean[n];  for(int i = 0; i < n; i++) {  if(!colored[i]) {   ret++;   for(int j = i; j < n; j++) {   if(a[j] % a[i] == 0) {    colored[j] = true;   }   }  }  }  System.out.println(ret);   }  public static void main(String[] args) throws Exception {  A a = new A();  a.realMain(); } }
2	public class template {  private InputStream is;  private PrintWriter pw;  static char[][] ch;  static int x1,x2,y1,y2,n,m,h,k;  static long dist[][];  static boolean boo[][];   void soln()  {  is = System.in;  pw = new PrintWriter(System.out);  long s = System.currentTimeMillis();  solve();  pw.close();  pw.flush();    }   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 template().soln();  }   void solve()  {  long n = nl(), k = nl();  if(n==0){   pw.println(0);   return;  }  long MOD = 1000000007;  long pow1 = pow(2,k,MOD), pow2 = pow(2,k+1,MOD);  pw.println(((((n%MOD)*pow2)%MOD) - (pow1-1+MOD)%MOD + 2*MOD)%MOD);  pw.close();  }  long pow(long x, long y, long mod){  long ans = 1;  while(y>0){   if(y%2==0) {   x *= x;   x %= mod;   y/=2;   }   else{   ans *= x;   ans %= mod;   y-=1;   }  }  return ans;  }  long gcd(long a, long b){  if(b==0) return a;  return gcd(b,a%b);  }  void printArray(long[] arr) {  for(long i : arr) pw.print(i +" ");  pw.println();  } static long min(long x, long y){  return (x<y)?x:y; } static class Pair implements Comparable<Pair>{  long val;  int x, y;  Pair(long v, int a, int b){  val = v; x = a; y = b;  }  public int compareTo(Pair p){  return Long.compare(this.val,p.val);  } } private static class Queue{  int st = 0;  int et = 0;  Pair[] arr;  public Queue(int len) {  arr = new Pair[len];  }  public boolean isEmpty() {  return st==et;  }  public void add(Pair x) {  arr[et++] = x;  }  public Pair poll() {  return arr[st++];  }  public void clear() {  st = et = 0;  } }        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;  }     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));  } }
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); } }
5	public class A {  public static void main(String[] args) {   A problem = new A();   problem.solve();  }  private void solve() {   Scanner sc = new Scanner(System.in);      int n = sc.nextInt();     int p = sc.nextInt();   int v = sc.nextInt();     long a[] = new long[n];     for (int i = 0; i < n; i++) {    a[i] = sc.nextLong();   }     long aux;   for(int i = 0; i < n -1; i++){    for(int j = i + 1; j < n; j++){      if((a[i]) > (a[j])){      aux = a[j];      a[j] = a[i];      a[i] = aux;     }    }   }     System.out.println(a[v]-a[v-1]);       } }
4	public class Main {  static class Fast {  StringTokenizer st;  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  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());  } }  static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));  static Fast scn = new Fast();  public static void main(String args[]) throws Exception {   int t = 1;   while(t-- > 0){    func();   }   bw.close();  }  private static void func() throws Exception{   int n = scn.nextInt();   int m = scn.nextInt();   int k = scn.nextInt();   int[][] hori = new int[n][m - 1];   int[][] vert = new int[n - 1][m];   for(int i = 0; i < n; i++){    for(int j = 0; j < m - 1; j++){     hori[i][j] = scn.nextInt();    }   }   for(int i = 0; i < n - 1; i++){    for(int j = 0; j < m; j++){     vert[i][j] = scn.nextInt();    }   }   if(k % 2 != 0){    for(int i = 0; i < n; i++){     for(int j = 0; j < m; j++){      bw.append(-1 + " ");     }     bw.append("\n");    }    return;   }   int[][][] strg = new int[n][m][k + 1];               int[][] answer = new int[n][m];   for(int i = 0; i < n; i++){    for(int j = 0; j < m; j++){     answer[i][j] = steps(i, j, hori, vert, k, strg);    }   }  for(int i = 0; i < n; i++){   for(int j = 0; j < m; j++){    bw.append(answer[i][j] + " ");   }   bw.append("\n");  }    }  static int steps(int x, int y, int[][] hori, int[][] vert, int k, int[][][] strg){   if(k == 0)    return 0;   if(strg[x][y][k] != 0)    return strg[x][y][k];   int xmove = x;   int ymove = y;   int ans = 0;   int val = Integer.MAX_VALUE;   if(y < hori[0].length){    xmove = x;    ymove = y + 1;    val = Math.min(val, steps(xmove, ymove, hori, vert, k - 2, strg) + (2 * hori[x][y]));   }   if(y - 1 >= 0){    xmove = x;    ymove = y - 1;    val = Math.min(val, steps(xmove, ymove, hori, vert, k - 2, strg) + (2 * hori[x][y - 1]));      }   if(x - 1 >= 0){    xmove = x - 1;    ymove = y;    val = Math.min(val, steps(xmove, ymove, hori, vert, k - 2, strg) + (2 * vert[x - 1][y]));      }   if(x < vert.length){    xmove = x + 1;    ymove = y;    val = Math.min(val, steps(xmove, ymove, hori, vert, k - 2, strg) + (2 * vert[x][y]));      }     ans += val;   return strg[x][y][k] = ans;  } }
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 A {  static BufferedReader bf = new BufferedReader(new InputStreamReader(  System.in)); static StringTokenizer st; static PrintWriter out = new PrintWriter(System.out);  static String nextToken() throws IOException {  while (st == null || !st.hasMoreTokens()) {  String s = bf.readLine();  if (s == null)   return null;  st = new StringTokenizer(s);  }  return st.nextToken(); }  static int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  static long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  static String nextStr() throws IOException {  return nextToken(); }  static double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  public static void main(String[] args) throws IOException {  int n = nextInt();  int a[] = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  Arrays.sort(a);   for (int q = 0; q < n; q++) {  if (a[q] != 1) {   out.print("1");   for (int i = 1; i < n; i++) {   out.print(" " + a[i - 1]);   }   out.flush();   return;  }  }   for (int i = 0; i < n - 1; i++) {  out.print("1 ");  }  out.println("2");  out.flush();    } }
0	public class C994{ static double area(double x1,double y1,double x2,double y2,double x3,double y3){  return Math.abs((x1 * (y2 - y3) +   x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0);  } public static void main(String args[])throws IOException{  Scanner sc=new Scanner(new BufferedReader(new InputStreamReader(System.in)));  PrintWriter pw=new PrintWriter(System.out);  int x11=sc.nextInt();  int y11=sc.nextInt();  int x12=sc.nextInt();  int y12=sc.nextInt();  int x13=sc.nextInt();  int y13=sc.nextInt();  int x14=sc.nextInt();  int y14=sc.nextInt();  double x1c=(x11+x12+x13+x14)/4.0;  double y1c=(y11+y12+y13+y14)/4.0;  int x21=sc.nextInt();  int y21=sc.nextInt();  int x22=sc.nextInt();  int y22=sc.nextInt();  int x23=sc.nextInt();  int y23=sc.nextInt();  int x24=sc.nextInt();  int y24=sc.nextInt();  double x2c=(x21+x22+x23+x24)/4.0;  double y2c=(y21+y22+y23+y24)/4.0;  double a1=area(x11,y11,x12,y12,x13,y13)+area(x11,y11,x13,y13,x14,y14);  double a2=area(x21,y21,x22,y22,x23,y23)+area(x21,y21,x23,y23,x24,y24);  if(a1==area(x11,y11,x12,y12,x21,y21)+area(x11,y11,x21,y21,x14,y14)+area(x21,y21,x12,y12,x13,y13)+area(x21,y21,x14,y14,x13,y13)){  pw.println("YES");  pw.close();  return;  }  if(a1==area(x11,y11,x12,y12,x22,y22)+area(x11,y11,x22,y22,x14,y14)+area(x22,y22,x12,y12,x13,y13)+area(x22,y22,x14,y14,x13,y13)){  pw.println("YES");  pw.close();  return;  }  if(a1==area(x11,y11,x12,y12,x23,y23)+area(x11,y11,x23,y23,x14,y14)+area(x23,y23,x12,y12,x13,y13)+area(x23,y23,x14,y14,x13,y13)){  pw.println("YES");  pw.close();  return;  }  if(a1==area(x11,y11,x12,y12,x24,y24)+area(x11,y11,x24,y24,x14,y14)+area(x24,y24,x12,y12,x13,y13)+area(x24,y24,x14,y14,x13,y13)){  pw.println("YES");  pw.close();  return;  }  if(a1==area(x11,y11,x12,y12,x2c,y2c)+area(x11,y11,x2c,y2c,x14,y14)+area(x2c,y2c,x12,y12,x13,y13)+area(x2c,y2c,x14,y14,x13,y13)){  pw.println("YES");  pw.close();  return;  }  if(a2==area(x21,y21,x22,y22,x11,y11)+area(x21,y21,x11,y11,x24,y24)+area(x11,y11,x22,y22,x23,y23)+area(x11,y11,x24,y24,x23,y23)){  pw.println("YES");  pw.close();  return;  }  if(a2==area(x21,y21,x22,y22,x12,y12)+area(x21,y21,x12,y12,x24,y24)+area(x12,y12,x22,y22,x23,y23)+area(x12,y12,x24,y24,x23,y23)){  pw.println("YES");  pw.close();  return;  }  if(a2==area(x21,y21,x22,y22,x13,y13)+area(x21,y21,x13,y13,x24,y24)+area(x13,y13,x22,y22,x23,y23)+area(x13,y13,x24,y24,x23,y23)){  pw.println("YES");  pw.close();  return;  }  if(a2==area(x21,y21,x22,y22,x14,y14)+area(x21,y21,x14,y14,x24,y24)+area(x14,y14,x22,y22,x23,y23)+area(x14,y14,x24,y24,x23,y23)){  pw.println("YES");  pw.close();  return;  }  if(a2==area(x21,y21,x22,y22,x1c,y1c)+area(x21,y21,x14,y14,x2c,y2c)+area(x1c,y1c,x22,y22,x23,y23)+area(x1c,y1c,x24,y24,x23,y23)){  pw.println("YES");  pw.close();  return;  }   pw.println("NO");  pw.close(); } }
6	public class Main{ static int[][]memo; static int n,m,in[][]; static int dp(int col,int maxRowMask) {  if(col>=m)return 0;  if(memo[col][maxRowMask]!=-1)return memo[col][maxRowMask];   int ans=0;   for(int colMask=0;colMask<(1<<n);colMask++) {    int sum=0;  for(int i=0;i<n;i++) {   if(((colMask>>i)&1)!=0) {   sum+=in[i][col];   }  }  int curMask=colMask;  for(int cyclicShift=0;cyclicShift<n;cyclicShift++) {   if((curMask&maxRowMask)!=0) {   int lastBit=curMask&1;   curMask>>=1;   curMask|=(lastBit<<(n-1));   continue;   }     ans=Math.max(ans, sum+dp(col+1, maxRowMask|curMask));     int lastBit=curMask&1;   curMask>>=1;   curMask|=(lastBit<<(n-1));     }    }  return memo[col][maxRowMask]=ans; } public static void main(String[] args) throws Exception{  pw=new PrintWriter(System.out);  sc = new MScanner(System.in);  int tc=sc.nextInt();  while(tc-->0) {  n=sc.nextInt();m=sc.nextInt();  in=new int[n][m];  for(int i=0;i<n;i++)in[i]=sc.intArr(m);  memo=new int[m][1<<n];  for(int i=0;i<m;i++)Arrays.fill(memo[i], -1);  pw.println(dp(0, 0));  }     pw.flush(); } static PrintWriter pw; static MScanner sc; static class MScanner {  StringTokenizer st;  BufferedReader br;  public MScanner(InputStream system) {  br = new BufferedReader(new InputStreamReader(system));  }   public MScanner(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 int[] intArr(int n) throws IOException {   int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();   return in;  }  public long[] longArr(int n) throws IOException {   long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();   return in;  }  public int[] intSortedArr(int n) throws IOException {   int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();   shuffle(in);   Arrays.sort(in);   return in;  }  public long[] longSortedArr(int n) throws IOException {   long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();   shuffle(in);   Arrays.sort(in);   return in;  }  public Integer[] IntegerArr(int n) throws IOException {   Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();   return in;  }  public Long[] LongArr(int n) throws IOException {   Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();   return in;  }  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);  } } static void shuffle(int[]in) {  for(int i=0;i<in.length;i++) {  int idx=(int)(Math.random()*in.length);  int tmp=in[i];  in[i]=in[idx];  in[idx]=tmp;  } } static void shuffle(long[]in) {  for(int i=0;i<in.length;i++) {  int idx=(int)(Math.random()*in.length);  long tmp=in[i];  in[i]=in[idx];  in[idx]=tmp;  } } }
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 A {  BufferedReader in;  StringTokenizer st;  PrintWriter out;  static class House implements Comparable<House> {   final int x, a;   House(int x, int a) {    this.x = x;    this.a = a;   }   public int compareTo(House h) {    return x - h.x;   }  }  void solve() throws IOException {   int n = nextInt();   int t = nextInt();   House[] h = new House[n];   for (int i = 0; i < n; ++i) {    h[i] = new House(2 * nextInt(), nextInt());   }   Arrays.sort(h);   int ans = 2;   for (int i = 1; i < n; ++i) {    House prev = h[i - 1];    House curr = h[i];    int diff = 2 * t + curr.a + prev.a;    if (curr.x - prev.x == diff) {     ++ans;    } else if (curr.x - prev.x > diff) {     ans += 2;    }   }   out.println(ans);  }  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();  } }
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);   SameSumBlocks solver = new SameSumBlocks();   solver.solve(1, in, out);   out.close();  }  static class SameSumBlocks {   int N;   public void solve(int testNumber, InputReader in, PrintWriter out) {    N = in.nextInt();    int[] arr = new int[N];    for (int i = 1; i <= N; i++) {     arr[i - 1] = in.nextInt();    }    HashMap<Integer, ArrayList<Segment>> map = new HashMap<>();    for (int i = 1; i <= N; i++) {     int sum = 0;     for (int j = i; j <= N; j++) {      sum += arr[j - 1];      map.putIfAbsent(sum, new ArrayList<>());      map.get(sum).add(new Segment(i, j));     }    }    int resI = 0;    int resVal = 0;    int sum = 0;    if (arr.length > 1 && arr[1] == -999) {     for (int i = 11; i < 130; i++) {      sum += arr[i];     }    }    for (int key : map.keySet()) {     if (map.get(key).size() > resI) {      int next = largestNon(map.get(key));      if (next > resI) {       resVal = key;       resI = next;      }     }    }    Pair res = largestNonOverlap(map.get(resVal));    out.println(resI);    for (int i = 0; i < resI; i++) {     out.println(res.used.get(i).li + " " + res.used.get(i).ri);    }   }   int largestNon(ArrayList<Segment> arr) {    Collections.sort(arr, new Comparator<Segment>() {     public int compare(Segment o1, Segment o2) {      return Integer.compare(o1.ri, o2.ri);     }    });    SameSumBlocks.SegmentTree seg = new SameSumBlocks.SegmentTree(N + 1);    for (int i = 0; i < arr.size(); i++) {     seg.add(arr.get(i).ri, arr.get(i).ri, 1 + seg.query(0, arr.get(i).li - 1).mx);    }    return seg.query(0, N).mx;   }   Pair largestNonOverlap(ArrayList<Segment> arr) {    Segment[] segs = new Segment[N + 1];    int[] dp = new int[N + 1];    for (int i = 0; i <= N; i++) {     segs[i] = new Segment(-1, 0);    }    for (Segment s : arr) {     if (s.li > segs[s.ri].li) {      segs[s.ri] = s;     }    }    int[] used = new int[N + 1];    for (int i = 1; i <= N; i++) {     dp[i] = dp[i - 1];     used[i] = used[i - 1];     if (segs[i].li != -1) {      if (dp[i] < dp[segs[i].li - 1] + 1) {       used[i] = i;       dp[i] = dp[segs[i].li - 1] + 1;      }     }    }    ArrayList<Segment> res = new ArrayList<>();    int u = used[N];    while (segs[u].li > 0) {     res.add(segs[u]);     u = used[segs[u].li - 1];    }    return new Pair(dp[N], res);   }   class Segment {    int li;    int ri;    Segment() {    }    Segment(int li, int ri) {     this.li = li;     this.ri = ri;    }   }   class Pair {    int val;    ArrayList<Segment> used = new ArrayList<>();    Pair(int val, ArrayList<Segment> used) {     this.val = val;     this.used = used;    }   }   static class SegmentTree {    Node[] tree;    int size = 0;    public Node none() {         Node res = new Node();     return res;    }    public SegmentTree(int N) {     tree = new Node[4 * N];     size = N;     for (int i = 0; i < 4 * N; i++) {      tree[i] = new Node();     }    }    Node combine(Node a, Node b) {         Node res = new Node();     res.mx = Math.max(a.mx, b.mx);     return res;    }    public Node query(int l, int r) {     return queryUtil(1, 0, size - 1, l, r);    }    public Node queryUtil(int n, int tl, int tr, int l, int r) {         if (l > r) {      return none();     }     if (tl == l && tr == r) {      return tree[n];     }     int tm = (tl + tr) / 2;     return combine(queryUtil(2 * n, tl, tm, l, Math.min(r, tm)), queryUtil(2 * n + 1, tm + 1, tr, Math.max(tm + 1, l), r));    }    public void add(int l, int r, int val) {         addUtil(1, 0, size - 1, l, r, val);    }    public void addUtil(int n, int tl, int tr, int l, int r, int val) {     if (l > r) {      return;     }     if (tl == l && tr == r) {      tree[n].update(val);     } else {      int tm = (tl + tr) / 2;      addUtil(2 * n, tl, tm, l, Math.min(tm, r), val);      addUtil(2 * n + 1, tm + 1, tr, Math.max(l, tm + 1), r, val);      tree[n] = combine(tree[2 * n], tree[2 * n + 1]);     }    }    class Node {     int mx = 0;     int lzy = 0;     void update(int val) {      mx = Math.max(mx, val);      lzy += val;     }    }   }  }  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 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();   } } }
5	public class l {               static long mod = (int) (1e9 + 7);  static int n;  static StringBuilder sol;  static class pair implements Comparable<pair> {   int L,R;   public pair( int x,int y) {    L=x;R=y;   }    public int compareTo(pair o) {    if (L!=o.L)return L-o.L;    return o.R-R;   }   public String toString(){    return L+" "+R;   }  }  static boolean is;  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);     PrintWriter pw = new PrintWriter(System.out);   int m = sc.nextInt();   int n = sc.nextInt();   int q = sc.nextInt();   TreeSet<Integer>length= new TreeSet<>();   length.add(0);   length.add(n);   TreeSet<Integer>width= new TreeSet<>();   width.add(0);   width.add(m);   TreeMap<Integer,Integer>len= new TreeMap<>();   len.put(n,1);   TreeMap<Integer,Integer>wid= new TreeMap<>();   wid.put(m,1);   while (q-->0){    String t= sc.next();    if (t.equals("H")) {     int x = sc.nextInt();     int k1 = length.ceiling(x);     int k2 = length.floor(x);     if (x != k1) {      int s = k1 - k2;      int con = len.get(s);      if (con == 1) len.remove(s);      else len.put(s, con - 1);      len.put((k1 - x), len.getOrDefault((k1 - x), 0) + 1);      len.put((x - k2), len.getOrDefault((x - k2), 0) + 1);      length.add(x);     }    }    else {     int x = sc.nextInt();     int k1 = width.ceiling(x);     int k2 = width.floor(x);     if (x != k1) {      int s = k1 - k2;           int con = wid.get(s);      if (con == 1) wid.remove(s);      else wid.put(s, con - 1);      wid.put((k1 - x), wid.getOrDefault((k1 - x), 0) + 1);      wid.put((x - k2), wid.getOrDefault((x - k2), 0) + 1);      width.add(x);     }    }    pw.println(1l*len.lastKey()*wid.lastKey());   }   pw.flush();  }  static class Scanner {   StringTokenizer st;   BufferedReader br;   public Scanner(FileReader r) {    br = new BufferedReader(r);   }   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 cf5722{ 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 k=Long.parseLong(st.nextToken());   long ans=((-3-(long)Math.sqrt(9+4*(1*2*(n+k))))/2);  long ans1=((-3+(long)Math.sqrt(9+4*(1*2*(n+k))))/2);  if(ans>0)  System.out.println(n-ans);  else{  System.out.println(n-ans1);  }  } }
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) {    int n = in.readInt();    boolean[] isF = new boolean[n];    for (int i = 0; i < n; i++) {     isF[i] = in.readCharacter() == 'f';    }    long[][] mem = new long[n + 1][n + 1];    mem[n][0] = 1;    for (int idx = n - 1; idx >= 0; idx--) {     for (int indentLevel = 0; indentLevel < n; indentLevel++) {      mem[idx + 1][indentLevel + 1] += mem[idx + 1][indentLevel];      long res = isF[idx] ?        mem[idx + 1][indentLevel + 1] - mem[idx + 1][indentLevel] :        mem[idx + 1][indentLevel];      mem[idx][indentLevel] = res % MiscUtils.MOD7;     }    }    out.printLine(mem[0][0]);   }  }  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 char readCharacter() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    return (char) c;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  static class MiscUtils {   public static final int MOD7 = (int) (1e9 + 7);  }  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 close() {    writer.close();   }   public void printLine(long i) {    writer.println(i);   }  } }
2	public class Main { static StreamTokenizer st = new StreamTokenizer(new BufferedInputStream(System.in)); static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter pr = new PrintWriter(new BufferedOutputStream(System.out)); static Scanner sc = new Scanner(System.in);  public static void main(String[] args) throws NumberFormatException, IOException {  int a = sc.nextInt();  int b = sc.nextInt();  int i = 0;  int cont = 0;  while(cont<b) {  i++;  cont+=i;  }   if(i+cont-b==a) {  System.out.println(cont-b);  }else {  while(i+cont-b!=a) {   i++;   cont+=i;  }  System.out.println(cont-b);  } }  private static int nextInt() {  try {  st.nextToken();  } catch (IOException e) {  e.printStackTrace();  }  return (int) st.nval; } }
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); } }
4	public class Main { public static void main(String[] args) throws IOException {  new Thread(null, new Runnable() {  public void run() {   try {   try {    if (new File("input.txt").exists())    System.setIn(new FileInputStream("input.txt"));   } catch (SecurityException e) {}   new Main().run();   } catch (IOException e) {   e.printStackTrace();   }  }  }, "1", 1L << 24).start();  }  BufferedReader in; PrintWriter out; StringTokenizer st = new StringTokenizer("");  int N; int M; boolean[][] used; Queue<Integer> queue;  int[] dx = { -1, 0, 1, 0 }; int[] dy = { 0, -1, 0, 1 }; int ans = -1;  void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter("output.txt");   N = nextInt();  M = nextInt();  used = new boolean [N][M];  queue = new ArrayDeque<Integer> (N * M);  for (int K = nextInt(); K --> 0; )  addState(nextInt() - 1, nextInt() - 1);  while (!queue.isEmpty()) {  int cv = queue.poll();  int cx = cv / M;  int cy = cv % M;  for (int d = 0; d < dx.length; d++) {   int nx = cx + dx[d];   int ny = cy + dy[d];   if (0 <= nx && nx < N && 0 <= ny && ny < M && !used[nx][ny])   addState(nx, ny);  }  }  out.println((1 + ans / M) + " " + (1 + ans % M));  out.close(); }  void addState(int x, int y) {  used[x][y] = true;  queue.add(ans = code(x, y)); }  int code(int x, int y) {  return x * M + y; }  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; } }
3	public class b {  public static void main(String[] rgs) {  Scanner s=new Scanner(System.in);  int n=s.nextInt();  long[] arr=new long[n];   for(int i=0;i<n;i++) {  arr[i]=s.nextLong();  }  HashMap<Long,ArrayList<pair>> map=new HashMap<>();   ArrayList<pair> list=new ArrayList<>();  for(int i=0;i<n;i++) {  long sum=0;  for(int j=i;j<n;j++) {   sum=sum+arr[j];   pair ob=new pair(i,j);   if(map.containsKey(sum))   {   ArrayList p=map.get(sum);   p.add(ob);   map.put(sum, p);      }else {   ArrayList<pair> listt=new ArrayList<>();   listt.add(ob);   map.put(sum,listt);   }  }  }         long in=-1;  int max=0;   for(Map.Entry<Long, ArrayList<pair>> entry:map.entrySet()) {  int l=1;  ArrayList<pair> p=entry.getValue();  Collections.sort(p,new comp());  int now=p.get(0).end;  for(int j=0;j<p.size();j++) {         if(p.get(j).st>now) {   l++;   now=p.get(j).end;      }       }    if(l>max) {   max=l;   in=entry.getKey();  }  }   System.out.println(max);     ArrayList<pair> d=map.get(in);  int now=-1;  for(int j=0;j<d.size();j++) {    if(d.get(j).st>now) {   System.out.println((d.get(j).st+1)+" "+(d.get(j).end+1));   now=d.get(j).end;   }     }       } } class pair{  int st; int end; public pair(int st,int end) {   this.st=st;  this.end=end; } } class comp implements Comparator<pair>{  public int compare(pair h,pair j) {   if(h.end<j.end) {  return -1;  }else if(h.end==j.end) {  if(h.st<j.st) {   return 1;  }else if(h.st==j.st) {   return 0;  }else {   return -1;  }  }else {  return 1;  } } }
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); } }
5	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ReaderFastIO in = new ReaderFastIO(inputStream);   PrintWriter out = new PrintWriter(outputStream);   DConcatenatedMultiples solver = new DConcatenatedMultiples();   solver.solve(1, in, out);   out.close();  }  static class DConcatenatedMultiples {   public void solve(int testNumber, ReaderFastIO in, PrintWriter out) {    Map<Integer, Integer>[] mapMods = new HashMap[11];    int n = in.nextInt();    int k = in.nextInt();    int[] a = in.readArrayInt(n);    for (int i = 0; i < 11; i++) {     mapMods[i] = new HashMap<>();    }    for (int i = 0; i < n; i++) {     int pot = getPot(a[i]);     mapMods[pot].put(a[i] % k, mapMods[pot].getOrDefault(a[i] % k, 0) + 1);    }    long ct = 0;    for (int i = 0; i < n; i++) {     int ownPot = getPot(a[i]);     long suffix = a[i] * 10L;     for (int j = 1; j <= 10; j++) {      int mod = (int) (suffix % k);      int comMod = (k - mod) % k;      int qt = mapMods[j].getOrDefault(comMod, 0);      if (j == ownPot && (a[i] % k) == comMod) {       qt--;      }      ct += qt;      suffix = (suffix * 10L) % k;     }    }    out.println(ct);   }   public int getPot(int x) {    int ct = 0;    while (x != 0) {     x /= 10;     ct++;    }    return ct;   }  }  static class ReaderFastIO {   BufferedReader br;   StringTokenizer st;   public ReaderFastIO() {    br = new BufferedReader(new InputStreamReader(System.in));   }   public ReaderFastIO(InputStream input) {    br = new BufferedReader(new InputStreamReader(input));   }   public String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }   public int[] readArrayInt(int n) {    int[] array = new int[n];    for (int i = 0; i < n; i++) {     array[i] = nextInt();    }    return array;   }  } }
2	public class taskB {  StringTokenizer st;  BufferedReader in;  PrintWriter out;  public static void main(String[] args) throws NumberFormatException,    IOException {   taskB solver = new taskB();   solver.open();   long time = System.currentTimeMillis();   solver.solve();   if (!"true".equals(System.getProperty("ONLINE_JUDGE"))) {    System.out.println("Spent time: "      + (System.currentTimeMillis() - time));    System.out.println("Memory: "      + (Runtime.getRuntime().totalMemory() - Runtime      .getRuntime().freeMemory()));   }   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()) {    String line = in.readLine();    if (line == null)     return null;    st = new StringTokenizer(line);   }   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());  }  long n, x, y, c;  long sq(long n) {   if (n <= 0) return 0;   return n * n;  }  long lrsp(long len, long max) {   long cnt = Math.min(len, max);   long arpr = (1 + cnt) * cnt / 2;   if (len > max) arpr += (len - max) * max;   return arpr;  }  long onn(long len) {   long up, down, left, right;   long toup = x - 1, todown = n - x, toleft = y - 1, toright = n - y;   left = Math.min(toleft, len);   right = Math.min(toright, len);   down = up = sq(len);   up -= sq(len - toup);   down -= sq(len - todown);   len--;   if (toright < len) {    up -= lrsp(len - toright, toup);    down -= lrsp(len - toright, todown);   }   if (toleft < len) {    up -= lrsp(len - toleft, toup);    down -= lrsp(len - toleft, todown);   }   return 1 + up + down + left + right;  }  public void solve() throws NumberFormatException, IOException {   n = nextInt();   x = nextInt();   y = nextInt();   c = nextInt();   long down = 0, up = 2 * n + 13;   while (up - down > 2) {    long tmp = (up + down) / 2;    if (onn(tmp) >= c) up = tmp;    else down = tmp;   }   if (onn(down) >= c) out.println(down);   else if (onn(down + 1) >= c) out.println(down + 1);   else if (onn(down + 2) >= c) out.println(down + 2);   else out.println(down + 3);  }  public void close() {   out.flush();   out.close();  } }
1	public class C {  public static void main(String[] args) throws IOException { BufferedReader in =  new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(in.readLine()); char[] ps = in.readLine().toCharArray(); HashMap<Character, TreeSet<Integer>> locs =  new HashMap<Character, TreeSet<Integer>>(); HashSet<Character> poks = new HashSet<Character>(); int lastNew = n; for (int i = 0; i < n; i++) {  if (!poks.contains(ps[i])) {  poks.add(ps[i]);  locs.put(ps[i], new TreeSet<Integer>());  lastNew = i;  }  locs.get(ps[i]).add(i); } int max = lastNew; int minRange = max+1; for (int min = 0; min < n; min++) {  char pAtMin = ps[min];  Integer nextInd = locs.get(pAtMin).higher(min);  if (nextInd == null) break;  max = Math.max(max, nextInd);  minRange = Math.min(minRange, max-min); } System.out.println(minRange);  } }
5	public class Abra {  void solve() throws IOException {  int n = nextInt(), t = nextInt();  TreeMap<Integer, Integer> tm = new TreeMap<Integer, Integer>();  for (int i = 0; i < n; i++)   tm.put(nextInt(), nextInt());  double tx = -1e9;  int c = 2;  for (Map.Entry<Integer, Integer> m : tm.entrySet()) {   if (tx == -1e9) {   tx = m.getKey() + m.getValue() / 2.0 + t;   continue;   }   if (m.getKey() - m.getValue() / 2.0 >= tx) c++;   if (m.getKey() - m.getValue() / 2.0 > tx) c++;   tx = m.getKey() + m.getValue() / 2.0 + t;  }  out.print(c); }  public static void main(String[] args) throws IOException {  new Abra().run(); }  StreamTokenizer in; PrintWriter out; boolean oj; BufferedReader br;  void init() throws IOException {  oj = System.getProperty("ONLINE_JUDGE") != null;  Reader reader = oj ? new InputStreamReader(System.in) : new FileReader("input.txt");  Writer writer = oj ? new OutputStreamWriter(System.out) : new FileWriter("output.txt");  br = new BufferedReader(reader);  in = new StreamTokenizer(br);  out = new PrintWriter(writer); }  long beginTime;  void run() throws IOException {  beginTime = System.currentTimeMillis();  long beginMem = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();  init();  solve();  long endMem = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();  long endTime = System.currentTimeMillis();  if (!oj) {  System.out.println("Memory used = " + (endMem - beginMem));  System.out.println("Total memory = " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));  System.out.println("Running time = " + (endTime - beginTime));  }  out.flush(); }  int nextInt() throws IOException {  in.nextToken();  return (int) in.nval; }  long nextLong() throws IOException {  in.nextToken();  return (long) in.nval; }  String nextString() throws IOException {  in.nextToken();  return in.sval; }  double nextDouble() throws IOException {  in.nextToken();  return in.nval; }  myLib lib = new myLib();  void time() {  System.out.print("It's ");  System.out.println(System.currentTimeMillis() - beginTime); }  static class myLib {  long fact(long x) {  long a = 1;  for (long i = 2; i <= x; i++) {   a *= i;  }  return a;  }  long digitSum(String x) {  long a = 0;  for (int i = 0; i < x.length(); i++) {   a += x.charAt(i) - '0';  }  return a;  }  long digitSum(long x) {  long a = 0;  while (x > 0) {   a += x % 10;   x /= 10;  }  return a;  }  long digitMul(long x) {  long a = 1;  while (x > 0) {   a *= x % 10;   x /= 10;  }  return a;  }  int digitCubesSum(int x) {  int a = 0;  while (x > 0) {   a += (x % 10) * (x % 10) * (x % 10);   x /= 10;  }  return a;  }  double pif(double ax, double ay, double bx, double by) {  return Math.sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));  }  double pif3D(double ax, double ay, double az, double bx, double by, double bz) {  return Math.sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by) + (az - bz) * (az - bz));  }  double pif3D(double[] a, double[] b) {  return Math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]) + (a[2] - b[2]) * (a[2] - b[2]));  }  long gcd(long a, long b) {  if (a == 0 || b == 0) return 1;  if (a < b) {   long c = b;   b = a;   a = c;  }  while (a % b != 0) {   a = a % b;   if (a < b) {   long c = b;   b = a;   a = c;   }  }  return b;  }  int gcd(int a, int b) {  if (a == 0 || b == 0) return 1;  if (a < b) {   int c = b;   b = a;   a = c;  }  while (a % b != 0) {   a = a % b;   if (a < b) {   int c = b;   b = a;   a = c;   }  }  return b;  }  long lcm(long a, long b) {  return a * b / gcd(a, b);  }  int lcm(int a, int b) {  return a * b / gcd(a, b);  }  int countOccurences(String x, String y) {  int a = 0, i = 0;  while (true) {   i = y.indexOf(x);   if (i == -1) break;   a++;   y = y.substring(i + 1);  }  return a;  }  int[] findPrimes(int x) {  boolean[] forErato = new boolean[x - 1];  List<Integer> t = new Vector<Integer>();  int l = 0, j = 0;  for (int i = 2; i < x; i++) {   if (forErato[i - 2]) continue;   t.add(i);   l++;   j = i * 2;   while (j < x) {   forErato[j - 2] = true;   j += i;   }  }  int[] primes = new int[l];  Iterator<Integer> iterator = t.iterator();  for (int i = 0; iterator.hasNext(); i++) {   primes[i] = iterator.next().intValue();  }  return primes;  }  int rev(int x) {  int a = 0;  while (x > 0) {   a = a * 10 + x % 10;   x /= 10;  }  return a;  }  class myDate {  int d, m, y;   int[] ml = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };   public myDate(int da, int ma, int ya) {   d = da;   m = ma;   y = ya;   if ((ma > 12 || ma < 1 || da > ml[ma - 1] || da < 1) && !(d == 29 && m == 2 && y % 4 == 0)) {   d = 1;   m = 1;   y = 9999999;   }  }   void incYear(int x) {   for (int i = 0; i < x; i++) {   y++;   if (m == 2 && d == 29) {    m = 3;    d = 1;    return;   }   if (m == 3 && d == 1) {    if (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)) {    m = 2;    d = 29;    }    return;   }   }  }   boolean less(myDate x) {   if (y < x.y) return true;   if (y > x.y) return false;   if (m < x.m) return true;   if (m > x.m) return false;   if (d < x.d) return true;   if (d > x.d) return false;   return true;  }   void inc() {   if ((d == 31) && (m == 12)) {   y++;   d = 1;   m = 1;   } else {   if (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)) {    ml[1] = 29;   }   if (d == ml[m - 1]) {    m++;    d = 1;   } else    d++;   }  }  }  int partition(int n, int l, int m) {          if (n < l) return 0;  if (n < l + 2) return 1;  if (l == 1) return 1;  int c = 0;  for (int i = Math.min(n - l + 1, m); i >= (n + l - 1) / l; i--) {   c += partition(n - i, l - 1, i);  }  return c;  }  int rifmQuality(String a, String b) {  if (a.length() > b.length()) {   String c = a;   a = b;   b = c;  }  int c = 0, d = b.length() - a.length();  for (int i = a.length() - 1; i >= 0; i--) {   if (a.charAt(i) == b.charAt(i + d)) c++;   else   break;  }  return c;  }  String numSym = "0123456789ABCDEF";  String ZFromXToYNotation(int x, int y, String z) {  if (z.equals("0")) return "0";  String a = "";    BigInteger q = BigInteger.ZERO, t = BigInteger.ONE;  for (int i = z.length() - 1; i >= 0; i--) {   q = q.add(t.multiply(BigInteger.valueOf(z.charAt(i) - 48)));   t = t.multiply(BigInteger.valueOf(x));  }  while (q.compareTo(BigInteger.ZERO) == 1) {   a = numSym.charAt((int) (q.mod(BigInteger.valueOf(y)).intValue())) + a;   q = q.divide(BigInteger.valueOf(y));  }  return a;  }  double angleFromXY(int x, int y) {  if ((x == 0) && (y > 0)) return Math.PI / 2;  if ((x == 0) && (y < 0)) return -Math.PI / 2;  if ((y == 0) && (x > 0)) return 0;  if ((y == 0) && (x < 0)) return Math.PI;  if (x > 0) return Math.atan((double) y / x);  else {   if (y > 0) return Math.atan((double) y / x) + Math.PI;   else   return Math.atan((double) y / x) - Math.PI;  }  }  static boolean isNumber(String x) {  try {   Integer.parseInt(x);  } catch (NumberFormatException ex) {   return false;  }  return true;  }  static boolean stringContainsOf(String x, String c) {  for (int i = 0; i < x.length(); i++) {   if (c.indexOf(x.charAt(i)) == -1) return false;  }  return true;  }  long pow(long a, long n) {   if (n == 0) return 1;  long k = n, b = 1, c = a;  while (k != 0) {   if (k % 2 == 0) {   k /= 2;   c *= c;   } else {   k--;   b *= c;   }  }  return b;  }  int pow(int a, int n) {   if (n == 0) return 1;  int k = n, b = 1, c = a;  while (k != 0) {   if (k % 2 == 0) {   k /= 2;   c *= c;   } else {   k--;   b *= c;   }  }  return b;  }  double pow(double a, int n) {   if (n == 0) return 1;  double k = n, b = 1, c = a;  while (k != 0) {   if (k % 2 == 0) {   k /= 2;   c *= c;   } else {   k--;   b *= c;   }  }  return b;  }  double log2(double x) {  return Math.log(x) / Math.log(2);  }  int lpd(int[] primes, int x) {  int i;  for (i = 0; primes[i] <= x / 2; i++) {   if (x % primes[i] == 0) {   return primes[i];   }  }  ;  return x;  }  int np(int[] primes, int x) {  for (int i = 0; true; i++) {   if (primes[i] == x) return i;  }  }  int[] dijkstra(int[][] map, int n, int s) {  int[] p = new int[n];  boolean[] b = new boolean[n];  Arrays.fill(p, Integer.MAX_VALUE);  p[s] = 0;  b[s] = true;  for (int i = 0; i < n; i++) {   if (i != s) p[i] = map[s][i];  }  while (true) {   int m = Integer.MAX_VALUE, mi = -1;   for (int i = 0; i < n; i++) {   if (!b[i] && (p[i] < m)) {    mi = i;    m = p[i];   }   }   if (mi == -1) break;   b[mi] = true;   for (int i = 0; i < n; i++)   if (p[mi] + map[mi][i] < p[i]) p[i] = p[mi] + map[mi][i];  }  return p;  }  boolean isLatinChar(char x) {  if (((x >= 'a') && (x <= 'z')) || ((x >= 'A') && (x <= 'Z'))) return true;  else   return false;  }  boolean isBigLatinChar(char x) {  if (x >= 'A' && x <= 'Z') return true;  else   return false;  }  boolean isSmallLatinChar(char x) {  if (x >= 'a' && x <= 'z') return true;  else   return false;  }  boolean isDigitChar(char x) {  if (x >= '0' && x <= '9') return true;  else   return false;  }  class NotANumberException extends Exception {  private static final long serialVersionUID = 1L;  String mistake;   NotANumberException() {   mistake = "Unknown.";  }   NotANumberException(String message) {   mistake = message;  }  }  class Real {  String num = "0";  long exp = 0;  boolean pos = true;   long length() {   return num.length();  }   void check(String x) throws NotANumberException {   if (!stringContainsOf(x, "0123456789+-.eE")) throw new NotANumberException("Illegal character.");   long j = 0;   for (long i = 0; i < x.length(); i++) {   if ((x.charAt((int) i) == '-') || (x.charAt((int) i) == '+')) {    if (j == 0) j = 1;    else    if (j == 5) j = 6;    else     throw new NotANumberException("Unexpected sign.");   } else    if ("0123456789".indexOf(x.charAt((int) i)) != -1) {    if (j == 0) j = 2;    else     if (j == 1) j = 2;     else     if (j == 2)     ;     else      if (j == 3) j = 4;      else      if (j == 4)      ;      else       if (j == 5) j = 6;       else       if (j == 6)       ;       else        throw new NotANumberException("Unexpected digit.");    } else    if (x.charAt((int) i) == '.') {     if (j == 0) j = 3;     else     if (j == 1) j = 3;     else      if (j == 2) j = 3;      else      throw new NotANumberException("Unexpected dot.");    } else     if ((x.charAt((int) i) == 'e') || (x.charAt((int) i) == 'E')) {     if (j == 2) j = 5;     else      if (j == 4) j = 5;      else      throw new NotANumberException("Unexpected exponent.");     } else     throw new NotANumberException("O_o.");   }   if ((j == 0) || (j == 1) || (j == 3) || (j == 5)) throw new NotANumberException("Unexpected end.");  }   public Real(String x) throws NotANumberException {   check(x);   if (x.charAt(0) == '-') pos = false;   long j = 0;   String e = "";   boolean epos = true;   for (long i = 0; i < x.length(); i++) {   if ("0123456789".indexOf(x.charAt((int) i)) != -1) {    if (j == 0) num += x.charAt((int) i);    if (j == 1) {    num += x.charAt((int) i);    exp--;    }    if (j == 2) e += x.charAt((int) i);   }   if (x.charAt((int) i) == '.') {    if (j == 0) j = 1;   }   if ((x.charAt((int) i) == 'e') || (x.charAt((int) i) == 'E')) {    j = 2;    if (x.charAt((int) (i + 1)) == '-') epos = false;   }   }   while ((num.length() > 1) && (num.charAt(0) == '0'))   num = num.substring(1);   while ((num.length() > 1) && (num.charAt(num.length() - 1) == '0')) {   num = num.substring(0, num.length() - 1);   exp++;   }   if (num.equals("0")) {   exp = 0;   pos = true;   return;   }   while ((e.length() > 1) && (e.charAt(0) == '0'))   e = e.substring(1);   try {   if (e != "") if (epos) exp += Long.parseLong(e);   else    exp -= Long.parseLong(e);   } catch (NumberFormatException exc) {   if (!epos) {    num = "0";    exp = 0;    pos = true;   } else {    throw new NotANumberException("Too long exponent");   }   }  }   public Real() {  }   String toString(long mantissa) {   String a = "", b = "";   if (exp >= 0) {   a = num;   if (!pos) a = '-' + a;   for (long i = 0; i < exp; i++)    a += '0';   for (long i = 0; i < mantissa; i++)    b += '0';   if (mantissa == 0) return a;   else    return a + "." + b;   } else {   if (exp + length() <= 0) {    a = "0";    if (mantissa == 0) {    return a;    }    if (mantissa < -(exp + length() - 1)) {    for (long i = 0; i < mantissa; i++)     b += '0';    return a + "." + b;    } else {    if (!pos) a = '-' + a;    for (long i = 0; i < mantissa; i++)     if (i < -(exp + length())) b += '0';     else     if (i + exp >= 0) b += '0';     else      b += num.charAt((int) (i + exp + length()));    return a + "." + b;    }   } else {    if (!pos) a = "-";    for (long i = 0; i < exp + length(); i++)    a += num.charAt((int) i);    if (mantissa == 0) return a;    for (long i = exp + length(); i < exp + length() + mantissa; i++)    if (i < length()) b += num.charAt((int) i);    else     b += '0';    return a + "." + b;   }   }  }  }  boolean containsRepeats(int... num) {  Set<Integer> s = new TreeSet<Integer>();  for (int d : num)   if (!s.contains(d)) s.add(d);   else   return true;  return false;  }  int[] rotateDice(int[] a, int n) {  int[] c = new int[6];  if (n == 0) {   c[0] = a[1];   c[1] = a[5];   c[2] = a[2];   c[3] = a[0];   c[4] = a[4];   c[5] = a[3];  }  if (n == 1) {   c[0] = a[2];   c[1] = a[1];   c[2] = a[5];   c[3] = a[3];   c[4] = a[0];   c[5] = a[4];  }  if (n == 2) {   c[0] = a[3];   c[1] = a[0];   c[2] = a[2];   c[3] = a[5];   c[4] = a[4];   c[5] = a[1];  }  if (n == 3) {   c[0] = a[4];   c[1] = a[1];   c[2] = a[0];   c[3] = a[3];   c[4] = a[5];   c[5] = a[2];  }  if (n == 4) {   c[0] = a[0];   c[1] = a[2];   c[2] = a[3];   c[3] = a[4];   c[4] = a[1];   c[5] = a[5];  }  if (n == 5) {   c[0] = a[0];   c[1] = a[4];   c[2] = a[1];   c[3] = a[2];   c[4] = a[3];   c[5] = a[5];  }  return c;  }  int min(int... a) {  int c = Integer.MAX_VALUE;  for (int d : a)   if (d < c) c = d;  return c;  }  int max(int... a) {  int c = Integer.MIN_VALUE;  for (int d : a)   if (d > c) c = d;  return c;  }  int pos(int x) {  if (x > 0) return x;  else   return 0;  }  long pos(long x) {  if (x > 0) return x;  else   return 0;  }  double maxD(double... a) {  double c = Double.MIN_VALUE;  for (double d : a)   if (d > c) c = d;  return c;  }  double minD(double... a) {  double c = Double.MAX_VALUE;  for (double d : a)   if (d < c) c = d;  return c;  }  int[] normalizeDice(int[] a) {  int[] c = a.clone();  if (c[0] != 0) if (c[1] == 0) c = rotateDice(c, 0);  else   if (c[2] == 0) c = rotateDice(c, 1);   else   if (c[3] == 0) c = rotateDice(c, 2);   else    if (c[4] == 0) c = rotateDice(c, 3);    else    if (c[5] == 0) c = rotateDice(rotateDice(c, 0), 0);  while (c[1] != min(c[1], c[2], c[3], c[4]))   c = rotateDice(c, 4);  return c;  }  boolean sameDice(int[] a, int[] b) {  for (int i = 0; i < 6; i++)   if (a[i] != b[i]) return false;  return true;  }  final double goldenRatio = (1 + Math.sqrt(5)) / 2;  final double aGoldenRatio = (1 - Math.sqrt(5)) / 2;  long Fib(int n) {  if (n < 0) if (n % 2 == 0) return -Math.round((pow(goldenRatio, -n) - pow(aGoldenRatio, -n)) / Math.sqrt(5));  else   return -Math.round((pow(goldenRatio, -n) - pow(aGoldenRatio, -n)) / Math.sqrt(5));  return Math.round((pow(goldenRatio, n) - pow(aGoldenRatio, n)) / Math.sqrt(5));  }  class japaneeseComparator implements Comparator<String> {  @Override  public int compare(String a, String b) {   int ai = 0, bi = 0;   boolean m = false, ns = false;   if (a.charAt(ai) <= '9' && a.charAt(ai) >= '0') {   if (b.charAt(bi) <= '9' && b.charAt(bi) >= '0') m = true;   else    return -1;   }   if (b.charAt(bi) <= '9' && b.charAt(bi) >= '0') {   if (a.charAt(ai) <= '9' && a.charAt(ai) >= '0') m = true;   else    return 1;   }   a += "!";   b += "!";   int na = 0, nb = 0;   while (true) {   if (a.charAt(ai) == '!') {    if (b.charAt(bi) == '!') break;    return -1;   }   if (b.charAt(bi) == '!') {    return 1;   }   if (m) {    int ab = -1, bb = -1;    while (a.charAt(ai) <= '9' && a.charAt(ai) >= '0') {    if (ab == -1) ab = ai;    ai++;    }    while (b.charAt(bi) <= '9' && b.charAt(bi) >= '0') {    if (bb == -1) bb = bi;    bi++;    }    m = !m;    if (ab == -1) {    if (bb == -1) continue;    else     return 1;    }    if (bb == -1) return -1;    while (a.charAt(ab) == '0' && ab + 1 != ai) {    ab++;    if (!ns) na++;    }    while (b.charAt(bb) == '0' && bb + 1 != bi) {    bb++;    if (!ns) nb++;    }    if (na != nb) ns = true;    if (ai - ab < bi - bb) return -1;    if (ai - ab > bi - bb) return 1;    for (int i = 0; i < ai - ab; i++) {    if (a.charAt(ab + i) < b.charAt(bb + i)) return -1;    if (a.charAt(ab + i) > b.charAt(bb + i)) return 1;    }   } else {    m = !m;    while (true) {    if (a.charAt(ai) <= 'z' && a.charAt(ai) >= 'a' && b.charAt(bi) <= 'z' && b.charAt(bi) >= 'a') {     if (a.charAt(ai) < b.charAt(bi)) return -1;     if (a.charAt(ai) > b.charAt(bi)) return 1;     ai++;     bi++;    } else     if (a.charAt(ai) <= 'z' && a.charAt(ai) >= 'a') return 1;     else     if (b.charAt(bi) <= 'z' && b.charAt(bi) >= 'a') return -1;     else      break;    }   }   }   if (na < nb) return 1;   if (na > nb) return -1;   return 0;  }  }  Random random = new Random(); }  void readIntArray(int[] a) throws IOException {  for (int i = 0; i < a.length; i++)  a[i] = nextInt(); }  String readChars(int l) throws IOException {  String r = "";  for (int i = 0; i < l; i++)  r += (char) br.read();  return r; }  class myFraction {  long num = 0, den = 1;  void reduce() {  long d = lib.gcd(num, den);  num /= d;  den /= d;  }  myFraction(long ch, long zn) {  num = ch;  den = zn;  reduce();  }  myFraction add(myFraction t) {  long nd = lib.lcm(den, t.den);  myFraction r = new myFraction(nd / den * num + nd / t.den * t.num, nd);  r.reduce();  return r;  }  public String toString() {  return num + "/" + den;  } }  class myPoint {  myPoint(int a, int b) {  x = a;  y = b;  }  int x, y;  boolean equals(myPoint a) {  if (x == a.x && y == a.y) return true;  else   return false;  }  public String toString() {  return x + ":" + y;  } }   }
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());}  }
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);   TaskF2 solver = new TaskF2();   solver.solve(1, in, out);   out.close();  }  static class TaskF2 {   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();    }    HashMap<Long, ArrayList<Interval>> map = new HashMap<>();    for (int i = 0; i < n; i++) {     long sum = 0;     for (int j = i; j < n; j++) {      sum += a[j];      if (map.containsKey(sum) == false) {       map.put(sum, new ArrayList<>());      }      ArrayList<Interval> arr = map.get(sum);      if (arr.isEmpty() || arr.get(arr.size() - 1).r < i) {       arr.add(new Interval(i, j));      } else if (arr.get(arr.size() - 1).r >= j) {       arr.set(arr.size() - 1, new Interval(i, j));      }     }    }    ArrayList<Interval> best = new ArrayList<>();    for (ArrayList<Interval> arr : map.values()) {     if (best.size() < arr.size()) {      best = arr;     }    }    out.println(best.size());    for (Interval i : best) {     out.println((i.l + 1) + " " + (i.r + 1));    }   }   class Interval {    int l;    int r;    Interval(int l, int r) {     this.l = l;     this.r = r;    }   }  }  static class InputReader {   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private InputStream stream;   public InputReader(InputStream stream) {    this.stream = stream;   }   private boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   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 nextInt() {    int c = read();    while (isWhitespace(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 (!isWhitespace(c));    return res * sgn;   }  } }
0	public class Main {   public static long func(long a, long b) {     if (a < b)    return func(b, a);  if (b < 2)    return a;   long q = a / b;   long r = a - q * b;   return q + func(b, r);  }   public static void main(String[] args) throws IOException {     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   String[] ss = br.readLine().split(" +");   long a = Long.parseLong(ss[0]);   long b = Long.parseLong(ss[1]);     System.out.println(func(a, b));    }  }
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 C {  public static void main(String[] arg) throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.valueOf(in.readLine());  char[] s = in.readLine().toCharArray();  int i = 0, j = 0;  int[] ct = new int[256];  Set<Character> all = new HashSet<>();  for (char c : s) {  all.add(c);  }  int total = 0, res = Integer.MAX_VALUE;  while (j < s.length) {  while (total < all.size() && j < s.length) {   if (ct[s[j]] == 0) {   total++;   }   ct[s[j]]++;   j++;  }  res = Math.min(res, j - i);  while (total == all.size() && i < s.length) {   ct[s[i]]--;   if (ct[s[i]] == 0) {   total--;   }   i++;   if (total == all.size()) {   res = Math.min(res, j - i);   }  }  }  System.out.println(res); } }
3	public class C {    int n; char[] a; long[][] memo; long mod = (long) 1e9 + 7;  boolean lastFor(int i) {  if(i == 0) return false;  return a[i - 1] == 'f'; }  long dp(int ind, int curIndent) {  if(ind == n) return 1;  if(curIndent < 0) return 0;  if(memo[ind][curIndent] != -1) return memo[ind][curIndent];  long ans = 0;  if(a[ind] == 'f' && lastFor(ind)) {  ans += dp(ind + 1, curIndent + 1);  } else if(a[ind] == 'f' && !lastFor(ind)) {  ans += dp(ind, curIndent - 1);  ans += dp(ind + 1, curIndent + 1);   } else if(a[ind] == 's' && lastFor(ind)) {  ans += dp(ind + 1, curIndent);  } else if(a[ind] == 's' && !lastFor(ind)) {  ans += dp(ind + 1, curIndent);  ans += dp(ind, curIndent - 1);   }  return memo[ind][curIndent] = ans % mod; }  public void solve(Scanner in, PrintWriter out) {  n = in.nextInt();  a = new char[n];  int forCount = 0;  int[] fc = new int[n + 1];  for(int i = 0; i < n; ++i) {  a[i] = in.next().charAt(0);  if(a[i] == 'f') ++forCount;  fc[i] = forCount;  }  fc[n] = fc[n - 1];  memo = new long[n][forCount + 1];  for(long[] aa : memo) {  Arrays.fill(aa, -1);  }  for(int i = n; i >= 0; --i) {  for(int indent = fc[i] - 1; indent >= 0; --indent) {   dp(i, indent);  }  }  out.println(dp(0, 0) % mod);  }  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  new C().solve(in, out);  in.close();  out.close(); } }
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; } }
6	public class G {  static int n,t;  static int[]a;  static int[]g;  static long[][][]dp;  static final long MOD=1000000007;  public static void main(String[]args){   Scanner sc=new Scanner(System.in);   n=sc.nextInt();   t=sc.nextInt();   a=new int[n];   g=new int[n];   for(int i=0;i<n;i++) {    a[i] = sc.nextInt();    g[i] = sc.nextInt();   }   dp=new long[4][1<<(n-1)+1][t+1];   for(int i=0;i<4;i++)    for(int j=0;j<1<<(n-1)+1;j++)     for(int k=0;k<=t;k++)      dp[i][j][k]=-1;   System.out.println(dp(0,0,t));  }  private static long dp(int genre,int mask,int time){   if(time<0)    return 0;   if(dp[genre][mask][time]!=-1)    return dp[genre][mask][time];   if(time==0)    return 1;   dp[genre][mask][time]=0;   for(int i=0;i<n;i++) {    if (g[i] != genre && ((1 << i) & mask) == 0)     dp[genre][mask][time] = (dp[genre][mask][time]+dp(g[i], mask | (1 << i), time - a[i]))%MOD;   }   return dp[genre][mask][time];  } }
0	public class Bank{ public static void main(String[] args){  Scanner reader = new Scanner(System.in);  int in = reader.nextInt();  int sign = (int)Math.signum(in);   String str = Math.abs(in)+"";  if(str.length() == 1){  if(in < 0)   System.out.println(0);  else   System.out.println(in);  return;  }   int max = in;  max = Math.max(max, sign * Integer.parseInt(str.substring(0,str.length()-1)));  max = Math.max(max, sign * Integer.parseInt(str.substring(0,str.length()-2) + str.charAt(str.length()-1)));  System.out.println(max); } }
1	public class Main {  static final double eps=1e-10;  public static void main(String[] args) throws FileNotFoundException  {   new Main().solve();  }  public void solve() throws FileNotFoundException  {   Scanner cin=new Scanner(System.in);   int n;   n=cin.nextInt();   String s;   s=cin.next();   int ans=Integer.MAX_VALUE;   int h=0,t=0;   for(int i=0;i<s.length();i++)   {    if(s.charAt(i)=='H')     h++;    else if(s.charAt(i)=='T')     t++;   }   ans=Math.min(ans,fun(s,'H',h));   ans=Math.min(ans,fun(s,'T',t));   System.out.println(ans);  }  public int fun(String s,char c,int num)  {   int ans=Integer.MAX_VALUE;   int ret=num;   for(int i=0;i<num;i++)   {    if(s.charAt(i)==c)    {     ret--;    }   }   ans=ret;   for(int i=0;i+num<s.length();i++)   {    if(s.charAt(i)!=c)     ret--;    if(s.charAt(i+num)!=c)    {     ret++;    }    ans=Math.min(ans, ret);   }   return ans;  } }
1	public class ProblemC {  public static void main(String[] args) throws IOException {  init();  new ProblemC().run();  out.flush();  out.close(); }  static void init() throws IOException {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(new OutputStreamWriter(System.out));  in.ordinaryChars(0, 65535);  in.wordChars(0, 65535);  in.whitespaceChars(' ', ' ');  in.whitespaceChars('\n', '\n');  in.whitespaceChars('\r', '\r'); }   class Pair<L, R> {  private final L X;  private final R Y;   public Pair(L X, R Y) {  this.X = X;  this.Y = Y;  }   public L getX() {  return X;  }   public R getY() {  return Y;  }   @Override  public int hashCode() {  return X.hashCode() ^ Y.hashCode();  }   @Override  public boolean equals(Object o) {  if (!(o instanceof Pair)) return false;  Pair pairo = (Pair) o;  return X.equals(pairo.getX()) && Y.equals(pairo.getY());  } }  static final long INFL = 200000000000000000L; static final int INF = 2000000000; static final boolean DEBUG = true;  static StreamTokenizer in; static PrintWriter out;  static void print(String s) {  print(s, 0); }  static void print(String s, int debug) {  if (debug == 0 || DEBUG) {  out.print(s);  } }  static void println(String s) {  println(s, 0); }  static void println(String s, int debug) {  if (debug == 0 || DEBUG) {  out.println(s);  } }  static void printArray(int[] arr) {  println(Arrays.toString(arr)); }  static void printArray(char[] arr) {  println(Arrays.toString(arr)); }  static void printArray(String[] arr) {  println(Arrays.toString(arr)); }  static void sort(int[] a) {  Random rnd = new Random();  for (int i = a.length - 1; i > 0; i--) {  int index = rnd.nextInt(i);  a[i] ^= a[index];  a[index] ^= a[i];  a[i] ^= a[index];  }  Arrays.sort(a); }  static char[] inChars; static int inCharsInd;  static String next() throws IOException {  in.nextToken();  return in.sval; }  static char nextChar() throws IOException {  while (inChars == null || inCharsInd >= inChars.length) {  inChars = next().toCharArray();  inCharsInd = 0;  }  return inChars[inCharsInd++]; }  static int nextInt() throws IOException {  return Integer.valueOf(next()); }  static double nextDouble() throws IOException {  return Double.valueOf(next()); }  static long nextLong() throws IOException {  return Long.valueOf(next()); }  private void run() throws IOException {  solve(); }  int K, L, M, N, P;  private void solve() throws IOException {  int[] countChars = new int['z' + 1];  boolean[] gotIt = new boolean['z' + 1];  int N = nextInt();  int fullCount = 0;  char[] chars = next().toCharArray();  for (int i = 0; i < N; i++) {  if (countChars[chars[i]] == 0) fullCount++;  countChars[chars[i]]++;  }    countChars = new int['z' + 1];  int answer = N;  int start = 0, finish = 0;  countChars[chars[start]]++;  fullCount--;   while (finish+1 < N){  finish++;  if (countChars[chars[finish]] == 0) {   fullCount--;  }  countChars[chars[finish]]++;  while (countChars[chars[start]] > 1){   countChars[chars[start]]--;   start++;  }  while (fullCount == 0){    answer = Math.min(answer, finish-start+1);   countChars[chars[start]]--;   if (countChars[chars[start]] == 0) fullCount++;   start++;  }  }   out.println(answer); }  }
4	public class A{  Scanner sc=new Scanner(System.in);  void run(){   String s=sc.nextLine();   int n=s.length();   int ans=0;   for(int len=1; len<n; len++){    for(int i=0; i+len<=n; i++){     String t=s.substring(i, i+len);     if(s.indexOf(t,i+1)!=-1){      ans=len;      break;     }    }   }   println(ans+"");  }  void println(String s){   System.out.println(s);  }  void print(String s){   System.out.print(s);  }  public static void main(String[] args){   new A().run();  } }
4	public class Longest {  public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  String str=sc.nextLine();  int max=0;  for(int i=0;i<str.length();i++)  {  for(int x=0;x+i<=str.length();x++)  {   if(contains(str,str.substring(x,x+i),x))   {      max=Math.max(max, i);   }  }  }  System.out.println(max); } public static boolean contains(String whole,String part,int start) {   if(whole.indexOf(part, start+1)>=0)return true;  return false; } }
4	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(); }  void solve() {  String s = nextToken();  for (int len = s.length(); len >= 1; len--) {  for (int i = 0; i + len <= s.length(); i++) {   int cnt = 0;   for (int j = 0; j + len <= s.length(); j++) {   boolean ok = true;   for (int k = 0; k < len; k++) {    if (s.charAt(i + k) != s.charAt(j + k)) {    ok = false;    break;    }   }   if (ok) {    cnt++;   }   }   if (cnt > 1) {   out.println(len);   return;   }  }  }  out.println(0); } }
2	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 {  long n,x,y,c;   public void solve(int testNumber, InputReader in, OutputWriter out) {   n = in.readInt();   x = in.readInt();   y = in.readInt();   c = in.readInt();   int lo = -1;   int hi = (int)c;   while(lo+1<hi) {    int mi = (lo+hi)/2;    if(P(mi)) hi = mi; else lo = mi;   }   out.printLine(hi); }  private boolean P(int t) {   if(t == -1) return false;   int ans = 0;   for(long i = Math.max(1,y-t); i <= Math.min(y+t,n); ++i) {    long a = Math.abs(y - i);    ans += D(Math.max(1,x-t+a), Math.min(n,x+t-a));    if(ans >= c) return true;   }   return false;  }  private long D(long a, long b) {   return b - a + 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();  } }
1	public class Main {    void run() throws IOException {   int n = nint();   char[] s = token().toCharArray();   int h = 0;   for (int i = 0; i < n; i++) {    if (s[i] == 'H') h++;   }   int r = Integer.MAX_VALUE;   for (int i = 0; i < n; i++) {    int t = 0;    for (int j = i; j < i + h; j++) {     if (s[j % n] == 'T') t++;    }    r = min(r, t);   }   out.println(r);  }  class pair implements Comparable <pair> {   int x, y;   pair(int x, int y) {    this.x = x;    this.y = y;      }   public int compareTo (pair p) {    if (x != p.x) {     return x - p.x;    } else {     return y - p.y;    }   }  }    public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);       in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   st = new StringTokenizer(" ");   new Main().run();     out.close();  }  static BufferedReader in;  static PrintWriter out;  static StringTokenizer st;  String token() throws IOException {   while (!st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int nint() throws IOException {   return Integer.parseInt(token());  }  long nlong() throws IOException {   return Long.parseLong(token());  }  double ndouble() throws IOException {   return Double.parseDouble(token());  } }
2	public class B {  final int MOD = (int)1e9 + 7; final double eps = 1e-12; final int INF = (int)1e9;  public B () {  long N = sc.nextInt();  long X = sc.nextInt() - 1;  long Y = sc.nextInt() - 1;  long C = sc.nextInt();  long [] A1 = new long [] { X, Y };  long [] A2 = new long [] { X, Y };  long [] B1 = new long [] { X, Y };  long [] B2 = new long [] { X, Y };  long [] C1 = new long [] { X, Y };  long [] C2 = new long [] { X, Y };  long [] D1 = new long [] { X, Y };  long [] D2 = new long [] { X, Y };   long cnt = 1, T = 0;   while (cnt < C) {  if (A1[0] > 0) --A1[0]; else --A1[1];  if (A2[0] > 0) --A2[0]; else ++A2[1];    if (B1[1] > 0) --B1[1]; else --B1[0];  if (B2[1] > 0) --B2[1]; else ++B2[0];    if (C1[0] < N-1) ++C1[0]; else --C1[1];  if (C2[0] < N-1) ++C2[0]; else ++C2[1];    if (D1[1] < N-1) ++D1[1]; else --D1[0];  if (D2[1] < N-1) ++D2[1]; else ++D2[0];      long [] Z = { B1[0] - A1[0],    C1[0] - B2[0],    C2[0] - D2[0],    D1[0] - A2[0] };    for (long z : Z)   if (z >= 0)   cnt += (z+1);    if (Arrays.equals(A1, A2)) --cnt;  if (Arrays.equals(B1, B2)) --cnt;  if (Arrays.equals(C1, C2)) --cnt;  if (Arrays.equals(D1, D2)) --cnt;    ++T;  }   exit(T); }    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 B();  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 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); }
6	public class CF_11D {  long[][] ways;  boolean[][] connect;  int n, m, lowestIndex, mask;   private static int HEAD_POINT_INDEX = 0;  public void solve() throws Exception {   int a, b;   long total = 0;   n = nextInt();   m = nextInt();   connect = new boolean[n][n];   ways = new long[1 << n][n];   for (int i = 0; i < m; i++) {    a = nextInt();    b = nextInt();    connect[a - 1][b - 1] = true;    connect[b - 1][a - 1] = true;   }   for (int i = 0; i < n; i++) {    ways[1 << i][i] = 1;   }   for (mask = 1; mask < 1 << n; mask++) {    int tmp = mask, cnt = 0;    while (tmp > 0) {     tmp = tmp & (tmp - 1);     cnt++;    }    lowestIndex = -1;    for (int endPointIndex = 0; endPointIndex < n; endPointIndex++) {     if ((mask & 1 << endPointIndex) != 0) {      if (lowestIndex < 0) {       lowestIndex = endPointIndex;      } else if (lowestIndex != endPointIndex) {       for (int i = lowestIndex; i < n; i++)        if (connect[i][endPointIndex]) {         ways[mask][endPointIndex] += ways[mask & ~(1 << endPointIndex)][i];        }       if (connect[endPointIndex][lowestIndex] && cnt > 2) {        total += ways[mask][endPointIndex];       }      }     }    }   }   writer.println(total / 2);  }  public static void main(String[] args) {   new CF_11D().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();  } }
3	public class B {  static StringBuilder sb;  static int N;  static int[] A;  static boolean[] B;  public static void main(String[] args) {   FastScanner sc = new FastScanner();     sb = new StringBuilder();   N = sc.nextInt();   A = new int[N];   for (int i = 0; i < N; i++) {    A[i] = sc.nextInt();   }   Arrays.sort(A);   B = new boolean[N];   int count = 0;   for (int i = 0; i < A.length; i++) {    if(B[i]) {     continue;    }    else {     count++;     B[i] = true;    }    for (int j = i + 1; j < A.length; j++) {     if(A[j] % A[i] == 0) {      B[j] = true;     }    }   }   sb.append(count);   System.out.println(sb);  }  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[] readIntBrray(int n) {    int[] a = new int[n];    for (int idx = 0; idx < n; idx++) {     a[idx] = nextInt();    }    return a;   }   long[] readLongBrray(int n) {    long[] a = new long[n];    for (int idx = 0; idx < n; idx++) {     a[idx] = nextLong();    }    return a;   }  } }
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);   }  } }
5	public class CodeforcesA implements Runnable { public static final String taskname = "A"; BufferedReader in; PrintWriter out; StringTokenizer tok;  public static void main(String[] args) {  new Thread(new CodeforcesA()).start(); }  static class Square implements Comparable<Square>{  int x, a;  public Square(int x, int a) {  this.x = x;  this.a = a;  }  @Override  public int compareTo(Square o) {  return x - o.x;  }   int distance(Square a, int t) {  double dist = a.x - x - this.a / 2.0 - a.a / 2.0;  if(dist > t) return 2;  else if(abs(dist - t) < 1e-9) return 1;  return 0;  }   public String toString() {  return x + " " + a;  } }   void solve() throws IOException {  int n = nextInt(), t = nextInt();  Square[] x = new Square[n];  for(int i = 0; i < n; ++i) {  x[i] = new Square(nextInt(), nextInt());  }  Arrays.sort(x);  long res = 2;  for(int i = 0; i < n - 1; ++i) {  res += x[i].distance(x[i + 1], t);  }  out.println(res);   }  @Override public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);    solve();  out.flush();  out.close();  in.close();  } catch (IOException e) {    e.printStackTrace();  }  }  String nextLine() throws IOException {  tok = null;  return in.readLine(); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  String nextToken() throws IOException {  while (tok == null || !tok.hasMoreTokens()) {  tok = new StringTokenizer(in.readLine());  }  return tok.nextToken(); } }
1	public class C {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   int len = s.nextInt();   s.nextLine();   String l = s.nextLine();   char[] ca = l.toCharArray();   int h = 0;   for (char c : ca)    h += A(c);   int cur = h;   int i;   for (i = 0; i < h; i++)    cur -= A(ca[i]);   int best = cur;   while (i != h + len) {    cur -= A(ca[i % len]);    cur += A(ca[(i - h) % len]);    best = best > cur ? cur : best;    i++;   }   System.out.println(best);  }  public static int A(char x) {   return x == 'H' ? 1 : 0;  } }
0	public class Subtractions {  public static void main(String[] args) {   Scanner scan = new Scanner(System.in);   int t = scan.nextInt();   while(t != 0) {    int f = scan.nextInt();    int s = scan.nextInt();    System.out.println(ops(f, s));    t--;   }  }  public static int ops(int f, int s) {   int ops = 0;   while((f > 0) && (s > 0)) {    if(f > s) {     ops += f/s;     f %= s;    } else {         ops += s/f;     s %= f;    }   }   return ops;  } }
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();   }  } }
4	public class Main {  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 final int N=205;  static final int mod=1000000007;  static final int INF=1000000009;  static final int numBit=17;  static FastReader r=new FastReader();  static PrintWriter pw = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {   int n=r.nextInt();   int m=r.nextInt();   int k=r.nextInt();   int [][]hor=new int[n][m-1];   int [][]ver=new int[n-1][m];   for(int i=0;i<n;++i){    for(int j=0;j<m-1;++j) hor[i][j]=r.nextInt();   }   for(int i=0;i<n-1;++i){    for(int j=0;j<m;++j) ver[i][j]=r.nextInt();   }   int [][]dp=new int[n][m];   if(k%2!=0){    for(int i=0;i<n;++i){     for(int j=0;j<m;++j) dp[i][j]=-1;    }   }   else{    int [][]new_dp=new int[n][m];    for(int step=0;step<k/2;++step){     for(int i=0;i<n;++i){      for(int j=0;j<m;++j){       new_dp[i][j]=INF;       if(i>0){        new_dp[i][j]=Math.min(new_dp[i][j],dp[i-1][j]+ver[i-1][j]*2);       }       if(i<n-1){        new_dp[i][j]=Math.min(new_dp[i][j],dp[i+1][j]+ver[i][j]*2);       }       if(j>0){        new_dp[i][j]=Math.min(new_dp[i][j],dp[i][j-1]+hor[i][j-1]*2);       }       if(j<m-1){        new_dp[i][j]=Math.min(new_dp[i][j],dp[i][j+1]+hor[i][j]*2);       }      }     }     for(int i=0;i<n;++i){      for(int j=0;j<m;++j){       dp[i][j]=new_dp[i][j];      }     }    }   }   for(int i=0;i<n;++i){    for(int j=0;j<m;++j){     pw.print(dp[i][j]+" ");    }    pw.println();   }   pw.close();  } }
3	public class E1180D {  public static void main(String args[]) {   Scanner sc = new Scanner(System.in);   PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));   int n = sc.nextInt();   int m = sc.nextInt();      for (int i= 1; i<= m/2; i++) {       int i2 = m -i + 1;        for (int j = 1; j <= n ; j++) {     int j2 = n - j + 1;         pw.println(j + " " + i);     pw.println(j2+ " " + i2);        }      }        if (m % 2 == 1) {    int i2 = m /2 + 1;    for (int j = 1; j <= n/2 ; j++) {     int j2 = n - j + 1;         pw.println(j + " " + i2);     pw.println(j2+ " " + i2);    }    if (n %2 == 1) {     int j = n /2 + 1;     pw.println(j + " " + i2);    }   }   pw.flush();   pw.close();  }  }
5	public class Flatwile {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int t = sc.nextInt();   int[] c = new int[n];   int[] a = new int[n];   for (int i=0; i<n; i++){    c[i] = sc.nextInt();    a[i] = sc.nextInt();   }   sort(c, a);   int res = 1;   double prev = Integer.MIN_VALUE;   for(int i=0; i<c.length; i++){    if (c[i]-a[i]/2d - prev >=t){     res++;    }    if (i!=c.length-1 && c[i+1]-a[i+1]/2d-(c[i]+a[i]/2d)>t ){     res++;    }    prev = c[i] +a[i]/2d;   }   System.out.println(res);  }  private static void sort(int[] a, int[] b){   for(int i=0; i<a.length; i++){    for(int j=i+1; j<a.length; j++){     if (a[i]>a[j]){      swap(a, i, j);      swap(b, i, j);     }    }   }  }  private static void swap(int[] a, int i, int j) {   int t = a[i];   a[i] = a[j];   a[j] = t;  } }
3	public class C { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni();  int mod = 1000000007;  long[] dp = new long[5005];  dp[0] = 1;  for(int i = 0;i < n;i++){  char c = nc();  if(c == 's'){   if(i < n-1){   for(int j = 5003;j >= 0;j--){    dp[j] += dp[j+1];    if(dp[j] >= mod)dp[j] -= mod;   }   }  }else{   for(int j = 5003;j >= 0;j--){   dp[j+1] = dp[j];   }   dp[0] = 0;  }  }  long ans = 0;  for(int i = 0;i < 5005;i++)ans += dp[i];  out.println(ans % mod); }  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)); } }
4	public class P023A {  public static void main(String[] args) {   Scanner inScanner = new Scanner(System.in);   String string = inScanner.next();   int n = string.length();   for (int l = n - 1; l > 0; l--) {    Set<String> seen = new HashSet<String>();    for (int i = 0; i < n - l + 1; i++) {     String subString = string.substring(i, i + l);     if (seen.contains(subString)) {      System.out.println(l);      return;     }     seen.add(subString);    }   }   System.out.println("0");  } }
4	public class D { public static int dir[][]={{-1,0},{1,0},{0,-1},{0,1}}; public static void main(String[] args) {  FastScanner sc = new FastScanner();  FastOutput out = new FastOutput(System.out);  int n=sc.nextInt();  int m=sc.nextInt();  int k=sc.nextInt();  int ans[][][]=new int[n][m][11];  int arr[][]=new int[n*m][4];  for(int i=0;i<n;i++){  for(int j=0;j<m-1;j++){   int x=sc.nextInt();   arr[i*m+j][3]=x;   arr[i*m+j+1][2]=x;  }  }  for(int i=0;i<n-1;i++){  for(int j=0;j<m;j++){   int x=sc.nextInt();   arr[i*m+j][1]=x;   arr[(i+1)*m+j][0]=x;  }  }  if(k%2==1){  for(int i=0;i<n;i++){   StringBuilder sb=new StringBuilder("");   for(int j=0;j<m;j++){   ans[i][j][10]=-1;   sb.append(ans[i][j][10]+" ");   }   out.println(sb.toString());  }  }else{    for(int ceng=1;ceng<=k/2;ceng++){   for(int i=0;i<n;i++){   for(int j=0;j<m;j++){    ans[i][j][ceng]=Integer.MAX_VALUE/3;    for(int dr=0;dr<4;dr++){    int nx=i+dir[dr][0];    int ny=j+dir[dr][1];    if(nx<n&&ny<m&&nx>=0&&ny>=0){     ans[i][j][ceng]=Math.min(ans[i][j][ceng], ans[nx][ny][ceng-1]+arr[i*m+j][dr]);    }    }   }   }  }  for(int i=0;i<n;i++){   StringBuilder sb=new StringBuilder("");   for(int j=0;j<m;j++){   sb.append(ans[i][j][k/2]*2+" ");   }   out.println(sb.toString());  }  }  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[] readIntArray(int n) {  int[] a=new int[n];  for (int i=0; i<n; i++) a[i]=nextInt();  return a;  }  long[] readLongArray(int n) {  long[] a=new long[n];  for (int i=0; i<n; i++) a[i]=nextLong();  return a;  }  long nextLong() {  return Long.parseLong(next());  } } static class FastOutput implements AutoCloseable, Closeable, Appendable {  private static final int THRESHOLD = 1 << 13;  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 append(String c) {  cache.append(c);  afterWrite();  return this;  }  public FastOutput println(String c) {  return append(c).println();  }  public FastOutput println() {  return append(System.lineSeparator());  }  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();  } } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   int mod = 1000000007;   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.readInt();    int[][] dp = new int[n + 1][5002];    char[] a = new char[n];    for (int i = 0; i < n; i++) a[i] = in.readCharacter();    for (int i = 0; i < dp[n].length; i++) dp[n][i] = 1;    for (int i = n - 1; i >= 0; i--) {     for (int j = 0; j < n; j++) {      if (a[i] == 's') {       if (j > 0) dp[i][j] = dp[i][j - 1];       dp[i][j] = (int) ((dp[i][j] + (long) dp[i + 1][j]) % mod);      } else {       if (j > 0) dp[i][j] = dp[i][j - 1];       dp[i][j] = (int) ((dp[i][j] + (long) dp[i + 1][j + 1] - (long) dp[i + 1][j] + mod) % mod);      }     }    }    out.println(dp[0][0]);   }  }  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 char readCharacter() {    int c = read();    while (isSpaceChar(c))     c = read();    return (char) c;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
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();   }  } }
5	public class Teams {  BufferedReader in;  PrintWriter out;  StringTokenizer st;  Random rnd;   class Pair implements Comparable<Pair> {   int a, b;   public Pair(int a, int b) {    this.a = a;    this.b = b;   }     public int compareTo(Pair p) {    if(a != p.a) {     return -(a - p.a);    }       return (b - p.b);   }  }  void solve() throws IOException {   int n = nextInt(), k = nextInt();     Pair[] ps = new Pair[n];     for(int i = 0; i < n; i++)    ps[i] = new Pair(nextInt(), nextInt());     Arrays.sort(ps);     int curPlace = 1, res = 0;     int[] places = new int[n];     for(int i = 0; i < n; i++) {    if(i - 1 >= 0 && ps[i].compareTo(ps[i - 1]) != 0)     ++curPlace;       places[i] = curPlace;   }     for(int i = 0; i < n; i++) {    if(places[i] == places[k - 1])     ++res;   }     out.println(res);  }  public static void main(String[] args) {   new Teams().run();  }  public void run() {   try {    final String className = this.getClass().getName().toLowerCase();    try {     in = new BufferedReader(new FileReader(className + ".in"));     out = new PrintWriter(new FileWriter(className + ".out"));    } catch (FileNotFoundException e) {     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());  } }
4	public class a23 {  public static void main(String arg[])throws IOException  {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));     String s=br.readLine();int max=0;   for(int i=0;i<s.length();i++)   {    for(int j=i+1;j<=s.length();j++)    {     String g=s.substring(i,j);          if(max<g.length())     for(int k=i+1;k<=s.length()-g.length();k++)     {            if(g.compareTo(s.substring(k,k+g.length()))==0)      {       max=g.length();       break;      }      }    }   }   System.out.println(max); } }
3	public class Codeforces{  static class MyScanner{  BufferedReader br;  StringTokenizer st;   MyScanner(FileReader fileReader){  br = new BufferedReader(fileReader);  }   MyScanner(){  br = new BufferedReader(new InputStreamReader(System.in));  }   String nn(){  while(st == null || !st.hasMoreElements()){   try{   st = new StringTokenizer(br.readLine());   }catch(IOException e){   e.printStackTrace();   }  }  return st.nextToken();  }   char nc(){  return nn().charAt(0);  }   int ni(){  return Integer.parseInt(nn());  }   long nl(){  return Long.parseLong(nn());  }   double nd(){  return Double.parseDouble(nn());  }   int[] niArr0(int n){  int[] ar = new int[n];  for(int i = 0; i < n; i++) ar[i] = ni();  return ar;  }   int[] niArr1(int n){  int[] ar = new int[n + 1];  for(int i = 1; i <= n; i++) ar[i] = ni();  return ar;  }   long[] nlArr0(int n){  long[] ar = new long[n];  for(int i = 0; i < n; i++) ar[i] = nl();  return ar;  } }  public static <T> void mprintln(T ... ar){  for(T i: ar) out.print(i + " ");  out.println(); }  private static PrintWriter out;  public static void main(String[] args) throws FileNotFoundException{             MyScanner sc = new MyScanner();     out = new PrintWriter(new BufferedOutputStream(System.out));     getAns(sc);   out.close(); }  private static void getAns(MyScanner sc){  int n = sc.ni();  long[] ar = sc.nlArr0(n);   HashMap<Long, ArrayList<int[]>> map = new HashMap();   for(int i = 0; i < n; i++){  long cur = 0;  for(int j = i; j >= 0; j--){   cur += ar[j];   if(!map.containsKey(cur)) map.put(cur, new ArrayList());   map.get(cur).add(new int[]{j + 1, i + 1});  }  }      Set<Long> set = map.keySet();   ArrayList<int[]> ans = new ArrayList();   for(Long l: set){  ArrayList<int[]> cur = new ArrayList();  int right = -1;  for(int[] arc: map.get(l)) if(arc[0] > right){   right = arc[1];   cur.add(arc);  }    if(cur.size() > ans.size()) ans = cur;  }   out.println(ans.size());  for(int[] arc: ans) mprintln(arc[0], arc[1]); } }
4	public class a{ public static void main(String[] args) {  Scanner in = new Scanner(System.in);  String str = in.next();  int max = 0;  for(int i=0; i<str.length(); i++) {  for(int j=i+1; j<=str.length(); j++) {   String first = str.substring(i,j);   for(int k=i+1; k<=str.length()-first.length(); k++) {   if(str.substring(k,k+first.length()).equals(first))    max = Math.max(max,first.length());   }  }  }  System.out.println(max); } }
6	public class G1 {  static int n, T, duration[], type[];  static long dp[][][], mod = (long) 1e9 + 7;  public static void main(String[] args) throws Exception {   new Thread(null, new Runnable() {    public void run() {     try {      solveIt();     } catch (Exception e) {      e.printStackTrace();      System.exit(1);     }    }   }, "Main", 1 << 28).start();  }  public static void solveIt() throws Exception {   Scanner in = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   n = in.nextInt();   T = in.nextInt();   dp = new long[4][T + 1][1 << n];   duration = new int[n];   type = new int[n];   for (int i = 0; i < n; i++) {    duration[i] = in.nextInt();    type[i] = in.nextInt() - 1;   }   for (long a[][] : dp) for (long b[] : a) Arrays.fill(b, -1);   pw.println(solve(3, T, 0));   pw.close();  }  static long solve(int lastType, int rem, int mask) {   if (rem == 0) return 1;   if (rem < 0) return 0;   if (dp[lastType][rem][mask] != -1) return dp[lastType][rem][mask];   long res = 0;   for (int i = 0; i < n; i++) {    if (!check(mask, i) && lastType != type[i] && rem - duration[i] >= 0) {     res += solve(type[i], rem - duration[i], set(mask, i));     if (res >= mod) res -= mod;    }   }   return dp[lastType][rem][mask] = res;  }  static boolean check(int N, int pos) {   return (N & (1 << pos)) != 0;  }  static int set(int N, int pos) {   return N = N | (1 << pos);  }  static int reset(int N, int pos) {   return N = N & ~(1 << pos);  }  static void debug(Object... obj) {   System.err.println(Arrays.deepToString(obj));  } }
5	public class Main {    public static void main(String[] args) {     int n, i;   boolean status = false;   int answer;   Scanner in = new Scanner(System.in);   n = in.nextInt();   int a[] = new int[n];   for (i = 0; i < n; i++) {    a[i] = in.nextInt();   }   Arrays.sort(a);   answer = a[0];   for (i = 1; i < n; i++) {    if (a[i] != answer) {     answer = a[i];     status = true;     i = n + 1;    }   }   if (status) {    System.out.println(answer);   } else {    System.out.println("NO");   }  } }
2	public class B  {  public static void main(String args[]) throws Exception  {   BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));    StringTokenizer st = new StringTokenizer(infile.readLine());   int N = Integer.parseInt(st.nextToken());   int K = Integer.parseInt(st.nextToken());         long x = (long)N;   long low = 0L;   long high = N;   while(low != high)   {    x = (low+high+1)/2;    long add = (x*(x+1))/2;    long y = N-x;    if(add-y > K)     high = x;    else if(add-y == K)    {     System.out.println(y);     break;    }    else     low = x;   }     }  public static void sort(int[] arr)  {   PriorityQueue<Integer> pq = new PriorityQueue<Integer>();   for(int a: arr)    pq.add(a);   for(int i=0; i < arr.length; i++)    arr[i] = pq.poll();  }  }
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());   }   } }
4	public class FireAgain {   static Queue q=new LinkedList<>();  static boolean[][] fired;  static Pair index = null;  public static void main(String[] args) throws IOException {      BufferedReader in=new BufferedReader(new FileReader("input.txt"));   BufferedWriter writer = new BufferedWriter(new FileWriter("output.txt"));   StringTokenizer s = new StringTokenizer(in.readLine());   int n=Integer.parseInt(s.nextToken());   int m=Integer.parseInt(s.nextToken());   fired=new boolean[n][m];   Pair result=null;   s = new StringTokenizer(in.readLine());   int firenum=Integer.parseInt(s.nextToken());   s = new StringTokenizer(in.readLine());   int i;   ArrayList<Integer> tree=new ArrayList<>();   for(i=0;i<firenum*2;i++){    tree.add(Integer.parseInt(s.nextToken())-1);   }   for(i=0;i<2*firenum-1;i+=2){    fired[tree.get(i)][tree.get(i+1)]=true;    q.add(new Pair(tree.get(i),tree.get(i+1)));   }   index=(Pair) q.peek();   result=bfs((int)index.getKey(),(int)index.getValue(),n,m);   int x1=(int)result.getKey()+1;   int x2=(int)result.getValue()+1;   String str = x1 + " " + x2;   writer.write(str);   writer.close();  }  public static Pair bfs(int x,int y,int xmax,int ymax){   fired[x][y]=true;   while(!q.isEmpty()){    index=(Pair) q.poll();    int i=(int) index.getKey();    int j=(int) index.getValue();    if(i-1>=0){     if(!fired[i-1][j]){     fired[i-1][j]=true;     q.add(new Pair((i-1),j));     }    }if(j-1>=0){     if(!fired[i][j-1]){     fired[i][j-1]=true;     q.add(new Pair(i,(j-1)));     }    } if(i+1<xmax){     if(!fired[i+1][j]){     fired[i+1][j]=true;     q.add(new Pair(i+1,j));     }    } if(j+1<ymax){     if(!fired[i][j+1]){     fired[i][j+1]=true;     q.add(new Pair(i,j+1));     }    }   }    return index;          }    }
2	public class CFEdu66 {  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  long n = in.nextLong();  long k = in.nextLong();  double tmp = Math.sqrt(9 + 8*(n+k));  if(Math.ceil(tmp)-tmp<0.001)  tmp = Math.ceil(tmp);   long root = (long)tmp;  long x = (-3+root)/2;  System.out.println(n-x);   } }
1	public class Main {  public static void main(String[] args) {   Scanner scanner = new Scanner(System.in);   int n = scanner.nextInt();   int[] P = new int[n];   int[] check=new int[n];   for (int i = 1; i < n; i++) {    P[i] = scanner.nextInt();    P[i]--;    check[P[i]]++;   }   int[] leaves = new int[n];    for (int i=0;i<n;i++) {    if(check[i]==0){     leaves[P[i]]++;    }   }    for (int i = 0; i < n; i++) {    if (check[i]>0&&leaves[i]<3) {     System.out.println("No");     return;    }   }   System.out.println("Yes");  } }
4	public class R023A { String str; int n;  public R023A() {  Scanner scanner = new Scanner(System.in);  str = scanner.next();  n = str.length(); }  private void process() {  int length = -1;  for(int i=1; i<n; i++) {  Set<String> set = new HashSet<String>();  length = n - i;  for(int j=0; j<=i; j++) {   String sub = str.substring(j, j+length);   set.add(sub);  }  if(set.size() < i+1) {   System.out.println(length);   return;  }  }  System.out.println(0); }  public static void main(String[] args) {  new R023A().process(); } }
1	class Parser {  final private int BUFFER_SIZE = 1 << 16;  private java.io.DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;  public Parser(java.io.InputStream in)  {   din = new java.io.DataInputStream(in);   buffer = new byte[BUFFER_SIZE];   bufferPointer = bytesRead = 0;  }  public int nextInt() throws Exception  {   byte c = read();   while (c <= ' ')    c = read();   boolean neg = c == '-';   if (neg)    c = read();   int ret = 0;   do   {    ret = ret * 10 + c - '0';    c = read();   } while (c > ' ');   bufferPointer--;   if (neg)    return -ret;   return ret;  }  public long nextLong() throws Exception  {   byte c = read();   while (c <= ' ')    c = read();   boolean neg = c == '-';   if (neg)    c = read();   long ret = 0;   do   {    ret = ret * 10 + c - '0';    c = read();   } while (c > ' ');   bufferPointer--;   if (neg)    return -ret;   return ret;  }  public double nextDouble() throws Exception  {   byte c = read();   while (c <= ' ')    c = read();   boolean neg = c == '-';   if (neg)    c = read();   boolean seenDot = false;   double div = 1;   double ret = 0;   do   {    if (c == '.')     seenDot = true;    else    {     if (seenDot)      div *= 10;     ret = ret * 10 + c - '0';    }    c = read();   } while (c > ' ');   bufferPointer--;   ret /= div;   if (neg)    return -ret;   return ret;  }  public char nextChar() throws Exception  {   byte c = read();   while (c <= ' ')    c = read();   return (char) c;  }  public String next() throws Exception  {   StringBuilder ret = new StringBuilder();   byte c = read();   while (c <= ' ')    c = read();   do   {    ret.append((char) c);    c = read();   } while (c > ' ');   bufferPointer--;   return ret.toString();  }    public int next(char[] ret) throws Exception  {   byte c = read();   while (c <= ' ')    c = read();   int bRead = 0;   do   {    ret[bRead++] = (char) c;    c = read();   } while (c > ' ');   bufferPointer--;   return bRead;  }  public String nextLine() throws Exception  {   StringBuilder ret = new StringBuilder();   byte c = read();   while (c != '\r' && c != '\n' && c != -1)   {    ret.append((char) c);    c = read();   }   if (c == '\r')    read();   return ret.toString();  }  public boolean hasNext() throws Exception  {   byte c;   do   {    c = read();    if (c == -1)    {     bufferPointer--;     return false;    }   } while (c <= ' ');   bufferPointer--;   return true;  }  private void fillBuffer() throws Exception  {   bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);  }  private byte read() throws Exception  {   if (bufferPointer == bytesRead) fillBuffer();   if (bytesRead == -1) return -1;   return buffer[bufferPointer++];  } } class Printer {  final private int BUFFER_SIZE = 1 << 16;  private java.io.DataOutputStream dout;  private byte[] buffer;  private int bufferPointer;  Printer(java.io.OutputStream out) throws Exception  {   dout = new java.io.DataOutputStream(out);   buffer = new byte[BUFFER_SIZE];   bufferPointer = 0;  }  public void println() throws Exception  {   write((byte) '\n');  }    public void println(int n) throws Exception  {   print(n);   println();  }  public void print(int n) throws Exception  {   if (n >= 0)    print(n, true);   else   {    write((byte) '-');    print(-n, true);   }  }  private void print(int n, boolean first) throws Exception  {   if (n == 0)   {    if (first)     write((byte) (n + '0'));   }   else   {    print(n / 10, false);    write((byte) ((n % 10) + '0'));   }  }    public void println(long n) throws Exception  {   print(n);   println();  }  public void print(long n) throws Exception  {   if (n >= 0)    print(n, true);   else   {    write((byte) '-');    print(-n, true);   }  }  private void print(long n, boolean first) throws Exception  {   if (n == 0)   {    if (first)     write((byte) (n + '0'));   }   else   {    print(n / 10, false);    write((byte) ((n % 10) + '0'));   }  }    public void println(double d) throws Exception  {   print(d);   println();  }  public void print(double d) throws Exception  {   print("double printing is not yet implemented!");  }    public void println(char c) throws Exception  {   print(c);   println();  }  public void print(char c) throws Exception  {   write((byte) c);  }    public void println(String s) throws Exception  {   print(s);   println();  }  public void print(String s) throws Exception  {   int len = s.length();   for (int i = 0; i < len; i++)    print(s.charAt(i));  }  public void close() throws Exception  {   flushBuffer();  }  private void flushBuffer() throws Exception  {   dout.write(buffer, 0, bufferPointer);   bufferPointer = 0;  }  private void write(byte b) throws Exception  {   buffer[bufferPointer++] = b;   if (bufferPointer == BUFFER_SIZE)    flushBuffer();  } } public class Main {  public static void main(String[] args) throws Exception  {   new Main();  }  final int oo = (int)1e9;    InputStream stream = System.in;  Parser in = new Parser(stream);  Printer out = new Printer(System.out);  Printer err = new Printer(System.err);  long start_time = System.nanoTime();      int Sn;  char[] S = new char[1000];  char[] B = new char[1000];   Main() throws Exception  {   for (int T=in.nextInt(); T-->0; )   {    Sn = in.next(S);    if (matchRxCy())     toLet();    else     toNum();   }     long end_time = System.nanoTime();   err.println("Time: " + ((end_time-start_time)/1e9) + "(s).");   if (stream instanceof FileInputStream)   {    err.println("~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~~~~~~~~~~~~~~~~");    err.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~CHANGE INPUT STREAM~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");    err.println("~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~~~~~~~~~~~~~~~~");   }   out.close();   err.close();  }   boolean matchRxCy()  {   boolean ok=S[0]=='R'&&(S[1]>='0'&&S[1]<='9');   if (!ok) return false;   int i;   for (i=2; i<Sn && S[i]!='C'; ++i);   return i<Sn;  }   void toLet() throws Exception  {   int r = 0;   int i=1;   while (S[i]!='C')    r=r*10+S[i++]-'0';   int c = 0;   ++i;   while (i<Sn)    c=c*10+S[i++]-'0';       int bi=0;   while (c>0)   {    B[bi++]=(char)((c-1)%26+'A');    c=(c-1)/26;   }     for (int j=bi-1; j>=0; --j)    out.print(B[j]);   i=1;   while (S[i]!='C')    out.print(S[i++]);   out.println();  }   void toNum() throws Exception  {   int c=0;   int i=0;   int v=1;   while (Character.isLetter(S[i++]))    v*=26;   v/=26;   i=0;   while (Character.isLetter(S[i]))   {    c+=v*(S[i++]-'A'+1);    v/=26;   }     int r=0;   while (i<Sn)    r=r*10+S[i++]-'0';     out.print('R');   out.print(r);   out.print('C');   out.print(c);   out.println();  } }
4	public class StringsProb {  private void solve() throws IOException {   String s = nextToken();   int res = 0;   Map<String , Integer> m = new HashMap<String, Integer>();   for (int i = 0; i < s.length(); i++)    for (int j = 0; j <= s.length(); j++) {     if (i > j) continue;     String a = s.substring(i , j);     if (a.equals("")) continue;     if (m.containsKey(a)) {      m.put(a, m.get(a) + 1);     }     else      m.put(a, 1);    }   for (Entry<String , Integer> e : m.entrySet()) {    if (e.getValue() >= 2)     res = Math.max(res, e.getKey().length());   }   System.out.println(res);  }  public static void main(String[] args) {   new StringsProb().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[] readIntArray(int size) throws IOException {   int[] res = new int[size];   for (int i = 0; i < size; i++) {    res[i] = nextInt();   }   return res;  }  long[] readLongArray(int size) throws IOException {   long[] res = new long[size];   for (int i = 0; i < size; i++) {    res[i] = nextLong();   }   return res;  }  double[] readDoubleArray(int size) throws IOException {   double[] res = new double[size];   for (int i = 0; i < size; i++) {    res[i] = nextDouble();   }   return res;  }  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();  } }
2	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();  }  static class TaskB {   int n;   int startrow;   int startcol;   long want;   boolean check(long time) {    long max = (long) 2 * time * (time + 1) + 1;    long highest = startrow - time;    if(highest < 0) {     max -= Math.abs(highest) * Math.abs(highest);    }    long lowest = startrow + time;    if(lowest >= n) {     max -= Math.abs(lowest - n + 1) * Math.abs(lowest - n + 1);    }    long leftmost = startcol - time;    if(leftmost < 0) {     max -= Math.abs(leftmost) * Math.abs(leftmost);    }    long rightmost = startcol + time;    if(rightmost >= n) {     max -= Math.abs(rightmost - n + 1) * Math.abs(rightmost - n + 1);    }    long upperright = time - (startrow + 1) - (n - startcol);    if(upperright >= 0) {     max += (upperright + 1) * (upperright + 2) / 2;    }    long lowerright = time - (n - startrow) - (n - startcol);    if(lowerright >= 0) {     max += (lowerright + 1) * (lowerright + 2) / 2;    }    long upperleft = time - (startrow + 1) - (startcol + 1);    if(upperleft >= 0) {     max += (upperleft + 1) * (upperleft + 2) / 2;    }    long lowerleft = time - (n - startrow) - (startcol + 1);    if(lowerleft >= 0) {     max += (lowerleft + 1) * (lowerleft + 2) / 2;    }    return max >= want;   }   public void solve(int testNumber, InputReader in, OutputWriter out) {    n = in.readInt();    startrow = in.readInt() - 1;    startcol = in.readInt() - 1;    want = in.readLong();    long low = 0, high = 2 * n;    while(low < high) {     long mid = (low + high) / 2;     if(check(mid)) high = mid;     else low = mid + 1;    }    out.printLine(low);   }  }  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 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 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 close() {    writer.close();   }   public void printLine(long i) {    writer.println(i);   }  } }
3	public class PythonIndentation { public static void main(String args[]) {  Scanner in = new Scanner(System.in) ;  int n = in.nextInt() ;  boolean[] lst = new boolean[n] ;  for(int i=0;i<n;i++)  {  lst[i] = (in.next().equals("s"))?false:true ;  }  System.out.println(dp(lst)) ; }  static int dp(boolean[] lst) {  int[][] dp = new int[2][lst.length] ;  dp[0][0] = 1 ;  for(int i=1;i<lst.length;i++)  {    for(int j=0;j<lst.length;j++)  {   if(lst[i-1])   {   if(j==0)    dp[i%2][j] = 0 ;   else    dp[i%2][j] = dp[(i-1)%2][j-1] ;   }     else   {   if(j==0)   {    int temp = 0 ;    for(int k=0;k<lst.length;k++)    temp = (temp+dp[(i-1)%2][k])%1000000007 ;    dp[i%2][j] = temp ;   }   else    dp[i%2][j] = (dp[i%2][j-1]-dp[(i-1)%2][j-1])%1000000007 ;   }  }  }  int ans = 0 ;  for(int i=0;i<lst.length;i++)  {  ans = (ans + dp[(lst.length-1)%2][i])%1000000007 ;  }  if(ans<0)  ans = ans + 1000000007 ;   return ans ; } }
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);   APaintTheNumbers solver = new APaintTheNumbers();   solver.solve(1, in, out);   out.close();  }  static class APaintTheNumbers {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int[] a = in.readIntArray(n);    Arrays.sort(a);    int answer = 0;    for (int i = 0; i < n; i++) {     if (a[i] == 0)      continue;     answer++;     for (int j = 0; j < n; j++) {      if (j == i)       continue;      if (a[j] % a[i] == 0) {       a[j] = 0;      }     }     a[i] = 0;    }    out.println(answer);   }  }  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 int[] readIntArray(int n) {    int[] x = new int[n];    for (int i = 0; i < n; i++) {     x[i] = nextInt();    }    return x;   }  } }
5	public class Main {  public static void main(String[] args)  {  Scanner keyboard = new Scanner(System.in);  int size = keyboard.nextInt();  int[] arr = new int[size];  int i = 0;  while( size != 0 )  {  arr[i] = keyboard.nextInt();  size--;  i++;  }    Arrays.sort(arr);   int index = 0;  boolean val = false;  int ans = 0;  for ( i = 0; i< arr.length-1 ; i++ )  {    if( arr[i] != arr[i+1] )  {   val = true;     index = i+1;   System.out.println(arr[index]);   return;  }  }    if (size == 1 || ( val == false))  {   System.out.println("NO");   }    }  }
0	public class HelloWorld {  public static void main (String args [])  {   Scanner read = new Scanner(System.in);   int n = read.nextInt();   int n1 = n; boolean q = true;   while (n1 > 0)   {    if (n % n1 == 0)    {     if (check(n1))     {      System.out.print("YES");      q = false;      break;     }     }    n1--;   }   if (q) System.out.print("NO");    }  public static boolean check (int n)  {   int n1 = n;   while (n1 != 0)   {    if (n1 % 10 != 4 && n1 % 10 != 7) return false;    n1 /= 10;   }   return true;  } }
5	public class A {  public static void main(String[] args) {  try {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));    String[] s = in.readLine().split(" ");  int n = Integer.parseInt(s[0]);  int t = Integer.parseInt(s[1]) * 2;    int[] walls = new int[n*2];     for (int i=0; i<n; i++)  {   s = in.readLine().split(" ");   int x = Integer.parseInt(s[0]) * 2;   int a = Integer.parseInt(s[1]);   walls[i*2] = x-a;   walls[i*2+1] = x+a;  }    Arrays.sort(walls);    int count = 2;    for (int i=1; i<n*2-2; i+=2) {   int space = walls[i+1] - walls[i];   if ( space == t)   count += 1;   else if ( space > t)   count += 2;  }    System.out.println (count);  } catch (NumberFormatException e) {  throw new RuntimeException(e);  } catch (IOException e) {  throw new RuntimeException(e);  }  } }
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();  } }
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++];  } }
3	public class ProblemF {  private static boolean debug = false;  private static int N;  private static int[] A;  private static void solveProblem(InputStream instr) throws Exception {   InputReader sc = new InputReader(instr);   int testCount = 1;   if (debug) {    testCount = sc.nextInt();   }   for (int t = 1; t <= testCount; t++) {    printDebug("------ " + t + " ------");    N = sc.nextInt();    A = readInts(sc, N);    Object result = solveTestCase();    System.out.println(result);   }  }  private static Object solveTestCase() {   int sum[] = new int[N];   sum[0] = A[0];   for (int i = 1; i < N; i++) {    sum[i] = sum[i - 1] + A[i];   }   TreeMap<Integer, List<int[]>> map = new TreeMap<>();   for (int i = 0; i < N; i++) {    for (int j = i; j < N; j++) {     int groupSum = sum[j] - (i == 0 ? 0 : sum[i - 1]);     map.putIfAbsent(groupSum, new ArrayList<>());     map.get(groupSum).add(new int[]{i, j});    }   }   int max = -1;   List<int[]> maxAnswer = null;   for (Map.Entry<Integer, List<int[]>> entry : map.entrySet()) {    List<int[]> values = entry.getValue();    if (values.size() <= max) {     continue;    }    List<int[]> curr = findMax(values);    if (curr.size() > max) {     max = curr.size();     maxAnswer = curr;    }   }   List<String> answer = new ArrayList<>();   for (int[] value : maxAnswer) {    answer.add((value[0] + 1) + " " + (value[1] + 1));   }   return max + "\n" + joinValues(answer, "\n");  }  private static List<int[]> findMax(List<int[]> values) {   values.sort(new Comparator<int[]>() {    @Override    public int compare(int[] o1, int[] o2) {     return o1[1] - o2[1];    }   });   List<int[]> answer = new ArrayList<>();   int right = -1;   for (int i = 0; i < values.size(); i++) {    int[] value = values.get(i);    if (value[0] > right) {     answer.add(value);     right = value[1];    }   }   return answer;  }  private static int[] readInts(InputReader sc, int N) throws Exception {   int[] arr = new int[N];   for (int i = 0; i < N; i++) {    arr[i] = sc.nextInt();   }   return arr;  }  private static String joinValues(List<? extends Object> list, String delim) {   return list.stream().map(Object::toString).collect(Collectors.joining(delim));  }  private static String joinValues(int[] arr, String delim) {   List<Object> list = new ArrayList<>();   for (Object value : arr) {    list.add(value);   }   return list.stream().map(Object::toString).collect(Collectors.joining(delim));  }  public static void printDebug(Object str) {   if (debug) {    System.out.println("DEBUG: " + str);   }  }  private static final class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[1024];   private int curChar;   private int Chars;   public InputReader(InputStream stream) {    this.stream = stream;   }   private int read() throws Exception {    if (curChar >= Chars) {     curChar = 0;     Chars = stream.read(buf);     if (Chars <= 0)      return -1;    }    return buf[curChar++];   }   public final int nextInt() throws Exception {    return (int)nextLong();   }   public final long nextLong() throws Exception {    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 {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += (c - '0');     c = read();    } while (!isSpaceChar(c));    return negative ? (-res) : (res);   }   public final int[] nextIntBrray(int size) throws Exception {    int[] arr = new int[size];    for (int i = 0; i < size; i++)     arr[i] = nextInt();    return arr;   }   public final String next() throws Exception {    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();   }   public final String nextLine() throws Exception {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.append((char)c);     c = read();    } while (c != '\n' && c != -1);    return res.toString();   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  }  public static void main(String[] args) throws Exception {   long currTime = System.currentTimeMillis();   if (debug) {    solveProblem(new FileInputStream(new File("input.in")));    System.out.println("Time: " + (System.currentTimeMillis() - currTime));   } else {    solveProblem(System.in);   }  } }
6	public class SimpleCycle {  int first(int x){  return x - (x & (x - 1)); }  void run(){  int N = nextInt(), M = nextInt();  int[] graph = new int[N];  for(int i = 0; i < M; i++){  int a = nextInt() - 1, b = nextInt() - 1;  graph[a] |= (1<<b);  graph[b] |= (1<<a);  }  int[] bitcount = new int[1<<N];  for(int i = 0; i < (1<<N); i++){  bitcount[i] = bitcount[i>>1];  if(i % 2 == 1) bitcount[i]++;  }  long[][] dp = new long[1<<N][N];  for(long[] f : dp) Arrays.fill(f, 0);  long ans = 0;  for(int mask = 1; mask < (1<<N); mask++){  for(int i = 0; i < N; i++)if((mask & (1<<i)) > 0){   if(bitcount[mask] == 1) dp[mask][i] = 1;   else{   if(first(mask) != (1<<i)){    for(int j = 0; j < N; j++)if((graph[i] & (1<<j)) > 0 && (mask & (1<<j)) > 0){    dp[mask][i] += dp[mask - (1<<i)][j];    }   }   }   if(bitcount[mask] >= 3 && (graph[i] & first(mask)) > 0) ans += dp[mask][i];  }  }  System.out.println(ans / 2);  }  int nextInt(){   try{    int c = System.in.read();    if(c == -1) return c;    while(c != '-' && (c < '0' || '9' < c)){     c = System.in.read();     if(c == -1) return c;    }    if(c == '-') return -nextInt();    int res = 0;    do{     res *= 10;     res += c - '0';     c = System.in.read();    }while('0' <= c && c <= '9');    return res;   }catch(Exception e){    return -1;   }  }  long nextLong(){   try{    int c = System.in.read();    if(c == -1) return -1;    while(c != '-' && (c < '0' || '9' < c)){     c = System.in.read();     if(c == -1) return -1;    }    if(c == '-') return -nextLong();    long res = 0;    do{     res *= 10;     res += c-'0';     c = System.in.read();    }while('0' <= c && c <= '9');    return res;   }catch(Exception e){    return -1;   }  }  double nextDouble(){   return Double.parseDouble(next());  }  String next(){   try{    StringBuilder res = new StringBuilder("");    int c = System.in.read();    while(Character.isWhitespace(c))     c = System.in.read();    do{     res.append((char)c);    }while(!Character.isWhitespace(c=System.in.read()));    return res.toString();   }catch(Exception e){    return null;   }  }  String nextLine(){   try{    StringBuilder res = new StringBuilder("");    int c = System.in.read();    while(c == '\r' || c == '\n')     c = System.in.read();    do{     res.append((char)c);     c = System.in.read();    }while(c != '\r' && c != '\n');    return res.toString();   }catch(Exception e){    return null;   }  }  public static void main(String[] args){   new SimpleCycle().run();  } }
1	public class E46A { public static void main(String[] args) {  FastScanner in = new FastScanner(System.in);  String[] sizes = {"XXXS", "XXS", "XS", "S", "M", "L", "XL", "XXL", "XXXL"};  int n = in.nextInt();  HashMap<String, Integer> a = new HashMap<>();  HashMap<String, Integer> b = new HashMap<>();  for (String s : sizes) {  a.put(s, 0);  b.put(s, 0);  }  for (int i = 0; i < n; i++) {  String s = in.next();  a.put(s, a.get(s) + 1);  }  for (int i = 0; i < n; i++) {  String s = in.next();  b.put(s, b.get(s) + 1);  }  for (String s : sizes) {  int cut = Math.min(a.get(s), b.get(s));  a.put(s, a.get(s) - cut);  b.put(s, b.get(s) - cut);  }  int changes = 0;  for (String s : sizes)  changes += a.get(s);  System.out.println(changes); }   public static class FastScanner {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  public FastScanner(InputStream stream)  {  this.stream = stream;  }  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++];  }  boolean isSpaceChar(int c)  {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  boolean isEndline(int c)  {  return c == '\n' || c == '\r' || c == -1;  }  public int nextInt()  {  return Integer.parseInt(next());  }  public long nextLong()  {  return Long.parseLong(next());  }  public double nextDouble()  {  return Double.parseDouble(next());  }  public String next()  {  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 (isEndline(c))   c = read();  StringBuilder res = new StringBuilder();  do  {   res.appendCodePoint(c);   c = read();  } while (!isEndline(c));  return res.toString();  } } }
6	public class Main {  static class Task {   int NN = 1000006;  int MOD = 998244353;  int INF = 2000000000;  long INFINITY = 1000000000000000000L;   long [][] a;  long [][] w, w1;  long [][] dp;   int countBit(int num) {  int ret = 0;  while(num > 0) {   if((num&1)!=0)   ++ret;   num >>= 1;  }  return ret;  }   long rec(int at, int mask, int n, int start) {  long ans = -INFINITY;  if(dp[at][mask] != -1)   return dp[at][mask];  if(countBit(mask) == n) {   return dp[at][mask] = w1[start][at];  }  for(int i=0;i < n;++i) {   if(((mask>>i)&1)==0) {   ans = Math.max(ans,     Math.min(w[at][i], rec(i, mask | (1<<i), n, start)));   }  }  return dp[at][mask] = ans;  }   public void solve(InputReader in, PrintWriter out) {  int n = in.nextInt(), m = in.nextInt();  dp = new long[n][1<<n];  a = new long[n][m];  w = new long[n][n];  w1 = new long[n][n];  for(int i=0;i<n;++i) {   for(int j=0;j<m;++j) {   a[i][j] = in.nextLong();   }  }  for(int i=0;i<n;++i) {   for(int j=0;j<n;++j) {   w[i][j] = INFINITY;   if(i == j)    continue;   for(int k=0;k<m;++k) {    w[i][j] = Math.min(w[i][j], Math.abs(a[j][k] - a[i][k]));   }   }  }  for(int i=0;i<n;++i) {   for(int j=0;j<n;++j) {   w1[i][j] = INFINITY;   for(int k=1;k<m;++k) {    w1[i][j] = Math.min(w1[i][j], Math.abs(a[i][k] - a[j][k - 1]));   }   }  }  long ans = 0;  for(int start = 0;start < n;++start) {   for(int i=0;i<n;++i) {   for(int j=0;j<(1<<n);++j)    dp[i][j] = -1;   }   ans = Math.max(ans, rec(start, 1<<start, n, start));  }  out.println(ans);  }   class Pair {  Integer first, second;  public Pair() {  }  public Pair(int first, int second) {   this.first = first;   this.second = second;  }  @Override  public int hashCode() {   final int prime = 31;   int result = 1;   result = prime * result + getOuterType().hashCode();   result = prime * result + first;   result = prime * result + second;   return result;  }  @Override  public boolean equals(Object obj) {   if (this == obj)   return true;   if (obj == null)   return false;   if (getClass() != obj.getClass())   return false;   Pair other = (Pair) obj;   if (!getOuterType().equals(other.getOuterType()))   return false;   if (first != other.first)   return false;   if (second != other.second)   return false;   return true;  }  private Task getOuterType() {   return Task.this;  }    }   }  static void prepareIO(boolean isFileIO) {  Task solver = new Task();   if(!isFileIO) {  InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   solver.solve(in, out);   out.close();  }    else {  String IPfilePath = System.getProperty("user.home") + "/Downloads/ip.in";   String OPfilePath = System.getProperty("user.home") + "/Downloads/op.out";   InputReader fin = new InputReader(IPfilePath);   PrintWriter fout = null;   try {   fout = new PrintWriter(new File(OPfilePath));  } catch (FileNotFoundException e) {   e.printStackTrace();  }   solver.solve(fin, fout);   fout.close();  } }  public static void main(String[] args) {   prepareIO(false); }  static class InputReader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public InputReader(InputStream stream) {    reader = new BufferedReader(new InputStreamReader(stream), 32768);    tokenizer = null;   }     public InputReader(String filePath) {   File file = new File(filePath);    try {   reader = new BufferedReader(new FileReader(file));  } catch (FileNotFoundException e) {     e.printStackTrace();  }    tokenizer = null;   }     public String nextLine() {   String str = "";   try {   str = reader.readLine();  } catch (IOException e) {     e.printStackTrace();  }   return str;   }     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());   }    } }
6	public class CF1185G2 { static final int MD = 1000000007; static int[][] solve1(int[] aa, int t, int n) {  int[][] da = new int[t + 1][n + 1];  da[0][0] = 1;  for (int i = 0; i < n; i++) {  int a = aa[i];  for (int s = t - 1; s >= 0; s--)   for (int m = 0; m < n; m++) {   int x = da[s][m];   if (x != 0) {    int s_ = s + a;    if (s_ <= t)    da[s_][m + 1] = (da[s_][m + 1] + x) % MD;   }   }  }  return da; } static int[][][] solve2(int[] aa, int[] bb, int t, int na, int nb) {  int[][] da = solve1(aa, t, na);  int[][][] dab = new int[t + 1][na + 1][nb + 1];  for (int s = 0; s <= t; s++)  for (int ma = 0; ma <= na; ma++)   dab[s][ma][0] = da[s][ma];  for (int i = 0; i < nb; i++) {  int b = bb[i];  for (int s = t - 1; s >= 0; s--)   for (int ma = 0; ma <= na; ma++)   for (int mb = 0; mb < nb; mb++) {    int x = dab[s][ma][mb];    if (x != 0) {    int s_ = s + b;    if (s_ <= t)     dab[s_][ma][mb + 1] = (dab[s_][ma][mb + 1] + x) % MD;    }   }  }  return dab; } static int[][][] init(int n, int na, int nb, int nc) {  int[][][] dp = new int[na + 1][nb + 1][nc + 1];  int[][][][] dq = new int[na + 1][nb + 1][nc + 1][3];  for (int ma = 0; ma <= na; ma++)  for (int mb = 0; mb <= nb; mb++)   for (int mc = 0; mc <= nc; mc++)   if (ma == 0 && mb == 0 && mc == 0) {    dp[ma][mb][mc] = 1;    dq[ma][mb][mc][0] = dq[ma][mb][mc][1] = dq[ma][mb][mc][2] = 1;   } else {    int x0 = ma > 0 ? (int) ((long) dq[ma - 1][mb][mc][0] * ma % MD) : 0;    int x1 = mb > 0 ? (int) ((long) dq[ma][mb - 1][mc][1] * mb % MD) : 0;    int x2 = mc > 0 ? (int) ((long) dq[ma][mb][mc - 1][2] * mc % MD) : 0;    dp[ma][mb][mc] = (int) (((long) x0 + x1 + x2) % MD);    dq[ma][mb][mc][0] = (x1 + x2) % MD;    dq[ma][mb][mc][1] = (x2 + x0) % MD;    dq[ma][mb][mc][2] = (x0 + x1) % MD;   }  return dp; } 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 t = Integer.parseInt(st.nextToken());  int[] aa = new int[n];  int[] bb = new int[n];  int[] cc = new int[n];  int na = 0, nb = 0, nc = 0;  for (int i = 0; i < n; i++) {  st = new StringTokenizer(br.readLine());  int a = Integer.parseInt(st.nextToken());  int g = Integer.parseInt(st.nextToken());  if (g == 1)   aa[na++] = a;  else if (g == 2)   bb[nb++] = a;  else   cc[nc++] = a;  }  int[][][] dp = init(n, na, nb, nc);  int[][][] dab = solve2(aa, bb, t, na, nb);  int[][] dc = solve1(cc, t, nc);  int ans = 0;  for (int tab = 0; tab <= t; tab++) {  int tc = t - tab;  for (int ma = 0; ma <= na; ma++)   for (int mb = 0; mb <= nb; mb++) {   int xab = dab[tab][ma][mb];   if (xab == 0)    continue;   for (int mc = 0; mc <= nc; mc++) {    int xc = dc[tc][mc];    if (xc == 0)    continue;    ans = (int) ((ans + (long) xab * xc % MD * dp[ma][mb][mc]) % MD);   }   }  }  System.out.println(ans); } }
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);  } }
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(); } }
5	public class SolA {  private static InputReader in; private static PrintWriter out;  public static void main(String[] args) throws IOException {  in = new InputReader(System.in);  out = new PrintWriter(System.out);  run();  out.close(); }  public static void run() {  int n = in.readInt();  int a = in.readInt();  int b = in.readInt();  int[] h = new int[n];  for(int i = 0; i < n; i++) {  h[i] = - in.readInt();  }  Arrays.sort(h);   int base = -h[a-1];  int base1 = -h[a];  out.print(-(base1 - base));   } } 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 static boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  public String next() {  return readString(); } }
5	public class A {  static class House {  int x, a; }   public static void main(final String[] args) {  final Scanner in = new Scanner(System.in);  final PrintWriter out = new PrintWriter(System.out);  try {  final int n = in.nextInt();  final int t = in.nextInt();   final House[] h = new House[n];  for (int i = 0; i < h.length; ++i) {   h[i] = new House();   h[i].x = in.nextInt();   h[i].a = in.nextInt();  }   Arrays.sort(h, new Comparator<House>() {   @Override   public int compare(final House o1, final House o2) {   return Integer.valueOf(o1.x).compareTo(o2.x);   }  });   int ans = 2;  for (int i = 1; i < n; ++i) {   final int dspace = 2 * h[i].x - h[i].a    - (2 * h[i - 1].x + h[i - 1].a);   if (dspace == 2 * t) {   ++ans;   } else if (dspace > 2 * t) {   ans += 2;   }  }   out.println(ans);  } finally {  in.close();  out.close();  } } }
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());  } }
3	public class q1 {  static int MOD=1000000007;  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[1000000];    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 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 gcd(int a, int b)  {   if (b == 0)   return a;   return gcd(b, a % b);  }       public static void main(String[] args) throws IOException  {   Scanner sc=new Scanner(System.in);      int T=1;   while(T-- > 0){    int N=sc.nextInt();    int a[]=new int[N];    int count=0;    int ans=0;    boolean flag=false;    for(int i=0;i<N;++i){     a[i]=sc.nextInt();    }    Arrays.sort(a);    for(int i=0;i<N;++i){     if(a[i]==-1)     continue;    for(int j=i+1;j<N;++j){     if(a[j]%a[i]==0 && a[j]!=-1){      a[j]=-1;;     }    }    }       for(int i=0;i<N;++i){     if(a[i]!= -1)     count++;    }    System.out.println(count);   }     }    }
6	public class E {  void solve(BufferedReader in) throws Exception {   int[] xx = toInts(in.readLine());   int n = xx[0];   double k = xx[1];   int[][] board = new int[n][n];   for(int i = 0; i<n; i++) board[i] = toInts(in.readLine());   int fst = n/2;   int snd = n - fst;   int[] maxc = new int[1<<fst];   int max = 1;   for(int i = 0; i<(1<<fst); i++) {    for(int j = 0; j<fst; j++) {     if((i&(1<<j)) != 0) maxc[i] = Math.max(maxc[i], maxc[i^(1<<j)]);    }    boolean ok = true;    for(int a = 0; a<fst; a++) if(((1<<a)&i) != 0) {     for(int b = a+1; b<fst; b++) if(((1<<b)&i) != 0) {      if(board[a][b] == 0) ok = false;     }    }    if(ok) {     maxc[i] = Integer.bitCount(i);     max = Math.max(max, maxc[i]);    }   }   for(int i = 0; i<(1<<snd); i++) {    boolean ok = true;    for(int a = 0; a<snd; a++) if(((1<<a)&i) != 0) {     for(int b = a+1; b<snd; b++) if(((1<<b)&i) != 0) {      if(board[a+fst][b+fst] == 0) ok = false;     }    }    if(!ok) continue;    int mask = 0;    for(int a = 0; a<fst; a++) {     ok = true;     for(int b = 0; b<snd; b++) {      if(((1<<b)&i) != 0) {       if(board[a][b+fst] == 0) ok = false;      }     }     if(ok) mask |= (1<<a);    }    max = Math.max(Integer.bitCount(i) + maxc[mask], max);   }   System.out.println(k*k*(max-1.0)/(2*max));  }  int toInt(String s) {return Integer.parseInt(s);}  int[] toInts(String s) {   String[] a = s.split(" ");   int[] o = new int[a.length];   for(int i = 0; i<a.length; i++) o[i] = toInt(a[i]);   return o;  }  void e(Object o) {   System.err.println(o);  }  public static void main(String[] args) throws Exception{   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   (new E()).solve(in);  } }
0	public class Main {  public static void main(String[] args) throws IOException{  Scanner cin = new Scanner(System.in);   int t, n, m;   t = cin.nextInt();   while(t > 0) {  t--;  int sum = 0;  n = cin.nextInt();  m = cin.nextInt();  while(n > 0 && m > 0) {   if(n < m) {   int k = n;   n = m;   m = k;   }   sum += n / m; n %= m;  }    System.out.println(sum);  } } }
6	public class Template implements Runnable {  private void solve() throws IOException {   int n = nextInt();   int m = nextInt();   boolean[][] g = new boolean[n][n];   for (int i = 0; i < m; ++i) {    int a = nextInt() - 1;    int b = nextInt() - 1;    g[a][b] = true;    g[b][a] = true;   }     long[] am = new long[n + 1];   long[][] ways = new long[1 << (n - 1)][n];   for (int start = 0; start < n; ++start) {    for (int mask = 0; mask < (1 << (n - start - 1)); ++mask)     for (int last = start; last < n; ++last) {      ways[mask][last - start] = 0;     }    ways[1 >> 1][0] = 1;    for (int mask = 1; mask < (1 << (n - start)); mask += 2) {     int cnt = 0;     int tmp = mask;     while (tmp > 0) {      ++cnt;      tmp = tmp & (tmp - 1);     }     for (int last = start; last < n; ++last)      if (ways[mask >> 1][last - start] > 0) {       long amm = ways[mask >> 1][last - start];       for (int i = start; i < n; ++i)        if ((mask & (1 << (i - start))) == 0 && g[last][i]) {         ways[(mask | (1 << (i - start))) >> 1][i - start] += amm;        }       if (g[last][start])        am[cnt] += ways[mask >> 1][last - start];      }    }   }   long res = 0;   for (int cnt = 3; cnt <= n; ++cnt) {    if (am[cnt] % (2) != 0)     throw new RuntimeException();    res += am[cnt] / (2);   }   writer.println(res);  }   public static void main(String[] args) {   new Template().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();  } }
4	public class Test {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   String s = in.readLine();   int ans = 0;   for (int i = 0; i < s.length(); i++) {    for (int j = i + 1; j <= s.length(); j++) {     String t = s.substring(i, j);     if (s.indexOf(t, i + 1)>=0) {      ans = Math.max(ans, j - i);     }    }   }   System.out.println(ans);  }  }
6	public class C {  static boolean[][] matrix;  static long[][] dp;  static int n;  static int m;  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   n = s.nextInt();   m = s.nextInt();   matrix = new boolean[n][n];   for (int i=0; i<m; ++i) {    int v1 = s.nextInt()-1;    int v2 = s.nextInt()-1;    matrix[v1][v2] = true;    matrix[v2][v1] = true;   }   dp = new long[n][1<<n+1];   for (int i=0; i<n; ++i) Arrays.fill(dp[i], -1);     long res = 0;   for (int i=0; i<n; ++i)    res += calc(i, i, (1<<i), 1);     System.out.println(res/2);  }   public static long calc(int h, int c, int m, int len) {   if (dp[c][m] != -1)    return dp[c][m];     long ret = 0;   if (len > 2 && matrix[c][h])    ret = 1;   for (int i=h+1; i<n; ++i)    if ((m & (1<<i)) == 0 && matrix[c][i])     ret += calc(h, i, m | (1<<i), len + 1);   return dp[c][m] = ret;  } }
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 Temppp {  public static void main(String[] args) {     Scanner sc = new Scanner(System.in);   long n = sc.nextLong();   long k = sc.nextLong();     long ans = (long) ((java.lang.Math.sqrt((9+(8*(n+k))))-3)/2);   System.out.println(n-ans);    }  }
4	public class Codes {  public static void main(String[] args) throws IOException {  InputReader input = new InputReader(new FileReader(("input.txt")));  int n = input.nextInt();  int m = input.nextInt();  int k = input.nextInt();  boolean[][] visited = new boolean[n][m];  Queue<Point> bfs = new LinkedList<Point>();  for (int i = 0; i < k; i++) {  int x = input.nextInt();  int y = input.nextInt();  visited[x - 1][y - 1] = true;  bfs.add(new Point(x - 1, y - 1));  }  Point last = bfs.peek();  while(!bfs.isEmpty()) {  Point current = bfs.poll();  int curX = current.x;  int curY = current.y;    if(curX - 1 >= 0) {   if(!visited[curX - 1][curY]) {   bfs.add(new Point(curX - 1,curY));   visited[curX - 1][curY] = true;   }  }    if(curY + 1 < m) {   if(!visited[curX][curY + 1]) {   bfs.add(new Point(curX ,curY + 1));   visited[curX][curY + 1] = true;   }  }    if(curX + 1 < n) {   if(!visited[curX + 1][curY]) {   bfs.add(new Point(curX + 1,curY));   visited[curX + 1][curY] = true;   }  }    if(curY - 1 >= 0) {   if(!visited[curX][curY - 1]) {   bfs.add(new Point(curX ,curY - 1));   visited[curX][curY - 1] = true;   }  }  if(bfs.peek()!= null)  last = bfs.peek();  }  PrintWriter out = new PrintWriter(new File("output.txt"));  out.println((last.x + 1) + " " + (last.y + 1));  out.close();   }  static class Point {  int x;  int y;  public Point(int x2, int y2) {  x = x2;  y = y2;    } }   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());  }  public double nextDouble() {  return Double.parseDouble(next());  } } }
2	public class C implements Runnable{ public static void main (String[] args) {new Thread(null, new C(), "_cf", 1 << 28).start();}  long MOD = (long)1e9+7;  public void run() {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  System.err.println("Go!");  long x = fs.nextLong();  long k = fs.nextLong();  if(x == 0) {  System.out.println(0);  return;  }  if(k == 0) {  System.out.println(mult(x, 2));  return;  }   long max = mult(x, power(2, k, MOD));  long min = sub(max, power(2, k, MOD));  long total = 0;  if(min <= max) {  total = sub(summ(max), summ(min));  }  else {  total = summ(max);  total = add(total, sub(summ(MOD-1), summ(min)));  }  total = mult(total, 2);  total = div(total, power(2, k, MOD));  out.println(total);  out.close(); }  long summ(long x) {  x *= x+1;  x /= 2;  x %= MOD;  return x; }  long add(long a, long b) {  a %= MOD;  b %= MOD;  a += b;  a %= MOD;  return a; }  long sub(long a, long b) {  a %= MOD;  b %= MOD;  a -= b;  while(a < 0) a += MOD;  a %= MOD;  return a; }  long mult(long a, long b) {  a %= MOD;  b %= MOD;  a *= b;  a %= MOD;  return a; }  long div(long a, long b) {  a %= MOD;  b %= MOD;  a *= inv(b);  a %= MOD;  return a; }  long inv(long x) {  long res = power(x, MOD-2, MOD);  while(res < 0) res += MOD;  res %= MOD;  return res; }  long power (long x, long y, long m) {  long res = 1;  x %= m;  while(y > 0) {   if(y % 2 == 1) {   res = (res * x) % m;   }   y >>= 1L;   x = (x * x) % m;  }  return res;  }  void sort (int[] a) {  int n = a.length;  for(int i = 0; i < 50; i++) {  Random r = new Random();  int x = r.nextInt(n), y = r.nextInt(n);  int temp = a[x];  a[x] = a[y];  a[y] = temp;  }  Arrays.sort(a); }  class FastScanner {  public int BS = 1<<16;  public char NC = (char)0;  byte[] buf = new byte[BS];  int bId = 0, size = 0;  char c = NC;  double num = 1;  BufferedInputStream in;  public FastScanner() {  in = new BufferedInputStream(System.in, BS);  }  public FastScanner(String s) throws FileNotFoundException {  in = new BufferedInputStream(new FileInputStream(new File(s)), BS);  }  public char nextChar(){  while(bId==size) {   try {   size = in.read(buf);   }catch(Exception e) {   return NC;   }       if(size==-1)return NC;   bId=0;  }  return (char)buf[bId++];  }  public int nextInt() {  return (int)nextLong();  }  public long nextLong() {  num=1;  boolean neg = false;  if(c==NC)c=nextChar();  for(;(c<'0' || c>'9'); c = nextChar()) {   if(c=='-')neg=true;  }  long res = 0;  for(; c>='0' && c <='9'; c=nextChar()) {   res = (res<<3)+(res<<1)+c-'0';   num*=10;  }  return neg?-res:res;  }  public double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }  public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }  public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  }   public int[] nextIntArray(int n) {  int[] res = new int[n];  for(int i = 0; i < n; i++) res[i] = nextInt();  return res;  }   } }
5	public class A { public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int t = scan.nextInt();  List<List<Double>> coords = new ArrayList<List<Double>>();  while (n-- > 0) {  double x = scan.nextDouble();  double a = scan.nextDouble() / 2;  coords.add(Arrays.asList(x - a, x + a));  }  Collections.sort(coords, new Comparator<List<Double>>() {  @Override  public int compare(List<Double> o1, List<Double> o2) {   return o1.get(0).compareTo(o2.get(0));  }  });  int count = 2;  ChoiceFormat f = new ChoiceFormat("-1#0|0#1|0<2");  for (int i = 0; i < coords.size()-1; i++) {  double l = coords.get(i+1).get(0)-coords.get(i).get(1)-t;  count += new Integer(f.format(l));  }  System.out.println(count); } }
3	public class Main {  public static void main(String[] args) throws Exception {   new Main().run();}                                                                                                       static long mul(long a, long b, long p)  {   long res=0,base=a;   while(b>0)   {    if((b&1L)>0)     res=(res+base)%p;    base=(base+base)%p;    b>>=1;   }   return res;  }  static long mod_pow(long k,long n,long p){   long res = 1L;   long temp = k;   while(n!=0L){    if((n&1L)==1L){     res = (res*temp)%p;    }    temp = (temp*temp)%p;    n = n>>1L;   }   return res%p;  }  int ct = 0;  int f[] =new int[200001];  int b[] =new int[200001];  int str[] =new int[200001];  void go(int rt,List<Integer> g[]){   str[ct] = rt;   f[rt] = ct;   for(int cd:g[rt]){    ct++;    go(cd,g);   }   b[rt] = ct;  }  int add =0;  void go(int rt,int sd,int k,List<Integer> g[],int n){   if(add>n) {    return;   }   Queue<Integer> q =new LinkedList<>();   q.offer(rt);   for(int i=1;i<=sd;++i){    int sz =q.size();    if(sz==0) break;    int f = (i==1?2:1);    while(sz-->0){     int cur = q.poll();     for(int j=0;j<k-f;++j){      q.offer(add);      g[cur].add(add);add++;      if(add==n+1){       return;      }     }    }   }   }   void solve() {   int n = ni();   int s[] = new int[n+1];   for(int i=0;i<n;++i){    s[i+1] = s[i] + ni();   }   Map<Integer,List<int[]>> mp = new HashMap<>();   for(int i=0;i<n;++i) {    for (int j = i; j>=0; --j) {     int v = s[i+1]-s[j];     if(!mp.containsKey(v)){      mp.put(v, new ArrayList<>());     }     mp.get(v).add(new int[]{j+1,i+1});    }   }   int all = 0;int vv = -1;   for(int v:mp.keySet()){    List<int[]> r = mp.get(v);    ;int c = 0;    int ri = -2000000000;    for(int [] fk : r){     if(fk[0]>ri){      ri = fk[1];c++;     }    }    if(c>all){     all = c;     vv = v;    }   }   println(all);   List<int[]> r = mp.get(vv);   int ri = -2000000000;   for(int fk[]:r){    if(fk[0]>ri){     ri = fk[1];println((fk[0])+" "+(fk[1]));    }   }                                                                                                                                                }       long t1[];   void update(long[] t,int i,long v){   for(;i<t.length;i+=(i&-i)){    t[i] += v;   }  }  long get(long[] t,int i){   long s = 0;   for(;i>0;i-=(i&-i)){    s += t[i];   }   return s;  }  int equal_bigger(long t[],long v){   int s=0,p=0;   for(int i=Integer.numberOfTrailingZeros(Integer.highestOneBit(t.length));i>=0;--i) {    if(p+(1<<i)< t.length && s + t[p+(1<<i)] < v){     v -= t[p+(1<<i)];     p |= 1<<i;    }   }   return p+1;  }      static class S{   int l = 0;   int r = 0 ;   long le = 0;   long ri = 0;   long tot = 0;   long all = 0;   public S(int l,int r) {    this.l = l;    this.r = r;   }  }  static S a[];  static int[] o;  static void init(int[] f){   o = f;   int len = o.length;   a = new S[len*4];   build(1,0,len-1);  }  static void build(int num,int l,int r){   S cur = new S(l,r);   if(l==r){    a[num] = cur;    return;   }else{    int m = (l+r)>>1;    int le = num<<1;    int ri = le|1;    build(le, l,m);    build(ri, m+1,r);    a[num] = cur;    pushup(num, le, ri);   }  }                static long dd = 10007;  static void update(int num,int l,long v){   if(a[num].l==a[num].r){    a[num].le = v%dd;    a[num].ri = v%dd;    a[num].all = v%dd;    a[num].tot = v%dd;   }else{    int m = (a[num].l+a[num].r)>>1;    int le = num<<1;    int ri = le|1;    pushdown(num, le, ri);    if(l<=m){     update(le,l,v);    }    if(l>m){     update(ri,l,v);    }    pushup(num,le,ri);   }  }  static void pushup(int num,int le,int ri){   a[num].all = (a[le].all*a[ri].all)%dd;   a[num].le = (a[le].le + a[le].all*a[ri].le)%dd;   a[num].ri = (a[ri].ri + a[ri].all*a[le].ri)%dd;   a[num].tot = (a[le].tot + a[ri].tot + a[le].ri*a[ri].le)%dd;     }  static void pushdown(int num,int le,int ri){  }   int gcd(int a,int b){ return b==0?a: gcd(b,a%b);}  InputStream is;PrintWriter out;  void run() throws Exception {is = System.in;out = new PrintWriter(System.out);solve();out.flush();}  private byte[] inbuf = new byte[2];  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 char ncc() {int b;while((b = readByte()) != -1 && !(b >= 32 && b <= 126));return (char)b;}  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 String nline() {int b = skip();StringBuilder sb = new StringBuilder();   while (!isSpaceChar(b) || b == ' ') { sb.appendCodePoint(b);b = readByte(); }   return sb.toString();}  private char[][] nm(int n, int m) {char[][] a = new char[n][];for (int i = 0; i < n; i++) a[i] = ns(m);return a;}  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 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 << 3) + (num << 1) + (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();}}  void print(Object obj){out.print(obj);}  void println(Object obj){out.println(obj);}  void println(){out.println();} }
4	public class Main implements Runnable {   BufferedReader in;  PrintWriter out;  StringTokenizer tok = new StringTokenizer("");  void init() throws FileNotFoundException {    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 mergeSort(int[] a) {    mergeSort(a, 0, a.length - 1);  }  private static void mergeSort(int[] a, int leftIndex, int rightIndex) {    final int MAGIC_VALUE = 50;    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 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;    }  }   public static void main(String[] args) {   new Main().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);   }  }  int mini = Integer.MAX_VALUE;  int maxi = Integer.MIN_VALUE;  int ans = 0;  int ans2 = 0;  int sum = 0;  void solve() throws IOException {   int n = readInt();   int m = readInt();   int maxi=0;   int [][] a = new int [n][m];   int k = readInt();   ArrayDeque<Point> dq = new ArrayDeque<Point> ();   Point p = new Point();   for (int i = 0; i<n; i++)    for (int j= 0; j<m; j++){     a[i][j]=Integer.MAX_VALUE;    }   for (int i = 0; i<k; i++){    int x = readInt()-1;    int y = readInt()-1;    p.x=x;    p.y=y;    dq.add(new Point(x,y));    a[x][y]=0;   }   while (!dq.isEmpty()){    Point v = dq.pollFirst();    Point u = new Point();    if (v.x-1!=-1) {     if (a[v.x-1][v.y]>a[v.x][v.y]+1){      a[v.x-1][v.y]=a[v.x][v.y]+1;      maxi=max(maxi,a[v.x-1][v.y]);      u.x=v.x-1;      u.y=v.y;      dq.add(new Point(u.x,u.y));     }    }    if (v.y-1!=-1) {     if (a[v.x][v.y-1]>a[v.x][v.y]+1){      a[v.x][v.y-1]=a[v.x][v.y]+1;      maxi=max(maxi,a[v.x][v.y-1]);      u.y=v.y-1;      u.x=v.x;      dq.add(new Point(u.x,u.y));     }    }    if (v.x+1!=n) {     if (a[v.x+1][v.y]>a[v.x][v.y]+1){      a[v.x+1][v.y]=a[v.x][v.y]+1;      maxi=max(maxi,a[v.x+1][v.y]);      u.x=v.x+1;      u.y=v.y;      dq.add(new Point(u.x,u.y));     }    }    if (v.y+1!=m) {     if (a[v.x][v.y+1]>a[v.x][v.y]+1){      a[v.x][v.y+1]=a[v.x][v.y]+1;      maxi=max(maxi,a[v.x][v.y+1]);      u.y=v.y+1;      u.x=v.x;      dq.add(new Point(u.x,u.y));     }    }   }   for (int i =0; i<n; i++)    for (int j =0; j<m; j++){     if (maxi==a[i][j]) {      out.print((i+1) + " " + (j+1));      return;     }    }     }             char c[];   void per (int left, int right){   if(left == right){    for (int i = 0; i<=right;i++){     out.print(c[i]);    }    out.println();   }   else {    for (int i = left; i <=right; i++){     char k = c[left];     c[left] = c[i];     c[i] = k;     per(left+1,right);     k = c[left];     c[left] = c[i];     c[i] = k;    }   }  } }
5	public class village {  static int[] X, A;  public void solve()  {   Scanner in = new Scanner(System.in);   int N = in.nextInt(), T = in.nextInt();   X = new int[N];   A = new int[N];   for(int i = 0; i < N; i++) {    X[i] = in.nextInt(); A[i] = in.nextInt();   }   if(N == 1) {    System.out.println("2");    return;   }   List<Integer> x = new ArrayList<Integer>();   for(int i = 0; i < N; i++) {    x.add(i);   }   Collections.sort(x, new Comp());   int places = 0;   for(int i = 0; i < N-1; i++) {    double space = (X[x.get(i+1)]-X[x.get(i)]-A[x.get(i+1)]/2.0-A[x.get(i)]/2.0);    if(space < T) {     continue;    } if(space - T < 1e-9) {     places++;    } else if(space > T) {     places+=2;    }   }   System.out.println(places+2);  }  public class Comp implements Comparator<Integer> {    public int compare(Integer i1, Integer i2) {     return X[i1]-X[i2];    }  }  public static void main(String[] args)  {   new village().solve();  } }
3	public class Main{  static ArrayList a[]=new ArrayList[5000001]; static Vector<pair>schedule_it(ArrayList<pair> v) {  Vector<pair >ans=new Vector<>();  Collections.sort(v, new Comparator<pair>() {  public int compare(pair p1,pair p2) {   if(p1.y<p2.y)   return -1;   if(p1.y>p2.y)   return 1;   if(p1.x<p2.x)   return -1;   if(p1.x>p2.x)   return 1;   return 0;  }  });  int end=-1;  for(int i=0;i<v.size();i++) {  pair p=v.get(i);  if(p.x>end) {   ans.add(p);   end=p.y;  }  }  return ans; } public static void main(String[] args)  {   InputReader in=new InputReader(System.in);   PrintWriter pw = new PrintWriter(System.out);   int n=in.nextInt();   long arr[]=new long[n];   for(int i=0;i<n;i++) {   arr[i]=in.nextLong();   }   HashMap<Long,Integer>hm=new HashMap<>();   int id=0;   for(int i=0;i<n;i++) {   long sum=0;   for(int j=i;j<n;j++) {    sum+=arr[j];    if(!hm.containsKey(sum)) {    hm.put(sum, id++);    a[id-1]=new ArrayList<pair>();    }    a[hm.get(sum)].add(new pair(i,j));   }   }   Vector<pair>fi=new Vector<>();   for(int i=0;i<id;i++) {   Vector<pair> v=schedule_it(a[i]);   if(v.size()>fi.size()) {    fi=v;   }   }   pw.println(fi.size());   for(int i=0;i<fi.size();i++) {   pw.println((fi.get(i).x+1)+" "+(fi.get(i).y+1));   }   pw.flush();   pw.close();    }   private 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;   }   static class tri implements Comparable<tri> {    int p, c, l;     tri(int p, int c, int l) {     this.p = p;     this.c = c;     this.l = l;    }     public int compareTo(tri o) {     return Integer.compare(l, o.l);    }   }    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 static int[] suffle(int[] a,Random gen)   {    int n = a.length;    for(int i=0;i<n;i++)    {     int ind = gen.nextInt(n-i)+i;     int 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 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);   }     public static long GCD(long a,long b)   {    if(b==0)     return a;    else     return GCD(b,a%b);   }     public static void extendedEuclid(int A,int B)   {    if(B==0)    {     d = A;     p = 1 ;     q = 0;    }    else    {     extendedEuclid(B, A%B);     int temp = p;     p = q;     q = temp - (A/B)*q;    }   }     public static long LCM(long a,long b)   {    return (a*b)/GCD(a,b);   }     public static int LCM(int a,int b)   {    return (a*b)/GCD(a,b);   }     public static int binaryExponentiation(int x,int n)   {    int result=1;    while(n>0)    {     if(n % 2 ==1)      result=result * x;     x=x*x;     n=n/2;    }    return result;   }     public static long binaryExponentiation(long x,long n)   {    long result=1;    while(n>0)    {     if(n % 2 ==1)      result=result * x;     x=x*x;     n=n/2;    }    return result;   }     public static int modularExponentiation(int x,int n,int M)   {    int result=1;    while(n>0)    {     if(n % 2 ==1)      result=(result * x)%M;     x=(x%M*x)%M;     n=n/2;    }    return result;   }     public static long modularExponentiation(long x,long n,long M)   {    long result=1;    while(n>0)    {     if(n % 2 ==1)      result=(result%M * x%M)%M;     x=(x%M * x%M)%M;     n=n/2;    }    return result;   }     public static long modInverse(int A,int M)   {    return modularExponentiation(A,M-2,M);   }     public static long modInverse(long A,long M)   {    return modularExponentiation(A,M-2,M);   }     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 long[] shuffle(long[] a, Random gen){     for(int i = 0, n = a.length;i < n;i++){      int ind = gen.nextInt(n-i)+i;      long d = a[i];      a[i] = a[ind];      a[ind] = d;     }     return a;    }   static class pair implements Comparable<pair>{    Integer x;    Integer y;    pair(int l,int id){     this.x=l;     this.y=id;    }    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);    }   }      }
0	public class Main {  public static void main(String[] args){   Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int a, b, min, max, result = 0, temp;  while(n-->0){  a = sc.nextInt();  b = sc.nextInt();  max = Math.max(a, b);  min = Math.min(a, b);  result = 0;  while(true){   result += max/min;   if(max%min == 0){   System.out.println(result);   break;   }     temp = max;   max = min;   min = temp%min;  }  }  sc.close(); }  }
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() );  } }
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());  }  }
1	public class CodeChef2 {   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 class Pair{  int x;  long y;   Pair(int x,long y, Integer integer, int i){  this.y=y;  this.x=x;  }  @Override  public String toString() {  return "(" + x +" "+ y+")";  }     }  static class Edge{  int src;  int dest;  int cost;  int val;   Edge(int src,int dest,int cost,int val){  this.src=src;  this.dest=dest;  this.cost=cost;  this.val=val;  }  public String toString() {  return "(" + src +" "+ dest+": "+ cost +" , "+val+")";  }     }   static class Pair2{  Pair node;  int dist;    Pair2(Pair p,int dist){   node=p;   this.dist=dist;  }  }   static long M=1000000007l;  static HashMap<Character,ArrayList<Character>> dirs;   public static void main(String[] args) throws Exception {   FastReader sc=new FastReader();   BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));      int t=sc.nextInt();   int po=0;     dirs=new HashMap<>();   dirs.put('U', new ArrayList<>());   dirs.get('U').addAll(Arrays.asList('U','R','D','L'));   dirs.put('L', new ArrayList<>());   dirs.get('L').addAll(Arrays.asList('L','U','R','D'));   dirs.put('D', new ArrayList<>());   dirs.get('D').addAll(Arrays.asList('D','L','U','R'));   dirs.put('R', new ArrayList<>());   dirs.get('R').addAll(Arrays.asList('R','D','L','U'));   outer:while(t-- >0) {   po++;   int n=sc.nextInt();   int x=(int) Math.sqrt(n/2);   int y=(int) Math.sqrt(n/4);      if(x*x*2 == n || y*y*4==n)    bw.append("YES\n");   else {    bw.append("NO\n");   }                      }   bw.close();  }      private static int abs(int i) {  if(i<0) {  return -i;  }  return i; }   private static String getRoaring2(String s) {  String res="";  String max="";   for(int i=1;i<=s.length()/2;i++) {    long prev=Long.parseLong(s.substring(0, i));  res=Long.toString(prev);  long prev1=Long.parseLong(res);  long ans=Long.parseLong(s);  long next=prev+1;    while(prev1 <= ans) {   prev1=Long.parseLong(res+Long.toString(next));   res+=Long.toString(next);   next++;  }  if(max.length() == 0) {   max=res;   res="";  }else {   Long a=Long.parseLong(max);   long m=Math.max(a, prev1);   max=Long.toString(m);  }  }  return max; }  private static String getRoaring(String s) {  int val=-1;  for(int i=1;i<=s.length()/2;i++) {  long prev=Long.parseLong(s.substring(0, i));  int j=i,update=i;    while(j<s.length()) {   if(numDigit(prev+1) > numDigit(prev)) {   update++;   }   if(j+update > s.length()) {   break;   }   long cur=Long.parseLong(s.substring(j, j+update));   if(cur != prev+1) {   break;   }   prev=cur;   j+=update;  }    if(j>= s.length()) {   val=i;   break;  }  }  if(val==-1) {  return "";  }else {  String res="";  long prev=Long.parseLong(s.substring(0, val));  res=Long.toString(prev+1);  System.out.println(res+ " ");    long prev1=Long.parseLong(res);    long ans=Long.parseLong(s);    long next=prev+1;    while(prev1 <= ans) {   prev1=Long.parseLong(res+Long.toString(next));   next++;  }  return Long.toString(prev1);  }   }  private static boolean isRoaring(String s) {  for(int i=1;i<=s.length()/2;i++) {  long prev=Long.parseLong(s.substring(0, i));   int j=i,update=i;    while(j<s.length()) {   if(numDigit(prev+1) > numDigit(prev)) {   update++;   }   if(j+update > s.length()) {   break;   }   long cur=Long.parseLong(s.substring(j, j+update));   if(cur != prev+1) {   break;   }   prev=cur;   j+=update;  }    if(j>= s.length()) {   return true;  }  }  return false; }  private static long numDigit(long ans) {  long sum=0;  while(ans > 0) {  sum++;  ans/=10;  }  return sum; }  private static boolean go(int i, int j, long n, long m, Integer k, HashMap<Integer, Boolean>[][] dp) {  if(i==n && j==m && k==0) {  return true;  }  if(i<1 || j<1 || i>n || j>m || k<0) {  return false;  }  if(dp[i][j].containsKey(k)) {  return dp[i][j].get(k);  }   boolean down=go(i+1,j,n,m,k-j,dp);  boolean left=go(i,j+1,n,m,k-i,dp);   dp[i][j].put(k, left||down);  return left||down; }  private static long getDigitSum(long ans) {  long sum=0;  while(ans > 0) {  sum+=ans%10;  ans/=10;  }  return sum; }  private static boolean getAns2(int l, long[] prefix, long x) {   for(int i=l;i<prefix.length-1;i++) {  if((x^prefix[i]) == (prefix[prefix.length-1]^prefix[i])) {   return true;  }  }  return false; }  private static boolean getAns(long[] prefix) {   for(int i=0;i<prefix.length-1;i++) {  if(prefix[i] == (prefix[prefix.length - 1]^prefix[i])) {   return true;  }  }   return false; }  private static void rotate(ArrayList<Integer> arr, int i) {  reverse(arr,0,i-1);  reverse(arr,i,arr.size()-1);  reverse(arr,0,arr.size()-1); }  private static void reverse(ArrayList<Integer> arr, int l, int m) {  while(l<m) {  int temp=arr.get(l);  arr.set(l,arr.get(m));  arr.set(m, temp);  l++;  m--;  } }  static int modInverse(int a, int m)  {   int m0 = m;   int y = 0, x = 1;    if (m == 1)    return 0;    while (a > 1) {    int q = a / m;     int t = m;    m = a % m;    a = t;    t = y;    y = x - q * y;    x = t;   }    if (x < 0)    x += m0;    return x;  }   private static long isPerfectSquare(long num) {  long l=1,h=num;   while(l<=h) {  long mid=l+(h-l)/2;    if(mid*mid == num) {   return mid;  }else if(mid*mid < num) {   l=mid+1;  }else {   h=mid-1;  }  }  return -1; }  private static void rightmax(long[] arr, long n,int[] res,int[] rightmax) {    Deque<Integer> stack=new ArrayDeque<>();   stack.clear();  for(int i=(int) (n-1);i>=0;i--) {  while(!stack.isEmpty() && arr[stack.peek()] <= arr[i]) {   stack.pop();  }    rightmax[i]=(stack.isEmpty()?Integer.MAX_VALUE:stack.peek());  stack.addFirst(i);  } }    private static boolean rotatedSorted(long[] arr, int min) {  reverse(arr,0,min-1);  reverse(arr,min,arr.length-1);  reverse(arr,0,arr.length-1);   if(isSorted(arr)) {  return true;  }  return false; }  private static boolean isSorted(long[] arr) {  for(int i=1;i<arr.length;i++) {  if(arr[i] < arr[i-1]) {   return false;  }  }  return true; }  private static int countDigit(long x) {  int count=0;  while(x > 0) {  x/=10;  count++;  }  return count; }  private static boolean isSub(String s, String c) {  int l=0;   for(int i=0;i<s.length();i++) {  if(l < c.length() && c.charAt(l)==s.charAt(i)) {   l++;  }  if(l==c.length()) {   break;  }  }  if(l==c.length()) {  return true;  }  return false; }  static long power(long a, long d, long n)  {   long res = 1;   a = a % n;   if (a == 0)   return 0;     while (d > 0)   {     if ((d & 1) != 0)    res = (res * a) % n;     d = d >> 1;   a = (a * a) % n;   }   return res;  }  private static void reverse(long[] arr,int l,int m) {  while(l<m) {  long temp=arr[l];  arr[l]=arr[m];  arr[m]=temp;  l++;  m--;  } }   static int UpperBound(ArrayList<Integer> a, int x) {   int l=-1,r=a.size();   while(l+1<r) {    int m=(l+r)>>>1;    if(a.get(m)<=x) l=m;    else r=m;   }   return l+1;  }  private static void printMat(int[][] dp) {    System.out.println("--------------------------------------------------------------------");  for(int i=0;i<dp.length;i++) {   for(int j=0;j<dp[0].length;j++) {   System.out.print(dp[i][j]+" ");   }   System.out.println();  }  System.out.println("--------------------------------------------------------------------"); }   private static int highestOneBit(long n) {  long x=Long.highestOneBit(n);  int c=0;  while(x >0) {  x=x/2;  c++;  }  return c-1; }  private static int bitcount(long l) {  int count=0;    while(l>0) {  l-=(l&(-l));  count++;  }  return count; }  private static void bfs(HashMap<Integer, HashSet<Integer>> tree, int start) {  Queue<Integer> q=new LinkedList<>();  q.offer(start);  HashSet<Integer> visited=new HashSet<>();   System.out.print(q.peek()+"\n");   while(!q.isEmpty()) {  int parent=q.poll();    if(visited.contains(parent)) {   continue;  }  visited.add(parent);  int flag=0;   for(int child:tree.get(parent)) {   if(!visited.contains(child)) {   q.offer(child);   System.out.print(child+" ");   flag=1;   }  }    if(flag==0) {   continue;  }  System.out.println();  } }  static int par; private static HashMap<Integer, HashSet<Integer>> getTreeInputLevel(StringTokenizer st) {  Queue<Integer> q=new LinkedList<>();   HashMap<Integer, HashSet<Integer>> tree=new HashMap<>();  q.offer(Integer.parseInt(st.nextToken()));   par=q.peek();   while(!q.isEmpty()) {  int parent=q.poll();    if(!tree.containsKey(parent)) {   tree.put(parent, new HashSet<Integer>());  }    int left=-1,right=-1;    if(st.hasMoreElements())   left=Integer.parseInt(st.nextToken());    if(st.hasMoreElements())   right=Integer.parseInt(st.nextToken());    if(left != -1) {   tree.get(parent).add(left);   if(!tree.containsKey(left)) {   tree.put(left, new HashSet<Integer>());   }   tree.get(left).add(parent);   q.offer(left);  }    if(right != -1) {   tree.get(parent).add(right);   if(!tree.containsKey(right)) {   tree.put(right, new HashSet<Integer>());   }   tree.get(right).add(parent);   q.offer(right);  }    }  tree.remove(-1);  return tree; }    private static int containsString(String s1,String s2) {  String s=s1+"#"+s2;  int[] z=getZfunc(s);   boolean flag=false;  for(int i=0;i<s.length();i++) {  if(z[i]==s1.length()) {   flag=true;  }  }  int count=0;   for(int i=s1.length();i<z.length;i++) {   if(z[i]==s1.length()) {   count++;  }  }  return count; }  private static int[] getZfunc(String s) {  int[] z=new int[s.length()];  int l=0,r=0;    for(int i=1;i<s.length();i++) {     if(i <= r) {   z[i]=Math.min( z[i-l] , r-i+1);   }   while(i+z[i] < s.length() && s.charAt(z[i])==s.charAt(i+z[i])) {   z[i]++;   }   if(i+z[i] -1 > r) {   l=i;   r=i+z[i]-1;   }     }  return z; }   private static long ceil(long n,long k) {  long ans;  if(n%k==0) {  ans=n/k;  }else {  ans=n/k+1;  }  return ans; }  static ArrayList<Integer> getDivisor(int n){  ArrayList<Integer> div=new ArrayList<>();     for (int i=1; i*i <= n; i++)   {    if (n%i==0)    {     if (n/i == i)      div.add(i);     else {      div.add(i);      div.add(n/i);     }    }   }     return div;  }   static long gcd(long x,long y) {  return (y==0?x:gcd(y,x%y));  }   static int MAXN = 1000001; static int[] spf=new int[MAXN];   static void sieveSmallestFactor()  {   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;    }   }  }     private static HashMap<Integer,Integer> PrimeFactorizationmap(long n) {  int count=0;   HashMap<Integer,Integer> factors=new HashMap<>();  if(n==1) {  factors.put( 1,1);  return factors;  }else {  for(long i=2; i*i <= n ;i++) {   long z=n;   if(z%i==0) {   count=0;   while(z%i==0) {    count++;    z=z/i;   }   factors.put((int) (i+0),count);   }  }  if(n>1) {   factors.put((int) (n+0),1);  }  }  return factors; }     static HashMap<Integer,Integer> getprimeFactors(int n)  {   HashMap<Integer,Integer> ret = new HashMap<>();   while (n > 1)   {    if(ret.containsKey(spf[n])) {    ret.put(spf[n],ret.get(spf[n])+1);   }else {    ret.put(spf[(int) n],1);   }    n = n / spf[n];   }     return ret;  }   static ArrayList<Integer> getPrimeSieve(){  int primesieve[]=new int[1000005];   Arrays.fill(primesieve,0);   for(int i=2;i*i<primesieve.length;i++) {  if(primesieve[i]==0)   for(int j=i*i;j<primesieve.length;j+=i) {    primesieve[j]=1;   }  }   ArrayList<Integer> prime=new ArrayList<>();  for(int i=2;i<primesieve.length;i++) {  if(primesieve[i]==0) {   prime.add(i);  }  }  return prime;  }       private static boolean checkPrimeRM(long n,int k) {  if(n<=4) {  return n==2||n==3;  }   int s=0;  long d=n-1;   while((d&1) != 1) {  d=d/2;  s++;  }   for(int i=0;i<k;i++) {  long a=2+(int)Math.random()*(n-4);  if(isComposite(a,s,d,n)) {   return false;  }  }  return true; }  private static boolean isComposite(long a, int s, long d, long n) {  long x=power(a,d,n);   if(x==1 || x==n-1) {  return false;  }   for(int i=0;i<s;i++){  if(x%(n-1)==0) {   return false;  }  x=(x*x)%n;  }   return true; }   public static HashSet<Long> getPrimeLtoR(int l,int r,List<Integer> prime) {  if(l==1) l++;   int[] arr=new int[r-l+1];   Arrays.fill(arr,0);   for(int i: prime ){   if(i*i<=r) {     int j=(l/i)*i;   if(j<l)    j+=i;   for(;j<=r;j+=i) {   if(j!=i)    arr[j-l]=1;   }  }else {   break;  }    }   HashSet<Long> primeLtoR=new HashSet<>();   for(int i=0;i<arr.length;i++) {  if(arr[i]==0) {   primeLtoR.add((i+l+0l));  }  }  return primeLtoR; } }
3	public class C {  static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) {  int n = in.nextInt();  int[] sol = new int[n];  sol[0] = 1;  int mod = 1000000007;  int maxind = 0;  boolean f = true;  for (int i = 0; i < n; i++) {  if (!f) {     for (int j = 1; j <= maxind; j++) {   sol[j] += sol[j-1];   sol[j] %= mod;   }     }  if (in.next().equals("f")) {   maxind++;   f = true;  }  else {   f = false;  }  }  int ans = 0;  for (int i = 0; i <= maxind; i++) {  ans += sol[i];  ans %= mod;  }  out.println(ans);  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;  }   } }
2	public class B { public static final boolean DEBUG = false; Scanner sc;  public void debug(Object o) {  if (DEBUG) {  int ln = Thread.currentThread().getStackTrace()[2].getLineNumber();  String fn = Thread.currentThread().getStackTrace()[2].getFileName();  System.out.println("(" + fn + ":" + ln+ "): " + o);  } }  public void pln(Object o) {  System.out.println(o); }  long getNumber(int x, int y, int n, int m) {  int n1 = Math.max(0, x + m - n);  int n2 = Math.max(0, y + m - n);  int n3 = Math.max(0, 1 - (x - m));  int n4 = Math.max(0, 1 - (y - m));   int n12 = Math.max(0, n1 + n2 - m - 1);  int n23 = Math.max(0, n2 + n3 - m - 1);  int n34 = Math.max(0, n3 + n4 - m - 1);  int n41 = Math.max(0, n4 + n1 - m - 1);      int m1 = m+1;  long nr = 1 + ((long)m1)*m1*2 - m1*2;  nr -= ((long)n1)*n1 + ((long)n2)*n2 + ((long)n3)*n3 + ((long)n4)*n4;  nr += ((long)n12)*(n12+1)/2 + ((long)n23)*(n23+1)/2 + ((long)n34)*(n34+1)/2 + ((long)n41)*(n41+1)/2;   return nr; } public void run() {    sc = new Scanner(System.in);   int n = sc.nextInt();  int x = sc.nextInt();  int y = sc.nextInt();  int c = sc.nextInt();   if (c <= 1) {  pln(0);  return;  }   int ll = 0;  int rr = 2*n+20;   while(true) {  int m = (ll+rr) / 2;  if (getNumber(x, y, n, m) >= c) {   rr = m;  }  else {   ll = m;  }     if (rr - ll < 3) {   for (int m2=ll; m2<=rr; m2++) {   if (getNumber(x, y, n, m2) >= c) {    pln(m2);    return;   }   }  }  }   } public static void main(String[] args) {  B t = new B();  t.run(); } }
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");  } } }
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); }  }
6	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);   E2RotateColumnsHardVersion solver = new E2RotateColumnsHardVersion();   int testCount = Integer.parseInt(in.next());   for (int i = 1; i <= testCount; i++)    solver.solve(i, in, out);   out.close();  }  static class E2RotateColumnsHardVersion {   public void solve(int testNumber, FastReader in, PrintWriter out) {    int n = in.nextInt();    int m = in.nextInt();    E2RotateColumnsHardVersion.Column[] columns = new E2RotateColumnsHardVersion.Column[m];    for (int i = 0; i < columns.length; ++i) columns[i] = new E2RotateColumnsHardVersion.Column(new int[n]);    for (int i = 0; i < n; ++i) {     for (int j = 0; j < m; ++j) {      columns[j].v[i] = in.nextInt();      if (i == n - 1) columns[j].initMax();     }    }    Arrays.sort(columns, (o1, o2) -> o2.max - o1.max);    if (columns.length > n)     columns = Arrays.copyOf(columns, n);    long[] dp = new long[1 << n];    for (E2RotateColumnsHardVersion.Column c : columns) {     long[] ndp = new long[1 << n];     System.arraycopy(dp, 0, ndp, 0, dp.length);     for (int rot = 0; rot < n; ++rot) {      long[] temp = new long[1 << n];      System.arraycopy(dp, 0, temp, 0, dp.length);      for (int i = 0, pos = rot; i < n; ++i, ++pos) {       if (pos >= n) pos = 0;       int val = c.v[pos];       for (int j = 0; j < temp.length; ++j) {        if ((j & (1 << i)) == 0)         temp[j | (1 << i)] = Math.max(temp[j | (1 << i)], temp[j] + val);       }      }      for (int i = 0; i < ndp.length; ++i)       ndp[i] = Math.max(ndp[i], temp[i]);     }     dp = ndp;    }    out.println(dp[dp.length - 1]);   }   static class Column {    int[] v;    int max;    public Column(int[] v) {     this.v = v;    }    void initMax() {     max = 0;     for (int vv : v) max = Math.max(max, vv);    }   }  }  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 String next() {    return nextString();   }   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 String nextString() {    int c = pread();    while (isSpaceChar(c))     c = pread();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = pread();    } while (!isSpaceChar(c));    return res.toString();   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
3	public class A { public void run() throws Exception {  FastScanner sc = new FastScanner();   int n = sc.nextInt();  int[] arr = new int[n];  int[] color = new int[n];  for (int i = 0; i<n; i++) {  arr[i] =sc.nextInt();  }  Arrays.sort(arr);  int counter = 1;  for (int i = 0; i<n; i++) {  if (color[i]!= 0) continue;  for (int j = i;j<n; j++) {   if (color[j]!= 0) continue;   else if (arr[j]%arr[i] == 0) color[j] = counter;  }  counter++;  }   int max = 0;  for (int i = 0; i<n; i++) {  max = Math.max(max, color[i]);  }  System.out.println(max); } 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);  }  }  } public static void main (String[] args) throws Exception {  new A().run(); } }
0	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   long n = in.nextLong();   out.println(0 + " " + 0 + " " + n);   in.close();   out.close();  } }
1	public class First {  StreamTokenizer in;  PrintWriter out;  int nextInt() throws IOException {   in.nextToken();   return (int)in.nval;  }  long nextLong() throws IOException {   in.nextToken();   return (long) in.nval;  }  String nextString() throws IOException {   in.nextToken();   return in.sval;  }   void run() throws IOException {   in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));   out = new PrintWriter(System.out);   solve();   out.flush();  }  void solve() throws IOException {   int n = nextInt(), k = nextInt(), sum = 0, count = 0;   String str = nextString();   char[] arr = str.toCharArray();   boolean[] bool = new boolean[26];   for(char ch: arr){    bool[((int)ch)-97] = true;   }   for(int i = 0; i < 26; i++){    if(bool[i]){     sum += i+1;     count++;     i += 1;    }    if(count == k) break;   }   if(count == k) out.println(sum);   else out.println(-1);  }  public static void main(String[] args) throws IOException {   new First().run();  } }
4	public class A {  public static void main(String[] args) {  new A().run(); }  private void run() {  Scanner sc = new Scanner(System.in);  String s = sc.next();  sc.close();   int res = 0;  for (int i = 0; i < s.length(); i++)  for (int j = i + 1; j <= s.length(); j++) {   String sub = s.substring(i, j);   int c = count(s, sub);   if (c >= 2)   res = Math.max(res, sub.length());  }  System.out.println(res); }  private int count(String s, String sub) {  int res = 0;  while (s.length() > 0) {  if (s.startsWith(sub))   res++;  s = s.substring(1);  }  return res; } }
2	public class B2 {   public static void main(String[] args) throws IOException {    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));    String line = reader.readLine();    StringTokenizer tokenizer = new StringTokenizer(line);    long n = Long.parseLong(tokenizer.nextToken());    long k = Long.parseLong(tokenizer.nextToken());    if (n == 1){     System.out.println("0");     return;    }    if (n <= k){     System.out.println("1");     return;    }    long first = 0;    long end = k;    long mid;    while (first < end){     mid = first + (end - first)/2;     if (is_exist(n, k , mid - 1)){      end = mid;     } else {      first = mid + 1;     }    }    if (is_exist(n, k, end - 1)){     System.out.println((end ));     return;    }    System.out.println("-1");    return;   }  static boolean is_exist(long n, long k, long x){   long res = n - (k - 1 + k - x)* (k - 1 - (k - x) + 1)/2;   if (res <= k - x ){    return true;   }   return false;  }  }
1	public class Cf2207C {  private static InputReader in = new InputReader(System.in);  private static OutputWriter out = new OutputWriter(System.out);  private static void solve() throws Exception {   int n = in.readInt();   String s = in.readString();   int[] count = new int[200];   boolean[] flag = new boolean[200];   for(int i=0; i<n; ++i){    flag[s.charAt(i)] = true;   }   int ref = 0;   for(int i=0; i<200; ++i){    if(flag[i]){     ref++;    }   }   int total = 0;   int min = Integer.MAX_VALUE;   int j = 0;   for(int i=0; i<n; ++i){    if((j==n)&&(total<ref)){     break;    }    if(total==ref){     min = Math.min(min,j-i);     count[s.charAt(i)]--;     if(count[s.charAt(i)]==0){      total--;     }     continue;    }    for(;j<n; ++j){     count[s.charAt(j)]++;     if(count[s.charAt(j)]==1){      total++;     }     if(total==ref){      min = Math.min(min,j-i+1);      j++;      break;     }    }    count[s.charAt(i)]--;    if(count[s.charAt(i)]==0){     total--;    }   }   out.println(min);  }  public static void main(String[] args) throws Exception {   solve();   out.close();  }  private static class InputReader {   private InputStream stream;   private byte[] buffer;   private int currentIndex;   private int bytesRead;   public InputReader(InputStream stream) {    this.stream = stream;    buffer = new byte[16384];   }   public InputReader(InputStream stream, int bufferSize) {    this.stream = stream;    buffer = new byte[bufferSize];   }   private int read() throws IOException {    if (currentIndex >= bytesRead) {     currentIndex = 0;     bytesRead = stream.read(buffer);     if (bytesRead <= 0) {      return -1;     }    }    return buffer[currentIndex++];   }   public String readString() throws IOException {    int c = read();    while (!isPrintable(c)) {     c = read();    }    StringBuilder result = new StringBuilder();    do {     result.appendCodePoint(c);     c = read();    } while (isPrintable(c));    return result.toString();   }   public int readInt() throws Exception {    int c = read();    int sign = 1;    while (!isPrintable(c)) {     c = read();    }    if (c == '-') {     sign = -1;     c = read();    }    int result = 0;    do {     if ((c < '0') || (c > '9')) {      throw new InputMismatchException();     }     result *= 10;     result += (c - '0');     c = read();    } while (isPrintable(c));    return sign * result;   }   public long readLong() throws Exception {    int c = read();    int sign = 1;    while (!isPrintable(c)) {     c = read();    }    if (c == '-') {     sign = -1;     c = read();    }    long result = 0;    do {     if ((c < '0') || (c > '9')) {      throw new InputMismatchException();     }     result *= 10;     result += (c - '0');     c = read();    } while (isPrintable(c));    return sign * result;   }   public double readDouble() throws Exception {    int c = read();    int sign = 1;    while (!isPrintable(c)) {     c = read();    }    if (c == '-') {     sign = -1;     c = read();    }    boolean fraction = false;    double multiplier = 1;    double result = 0;    do {     if ((c == 'e') || (c == 'E')) {      return sign * result * Math.pow(10, readInt());     }     if ((c < '0') || (c > '9')) {      if ((c == '.') && (!fraction)) {       fraction = true;       c = read();       continue;      }      throw new InputMismatchException();     }     if (fraction) {      multiplier /= 10;      result += (c - '0') * multiplier;      c = read();     } else {      result *= 10;      result += (c - '0');      c = read();     }    } while (isPrintable(c));    return sign * result;   }   private boolean isPrintable(int c) {    return ((c > 32) && (c < 127));   }  }  private static class OutputWriter {   private 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();   }  } }
0	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   if ((n % 4 == 0) || (n % 7 == 0) || (n % 44 == 0) || (n % 47 == 0) || (n % 74 == 0) || (n % 77 == 0)     || (n % 444 == 0) || (n % 447 == 0) || (n % 474 == 0) || (n % 477 == 0) || (n % 744 == 0)     || (n % 747 == 0) || (n % 774 == 0) || (n % 777 == 0)) {    System.out.println("YES");    return;   }   System.out.println("NO");  } }
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+" "); }  }
4	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader            (new FileReader("input.txt"));   StringBuilder out = new StringBuilder();   StringTokenizer tk;   PrintWriter pw = new PrintWriter("output.txt", "UTF-8");     int [] dx = {-1,1,0,0},dy = {0,0,-1,1};     tk = new StringTokenizer(in.readLine());   int n = parseInt(tk.nextToken()),m = parseInt(tk.nextToken());   int k = parseInt(in.readLine());     int [][] dist = new int[n][m];   for(int i=0; i<n; i++)    Arrays.fill(dist[i], -1);     int ans = -1,atx = -1,aty = -1;     Queue<point> q = new LinkedList<point>();     tk = new StringTokenizer(in.readLine());   while(k-- > 0) {    int x = parseInt(tk.nextToken())-1,y = parseInt(tk.nextToken())-1;       dist[x][y] = 0;    q.add(new point(x,y));   }     while(!q.isEmpty()) {    point p = q.remove();       if(dist[p.x][p.y]>ans) {     ans = dist[p.x][p.y];     atx = p.x+1;     aty = p.y+1;    }       for(int i=0; i<4; i++) {     int nx = p.x + dx[i];     int ny = p.y + dy[i];         if(nx>=0 && nx<n && ny>=0 && ny<m && dist[nx][ny]==-1) {      dist[nx][ny] = dist[p.x][p.y] + 1;      q.add(new point(nx,ny));     }    }   }     pw.println(atx+" "+aty);   pw.close();  }  } class point {  int x,y;   public point(int x,int y) {   this.x = x;   this.y = y;  } }
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();  } }
3	public class C {  public static void main(String[] args){  FastScanner scan = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  n = scan.nextInt(); mod = (int)1e9+7;  in = new char[n];  for(int i = 0; i < n; i++) in[i] = scan.next().charAt(0);  dp = new Long[n][n];  out.println(go(0, 0));  out.close(); }  static long go(int at, int i) {  if(at == n-1) return 1;  if(dp[at][i] != null) return dp[at][i];  long res = 0;  if(in[at] == 's') {  res += go(at+1, i);  res %= mod;  if(i > 0) {   res += go(at, i-1);   res %= mod;  }  } else {  res += go(at+1, i+1);  res %= mod;  }  return dp[at][i] = res; }  static Long[][] dp; static int n, mod; static char[] in;  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;  } }  }
3	public class utkarsh{ BufferedReader br;  void solve(){  br = new BufferedReader(new InputStreamReader(System.in));  int i, j, n, mod = (int)(1e9 + 7);  n = ni();  char c[] = new char[n];  for(i = 0; i < n; i++) c[i] = ns().charAt(0);  long dp[][] = new long[n][n];  dp[0][0] = 1;  for(i = 1; i < n; i++){  if(c[i-1] == 'f'){   for(j = 0; j < i; j++){   dp[i][j+1] = dp[i-1][j];   }  }else{   for(j = i-1; j >= 0; j--){   dp[i][j] = dp[i-1][j] + dp[i][j+1];   dp[i][j] %= mod;   }  }  }  long ans = 0;  for(long x : dp[n-1]){  ans += x;  ans %= mod;  }  System.out.println(ans); }  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(); } }
5	public class VkR2A{  static BufferedReader br;  public static void main(String args[])throws Exception{   br=new BufferedReader(new InputStreamReader(System.in));   int nm[] = toIntArray();   int n = nm[0];   int a = nm[1];   int b = nm[2];   nm=toIntArray();   Arrays.sort(nm);   int k=nm[b-1];   int res=nm[b]-k;   System.out.println(res);  }    public static int[] toIntArray()throws Exception{   String str[]=br.readLine().split(" ");   int k[]=new int[str.length];   for(int i=0;i<str.length;i++){    k[i]=Integer.parseInt(str[i]);   }   return k;  }  public static int toInt()throws Exception{   return Integer.parseInt(br.readLine());  }  public static long[] toLongArray()throws Exception{   String str[]=br.readLine().split(" ");   long k[]=new long[str.length];   for(int i=0;i<str.length;i++){    k[i]=Long.parseLong(str[i]);   }   return k;  }  public static long toLong()throws Exception{   return Long.parseLong(br.readLine());  }  public static double[] toDoubleArray()throws Exception{   String str[]=br.readLine().split(" ");   double k[]=new double[str.length];   for(int i=0;i<str.length;i++){    k[i]=Double.parseDouble(str[i]);   }   return k;  }  public static double toDouble()throws Exception{   return Double.parseDouble(br.readLine());  }  public static String toStr()throws Exception{   return br.readLine();  }  public static String[] toStrArray()throws Exception{   String str[]=br.readLine().split(" ");   return str;  }   }
4	public class Test {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   StringBuilder text = new StringBuilder(in.nextLine()); String substr; String max="";   for(int i=2; i<=text.length(); i++){    for(int j=0; j<i; j++){     substr = text.substring(j, i);     if(text.lastIndexOf(substr) != text.indexOf(substr)){      if(substr.length() > max.length()){ max = substr;}     }    }   }   System.out.println(max.length());  } }
1	public class A {  public static void main(String[] args) throws Exception {   BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));          StringTokenizer st = new StringTokenizer(bf.readLine());     int n = Integer.parseInt(st.nextToken());   int d = Integer.parseInt(st.nextToken());   st = new StringTokenizer(bf.readLine());   int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());   int ans = 2;   for(int i=0; i<n-1; i++) {   int diff = a[i+1]-a[i];   if(diff == 2*d) ans++;   else if(diff > 2*d) ans += 2;   }   System.out.println(ans);       } }
5	public class Main {  public static void main(String[]args){   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int t = sc.nextInt();   double [] left = new double[n];   double [] right = new double[n];   for (int i = 0; i<n; i++){    int x = sc.nextInt();    int a = sc.nextInt();    double l = x - (double)a/2;    double r = x + (double)a/2;    left[i] = l;    right[i] = r;   }   int answer = 2;   quickSort(left, right, 0, n-1);   for (int i = 0; i<n-1; i++){    if (left[i+1] - right[i] == t){     answer++;     }    if (left[i+1] - right[i] > t){     answer += 2;    }   }   System.out.println(answer);  }    int partition(double arr[], int left, int right)  {   int i = left, j = right;   double tmp;   double pivot = arr[(left + right) / 2];   while (i <= j) {     while (arr[i] < pivot)      i++;     while (arr[j] > pivot)      j--;     if (i <= j) {      tmp = arr[i];      arr[i] = arr[j];      arr[j] = tmp;      i++;      j--;     }   };   return i;  }  void quickSort(double arr[], int left, int right) {   int index = partition(arr, left, right);   if (left < index - 1)     quickSort(arr, left, index - 1);   if (index < right)     quickSort(arr,index, right);  }  static int partition(double arr[], double arr2[], int left, int right)  {   int i = left, j = right;   double tmp; double tmp2;   double pivot = arr[(left + right) / 2];    while (i <= j) {     while (arr[i] < pivot)      i++;     while (arr[j] > pivot)      j--;     if (i <= j) {      tmp = arr[i];      arr[i] = arr[j];      arr[j] = tmp;      tmp2 = arr2[i];      arr2[i] = arr2[j];      arr2[j] = tmp2;      i++;      j--;     }   };   return i;  }  static void quickSort(double arr[], double[]arr2, int left, int right) {   int index = partition(arr, arr2, left, right);   if (left < index - 1)     quickSort(arr, arr2, left, index - 1);   if (index < right)     quickSort(arr, arr2, index, right);  }  }
4	public class C35C_BFS_Fire {  public static boolean[][] burning;  public static LinkedList<int[]> LitTrees;  public static int N, M;  public static int[] lastTree;  public static void main(String[] args) throws IOException {        BufferedReader input = new BufferedReader(new FileReader("input.txt"));  PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));   StringTokenizer dataR = new StringTokenizer(input.readLine());   N = Integer.parseInt(dataR.nextToken());   M = Integer.parseInt(dataR.nextToken());   burning = new boolean[N+1][M+1];   StringTokenizer dataR1 = new StringTokenizer(input.readLine());   int K = Integer.parseInt(dataR1.nextToken());   StringTokenizer dataR2 = new StringTokenizer(input.readLine());   LitTrees = new LinkedList<int[]>();   for (int j = 0; j < K; j++){    int x = Integer.parseInt(dataR2.nextToken());    int y = Integer.parseInt(dataR2.nextToken());    int[] coord = {x, y};    LitTrees.add(coord);    burning[x][y] = true;   }           spread();      out.println(lastTree[0] + " " + lastTree[1]);   out.close();  }  public static void spread(){   while(!LitTrees.isEmpty()){    int[] studying = LitTrees.removeFirst();    int[] studying1 = {studying[0]-1, studying[1]};    int[] studying2 = {studying[0], studying[1]-1};    int[] studying3 = {studying[0], studying[1]+1};    int[] studying4 = {studying[0]+1, studying[1]};    if (studying1[0] >= 1 && !burning[studying1[0]][studying1[1]]){     LitTrees.add(studying1);     burning[studying1[0]][studying1[1]] = true;    }    if (studying2[1] >= 1 && !burning[studying2[0]][studying2[1]]){     LitTrees.add(studying2);     burning[studying2[0]][studying2[1]] = true;    }    if (studying3[1] < M+1 && !burning[studying3[0]][studying3[1]]){     LitTrees.add(studying3);     burning[studying3[0]][studying3[1]] = true;    }    if (studying4[0] < N+1 && !burning[studying4[0]][studying4[1]]){     LitTrees.add(studying4);     burning[studying4[0]][studying4[1]] = true;    }    lastTree = studying;   }    }    public static boolean ExistsAliveTree() {   if (LitTrees.size() == N*M){    return false;   } else{    return true;   }  } }
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");  } }
0	public class Subtractions {  public static void main(String[] args) {   Scanner scanner = new Scanner(System.in);   int numberOfTests = scanner.nextInt();   while (numberOfTests-- > 0) {    int a = scanner.nextInt();    int b = scanner.nextInt();    int[] res = new int[1];    compute(a, b, res);    System.out.println(res[0]);   }  }  private static void compute(int x, int y, int[] res) {   if (x == 0 || y == 0) {    return;   }   int tmp;   if (x < y) {    tmp = x;    x = y;    y = tmp;   }   res[0] += x / y;   tmp = x % y;   if (tmp == 0) {    return;   }   x = y;   y = tmp;   compute(x, y, res);  } }
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;  } } }
2	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) {     long n = in.nextLong();   long x = in.nextLong();   long y = in.nextLong();   long c = in.nextLong();     long tl, tr, tt = -1, t;   tl = 0;   tr = (long) 4e9;   while(tl<tr){    t = (tl+tr)>>1;       long cc = f(n, t, x, y);    if(cc>=c){     tt = t;     tr = t;    }else tl = t+1;   }     out.writeln(tt); }     public static long f(long n, long t, long x, long y){     long res = (t*t+t)/2 * 4 + 1;   long s;     if(x-t<1){    s = t-x+1;    res -= s*s;   }   if(y-t<1){    s = t-y+1;    res -= s*s;   }   if(x+t>n){    s = x+t-n;    res -= s*s;   }   if(y+t>n){    s = y+t-n;    res -= s*s;   }   s = t-(Math.abs(x-1)+Math.abs(y-1))-1;   if(s>0) res+=(s*s+s)/2;   s = t-(Math.abs(x-1)+Math.abs(n-y))-1;   if(s>0) res+=(s*s+s)/2;   s = t-(Math.abs(n-x)+Math.abs(n-y))-1;   if(s>0) res+=(s*s+s)/2;   s = t-(Math.abs(n-x)+Math.abs(y-1))-1;   if(s>0) res+=(s*s+s)/2;        return 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 (IOException e){     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }   public long nextLong(){   return Long.parseLong(next());  }   } 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 write(Object ... o){   for(Object x : o) out.print(x);  }  public void writeln(Object ... o){   write(o);   out.println();  }  public void close(){   out.close();  } }
6	public class Main {  static HashSet<Integer> adjList[];  public static void main(String[]args)throws IOException{   BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(System.in));   StringBuilder stringBuilder=new StringBuilder();   String temp[]=bufferedReader.readLine().split(" ");   int V=Integer.parseInt(temp[0]);   int E=Integer.parseInt(temp[1]);   adjList=new HashSet[V];   for(int i=0;i<V;i++)    adjList[i]=new HashSet<>();   for(int i=0;i<E;i++){    temp=bufferedReader.readLine().split(" ");    int x=Integer.parseInt(temp[0])-1;    int y=Integer.parseInt(temp[1])-1;    adjList[y].add(x);    adjList[x].add(y);   }   stringBuilder.append(solve(V)+"\n");   System.out.println(stringBuilder);  }  private static long solve(int V) {   long dp[][]=new long[(1<<V)][V];   for(int i=0;i<V;i++)    dp[(1<<i)][i]=1;   for(int mask=1;mask<(1<<V);mask++){       int first = Integer.numberOfTrailingZeros(mask);    for(int i=0;i<V;i++){     if((mask&(1<<i))==0 || first==i) continue;     for (int j = 0; j < V; j++)      if (adjList[i].contains(j) && (mask & (1<<j))!=0)       dp[mask][i] += dp[mask ^ (1 << i)][j];    }   }     long count=0;   for(int mask=1;mask<(1<<V);mask++) {    int first = Integer.numberOfTrailingZeros(mask);    if (Integer.bitCount(mask)>=3)     for (int i = 0; i < V; i++) {      if(adjList[first].contains(i))       count+=dp[mask][i];     }   }   return count/2;   } }
4	public class Main {  public static void main(String[] args)throws IOException, URISyntaxException {   Reader.init(new FileInputStream("input.txt"));   StringBuilder s=new StringBuilder();   boolean[][]vis=new boolean[Reader.nextInt()][Reader.nextInt()];   int k=Reader.nextInt(),r,c;   Queue<Point>q=new LinkedList<Point>();   while(k-->0) {    r=Reader.nextInt()-1;    c=Reader.nextInt()-1;    vis[r][c]=true;    q.add(new Point(r,c));   }   Point end=null;   int[]x={0,0,1,-1},y={1,-1,0,0};   int a,b,i;   while(!q.isEmpty()) {    end=q.poll();    for(i=0;i<4;i++) {     a=end.x+x[i];     b=end.y+y[i];     if(a>=0&&b>=0&&a<vis.length&&b<vis[a].length&&!vis[a][b]) {      vis[a][b]=true;      q.add(new Point(a,b));     }    }   }   s.append(end.x+1).append(' ').append(end.y+1);   PrintWriter p=new PrintWriter("output.txt");   p.println(s);   p.close();  } } class Reader {  static BufferedReader reader;  static StringTokenizer tokenizer;    static void init(InputStream input) throws UnsupportedEncodingException {   reader = new BufferedReader(      new InputStreamReader(input, "UTF-8") );   tokenizer = new StringTokenizer("");  }    static String next() throws IOException {   while ( ! tokenizer.hasMoreTokens() ) {       tokenizer = new StringTokenizer(      reader.readLine() );   }   return tokenizer.nextToken();  }   static String nextLine() throws IOException {   return reader.readLine();  }  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() );  } }
5	public class CF_Chores {    public static void main(String[] args) {   Scanner s = new Scanner(System.in);     int n = s.nextInt();   int a = s.nextInt();   int b = s.nextInt();     long ar[] = new long[n];   for (int i = 0; i < n; i++) {    ar[i]=s.nextLong();   }   Arrays.sort(ar);     long ret = 0;   if(ar[b]==ar[b-1])    System.out.println("0");   else {    ret = ar[b]-ar[b-1];    System.out.println(ret);   }    } }
3	public class Main {  public static class node implements Comparable<node>{  int l,r;  node(){}  node(int l,int r) {  this.l=l;  this.r=r;  }  @Override  public int compareTo(node rhs) {  return r-rhs.r;  } }  public static void main(String args[]){  Scanner in = new Scanner(System.in);  int a = in.nextInt();  int x[] = new int[a];  for(int n=0;n<a;n++){  x[n] = in.nextInt();  }  int max = 1;  int t = 0;  HashMap<Integer, ArrayList<node>> map = new HashMap<Integer, ArrayList<node>>();  for(int n=0;n<a;n++){  int num = 0;  for(int m=n;m<a;m++){   num += x[m];   node node = new node(n, m);   if(!map.containsKey(num)){   ArrayList<node> list = new ArrayList<node>();   list.add(node);   map.put(num, list);   if(max == 1)t = num;   }   else{   ArrayList<node> list = map.get(num);   int left = 0;   int right = list.size()-1;     int res = list.size();   while(left <= right){    int mid = (left + right) >> 1;       if(list.get(mid).r >= n){    res = mid;    right = mid - 1;    }    else{    left = mid + 1;    }   }   if(res == list.size()){    list.add(node);    if(max < res+1){    max = res+1;    t = num;    }   }   else if(list.get(res).r>m){    list.set(res, node);    if(max < res){    max = list.size();    t = num;    }   }      }  }  }  System.out.println(max);  for(int n=0;n<max;n++){  System.out.println((map.get(t).get(n).l+1)+" "+(map.get(t).get(n).r+1));  }   } }
0	public class Solution {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   s.nextLine();   while(s.hasNext()) {    int first = s.nextInt();    int second = s.nextInt();    System.out.println(calculate(first,second));   }  }   public static int calculate(int first, int second) {   int operations = 0;   while(first != 0 && second != 0) {    int temp;    if(first < second) {     temp = second/first;     operations += temp;     second -= (first*temp);    }    else {     temp = first/second;     operations += temp;     first -= (second*temp);    }   }   return operations;  } }
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;   }   } }
1	public class codeforces { public static void main(String[] args) {  PrintWriter out=new PrintWriter(System.out);  Scanner s=new Scanner(System.in);   int t=s.nextInt();  for(int tt=0;tt<t;tt++) {   long n=s.nextInt();   long x=(long)Math.sqrt(n/2);   long y=(long)Math.sqrt(n/4);   if(x*x*2==n || y*y*4==n) {   out.println("YES");   }else {   out.println("NO");   }  }  out.close();  s.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); }  }
5	public class cf166a { private static boolean[][] matrix; private static int n; public static void main(String[] args) {  Scanner sc = new Scanner(System.in);      int n = sc.nextInt();  int k = sc.nextInt();  int[] p = new int[n];  int[] t = new int[n];  int[] score = new int[n];  for(int i=0;i<n;i++){  p[i] = sc.nextInt();  t[i] = sc.nextInt();  score[i] = p[i] * 100 + (50 - t[i]);  }  boolean[] called = new boolean[n];  int x = 0;  boolean check = false;  while(true){  int max = 0;  int y = 0;  for(int i=0;i<n;i++){   if(called[i]==false&&score[i]>max){max=score[i];}  }  for(int i=0;i<n;i++){   if(max==score[i]){   called[i] = true;   x++;   y++;   if(x==k){check=true;}   }  }  if(check){   System.out.println(y);   break;  }  } } }
5	public class test {  public static void main(String[] args) {   Scanner kb = new Scanner(System.in);   int n = kb.nextInt();   int a = kb.nextInt();   int b = kb.nextInt();   int array[] = new int[n];   for (int i = 0; i < n; i++) {    array[i] = kb.nextInt();   }   Arrays.sort(array);   int k = 0;   int t1 = 0;   int t2 = 0;   for (int i = 0; i < b; i++) {    t1= array[i];    if(i<n-1){     t2=array[i+1];     k=t2-t1;    }    else k=0;   }   System.out.println(k);  } }
2	public class C {  static long mod=(long)(1e9+7); public static long powMod(long e,long b) {   long res=1;   while(e>0)  {  if(e%2==1)   res=res*b%mod;  e/=2;  b=b*b%mod;  }  return res; }  public static void main(String[] args) throws IOException  {  Scanner sc=new Scanner(System.in);  PrintWriter pw=new PrintWriter(System.out);  long x=sc.nextLong(),k=sc.nextLong();  if(x==0)  {   System.out.println(0);   return;  }    if(k==0)  {   pw.println((2*x)%mod);        pw.close();return;  }    long ans=2*x-1;  ans=ans%mod;    long b=powMod(k,2);  ans=((ans*b)+1)%mod;      pw.println(ans);    pw.close();     }    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 double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public boolean ready() throws IOException {  return br.ready();  } } }
0	public class Main {  static void solve() throws IOException {   String str = br.readLine();   StringBuffer sb1 = new StringBuffer(str);   StringBuffer sb2 = new StringBuffer(str);   StringBuffer sb3 = new StringBuffer(str);   sb1.deleteCharAt(sb1.length()-1);   sb2.deleteCharAt(sb2.length()-2);   int n1 = Integer.parseInt(sb1.toString());   int n2 = Integer.parseInt(sb2.toString());   int n3 = Integer.parseInt(sb3.toString());   out.println(Math.max(n1, Math.max(n2, n3)));  }  static BufferedReader br;  static StringTokenizer st;  static PrintWriter out;  public static void main(String[] args) throws IOException {   InputStream input = System.in;   br = new BufferedReader(new InputStreamReader(input));   out = new PrintWriter(System.out);   solve();   out.close();  }  static long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  static double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  static int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  static String nextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    String line = br.readLine();    if (line == null) {     return null;    }    st = new StringTokenizer(line);   }   return st.nextToken();  } }
4	public class A {  private BufferedReader in;  private StringTokenizer st;   void solve() throws IOException{   int len = 0;  String x = next();  HashSet<String> h = new HashSet<String>();  for (int i = 0; i < x.length(); i++) {  for (int j = i+1; j <= x.length(); j++) {   String y = x.substring(i,j);   if(h.contains(y)){   if(y.length()>len) len = y.length();   }   else h.add(y);  }  }  System.out.println(len);   } A() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));   eat("");  solve();   }  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 A(); } }
6	public class A{ static int n,m,start; static boolean [][] adj; static long [][] mem; public static void main(String[] args)throws Throwable {  Scanner sc=new Scanner(System.in);  n=sc.nextInt();  m=sc.nextInt();  adj=new boolean [n][n];  for(int i=0;i<m;i++){  int u=sc.nextInt()-1;  int v=sc.nextInt()-1;  adj[u][v]=true;  adj[v][u]=true;  }  mem=new long [n+1][(1<<n)];  for(int i=0;i<=n;i++)  Arrays.fill(mem[i], -1);  long ans=0;  for(int i=0;i<n;i++){  start=i;  ans+=dp(i, (1<<i));  }  System.out.println(ans/2); }  public static long dp(int i,int msk){  if(mem[i][msk]!=-1)  return mem[i][msk];  long ans=0;  if(adj[i][start] && Integer.bitCount(msk)>2)  ans++;  for(int j=start+1;j<n;j++){  if(adj[i][j] && (msk & (1<<j))==0){   ans+=dp(j, msk | (1<<j));  }  }  return mem[i][msk]=ans; }  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();}  } }
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);   TaskB solver = new TaskB();   solver.solve(1, in, out);   out.close();  } } class TaskB {  public void solve(int testNumber, Scanner in, PrintWriter out) {   long n = in.nextLong();   long k = in.nextLong();   if (n == 1) {    out.println(0);    return;   }   if (k * (k - 1) < 2 * (n - 1)) {    out.println(-1);    return;   }   long sq2 = 4 * k * k - 4 * k + 1 - 4 * (2 * n - 2);   double sqrt = Math.sqrt(sq2);   long sq = (long) sqrt;   if ((sq + 1) * (sq + 1) == sq2) {    sq = sq + 1;   } else if ((sq - 1) * (sq - 1) == sq2) {    sq = sq - 1;   }   if (sq*sq == sq2) {    long kmin = (sq + 3) / 2;    out.println(k - kmin + 1);   } else {    long km = Math.max(2, (long) ((sqrt + 3) / 2.0) - 2);    while (((km + k - 2)*(k - km + 1) >= 2*(n-1))) {     ++km;    }    out.println(k - km + 2);   }  } }
1	public class CodehorsesTshirts {           private static void solve() {        int n = nextInt();     HashMap<String, Integer> a = new HashMap<>();   HashMap<String, Integer> b = new HashMap<>();     for(int i = 0; i < n; i++)    a.merge(nextLine(), 1, Integer::sum);     for(int i = 0; i < n; i++)    b.merge(nextLine(), 1, Integer::sum);     b.forEach((k , v) -> {    if(a.containsKey(k))     a.put(k, a.get(k) - Math.min(v , a.get(k)));   });     int cost = a.values().stream().reduce(0, Integer::sum);     println(cost);     }                  public static void main(String[] args) throws IOException {   reader = new BufferedReader(new InputStreamReader(System.in));   writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);   st  = null;   solve();   reader.close();   writer.close();  }   static BufferedReader reader;  static PrintWriter writer;  static StringTokenizer st;   static String next()  {while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}  static String nextLine() {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}     static int nextInt() {return Integer.parseInt(next());}  static long nextLong() {return Long.parseLong(next());}   static double nextDouble(){return Double.parseDouble(next());}  static char nextChar() {return next().charAt(0);}  static int[] nextIntArray(int n)   {int[] a= new int[n]; int i=0;while(i<n){a[i++]=nextInt();} return a;}  static long[] nextLongArray(int n)  {long[]a= new long[n]; int i=0;while(i<n){a[i++]=nextLong();} return a;}   static int[] nextIntArrayOneBased(int n) {int[] a= new int[n+1]; int i=1;while(i<=n){a[i++]=nextInt();} return a;}     static long[] nextLongArrayOneBased(int n){long[]a= new long[n+1];int i=1;while(i<=n){a[i++]=nextLong();}return a;}     static void print(Object o) { writer.print(o); }  static void println(Object o){ writer.println(o);}     }
4	public class Main {  private static StreamTokenizer in;  private static PrintWriter out;  private static BufferedReader inB;   private static int nextInt() throws Exception{   in.nextToken();   return (int)in.nval;  }   private static String nextString() throws Exception{   in.nextToken();   return in.sval;  }   static{          try {   inB = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));   out = new PrintWriter(new FileOutputStream("output.txt"));   } catch(Exception e) {}     in = new StreamTokenizer(inB);  }   private static int[][] mind;  private static boolean[][] used;   private static int n,m;   public static void main(String[] args)throws Exception {   n = nextInt();   m = nextInt();   int k = nextInt();   int[][] mas = new int[k][2];     for(int i = 0; i<k; i++) {    mas[i][0] = nextInt()-1;    mas[i][1] = nextInt()-1;   }     mind = new int[n][m];   used = new boolean[n][m];   for(int i = 0; i<n; i++) {    Arrays.fill(mind[i], Integer.MAX_VALUE);   }     ArrayDeque<int[]> ad = new ArrayDeque<int[]>();     for(int i = 0; i<k; i++) {    ad.add(new int[] {mas[i][0], mas[i][1], 0});   }     while(!ad.isEmpty()) {    int[] cur = ad.remove();       if(used[cur[0]][cur[1]])continue;    int x = cur[0]; int y = cur[1]; int d = cur[2];    mind[x][y] = ++d;    used[x][y] = true;       if(isValid(x+1,y) && !used[x+1][y]) ad.add(new int[] {x+1, y, d});       if(isValid(x,y+1) && !used[x][y+1]) ad.add(new int[] {x, y+1, d});    if(isValid(x,y-1) && !used[x][y-1]) ad.add(new int[] {x, y-1, d});       if(isValid(x-1,y) && !used[x-1][y]) ad.add(new int[] {x-1, y, d});      }     int max = Integer.MIN_VALUE;   int maxx = 0, maxy = 0;     for(int i = 0; i<n; i++) {    for(int j = 0; j<m; j++) {     if(mind[i][j] > max) {      max = mind[i][j];      maxx = i+1;      maxy = j+1;     }    }   }     out.println(maxx + " " + maxy);   out.flush();  }   private static boolean isValid(int x, int y) {   return x>=0 && x<n && y>=0 && y<m;  }        private static void println(Object o) throws Exception {   System.out.println(o);  }  private static void exit(Object o) throws Exception {   println(o);   exit();  }  private static void exit() {   System.exit(0);  }  }
6	public class MaeDosDragoes { public static PrintWriter saida = new PrintWriter(System.out, false); public static class Escanear {   BufferedReader reader;   StringTokenizer tokenizer;  public Escanear() {    this(new InputStreamReader(System.in));   }  public Escanear(Reader in) {    reader = new BufferedReader(in);   }   String proximo() {    if (tokenizer == null || !tokenizer.hasMoreElements()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return tokenizer.nextToken();   }     int proximoNum() {    return Integer.parseInt(proximo());   }  }   public static void main(String[] args) {  Escanear escanear = new Escanear();   int proximoInt = escanear.proximoNum();   double proximoDouble = escanear.proximoNum();   long[] aux = new long[proximoInt];   for(Integer i = 0; i < proximoInt; i++) {    for(Integer j =0; j < proximoInt; j++) {     Integer val = escanear.proximoNum();     if (val.equals(1) || i.equals(j)) {   aux[i] |= 1L << j;   }    }   }   int esquerda = proximoInt/2;   int direita = proximoInt - esquerda;   int[] depois = new int[1 << esquerda];   int maiorMascara = 1 << esquerda;   for(int mascara = 1; mascara <maiorMascara; mascara++) {    int mascaraAtual = mascara;    for(int j = 0; j < esquerda; j++) {     if (((1 << j) & mascara) > 0) {      mascaraAtual &= aux[j + direita] >> direita;      depois[mascara] = Math.max(depois[mascara], depois[mascara ^ (1 << j)]);     }    }    if (mascara == mascaraAtual) {     depois[mascara] = Math.max(depois[mascara],Integer.bitCount(mascara));    }   }   int auxiliar = 0;   int mascaraMaxima = 1 << direita;   for(int mascara = 0; mascara < mascaraMaxima; mascara++) {    int mascaraCorrente = mascara;    int mascaraValor = maiorMascara -1;    for(int j = 0; j < direita; j++) {     if (((1 << j) & mascara) > 0) {      mascaraCorrente &= (aux[j] & (mascaraMaxima-1));      mascaraValor &= aux[j] >> direita;     }    }    if (mascaraCorrente != mascara) continue;    auxiliar = Math.max(auxiliar, Integer.bitCount(mascara) + depois[mascaraValor]);   }   proximoDouble/=auxiliar;   saida.println(proximoDouble * proximoDouble * (auxiliar * (auxiliar-1))/2);   saida.flush();  } }
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);  } }
0	public class A {  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 x = nextLong();   long y = nextLong();   long ans = 0;   while (x > 0 && y > 0) {    if (x > y) {     ans += x / y;     x %= y;    }    else {     ans += y / x;     y %= x;    }   }   System.out.println(ans);  }  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();  } }
1	public class B { static ArrayList<Integer> [] adj; static int [] num; static int dfs(int u, int p){  int cnt = 0;  for(int v:adj[u]){  if(v != p)   cnt += dfs(v, u);  }  if(adj[u].size() == 1 && u != 0 || u == 0 && adj[0].size() == 0)  cnt++;  num[cnt]++;  return cnt; } public static void main(String[] args) throws NumberFormatException, IOException {  Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out);  int n = sc.nextInt();  adj = new ArrayList[n];  for (int i = 0; i < adj.length; ++i) {  adj[i] = new ArrayList<>();  }  for (int i = 1; i < n; ++i) {  int p = sc.nextInt()-1;  adj[p].add(i);  adj[i].add(p);  }  num = new int[n+1];  dfs(0, -1);  for (int i = 1; i < num.length; ++i) {  num[i] += num[i-1];  }  int cur = 1;  for (int i = 0; i < num.length; ++i) {  while(cur <= num[i]){   out.print(i + " ");   ++cur;  }  }  out.close(); }  static class Scanner {  BufferedReader br;  StringTokenizer st;  public Scanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  public String next() throws IOException {  while (st == null || !st.hasMoreTokens()) {   st = new StringTokenizer(br.readLine());  }  return st.nextToken();  }  public int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(next());  } } }
5	public class Main implements Runnable {  PrintWriter out;  BufferedReader in;  StringTokenizer st;   void solve() throws Exception {   int n = nextInt();   int[] a = new int[n];   int sum = 0;   for(int i = 0; i < n; ++i) {    a[i] = nextInt();    sum += a[i];   }   Arrays.sort(a);   int ans = 0, csum = 0;   for(int i = n - 1; csum <= sum - csum && i >= 0; i--) {    csum += a[i];    ans++;   }   out.println(ans);  }  public void run() {   try {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);     solve();    out.close();   } catch (Exception e) {    e.printStackTrace();   }  }   static public void main(String args[]) throws Exception {   (new Main()).run();  }   int nextInt() {   return Integer.parseInt(nextToken());  }   double nextDouble() {   return Double.parseDouble(nextToken());  }   String nextToken() {   while(st == null || !st.hasMoreTokens()) {    try {     String line = in.readLine();     st = new StringTokenizer(line);    } catch(Exception e) {     return null;    }   }   return st.nextToken();  } }
0	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);   ASubtractions solver = new ASubtractions();   solver.solve(1, in, out);   out.close();  }  static class ASubtractions {   int sub(int a, int b) {    if (a % b == 0)     return a / b;    else return a / b + sub(b, a % b);   }   public void solve(int testNumber, InputReader in, OutputWriter out) {    int t = in.nextInt();    int a, b;    while (t-- > 0) {     a = in.nextInt();     b = in.nextInt();     out.println(sub(a, b));    }   }  }  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);   }  }  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 close() {    writer.close();   }   public void println(int i) {    writer.println(i);   }  } }
5	public class D {  static HashMap<Long, Integer> comp = new HashMap<Long, Integer>(); static HashMap<Integer, Long> rev = new HashMap<Integer, Long>(); static long freq[]; public static void main(String[] args) {  FastScanner in = new FastScanner();  int n = in.nextInt();  long a[] = new long[n];  long copy[] = new long[n];  long sum = 0;  for(int i = 0; i < n; i++){  a[i] = in.nextLong();  copy[i] = a[i];  sum+=a[i];  }  Arrays.sort(copy);  for(int i = 0; i < n; i++)   if(!comp.containsKey(copy[i])){   comp.put(copy[i], (comp.size()+1));     }      freq = new long[n+1];  Arrays.fill(freq, 0);  for(int i = 0; i < n; i++){  int v = comp.get(a[i]);  freq[v]++;  }   long res = 0;  BigInteger res2 = new BigInteger("0");  for(int i = 0; i < n; i++){   long x = a[i];      long below = getFreq(x-1);  long eq = getFreq(x);  long above = getFreq(x+1);  long other = (n-i)-below-eq-above;        long leaveOut = below*(x-1) + eq*(x) + above*(x+1);  long cur = (sum-leaveOut)-(x*other);    res2 = res2.add(new BigInteger(""+cur));  res += cur;  sum -= x;  freq[comp.get(x)]--;    }  System.out.println(res2); }  static long getFreq(long n){  if(!comp.containsKey(n)) return 0;  else return freq[comp.get(n)]; }     static class FastScanner{  BufferedReader br;  StringTokenizer st;  public FastScanner(String s) {  try{   br = new BufferedReader(new FileReader(s));  }  catch(FileNotFoundException e) {   e.printStackTrace();  }  }  public FastScanner(){  br = new BufferedReader(new InputStreamReader(System.in));  }   String nextToken() {  while(st == null ||!st.hasMoreElements()){   try {   st = new StringTokenizer(br.readLine());}   catch(IOException e) {   e.printStackTrace();   }    }  return st.nextToken();  }   int nextInt() {  return Integer.parseInt(nextToken());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  }  String next() {  return nextToken();  }   }   }
6	public class E584 {  public static void main(String[] args) {   MyScanner sc = new MyScanner();   PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));   int t = sc.nextInt();   while (t > 0) {    int n = sc.nextInt(); int m = sc.nextInt();    int [][] a = new int[m][n];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      a[j][i] = sc.nextInt();     }    }    int [][] dp = new int[m + 1][(1 << n)];    for (int i = 1; i <= m; i++) {     for (int j = 0; j < (1 << n); j++) {      dp[i][j] = Math.max(dp[i][j], dp[i - 1][j]);      int [] b = a[i - 1];      for (int start = 0; start < n; start++) {       int [] c = new int[n];       for (int p = 0; p < n; p++) c[p] = b[(start + p) % n];       for (int k = 0; k < (1 << n); k++) {        if ((k | j) == j) {         int sum = 0;         for (int p = 0; p < n; p++) {          if (((k >> p) & 1) == 0 && ((j >> p) & 1) == 1) sum += c[p];         }         dp[i][j] = Math.max(dp[i][j], dp[i - 1][k] + sum);        }       }      }     }    }    out.println(dp[m][(1 << n) - 1]);    t--;   }   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;   }   } }
5	public class nA {  Scanner in;  PrintWriter out;  void solve() {   int n = in.nextInt();   int a[] = new int[n];   int sum = 0;   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();    sum+=a[i];   }   Arrays.sort(a);   int nowsum = 0;   int kol = 0;   for(int i = n - 1; i >= 0; i--){    if(nowsum <= sum / 2){     nowsum+=a[i];     kol++;    }else{     break;    }   }   out.println(kol);  }  void run() {   in = new Scanner(System.in);   out = new PrintWriter(System.out);   try {    solve();   } finally {    out.close();   }  }  public static void main(String[] args) {   new nA().run();  } }
1	public class AA { public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = sc.nextInt();  int d =sc.nextInt();  int[] hotels = new int[n];  for (int i = 0; i < hotels.length; i++) {  hotels[i] = sc.nextInt();  }  int count = 0;  for (int i = 0; i < hotels.length-1; i++) {  int one = hotels[i];  int two = hotels[i+1];  double mid = (two-one)*1.0/2.0;  if(mid==d) {   count++;   }  else if(mid>d) {   count+=2;     }    }  count+=2;  System.out.println(count);     out.flush();  out.close(); }  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();  }  } }
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); } }
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()); } }
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(); } }
6	public class CF1102F { 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 m = Integer.parseInt(st.nextToken());  int[][] aa = new int[n][m];  for (int i = 0; i < n; i++) {  st = new StringTokenizer(br.readLine());  for (int j = 0; j < m; j++)   aa[i][j] = Integer.parseInt(st.nextToken());  }  int[][] dd = new int[n][n];  for (int i = 0; i < n; i++)  for (int j = i + 1; j < n; j++) {   int d = Integer.MAX_VALUE;   for (int h = 0; h < m; h++)   d = Math.min(d, Math.abs(aa[i][h] - aa[j][h]));   dd[i][j] = dd[j][i] = d;  }  int[][] dd_ = new int[n][n];  for (int i = 0; i < n; i++)  for (int j = 0; j < n; j++) {   int d = Integer.MAX_VALUE;   for (int h = 0; h < m - 1; h++)   d = Math.min(d, Math.abs(aa[i][h] - aa[j][h + 1]));   dd_[i][j] = d;  }  if (n == 1) {  System.out.println(dd_[0][0]);  return;  }  int[] ii = new int[1 << n];  for (int i = 0; i < n; i++)  ii[1 << i] = i;  int[][][] dp = new int[1 << n][n][n];  for (int b = 0; b < 1 << n; b++)  for (int u = b; u > 0; u &= u - 1) {   int i = ii[u & -u];   for (int v = b ^ 1 << i; v > 0; v &= v - 1) {   int j = ii[v & -v];   if (b == (1 << i ^ 1 << j))    dp[b][i][j] = dd[i][j];   else {    int x = 0;    for (int w = b ^ 1 << i ^ 1 << j; w > 0; w &= w - 1) {    int k = ii[w & -w];    x = Math.max(x, Math.min(dp[b ^ 1 << j][i][k], dd[k][j]));    }    dp[b][i][j] = x;   }   }  }  int b = (1 << n) - 1;  int x = 0;  for (int i = 0; i < n; i++)  for (int j = 0; j < n; j++)   if (i != j)   x = Math.max(x, Math.min(dp[b][i][j], dd_[i][j]));  System.out.println(x); } }
1	public class javatemp { static String map(int a) {  if( a == 0) return "S";  else if ( a == 1 ) return "M";  else if ( a == 2 ) return "L";  else if ( a == 3 ) return "XL";  else if ( a == 4 ) return "XXL";  return ""; }  public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader( new InputStreamReader(System.in));  int ans = 1000;  in.readLine();  String s = in.readLine();  int H = 0;  for(int i =0; i < s.length(); i++)  if( s.charAt(i) == 'H') H++;    for(int i = 0; i < s.length(); i++)  {  int count = 0;  for(int j = 0; j < H; j++)   if( s.charAt( (i +j) % s.length()) =='T') count ++;  ans = Math.min ( ans, count);  }  System.out.println(ans);  }   static void debug(Object...os) {  System.out.println(Arrays.deepToString(os)); } }
1	public class Main { public static void main(String[] args) throws Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int N = Integer.parseInt(br.readLine());  String[] s = {"XXXS", "XXS", "XS", "S", "M", "L", "XL", "XXL", "XXXL"};  int[] size = new int[9];  for(int i=0; i<N; i++){  String c = br.readLine();  for(int j=0; j<9; j++){   if(s[j].equals(c)){   size[j]++;   }  }  }  for(int i=0; i<N; i++){  String c = br.readLine();  for(int j=0; j<9; j++){   if(s[j].equals(c)){   size[j]--;   }  }  }  int sum = 0;  for(int i=0; i<9; i++){  if(size[i]>0)   sum += size[i];  }  System.out.println(sum); } }
2	public class A {  public static void main(String[] args) throws IOException  {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   long N,K,tmp,ans=0;   String s[]=br.readLine().trim().split(" ");   N=Long.parseLong(s[0]);   K=Long.parseLong(s[1]);   long l=1,r=N,mid;   while(l<=r)   {    mid=(l+r)/2;    tmp=mid*(mid+1)/2;    tmp-=N;    tmp+=mid;    if(tmp==K)    {     ans=N-mid;     break;    }    else if(tmp>K)     r=mid-1;    else     l=mid+1;   }   System.out.println(ans);  } }
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);  }  } } }
0	public class Solve4 {  public static void main(String[] args) throws IOException {  FastReader sc = new FastReader();  int x= sc.nextInt();  int y= sc.nextInt();  int z= sc.nextInt();  int t1= sc.nextInt();  int t2= sc.nextInt();  int t3= sc.nextInt();  if(Math.abs(x-y)*t1 < (Math.abs(x-z)+Math.abs(x-y))*t2+3*t3 ) System.out.println("NO");  else System.out.println("YES");  }  static class FastReader {   BufferedReader br;   StringTokenizer st;   public FastReader() {    br = new BufferedReader(new InputStreamReader(System.in));   }   public String next() throws IOException {    if (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 String nextLine() {    String s = "";    try {     s = br.readLine();    } catch (IOException ex) {    }    return s;   }  } }
5	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   MyReader in = new MyReader(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, MyReader in, PrintWriter out) {    int n = in.nextInt();    int[] a = new int[n];    for (int i = 0; i < n; ++i) {     a[i] = in.nextInt();    }    Map<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);     }    }    List<Integer> compressed = new ArrayList<>();    compressed.add(-1);    compressed.add(Integer.MAX_VALUE);    compressed.addAll(map.keySet());    Collections.sort(compressed);       int N = compressed.size() + 10;    BIT count = new BIT(N);    BIT sum = new BIT(N);    BigInteger ret = BigInteger.ZERO;    for (int i = n - 1; i >= 0; --i) {     int l = findLeft(compressed, a[i] - 2);     int r = findRight(compressed, a[i] + 2);     long left = sum.sum(0, l);     long countLeft = count.sum(0, l);     long right = sum.sum(r, N);     long countRight = count.sum(r, N);                           long t = (left - countLeft * a[i]) + (right - a[i] * countRight);     ret = ret.add(BigInteger.valueOf(t));     int x = Collections.binarySearch(compressed, a[i]);     sum.update(x, a[i]);     count.update(x, 1);    }    out.println(ret);   }   private int findLeft(List<Integer> a, int t) {    int lo = -1, hi = a.size();    while (hi - lo > 1) {     int m = lo + (hi - lo) / 2;     if (a.get(m) <= t) {      lo = m;     } else {      hi = m;     }    }    return lo;   }   private int findRight(List<Integer> a, int t) {    int lo = -1, hi = a.size();    while (hi - lo > 1) {     int m = lo + (hi - lo) / 2;     if (a.get(m) < t) {      lo = m;     } else {      hi = m;     }    }    return hi;   }   class BIT {    long[] tree;    public BIT(int n) {     tree = new long[n + 1];    }    public void update(int x, long d) {     while (x < tree.length) {      tree[x] += d;      x += x & -x;     }    }    public long sum(int l, int r) {     return sum(r) - sum(l - 1);    }    public long sum(int x) {     long sum = 0;     while (x > 0) {      sum += tree[x];      x -= x & -x;     }     return sum;    }   }  }  static class MyReader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public MyReader(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());   }  } }
2	public class B {  static long n, k;  public static void main(String[] args) throws Exception {   Scanner in = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   n = in.nextLong();   k = in.nextLong();   long ans = n - TernarySearch(0, n);   pw.println(ans);   pw.close();  }  static long cal(long m) {   long x = (m * (m + 1)) / 2;   long y = x - (n - m);   return abs(k - y);  }  static long TernarySearch(long l, long r) {   long m1, m2;   while (r - l > 5) {    m1 = (2 * l + r) / 3;    m2 = (l + 2 * r) / 3;    if (cal(m1) > cal(m2)) l = m1;    else r = m2;   }   long min = cal(l), i = l;   for (; l <= r; l++) {    long t = cal(l);    if (t < min) {     min = t;     i = l;    }   }   return i;  }   static void debug(Object... obj) {   System.err.println(Arrays.deepToString(obj));  } }
3	public class Solver {  public static void main(String[] args) {   FastReader in = new FastReader();   PrintWriter out = new PrintWriter(System.out);   TaskC solver = new TaskC(in, out);   solver.solve();   out.close();  }  static class TaskC {   FastReader in;   PrintWriter out;   public TaskC(FastReader in, PrintWriter out) {    this.in = in;    this.out = out;   }   public void solve() {    solveA();   }   public void solveA() {    int n = in.nextInt();    int[] inputColors = in.nextIntArray(n);    int colors = 0;    Arrays.sort(inputColors);    for (int i = 0; i < inputColors.length; i++) {     if (inputColors[i] == -1) {      continue;     }     int colorCode = inputColors[i];     boolean colorFound = false;     for (int j = i; j < inputColors.length; j++) {      if (inputColors[j] != -1 && inputColors[j] % colorCode == 0) {       if (!colorFound) {        colorFound = true;        colors++;       }       inputColors[j] = -1;      }     }    }    out.println(colors);   }   public void solveB() {   }   public void solveC() {   }   public void solveD() {   }   public void solveE() {   }   public void solveF() {   }   public void solveG() {   }   public void solveH() {   }  }  private static long gcd(long a, long b) {   if (a == 0) {    return b;   }   return gcd(b % a, a);  }  private static long lcm(long a, long b) {   return (a * b) / gcd(a, b);  }  private static int min(int a, int b) {   return a < b ? a : b;  }  private static int max(int a, int b) {   return a > b ? a : b;  }  private static int min(ArrayList<Integer> list) {   int min = Integer.MAX_VALUE;   for (int el : list) {    if (el < min) {     min = el;    }   }   return min;  }  private static int max(ArrayList<Integer> list) {   int max = Integer.MIN_VALUE;   for (int el : list) {    if (el > max) {     max = el;    }   }   return max;  }  private static int min(int[] list) {   int min = Integer.MAX_VALUE;   for (int el : list) {    if (el < min) {     min = el;    }   }   return min;  }  private static int max(int[] list) {   int max = Integer.MIN_VALUE;   for (int el : list) {    if (el > max) {     max = el;    }   }   return max;  }  private static void fill(int[] array, int value) {   for (int i = 0; i < array.length; i++) {    array[i] = value;   }  }   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;   }   int[] nextIntArray(int n) {    int[] array = new int[n];    for (int i = 0; i < n; i++) {     array[i] = nextInt();    }    return array;   }  } }
1	public class Task1b {  static int[] fromRC (String data) {  int pos = data.indexOf('C');  int res[] = new int[2];  res[0] = Integer.parseInt(data.substring(1, pos));  res[1] = Integer.parseInt(data.substring(pos + 1));  return res; }  static int[] fromXC (String data) {  int pos = 0;  int res[] = new int[2];  res[0] = res[1] = 0;  while (data.charAt(pos) >= 'A' && data.charAt(pos) <= 'Z') {  res[1] *= 26;  res[1]++;  res[1] += data.charAt(pos) - 'A';  pos++;  }  res[0] = Integer.parseInt(data.substring(pos));  return res; }  static String toRC (int[] data) {  return String.format("R%dC%d", data[0], data[1]); }  static String toXC (int[] data) {  StringBuilder sb = new StringBuilder();  while (data[1] > 0) {  data[1]--;  sb.append((char)('A' + data[1] % 26));  data[1] /= 26;  }  sb = sb.reverse();  sb.append(data[0]);  return sb.toString(); }   public static void main(String[] args) throws Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  for (int i = 0; i < n; i++) {  String s = br.readLine();  if ((s.charAt(0) == 'R') &&   (s.charAt(1) >= '0' && s.charAt(1) <= '9') &&   (s.indexOf('C') != -1)) {     System.out.println(toXC(fromRC(s)));  } else {   System.out.println(toRC(fromXC(s)));  }  } } }
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();  } }
5	public class Main {    static int sum=0;    public static void main(String[] args)throws Exception{   Scanner sc =new Scanner(System.in);            while(sc.hasNext()){   int n=ni(sc),x[]=new int[n+1];  for(int i=1;i<=n;i++)x[i]=ni(sc);  sort(x);  if(x[n]==1){x[n]=2;for(int i=1;i<=n;i++)System.out.print(x[i]+" ");}  else{x[0]=1;  for(int i=0;i<n;i++)System.out.print(x[i]+" ");  }    }      }    static void db(Object... os){    System.err.println(Arrays.deepToString(os)); }   static int ni(Scanner in){  return in.nextInt();  }  }
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 {   long MOD = (long) 1e9 + 7;   long[][] dp;   int[] a;   public void solve(int testNumber, InputReader in, OutputWriter out) {    int N = in.nextInt();    a = new int[N];    dp = new long[N][N];    int i;    for (i = 0; i < N; i++) {     char c = in.nextChar();     if (c == 'f') {      a[i] = 1;     }    }    out.printLine(iterative());     }   public long iterative() {    int i, j, N = a.length, lastLevel = 0;    dp[0][0] = 1;    for (i = 1; i < N; i++) {     if (a[i - 1] == 1) {      lastLevel++;      for (j = 1; j <= lastLevel; j++) {       dp[i][j] = dp[i - 1][j - 1];      }     } else {      dp[i][N - 1] = dp[i - 1][N - 1];      for (j = N - 2; j >= 0; j--) {       dp[i][j] = (dp[i][j + 1] + dp[i - 1][j]) % MOD;      }     }    }    long ans = 0;    for (i = 0; i < N; i++) {     ans += dp[N - 1][i];    }    return ans % MOD;   }  }  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());   }   public char nextChar() {    return next().charAt(0);   }  }  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();   }  } }
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) {    int n = in.readInt();    boolean[] isF = new boolean[n];    for (int i = 0; i < n; i++) {     isF[i] = in.readCharacter() == 'f';    }    int[][] mem = new int[n + 1][n + 1];    mem[n][0] = 1;    for (int idx = n - 1; idx >= 0; idx--) {     for (int indentLevel = 0; indentLevel < n; indentLevel++) {      mem[idx + 1][indentLevel + 1] += mem[idx + 1][indentLevel];      mem[idx + 1][indentLevel + 1] %= MiscUtils.MOD7;      int res = isF[idx] ?        mem[idx + 1][indentLevel + 1] - mem[idx + 1][indentLevel] :        mem[idx + 1][indentLevel];      mem[idx][indentLevel] = (res + MiscUtils.MOD7) % MiscUtils.MOD7;     }    }    out.printLine(mem[0][0]);   }  }  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 char readCharacter() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    return (char) c;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  static class MiscUtils {   public static final int MOD7 = (int) (1e9 + 7);  }  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 close() {    writer.close();   }   public void printLine(int i) {    writer.println(i);   }  } }
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)); } }
1	public class Main {  public static void main(String[] args)  {   Scanner stdin = new Scanner(System.in);     test(stdin);   stdin.close();  }  public static void test(Scanner stdin)  {  int n = stdin.nextInt();  int min = Integer.MAX_VALUE;  for(int i = 0; i < n; i++)  {   int a = stdin.nextInt();   if((int)((1.0)*a/(Math.max(i, n - i - 1))) < min)   { min = (int)((1.0)*a/(Math.max(i, n - i - 1))); }  }  System.out.println(min);  } }
1	public class Main { public static void main(String args[]) throws IOException {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  String s;  int i,j;  for(i=0;i<n;i++)  {  s = sc.next();  j = 0;  boolean ok;       while((s.charAt(j)>='A')&&(s.charAt(j)<='Z')) j++;       while((j<s.length())&&(s.charAt(j)>='0')&&(s.charAt(j)<='9')) j++;       if (j==s.length()) ok = true; else ok = false;       String s1="",s2="";       if (ok)       {       j = 0;       while((s.charAt(j)>='A')&&(s.charAt(j)<='Z'))        {        s1 += s.charAt(j);        j++;       }       while(j<s.length())        {        s2 += s.charAt(j);        j++;       }       int v = 0,p = 1;       for(j=s1.length()-1;j>=0;j--)       {        v += p*(s1.charAt(j)-'A'+1);        p*=26;       }       System.out.println("R"+s2+"C"+v);       } else       {       j = 1;       while((s.charAt(j)>='0')&&(s.charAt(j)<='9'))       {        s1 += s.charAt(j);        j++;       }       j++;       while(j<s.length())       {        s2 += s.charAt(j);        j++;       }   Integer a = new Integer(s2);       String s3="";       int d;       while(a > 0)       {        d = a%26; a/=26;        if (d==0) {d=26; a--;}        s3 = Character.toUpperCase(Character.forDigit(9+d,36)) + s3;          }       System.out.println(s3+s1);       }  } } }
2	public class PipelineSolver {  private long n;  private long k;  public static void main(String[] args) {   PipelineSolver solver = new PipelineSolver();   solver.readData();   int solution = solver.solve();   solver.print(solution);  }  private int gcd(int a, int b) {   return b == 0 ? a : gcd(b, a % b);  }  private int lcm(int a, int b) {   return a * b / gcd(a, b);  }  private void print(int[] values) {   StringBuilder builder = new StringBuilder();   for (int value : values) {    builder.append(value);    builder.append(" ");   }   print(builder);  }  private void print(Object value) {   System.out.println(value);  }  private void print(boolean value) {   System.out.println(value ? "YES" : "NO");  }  private void print(int value) {   System.out.println(value);  }  private void print(long value) {   System.out.println(value);  }  private void print(double value) {   System.out.printf(Locale.ENGLISH, "%.10f", value);  }  private int[] getDigits(int number) {   int[] digits = new int[10];   int index = digits.length - 1;   int digitsCount = 0;   while (number > 0) {    digits[index] = number % 10;    number /= 10;    index--;    digitsCount++;   }   int[] result = new int[digitsCount];   System.arraycopy(digits, digits.length - digitsCount, result, 0, digitsCount);   return result;  }  private int[] readArray(Scanner scanner, int size) {   int[] result = new int[size];   for (int i = 0; i < size; i++) {    result[i] = scanner.nextInt();   }   return result;  }  private void readData() {   Scanner scanner = new Scanner(System.in);   n = scanner.nextLong();   k = scanner.nextLong();  }  private int solve() {   if (n == 1) {    return 0;   }   if (n <= k) {    return 1;   }   int result;   long l;   long d = (5 - 2 * k) * (5 - 2 * k) - 4 * (2 * n - 4 * k + 4);   if (d < 0)   {    result = -1;   } else {    l = Math.min(Math.max((int)((2 * k - 3 - Math.sqrt(d)) / 2), 0), Math.max((int)((2 * k - 3 + Math.sqrt(d)) / 2), 0));    long difference = n - k * (l + 1) + l * (l + 3) / 2;    if (l > k - 2) {     result = -1;    } else if (l == k - 2) {     result = difference == 0 ? (int) (l + 1) : -1;    } else {     result = (int) (l + 1 + (difference == 0 ? 0 : 1));    }   }   return result;  } }
5	public class ProblemE {  static int mod = (int) (1e9+7);  static InputReader in;  static PrintWriter out;   static class SegmentTree {   long st[];    SegmentTree(int n) {    st = new long[4*n];    build(0, n - 1, 1);   }     int getMid(int s, int e) {    return (s+e)>>1;   }   long merge(long a,long b){    return a+b;   }     void update(int s, int e, int x, int y, long c, int si){    if(s == x && e == y){     st[si] += c;    }    else{     int mid = getMid(s, e);     if(y <= mid)       update(s, mid, x, y, c, 2*si);     else if(x > mid)      update(mid + 1, e, x ,y ,c ,2*si + 1);     else{      update(s, mid, x, mid, c, 2*si);      update(mid + 1, e, mid + 1, y, c, 2*si + 1);     }     st[si] = merge(st[2*si],st[2*si+1]);    }   }   long get(int s, int e, int x, int y, int si){    if(s == x && e == y){     return st[si];    }    int mid = getMid(s, e);    if(y <= mid)     return get(s, mid, x, y, 2*si);    else if(x > mid)     return get(mid + 1, e, x, y, 2*si + 1);    return merge(get(s, mid, x, mid, 2*si), get(mid + 1, e, mid + 1, y, 2*si + 1));   }   void build(int ss, int se, int si){    if (ss == se) {     st[si] = 0;     return;    }    int mid = getMid(ss, se);    build(ss, mid, si * 2 );    build(mid + 1, se, si * 2 + 1);    st[si] = merge(st[2*si],st[2*si+1]);   }    }    public static void main(String[] args) throws FileNotFoundException  {   in = new InputReader(System.in);   out = new PrintWriter(System.out);        int n = in.nextInt();   int[] arr = in.nextIntArray(n);   ArrayList<Integer>list = new ArrayList<>();   HashMap<Integer,Integer> map = new HashMap<>();     for(int i = 0; i < n; i++){    list.add(arr[i]);    list.add(arr[i] + 1);    list.add(arr[i] - 1);   }   Collections.sort(list);   int j = 1;   for(int k : list){    if(map.containsKey(k)) continue;    map.put(k, j++);   }     SegmentTree seg = new SegmentTree(j + 1);   SegmentTree seg1 = new SegmentTree(j + 1);   BigInteger ans = BigInteger.ZERO;   BigInteger sum = BigInteger.ZERO;    for(int i = 0; i < n; i++){    long x = seg.get(0, j - 1, map.get(arr[i] - 1), map.get(arr[i] + 1), 1);    long y = seg1.get(0, j - 1, map.get(arr[i] - 1), map.get(arr[i] + 1), 1);    ans = ans.add(new BigInteger(""+x));    ans = ans.subtract(sum);    ans = ans.add(new BigInteger(""+((arr[i] * 1l *(i - y)))));        seg.update(0, j - 1, map.get(arr[i]), map.get(arr[i]), arr[i], 1);    seg1.update(0, j - 1, map.get(arr[i]), map.get(arr[i]), 1, 1);    sum = sum.add(new BigInteger(arr[i] + ""));   }     out.println(ans);   out.close();  }  static class Pair implements Comparable<Pair>  {   int x,y;   int i;     Pair (int x,int y)   {     this.x = x;     this.y = y;   }   Pair (int x,int y, int i)   {     this.x = x;     this.y = y;     this.i = i;   }   public int compareTo(Pair o)   {    return Long.compare(this.i,o.i);       }   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 + " "+i;   }     }   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 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;  }  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);   }  } }
2	public class Pipeline {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   long n = in.nextLong();   long k = in.nextLong();   if (n == 1) {    System.out.println(0);    return;   }   if (k >= n) {    System.out.println(1);    return;   }   long total = (k + 2) * (k - 1) / 2 - (k - 2);   if (total < n) {    System.out.println(-1);    return;   }         int i = 2, j = (int) k;   while (i < j) {    int m = (i + j + 1) / 2;    total = (k + m) * (k - m + 1) / 2 - (k - m);    if (total < n)     j = m - 1;    else     i = m;   }   System.out.println(k - i + 1);  } }
6	public class Main {  static FastScanner fs=new FastScanner();  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();   }   int Int() {    return Integer.parseInt(next());   }   long Long() {    return Long.parseLong(next());   }   String Str(){    return next();   }  }   public static void main (String[] args) throws java.lang.Exception {   PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   int T=1;   for(int t=0;t<T;t++){    int n=Int(),k=Int();    int A[][]=new int[n][2];    for(int i=0;i<n;i++){     A[i][0]=Int();     A[i][1]=Int();    }    Solution sol=new Solution(out);    sol.solution(A,k);   }   out.close();  }   public static int Int(){   return fs.Int();  }  public static long Long(){   return fs.Long();  }  public static String Str(){   return fs.Str();  } }    class Solution{  PrintWriter out;  public Solution(PrintWriter out){   this.out=out;  }   long dp[][];  int mod=1000000007;  int time;  public void solution(int A[][],int t){   this.time=t;   dp=new long[4][1<<A.length+2];   for(int i=0;i<dp.length;i++){    Arrays.fill(dp[i],-1);   }   long a=dfs(A,0,(1<<A.length)-1);   out.println(a);  }  public long dfs(int A[][],int pre,int state){   int use=cal(A,state);   if(time-use==0){    return 1;   }   if(time<use||state==0){    return 0;   }   if(dp[pre][state]!=-1)return dp[pre][state];   long res=0;   for(int i=0;i<A.length;i++){    if(((state&(1<<i))!=0)&&A[i][1]!=pre){     res+=dfs(A,A[i][1],(state^(1<<i)));     res%=mod;    }   }   dp[pre][state]=res;   return res;  }  public int cal(int A[][],int state){   int t=0;   for(int i=0;i<A.length;i++){    if((state&(1<<i))==0){     t+=A[i][0];    }   }   return t;  }  }
5	public class CottageVillage { public Scanner in = new Scanner(System.in); public PrintStream out = System.out;  public int n, t; public Pair[] v;  public void main() {  n = in.nextInt();  t = in.nextInt();   int i;  v = new Pair[n];  for(i=0;i<n;++i) v[i] = new Pair(in.nextInt() * 2, in.nextInt());   Arrays.sort(v);   int res = 2;  for(i=0;i+1<n;++i)  {  if(v[i].x + v[i].y + 2*t == v[i+1].x - v[i+1].y) ++res;  else if(v[i].x+v[i].y+2*t < v[i+1].x-v[i+1].y) res +=2;  }   out.println(res); }   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 CottageVillage()).main(); } }
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 Solution {  BufferedReader in;  PrintWriter out;  StringTokenizer st;  void solve() throws IOException {   int n = ni();   int[] v = new int[n];   for (int i = 0; i < n; ++i)    v[i] = ni();   Arrays.sort(v);   int mn = v[0];   for (int i = 1; i < n; ++i)    if (v[i] > mn) {     out.println(v[i]);     return;    }   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();  } }
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(); } }
2	public class Main {  static int n, k;  public static void main(String[] args) throws IOException {   FastScanner sc = new FastScanner();   PrintWriter pw = new PrintWriter(System.out);   n = sc.nextInt();   k = sc.nextInt();   long l = 0;   long r = n + 1;   while (l + 1 != r) {    long m = (r + l) / 2;    if (check(m))     l = m;    else     r = m;   }   pw.print(l * (l + 1L) / 2L - k);   pw.close();  }  public static boolean check(long m) {   return m * (m + 1) / 2 - (n - m) <= k;  } } class FastScanner {  static BufferedReader br;  static StringTokenizer st = new StringTokenizer("");  public FastScanner() {   br = new BufferedReader(new InputStreamReader(System.in));  }  public String next() throws IOException {   while (!st.hasMoreTokens())    st = new StringTokenizer(br.readLine());   return st.nextToken();  }  public int nextInt() throws IOException {   return Integer.parseInt(next());  } }
1	public class Test11 {  public static void main(String[] Args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   String s0 = sc.nextLine();   int s = 0;   int m = 0;   int l = 0;   int s1 = 0;   int l1 = 0;   int s2 = 0;   int l2 = 0;   int s3 = 0;   int l3 = 0;   for (int i = 0; i < n; i++) {    s0 = sc.nextLine();    if (s0.charAt(0) == 'S') s++;    if (s0.charAt(0) == 'M') m++;    if (s0.charAt(0) == 'L') l++;    if (s0.charAt(0) == 'X' && s0.length() == 2 && s0.charAt(s0.length() - 1) == 'S') s1++;    if (s0.charAt(0) == 'X' && s0.length() == 3 && s0.charAt(s0.length() - 1) == 'S') s2++;    if (s0.charAt(0) == 'X' && s0.length() == 4 && s0.charAt(s0.length() - 1) == 'S') s3++;    if (s0.charAt(0) == 'X' && s0.length() == 2 && s0.charAt(s0.length() - 1) == 'L') l1++;    if (s0.charAt(0) == 'X' && s0.length() == 3 && s0.charAt(s0.length() - 1) == 'L') l2++;    if (s0.charAt(0) == 'X' && s0.length() == 4 && s0.charAt(s0.length() - 1) == 'L') l3++;   }    int rs = 0;   int rm = 0;   int rl = 0;   int rs1 = 0;   int rl1 = 0;   int rs2 = 0;   int rl2 = 0;   int rs3 = 0;   int rl3 = 0;   for (int i = 0; i < n; i++) {    s0 = sc.nextLine();    if (s0.charAt(0) == 'S') rs++;    if (s0.charAt(0) == 'M') rm++;    if (s0.charAt(0) == 'L') rl++;    if (s0.charAt(0) == 'X' && s0.length() == 2 && s0.charAt(s0.length() - 1) == 'S') rs1++;    if (s0.charAt(0) == 'X' && s0.length() == 3 && s0.charAt(s0.length() - 1) == 'S') rs2++;    if (s0.charAt(0) == 'X' && s0.length() == 4 && s0.charAt(s0.length() - 1) == 'S') rs3++;    if (s0.charAt(0) == 'X' && s0.length() == 2 && s0.charAt(s0.length() - 1) == 'L') rl1++;    if (s0.charAt(0) == 'X' && s0.length() == 3 && s0.charAt(s0.length() - 1) == 'L') rl2++;    if (s0.charAt(0) == 'X' && s0.length() == 4 && s0.charAt(s0.length() - 1) == 'L') rl3++;   }    int ans = Math.abs(s1 - rs1) + Math.abs(s2 - rs2) + Math.abs(s3 - rs3) + (Math.abs(s - rs) + Math.abs(l - rl) + Math.abs(m - rm))/2;   System.out.println(ans);     } }
1	public class TestClass11 {   public static void main(String[] args) {   InputReader in=new InputReader(System.in);  OutputWriter out=new OutputWriter(System.out);  int n=in.readInt();  String s=in.readString();  int low[]=new int[26];  int upper[]=new int[26];  boolean islow[]=new boolean[26];  boolean isupper[]=new boolean[26];  Arrays.fill(low,Integer.MAX_VALUE);  Arrays.fill(upper, Integer.MAX_VALUE);   int ans[]=new int[n];  int finalsans=Integer.MAX_VALUE;  for(int i=0;i<n;i++){  int c=s.charAt(i);  if(c>='a'&&c<='z'){   islow[c-'a']=true;  }  else{   isupper[c-'A']=true;  }    }     for(int i=n-1;i>=0;i--){  int c=s.charAt(i);    if(c>='a'&&c<='z'){   low[c-'a']=i;  }  else{   upper[c-'A']=i;  }      for(int j=0;j<26;j++){   if(islow[j]==true){   ans[i]=Math.max(ans[i], low[j]);   }  }   for(int j=0;j<26;j++){    if(isupper[j]==true){    ans[i]=Math.max(ans[i], upper[j]);   }  }      finalsans=Math.min(ans[i]-i+1, finalsans);  }    System.out.println(finalsans);    } } 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 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); } }  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(); }  public void flush() {  writer.flush(); }  }  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 Spreadsheet {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int N = in.nextInt();   in.nextLine();   for (int i = 0; i < N; i++) {    String str = in.nextLine();    if (str.indexOf("R") == 0 && str.indexOf("R") + 1 < str.indexOf("C") && isNum(str.charAt(1))) {     int row = Integer.parseInt(str.substring(str.indexOf("R") + 1, str.indexOf("C")));     int col = Integer.parseInt(str.substring(str.indexOf("C") + 1));     System.out.println(convertRC(row, col));    } else {     String row = "";     int j = 0;     while (str.charAt(j) >= 'A' && str.charAt(j) <= 'Z') {      row += str.charAt(j);      j++;     }     int num = Integer.parseInt(str.substring(j));     System.out.println(convertAB(row, num));    }   }  }  static String convertAB(String str, int num) {   String result = "";   int col = 0;   for (int i = 0; i < str.length(); i++) {    col += (int)Math.pow(26, (str.length()) - (i + 1)) * (str.charAt(i) - 'A' + 1);   }   result += "R" + num;   result += "C" + col;   return result;  }  static String convertRC(int row, int column) {   String result = "";   while (column > 0) {    int index = column % 26;    char c;    if (index == 0) {     c = 'Z';     column = column - 26;    } else {     c = (char) ('A' + index - 1);     column = column - index;    }    result += c;    column = column / 26;   }   String res = "";   for (int i = 0; i < result.length(); i++) {    res += result.charAt(result.length() - (i + 1));   }   res += row;   return res;  }  static boolean isNum(char x){   return x>'0'&&x<='9';  } }
4	public class Main {  public static void main(String[] args) throws Exception {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   StringBuilder line = new StringBuilder(reader.readLine());   int length = 0;   for (int head = 0; head < line.length(); head++) {    for (int tail = line.length() - 1; tail > head; tail--) {     String subString = line.substring(head, tail);     if(line.indexOf(subString,head+1)>-1){      length = Math.max(subString.length(), length);     }    }   }   System.out.println(length);  } }
1	public class P3 {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   String s = "";   while (s.length() == 0) {    s = sc.nextLine();   }   char[] pokemons = s.toCharArray();   Set<Character> pokemonTypes = new HashSet<>();   for (int i = 0; i < n; i++) {    pokemonTypes.add(pokemons[i]);   }   int types = pokemonTypes.size();   int l = 0;   int r = 0;   int min = n;   Map<Character, Integer> currentPokemons = new HashMap<>();    while (r < n) {    while (currentPokemons.size() < types && r < n) {     char pokemon = pokemons[r++];     currentPokemons.merge(pokemon, 1, (a, b) -> a + b);    }    min = Math.min(r - l, min);    while (currentPokemons.size() == types) {     char pokemon = pokemons[l++];     if (currentPokemons.get(pokemon) == 1) {      currentPokemons.remove(pokemon);     } else {      min = Math.min(r - l, min);      currentPokemons.put(pokemon, currentPokemons.get(pokemon) - 1);     }    }   }   min = Math.min(min, r - l + 1);   min = Math.max(min, types);   System.out.println(min);  } }
3	public class a{  public static void main(String[] args)throws IOException{ br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int n = nextInt(); int v[] = new int[n]; int fv[] = new int[101]; for(int i = 0; i<n;i++){  v[i] = nextInt(); } Arrays.sort(v); for(int i = 0; i<n;i++){  for(int j = i; j<n;j++){  if(v[j]%v[i]==0){   v[j] = v[i];   fv[v[j]]++;  }  } } int ans = 0; for(int i = 0; i<101;i++){  if(fv[i]!=0){  ans++;  } } out.println(ans); out.close();  }  static BufferedReader br;  static StringTokenizer st = new StringTokenizer("");  static String next()throws IOException{ while(!st.hasMoreTokens()){  st = new StringTokenizer(br.readLine()); } return st.nextToken();  }  static int nextInt()throws IOException{ return Integer.parseInt(next());  }  }
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);         } }
5	public class Main {  public static void main(String[] args)throws IOException{   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[][] point = new int[n][];   for(int i=0;i<n;i++) point[i] = new int[]{sc.nextInt(),sc.nextInt()};   Arrays.sort(point,(a,b)->((a[0]-a[1])-(b[0]-b[1])));   TreeMap<Integer,Integer> tm = new TreeMap<>();   int ans = 0;   for(int i=n-1;i>=0;i--){    int x = point[i][0], w = point[i][1];    Map.Entry<Integer,Integer> cur = tm.ceilingEntry(x+w);    int curRes;    if(cur==null) curRes = 1;    else curRes = cur.getValue()+1;    ans = Math.max(ans,curRes);    Map.Entry<Integer,Integer> upper = tm.ceilingEntry(x-w);    if(upper==null||upper.getValue()<curRes) tm.put(x-w,curRes);      }   System.out.println(ans);  } }
1	public class two {  public static void main(String[] args) throws IOException, FileNotFoundException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));    HashSet<Integer> good = new HashSet<>();  int i=1;  for (; i<= (int)(1e9);) {  i <<= 1;  good.add(i);  }   for (i=3; i*i*2 <= (int)(1e9); i++) {  good.add(i*i*2);  }   int beg = 4;  for (i=3; beg + i*4 <= (int)(1e9); i+=2) {  good.add(beg + i*4);  beg += i*4;  }   int t = Integer.parseInt(in.readLine());  while (t-- > 0) {  int n = Integer.parseInt(in.readLine());  if (good.contains(n)) {   System.out.println("YES");  }  else {   System.out.println("NO");  }    }  } }
1	public class Round364_div2_C {  public static void main(String[] args) throws IOException {   FastReader in = new FastReader(System.in);   PrintWriter out = new PrintWriter(System.out);   solve(in, out);   out.flush();  }   public static void solve(FastReader in, PrintWriter out) {   int n = in.readInt();   String s = in.readString();   int totalCnt = (int) s.chars().distinct().count();   Map<Character, Integer> curCnts = new HashMap<>();   int solution = s.length();   int i = 0;   for (int j = 0 ; j < s.length() ; j++) {       char sj = s.charAt(j);    curCnts.put(sj, curCnts.getOrDefault(sj, 0) + 1);        while (curCnts.getOrDefault(s.charAt(i), 0) > 1) {     char si = s.charAt(i);     int siCnt = curCnts.get(si);     if (siCnt > 1) {      curCnts.put(si, siCnt - 1);     } else {      curCnts.remove(si);     }     i++;    }    if (curCnts.size() == totalCnt) {     solution = Math.min(solution, j - i + 1);    }   }   out.println(solution);  }    static class FastReader {   private final InputStream stream;   private int current;   private int size;   private byte[] buffer = new byte[1024 * 8];   public FastReader(InputStream stream) {    this.stream = stream;    current = 0;    size = 0;   }   public int readInt() {    int sign = 1;    int abs = 0;    int c = readNonEmpty();    if (c == '-') {     sign = -1;     c = readAny();    }    do {     if (c < '0' || c > '9') {      throw new IllegalStateException();     }     abs = 10 * abs + (c - '0');     c = readAny();    } while (!isEmpty(c));    return sign * abs;   }   public int[] readIntArray(int n) {    int[] array = new int[n];    for (int i = 0 ; i < n ; i++) {     array[i] = readInt();    }    return array;   }   public char readChar() {    return (char) readNonEmpty();   }   public String readString() {    StringBuffer sb = new StringBuffer();    int c;    do {     c = readAny();    } while (isEmpty(c));    do {     sb.append((char) c);     c = readAny();    } while (!isEmpty(c));    return sb.toString();   }   private int readAny() {    try {     if (current >= size) {      current = 0;      size = stream.read(buffer);      if (size < 0) {       return -1;      }     }    } catch (IOException e) {     throw new RuntimeException("Failed to readAny next byte", e);    }    return buffer[current++];   }   private int readNonEmpty() {    int result;    do {     result = readAny();    } while (isEmpty(result));    return result;   }   private static boolean isEmpty(int c) {    return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == -1;   }  } }
1	public class Main {  static Scanner sc;  static PrintWriter out;  public static void main(String[] args) {   sc = new Scanner(System.in);   out = new PrintWriter(System.out);   int t = 1;   if (true) {    t = sc.nextInt();   }   for(int i=0; i<t; i++) {    new Main().solve();   }   out.flush();  }  public void solve() {   long n = sc.nextInt();   if(n % 2 == 1) {    out.println("NO");    return;   }   for(long i=1; i*i*2 <= n; i++) {    if(i * i * 2 == n || i * i * 4 == n) {     out.println("YES");     return;    }   }   out.println("NO");  } }
0	public class cf343a { static FastIO in = new FastIO(), out = in;  public static void main(String[] args) {  out.println(go(in.nextLong(),in.nextLong()));  out.close(); } static long go(long a, long b) {  return b==0?0:(go(b,a%b) + a/b); }  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());  } } }
6	public class Main { static void debug(Object... os) {  System.err.println(deepToString(os)); }  public static void main(String[] args) {  new Main().run(); }  void run() {  Scanner sc = new Scanner(System.in);  int n=sc.nextInt(),m=sc.nextInt();  boolean[][] bs=new boolean[n][n];  for (int i = 0; i < m; i++) {  int s=sc.nextInt()-1,t=sc.nextInt()-1;  bs[s][t] = bs[t][s] = true;  }  long res = 0;  for(int i=0;i<n;i++){  res += calc(bs,n-1-i);  }  System.out.println(res/2); } long calc(boolean[][] bs,int n){  long[][] dp=new long[1<<n][n];  for(int i=0;i<n;i++){  if(bs[i][n])   dp[1<<i][i] ++;  }  for(int i=1;i<1<<n;i++){  for(int j=0;j<n;j++)if(((i>>j)&1)==1)   for(int k=0;k<n;k++)if(((i>>k)&1)==0 && bs[j][k]){   dp[i|(1<<k)][k] += dp[i][j];   }  }  long res=0;  for(int i=0;i<1<<n;i++)for(int j=0;j<n;j++)if(Integer.bitCount(i)>=2&&bs[j][n])res+=dp[i][j];  return res; }  }
3	public class p3sol{  static char[] c; static int[][] dp; static int mod = (int)1e9 + 7;  public static void main(String[] args) throws Exception{  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(br.readLine());  c = new char[n];  for(int i = 0; i < n; i++)  c[i] = br.readLine().charAt(0);  dp = new int[n + 1][n + 1];  dp[0][0] = 1;  for(int i = 0; i < n - 1; i++){  if(c[i] == 's'){   int prev = 0;   for(int j = i; j >= 0; j--){   prev += dp[i][j];   prev %= mod;   dp[i + 1][j] += prev;   dp[i + 1][j] %= mod;   }  }  else{   for(int j = 1; j <= n; j++){   dp[i + 1][j] += dp[i][j - 1];   dp[i + 1][j] %= mod;   }  }  }  int ans = 0;  for(int i = 0; i < n; i++){  ans += dp[n - 1][i];  ans %= mod;  }    System.out.println(ans);   br.close(); }  public 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("");  } } }
5	public class A2 { static Scanner in; static int next() throws Exception {return in.nextInt();};  static PrintWriter out;  public static void main(String[] args) throws Exception {  in = new Scanner(System.in);   out = new PrintWriter(System.out);   int n = next(), k = next()-1;   int x[] = new int[n];   for (int i = 0;i < n;i++) x[i] = (100-next())*100+next();   Arrays.sort(x);   int res = 0, t = x[k];   for (int i = 0;i < n;i++) if (t == x[i]) res++;   out.println(res);    out.println();  out.close(); } }
3	public class F {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[] arr = new int[n];   for (int i = 0; i < n; i++) arr[i] = sc.nextInt();   int[][] sub = new int[n][n];   for (int i = 0; i < n; i++) {    sub[i][i] = arr[i];    for (int j = i + 1; j < n; j++) {     sub[i][j] = sub[i][j - 1] + arr[j];    }   }   HashMap<Integer, List<P>> hm = new HashMap<>();     for(int stop=0; stop<n; stop++) {    for(int start=0; start<=stop; start++) {     if (hm.containsKey(sub[start][stop])) {      hm.get(sub[start][stop]).add(new P(start, stop));     } else {      List<P> temp = new ArrayList<>();      temp.add(new P(start, stop));      hm.put(sub[start][stop], temp);     }    }   }   int ans = Integer.MIN_VALUE;      List<P> ansList = null;   for (List<P> it : hm.values()) {    int or = overlap(it);    if(or>ans) {     ans = or;     ansList = it;    }   }   List<P> processedList = extractOverlapping(ansList);   System.out.println(ans);   for(int i=0; i<processedList.size(); i++) {    int A = processedList.get(i).a + 1;    int B = processedList.get(i).b + 1;    System.out.println(A + " " + B);   }  }  public static int overlap(List<P> listOfPair) {     List<P> sortedList = listOfPair;   int cnt = 0;   int end = sortedList.get(0).b;   for (int i = 1; i < sortedList.size(); i++) {    if (sortedList.get(i).a <= end) {     cnt++;    } else {     end = sortedList.get(i).b;    }   }   return sortedList.size() - cnt;  }  public static List<P> extractOverlapping(List<P> ansList) {   List<P> sortedList = ansList.stream()     .sorted((pair1, pair2) -> pair1.getB().compareTo(pair2.getB()))     .collect(Collectors.toList());   List<P> finalList = new ArrayList<>();   finalList.add(sortedList.get(0));   int end = sortedList.get(0).b;   for (int i = 1; i < sortedList.size(); i++) {    if (sortedList.get(i).a <= end) {     continue;    } else {     finalList.add(sortedList.get(i));     end = sortedList.get(i).b;    }   }   return finalList;  } } class P implements Comparable<P> {  Integer a;  Integer b;  public P(int a, int b) {   this.a = a;   this.b = b;  }  public Integer getA() {   return a;  }  public Integer getB() {   return b;  }  @Override  public int compareTo(P that) {   return this.b.compareTo(that.b);  } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   static final int modular = (int) (1e9 + 7);   public void solve(int testNum, InputReader in, PrintWriter out) {    int n = in.nextInt();    int ans = 0;    String[] g = new String[n];    int[][] dp = new int[2][n];    for(int i = 0; i < n; i++) {     g[i] = in.next();    }    if(n == 1) {     out.println(1);     return;    }    dp[0][0] = 1;    for(int i = 1; i < n; i++) {     if(g[i - 1].equals("f")) {      dp[1][0] = 0;      for(int j = 1; j < n; j++) {       dp[1][j] = dp[0][j - 1];      }     }     else {      dp[1][n - 1] = dp[0][n - 1];      for(int j = n - 2; j >= 0; j--) {       dp[1][j] = dp[1][j + 1] + dp[0][j];       dp[1][j] = dp[1][j] % modular;      }     }     for(int j = 0; j < n; j++) {      dp[0][j] = dp[1][j];     }     if(i == n - 1) {      for(int j = 0; j < n; j++) {       ans = ans + dp[1][j];       ans = ans % modular;      }     }    }    out.println(ans);   }  }  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());   }  } }
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) {      }  } }
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);    }   }  } }
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);  } } }
1	public class TaskA implements Runnable {  long m = (int)1e9+7;  PrintWriter w;  InputReader c;  final int MAXN = (int)1e6 + 100;  public void run() {   c = new InputReader(System.in);   w = new PrintWriter(System.out);   int n = c.nextInt(), hamming_distance = 0;   char[] s = c.next().toCharArray(), t = c.next().toCharArray();   HashMap<Character, HashSet<Character>> replace = new HashMap<>();   HashMap<Character, Integer> map = new HashMap<>();   for(int i=0;i<n;++i) if(s[i] != t[i]) {    HashSet<Character> temp;    if(replace.containsKey(s[i])){     temp = replace.get(s[i]);     temp.add(t[i]);    } else {     temp = new HashSet<>();     temp.add(t[i]);    }    map.put(s[i],i);    replace.put(s[i], temp);    hamming_distance++;   }   int l = -1, r = -1;   boolean global_check = false;   for(int i=0;i<n;i++) if(s[i] != t[i]) {    if(replace.containsKey(t[i])) {     HashSet<Character> indices = replace.get(t[i]);     int ind = map.get(t[i]);     l = i + 1;     r = ind + 1;     if (indices.contains(s[i])) {      hamming_distance -= 2;      global_check = true;      break;     }    }    if(global_check) break;   }   if(!global_check && l!=-1) hamming_distance--;   else if(global_check){    for(int i=0;i<n;i++) {     if(t[i] == s[l-1] && s[i] == t[l-1]){      r = i + 1;      break;     }    }   }   w.println(hamming_distance);   w.println(l+" "+r);   w.close();  }  static long gcd(long a, long b) {   if (b == 0)    return a;   return gcd(b, a % b);  }  public static void sortbyColumn(int arr[][], int col){   Arrays.sort(arr, new Comparator<int[]>()   {    public int compare(int[] o1, int[] o2){     return(Integer.valueOf(o1[col]).compareTo(o2[col]));    }   });  }  public static class DJSet {   public int[] upper;   public DJSet(int n) {    upper = new int[n];    Arrays.fill(upper, -1);   }   public int root(int x) {    return upper[x] < 0 ? x : (upper[x] = root(upper[x]));   }   public boolean equiv(int x, int y) {    return root(x) == root(y);   }   public boolean union(int x, int y) {    x = root(x);    y = root(y);    if (x != y) {     if (upper[y] < upper[x]) {      int d = x;      x = y;      y = d;     }     upper[x] += upper[y];     upper[y] = x;    }    return x == y;   }  }  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;  }  public void printArray(int[] a){   for(int i=0;i<a.length;i++)    w.print(a[i]+" ");   w.println();  }  public int[] scanArrayI(int n){   int a[] = new int[n];   for(int i=0;i<n;i++)    a[i] = c.nextInt();   return a;  }  public long[] scanArrayL(int n){   long a[] = new long[n];   for(int i=0;i<n;i++)    a[i] = c.nextLong();   return a;  }  public void printArray(long[] a){   for(int i=0;i<a.length;i++)    w.print(a[i]+" ");   w.println();  }  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 TaskA(),"TaskA",1<<26).start();  } }
3	public class Main{     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();   HashMap<Long, ArrayList<int[]>> map = new HashMap<>();   for(int i = 0; i< n; i++){    long sum = 0;    for(int j = i; j< n; j++){     sum+=a[j];     if(!map.containsKey(sum))map.put(sum, new ArrayList<>());     map.get(sum).add(new int[]{i+1, j+1});    }   }   int[][] ans = new int[n][];int cur = 0;   int[][] tmp = new int[n][];int tc;   for(Map.Entry<Long, ArrayList<int[]>> e: map.entrySet()){    int prev = 0;    ArrayList<int[]> li = e.getValue();    Collections.sort(li, new Comparator<int[]>(){     public int compare(int[] i1, int[] i2){      if(i1[1]!=i2[1])return Integer.compare(i1[1], i2[1]);      return Integer.compare(i1[0], i1[0]);     }    });     tc = 0;    for(int[] p:li){     if(p[0]>prev){      tmp[tc++] = new int[]{p[0],p[1]};      prev = p[1];     }    }    if(tc>cur){     cur = tc;     for(int i = 0; i< tc; i++)ans[i] = new int[]{tmp[i][0], tmp[i][1]};    }   }   pn(cur);   for(int i = 0; i< cur; i++)pn(ans[i][0]+" "+ans[i][1]);  }   void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}  long mod = (long)1e9+7, IINF = (long)1e18;  final int INF = (int)1e9, MX = (int)2e3+1;  DecimalFormat df = new DecimalFormat("0.00000000000");  double PI = 3.1415926535897932384626433832792884197169399375105820974944, eps = 1e-8;  static boolean multipleTC = false, memory = false;  FastReader in;PrintWriter out;  void run() throws Exception{   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();  }  public static void main(String[] args) throws Exception{   if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();   else new Main().run();  }  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){out.print(o);}  void pn(Object o){out.println(o);}  void pni(Object o){out.println(o);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;   }  } }
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();  } }
0	public class A { public static void main(String[] args){  FastScanner sc = new FastScanner();  long a = sc.nextLong();  long b = sc.nextLong();  long result = 0L;  while(a != 0 && b != 0) {  if(a > b) {   result += a/b;   a = a % b;  } else {   result += b/a;   b = b % a;  }   long gcd = gcd(a, b);  a /= gcd;  b /= gcd;  }   System.out.println(result); }  private static long gcd(long a, long b) {  while(a != 0 && b != 0) {  if(a < b) {   long tmp = a;   a = b;   b = tmp;  }  a%=b;  }  return a + b; }  public static class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner(String s) {  try {   br = new BufferedReader(new FileReader(s));  } catch (FileNotFoundException e) {   e.printStackTrace();  }  }  public FastScanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  String nextToken() {  while (st == null || !st.hasMoreElements()) try {   st = new StringTokenizer(br.readLine());  } catch (IOException e) {   e.printStackTrace();  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(nextToken());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  } } }
1	public class Main {   public static void main(String[] args) {     var sc = new Scanner(System.in);   var pw = new PrintWriter(System.out);     int T = Integer.parseInt(sc.next());   for(int t = 0; t < T; t++){    int n = Integer.parseInt(sc.next());    boolean ok = false;    if(n%2 == 0){     int a = n/2;     int b = (int) Math.sqrt(a);     if(b*b == a){      ok = true;     }    }    if(n%4 == 0){     int a = n/4;     int b = (int) Math.sqrt(a);     if(b*b == a){      ok = true;     }    }    if(ok){     pw.println("YES");    }else{     pw.println("NO");    }   }   pw.flush();  } }
3	public class Main {  static FastScanner sc = new FastScanner(); static Output out = new Output(System.out);  static final int[] dx = {0, 1, 0, -1}; static final int[] dy = {-1, 0, 1, 0};  static final long MOD = (long) (1e9 + 7); static final long INF = Long.MAX_VALUE / 2;  static final int e5 = (int) 1e5;  public static class Solver {  public Solver() {   int N = sc.nextInt();   boolean[] flag = new boolean[101];  for (int i=0; i<N; i++) {   flag[sc.nextInt()] = true;  }   int ans = 0;  for (int i=1; i<=100; i++) {   if (flag[i]) {   ans++;   for (int j=i*2; j<=100; j+=i) {    flag[j] = false;   }   }  }   out.println(ans);  }  public static void sort(int[] a) {  shuffle(a);  Arrays.sort(a);  }  public static void sort(long[] a) {  shuffle(a);  Arrays.sort(a);  }  public static void shuffle(int[] arr){  int n = arr.length;  Random rnd = new Random();  for(int i=0; i<n; ++i){   int tmp = arr[i];   int randomPos = i + rnd.nextInt(n-i);   arr[i] = arr[randomPos];   arr[randomPos] = tmp;  }  }  public static void shuffle(long[] arr){  int n = arr.length;  Random rnd = new Random();  for(int i=0; i<n; ++i){   long tmp = arr[i];   int randomPos = i + rnd.nextInt(n-i);   arr[i] = arr[randomPos];   arr[randomPos] = tmp;  }  } }  public static void main(String[] args) {  new Solver();  out.flush(); }  static class FastScanner {  private InputStream in = System.in;  private final byte[] buffer = new byte[1024];  private int ptr = 0;  private int buflen = 0;   public void load() {  try {   in = new FileInputStream(next());  } catch (Exception e) {   e.printStackTrace();  }  }  private boolean hasNextByte() {  if (ptr < buflen) {   return true;  } else {   ptr = 0;   try {   buflen = in.read(buffer);   } catch (IOException e) {   e.printStackTrace();   }   if (buflen <= 0) {   return false;   }  }  return true;  }  private int readByte() {  if (hasNextByte()) return buffer[ptr++];  else return -1;  }  private static boolean isPrintableChar(int c) {  return 33 <= c && c <= 126;  }  private void skipUnprintable() {  while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;  }  public boolean hasNext() {  skipUnprintable();  return hasNextByte();  }  public String next() {  if (!hasNext()) throw new NoSuchElementException();  StringBuilder sb = new StringBuilder();  int b = readByte();  while (isPrintableChar(b)) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }  public long nextLong() {  if (!hasNext()) throw new NoSuchElementException();  long n = 0;  boolean minus = false;  int b = readByte();  if (b == '-') {   minus = true;   b = readByte();  }  if (b < '0' || '9' < b) {   throw new NumberFormatException();  }  while (true) {   if ('0' <= b && b <= '9') {   n *= 10;   n += b - '0';   } else if (b == -1 || !isPrintableChar(b)) {   return minus ? -n : n;   } else {   throw new NumberFormatException();   }   b = readByte();  }  }  public int nextInt() {  return (int) nextLong();  }  public int[] nextIntArray(int N, boolean oneBased) {  if (oneBased) {   int[] array = new int[N + 1];   for (int i = 1; i <= N; i++) {   array[i] = sc.nextInt();   }   return array;  } else {   int[] array = new int[N];   for (int i = 0; i < N; i++) {   array[i] = sc.nextInt();   }   return array;  }  }  public long[] nextLongArray(int N, boolean oneBased) {  if (oneBased) {   long[] array = new long[N + 1];   for (int i = 1; i <= N; i++) {   array[i] = sc.nextLong();   }   return array;  } else {   long[] array = new long[N];   for (int i = 0; i < N; i++) {   array[i] = sc.nextLong();   }   return array;  }  } }  static class Output extends PrintWriter {  private long startTime;  public Output(PrintStream ps) {  super(ps);  }  public void print(int[] a, String separator) {  for (int i = 0; i < a.length; i++) {   if (i == 0) print(a[i]);   else print(separator + a[i]);  }  println();  }  public void print(long[] a, String separator) {  for (int i = 0; i < a.length; i++) {   if (i == 0) print(a[i]);   else print(separator + a[i]);  }  println();  }  public void print(String[] a, String separator) {  for (int i = 0; i < a.length; i++) {   if (i == 0) print(a[i]);   else print(separator + a[i]);  }  println();  }  public void print(ArrayList a, String separator) {  for (int i = 0; i < a.size(); i++) {   if (i == 0) print(a.get(i));   else print(separator + a.get(i));  }  println();  }  public void start() {  startTime = System.currentTimeMillis();  }  public void time(String s) {  long time = System.currentTimeMillis() - startTime;  println(s + "(" + time + ")");  }  } }
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);   }  } }
1	public class Main {    public static void main(String[] args) {     try   {    Parserdoubt pd=new Parserdoubt(System.in);    int t=pd.nextInt();    int inde=0,indo=0,o=0,e=0;    for(int i=0;i<t;i++)    {     if(pd.nextInt()%2==0)     {      inde=i;      e++;     }     else     {      o++;      indo=i;     }    }    if(o==1)    {     System.out.println(indo+1);    }    else    {     System.out.println(inde+1);    }   }   catch(Exception e){}  } } class Parserdoubt {  final private int BUFFER_SIZE = 1 << 17;   private DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;   public Parserdoubt(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++];  } }
5	public class solver {  FastScanner in = new FastScanner(System.in);  PrintWriter out = new PrintWriter(System.out);     public static void main(String[] args) {   new solver().solve();  }   public void solve() {    int n = in.nextInt();   int[]tab = new int[n];     int sum = 0;     for (int i = 0; i < n; i++) {    tab[i] = in.nextInt();    sum += tab[i];   }     Arrays.sort(tab);   int v1 = 0;   int count = 0;     for (int i = tab.length - 1; i >= 0; i--) {    v1 += tab[i];    count++;    if (v1 > getSum(i, tab)) {     break;    }   }     out.println(count);     in.close();   out.close();  }   public int getSum(int index, int[]tab) {   int sum = 0;   for (int i = 0; i < index; i++) sum += tab[i];   return sum;  }   public int max(int a, int b) {   if (a > b) return a;   else return b;  } }  class FastScanner {  BufferedReader br;  StringTokenizer st;  FastScanner(InputStream in) {   br = new BufferedReader(new InputStreamReader(in));  }  String next() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (IOException e) {     System.err.println(e);     return "";    }   }   return st.nextToken();  }  int nextInt() {   return Integer.parseInt(next());  }  long nextLong() {   return Long.parseLong(next());  }  double nextDouble() {   return Double.parseDouble(next());  }  float nextFloat() {   return Float.parseFloat(next());  }  BigInteger nextBigInt() {   return new BigInteger(next());  }  void close() {   try {    br.close();   } catch (IOException e) {   }  } }
4	public class Main { static final FastReader FR = new FastReader(); static final PrintWriter PW = new PrintWriter(new OutputStreamWriter(System.out));  public static void main(String[] args) {  StringBuilder solution = new StringBuilder();  int rows = FR.nextInt();  int cols = FR.nextInt();  int moves = FR.nextInt();  int[][] horizontalEdgeWeights = new int[rows][cols-1];  for (int r = 0; r < rows; r++) {  for (int c = 0; c < cols - 1; c++) {   horizontalEdgeWeights[r][c] = FR.nextInt();  }  }  int[][] verticalEdgeWeights = new int[rows-1][cols];  for (int r = 0; r < rows - 1; r++) {  for (int c = 0; c < cols; c++) {   verticalEdgeWeights[r][c] = FR.nextInt();  }  }  int[][] result = getResult(rows, cols, moves, horizontalEdgeWeights, verticalEdgeWeights);  for (int r = 0; r < rows; r++) {  for (int c = 0; c < cols; c++) {   solution.append(result[r][c] + " ");  }  solution.append("\n");  }  PW.print(solution.toString());  PW.close(); }  static int[][] getResult(int rows, int cols, int moves, int[][] horizontalEdgeWeights, int[][] verticalEdgeWeights) {  int[][] result = new int[rows][cols];  if ((moves & 1) == 1) {  for (int r = 0; r < rows; r++) {   for (int c = 0; c < cols; c++) {   result[r][c] = -1;   }  }   return result;  }  int mid = moves >> 1;  int[][][] minForDistance = new int[rows][cols][mid+1];  for (int r = 0; r < rows; r++) {  for (int c = 0; c < cols; c++) {   for (int m = 1; m <= mid; m++) {   minForDistance[r][c][m] = Integer.MAX_VALUE;   }  }  }  for (int m = 1; m <= mid; m++) {  for (int r = 0; r < rows; r++) {   for (int c = 0; c < cols; c++) {   int minBoredom = minForDistance[r][c][m];    if (r > 0) {    int candidateBoredom = minForDistance[r-1][c][m-1] + verticalEdgeWeights[r-1][c];    minBoredom = Math.min(minBoredom, candidateBoredom);   }    if (c > 0) {    int candidateBoredom = minForDistance[r][c-1][m-1] + horizontalEdgeWeights[r][c-1];    minBoredom = Math.min(minBoredom, candidateBoredom);   }    if (r + 1 < rows) {    int candidateBoredom = minForDistance[r+1][c][m-1] + verticalEdgeWeights[r][c];    minBoredom = Math.min(minBoredom, candidateBoredom);   }    if (c + 1 < cols) {    int candidateBoredom = minForDistance[r][c+1][m-1] + horizontalEdgeWeights[r][c];    minBoredom = Math.min(minBoredom, candidateBoredom);   }    minForDistance[r][c][m] = minBoredom;   }  }  }  for (int r = 0; r < rows; r++) {  for (int c = 0; c < cols; c++) {   result[r][c] = minForDistance[r][c][mid] << 1;  }  }  return result; }  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;  } } }
0	public class Lucky {   public static void main(String[] args) {   Scanner in = new Scanner(System.in);  int n = in.nextInt();  if(n%4==0 || n%7==0 || n%47==0 || n%74==0 || n%474==0 || n%447==0 || n%774==0 || n%747==0 || n%477==0 || n%744==0)System.out.println("YES");  else System.out.println("NO"); } }
4	public class Main {  static FastScanner fs=new FastScanner();  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();   }   int Int() {    return Integer.parseInt(next());   }   long Long() {    return Long.parseLong(next());   }   String Str(){    return next();   }  }   public static void main (String[] args) throws java.lang.Exception {   PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   int T=1;   for(int t=0;t<T;t++){    int n=Int(),m=Int(),k=Int();    List<int[]>g[]=new ArrayList[n*m+1];    for(int i=0;i<g.length;i++){     g[i]=new ArrayList<>();    }    for(int i=0;i<n;i++){     for(int j=0;j<m-1;j++){      int w=Int();      int u=i*m+j;      int v=i*m+(j+1);      g[u].add(new int[]{v,w});      g[v].add(new int[]{u,w});     }    }    for(int i=0;i<n-1;i++){     for(int j=0;j<m;j++){      int w=Int();      int u=i*m+j;      int v=(i+1)*m+j;      g[u].add(new int[]{v,w});      g[v].add(new int[]{u,w});     }    }    Solution sol=new Solution(out);    sol.solution(n,m,k,g);   }   out.close();  }   public static int Int(){   return fs.Int();  }  public static long Long(){   return fs.Long();  }  public static String Str(){   return fs.Str();  } }    class Solution{  PrintWriter out;  public Solution(PrintWriter out){   this.out=out;  }    List<int[]>g[];  int n,m;  long INF=10000000000000000l;  int curr=-1,curc=-1;  long mn=Long.MAX_VALUE;  long dp[][];  public void solution(int n,int m,int k,List<int[]>g[]){     this.n=n;   this.m=m;   long res[][]=new long[n][m];   if(k%2==1){    for(int i=0;i<n;i++){     Arrays.fill(res[i],-1);    }    print(res);    return;   }   this.g=g;   dp=new long[n*m+1][k/2+2];   for(int i=0;i<dp.length;i++){    Arrays.fill(dp[i],-1);   }    for(int i=0;i<n;i++){    for(int j=0;j<m;j++){     int id=i*m+j;     dfs(id,k/2);    }   }   for(int i=0;i<n;i++){    for(int j=0;j<m;j++){     int id=i*m+j;     res[i][j]=dp[id][k/2];    }   }   print(res);  }  public long dfs(int id,int cnt){   if(cnt==0){    return 0;   }   if(dp[id][cnt]!=-1)return dp[id][cnt];   int r=id/m;   int c=id%m;   long res=Long.MAX_VALUE;   for(int p[]:g[id]){    int next=p[0],w=p[1];    res=Math.min(res,w*2+dfs(next,cnt-1));   }   dp[id][cnt]=res;   return res;  }  public int dis(int x1,int y1,int x2,int y2){   return Math.abs(x1-x2)+Math.abs(y1-y2);  }   public void print(long A[][]){   for(int i=0;i<A.length;i++){    for(int j=0;j<A[0].length;j++){     out.print(A[i][j]+" ");    }    out.println();   }  }    } class Solution1{  PrintWriter out;  public Solution1(PrintWriter out){   this.out=out;  }  public void solution(int A[]){  } }
1	public class Main3 {  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);      int N = sc.nextInt();   String S = sc.next();   HashSet<Character> unique = new HashSet<>();   for(char c : S.toCharArray()){    unique.add(c);   }   int number = unique.size();   Hashtable<Character, Integer> indexes = new Hashtable<>();   TreeSet<Integer> tree = new TreeSet<>();   int min = N+1;   int total = 0;   for(int i = 0; i<N; i++){    char c = S.charAt(i);    if(!indexes.containsKey(c)){     total++;     indexes.put(c, i);     tree.add(i);    }    else{     int old = indexes.get(c);     indexes.put(c, i);     tree.remove(old);     tree.add(i);    }    if(total == number){     int dist = tree.last() - tree.first() + 1;     min = Math.min(dist, min);    }   }   System.out.println(min);  } }
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());  } }
3	public class Main {  public static void main(String [] args) {   Scanner scanner = new Scanner(System.in);   int n = scanner.nextInt();   int numbers[] = new int[n];   for (int i = 0; i < n; i++) {    numbers[i] = scanner.nextInt();   }   scanner.close();   Arrays.sort(numbers);   boolean[] colored = new boolean[n];   int res = 0;   for (int i = 0; i < n; i++) {    if (!colored[i]) {     res += 1;    }    for (int j = i; j < n; j++) {     if (numbers[j] % numbers[i] == 0) {      colored[j] = true;     }    }   }   System.out.println(res);  } }
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);  CBanhMi solver = new CBanhMi();  solver.solve(1, in, out);  out.close(); }  static class CBanhMi {  long mod = (long) (1e9 + 7);  public void solve(int testNumber, InputReader in, PrintWriter out) {  int n = in.nextInt();  int q = in.nextInt();  long[] two = new long[n + 1];  two[0] = 1;  for (int i = 1; i <= n; ++i) {   two[i] = (two[i - 1] * 2L);   two[i] %= mod;  }   char[] s = in.nextCharArray();  int[] acc = new int[n + 1];  for (int i = 1; i <= n; ++i) {   acc[i] = s[i - 1] == '0' ? 0 : 1;   acc[i] += acc[i - 1];  }            while (q-- > 0) {   int f = in.nextInt();   int t = in.nextInt();   int ones = acc[t] - acc[f - 1];   int zeros = (t - f + 1) - ones;   if (ones == 0) {   out.println(0);   } else {   long ans = two[t - f + 1] - (zeros > 0 ? two[zeros] : 0);   if (zeros == 0) {    --ans;   }   ans = (ans + mod) % mod;   out.println(ans);   }  }  }  }  static class InputReader implements FastIO {  private InputStream stream;  private static final int DEFAULT_BUFFER_SIZE = 1 << 16;  private static final int EOF = -1;  private byte[] buf = new byte[DEFAULT_BUFFER_SIZE];  private int curChar;  private int numChars;  public InputReader(InputStream stream) {  this.stream = stream;  }  public int read() {  if (this.numChars == EOF) {   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 EOF;   }   }   return this.buf[this.curChar++];  }  }  public 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 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();  }  public static boolean isSpaceChar(int c) {  return c == 32 || c == 10 || c == 13 || c == 9 || c == EOF;  }  public char[] nextCharArray() {  return next().toCharArray();  }  }  static interface FastIO {  } }
2	public class algo_1802 {  public static void main(String args[])  {   Scanner ex=new Scanner(System.in);   int n=ex.nextInt();   int k=ex.nextInt();   int x=(int)((Math.sqrt(9.0+8.0*((double)n+(double)k))-3.0)/2.0);   System.out.println(n-x);  } }
1	public class B {  public static void main(String[] args) {  FastScanner fs=new FastScanner();  int T=fs.nextInt();  for (int tt=0; tt<T; tt++) {  int n=fs.nextInt();  boolean isEven=n%2==0;  while (n%2==0) n/=2;  if (isSquare(n) && isEven) {   System.out.println("YES");  }  else {   System.out.println("NO");  }  } }  static boolean isSquare(long n) {  long sqrt=(long) Math.sqrt(n);  for (int i=(int) Math.max(1, sqrt-5); i<=sqrt+5; i++)  if (i*i==n)   return true;  return false; }  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());  } }  }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   String[] str;   long mod = (long) 1e9 + 7;   long[][] dp;   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    str = new String[n];    dp = new long[n + 2][n + 2];    for (int i = 0; i < dp.length; i++) {     Arrays.fill(dp[i], -1);    }    for (int i = 0; i < n; i++) {     str[i] = in.readString();    }    if (str[0].charAt(0) == 'f') {     out.print(solve(1, 1));    } else {     out.print(solve(1, 0));    }   }   long solve(int n, int horiz) {    if (horiz < 0)     return 0;    if (n >= str.length - 1) {     return 1;    }    if (dp[n][horiz] != -1) {     return dp[n][horiz];    }    if (str[n].charAt(0) == 'f') {     return dp[n][horiz] = solve(n + 1, horiz + 1);    } else {     long ans1 = solve(n, horiz - 1);         ans1 += solve(n + 1, horiz);         ans1 = ans1 % mod;     return dp[n][horiz] = ans1;    }   }  }  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 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) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
5	public class A {  public void solve() throws Exception {     int n = nextInt();   int[] p = nextArr(n);   Arrays.sort(p);   int sum = 0;   for (int i=0; i<n; ++i) sum+=p[i];   int curr = 0;   for (int i=n-1; i>=0; --i) {    curr += p[i];    if (curr>sum-curr) halt(n-i);   }    }       boolean showDebug = true;  static boolean useFiles = false;  static String inFile = "input.txt";  static String outFile = "output.txt";  double EPS = 1e-7;  int INF = Integer.MAX_VALUE;  long INFL = Long.MAX_VALUE;  double INFD = Double.MAX_VALUE;    int absPos(int num) {   return num<0 ? 0:num;  }  long absPos(long num) {   return num<0 ? 0:num;  }  double absPos(double num) {   return num<0 ? 0:num;  }   int min(int... nums) {   int r = Integer.MAX_VALUE;   for (int i: nums)    if (i<r) r=i;   return r;  }  int max(int... nums) {   int r = Integer.MIN_VALUE;   for (int i: nums)    if (i>r) r=i;   return r;  }  long minL(long... nums) {   long r = Long.MAX_VALUE;   for (long i: nums)    if (i<r) r=i;   return r;  }  long maxL(long... nums) {   long r = Long.MIN_VALUE;   for (long i: nums)    if (i>r) r=i;   return r;  }  double minD(double... nums) {   double r = Double.MAX_VALUE;   for (double i: nums)    if (i<r) r=i;   return r;  }  double maxD(double... nums) {   double r = Double.MIN_VALUE;   for (double i: nums)    if (i>r) r=i;   return r;  }   long sumArr(int[] arr) {   long res = 0;   for (int i: arr)    res+=i;   return res;  }  long sumArr(long[] arr) {   long res = 0;   for (long i: arr)    res+=i;   return res;  }  double sumArr(double[] arr) {   double res = 0;   for (double i: arr)    res+=i;   return res;  }  long partsFitCnt(long partSize, long wholeSize) {   return (partSize+wholeSize-1)/partSize;  }  boolean odd(long num) {   return (num&1)==1;  }   boolean hasBit(int num, int pos) {   return (num&(1<<pos))>0;  }  long binpow(long a, int n) {   long r = 1;   while (n>0) {    if ((n&1)!=0) r*=a;    a*=a;    n>>=1;   }   return r;  }  boolean isLetter(char c) {   return (c>='a' && c<='z') || (c>='A' && c<='Z');  }  boolean isLowercase(char c) {   return (c>='a' && c<='z');  }  boolean isUppercase(char c) {   return (c>='A' && c<='Z');  }  boolean isDigit(char c) {   return (c>='0' && c<='9');  }   boolean charIn(String chars, String s) {   if (s==null) return false;   if (chars==null || chars.equals("")) return true;   for (int i=0; i<s.length(); ++i)    for (int j=0; j<chars.length(); ++j)     if (chars.charAt(j)==s.charAt(i)) return true;   return false;  }   String stringn(String s, int n) {   if (n<1 || s==null) return "";   StringBuilder sb = new StringBuilder(s.length()*n);   for (int i=0; i<n; ++i) sb.append(s);   return sb.toString();  }  String str(Object o) {   if (o==null) return "";   return o.toString();  }   long timer = System.currentTimeMillis();  void startTimer() {   timer = System.currentTimeMillis();  }  void stopTimer() {   System.err.println("time: "+(System.currentTimeMillis()-timer)/1000.0);  }   static class InputReader {   private byte[] buf;   private int bufPos = 0, bufLim = -1;   private InputStream stream;   public InputReader(InputStream stream, int size) {    buf = new byte[size];    this.stream = stream;   }   private void fillBuf() throws IOException {    bufLim = stream.read(buf);    bufPos = 0;   }   char read() throws IOException {    if (bufPos>=bufLim) fillBuf();    return (char)buf[bufPos++];   }   boolean hasInput() throws IOException {    if (bufPos>=bufLim) fillBuf();    return bufPos<bufLim;   }  }   static InputReader inputReader;  static BufferedWriter outputWriter;  char nextChar() throws IOException {   return inputReader.read();  }  char nextNonWhitespaceChar() throws IOException {   char c = inputReader.read();   while (c<=' ') c=inputReader.read();   return c;  }  String nextWord() throws IOException {   StringBuilder sb = new StringBuilder();   char c = inputReader.read();   while (c<=' ') c=inputReader.read();   while (c>' ') {    sb.append(c);    c = inputReader.read();   }   return new String(sb);  }  String nextLine() throws IOException {   StringBuilder sb = new StringBuilder();   char c = inputReader.read();   while (c<=' ') c=inputReader.read();   while (c!='\n' && c!='\r') {    sb.append(c);    c = inputReader.read();   }   return new String(sb);  }  int nextInt() throws IOException {   int r = 0;   char c = nextNonWhitespaceChar();   boolean neg = false;   if (c=='-') neg=true;   else r=c-48;   c = nextChar();   while (c>='0' && c<='9') {    r*=10;    r+=c-48;    c=nextChar();   }   return neg ? -r:r;  }  long nextLong() throws IOException {   long r = 0;   char c = nextNonWhitespaceChar();   boolean neg = false;   if (c=='-') neg=true;   else r = c-48;   c = nextChar();   while (c>='0' && c<='9') {    r*=10L;    r+=c-48L;    c=nextChar();   }   return neg ? -r:r;  }  double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextWord());  }  int[] nextArr(int size) throws NumberFormatException, IOException {   int[] arr = new int[size];   for (int i=0; i<size; ++i)    arr[i] = nextInt();   return arr;  }  long[] nextArrL(int size) throws NumberFormatException, IOException {   long[] arr = new long[size];   for (int i=0; i<size; ++i)    arr[i] = nextLong();   return arr;  }  double[] nextArrD(int size) throws NumberFormatException, IOException {   double[] arr = new double[size];   for (int i=0; i<size; ++i)    arr[i] = nextDouble();   return arr;  }  String[] nextArrS(int size) throws NumberFormatException, IOException {   String[] arr = new String[size];   for (int i=0; i<size; ++i)    arr[i] = nextWord();   return arr;  }  char[] nextArrCh(int size) throws IOException {   char[] arr = new char[size];   for (int i=0; i<size; ++i)    arr[i] = nextNonWhitespaceChar();   return arr;  }  char[][] nextArrCh(int rows, int columns) throws IOException {   char[][] arr = new char[rows][columns];   for (int i=0; i<rows; ++i)    for (int j=0; j<columns; ++j)     arr[i][j] = nextNonWhitespaceChar();   return arr;  }  char[][] nextArrChBorders(int rows, int columns, char border) throws IOException {   char[][] arr = new char[rows+2][columns+2];   for (int i=1; i<=rows; ++i)    for (int j=1; j<=columns; ++j)     arr[i][j] = nextNonWhitespaceChar();   for (int i=0; i<columns+2; ++i) {    arr[0][i] = border;    arr[rows+1][i] = border;   }   for (int i=0; i<rows+2; ++i) {    arr[i][0] = border;    arr[i][columns+1] = border;   }   return arr;  }  void printf(String format, Object... args) throws IOException {   outputWriter.write(String.format(format, args));  }  void print(Object o) throws IOException {   outputWriter.write(o.toString());  }  void println(Object o) throws IOException {   outputWriter.write(o.toString());   outputWriter.newLine();  }  void print(Object... o) throws IOException {   for (int i=0; i<o.length; ++i) {    if (i!=0) outputWriter.write(' ');    outputWriter.write(o[i].toString());   }  }  void println(Object... o) throws IOException {   print(o);   outputWriter.newLine();  }  void printn(Object o, int n) throws IOException {   String s = o.toString();   for (int i=0; i<n; ++i) {    outputWriter.write(s);    if (i!=n-1) outputWriter.write(' ');   }  }  void printnln(Object o, int n) throws IOException {   printn(o, n);   outputWriter.newLine();  }  void printArr(int[] arr) throws IOException {   for (int i=0; i<arr.length; ++i) {    if (i!=0) outputWriter.write(' ');    outputWriter.write(Integer.toString(arr[i]));   }  }  void printArr(long[] arr) throws IOException {   for (int i=0; i<arr.length; ++i) {    if (i!=0) outputWriter.write(' ');    outputWriter.write(Long.toString(arr[i]));   }  }  void printArr(double[] arr) throws IOException {   for (int i=0; i<arr.length; ++i) {    if (i!=0) outputWriter.write(' ');    outputWriter.write(Double.toString(arr[i]));   }  }  void printArr(String[] arr) throws IOException {   for (int i=0; i<arr.length; ++i) {    if (i!=0) outputWriter.write(' ');    outputWriter.write(arr[i]);   }  }  void printArr(char[] arr) throws IOException {   for (char c: arr) outputWriter.write(c);  }  void printlnArr(int[] arr) throws IOException {   printArr(arr);   outputWriter.newLine();  }  void printlnArr(long[] arr) throws IOException {   printArr(arr);   outputWriter.newLine();  }  void printlnArr(double[] arr) throws IOException {   printArr(arr);   outputWriter.newLine();  }  void printlnArr(String[] arr) throws IOException {   printArr(arr);   outputWriter.newLine();  }  void printlnArr(char[] arr) throws IOException {   printArr(arr);   outputWriter.newLine();  }  void halt(Object... o) throws IOException {   if (o.length!=0) println(o);   outputWriter.flush(); outputWriter.close();   System.exit(0);  }   void debug(Object... o) {   if (showDebug) System.err.println(Arrays.deepToString(o));  }   public static void main(String[] args) throws Exception {   Locale.setDefault(Locale.US);   if (!useFiles) {    inputReader = new InputReader(System.in, 1<<16);    outputWriter = new BufferedWriter(new OutputStreamWriter(System.out), 1<<16);   } else {    inputReader = new InputReader(new FileInputStream(new File(inFile)), 1<<16);    outputWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outFile))), 1<<16);   }   new A().solve();   outputWriter.flush(); outputWriter.close();  } }
4	public class Main { public static void main(String [] args) throws IOException{  Scanner in = new Scanner(new FileInputStream("input.txt"));   File file = new File("output.txt");  FileOutputStream fos = new FileOutputStream(file);  if (!file.exists()) {   file.createNewFile();  }   int N = in.nextInt();  int M = in.nextInt();  int K = in.nextInt();  int [][] fireTime = new int[N][M];  for (int i=0; i<K; i++){  int x = in.nextInt()-1;  int y = in.nextInt()-1;  fireTime[x][y] = -1;    for (int j=1; j<=x+y; j++){   for (int p=0; p<=j; p++){   if (x-j+p >= 0 && y-p >=0 && (fireTime[x-j+p][y-p] == 0 || fireTime[x-j+p][y-p] > j)){    fireTime[x-j+p][y-p] = j;   }   }  }    for (int j=1; j<=x+M-1-y; j++){   for (int p=0; p<=j; p++){   if (x-j+p >= 0 && y+p < M && (fireTime[x-j+p][y+p] == 0 || fireTime[x-j+p][y+p] > j)){    fireTime[x-j+p][y+p] = j;   }   }  }    for (int j=1; j<=N-1-x+y; j++){   for (int p=0; p<j; p++){   if (x+j-p < N && y-p >= 0 && (fireTime[x+j-p][y-p] == 0 || fireTime[x+j-p][y-p] > j)){    fireTime[x+j-p][y-p] = j;   }   }  }    for (int j=1; j<=N-1-x+M-1-y; j++){   for (int p=0; p<=j; p++){      if (x+j-p < N && y+p < M && (fireTime[x+j-p][y+p] == 0 || fireTime[x+j-p][y+p] > j)){       fireTime[x+j-p][y+p] = j;   }   }  }  }   int max = -1;  int tx = 1;  int ty = 1;  for (int i=0; i<N; i++){  for (int j=0; j<M; j++){     if (fireTime[i][j] > max){   max = fireTime[i][j];   tx = i+1;   ty = j+1;   }  }    }   String output = tx+" "+ty;   byte[] bA = output.getBytes();  fos.write(bA);  fos.flush(); } }
1	public class Main {  public static void main(String[] args) {   Main iq = new Main();   Scanner sc = new Scanner(System.in);   int n;   n = sc.nextInt();   int[] naturalNumbers = new int[n];   for (int i = 0; i < naturalNumbers.length; i++) {    naturalNumbers[i] = sc.nextInt();   }   System.out.println(iq.diffInEvenness(n, naturalNumbers));    }   public int diffInEvenness(int n, int[] naturalNumbers) {     int even, odd, lastEvenIndex, lastOddIndex;   even = odd = lastEvenIndex = lastOddIndex = 0;   for (int i = 0; i < naturalNumbers.length; i++) {    if((naturalNumbers[i] % 2) == 0) {     even++;     lastEvenIndex = i + 1;    }    else {     odd++;     lastOddIndex = i + 1;    }   }   return (even > odd ? lastOddIndex : lastEvenIndex);   } }
1	public class Task25a {   public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int a1 = 0, a2 = 0;  int n1 = 0, n2 = 0;  for (int i = 1; i <= n; i++) {  int c = sc.nextInt();  if (c % 2 == 1) {   a1 = i;   n1++;  } else {   a2 = i;   n2++;  }  }  if (n1 == 1) {  System.out.println(a1);  } else {  System.out.println(a2);  } } }
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); } }  }
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] + " ");   }  }  }
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);  } }
4	public class ViewAngle{    private static int V,level[][],count=-1,lev_dfs[],degree=0,no_vert_conn_comp=0;    private static Stack <Integer>st=new Stack();    private static LinkedList<Integer > adj[];    private static boolean[][] Visite;    private static boolean [] Visited;    private static TreeSet<Integer> ts=new TreeSet();        private static Queue<Pair> queue = new LinkedList<Pair>();    ViewAngle(int V){   V++;   this.V=(V);   adj=new LinkedList[V];   Visite=new boolean[100][100];    Visited=new boolean[V];     lev_dfs=new int[V];   for(int i=0;i<V;i++)   adj[i]=new LinkedList<Integer>();   }    static File inFile,outFile;    static FileWriter fWriter;    static PrintWriter pWriter;    public static void main(String[] args) throws IOException {       inFile=new File("input.txt");    outFile = new File ("output.txt");    fWriter = new FileWriter (outFile);   pWriter = new PrintWriter (fWriter);   Scanner sc = new Scanner (inFile);   int n=sc.nextInt();   int m=sc.nextInt();   char c[][]=new char[n][m];   for(int i=0;i<n;i++){   for(int j=0;j<m;j++){    c[i][j]='.';   }   }   setup(n, m);   int k=sc.nextInt();   for(int i=0;i<k;i++){   int x=sc.nextInt();   int y=sc.nextInt();   queue.add(new Pair(x-1, y-1));   c[x-1][y-1]='X';   level[x-1][y-1]=-1;   Visite[x-1][y-1]=true;   }  BFS(c, n, m);   pWriter.close();   sc.close();   }   static void addEdge(int v,int w){      if(adj[v]==null){    adj[v]=new LinkedList();   }   adj[v].add(w);         }     public static int BFS2(int startVert,int dest){   Visited=new boolean[V];   for(int i=1;i<V;i++){    lev_dfs[i]=-1;   }   Queue<Integer> q=new LinkedList<Integer>();   q.add(startVert);      lev_dfs[startVert]=0;   while(!q.isEmpty()){    int top=q.poll();       Iterator<Integer> i= adj[top].listIterator();    while(i.hasNext()){    int n=i.next();    if(!Visited[n]){     q.add(n);     Visited[n]=true;     lev_dfs[n]=lev_dfs[top]+1;    if(n==dest){     q.clear();     return lev_dfs[n];        }    }    }   }   q.clear();   return -1;   }   public int getEd(){   return degree/2;   }   public void get(int from,int to){   int h=lev_dfs[from]-lev_dfs[to];   if(h<=0){    System.out.println(-1);   }else{    System.out.println(h-1);   }   }   public static void setup(int n,int m){    level=new int[n][m];   Visite=new boolean[n][m];   }   private static boolean check(int x,int y,char c[][]){     if((x>=0 && y>=0) && (x<c.length && y<c[0].length) && c[x][y]=='.'){      return true;   }   return false;  }   public static int BFS(char[][] c,int n,int m)   {          int count=0;      while (!queue.isEmpty())    {         Pair temp = queue.poll();     int x=temp.w;     int y=temp.h;     Visite[x][y]=true;     if(check(x+1,y,c) && !Visite[x+1][y]){     level[x+1][y]=level[x][y]+1;     queue.add(new Pair(x+1, y));     Visite[x+1][y]=true;     }     if(check(x-1,y,c) && !Visite[x-1][y]){     level[x-1][y]=level[x][y]+1;     queue.add(new Pair(x-1, y));     Visite[x-1][y]=true;     }     if(check(x,y+1,c) && !Visite[x][y+1]){     level[x][y+1]=level[x][y]+1;     queue.add(new Pair(x, y+1));     Visite[x][y+1]=true;     }     if(check(x,y-1,c) && !Visite[x][y-1]){     level[x][y-1]=level[x][y]+1;     queue.add(new Pair(x, y-1));     Visite[x][y-1]=true;     }            }    int prev_lev=-1,x=-1,y=-1;    for(int i=0;i<n;i++){    for(int j=0;j<m;j++){     if(level[i][j]>=prev_lev){     prev_lev=level[i][j];     x=i;y=j;     }         }        }       pWriter.println((x+1)+" "+(y+1));    return V;   }     private void getAns(int startVertex){   for(int i=0;i<adj[startVertex].size();i++){    int ch=adj[startVertex].get(i);    for(int j=0;j<adj[ch].size();j++){    int ch2=adj[ch].get(j);    if(adj[ch2].contains(startVertex)){     System.out.println(startVertex+" "+ch+" "+ch2);     System.exit(0);    }    }   }   }      public long dfs(int startVertex){          if(!Visited[startVertex]) {     return dfsUtil(startVertex,Visited);      }            return 0;   }  private long dfsUtil(int startVertex, boolean[] Visited) {    int c=1;   long cout=0;   degree=0;   Visited[startVertex]=true;      st.push(startVertex);   while(!st.isEmpty()){      int top=st.pop();      Iterator<Integer> i=adj[top].listIterator();   degree+=adj[top].size();     while(i.hasNext()){     int n=i.next();     if( !Visited[n]){     Visited[n]=true;     st.push(n);          lev_dfs[n]=top;        }    }    }      for(int i=1;i<V;i++){   if(lev_dfs[i]!=0){    System.out.print(lev_dfs[i]+" ");   }   }   return cout;                     }       }  class Pair implements Comparable<Pair>{   int w; int h; Pair(int w,int h){  this.w=w;  this.h=h; } @Override public int compareTo(Pair o) {    if(w>o.w){  return 1;  }else if(w<o.w){  return -1;  }else{  if(h>o.h)   return 1;  else if(h<o.h)   return -1;  else  return 0;  }    } }
4	public class Solution implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer("");  @Override public void run() {  try {  init();  } catch (FileNotFoundException e) {  e.printStackTrace();  }  long time = System.currentTimeMillis();  try {  solve();  } catch (Exception e) {  e.printStackTrace();  }  out.close();   }  private void init() throws FileNotFoundException {  String file = "123";  if (!file.equals("")) {  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);  } }  public static void main(String[] args) {  new Thread(new Solution()).start(); }  private String readString() {  while (!tok.hasMoreTokens()) {  try {   tok = new StringTokenizer(in.readLine());  } catch (IOException e) {   e.printStackTrace();  }  }  return tok.nextToken(); }  private int readInt() {  return Integer.parseInt(readString()); }  int[] counts = new int[1000];  private long readLong() {  return Long.parseLong(readString()); }  private void solve() {  int n = readInt()+2;  int m = readInt()+2;  boolean[][] graph = new boolean[n][m];  for (int i = 0; i < n; i++) {  graph[i][m-1] = true;  graph[i][0] = true;  }  for (int i = 0; i < m; i++) {  graph[n-1][i] = true;  graph[0][i] = true;  }  int k = readInt();  int inFire = 0;  Queue<Point> q = new ArrayDeque<>();  for (int i = 0; i < k; i++) {  int x = readInt();  int y = readInt();  Point p = new Point(x, y);  graph[x][y] = true;  q.add(p);  }  while (!q.isEmpty()) {  Point current = q.poll();  inFire++;  if(!graph[current.x+1][current.y]) {   graph[current.x+1][current.y] = true;   q.add(new Point(current.x+1, current.y));  }  if(!graph[current.x-1][current.y]) {   graph[current.x-1][current.y] = true;   q.add(new Point(current.x-1, current.y));  }  if(!graph[current.x][current.y+1]) {   graph[current.x][current.y+1] = true;   q.add(new Point(current.x, current.y+1));  }  if(!graph[current.x][current.y-1]) {   graph[current.x][current.y-1] = true;   q.add(new Point(current.x, current.y-1));  }  if(q.isEmpty()) {   out.print(current.x+" "+current.y);   return;  }  }  }  class Point{  int x, y;  public Point(int x, int y) {  this.x = x;  this.y = y;  } } }
0	public class Task122A {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  sc.close();   if ( (n % 4 == 0) ||   (n % 7 == 0) ||   (n % 44 == 0) ||   (n % 47 == 0) ||   (n % 74 == 0) ||   (n % 77 == 0) ||    (n % 444 == 0) ||   (n % 447 == 0) ||   (n % 474 == 0) ||   (n % 477 == 0) ||   (n % 744 == 0) ||   (n % 747 == 0) ||   (n % 774 == 0) ||   (n % 777 == 0) )  {  System.out.println("YES");  } else {  System.out.println("NO");  } } }
0	public class Main {  public static void main(String[] args) throws Exception {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int res = n;  String str = Integer.toString(n);  res = Math.max(res, Integer.parseInt(str.substring(0, str.length() - 1)));  res = Math.max(res, Integer.parseInt(str.substring(0, str.length() - 2) + str.substring(str.length() - 1)));  System.out.println(res); } }
0	public class C {  static StringBuilder st = new StringBuilder();  public static void main(String[] args) throws Exception {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  Point [] square = new Point [4] ;  Point [] rotSquare = new Point[4] ;    for(int i = 0 ; i < 4 ;i++)  square[i] = new Point(sc.nextInt() , sc.nextInt());   for(int i = 0 ; i < 4 ;i++)  rotSquare[i] = new Point(sc.nextInt() , sc.nextInt());   boolean can = false ;    for(int x = -100 ; x <= 100 ; x++)  for(int y = -100 ; y <= 100 ; y++)   can |= inside(new Point(x , y), square) & inside(new Point (x , y), rotSquare);         out.println(can ? "YES" : "NO");   out.flush();  out.close();  } static int crossProduct(Point a , Point b) {  int ans = a.x * b.y - a.y * b.x ;    if(ans < 0)return -1 ;  if(ans == 0) return 0 ;  return 1 ;  }  static boolean inside(Point a , Point [] points) {  boolean allPos = true ;  boolean allNeg = true ;    for(int i = 0 ; i < 4 ; i++)  {  Point v1 = new Point (points[i].x - a.x , points[i].y - a.y) ;   Point v2 = new Point (points[(i + 1) % 4].x - a.x , points[(i + 1) % 4].y - a.y) ;     allPos &= crossProduct(v1, v2) >= 0;  allNeg &= crossProduct(v1, v2) <= 0;  }  return allPos | allNeg ;   }  static class Scanner {  BufferedReader br;  StringTokenizer st;  Scanner(InputStream in) {  br = new BufferedReader(new InputStreamReader(System.in));  }  String next() throws Exception {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.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());  }  }  static 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;  } } }
4	public class YouAreGivenAString { public static void main(String[] args) throws Exception {   BufferedReader r = new BufferedReader(new InputStreamReader(System.in));  String s=r.readLine();  int max=0;  for(int i=1;i<s.length();i++){  for (int j = 0; j <= s.length()-i; j++) {   String sub=s.substring(j,j+i);   if(count(s,sub)>=2)   max=Math.max(max, i);  }  }  System.out.println(max); }  private static int count(String s, String sub) {  int l=sub.length();  int c=0;  for(int i=0;i<=s.length()-l;i++){  if(s.substring(i,i+l).equals(sub))   c++;  }  return c; } }
4	@SuppressWarnings("unused") public class Fire35C {  InputStream is; PrintWriter out; String INPUT = "";  int mod = (int)(Math.pow(10,9)+7); int v = 0; int max = 0; StringBuilder st = new StringBuilder(); File outFile = new File("output.txt"); void solve() throws IOException {   int n = ni();  int m = ni();  boolean visited[][] = new boolean[n][m];  boolean inq[][] = new boolean[n][m];  Queue<Integer> x = new LinkedList<>();  Queue<Integer> y = new LinkedList<>();  Queue<Integer> lev = new LinkedList<>();  int a = -1 , b = -1 , max = 0;  int k = ni();  while(k-- > 0) {  int u = ni()-1;  int v = ni()-1;  x.add(u);  y.add(v);  lev.add(1);  inq[u][v] = true;  }  while(x.size() != 0) {   int u = x.poll();  int v = y.poll();  int l = lev.poll();  if(max < l) {   a = u;   b = v;   max = l;  }  visited[u][v] = true;  if(u-1 >= 0 && !visited[u-1][v] && !inq[u-1][v]) {   x.add(u-1);   y.add(v);   lev.add(l+1);   inq[u-1][v] = true;  }   if(u+1 < n && !visited[u+1][v] && !inq[u+1][v]) {   x.add(u+1);   y.add(v);   lev.add(l+1);   inq[u+1][v] = true;  }   if(v-1 >= 0 && !visited[u][v-1] && !inq[u][v-1]) {   x.add(u);   y.add(v-1);   lev.add(l+1);   inq[u][v-1] = true;  }   if(v+1 < m && !visited[u][v+1] && !inq[u][v+1]) {   x.add(u);   y.add(v+1);   lev.add(l+1);   inq[u][v+1] = true;  }    }  a++;  b++;  out.println(a+" "+b);  out.close(); }  void run() throws Exception {  is = INPUT.isEmpty() ? new FileInputStream(new File("input.txt")) : new ByteArrayInputStream(INPUT.getBytes());  out = new PrintWriter(new BufferedWriter(new FileWriter(outFile)));  long s = System.currentTimeMillis();  solve();  out.flush();  if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms"); }  public static void main(String[] args) throws Exception { new Fire35C().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) && 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[][] na(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] = 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();  } }  void display2D(int a[][]) {  for(int i[] : a) {  for(int j : i) {   out.print(j+" ");  }  out.println();  } }  int[][] creategraph(int n , int m) {  int g[][] = new int[n+1][];  int from[] = new int[m];  int to[] = new int[m];  int ct[] = new int[n+1];  for(int i = 0 ; i<m; i++) {  from[i] = ni();  to[i] = ni();  ct[from[i]]++;  ct[to[i]]++;  }  int parent[] = new int[n+1];  for(int i = 0 ; i<n+1 ; i++) g[i] = new int[ct[i]];  for(int i = 0 ; i<m ; i++) {  g[from[i]][--ct[from[i]]] = to[i];  g[to[i]][--ct[to[i]]] = from[i];  }  return g; }  static long __gcd(long a, long b) {  if(b == 0)  {  return a;  }  else  {  return __gcd(b, a % b);  } }   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 a, int m) {  if (__gcd(a, m) != 1) {    return -1;  }  else {           return power(a, m - 2, m);  } }  static long nCrModPFermat(int n, int r,  int p , long fac[]) {    if (r == 0)  return 1;       long t = (fac[n]* modInverse(fac[r], p))%p;  return ( (t* modInverse(fac[n-r], p))% p); }  private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); } }
4	public class Main {  public static void main(String[] args) {   Scanner r = new Scanner(System.in);     String a = r.next();   char[] c = a.toCharArray();     for(int l = a.length()-1; l >= 1; l--){    for(int i = 0; i <= a.length()-l; i++){     int j = i+l-1;         for(int s = 0; s <= a.length()-l; s++){      if(i == s)continue;      if(a.substring(i, i+l).equals(a.subSequence(s, s+l))){       System.out.println(l);       System.exit(0);      }           }    }   }     System.out.println(0);    } }
4	public class Main{  public static void main(String args[]){   Scanner sc=new Scanner(System.in);   String str=sc.next();   sc.close();     int maxm=0;   int ind1,ind2;     for(int i=0;i<str.length();i++){    for(int j=i+1;j<str.length();j++){     int len=0;     ind1=i;ind2=j;     while(ind2<str.length() && str.charAt(ind1)==str.charAt(ind2)){      ind1++;      ind2++;      len++;     }     maxm=Math.max(maxm,len);    }   }   System.out.println(maxm);  } }
2	public class C {  String fileName = "<name>";  public static final int MOD = (int) (1e9 + 7);  public void solve() throws IOException {   long x = nextLong();   if (x == 0) {    out.print(0);    return;   }   long k = nextLong();   BigInteger power = BigInteger.valueOf(2)     .modPow(BigInteger.valueOf(k), BigInteger.valueOf(MOD));   BigInteger r = BigInteger.valueOf(x).multiply(power);   BigInteger l = r.subtract(power).add(BigInteger.ONE);   out.print(l.add(r).mod(BigInteger.valueOf(MOD)));  }  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);   }  }  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 long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);   new C().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);   F1BlokiRavnoiSummiProstayaRedakciya solver = new F1BlokiRavnoiSummiProstayaRedakciya();   solver.solve(1, in, out);   out.close();  }  static class F1BlokiRavnoiSummiProstayaRedakciya  {   InputReader in;   Map<Long, List<F1BlokiRavnoiSummiProstayaRedakciya.Block>> sums;   public void solve(int testNumber, InputReader in, PrintWriter out)   {    this.in = in;    int n = ni();    long[] a = nla(n);    sums = new HashMap<>();    for (int i = 0; i < n; i++)    {     long sum = 0;     for (int j = i; j < n; j++)     {      sum += a[j];      sums.computeIfAbsent(sum, k -> new ArrayList<>()).add(          new F1BlokiRavnoiSummiProstayaRedakciya.Block(i, j, sum));     }    }    for (Map.Entry<Long, List<F1BlokiRavnoiSummiProstayaRedakciya.Block>> e : sums.entrySet())    {     Collections.sort(e.getValue());    }    List<F1BlokiRavnoiSummiProstayaRedakciya.Block> res = Collections.emptyList();    for (Map.Entry<Long, List<F1BlokiRavnoiSummiProstayaRedakciya.Block>> e : sums.entrySet())    {     List<F1BlokiRavnoiSummiProstayaRedakciya.Block> blocks = e.getValue();     List<F1BlokiRavnoiSummiProstayaRedakciya.Block> updated = new ArrayList<>();     if (blocks.size() <= res.size())      continue;     for (F1BlokiRavnoiSummiProstayaRedakciya.Block next : blocks)     {      if (updated.size() == 0)       updated.add(next);      else      {       F1BlokiRavnoiSummiProstayaRedakciya.Block prev = updated.get(updated.size() - 1);       if (next.l > prev.r)        updated.add(next);      }     }     if (updated.size() > res.size())      res = updated;    }    StringBuilder resS = new StringBuilder();    resS.append(res.size()).append('\n');    for (F1BlokiRavnoiSummiProstayaRedakciya.Block block : res)     resS.append(block.l + 1).append(' ').append(block.r + 1).append('\n');    out.println(resS);   }   private long[] nla(int size)   {    return in.nextLongArray(size);   }   private int ni()   {    return in.nextInt();   }   static class Block implements Comparable<F1BlokiRavnoiSummiProstayaRedakciya.Block>   {    int l;    int r;    long sum;    public Block(int l, int r, long sum)    {     this.l = l;     this.r = r;     this.sum = sum;    }    public int compareTo(F1BlokiRavnoiSummiProstayaRedakciya.Block o)    {     int res = Integer.compare(r, o.r);     if (res == 0)      res = Integer.compare(l, o.l);     return res;    }   }  }  static class InputReader  {   private final BufferedReader reader;   private StringTokenizer tokenizer;   public InputReader(InputStream in)   {    reader = new BufferedReader(new InputStreamReader(in));   }   public long[] nextLongArray(int size)   {    long[] array = new long[size];    for (int i = 0; i < size; ++i)    {     array[i] = nextLong();    }    return array;   }   public int nextInt()   {    return Integer.parseInt(next());   }   public long nextLong()   {    return Long.parseLong(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 {  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) {    try {     int n = in.readInt();     int[] x = new int[n], w = new int[n];     in.readIntArrays(x, w);     int[] begin = new int[n], end = new int[n];     Arrays.setAll(begin, i -> x[i] - w[i]);     Arrays.setAll(end, i -> x[i] + w[i]);     int m = ArrayUtils.compress(begin, end).length;     int[] dp = new int[m + 1], order = ArrayUtils.order(end);     int idx = 0;     for (int i = 0; i < m; i++) {      if (i > 0) {       dp[i] = dp[i - 1];      }      while (idx < n && end[order[idx]] == i) {       dp[i] = Math.max(dp[i], dp[begin[order[idx]]] + 1);       idx++;      }     }     int res = dp[m - 1];     out.printLine(res);    } catch (Exception e) {     e.printStackTrace();    }   }  }  static class Sorter {   private static final int INSERTION_THRESHOLD = 16;   private Sorter() {   }   public static void sort(IntList list, IntComparator comparator) {    quickSort(list, 0, list.size() - 1, (Integer.bitCount(Integer.highestOneBit(list.size()) - 1) * 5) >> 1,      comparator);   }   private static void quickSort(IntList list, int from, int to, int remaining, IntComparator comparator) {    if (to - from < INSERTION_THRESHOLD) {     insertionSort(list, from, to, comparator);     return;    }    if (remaining == 0) {     heapSort(list, from, to, comparator);     return;    }    remaining--;    int pivotIndex = (from + to) >> 1;    int pivot = list.get(pivotIndex);    list.swap(pivotIndex, to);    int storeIndex = from;    int equalIndex = to;    for (int i = from; i < equalIndex; i++) {     int value = comparator.compare(list.get(i), pivot);     if (value < 0) {      list.swap(storeIndex++, i);     } else if (value == 0) {      list.swap(--equalIndex, i--);     }    }    quickSort(list, from, storeIndex - 1, remaining, comparator);    for (int i = equalIndex; i <= to; i++) {     list.swap(storeIndex++, i);    }    quickSort(list, storeIndex, to, remaining, comparator);   }   private static void heapSort(IntList list, int from, int to, IntComparator comparator) {    for (int i = (to + from - 1) >> 1; i >= from; i--) {     siftDown(list, i, to, comparator, from);    }    for (int i = to; i > from; i--) {     list.swap(from, i);     siftDown(list, from, i - 1, comparator, from);    }   }   private static void siftDown(IntList list, int start, int end, IntComparator comparator, int delta) {    int value = list.get(start);    while (true) {     int child = ((start - delta) << 1) + 1 + delta;     if (child > end) {      return;     }     int childValue = list.get(child);     if (child + 1 <= end) {      int otherValue = list.get(child + 1);      if (comparator.compare(otherValue, childValue) > 0) {       child++;       childValue = otherValue;      }     }     if (comparator.compare(value, childValue) >= 0) {      return;     }     list.swap(start, child);     start = child;    }   }   private static void insertionSort(IntList list, int from, int to, IntComparator comparator) {    for (int i = from + 1; i <= to; i++) {     int value = list.get(i);     for (int j = i - 1; j >= from; j--) {      if (comparator.compare(list.get(j), value) <= 0) {       break;      }      list.swap(j, j + 1);     }    }   }  }  static interface IntList extends IntReversableCollection {   public abstract int get(int index);   public abstract void set(int index, int value);   public abstract void addAt(int index, int value);   public abstract void removeAt(int index);   default public void swap(int first, int second) {    if (first == second) {     return;    }    int temp = get(first);    set(first, get(second));    set(second, temp);   }   default public IntIterator intIterator() {    return new IntIterator() {     private int at;     private boolean removed;     public int value() {      if (removed) {       throw new IllegalStateException();      }      return get(at);     }     public boolean advance() {      at++;      removed = false;      return isValid();     }     public boolean isValid() {      return !removed && at < size();     }     public void remove() {      removeAt(at);      at--;      removed = true;     }    };   }   default public void add(int value) {    addAt(size(), value);   }   default public IntList sort(IntComparator comparator) {    Sorter.sort(this, comparator);    return this;   }   default IntList unique() {    int last = Integer.MIN_VALUE;    IntList result = new IntArrayList();    int size = size();    for (int i = 0; i < size; i++) {     int current = get(i);     if (current != last) {      result.add(current);      last = current;     }    }    return result;   }   default public IntList subList(final int from, final int to) {    return new IntList() {     private final int shift;     private final int size;     {      if (from < 0 || from > to || to > IntList.this.size()) {       throw new IndexOutOfBoundsException("from = " + from + ", to = " + to + ", size = " + size());      }      shift = from;      size = to - from;     }     public int size() {      return size;     }     public int get(int at) {      if (at < 0 || at >= size) {       throw new IndexOutOfBoundsException("at = " + at + ", size = " + size());      }      return IntList.this.get(at + shift);     }     public void addAt(int index, int value) {      throw new UnsupportedOperationException();     }     public void removeAt(int index) {      throw new UnsupportedOperationException();     }     public void set(int at, int value) {      if (at < 0 || at >= size) {       throw new IndexOutOfBoundsException("at = " + at + ", size = " + size());      }      IntList.this.set(at + shift, value);     }     public IntList compute() {      return new IntArrayList(this);     }    };   }  }  static interface IntComparator {   IntComparator DEFAULT = Integer::compare;   int compare(int first, int second);  }  static class Range {   public static IntList range(int from, int to) {    int[] result = new int[Math.abs(from - to)];    int current = from;    if (from <= to) {     for (int i = 0; i < result.length; i++) {      result[i] = current++;     }    } else {     for (int i = 0; i < result.length; i++) {      result[i] = current--;     }    }    return new IntArray(result);   }  }  static interface IntReversableCollection extends IntCollection {  }  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 close() {    writer.close();   }   public void printLine(int i) {    writer.println(i);   }  }  static interface IntStream extends Iterable<Integer>, Comparable<IntStream> {   IntIterator intIterator();   default Iterator<Integer> iterator() {    return new Iterator<Integer>() {     private IntIterator it = intIterator();     public boolean hasNext() {      return it.isValid();     }     public Integer next() {      int result = it.value();      it.advance();      return result;     }    };   }   default int compareTo(IntStream c) {    IntIterator it = intIterator();    IntIterator jt = c.intIterator();    while (it.isValid() && jt.isValid()) {     int i = it.value();     int j = jt.value();     if (i < j) {      return -1;     } else if (i > j) {      return 1;     }     it.advance();     jt.advance();    }    if (it.isValid()) {     return 1;    }    if (jt.isValid()) {     return -1;    }    return 0;   }  }  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 void readIntArrays(int[]... arrays) {    for (int i = 0; i < arrays[0].length; i++) {     for (int j = 0; j < arrays.length; j++) {      arrays[j][i] = readInt();     }    }   }   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 {    boolean isSpaceChar(int ch);   }  }  static interface IntCollection extends IntStream {   public int size();   default public void add(int value) {    throw new UnsupportedOperationException();   }   default public int[] toArray() {    int size = size();    int[] array = new int[size];    int i = 0;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     array[i++] = it.value();    }    return array;   }   default public IntCollection addAll(IntStream values) {    for (IntIterator it = values.intIterator(); it.isValid(); it.advance()) {     add(it.value());    }    return this;   }  }  static class IntArray extends IntAbstractStream implements IntList {   private int[] data;   public IntArray(int[] arr) {    data = arr;   }   public int size() {    return data.length;   }   public int get(int at) {    return data[at];   }   public void addAt(int index, int value) {    throw new UnsupportedOperationException();   }   public void removeAt(int index) {    throw new UnsupportedOperationException();   }   public void set(int index, int value) {    data[index] = value;   }  }  static class ArrayUtils {   public static int[] range(int from, int to) {    return Range.range(from, to).toArray();   }   public static int[] createOrder(int size) {    return range(0, size);   }   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) {    if (from == 0 && to == array.length) {     new IntArray(array).sort(comparator);    } else {     new IntArray(array).subList(from, to).sort(comparator);    }    return array;   }   public static int[] order(final int[] array) {    return sort(createOrder(array.length), (first, second) -> Integer.compare(array[first], array[second]));   }   public static int[] unique(int[] array) {    return new IntArray(array).unique().toArray();   }   public static int[] compress(int[]... arrays) {    int totalLength = 0;    for (int[] array : arrays) {     totalLength += array.length;    }    int[] all = new int[totalLength];    int delta = 0;    for (int[] array : arrays) {     System.arraycopy(array, 0, all, delta, array.length);     delta += array.length;    }    sort(all, IntComparator.DEFAULT);    all = unique(all);    for (int[] array : arrays) {     for (int i = 0; i < array.length; i++) {      array[i] = Arrays.binarySearch(all, array[i]);     }    }    return all;   }  }  static interface IntIterator {   public int value() throws NoSuchElementException;   public boolean advance();   public boolean isValid();  }  static class IntArrayList extends IntAbstractStream implements IntList {   private int size;   private int[] data;   public IntArrayList() {    this(3);   }   public IntArrayList(int capacity) {    data = new int[capacity];   }   public IntArrayList(IntCollection c) {    this(c.size());    addAll(c);   }   public IntArrayList(IntStream c) {    this();    if (c instanceof IntCollection) {     ensureCapacity(((IntCollection) c).size());    }    addAll(c);   }   public IntArrayList(IntArrayList c) {    size = c.size();    data = c.data.clone();   }   public IntArrayList(int[] arr) {    size = arr.length;    data = arr.clone();   }   public int size() {    return size;   }   public int get(int at) {    if (at >= size) {     throw new IndexOutOfBoundsException("at = " + at + ", size = " + size);    }    return data[at];   }   private void ensureCapacity(int capacity) {    if (data.length >= capacity) {     return;    }    capacity = Math.max(2 * data.length, capacity);    data = Arrays.copyOf(data, capacity);   }   public void addAt(int index, int value) {    ensureCapacity(size + 1);    if (index > size || index < 0) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    if (index != size) {     System.arraycopy(data, index, data, index + 1, size - index);    }    data[index] = value;    size++;   }   public void removeAt(int index) {    if (index >= size || index < 0) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    if (index != size - 1) {     System.arraycopy(data, index + 1, data, index, size - index - 1);    }    size--;   }   public void set(int index, int value) {    if (index >= size) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    data[index] = value;   }   public int[] toArray() {    return Arrays.copyOf(data, size);   }  }  static abstract class IntAbstractStream implements IntStream {   public String toString() {    StringBuilder builder = new StringBuilder();    boolean first = true;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     if (first) {      first = false;     } else {      builder.append(' ');     }     builder.append(it.value());    }    return builder.toString();   }   public boolean equals(Object o) {    if (!(o instanceof IntStream)) {     return false;    }    IntStream c = (IntStream) o;    IntIterator it = intIterator();    IntIterator jt = c.intIterator();    while (it.isValid() && jt.isValid()) {     if (it.value() != jt.value()) {      return false;     }     it.advance();     jt.advance();    }    return !it.isValid() && !jt.isValid();   }   public int hashCode() {    int result = 0;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     result *= 31;     result += it.value();    }    return result;   }  } }
1	public class Main {  long b = 31;  String fileName = "";    int INF = Integer.MAX_VALUE / 10;  long MODULO = 1000*1000*100;  void solve() throws IOException {   int n = readInt();   int d = readInt();   int[] arr = readIntArray(n);   Arrays.sort(arr);   int ans = 2;   for (int i=0; i < n - 1; ++i){    int cur = arr[i] + d;    if (arr[i+1] - d == cur) ans++;    if (arr[i+1] - d > cur) ans +=2;   }   out.println(ans);  }  class Number implements Comparable<Number>{   int x, cost;   Number(int x, int cost){    this.x = x;    this.cost = cost;   }   @Override   public int compareTo(Number o) {    return Integer.compare(this.cost, o.cost);   }  }  class Point{   int x, y;   Point(int x, int y){    this.x = x;    this.y = y;   }  }  class Vertex implements Comparable<Vertex>{   int num, depth, e, c;   Vertex(int num, int depth, int e, int c){    this.num = num;    this.e = e;    this.depth = depth;    this.c = c;   }   @Override   public int compareTo(Vertex o) {    return Integer.compare(this.e, o.e);   }  }    class Edge{   int from, to, num;   Edge(int to, int num){    this.to = to;    this.num = num;   }  }  class SparseTable{   int[][] rmq;   int[] logTable;   int n;   SparseTable(int[] a){    n = a.length;    logTable = new int[n+1];    for(int i = 2; i <= n; ++i){     logTable[i] = logTable[i >> 1] + 1;    }    rmq = new int[logTable[n] + 1][n];    for(int i=0; i<n; ++i){     rmq[0][i] = a[i];    }    for(int k=1; (1 << k) < n; ++k){     for(int i=0; i + (1 << k) <= n; ++i){      int max1 = rmq[k - 1][i];      int max2 = rmq[k-1][i + (1 << (k-1))];      rmq[k][i] = Math.max(max1, max2);     }    }   }   int max(int l, int r){    int k = logTable[r - l];    int max1 = rmq[k][l];    int max2 = rmq[k][r - (1 << k) + 1];    return Math.max(max1, max2);   }  }  long checkBit(long mask, int bit){   return (mask >> bit) & 1;  }  class Dsu{   int[] parent;   int countSets;   Dsu(int n){    countSets = n;    parent = new int[n];    for(int i=0; i<n; ++i){     parent[i] = i;    }   }   int findSet(int a){    if(parent[a] == a) return a;    parent[a] = findSet(parent[a]);    return parent[a];   }   void unionSets(int a, int b){    a = findSet(a);    b = findSet(b);    if(a!=b){     countSets--;     parent[a] = b;    }   }  }  static int checkBit(int mask, int bit) {   return (mask >> bit) & 1;  }  boolean isLower(char c){   return c >= 'a' && c <= 'z';  }    class SegmentTree{   int[] t;   int n;   SegmentTree(int n){    t = new int[4*n];    build(new int[n+1], 1, 1, n);   }   void build (int a[], int v, int tl, int tr) {    if (tl == tr)     t[v] = a[tl];    else {     int tm = (tl + tr) / 2;     build (a, v*2, tl, tm);     build (a, v*2+1, tm+1, tr);    }   }   void update (int v, int tl, int tr, int l, int r, int add) {    if (l > r)     return;    if (l == tl && tr == r)     t[v] += add;    else {     int tm = (tl + tr) / 2;     update (v*2, tl, tm, l, Math.min(r,tm), add);     update (v*2+1, tm+1, tr, Math.max(l,tm+1), r, add);    }   }   int get (int v, int tl, int tr, int pos) {    if (tl == tr)     return t[v];    int tm = (tl + tr) / 2;    if (pos <= tm)     return t[v] + get (v*2, tl, tm, pos);    else     return t[v] + get (v*2+1, tm+1, tr, pos);   }  }  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] = Math.max(delta, t[ind]);    }   }   long getMax(int r) {    long sum = 0;    for (; r >= 0; r = (r & (r + 1)) - 1) {     sum = Math.max(sum, t[r]);    }    return sum;   }  }  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);  }  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;   }  }  int minInt(int... values) {   int min = Integer.MAX_VALUE;   for (int value : values) min = Math.min(min, value);   return min;  }  int maxInt(int... values) {   int max = Integer.MIN_VALUE;   for (int value : values) max = Math.max(max, value);   return max;  }  public static void main(String[] args) throws NumberFormatException, IOException {     new Main().run();  }  void run() throws NumberFormatException, IOException {   solve();   out.close();  };  BufferedReader in;  PrintWriter out;  StringTokenizer tok;  String delim = " ";  Random rnd = new Random();  Main() 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());  }  byte readByte() throws NumberFormatException, IOException {   return Byte.parseByte(readString());  }  int[] readIntArray (int n) throws NumberFormatException, IOException {   int[] a = new int[n];   for(int i=0; i<n; ++i){    a[i] = readInt();   }   return a;  }  Integer[] readIntegerArray (int n) throws NumberFormatException, IOException {   Integer[] a = new Integer[n];   for(int i=0; i<n; ++i){    a[i] = readInt();   }   return a;  }  long readLong() throws NumberFormatException, IOException {   return Long.parseLong(readString());  }  double readDouble() throws NumberFormatException, IOException {   return Double.parseDouble(readString());  } }
6	public class G1 {  static int n, T, duration[], type[];  static long dp[][][], mod = (long) 1e9 + 7;  public static void main(String[] args) throws Exception {   new Thread(null, new Runnable() {    public void run() {     try {      solveIt();     } catch (Exception e) {      e.printStackTrace();      System.exit(1);     }    }   }, "Main", 1 << 28).start();  }  public static void solveIt() throws Exception {   Scanner in = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   n = in.nextInt();   T = in.nextInt();   dp = new long[3][T + 1][1 << n];   duration = new int[n];   type = new int[n];   for (int i = 0; i < n; i++) {    duration[i] = in.nextInt();    type[i] = in.nextInt() - 1;   }   for (long a[][] : dp) for (long b[] : a) Arrays.fill(b, -1);   pw.println(solve(0, T, 0));   pw.close();  }  static long solve(int lastType, int rem, int mask) {   if (rem == 0) return 1;   if (rem < 0) return 0;   if (dp[lastType][rem][mask] != -1) return dp[lastType][rem][mask];   long res = 0;   for (int i = 0; i < n; i++) {    if (!check(mask, i) && (lastType != type[i] || mask == 0) && rem - duration[i] >= 0) {     res += solve(type[i], rem - duration[i], set(mask, i));     if (res >= mod) res -= mod;    }   }   return dp[lastType][rem][mask] = res;  }  static boolean check(int N, int pos) {   return (N & (1 << pos)) != 0;  }  static int set(int N, int pos) {   return N = N | (1 << pos);  }  static int reset(int N, int pos) {   return N = N & ~(1 << pos);  }  static void debug(Object... obj) {   System.err.println(Arrays.deepToString(obj));  } }
5	public class CottageVillage {   class cl {   int x=0;   int a=0;     cl(int x, int a){    this.x=x;    this.a=a;   }  }   class cmp implements Comparator<cl> {   public int compare(cl d1, cl d2) {    return d1.x<d2.x ? -1 : 1;   }  }   public CottageVillage() {   Scanner sc = new Scanner(System.in);     int n = sc.nextInt();   int k = sc.nextInt();     cl[] w = new cl[n];   for(int i=0; i<n; i++)    w[i] = new cl(sc.nextInt(), sc.nextInt());   Arrays.sort(w, new cmp());     int cnt=2, diff=0;   for(int i=1; i<n; i++) {    diff = Math.abs(2*w[i].x-2*w[i-1].x-w[i].a-w[i-1].a)-2*k;    if (diff>0) cnt+=2;    else if (diff==0) cnt++;   }   System.out.println(cnt);  }   public static void main(String... args) {   new CottageVillage();  } }
4	public class Solution implements Runnable {  public static void main(String... strings) throws InterruptedException {  new Thread(new Solution()).start(); }  BufferedReader in; PrintWriter out; StringTokenizer st;  String next() throws Exception {  if (st == null || !st.hasMoreElements())  st = new StringTokenizer(in.readLine());  return st.nextToken(); }  int nextInt() throws Exception {  return Integer.parseInt(next()); }  double nextDouble() throws Exception {  return Double.parseDouble(next()); }  long nextLong() throws Exception {  return Long.parseLong(next()); }  @Override public void run() {  try {  in = new BufferedReader(new FileReader("input.txt"));  out = new PrintWriter(new FileWriter("output.txt"));  solve();  } catch (Exception e) {  throw new RuntimeException(e);  } finally {  out.close();  } } int n, m, k, xor = 0; boolean[][] used; HashSet<Long> [] set; void solve() throws Exception {  n = nextInt();  m = nextInt();  k = nextInt();  used = new boolean[n][m];  set = new HashSet[2];  for(int i = 0; i < 2; set[i++] = new HashSet<Long>());   for(int i = 0; i < k; i++){  int x = nextInt()-1, y = nextInt()-1;  used[x][y] = true;  set[0].add(10000L*x + y);  }  for (;;xor ^= 1){  set[xor^1].clear();  int ansx = -1, ansy = -1;  for (long i : set[xor]){   int x = (int)(i/10000), y = (int)(i%10000);   if (ansx < 0){   ansx = x+1;   ansy = y+1;   }   add(x+1, y);   add(x-1, y);   add(x, y+1);   add(x, y-1);  }  if (set[xor^1].size() == 0){   out.println(ansx + " " + ansy);   break;  }  } } public void add(int x, int y){  if (!( x >= 0 && y >= 0 && x < n && y < m && !used[x][y])) return;  set[xor^1].add(10000L*x + y);  used[x][y] = true; } }
3	public class PythonIndentation { public static void main(String args[]) {  Scanner in = new Scanner(System.in) ;  int n = in.nextInt() ;  boolean[] lst = new boolean[n] ;  for(int i=0;i<n;i++)  {  lst[i] = (in.next().equals("s"))?false:true ;  }  System.out.println(dp(lst)) ; } static void arrayPrinter(int[][] dp) {  System.out.println(":::") ;  for(int i=0;i<dp.length;i++)  {  for(int j=0;j<dp[0].length;j++)  {   System.out.print(dp[i][j]+" ") ;  }  System.out.println() ;  } } static int dp(boolean[] lst) {  int[][] dp = new int[2][lst.length] ;  dp[0][0] = 1 ;  for(int i=1;i<lst.length;i++)  {    for(int j=0;j<lst.length;j++)  {   if(lst[i-1])   {   if(j==0)    dp[i%2][j] = 0 ;   else    dp[i%2][j] = dp[(i-1)%2][j-1] ;   }     else   {   if(j==0)   {    int temp = 0 ;    for(int k=0;k<lst.length;k++)    temp = (temp+dp[(i-1)%2][k])%1000000007 ;    dp[i%2][j] = temp ;   }   else    dp[i%2][j] = (dp[i%2][j-1]-dp[(i-1)%2][j-1])%1000000007 ;   }  }  }  int ans = 0 ;  for(int i=0;i<lst.length;i++)  {  ans = (ans + dp[(lst.length-1)%2][i])%1000000007 ;  }  if(ans<0)  ans = ans + 1000000007 ;   return ans ; } }
6	public class ElongatedMatrix { public static void main(String[] args) {  InputStream input;  OutputStream output;  try {  input = new FileInputStream("input.txt");  output = new FileOutputStream("output.txt");  } catch (FileNotFoundException e) {  input = System.in;  output = System.out;  }  Kattio io = new Kattio(input, output);  (new Solve(io)).main();  io.close();  if (input instanceof FileInputStream)  try {   input.close();  } catch (IOException e) {   }  if (output instanceof FileOutputStream)  try {   output.close();  } catch (IOException e) {   } } } class Solve { static final int oo = (int) 1e9; Kattio io; int n, m; int[][] a; int[][][] dp; int[][] diff; int[][] slant;  Solve(Kattio io) {  this.io = io; }  int getbit(int x, int n) {  n--;  return (x >> n) & 1; }  int setbit(int x, int n) {  n--;  return x | (1 << n); }  int caldp(int currentRow, int firstRow, int mask) {  if (dp[currentRow][firstRow][mask] != -1)  return dp[currentRow][firstRow][mask];  dp[currentRow][firstRow][mask] = 0;  if (mask == (1 << n) - 1)  dp[currentRow][firstRow][mask] = slant[currentRow][firstRow];  else {  for (int i = 1; i <= n; i++)   if (getbit(mask, i) == 0) {   dp[currentRow][firstRow][mask] = Math.max(    Math.min(caldp(i, firstRow, setbit(mask, i)), diff[currentRow][i]),    dp[currentRow][firstRow][mask]);   }  }  return dp[currentRow][firstRow][mask];  }  void main() {  n = io.getInt();  m = io.getInt();  a = new int[n+1][m+1];  dp = new int[n+1][n+1][1<<n];   for (int i=1; i<=n; i++)  for (int j=1; j<=m; j++)   a[i][j] = io.getInt();   diff = new int[n+1][n+1];  for (int i=1; i<=n; i++)  for (int j=1; j<=n; j++)  {   diff[i][j]=oo;   for (int x=1; x<=m; x++)   diff[i][j]=Math.min(diff[i][j], Math.abs(a[i][x]-a[j][x]));  }   slant = new int[n+1][n+1];  for (int i=1; i<=n; i++)  for (int j=1; j<=n; j++)  {   slant[i][j] = oo;   for (int x=1; x+1<=m; x++)   slant[i][j] = Math.min(slant[i][j], Math.abs(a[i][x]-a[j][x+1]));  }   for (int i=1; i<=n; i++)  for (int j=1; j<=n; j++)   Arrays.fill(dp[i][j], -1);   int res = 0;  for (int i=1; i<=n; i++)  res = Math.max(res, caldp(i,i,setbit(0,i)));   io.print(res); } } class Kattio extends PrintWriter { public Kattio(InputStream i) {  super(new BufferedOutputStream(System.out));  r = new BufferedReader(new InputStreamReader(i)); }  public Kattio(InputStream i, OutputStream o) {  super(new BufferedOutputStream(o));  r = new BufferedReader(new InputStreamReader(i)); }  public boolean hasMoreTokens() {  return peekToken() != null; }  public int getInt() {  return Integer.parseInt(nextToken()); }  public double getDouble() {  return Double.parseDouble(nextToken()); }  public long getLong() {  return Long.parseLong(nextToken()); }  public String getWord() {  return nextToken(); }  private BufferedReader r; private String line; private StringTokenizer st; private String token;  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; } }
4	public class Main {  public static void main(String[] args)  {   InputStream inputStream;   try   {    inputStream = new FileInputStream("input.txt");   } catch (IOException e)   {    throw new RuntimeException(e);   }   OutputStream outputStream;   try   {    outputStream = new FileOutputStream("output.txt");   } catch (IOException e)   {    throw new RuntimeException(e);   }   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 m = in.nextInt();    int p = in.nextInt();    int[] x = new int[p];    int[] y = new int[p];    for (int i = 0; i < p; i++)    {     x[i] = in.nextInt();     y[i] = in.nextInt();    }    int X = x[0];    int Y = y[0];    int D = -1;    for (int dx = 1; dx <= n; dx++)    {     int x1 = dx;     int y1 = 1;     int xx = 0;     int yy = 0;     int minD = Integer.MAX_VALUE;     for (int j = 0; j < p; j++)     {      int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);      if (d < minD)      {       minD = d;       xx = x1;       yy = y1;      }     }     if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)     {      D = minD;      X = xx;      Y = yy;     }    }    for (int dx = 1; dx <= n; dx++)    {     int x1 = dx;     int y1 = m;     int xx = 0;     int yy = 0;     int minD = Integer.MAX_VALUE;     for (int j = 0; j < p; j++)     {      int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);      if (d < minD)      {       minD = d;       xx = x1;       yy = y1;      }     }     if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)     {      D = minD;      X = xx;      Y = yy;     }    }    for (int dy = 1; dy <= m; dy++)    {     int x1 = 1;     int y1 = dy;     int xx = 0;     int yy = 0;     int minD = Integer.MAX_VALUE;     for (int j = 0; j < p; j++)     {      int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);      if (d < minD)      {       minD = d;       xx = x1;       yy = y1;      }     }     if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)     {      D = minD;      X = xx;      Y = yy;     }    }    for (int dy = 1; dy <= m; dy++)    {     int x1 = n;     int y1 = dy;     int xx = 0;     int yy = 0;     int minD = Integer.MAX_VALUE;     for (int j = 0; j < p; j++)     {      int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);      if (d < minD)      {       minD = d;       xx = x1;       yy = y1;      }     }     if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)     {      D = minD;      X = xx;      Y = yy;     }    }    for (int i = 1; i <= Math.min(m, n); i++)    {     int x1 = i;     int y1 = i;     int xx = 0;     int yy = 0;     int minD = Integer.MAX_VALUE;     for (int j = 0; j < p; j++)     {      int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);      if (d < minD)      {       minD = d;       xx = x1;       yy = y1;      }     }     if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)     {      D = minD;      X = xx;      Y = yy;     }    }    for (int i = 1, ii = m; i <= n && ii >= 1; i++, ii--)    {     int x1 = i;     int y1 = ii;     int xx = 0;     int yy = 0;     int minD = Integer.MAX_VALUE;     for (int j = 0; j < p; j++)     {      int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);      if (d < minD)      {       minD = d;       xx = x1;       yy = y1;      }     }     if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)     {      D = minD;      X = xx;      Y = yy;     }    }    out.println(X + " " + Y);   }  }  static class FastScanner  {   public BufferedReader br;   public StringTokenizer st;   public FastScanner(InputStream is)   {    br = new BufferedReader(new InputStreamReader(is));   }   public FastScanner(File f)   {    try    {     br = new BufferedReader(new FileReader(f));    } catch (FileNotFoundException e)    {     e.printStackTrace();    }   }   public String next()   {    while (st == null || !st.hasMoreElements())    {     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(next());   }  }  static class FastPrinter extends PrintWriter  {   public FastPrinter(OutputStream out)   {    super(out);   }   public FastPrinter(Writer out)   {    super(out);   }  } }
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 {  static int [] solve(int [] a) {  int n = a.length;  Arrays.sort(a);  a[n - 1] = (a[n - 1] > 1 ? 1 : 2);  int [] b = Arrays.copyOf(a, n);  Arrays.sort(b);  return b; }  public static void main(String[] args) throws Exception {  reader = new BufferedReader(new InputStreamReader(System.in));  writer = new PrintWriter(System.out);  setTime();   int n = nextInt();  int [] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  int [] b = solve(a);  for (int v: b) {  writer.print(v + " ");  }   printTime();  printMemory();  writer.close(); }  static BufferedReader reader; static PrintWriter writer; static StringTokenizer tok = new StringTokenizer(""); static long systemTime;  static void debug(Object... o) {  System.err.println(deepToString(o)); }  static void setTime() {  systemTime = System.currentTimeMillis(); }  static void printTime() {  System.err.println("Time consumed: " + (System.currentTimeMillis() - systemTime)); }  static void printMemory() {  System.err.println("Memory consumed: "   + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1000 + "kb"); }  static String next() {  while (!tok.hasMoreTokens()) {  String w = null;  try {   w = reader.readLine();  } catch (Exception e) {   e.printStackTrace();  }  if (w == null)   return null;  tok = new StringTokenizer(w);  }  return tok.nextToken(); }  static int nextInt() {  return Integer.parseInt(next()); }  static long nextLong() {  return Long.parseLong(next()); }  static double nextDouble() {  return Double.parseDouble(next()); }  static BigInteger nextBigInteger() {  return new BigInteger(next()); } }
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);   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 m = in.nextInt();    boolean[][] g = new boolean[n][n];    for (int i = 0; i < m; ++i) {     int a = in.nextInt() - 1;     int b = in.nextInt() - 1;     g[a][b] = true;     g[b][a] = true;    }      long[] am = new long[n + 1];    long[][] ways = new long[1 << n][n];    for (int start = 0; start < n; ++start) {     for (int mask = 0; mask < (1 << (n - start)); ++mask)      for (int last = start; last < n; ++last) {       ways[mask][last - start] = 0;      }     ways[1][0] = 1;     for (int mask = 0; mask < (1 << (n - start)); ++mask) {      int cnt = 0;      int tmp = mask;      while (tmp > 0) {       ++cnt;       tmp = tmp & (tmp - 1);      }      for (int last = start; last < n; ++last)       if (ways[mask][last - start] > 0) {        long amm = ways[mask][last - start];        for (int i = start; i < n; ++i)         if ((mask & (1 << (i - start))) == 0 && g[last][i]) {          ways[mask | (1 << (i - start))][i - start] += amm;         }        if (g[last][start])         am[cnt] += ways[mask][last - start];       }     }    }    long res = 0;    for (int cnt = 3; cnt <= n; ++cnt) {     if (am[cnt] % (2) != 0)      throw new RuntimeException();     res += am[cnt] / (2);    }    out.println(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 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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
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);   TaskB solver = new TaskB();   solver.solve(1, in, out);   out.close();  } } class TaskB {  public void solve(int testNumber, Scanner in, PrintWriter out) {   long n = in.nextLong();   long k = in.nextLong();   if (n == 1) {    out.println(0);    return;   }   if (k * (k - 1) < 2 * (n - 1)) {    out.println(-1);    return;   }   long sq2 = 4 * k * k - 4 * k + 1 - 4 * (2 * n - 2);   long km = Math.max(2, (long) ((Math.sqrt(sq2) + 3) / 2.0) - 3);   while (((km + k - 2)*(k - km + 1) >= 2*(n-1))) {    ++km;   }   out.println(k - km + 2);  } }
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());   }  } }
5	public class Main{  public static void main(String[] args) throws Exception {   int n = nextInt();  int a = nextInt();  int b = nextInt();  int[] tasks = new int[n];  for(int i = 0; i < n; i++){  tasks[i] = nextInt();  }  Arrays.sort(tasks);  exit(tasks[b] - tasks[b-1]);   }  private static PrintWriter out; private static BufferedReader inB; private static boolean FILE = false;   static {  try {  out = new PrintWriter(FILE ? (new FileOutputStream("output.txt")) : System.out);  inB = new BufferedReader(new InputStreamReader(FILE ? new FileInputStream("input.txt") : System.in));  } catch(Exception e) {e.printStackTrace();} }  private static StreamTokenizer in = new StreamTokenizer(inB);  private static void exit(Object o) throws Exception {  out.println(o);  out.flush();  System.exit(0); } private static void println(Object o) throws Exception{  out.println(o);  out.flush(); } private static void print(Object o) throws Exception{  out.print(o);  out.flush(); } private static int nextInt() throws Exception {  in.nextToken();  return (int)in.nval; }  private static String nextString() throws Exception {  in.nextToken();  return in.sval;   } }
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);   }  } }
5	public class Main {   public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String[]parts = br.readLine().split("\\s+");  int n = Integer.parseInt(parts[0]);  int a = Integer.parseInt(parts[1]);  int b = Integer.parseInt(parts[2]);  parts = br.readLine().split("\\s+");  int[]hard = new int[n];  for(int i = 0; i < n; i++){  hard[i] = Integer.parseInt(parts[i]);  }  Arrays.sort(hard);  System.out.println(hard[b]-hard[b-1]); } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   static final long MODULO = (long) (1e9 + 7);   public void solve(int testNumber, FastReader in, PrintWriter out) {    int n = in.nextInt();    long[][] dp = new long[n + 100][n + 100];    dp[0][0] = 1;    for (int i = 0; i < n; ++i) {     char current = in.nextCharacter();     if (current == 'f') {      for (int j = 0; j < n; ++j) {       dp[i + 1][j + 1] += dp[i][j];       dp[i + 1][j + 1] %= MODULO;      }     } else {      long runningSum = 0;      for (int j = n; j >= 0; --j) {       runningSum += dp[i][j];       runningSum %= MODULO;       dp[i + 1][j] += runningSum;       dp[i + 1][j] %= MODULO;      }     }    }    out.println(dp[n][0]);   }  }  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;   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public char nextCharacter() {    int c = pread();    while (isSpaceChar(c))     c = pread();    return (char) c;   }  } }
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();   } }
1	public class Main {  public static void main(String[] args)  {   InputReader in = new InputReader(System.in);   OutputWriter out = new OutputWriter(System.out);   int n = in.nextInt();   int d = in.nextInt();   int[]a = new int[n];   int ans=2;    for (int i =0;i<n;i++)   {    a[i] = in.nextInt();    }   for (int i =0;i<n-1;i++)   {     if (a[i+1]-a[i]==2*d)     ans++;    if (a[i+1]-a[i]>2*d)     ans+=2;   }   out.printLine(ans);   out.flush();  } } class pair implements Comparable {  int key;  int value;  public pair(Object key, Object value) {   this.key = (int)key;   this.value=(int)value;  }  @Override  public int compareTo(Object o) {   pair temp =(pair)o;   return key-temp.key;  } } class Graph {   int n;  ArrayList<Integer>[] adjList;  public Graph(int n) {   this.n = n;   adjList = new ArrayList[n];   for (int i = 0; i < n; i++)    adjList[i] = new ArrayList<>();  } }  class InputReader {  private final InputStream stream;  private final byte[] buf = new byte[8192];  private int curChar, snumChars;  public InputReader(InputStream stream) {   this.stream = stream;  }  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;  } } 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();  }  public void flush() {   writer.flush();  } }
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(),k=in.nextInt()-1,i;   scores a[]=new scores[n];   for(i=0;i<n;i++)    a[i]=new scores(in.nextInt(),in.nextInt());   Arrays.sort(a);     int c=1;   for(i=k-1;i>=0;i--)   {    if(a[i].p==a[k].p&&a[i].t==a[k].t)     c++;    else break;   }   for(i=k+1;i<n;i++)   {    if(a[i].p==a[k].p&&a[i].t==a[k].t)     c++;    else break;   }   out.println(c);  }  class scores implements Comparable<scores>  {   int p,t;   public scores(int p,int t)   {    this.p=p;    this.t=t;   }   public int compareTo(scores a)   {    if(a.p>this.p)     return 1;    if(a.p==this.p&&a.t<this.t)     return 1;    return -1;   }  } }
4	public class Main {  public static void main(String[] args) throws IOException {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(new FileReader("input.txt"));   PrintWriter out = new PrintWriter("output.txt");   TaskB solver = new TaskB();   solver.solve(in, out);   out.close();  }  private static class TaskB {   static final long max = 1000000000000000000L;   static final double eps = 0.0000001;   static final long mod = 1000000007;   static int N, M, K;   static long X, Y;   static boolean F[][][];   static int D[][];   void solve(InputReader in, PrintWriter out) throws IOException {    N = in.nextInt();    M = in.nextInt();    K = in.nextInt();    F = new boolean[K][N][M];    D = new int[N][M];    for (int i = 0; i < N; i++)     for (int j = 0; j < M; j++)      D[i][j] = Integer.MAX_VALUE;    List<Pair> list = new ArrayList<>();    for (int i = 0; i < K; i++) {     list.add(new Pair(in.nextInt() - 1, in.nextInt() - 1));    }       for (int i = 0; i < N; i++)     for (int j = 0; j < M; j++)      for (int k = 0; k < K; k++)       D[i][j] = Math.min(D[i][j], Math.abs(list.get(k).X - i) + Math.abs(list.get(k).Y - j));    int res = Integer.MIN_VALUE;    for (int j = 0; j < N; j++)     for (int k = 0; k < M; k++)      if (D[j][k] > res) {       X = j + 1;       Y = k + 1;       res = D[j][k];      }    out.println(X + " " + Y);   }     class Pair {    int X, Y;    Pair(int X, int Y) {     this.X = X;     this.Y = Y;    }   }   long gcd(long A, long B) {    if (B == 0) return A;    return gcd(B, A % B);   }   boolean isPrime(long n) {    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))     return false;    for (long i = 5, j = 2; i * i <= n; i += j, j = 6 - j)     if (n % i == 0)      return false;    return true;   }   boolean isEqual(double A, double B) {    return Math.abs(A - B) < eps;   }   double dist(double X1, double Y1, double X2, double Y2) {    return Math.sqrt((X1 - X2) * (X1 - X2) + (Y1 - Y2) * (Y1 - Y2));   }   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;   }   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;    }   }  }  private static class InputReader {   StringTokenizer st;   BufferedReader br;   public InputReader(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }   public InputReader(FileReader s) throws FileNotFoundException {    br = new BufferedReader(s);   }   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());   }   public long nextLong() {    return Long.parseLong(next());   }   public String nextLine() {    try {     return br.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public double nextDouble() {    return Double.parseDouble(next());   }   public boolean ready() {    try {     return br.ready();    } catch (IOException e) {     throw new RuntimeException(e);    }   }  } }
5	public class Solution {  static class Cottage implements Comparable<Cottage> {   public int x;   public double a;   public Cottage(int x, int a) {    this.x = x;    this.a = a;   }   public int compareTo(Cottage c) {    return x - c.x;   }  }  static final double e = 1e-9;  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int n = in.nextInt();   int t = in.nextInt();   Cottage[] cottages = new Cottage[n];   for (int i = 0; i < n; i++)    cottages[i] = new Cottage(in.nextInt(), in.nextInt());   Arrays.sort(cottages);   int ans = 2;   for (int i = 1; i < cottages.length; i++) {    double diff = cottages[i].x - cottages[i - 1].x - cottages[i - 1].a / 2 - cottages[i].a / 2;    ans = Math.abs(diff - t) < e ? ans + 1 : diff - t < -e ? ans : ans + 2;   }   out.print(ans);   out.close();  } }
1	public class EdD { 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();  for(int i = 0;i<t;i++){   int n =sc.nextInt();   if (n%2== 1)   out.println("NO");   else{    while(n%2 == 0){    n/=2;   }   verdict(isSquare(n) || isSquare(2*n));      }  }  out.close();    } public static boolean isSquare(int n) {  int d = (int)Math.sqrt(n);  for(long s = d-2;s<=d+2;s++){  if (s*s == n)   return true;  }  return false; } 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;   }    } }
0	public class cf2 { static final double EPS = 1e-9;  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);    int xr1=sc.nextInt(), yr1=sc.nextInt(), xr2=sc.nextInt(),yr2=sc.nextInt();  int xr3=sc.nextInt(), yr3=sc.nextInt(), xr4=sc.nextInt(),yr4=sc.nextInt();   Point pr1 = new Point(xr1, yr1);  Point pr2 = new Point(xr2, yr2);  Point pr3 = new Point(xr3, yr3);  Point pr4 = new Point(xr4, yr4);   LineSegment lr1 = new LineSegment(pr1, pr2);  LineSegment lr2 = new LineSegment(pr2, pr3);  LineSegment lr3 = new LineSegment(pr3, pr4);  LineSegment lr4 = new LineSegment(pr4, pr1);     int xd1=sc.nextInt(), yd1=sc.nextInt(), xd2=sc.nextInt(),yd2=sc.nextInt();  int xd3=sc.nextInt(), yd3=sc.nextInt(), xd4=sc.nextInt(),yd4=sc.nextInt();   Point p1 = new Point(xd1, yd1);  Point p2 = new Point(xd2, yd2);  Point p3 = new Point(xd3, yd3);  Point p4 = new Point(xd4, yd4);   Point [] pt = new Point [5];  pt[0]=p1; pt[1]=p2; pt[2]=p3; pt[3]=p4; pt[4]=p1;  Polygon pg = new Polygon(pt);   if(pg.inside(pr1)||pg.inside(pr2)||pg.inside(pr3)||pg.inside(pr4)) {  System.out.println("YES");  return;  }    LineSegment ld1 = new LineSegment(p1, p2);  LineSegment ld2 = new LineSegment(p2, p3);  LineSegment ld3 = new LineSegment(p3, p4);  LineSegment ld4 = new LineSegment(p4, p1);   Rectangle rec = new Rectangle(new Point(Math.min(Math.min(xr3,xr4),Math.min(xr1,xr2)), Math.min(Math.min(yr3,yr4),Math.min(yr1,yr2))),   new Point(Math.max(Math.max(xr3,xr4),Math.max(xr1,xr2)), Math.max(Math.max(yr3,yr4),Math.max(yr1,yr2))) );   if(rec.contains(p1)||rec.contains(p2)||rec.contains(p3)||rec.contains(p4)) {  System.out.println("YES");   return;  }   if(ld1.intersect(lr1)||ld1.intersect(lr3)||ld1.intersect(lr3)||ld1.intersect(lr4)) {  System.out.println("YES");   return;  }   if(ld2.intersect(lr1)||ld2.intersect(lr3)||ld2.intersect(lr3)||ld2.intersect(lr4)) {  System.out.println("YES");   return;  }   if(ld3.intersect(lr1)||ld3.intersect(lr3)||ld3.intersect(lr3)||ld3.intersect(lr4)) {  System.out.println("YES");   return;  }   if(ld4.intersect(lr1)||ld4.intersect(lr3)||ld4.intersect(lr3)||ld4.intersect(lr4)) {  System.out.println("YES");   return;  }   System.out.println("NO");       }  public static class Polygon {    static final double EPS = 1e-9;   Point[] g;     Polygon(Point[] o) { g = o; }  double perimeter()  {  double sum = 0.0;  for(int i = 0; i < g.length - 1; ++i)   sum += g[i].dist(g[i+1]);  return sum;  }   double area()   {  double area = 0.0;  for(int i = 0; i < g.length - 1; ++i)   area += g[i].x * g[i+1].y - g[i].y * g[i+1].x;  return Math.abs(area) / 2.0;   }     boolean inside(Point p)  {  double sum = 0.0;  for(int i = 0; i < g.length - 1; ++i)  {   double angle = Point.angle(g[i], p, g[i+1]);   if((Math.abs(angle) < EPS || Math.abs(angle - Math.PI) < EPS) && p.between(g[i], g[i+1]))   return true;   if(Point.ccw(p, g[i], g[i+1]))   sum += angle;   else   sum -= angle;  }   return Math.abs(2 * Math.PI - Math.abs(sum)) < EPS;   }        Point centroid()   {  double cx = 0.0, cy = 0.0;  for(int i = 0; i < g.length - 1; i++)  {   double x1 = g[i].x, y1 = g[i].y;   double x2 = g[i+1].x, y2 = g[i+1].y;   double f = x1 * y2 - x2 * y1;   cx += (x1 + x2) * f;   cy += (y1 + y2) * f;  }  double area = area();   cx /= 6.0 * area;  cy /= 6.0 * area;  return new Point(cx, cy);  } }   static class LineSegment {  Point p, q;   LineSegment(Point a, Point b) { p = a; q = b; }    boolean intersect(LineSegment ls)  {  Line l1 = new Line(p, q), l2 = new Line(ls.p, ls.q);  if(l1.parallel(l2))  {   if(l1.same(l2))   return p.between(ls.p, ls.q) || q.between(ls.p, ls.q) || ls.p.between(p, q) || ls.q.between(p, q);   return false;  }  Point c = l1.intersect(l2);  return c.between(p, q) && c.between(ls.p, ls.q);  }  }   static class Rectangle {  static final double EPS = 1e-9;   Point ll, ur;  Rectangle(Point a, Point b) { ll = a; ur = b; }  double area() { return (ur.x - ll.x) * (ur.y - ll.y); }  boolean contains(Point p)  {  return p.x <= ur.x + EPS && p.x + EPS >= ll.x && p.y <= ur.y + EPS && p.y + EPS >= ll.y;  }  Rectangle intersect(Rectangle r)  {  Point ll = new Point(Math.max(this.ll.x, r.ll.x), Math.max(this.ll.y, r.ll.y));  Point ur = new Point(Math.min(this.ur.x, r.ur.x), Math.min(this.ur.y, r.ur.y));  if(Math.abs(ur.x - ll.x) > EPS && Math.abs(ur.y - ll.y) > EPS && this.contains(ll) && this.contains(ur) && r.contains(ll) && r.contains(ur))   return new Rectangle(ll, ur);  return null;  }  }  static class Line {  static final double INF = 1e9, EPS = 1e-9;   double a, b, c;   Line(Point p, Point q)  {  if(Math.abs(p.x - q.x) < EPS) { a = 1; b = 0; c = -p.x; }  else  {   a = (p.y - q.y) / (q.x - p.x);   b = 1.0;   c = -(a * p.x + p.y);  }     }   Line(Point p, double m) { a = -m; b = 1; c = -(a * p.x + p.y); }    boolean parallel(Line l) { return Math.abs(a - l.a) < EPS && Math.abs(b - l.b) < EPS; }   boolean same(Line l) { return parallel(l) && Math.abs(c - l.c) < EPS; }   Point intersect(Line l)  {  if(parallel(l))   return null;  double x = (b * l.c - c * l.b) / (a * l.b - b * l.a);  double y;  if(Math.abs(b) < EPS)   y = -l.a * x - l.c;  else   y = -a * x - c;    return new Point(x, y);  }   Point closestPoint(Point p)  {  if(Math.abs(b) < EPS) return new Point(-c, p.y);  if(Math.abs(a) < EPS) return new Point(p.x, -c);  return intersect(new Line(p, 1 / a));  }    }  public static class Vector {  double x, y;   Vector(double a, double b) { x = a; y = b; }  Vector(Point a, Point b) { this(b.x - a.x, b.y - a.y); }  Vector scale(double s) { return new Vector(x * s, y * s); }      double dot(Vector v) { return (x * v.x + y * v.y); }  double cross(Vector v) { return x * v.y - y * v.x; }  double norm2() { return x * x + y * y; }  Vector reverse() { return new Vector(-x, -y); }  Vector normalize()  {   double d = Math.sqrt(norm2());  return scale(1 / d);  }  }   static class Point implements Comparable<Point>{  static final double EPS = 1e-9;  double x, y;       Point(double a, double b) { x = a; y = b; }    public int compareTo(Point p)  {  if(Math.abs(x - p.x) > EPS) return x > p.x ? 1 : -1;  if(Math.abs(y - p.y) > EPS) return y > p.y ? 1 : -1;  return 0;  }  static double angle(Point a, Point o, Point b)  {  Vector oa = new Vector(o, a), ob = new Vector(o, b);  return Math.acos(oa.dot(ob) / Math.sqrt(oa.norm2() * ob.norm2()));  }  static boolean ccw(Point p, Point q, Point r)  {  return new Vector(p, q).cross(new Vector(p, r)) > 0;  }   public double dist(Point p) { return Math.sqrt(sq(x - p.x) + sq(y - p.y)); }   static double sq(double x) { return x * x; }   Point rotate(double angle)  {  double c = Math.cos(angle), s = Math.sin(angle);  return new Point(x * c - y * s, x * s + y * c);  }       boolean between(Point p, Point q)  {  return x < Math.max(p.x, q.x) + EPS && x + EPS > Math.min(p.x, q.x)   && y < Math.max(p.y, q.y) + EPS && y + EPS > Math.min(p.y, q.y);  }        }  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 Scanner(String file) throws FileNotFoundException {  br = new BufferedReader(new FileReader(file));  }  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 long nextlong() throws IOException {  String x = next();  StringBuilder sb = new StringBuilder("0");  long 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 Solution{  public static Integer INT(String s){  return Integer.parseInt(s); }  public static Long LONG(String s){  return Long.parseLong(s); }       public static void main(String args[])throws IOException{   BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); Scanner in=new Scanner(System.in); StringBuilder out=new StringBuilder();   long n=in.nextLong(),   k=in.nextLong();  long a=1,   b=3,   c=-2*(n+k);   long r1=(-b+(long)Math.sqrt(b*b-4*a*c))/(2*a);  long r2=(-b-(long)Math.sqrt(b*b-4*a*c))/(2*a);  System.out.println(n-Math.max(r1, r2)); } }
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) {};  }  } }
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);  } } }
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); } }
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());  } }  }
3	public class Main { public static void main(String[] args) throws Exception {  MScanner sc=new MScanner(System.in);  PrintWriter pw=new PrintWriter(System.out);  int n=sc.nextInt();HashSet<Integer>nums=new HashSet<Integer>();  int[]in=new int[n];for(int i=0;i<n;i++)in[i]=sc.nextInt();  Arrays.sort(in);  int ans=0;  boolean vis[]=new boolean[n];  for(int i=0;i<n;i++) {  if(vis[i])continue;  for(int j=i+1;j<n;j++) {   if(in[j]%in[i]==0) {   vis[j]=true;   }  }  ans++;  }  pw.println(ans);   pw.flush(); }  static class MScanner {  StringTokenizer st;  BufferedReader br;   public MScanner(InputStream system) {  br = new BufferedReader(new InputStreamReader(system));  }   public MScanner(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 Main implements Runnable {  public static void main(String[] args) {   new Thread(null, new Main(), "Check2", 1 << 28).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 k = in.nextLong();   long ans= 0;   for (long i=1;i<=Math.min(100000,n);i++){    long left = i;    long right = n-i;    long sum = left * (left + 1);    sum /= 2;    if (sum - right ==k){     ans = right;    }   }   w.println(ans);   w.close();  }  void debug(Object...args) {   System.out.println(Arrays.deepToString(args));  }  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 o){    if(this.b != o.b)return this.b - o.b;    return this.a - o.a;   }  }  long modinv(long a,long b) {   long p=power(b,mod-2,mod);   p=a%mod*p%mod;   p%=mod;   return p;  }  long power(long x,long y,long mod){   if(y==0)return 1%mod;   if(y==1)return x%mod;   long res=1;   x=x%mod;   while(y>0)   {    if((y%2)!=0){     res=(res*x)%mod;    }    y=y/2;    x=(x*x)%mod;   }   return res;  }  long gcd(long a,long b){   if(b==0)return a;   return gcd(b,a%b);  }  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 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 stock = "";    try    {     stock = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return stock;   }   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);   }  } }
6	public class F { static Scanner in = new Scanner(System.in); static PrintWriter out = new PrintWriter(System.out);  static int n,m,res=0; static int[][] a=new int[20][10005],Min=new int[20][20],Min1=new int[20][20]; static int[][][] f=new int[1<<16][20][20];  static int GetBit(int x,int k) {  return (x>>k)&1; }  static int TurnBit(int x,int k) {  return x^(1<<k); }  public static void main(String[] args)  {  n=in.nextInt();  m=in.nextInt();  for(int i=0;i<n;i++)  for(int j=1;j<=m;j++)   a[i][j]=in.nextInt();  if(n==1)  {  res=(int)1e9;  for(int i=1;i<m;i++)   res=Math.min(res,Math.abs(a[0][i]-a[0][i+1]));  out.print(res);  out.close();  return;  }  for(int i=0;i<n;i++)  for(int j=0;j<n;j++)  {   Min[i][j]=Min1[i][j]=(int)1e9;   for(int t=1;t<=m;t++)   Min[i][j]=Math.min(Min[i][j],Math.abs(a[i][t]-a[j][t]));   for(int t=1;t<m;t++)   Min1[i][j]=Math.min(Min1[i][j],Math.abs(a[i][t]-a[j][t+1]));  }  for(int i=0;i<n;i++)  f[1<<i][i][i]=(int)1e9;  for(int mask=0;mask<(1<<n);mask++)  if(Integer.bitCount(mask)>1)   for(int i=0;i<n;i++)   if(GetBit(mask,i)==1)    for(int j=0;j<n;j++)    if(i!=j&&GetBit(mask,j)==1)    {     for(int t=0;t<n;t++)     if(j!=t&&GetBit(mask,t)==1)      f[mask][i][j]=Math.max(f[mask][i][j],Math.min(f[TurnBit(mask,j)][i][t],Min[j][t]));     if(mask==(1<<n)-1)          res=Math.max(res,Math.min(f[mask][i][j],Min1[j][i]));    }  out.print(res);  out.close(); } }
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();  } }
2	public class B1195 {  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);  long x =sc.nextInt();  long y =sc.nextInt();  long m = (-3+Math.round(Math.sqrt(9+8*(x+y))))/2;  long e = x-m;  pw.println(e);  pw.flush(); }  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 boolean ready() throws IOException {  return br.ready();  }  } }
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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, Scanner in, PrintWriter out) {    int n = in.nextInt();    int[] a = new int[n];    BigInteger sum = new BigInteger("0");    for (int i = 0; i < n; ++i) {     a[i] = in.nextInt();     long tmp = ((long) (2 * i + 1 - n)) * a[i];     sum = sum.add(BigInteger.valueOf(tmp));    }    Map<Integer, Integer> cnt = new HashMap<>();    for (int i = n - 1; i >= 0; --i) {     if (cnt.containsKey(a[i] + 1)) {      sum = sum.subtract(BigInteger.valueOf(cnt.get(a[i] + 1)));     }     if (cnt.containsKey(a[i] - 1)) {      sum = sum.add(BigInteger.valueOf(cnt.get(a[i] - 1)));     }     if (cnt.containsKey(a[i])) {      cnt.put(a[i], cnt.get(a[i]) + 1);     } else {      cnt.put(a[i], 1);     }    }    out.println(sum);   }  } }
1	public class Main {  public void solve(InputProvider input, PrintWriter output) throws IOException {   int n = input.nextInt();   int d = input.nextInt();   int count = 1;   int current = input.nextInt();   for (int i = 1; i < n; i++) {    int x = input.nextInt();    if (x - current == d * 2) {     count++;    } else if (x - current > d * 2) {     count += 2;    }    current = x;   }   count++;   output.print(count);  }  public static void main(String[] args) throws Exception {   try (InputProvider input = new InputProvider(System.in);    PrintWriter output = new PrintWriter(System.out)) {    new Main().solve(input, output);   }  }  public static class InputProvider implements AutoCloseable {   private final BufferedReader reader;   private StringTokenizer tokenizer;   public InputProvider(Reader reader) {    this.reader = new BufferedReader(reader);   }   public InputProvider(InputStream input) {    reader = new BufferedReader(new InputStreamReader(input));   }   public String next() throws IOException {    if (Objects.isNull(tokenizer) || !tokenizer.hasMoreTokens())     tokenizer = new StringTokenizer(reader.readLine());    return tokenizer.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 String nextLine() throws IOException {    return reader.readLine();   }   @Override   public void close() throws Exception {    reader.close();   }  } }
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(); } }
0	public class LuckyDivison {  public static void main(String[] args)  {   Scanner in = new Scanner(System.in);   int inp = in.nextInt();   if(inp%4==0||inp%7==0||inp%47==0||inp%74==0||inp%447==0||inp%474==0||inp%477==0||inp%747==0||inp%774==0||inp%777==0)   {   System.out.println("YES");   }   else System.out.println("NO");       } }
2	public class Main implements Runnable {  private BufferedReader br;  private StringTokenizer tok;  private PrintWriter out;  static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  int[] a;  int[] b;  int[] p;  int getCeils(int id, int step) {   if (step > a[id] + b[id] - 1) {    return 0;   }   if (a[id] < b[id]) {    if (step < a[id]) {     return step;    }    if (step >= a[id] && step <= b[id]) {     return a[id];    }    ++p[id];    return a[id] - p[id];   } else {    if (step < b[id]) {     return step;    }    if (step >= b[id] && step <= a[id]) {     return b[id];    }    ++p[id];    return b[id] - p[id];   }  }  void solve() throws IOException {   int n = nextInt(), x = nextInt(), y = nextInt(), c = nextInt();   long s = 1;   int step = 0;   a = new int[4];   b = new int[4];   p = new int[4];   a[0] = x - 1; b[0] = n - y;   a[1] = x - 1; b[1] = y - 1;   a[2] = n - x; b[2] = y - 1;   a[3] = n - x; b[3] = n - y;   int xf = x + 1, xb = x - 1, yf = y + 1, yb = y - 1;   while (s < c) {    ++step;    if (xf <= n) {     ++s;     ++xf;    }    if (xb > 0) {     ++s;     --xb;    }    if (yf <= n) {     ++s;     ++yf;    }    if (yb > 0) {     ++s;     --yb;    }    if (step == 1) {     continue;    }    for (int i = 0; i < 4; ++i) {     s += getCeils(i, step - 1);    }   }   out.println(step);  }  public void run() {   try {    if (ONLINE_JUDGE) {     br = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);    } else {     br = new BufferedReader(new FileReader(new File("input.txt")));     out = new PrintWriter(new File("output.txt"));    }    solve();    br.close();    out.close();   } catch (IOException e) {    e.printStackTrace();    System.exit(1);   }  }  public static void main(String[] args) {   new Main().run();  }  String nextToken() throws IOException {   while (tok == null || !tok.hasMoreTokens())    tok = new StringTokenizer(br.readLine());   return tok.nextToken();  }  String nextString() throws IOException {   return 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());  }  BigInteger nextBigInteger() throws IOException {   return new BigInteger(nextToken());  } }
3	public class Main { public static class node implements Comparable<node> {  int l,r;  node(){}  node(int l,int r) {  this.l=l;  this.r=r;  }  @Override  public int compareTo(node rhs) {  return r-rhs.r;  } } public static void main(String[] args) throws IOException {  BufferedReader in=new BufferedReader(new InputStreamReader(System.in));  PrintWriter out=new PrintWriter(System.out);  StringTokenizer sa=new StringTokenizer(in.readLine());  int n=Integer.parseInt(sa.nextToken());  sa=new StringTokenizer(in.readLine());  int[] a=new int[n];  TreeMap<Integer,ArrayList<node>> mp=new TreeMap();  for (int i=0;i<n;++i) a[i]=Integer.parseInt(sa.nextToken());  for (int i=0;i<n;++i) {  int tmp=0;  for (int j=i;j<n;++j) {   tmp+=a[j];   if (!mp.containsKey(tmp)) {   ArrayList t=new ArrayList();   t.add(new node(i,j));   mp.put(tmp,t);   } else {   ArrayList<node> t=mp.get(tmp);   int left=0,right=t.size()-1,res=t.size();   while (left<=right) {    int mid=(left+right)>>1;    if (t.get(mid).r>=i) {    res=mid;    right=mid-1;    } else left=mid+1;   }   if (res==t.size()) t.add(new node(i,j));   else if (t.get(res).r>j) t.set(res,new node(i,j));   }  }  }  int res=0;  for (Entry<Integer,ArrayList<node>> entry:mp.entrySet())  res=Math.max(res,entry.getValue().size());  out.println(res);  for (Entry<Integer,ArrayList<node>> entry:mp.entrySet())  if (entry.getValue().size()==res) {   ArrayList<node> tmp=entry.getValue();   for (int i=0;i<tmp.size();++i)   out.printf("%d %d\n",tmp.get(i).l+1,tmp.get(i).r+1);   out.flush();   return;  } } }
0	public class JavaApplication2 {    public static void main(String[] args) {   Scanner s=new Scanner(System.in);       int n;      n=s.nextInt();      System.out.print(n+" "+"0 0");    } }
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);  } }
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 a = in.nextInt();   int b = in.nextInt();   int[] chores = new int[n];   for (int i=0; i<n; i++) chores[i] = in.nextInt();   Arrays.sort(chores);   out.println(chores[b]-chores[b-1]);  } }
2	public class ModifyLongest {  InputStream is;  PrintWriter out;  String INPUT = "";    boolean codechef=true;  void solve()  {     long mod=1000000007;   long x=nl(),k=nl();   if(x==0)   {    System.out.println(0);    return;   }   long val=calc((pow(2,k,mod)*(x%mod))%mod);   val-=calc(((pow(2,k,mod)*(x%mod))%mod-(pow(2,k,mod)-1)-1+mod)%mod);      val=(val+mod)%mod;   val=(val*inv(pow(2,k,mod),mod))%mod;   System.out.println(val);  }  static long calc(long a)  {   long b=(a*(a+1))%1000000007;   return b;  }    long PollardRho(long n)  {           if (n==1) return n;      if (n % 2 == 0) return 2;   Random r=new Random();     long x = (r.nextLong()%(n-2))+2;   long y = x;      long c = (r.nextLong()%(n-1))+1;      long d = 1;     while (d==1)   {       x = (pow(x, 2, n) + c + n)%n;        y = (pow(y, 2, n) + c + n)%n;    y = (pow(y, 2, n) + c + n)%n;        d = gcd(Math.abs(x-y), n);        if (d==n) return PollardRho(n);   }   return d;  }  static HashMap<Long,HashSet<Long>> globalSet;    static long fnc(int a,int b)  {   long val=Math.min(a,b)*1000000007;   val+=Math.max(a,b);   return val;  }   static long fnc2(long a,long b)  {   long val=a*1000000007;   val+=b;   return val;  }    static class Pair  {   int a,b;   public Pair(int a,int b)   {    this.a=a;    this.b=b;   }  }   static int bit[];   static void add(int x,int d,int n)  {   for(int i=x;i<=n;i+=i&-i)bit[i]+=d;  }   static int query(int x)  {   int ret=0;   for(int i=x;i>0;i-=i&-i)    ret+=bit[i];   return ret;  }   static long lcm(int a,int b)  {   long val=a;   val*=b;   return (val/gcd(a,b));  }   static long gcd(long a,long b)  {   if(a==0)return b;   return gcd(b%a,a);  }   static long pow(long a, long b, long p)  {   long ans = 1, base = a;   while (b!=0)   {    if ((b & 1)!=0)    {     ans *= base;     ans%= p;    }    base *= base;    base%= p;    b >>= 1;   }   return ans;  }   static long inv(long x,long p)  {   return pow(x, (int)p - 2, p);  }    void run() throws Exception  {   if(codechef)oj=true;   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 ModifyLongest().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)); } }
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;   }  } }
4	public class Solution {  public static void main(String[] args)  {   new Solution().calc();  }  void calc()  {   Scanner cin = new Scanner(System.in);   String s = cin.next();   int ret = 0;   for (int i = 0; i < s.length(); i++)   {    for (int j = i + 1; j < s.length(); j++)    {     for (int k = 0; j + k < s.length(); k++)     {      if (s.charAt(i + k) != s.charAt(j + k)) break;      ret = Math.max(k + 1, ret);     }    }   }   System.out.println(ret);  } }
3	public class Es1 {  static IO io = new IO();  public static void main(String[] args)  {  int n = io.getInt();  int[] a = new int[n];  for(int i=0; i<n; i++)  a[i] = io.getInt();   Arrays.sort(a);  int[] color = new int[n];  int num = 1;  for(int i=0; i<n; i++){  if(color[i]==0){   for(int j=i+1; j<n; j++){   if(a[j]%a[i]==0)    color[j] = num;   }   num++;  }  }   io.println(num-1);        io.close();  } }  class IO extends PrintWriter { public IO() {   super(new BufferedOutputStream(System.out));   r = new BufferedReader(new InputStreamReader(System.in));  }  public IO(String fileName) {   super(new BufferedOutputStream(System.out));   try{    r = new BufferedReader(new FileReader(fileName));   } catch (FileNotFoundException e) {    this.println("File Not Found");   }  }  public boolean hasMoreTokens() {   return peekToken() != null;  }  public int getInt() {   return Integer.parseInt(nextToken());  }  public double getDouble() {   return Double.parseDouble(nextToken());  }  public long getLong() {   return Long.parseLong(nextToken());  }  public String getWord() {   return nextToken();  }  public String getLine(){   try{    st = null;    return r.readLine();   }   catch(IOException ex){}   return null;  }   private BufferedReader r;  private String line;  private StringTokenizer st;  private String token;  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;  } }
6	public class Main2 {  static int mod = 1000000007;  static FastScanner scanner;   public static void main(String[] args) {   scanner = new FastScanner();   int n = scanner.nextInt();   int T = scanner.nextInt();   int[][] songs = new int[n][2];   for (int i = 0; i < n; i++) {    songs[i][0] = scanner.nextInt();    songs[i][1] = scanner.nextInt() - 1;   }   int[] mapping = new int[65536];   int mask = 1;   for (int k = 0; k < n; k++) {    for (int i = 1; i < mapping.length; i++) {     if ((i & mask) != 0) mapping[i] += songs[k][0];    }    mask <<= 1;   }   int[][][] dp = new int[17][65536][3];   mask = 1;   for (int i = 0; i < n; i++) {    dp[1][mask][songs[i][1]] = 1;    mask <<= 1;   }   for (int i = 1; i < n; i++) {    mask = 1;    for (int k = 0; k < n; k++) {     int cg = songs[k][1];     int g1,g2;     if (cg == 0) {g1 = 1; g2 = 2;}     else if (cg == 1) {g1 = 0; g2 = 2;}     else {g1 = 0; g2 = 1;}     for (int j = 1; j < 65536; j++) {      if ((j & mask) != 0) continue;      dp[i + 1][j | mask][cg] = (dp[i + 1][j | mask][cg] + (dp[i][j][g1] + dp[i][j][g2]) % mod) % mod;     }     mask <<= 1;    }   }   int res = 0;   for (int k = 0; k < 17; k++)   for (int i = 1; i < 65536; i++) {    if (mapping[i] == T) res = (res + dp[k][i][0] + dp[k][i][1] + dp[k][i][2]) % mod;   }   System.out.println(res);  }  static long test(long[] b, long c, int maxSkipped, int startWith) {   int skipped = 0;   long lastSkipped = b[0];   for (int i = startWith; i < b.length; i++) {    long expected = b[0] + c * (i - skipped);    if (b[i] != expected) {     skipped++;     lastSkipped = b[i];     if (skipped > maxSkipped) {      return Long.MAX_VALUE;     }    }   }   return lastSkipped;  }  static boolean test2(long[] b, long c) {   for (int i = 1; i < b.length; i++) {    long expected = b[1] + c * (i - 1);    if (b[i] != expected) {     return false;    }   }   return true;  }    static class WithIdx implements Comparable<WithIdx> {   int val;   int idx;   public WithIdx(int val, int idx) {    this.val = val;    this.idx = idx;   }   @Override   public int compareTo(WithIdx o) {    if (val == o.val) {     return Integer.compare(idx, o.idx);    }    return -Integer.compare(val, o.val);   }  }  public static class FastScanner {   BufferedReader br;   StringTokenizer st;   public FastScanner() {    br = new BufferedReader(new InputStreamReader(System.in));   }   String nextToken() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {           e.printStackTrace();     }    }    return st.nextToken();   }   String nextLine() {    try {     return br.readLine();    } catch (Exception e) {     e.printStackTrace();     throw new RuntimeException();    }   }   int nextInt() {    return Integer.parseInt(nextToken());   }   long nextLong() {    return Long.parseLong(nextToken());   }   double nextDouble() {    return Double.parseDouble(nextToken());   }   int[] nextIntArray(int n) {    int[] res = new int[n];    for (int i = 0; i < n; i++) res[i] = nextInt();    return res;   }   long[] nextLongArray(int n) {    long[] res = new long[n];    for (int i = 0; i < n; i++) res[i] = nextLong();    return res;   }   String[] nextStringArray(int n) {    String[] res = new String[n];    for (int i = 0; i < n; i++) res[i] = nextToken();    return res;   }  }  static class PrefixSums {   long[] sums;   public PrefixSums(long[] sums) {    this.sums = sums;   }   public long sum(int fromInclusive, int toExclusive) {    if (fromInclusive > toExclusive) throw new IllegalArgumentException("Wrong value");    return sums[toExclusive] - sums[fromInclusive];   }   public static PrefixSums of(int[] ar) {    long[] sums = new long[ar.length + 1];    for (int i = 1; i <= ar.length; i++) {     sums[i] = sums[i - 1] + ar[i - 1];    }    return new PrefixSums(sums);   }   public static PrefixSums of(long[] ar) {    long[] sums = new long[ar.length + 1];    for (int i = 1; i <= ar.length; i++) {     sums[i] = sums[i - 1] + ar[i - 1];    }    return new PrefixSums(sums);   }  }  static class ADUtils {   static void sort(int[] ar) {    Random rnd = ThreadLocalRandom.current();    for (int i = ar.length - 1; i > 0; i--)    {     int index = rnd.nextInt(i + 1);         int a = ar[index];     ar[index] = ar[i];     ar[i] = a;    }    Arrays.sort(ar);   }   static void reverse(int[] arr) {    int last = arr.length / 2;    for (int i = 0; i < last; i++) {     int tmp = arr[i];     arr[i] = arr[arr.length - 1 - i];     arr[arr.length - 1 - i] = tmp;    }   }   static void sort(long[] ar) {    Random rnd = ThreadLocalRandom.current();    for (int i = ar.length - 1; i > 0; i--)    {     int index = rnd.nextInt(i + 1);         long a = ar[index];     ar[index] = ar[i];     ar[i] = a;    }    Arrays.sort(ar);   }  }  static class MathUtils {   static long[] FIRST_PRIMES = {     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, 1009, 1013,     1019, 1021, 1031, 1033, 1039, 1049, 1051};   static long[] primes(int to) {    long[] all = new long[to + 1];    long[] primes = new long[to + 1];    all[1] = 1;    int primesLength = 0;    for (int i = 2; i <= to; i ++) {     if (all[i] == 0) {      primes[primesLength++] = i;      all[i] = i;     }     for (int j = 0; j < primesLength && i * primes[j] <= to && all[i] >= primes[j]; j++) {      all[(int) (i * primes[j])] = primes[j];     }    }    return Arrays.copyOf(primes, primesLength);   }   static long modpow(long b, long e, long m) {    long result = 1;    while (e > 0) {     if ((e & 1) == 1) {           result = (result * b) % m;     }     b = (b * b) % m;     e >>= 1;    }    return result;   }   static long submod(long x, long y, long m) {    return (x - y + m) % m;   }  } }
4	public class Main {  InputStream is;  PrintWriter out;  String INPUT = "";   long MAX = 100000L, MOD = 1000000007L, INF = (long) 1e18;   boolean isValid(int x, int y, int n, int m){   return x>=0 && y>=0 && x<n && y<m;  }   void solve(int TC) throws Exception {   helper hp = new helper(MOD, (int)MAX);   hp.initIO("input.txt", "output.txt");   int n = hp.nextInt(), m = hp.nextInt();   boolean[][] a = new boolean[n][m];   int k = hp.nextInt();   ArrayDeque<int[]> q = new ArrayDeque<>();   for(int i=0;i<k;i++){    int x = hp.nextInt() - 1;    int y = hp.nextInt() - 1;    a[x][y] = true;    q.add(new int[]{x,y});   }   int lastX = 0,lastY = 0;   int[] dx = new int[]{1,-1,0,0};   int[] dy = new int[]{0,0,1,-1};   while(!q.isEmpty()){    int[] X = q.pollFirst();    for(int i=0;i<4;i++){     int x = X[0] + dx[i];     int y = X[1] + dy[i];     if(isValid(x,y,n,m) && !a[x][y]){      a[x][y] = true;      lastX = x;      lastY = y;      q.add(new int[]{x,y});     }    }   }   hp.println((lastX+1) + " " + (lastY+1)); hp.flush();  }   boolean TestCases = false;  public static void main(String[] args) throws Exception { new Main().run(); }   void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}  static void dbg(Object... o){System.err.println(Arrays.deepToString(o));}   void run() throws Exception {   is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());   out = new PrintWriter(System.out);   long s = System.currentTimeMillis();   int T = TestCases ? ni() : 1;   for(int t=1;t<=T;t++) solve(t);   out.flush();   if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");  }   void p(Object o) { out.print(o); }  void pn(Object o) { out.println(o); }  void pni(Object o) { out.println(o);out.flush(); }  double PI = 3.141592653589793238462643383279502884197169399;   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();   }  }   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();   }  }   double nd() { return Double.parseDouble(ns()); }  char nc() { return (char)skip(); }   int BUF_SIZE = 1024 * 8;  byte[] inbuf = new byte[BUF_SIZE];  int lenbuf = 0, ptrbuf = 0;   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++];  }   boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }  int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }   String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b))) {    sb.appendCodePoint(b); b = readByte();   } return sb.toString();  }   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);  }   void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); } }  class helper {  final long MOD;  final int MAXN;  final Random rnd;  public helper(long mod, int maxn) {   MOD = mod;   MAXN = maxn;   rnd = new Random();  }   static final int BUFSIZE = 1 << 20;  static byte[] buf;  static int index, total;  static InputStream in;  static BufferedWriter bw;   public void initIO(InputStream is, OutputStream os) {   try {    in = is;    bw = new BufferedWriter(new OutputStreamWriter(os));    buf = new byte[BUFSIZE];   } catch (Exception e) {   }  }  public void initIO(String inputFile, String outputFile) {   try {    in = new FileInputStream(inputFile);    bw = new BufferedWriter(new OutputStreamWriter(      new FileOutputStream(outputFile)));    buf = new byte[BUFSIZE];   } catch (Exception e) {    e.printStackTrace();   }  }   private int scan() throws Exception {   if (index >= total) {    index = 0;    total = in.read(buf);    if (total <= 0)     return -1;   }   return buf[index++];  }  public String next() throws Exception {   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();  }  public int nextInt() throws Exception {   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;  }  public long nextLong() throws Exception {   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;  }   public long pow(long base, long exp, long MOD) {   base %= MOD;   long ret = 1;   while (exp > 0) {    if ((exp & 1) == 1) ret = ret * base % MOD;    base = base * base % MOD;    exp >>= 1;   }   return ret;  }   public void println(Object a) throws Exception {   bw.write(a.toString()+"\n");  }  public void print(Object a) throws Exception {   bw.write(a.toString());  }  public void flush() throws Exception {   bw.flush();  }   public static int[] sieve;  public static ArrayList<Integer> primes;   public void setSieve() {   primes = new ArrayList<>();   sieve = new int[MAXN];   int i, j;   for (i = 2; i < MAXN; ++i)    if (sieve[i] == 0) {     primes.add(i);     for (j = i; j < MAXN; j += i) {      sieve[j] = i;     }    }  } }
1	public class Solution {  static BufferedReader br=null;  static PrintWriter pw=null;  static StringTokenizer st=null;  static String FILENAME="";   void nline(){   try {    st=new StringTokenizer(br.readLine());   } catch (IOException e) {       e.printStackTrace();   }  }  int ni(){   while(st==null || !st.hasMoreTokens()) nline();   return Integer.parseInt(st.nextToken());  }  long nl(){   while(st==null || !st.hasMoreTokens()) nline();   return Long.parseLong(st.nextToken());  }  double nd(){   while(st==null || !st.hasMoreTokens()) nline();   return Double.parseDouble(st.nextToken());  }  String ns(){   while(st==null || !st.hasMoreTokens()) nline();   return st.nextToken();  }  String nstr(){   String s="";   try {    s=br.readLine();   } catch (IOException e) {       e.printStackTrace();   }   return s;  }  public void solve(){   int n = ni();   String s = nstr();   int[] a = new int[n];   for (int i=0;i<n;i++)    a[i]=s.charAt(i)=='H'?0:1;   int hc = 0;   for (int i=0;i<n;i++)    if (a[i]==0) hc++;   int min = 1000000;   for (int ss=0;ss<n;ss++) {    int rc = 0;    for (int i=0;i<hc;i++)     if (a[(i+ss)%n]==0) rc++;    if (hc-rc<min) min=hc-rc;   }   pw.print(min);  }  public void run(){   solve();   pw.close();  }  public static void main(String[] args) {    br = new BufferedReader(new InputStreamReader(System.in));    pw = new PrintWriter(System.out);     new Solution().run();  } }
2	public class P287B{ Scanner sc=new Scanner(System.in);  int INF=1<<28; double EPS=1e-9;  long n, k;  void run(){  n=sc.nextLong();  k=sc.nextLong();  solve(); }  void solve(){  long left=-1, right=k+1;  for(; right-left>1;){  long m=(left+right)/2;  long lb=k*(k+1)/2-(k-m)*(k-m+1)/2-(m-1);  if(lb>=n){   right=m;  }else{   left=m;  }  }  println(""+(right>k?-1:right)); }  void println(String s){  System.out.println(s); }  void print(String s){  System.out.print(s); }  void debug(Object... os){  System.err.println(deepToString(os)); }  public static void main(String[] args){  Locale.setDefault(Locale.US);  new P287B().run(); } }
6	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   Input in = new Input(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskE solver = new TaskE();   solver.solve(1, in, out);   out.close();  }  static class TaskE {   public void solve(int testNumber, Input in, PrintWriter out) {    try {     int kt = in.readInt();     for (int nt = 0; nt < kt; nt++) {      int n = in.readInt();      int m = in.readInt();      int[][] a = new int[m][n];      for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {        a[j][i] = in.readInt();       }      }      Arrays.sort(a, (x, y) -> {       int xMax = 0;       for (int i = 0; i < x.length; i++) {        xMax = Math.max(xMax, x[i]);       }       int yMax = 0;       for (int i = 0; i < y.length; i++) {        yMax = Math.max(yMax, y[i]);       }       return Integer.compare(-xMax, -yMax);      });      int ans = 0;      int[] s = new int[4];      for (s[0] = 0; s[0] < n; s[0]++) {       for (s[1] = 0; s[1] < n; s[1]++) {        for (s[2] = 0; s[2] < n; s[2]++) {         for (s[3] = 0; s[3] < n; s[3]++) {          int cur = 0;          for (int i = 0; i < n; i++) {           int max = 0;           for (int j = 0; j < Math.min(m, n); j++) {            max = Math.max(max, a[j][(i + s[j]) % n]);           }           cur += max;          }          ans = Math.max(cur, ans);         }        }       }      }      out.println(ans);     }    } catch (Exception e) {     throw new RuntimeException(e);    }   }  }  static class Input {   public final BufferedReader reader;   private String line = "";   private int pos = 0;   public Input(InputStream inputStream) {    reader = new BufferedReader(new InputStreamReader(inputStream));   }   private boolean isSpace(char ch) {    return ch <= 32;   }   public String readWord() throws IOException {    skip();    int start = pos;    while (pos < line.length() && !isSpace(line.charAt(pos))) {     pos++;    }    return line.substring(start, pos);   }   public int readInt() throws IOException {    return Integer.parseInt(readWord());   }   private void skip() throws IOException {    while (true) {     if (pos >= line.length()) {      line = reader.readLine();      pos = 0;     }     while (pos < line.length() && isSpace(line.charAt(pos))) {      pos++;     }     if (pos < line.length()) {      return;     }    }   }  } }
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;   }  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   TaskC.InputReader in = new TaskC.InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskC solver = new TaskC();   solver.Solve(in, out);   out.close();  }   static class TaskC {   private long mod = 1_000_000_007;   private int n;   private boolean[] s;   public void Solve(InputReader in, PrintWriter out) {    n = in.NextInt();    s = new boolean[n];    for (int i = 0; i < n; i++) {     String ss = in.Next();     s[i] = ss.charAt(0) == 'f';    }    if (s[n - 1]) {     out.println(0);     return;    }    long[] dpSum = new long[n + 1], lastDpSum = new long[n + 1];    for (int i = 0; i <= n; i++) {     lastDpSum[i] = i + 1;    }    for (int i = n - 2; i >= 0; i--) {     for (int j = 0; j <= i; j++) {      if (!s[i]) {       dpSum[j] = lastDpSum[j];      } else {       dpSum[j] = lastDpSum[j + 1] - lastDpSum[j];      }      if (j != 0) {       dpSum[j] += dpSum[j - 1];      }      dpSum[j] %= mod;      while (dpSum[j] < 0) dpSum[j] += mod;     }     long[] temp = dpSum;     dpSum = lastDpSum;     lastDpSum = temp;    }    out.println(lastDpSum[0]);   }   public static int GetMax(int[] ar) {    int max = Integer.MIN_VALUE;    for (int a : ar) {     max = Math.max(max, a);    }    return max;   }   public static int GetMin(int[] ar) {    int min = Integer.MAX_VALUE;    for (int a : ar) {     min = Math.min(min, a);    }    return min;   }   public static long GetSum(int[] ar) {    long s = 0;    for (int a : ar) s += a;    return s;   }   public static int[] GetCount(int[] ar) {    return GetCount(ar, GetMax(ar));   }   public static int[] GetCount(int[] ar, int maxValue) {    int[] dp = new int[maxValue + 1];    for (int a : ar) {     dp[a]++;    }    return dp;   }   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(), " \t\n\r\f,");      } 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 int[] NextIntArray(int n) {     return NextIntArray(n, 0);    }    public int[] NextIntArray(int n, int offset) {     int[] a = new int[n];     for (int i = 0; i < n; i++) {      a[i] = NextInt() - offset;     }     return a;    }    public int[][] NextIntMatrix(int n, int m) {     return NextIntMatrix(n, m, 0);    }    public int[][] NextIntMatrix(int n, int m, int offset) {     int[][] a = new int[n][m];     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       a[i][j] = NextInt() - offset;      }     }     return a;    }   }  } }
6	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);   G1PlaylistForPolycarpEasyVersion solver = new G1PlaylistForPolycarpEasyVersion();   solver.solve(1, in, out);   out.close();  }  static class G1PlaylistForPolycarpEasyVersion {   static ArrayList<Integer> list;   static int n;   static int req;   static int mod = (int) 1e9 + 7;   static int[] dur;   static int[] genre;   static Integer[][][] memo;   public void solve(int testNumber, Scanner sc, PrintWriter pw) {    n = sc.nextInt();    req = sc.nextInt();    dur = new int[n];    genre = new int[n];    list = new ArrayList<>();    for (int i = 0; i < n; i++) {     dur[i] = sc.nextInt();     genre[i] = sc.nextInt();    }    int ans = 0;    memo = new Integer[1 << n][n + 1][4];    for (int i = 0; i <= n; i++)     ans += bf(0, 0, 0, i) % mod;    pw.print(ans % mod);   }   private int bf(int idx, int msk, int before, int max) {    if (idx == max) {     int sum = 0;     for (int x : list)      sum += x;     if (sum == req)      return 1;     return 0;    }    if (memo[msk][max][before] != null)     return memo[msk][max][before] % mod;    int toRet = 0;    for (int i = 0; i < n; i++) {     if (genre[i] != before && (msk & 1 << i) == 0) {      list.add(dur[i]);      toRet += bf(idx + 1, msk | 1 << i, genre[i], max);      toRet %= mod;      list.remove(list.size() - 1);     }    }    return memo[msk][max][before] = (toRet % mod);   }  }  static class Scanner {   StringTokenizer st;   BufferedReader br;   public Scanner(FileReader r) {    br = new BufferedReader(r);   }   public Scanner(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }   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());   }  } }
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();   int a[] = new int[n];   for (int i = 0; i < n; i++)    a[i] = nextInt();   Arrays.sort(a);   if (a[n - 1] == 1) {    for (int i = 1; i < n; i++)     out.print("1 ");    out.print(2);    return;   }      Arrays.sort(a);   out.print(1);   for (int i = 1; i < n; i++)    out.print(" " + a[i-1]);  }  void run() {   try {    Locale.setDefault(Locale.US);    boolean oj = System.getProperty("ONLINE_JUDGE") != null;    Reader reader = oj ? new InputStreamReader(System.in)      : new FileReader("input.txt");    Writer writer = oj ? new OutputStreamWriter(System.out)      : new FileWriter("output.txt");    in = new BufferedReader(reader);    out = new PrintWriter(writer);    solve();    out.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }  public static void main(String[] args) {   new A().run();  } }
2	public class Main {  private void solve() throws IOException {  int n = nextInt();  int x = nextInt();  int y = nextInt();  int c = nextInt();   int lux = x;  int luy = y + 1;   int rux = x + 1;  int ruy = y;   int ldx = x - 1;  int ldy = y;   int rdx = x;  int rdy = y - 1;   int k = 1;  int res = 0;  while (k < c) {  lux--;  luy--;  rux--;  ruy++;  rdx++;  rdy++;  ldx++;  ldy--;  int p = 0;  p += lu(x - 1, luy, lux, y, n);  p += ru(x, ruy, rux, y + 1, n);  p += ld(x, ldy, ldx, y - 1, n);  p += rd(x + 1, rdy, rdx, y, n);  k += p;  res++;  }   println(res); }  private int lu(int x1, int y1, int x2, int y2, int n) {  if (y1 > 0 && x2 > 0) {  return x1 - x2 + 1;  } else if (y1 > 0 && x2 < 1) {  return x1;  } else if (y1 < 1 && x2 > 0) {  return y2;  } else if (x1 - (1 - y1) > 0) {  return lu(x1 - (1 - y1), 1, x2, y2, n);  } else {  return 0;  } }  private int ru(int x1, int y1, int x2, int y2, int n) {  if (y1 <= n && x2 > 0) {  return x1 - x2 + 1;  } else if (y1 <= n && x2 < 1) {  return x1;  } else if (y1 > n && x2 > 0) {  return n - y2 + 1;  } else if (x1 - (y1 - n) > 0) {  return ru(x1 - (y1 - n), n, x2, y2, n);  } else {  return 0;  } }  private int ld(int x1, int y1, int x2, int y2, int n) {  if (y1 > 0 && x2 <= n) {  return x2 - x1 + 1;  } else if (y1 > 0 && x2 > n) {  return n - x1 + 1;  } else if (y1 < 1 && x2 <= n) {  return y2;  } else if (x1 + (1 - y1) <= n) {  return ld(x1 + (1 - y1), 1, x2, y2, n);  } else {  return 0;  } }  private int rd(int x1, int y1, int x2, int y2, int n) {  if (y1 <= n && x2 <= n) {  return x2 - x1 + 1;  } else if (y1 <= n && x2 > n) {  return n - x1 + 1;  } else if (y1 > n && x2 <= n) {  return n - y2 + 1;  } else if (x1 + (y1 - n) <= n) {  return rd(x1 + (y1 - n), n, x2, y2, n);  } else {  return 0;  } }  private String next() throws IOException {  while (st == null || !st.hasMoreTokens()) {  st = new StringTokenizer(reader.readLine());  }  return st.nextToken(); }  @SuppressWarnings("unused") private int nextInt() throws IOException {  return Integer.parseInt(next()); }  @SuppressWarnings("unused") private double nextDouble() throws IOException {  return Double.parseDouble(next()); }  @SuppressWarnings("unused") private long nextLong() throws IOException {  return Long.parseLong(next()); }  @SuppressWarnings("unused") private void println(Object o) {  writer.println(o); }  @SuppressWarnings("unused") private void print(Object o) {  writer.print(o); }  private BufferedReader reader; private PrintWriter writer; private StringTokenizer st;  private void run() throws IOException {  long time = System.currentTimeMillis();  Locale.setDefault(Locale.US);  reader = new BufferedReader(new InputStreamReader(System.in));  writer = new PrintWriter(System.out);  solve();  writer.close();  System.err.println(System.currentTimeMillis() - time); }  public static void main(String[] args) throws IOException {  new Main().run(); } }
5	public class Main implements Runnable {  final String filename = "";  public void solve() throws Exception {  int n = iread();  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = iread();  Arrays.sort(a);  boolean test = true;  for (int i = 0; i < n; i++) {  if (a[i] != 1)   test = false;  int min = (i == 0) ? 1 : a[i - 1];  if (test && i == n - 1)   out.write((min + 1) + "");  else   out.write(min + "");  if (i == n - 1)   out.write("\n");  else   out.write(" ");  } }  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(null, new Main(), "1", 1 << 25).start(); } }
5	public class Main {  public static void main(String[] args) throws NumberFormatException, IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(in.readLine());   int nums[] = new int[n];  StringTokenizer tokenizer = new StringTokenizer(in.readLine(), " ");  for (int i = 0; i < n; i++) {  nums[i] = Integer.parseInt(tokenizer.nextToken());  }   Arrays.sort(nums);  int min = nums[0];  int so = -200;  for (int i = 1; i < n; i++) {  if(nums[i] != min) {   so = nums[i];   break;  }  }  if(so != -200)  System.out.println(so);  else  System.out.println("NO"); } }
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");  } }
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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   int n;   boolean[][] adj;   long[] mem;   int start;   long cycles(int cur, int visited) {    if (cur == start && visited > 0) {     return Integer.bitCount(visited) >= 3 ? 1 : 0;    }    int index = visited * n + cur;    if (mem[index] != -1) return mem[index];    long res = 0;    int newvisited = visited | (1 << cur);    for (int nxt = 0; nxt < n; nxt++)     if (adj[cur][nxt]) {      if (nxt >= start && (nxt == start || ((visited >> nxt) & 1) == 0)) {       res += cycles(nxt, newvisited);      }     }    return mem[index] = res;   }   public void solve(int testNumber, InputReader in, OutputWriter out) {    n = in.readInt();    int m = in.readInt();    mem = new long[n * (1 << n)];    adj = new boolean[n][n];    for (int i = 0; i < m; i++) {     int a = in.readInt() - 1, b = in.readInt() - 1;     adj[a][b] = true;     adj[b][a] = true;    }    long res = 0;    for (int start = 0; start < n; start++) {     Arrays.fill(mem, -1);     this.start = start;     res += cycles(start, 0) / 2;    }    out.printLine(res);   }  }  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 close() {    writer.close();   }   public void printLine(long 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 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);   }  } }
2	public class B {  public static void main(String[] args) {  PrintWriter out = new PrintWriter(System.out);  Scanner sc = new Scanner(System.in);  long N = sc.nextLong();  long K = sc.nextLong();  if (N == 1) {  out.println(0);  } else if (N <= K) {  out.println(1);  } else if (N > ((K - 1) * (K)) / 2 + 1) {  out.println(-1);  } else {   long lo = 1;  long hi = Math.max(K - 2, 1);   long big = ((K - 2) * (K - 1)) / 2;   long prevmid = -1;   for (int i = 0; i < 10000; i++) {   long mid = (lo + hi) / 2;              long tmp = ((K - 2 - mid) * (K - 2 - mid + 1)) / 2;      if (K + big - tmp > N) {   hi = mid;   } else if (K + big - tmp < N) {   lo = mid;   if (prevmid == mid)    lo++;   lo = Math.min(lo, hi);   prevmid = mid;   } else {   lo = mid;   break;   }  }  out.println((long) lo + 1);  }  sc.close();  out.close(); } }
3	public class Main {  public static void main(String[] args) throws Exception {   new Main().go();  }  PrintWriter out;  Reader in;  BufferedReader br;  Main() throws IOException {   try {           in = new Reader("input.txt");    out = new PrintWriter( new BufferedWriter(new FileWriter("output.txt")) );   }   catch (Exception e) {        in = new Reader();    out = new PrintWriter( new BufferedWriter(new OutputStreamWriter(System.out)) );   }  }  void go() throws Exception {      int t = 1;   while (t > 0) {    solve();    t--;   }   out.flush();   out.close();  }   int inf = 2000000000;  int mod = 1000000007;  double eps = 0.000000001;  int n;  int m;  ArrayList<Integer>[] g;  int[] a;  void solve() throws IOException {   int n = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = in.nextInt();   HashMap<Integer, ArrayList<Pair>> segs = new HashMap<>();   for (int i = 0; i < n; i++) {    int sum = 0;    for (int j = i; j < n; j++) {     sum += a[j];     if (!segs.containsKey(sum))      segs.put(sum, new ArrayList<>());     segs.get(sum).add(new Pair(i, j));    }   }   int max = 0;   ArrayList<Pair> ans = new ArrayList<>();   for (Integer k : segs.keySet()) {    ArrayList<Pair> list = segs.get(k);    ArrayList<Pair> blocks = new ArrayList<>();    Collections.reverse(list);    int prev = inf;    for (Pair p : list) {     int l = p.a;     int r = p.b;     if (r < prev) {      blocks.add(p);      prev = l;     }    }    if (blocks.size() > max) {     ans = blocks;     max = blocks.size();    }   }   out.println(ans.size());   for (Pair p : ans)    out.println((p.a+1)+" "+(p.b+1));  }   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 Integer.compare(a, p.a);    else     return Integer.compare(b, p.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 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();   }  }  static class InputReader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;   public InputReader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public InputReader(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();   }  } }
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;  }  }   }
5	public class Main {  class team implements Comparable<team>{   int pro,time;   public int compareTo(team oth) {    if(pro>oth.pro)     return -1;    if(pro==oth.pro&&time<oth.time)     return -1;       return 1;   }    }  Scanner scan=new Scanner(System.in);  void run(){   int n=scan.nextInt();   int k=scan.nextInt()-1;   team tm[]=new team[n];   for(int i=0;i<n;i++){    tm[i]=new team();    tm[i].pro=scan.nextInt();    tm[i].time=scan.nextInt();   }   Arrays.sort(tm);   int sum=0;     for(int i=k;i>=0;i--)    if(tm[i].pro==tm[k].pro&&tm[i].time==tm[k].time)     sum++;   for(int i=k;i<n;i++)    if(tm[i].pro==tm[k].pro&&tm[i].time==tm[k].time)     sum++;   System.out.println(sum-1);  }  public static void main(String args[]) {      new Main().run();  } }
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(); } }
3	public class A {  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());   StringTokenizer st = new StringTokenizer(bf.readLine());   int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());   int counter = 0;   TreeSet<Integer> val = new TreeSet<Integer>();   for(int i : a) val.add(i);   while(!val.isEmpty()) {   int min = val.first();   Set<Integer> toRemove = new HashSet<Integer>();   for(int i : val) if(i % min == 0) toRemove.add(i);   for(int i : toRemove) val.remove(i);   counter++;   }   out.println(counter);      out.close(); System.exit(0);  } }
4	public class A {  private static final int INF = (int) 1e9 + 7;  public static void main(String[] args) {   FastScanner fs=new FastScanner();   PrintWriter pr = new PrintWriter(System.out);     int n = fs.nextInt(), m = fs.nextInt(), k = fs.nextInt();    int[][] right = new int[n][m -1], down = new int[n - 1][m];    for(int i = 0; i < n; i++) right[i] = fs.readArray(m - 1);    for(int i = 0; i < n - 1; i++) down[i] = fs.readArray(m);    if (k % 2 == 1) {     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) pr.print(-1 + " ");      pr.println();     }    } else {     int[][][] dp = new int[k / 2 + 1][n][m];     for(int r = 1; 2 * r <= k; r++) {      for(int i = 0; i < n; i++) Arrays.fill(dp[r][i], INF);      for(int i = 0; i < n; i++)       for(int j = 0; j + 1 < m; j++) {        int cost = right[i][j];        dp[r][i][j] = Integer.min(dp[r][i][j], dp[r - 1][i][j + 1] + cost);        dp[r][i][j + 1] = Integer.min(dp[r][i][j + 1], dp[r - 1][i][j] + cost);       }      for(int i = 0; i + 1 < n; i++)       for(int j = 0; j < m; j++) {        int cost = down[i][j];        dp[r][i][j] = Integer.min(dp[r][i][j], dp[r - 1][i + 1][j] + cost);        dp[r][i + 1][j] = Integer.min(dp[r][i + 1][j], dp[r - 1][i][j] + cost);       }     }     for(int i = 0; i < n; i++) {      for(int j = 0; j < m; j++) {       pr.print(2 * dp[k/2][i][j] + " ");      }      pr.println();     }    }     pr.flush();   pr.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[] readLongArray(int n) {    long[] a=new long[n];    for (int i=0; i<n; i++) a[i]=nextLong();    return a;   }   long nextLong() {    return Long.parseLong(next());   }  } }
0	public class LuckyDivision { public static void main (String[] args) {  Scanner read = new Scanner(System.in);  int n = read.nextInt();   if (n % 4 == 0 ||  n % 7 == 0 ||  n % 47 == 0 ||  n % 74 == 0 ||  n % 447 == 0 ||  n % 474 == 0 ||  n % 477 == 0 ||  n % 744 == 0 ||  n % 747 == 0 ||  n % 774 == 0) {   System.out.println("YES");  }  else {   System.out.println("NO");  }   } }
5	public class VKRound2Div2Task1 {   public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String str = br.readLine();  String[] strs = str.split(" ");  int n = Integer.parseInt(strs[0]);  int a = Integer.parseInt(strs[1]);  int b = Integer.parseInt(strs[2]);  str = br.readLine();  String[] hs = str.split(" ");  int[] h = new int[hs.length];  for(int i=0;i<hs.length;i++){  h[i] = Integer.parseInt(hs[i]);  }  Arrays.sort(h);  if(h[b-1]==h[b]){  System.out.println(0);  }else{  System.out.println(h[b]-h[b-1]);  }   } }
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)); }  }
5	public class Train_A {  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 [] h = new int[n];   for (int i = 0; i < n; i++) {    h[i] = sc.nextInt();   }   Arrays.sort(h);   System.out.println(h[n-a] - h[b-1]);  } }
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();}  } }
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)); } }
4	public class C { String line; StringTokenizer inputParser; BufferedReader is; FileInputStream fstream; DataInputStream in;  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);  }   }  int NextInt() {  String n = inputParser.nextToken();  int val = Integer.parseInt(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];  C c = new C(filePath); }  public C(String inputFile) {  inputFile="input.txt";   openInput(inputFile);   PrintWriter writer=null;  try {  writer = new PrintWriter("output.txt");    } catch (FileNotFoundException e) {  e.printStackTrace();  }   readNextLine();  int N=NextInt();  int M=NextInt();  readNextLine();  int K=NextInt();  readNextLine();  int [] [] p = new int[N][M];  int [] [] init = new int [K][2];   for(int i=0; i<K; i++)  {  int x=NextInt()-1;  int y=NextInt()-1;  p[x][y]=0;  init[i][0]=x;  init[i][1]=y;  }   int max=-1;  int maxX=-1, maxY=-1;   for(int i=0; i<N; i++)  for(int j=0; j<M; j++)  {   p[i][j]=10000;   for(int k=0; k<K; k++)   {   int n=Math.abs(init[k][0]-i)+Math.abs(init[k][1]-j);   if(n<p[i][j])p[i][j]=n;   }   if(p[i][j]>max)   {   max=p[i][j];   maxX=i+1;   maxY=j+1;   }  }      writer.println( maxX+" "+maxY);       closeInput();  writer.close(); }  }
5	public class Main {  public static void main(String[] args) {   Scanner r = new Scanner(System.in);   int N = r.nextInt();   int K = r.nextInt() - 1;     T[] a = new T[N];   for(int i = 0; i < N; i++)    a[i] = new T(r.nextInt(), r.nextInt());     Arrays.sort(a, new Comparator<T>() {    @Override    public int compare(T x, T y) {     if(x.p > y.p)return -1;     else if(x.p == y.p){      if(x.t < y.t)return -1;      else if(x.t == y.t)return 0;      else return 1;     }else return 1;    }   });     int ret = 0;   for(int i = 0; i < N; i++)    if(a[i].p == a[K].p && a[i].t == a[K].t)ret++;     System.out.println(ret);  } } class T{  int p, t;  public T(int pi, int ti){   p = pi;   t = ti;  } }
3	public class P1141F {  static BufferedReader br; static BufferedWriter bw; static StringTokenizer st;  public static void main(String[] args) throws IOException {  br = new BufferedReader(new InputStreamReader(System.in));  bw = new BufferedWriter(new OutputStreamWriter(System.out));  int n = Integer.parseInt(br.readLine());  int[] a = new int[n];  int[][] b = new int[n][n];  HashMap<Integer, ArrayList<Integer>> map = new HashMap<Integer, ArrayList<Integer>>();   st = new StringTokenizer(br.readLine());  for(int i = 0; i < n; ++i) {  a[i] = Integer.parseInt(st.nextToken());    int r = i;  b[r][r] = a[r];  if (!map.containsKey(b[r][r]))   map.put(b[r][r], new ArrayList<Integer>());  for(int l = 0; l < r; ++l) {   b[l][r] = b[l][r-1] + a[r];   if (!map.containsKey(b[l][r]))   map.put(b[l][r], new ArrayList<Integer>());  }  }    for(int r = 0; r < n; ++r) {  for(int l = 0; l <= r; ++l) {   int sum = b[l][r];   ArrayList<Integer> intervals = map.get(sum);   int last_r = -1;   if(!intervals.isEmpty())   last_r = intervals.get(intervals.size()-1);     if(l > last_r) {   intervals.add(l);   intervals.add(r);   }     }  }     ArrayList<Integer> best_intervals = new ArrayList<Integer>();   for(Map.Entry<Integer, ArrayList<Integer>> entry : map.entrySet()) {    ArrayList<Integer> intervals = entry.getValue();    if(intervals.size() > best_intervals.size()) {   best_intervals = intervals;  }  }   bw.write(best_intervals.size()/2 + "\n");  for(int i = 0; i < best_intervals.size(); i += 2) {  bw.write((best_intervals.get(i)+1) + " " + (best_intervals.get(i+1)+1) + "\n");  }   br.close();  bw.close(); } }
5	public class C111A{  static BufferedReader br;  public static void main(String args[])throws Exception{   br=new BufferedReader(new InputStreamReader(System.in));   int n = toInt();   int nm[] = toIntArray();   double a=0.0;   double sum=0;   for(int i=0;i<n;i++){    sum+=nm[i];   }   a=sum/2;   Arrays.sort(nm);   int cur=0;   int count=0;   for(int i=nm.length-1;i>=0;i--){    cur+=nm[i];    count++;    if(cur>a){     break;    }   }   System.out.println(count);   }    public static int[] toIntArray()throws Exception{   String str[]=br.readLine().split(" ");   int k[]=new int[str.length];   for(int i=0;i<str.length;i++){    k[i]=Integer.parseInt(str[i]);   }   return k;  }  public static int toInt()throws Exception{   return Integer.parseInt(br.readLine());  }  public static long[] toLongArray()throws Exception{   String str[]=br.readLine().split(" ");   long k[]=new long[str.length];   for(int i=0;i<str.length;i++){    k[i]=Long.parseLong(str[i]);   }   return k;  }  public static long toLong()throws Exception{   return Long.parseLong(br.readLine());  }  public static double[] toDoubleArray()throws Exception{   String str[]=br.readLine().split(" ");   double k[]=new double[str.length];   for(int i=0;i<str.length;i++){    k[i]=Double.parseDouble(str[i]);   }   return k;  }  public static double toDouble()throws Exception{   return Double.parseDouble(br.readLine());  }  public static String toStr()throws Exception{   return br.readLine();  }  public static String[] toStrArray()throws Exception{   String str[]=br.readLine().split(" ");   return str;  }   }
1	public class Main {  final boolean ONLINE_JUDGE = !new File("input.txt").exists();  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 Main().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);   }  }  class LOL implements Comparable<LOL> {   int x;   int y;    public LOL(int x, int y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(LOL o) {    if (o.x != x)     return (int) (o.x - x);    return (int) (y - o.y);   }  }  long modulo = 1000 * 1000 * 1000 + 7;  long binPow (long a, long b) {   if(b == 0) return 1;   long c = binPow(a, b / 2);   long ans = (c * c) % modulo;   if(b % 2 == 1) ans = (ans * a) % modulo;   return ans;  }   int[] gcd (int a, int b) {   int[] res = new int[3];   if (a == 0) {    res[0] = b; res[1] = 0; res[2] = -1;    return res;   }   res = gcd (b%a, a);   int x = -(res[2] + (b / a) * res[1]);   int y = - res[1];   res[1] = x;   res[2] = y;   return res;  }   public void solve() throws IOException {   int n = readInt();   HashMap<Character,Integer> mapa = new HashMap<>();   char[] s = readString().toCharArray();   for(int i = 0; i < n; i++) {    if(mapa.containsKey(s[i])) {     int x = mapa.get(s[i]);     mapa.replace(s[i], x + 1);    }    else mapa.put(s[i], 1);   }   int sz = mapa.size();   mapa = new HashMap<>();   int i = 0;   while (mapa.size() < sz) {    if(mapa.containsKey(s[i])) {     int x = mapa.get(s[i]);     mapa.replace(s[i], x + 1);    }    else mapa.put(s[i], 1);    i++;   }   int ans = i;   int left = 0;   int right = i - 1;   while(right < n) {    while(left < right) {     int y = mapa.get(s[left]);     if(y == 1) mapa.remove(s[left]);     else mapa.replace(s[left], y - 1);     if(mapa.size() == sz) {      ans = Math.min(ans, right - left);      left++;     }     else {      left++;      break;     }    }    right++;    if(right < n) {     if (mapa.containsKey(s[right])) {      int x = mapa.get(s[right]);      mapa.replace(s[right], x + 1);     } else mapa.put(s[right], 1);    }   }   out.print(ans);  } }
3	public class Mainm {  static int mod1 = (int) (1e9 + 7);  static class Reader {   final private int BUFFER_SIZE = 1 << 16;   Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));   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 nextString() throws IOException {    String str00 = scan.next();    return str00;   }   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);   }   String next() throws IOException {    int c;    for (c = read(); c <= 32; c = read());    StringBuilder sb = new StringBuilder();    for (; c > 32; c = read()) {     sb.append((char) c);    }    return sb.toString();   }   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 int[] nextArray(int n) throws IOException {    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = nextInt();    }    return a;   }  }   static int GCD(int a, int b)  {   if (b == 0)    return a;   return GCD(b, a % b);  }   static long power(long x, long y, long p)  {   int res = 1;     return res;  }   static boolean primeCheck(long num0) {   boolean b1 = true;   if (num0 == 1) {    b1 = false;   } else {    int num01 = (int) (Math.sqrt(num0)) + 1;    me1:    for (int i = 2; i < num01; i++) {     if (num0 % i == 0) {      b1 = false;      break me1;     }    }   }   return b1;  }  public static int dev(long num1)  {   int count00=0;   while (num1%2==0)   {    count00++;    num1/=2;   }   HashMap<Long,Long> hashMap=new HashMap<>();   if(count00!=0)   {    hashMap.put(2L,(long)count00);   }   for (int i = 3; i <= (int)Math.sqrt(num1); i = i + 2)   {       if(num1%i==0) {     int count01 = 0;     while (num1 % i == 0) {      num1 /= i;      count01++;     }     hashMap.put((long)i,(long)count01);    }   }   if(num1>2)   {    hashMap.put((long)num1,1L);   }   long numOfDiv=1;   for(long num00:hashMap.keySet())   {    long cDiv0=hashMap.get(num00);    numOfDiv*=(cDiv0+1);   }   return (int)(numOfDiv);  }   public static long solve(long[] arr1, long N)  {   int n=(int)N;   HashMap<Long,Integer> hm=new HashMap<>();   for(int i=0;i<n;i++)   {    if(hm.containsKey(arr1[i]))    {    }    else    {     hm.put(arr1[i],1);    }   }   long count1=0;   for(int i=0;i<n;i++)   {    long num1=arr1[i]*arr1[i];    if(hm.containsKey(num1))    {     count1+=hm.get(num1);     if(arr1[i]==1)     {      count1--;     }    }   }   return count1;  }    public static void main(String[] args) throws IOException {   Reader r = new Reader();          OutputWriter770 out77 = new OutputWriter770(System.out);   int num1=r.nextInt();   int[] arr1=r.nextArray(num1);   Arrays.sort(arr1);   int res1=0;   for(int i=0;i<num1;i++)   {    if(arr1[i]!=-1)    {     res1++;     int num2=arr1[i];     arr1[i]=-1;     for(int j=i+1;j<num1;j++)     {      if(arr1[j]%num2==0)      {       arr1[j]=-1;      }     }    }   }   out77.print(res1+"");   r.close();   out77.close();  } }   class OutputWriter770 {  BufferedWriter writer;  public OutputWriter770(OutputStream stream)  {   writer = new BufferedWriter(new OutputStreamWriter(stream));  }  public void print(int i) throws IOException  {   writer.write(i + "");  }  public void println(int i) throws IOException  {   writer.write(i + "\n");  }  public void print(String s) throws IOException  {   writer.write(s + "");  }  public void println(String s) throws IOException  {   writer.write(s + "\n");  }  public void print(char[] c) throws IOException  {   writer.write(c);  }  public void close() throws IOException  {   writer.flush();   writer.close();  } } class node {  int source,dest;  long difDist;  node(int source,int dest,long tDst, long hDst)  {   this.source=source;   this.dest=dest;   this.difDist=hDst-tDst;  } }
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; } }
3	public class MyClass {  static class Pair implements Comparable<Pair>{   int x,y;   Pair(int x,int y){    this.x=x; this.y=y;   }   public int compareTo(Pair p){    return Integer.compare(this.y,p.y);   }  }  public static void main(String args[]) {  Scanner in =new Scanner(System.in);  HashMap<Long,ArrayList<Pair>> hm=new HashMap<Long,ArrayList<Pair>>();  int n=in.nextInt();  int a[]=new int[n];  long sum[]=new long[n];  long s=0;  for(int i=0;i<n;i++){ a[i]=in.nextInt(); s+=a[i]; sum[i]=s; }  for(int i=0;i<n;i++){   for(int j=i;j<n;j++){    long x=sum[j]-sum[i]+a[i];    ArrayList<Pair> temp=new ArrayList<Pair>();    if(hm.containsKey(x)) { temp=hm.get(x); }    temp.add(new Pair(i+1,j+1));    hm.put(x,temp);   }  }  ArrayList<Pair> ans=new ArrayList<Pair>();  for(Map.Entry em:hm.entrySet()){   ArrayList<Pair> array=hm.get(em.getKey());   Collections.sort(array);   int prev=0;   ArrayList<Pair> temp=new ArrayList<Pair>();   for(int i=0;i<array.size();i++){    if(array.get(i).x>prev){ temp.add(new Pair(array.get(i).x,array.get(i).y)); prev=array.get(i).y; }   }      if(temp.size()>ans.size()){    ans=(ArrayList<Pair>)temp.clone();   }  }  long g=-5;  System.out.println(ans.size());   for(int i=0;i<ans.size();i++){   System.out.println(ans.get(i).x+" "+ans.get(i).y);  }  } }
5	public class Solution {    private static StringTokenizer st;  private static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  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 {   initTokenizer();   int n = nextInt();   int a = nextInt();   int b = nextInt();   int[] h = new int[n];   initTokenizer();   for (int i = 0; i < n; i++) {    h[i] = nextInt();   }   Arrays.sort(h);   System.out.print(h[b] - h[b - 1]);  } }
1	public class Main{  public static void main(String[] args) {  Scanner in=new Scanner(new BufferedInputStream(System.in)); int n=in.nextInt(); char b[]=in.next().toCharArray(); int bb[]=new int [b.length];  int Mark[]=new int [26*2+1]; int Mark1[]=new int [26*2+1];  int ans=0; for(int i=0;i<b.length;i++){  char f=b[i];  int a;  if(f>='a'&&f<='z')  a=f-'a';  else a=f-'A'+26;  bb[i]=a;  if(Mark1[a] == 0){  ans++;  Mark1[a]=1;}  }  int i;   int L = 0 ,nowsum = 0 ,Ans = n,R = 0;    for(i = 0 ;i < n ;i ++)  {   if(Mark[bb[i]]==0) nowsum ++;    Mark[bb[i]] ++;    if(nowsum == ans)    {    R = i;    break;    }     }   Ans = R - L + 1;   for(i = L ;i < n ;i ++)  {     if((--Mark[bb[i]])==0)   {    int ok = 0;    for(int j = R + 1 ;j < n ;j ++)    {            Mark[bb[j]] ++;     if(bb[j] == bb[i])     {      ok = 1;      R = j;      break;     }        }    if(ok==0) break;   }   if(Ans > R - i) Ans = R - i;  }   System.out.println(Ans);    } }
3	public class Solution {  public static void main(String[] args) {   FastReader in = new FastReader();   int n = in.nextInt();   int[] a = new int[101];   for (int i = 0; i < n; i++) {    a[in.nextInt()]++;   }   int count = 0;   for (int i = 1; i < 101; i++) {    if (a[i] > 0) {     count++;     for (int j = i; j < 101; j += i) {      a[j] = 0;     }    }   }   System.out.println(count);  }  static class FastReader {   BufferedReader br;   StringTokenizer st;   public FastReader() {    br = new BufferedReader(new      InputStreamReader(System.in));   }   public int[] nextIntArray(int n) {    int[] array = new int[n];    for (int i = 0; i < n; ++i) array[i] = nextInt();    return array;   }   public int[] nextSortedIntArray(int n) {    int array[] = nextIntArray(n);    Arrays.sort(array);    return array;   }   public int[] nextSumIntArray(int n) {    int[] array = new int[n];    array[0] = nextInt();    for (int i = 1; i < n; ++i) array[i] = array[i - 1] + nextInt();    return array;   }   public long[] nextLongArray(int n) {    long[] array = new long[n];    for (int i = 0; i < n; ++i) array[i] = nextLong();    return array;   }   public long[] nextSumLongArray(int n) {    long[] array = new long[n];    array[0] = nextInt();    for (int i = 1; i < n; ++i) array[i] = array[i - 1] + nextInt();    return array;   }   public long[] nextSortedLongArray(int n) {    long array[] = nextLongArray(n);    Arrays.sort(array);    return array;   }   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 P35C { public static void main(String[] args) throws FileNotFoundException {  InputStream inputStream = new FileInputStream("input.txt");  OutputStream outputStream = new FileOutputStream("output.txt");  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  Task solver = new Task();  solver.solve(in, out);  out.close(); }  static class Task {  private class Point {  int x, y;   public Point(int x, int y) {   this.x = x;   this.y = y;  }  }  private int dis(int i, int j, Point p2) {  return Math.abs(i - p2.x) + Math.abs(j - p2.y);  }  public void solve(InputReader in, PrintWriter out) {  int n = in.nextInt(), m = in.nextInt();  int k = in.nextInt();  Point[] ps = new Point[k];  for (int i = 0; i < k; i++) {   ps[i] = new Point(in.nextInt() - 1, in.nextInt() - 1);  }  int max = 0;  Point argmax = ps[0];  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   int val = dis(i, j, ps[0]);   for (int l = 1; l < k; l++) {    val = Math.min(val, dis(i, j, ps[l]));   }   if (val > max) {    max = val;    argmax = new Point(i, j);   }   }  }  out.println((argmax.x + 1) + " " + (argmax.y + 1));  } }  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 String nextLine() {  try {   return reader.readLine();  } catch (IOException e) {   throw new RuntimeException(e);  }  }  } }
5	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[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = sc.nextInt();  Arrays.sort(a);  int i = 0;  while (i < n && a[i] == a[0])  i++;  if (i < n)  System.out.println(a[i]);  else  System.out.println("NO");  sc.close(); }  }
1	public class hackerearth {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);   int n=sc.nextInt();   HashMap<String,Integer> map=new HashMap<>();   HashMap<String,Integer> map2=new HashMap<>();   for(int i=0;i<n;i++)   {    String s=sc.next();    if(map.containsKey(s))     map.put(s,map.get(s)+1);    else     map.put(s,1);   }   for(int i=0;i<n;i++)   {    String s=sc.next();    if(map2.containsKey(s))     map2.put(s,map2.get(s)+1);    else     map2.put(s,1);    if(map.containsKey(s)) {     int feq = map.get(s);     feq--;     if (feq <= 0)      map.remove(s);     else      map.put(s, feq);    }   }    int ans=0;   for(Map.Entry<String,Integer> entry:map.entrySet())   {    ans+=entry.getValue();   }   System.out.println(ans);   }  }
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()); } }
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 {  static final long MOD = 1_000_000_007, INF = 1_000_000_000_000_000_000L;  static final int INf = 1_000_000_000;  static FastReader reader;  static PrintWriter writer;  public static void main(String[] args) {   Thread t = new Thread(null, new O(), "Integer.MAX_VALUE", 100000000);   t.start();  }  static class O implements Runnable {   public void run() {    try {     magic();    }    catch (Exception e) {     e.printStackTrace();     System.exit(1);    }   }  }  static class FastReader {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;   public FastReader() {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public FastReader(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[1000000];    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 int n,m,pre[][], pre_stop_and_start[][],mat[][], dp[][][];  static void magic() throws IOException {   reader = new FastReader();   writer = new PrintWriter(System.out, true);   n = reader.nextInt();   m = reader.nextInt();   mat = new int[n][m];   for(int i=0;i<n;++i) {    for(int j=0;j<m;++j) {     mat[i][j] = reader.nextInt();    }   }   if(n==1) {    int ans = Integer.MAX_VALUE;    for(int i=0;i+1<m;++i) {     ans = min(ans, abs(mat[0][i] - mat[0][i+1]));    }    writer.println(ans);    System.exit(0);   }   pre = new int[n][n];   pre_stop_and_start = new int[n][n];   for(int i=0;i<n;++i) {    for(int j=i+1;j<n;++j) {     int min = Integer.MAX_VALUE;     for(int k=0;k<m;++k) {      min = min(min, abs(mat[i][k] - mat[j][k]));     }     pre[i][j] = pre[j][i] = min;    }   }   for(int i=0;i<n;++i) {    for(int j=0;j<n;++j) {     if(j==i) {      continue;     }     int min = Integer.MAX_VALUE;     for(int k=0;k+1<m;++k) {      min = min(min, abs(mat[j][k+1] - mat[i][k]));     }     pre_stop_and_start[i][j] = min;    }   }           dp = new int[1<<n][n][n];   for(int i=0;i<(1<<n);++i) {    for(int j=0;j<n;++j) {     for(int k=0;k<n;++k) {      dp[i][j][k] = -1;     }    }   }   int ans = 0;   for(int i=0;i<n;++i) {    ans = max(ans, f((1<<i), i, i));   }   writer.println(ans);  }  static int f(int mask_already, int prev, int first) {   if(mask_already==(1<<n) - 1) {    return pre_stop_and_start[prev][first];   }   if(dp[mask_already][prev][first] != -1) {    return dp[mask_already][prev][first];   }   int max = 0;   for(int i=0;i<n;++i) {    if((mask_already&(1<<i)) == 0) {     max = max(max, min(pre[prev][i], f(mask_already|(1<<i), i, first)));    }   }   return dp[mask_already][prev][first] = max;  } }
4	public class Main {  public static void deal(int n,int m,int k,int[][] d1,int[][] d2) {   if(k % 2 == 1) {    for(int i=0;i<n;i++) {     for(int j=0;j<m;j++) {      System.out.print("-1 ");     }     System.out.println();    }    return;   }   int[][][] dp = new int[k/2+1][n][m];   for(int i=0;i<k/2;i++) {    for(int j=0;j<n;j++) {     for(int l=0;l<m;l++) {      int min = Integer.MAX_VALUE;      if(j>0) min = Math.min(min,d2[j-1][l]+dp[i][j-1][l]);      if(j<n-1) min = Math.min(min,d2[j][l]+dp[i][j+1][l]);      if(l>0) min = Math.min(min,d1[j][l-1]+dp[i][j][l-1]);      if(l<m-1) min = Math.min(min,d1[j][l]+dp[i][j][l+1]);      dp[i+1][j][l] = min;     }    }   }   for(int i=0;i<n;i++) {    for(int j=0;j<m;j++) {     System.out.print(dp[k/2][i][j]*2);     System.out.print(" ");    }    System.out.println();   }  }  public static void main(String[] args) {   MyScanner scanner = new MyScanner();   int n = scanner.nextInt();   int m = scanner.nextInt();   int k = scanner.nextInt();   int[][] d1 = new int[n][m-1];   int[][] d2 = new int[n-1][m];   for(int i=0;i<n;i++) {    for(int j=0;j<m-1;j++) {     d1[i][j] = scanner.nextInt();    }   }   for(int i=0;i<n-1;i++) {    for(int j=0;j<m;j++) {     d2[i][j] = scanner.nextInt();    }   }   deal(n,m,k,d1,d2);  }   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 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;   } }
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();  }  static class TaskB {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int numTests = in.nextInt();    for (int test = 0; test < numTests; test++) {     int n = in.nextInt();     boolean can = false;     if (n % 2 == 0 && isSquare(n / 2)) {      can = true;     }     if (n % 4 == 0 && isSquare(n / 4)) {      can = true;     }     out.println(can ? "YES" : "NO");    }   }   private boolean isSquare(int n) {    int x = (int) Math.sqrt(n);    while (x * x > n) {     --x;    }    while (x * x < n) {     ++x;    }    return x * x == n;   }  }  static 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 {      st = new StringTokenizer(in.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }  } }
1	public class B {  public static void main (String[] args) throws IOException {   BufferedReader b = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(b.readLine());   while (n-- > 0) {    String s = b.readLine();    if (s.matches("^[A-Z]+[0-9]+$")) {     System.out.println(toRC(decodeCR(s)));    } else {     System.out.println(toCR(decodeRC(s)));    }   }  }  private static String toRC(int[] a) {   return "R" + a[0] + "C" + a[1];  }  private static String toCR(int[] a) {   String r = "";   if (a[1] == 1) {    r = "A";   } else {    for (int x = a[1]; x > 0; x /= 26) {     r = (char)('A' + (x - 1) % 26) + r;     if (x % 26 == 0) x -= 26;    }   }   return r + a[0];  }  private static int[] decodeCR(String s) {   int[] a = new int[2];   int i = 0;   while (s.charAt(i) >= 'A') {    a[1] = a[1] * 26 + (s.charAt(i) - 'A' + 1);    i++;   }   a[0] = Integer.parseInt(s.substring(i));     return a;  }  private static int[] decodeRC(String s) {   assert s.charAt(0) == 'R';   int[] a = new int[2];   a[0] = Integer.parseInt(s.substring(1, s.indexOf('C')));   a[1] = Integer.parseInt(s.substring(s.indexOf('C') + 1));     return a;  } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int N = in.nextInt();    String word = in.next();    int cnt[] = new int[1000];    int let = 0;    Set<Character> set = new TreeSet<>();    for (int i = 0; i < word.length(); i++) {     set.add(word.charAt(i));    }    int uniq = set.size();    int i = 0, j = -1;    int ans = Integer.MAX_VALUE;    while (i < N && j < N) {     while (j + 1 < N && let < uniq) {      j++;      if (cnt[word.charAt(j)] == 0) {       let++;      }      cnt[word.charAt(j)]++;     }     if (let == uniq)      ans = Math.min(ans, j - i + 1);     cnt[word.charAt(i)]--;     if (cnt[word.charAt(i)] == 0) let--;     i++;    }    out.println(ans);   }  }  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());   }  } }
0	public class program{ public static void main(String args[]) throws Exception{  Scanner sc=new Scanner(System.in);  int n=sc.nextInt();  if(n==0){  System.out.println("0 0 0");  return;  }  else if(n==1){  System.out.println("0 0 1");  return;  }  else if(n==2){  System.out.println("0 1 1");  return;  }  else{  int ppp=0;  int pp=1;  int c=2;  while(true){   if(ppp+pp+c==n){   System.out.println(ppp+" "+pp+" "+c);   return;   }   else{   c=c+pp+ppp;   int temp=pp;   pp=pp+ppp;   ppp=temp;   }  }  } } }
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(); } }
4	public class N718 { static PrintWriter out; static Scanner sc; static ArrayList<int[]>q,w,x; static ArrayList<Integer>adj[]; static HashSet<Integer>primesH; static boolean prime[];  static HashSet<Long>tmp; static int[][][]dist; static boolean[]v; static int[]a,b,c,d; static Boolean[][]dp; static char[][]mp; static int A,B,n,m,h,ans,sum;  static long oo=(long)1e9+7; public static void main(String[]args) throws IOException {  sc=new Scanner(System.in);  out=new PrintWriter(System.out);      D();      out.close(); }  private static void A() throws IOException {  int t=ni();  while(t-->0) {   long l=nl();   if(l%2050!=0)ol(-1);   else {   long num=l/2050;   int cnt=0;   while(num>0) {    cnt+=num%10;    num/=10;   }   ol(cnt);      }  }    }  static void B() throws IOException {  int t=ni();  while(t-->0) {   int n=ni(),m=ni();   int[][]a=nmi(n,m);   PriorityQueue<int[]>pq=new PriorityQueue<int[]>((u,v)->u[0]-v[0]);   ArrayList<Integer>[]nums=new ArrayList[n];   for(int i=0;i<n;i++) {      for(int j=0;j<m;j++) {       pq.add(new int[] {a[i][j],i});   }   }   int[][]ans=new int[n][m];   for(int i=0;i<m;i++) {   int[]x=pq.poll();   ans[x[1]][i]=x[0];   }   int []indices=new int[n];   while(!pq.isEmpty()) {   int[]x=pq.poll();   int i=x[1];   while(ans[i][indices[i]]!=0) {    indices[i]++;   }   ans[i][indices[i]]=x[0];   }   for(int i=0;i<n;i++) {   for(int j=0;j<m;j++) {    out.print(ans[i][j]+" ");   }   ol("");   }  }  }   static void C() throws IOException{   int t=1;   while(t-->0) {   int n=ni();   a=nai(n);   int[][]ans=new int[n][n];   for(int i=0;i<n;i++)ans[i][i]=a[i];   for(int i=n-1;i>=0;i--) {    int j=i,k=i;    int cur=ans[i][i];    cur--;    while(cur>0) {    j++;    if(j>=n||ans[j][k]!=0) {     j--;     k--;    }    ans[j][k]=ans[i][i];    cur--;    }   }   for(int i=0;i<n;i++) {    for(int j=0;j<=i;j++) {    out.print(ans[i][j]+" ");    }    ol("");   }   }  }  private static Boolean dp(int i, int j) {  if(j>sum/2)return false;  if(i==x.size()) {   return sum/2==j;  }  if(dp[i][j]!=null)return dp[i][j];    return dp[i][j]=dp(i+1,j+x.get(i)[0])||dp(i+1,j);  }  static boolean isPrime(long n) {  if(n==2)return true;  if(n<2||n%2==0)return false;    for(long i=3L;i*i<n;i+=2l) {   long rem=(n%i);   if(rem==0)return false;  }  return true;  }  static void D() throws IOException {  int t=1;  while(t-->0) {   int n=ni(),m=ni(),k=ni();   int[][]ans=new int[n][m];   dist=new int[n][m][4];   for(int i=0;i<n;i++)for(int j=0;j>m;j++)   Arrays.fill(dist[i][j], Integer.MAX_VALUE);   int x;   for(int i=0;i<n;i++) {   for(int j=0;j<m-1;j++) {    dist[i][j][2]=(x=ni());    dist[i][j+1][3]=x;   }   }   for(int i=0;i<n-1;i++) {   for(int j=0;j<m;j++) {    dist[i][j][1]=(x=ni());    dist[i+1][j][0]=x;   }   }   int[][]nans=new int[n][m];   if(k%2==1) {   for(int i=0;i<n;i++)Arrays.fill(ans[i], -1);   }else {   for(int ii=0;ii<k/2;ii++) {   for(int i=0;i<n;i++) {       for(int j=0;j<m;j++) {    nans[i][j]=Integer.MAX_VALUE;    if(i>0)     nans[i][j]=Math.min(nans[i][j], ans[i-1][j]+2*dist[i-1][j][1]);    if(i<n-1)     nans[i][j]=Math.min(nans[i][j], ans[i+1][j]+2*dist[i+1][j][0]);    if(j>0)     nans[i][j]=Math.min(nans[i][j], ans[i][j-1]+2*dist[i][j-1][2]);    if(j<m-1)     nans[i][j]=Math.min(nans[i][j], ans[i][j+1]+2*dist[i][j+1][3]);    }   }   int[][]tmp=ans;   ans=nans;   nans=tmp;   }   }   for(int i=0;i<n;i++) {   for(int j=0;j<m;j++) {    out.print(ans[i][j]+" ");   }   ol("");   }  }  }  private static int bfs(int i, int j,int k) {  boolean [][]vis=new boolean[dist.length][dist[0].length];  Queue<int[]>q=new LinkedList<int[]>();  int mn=Integer.MAX_VALUE;  q.add(new int[] {i,j,0,0});  int[]dx=new int[] {-1,1,0,0};  int[]dy=new int[] {0,0,1,-1};  while(!q.isEmpty()) {   int []x=q.poll();   vis[x[0]][x[1]]=true;   int c=x[2];   if(c>k/2)continue;   if(c>0&&k%c==0&&(k/c)%2==0) {   mn=Math.min(mn,x[3]*k/c );   }   for(int a=0;a<4;a++) {   int nx=x[0]+dx[a];   int ny=x[1]+dy[a];   if(valid(nx,ny)&&!vis[nx][ny]) {    q.add(new int[] {nx,ny,c+1,x[3]+dist[x[0]][x[1]][a]});   }   }     }  return mn;  }  private static boolean valid(int nx, int ny) {  return nx>=0&&nx<dist.length&&ny>=0&&ny<dist[0].length;  }  static int gcd (int a, int b) {   return b==0?a:gcd (b, a % b);  }   static void E() throws IOException {  int t=ni();  while(t-->0) {      }   }  static void F() throws IOException {  int t=ni();  while(t-->0) {    } } static void CC() throws IOException {  for(int kk=2;kk<21;kk++) {  ol(kk+" -------");  int n=kk;  int k=n-2;  int msk=1<<k;  int[]a=new int[k];  for(int i=0;i<a.length;i++)a[i]=i+2;  int mx=1;  int ms=0;  for(int i=1;i<msk;i++) {  long prod=1;  int cnt=0;  for(int j=0;j<a.length;j++) {   if(((i>>j)&1)!=0) {   prod*=a[j];   cnt++;   }  }  if(cnt>=mx&&prod%n==1) {   mx=cnt;   ms=i;  }    }  ol(mx==1?mx:mx+1);  out.print(1+" ");  long pr=1;  for(int j=0;j<a.length;j++) {  if(((ms>>j)&1)!=0) {   out.print(a[j]+" ");   pr*=a[j];  }  }  ol("");  ol("Prod: "+pr);  ol(n+"*"+((pr-1)/n)+" + "+1);  } } static int ni() throws IOException {  return sc.nextInt(); } static double nd() throws IOException {  return sc.nextDouble(); } static long nl() throws IOException {  return sc.nextLong(); } static String ns() throws IOException {  return sc.next(); } static int[] nai(int n) throws IOException {  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = sc.nextInt();  return a; } static long[] nal(int n) throws IOException {  long[] a = new long[n];  for (int i = 0; i < n; i++)  a[i] = sc.nextLong();  return a; } static int[][] nmi(int n,int m) throws IOException{  int[][]a=new int[n][m];  for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   a[i][j]=sc.nextInt();  }  }  return a; }  static long[][] nml(int n,int m) throws IOException{  long[][]a=new long[n][m];  for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   a[i][j]=sc.nextLong();  }  }  return a; } static void o(String x) {  out.print(x); } static void ol(String x) {  out.println(x); } static void ol(int x) {  out.println(x); } static void disp1(int []a) {  for(int i=0;i<a.length;i++) {  out.print(a[i]+" ");  }  out.println(); }  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 boolean hasNext() {return st.hasMoreTokens();}  public int nextInt() throws IOException {return Integer.parseInt(next());}   public double nextDouble() throws IOException {return Double.parseDouble(next());}   public long nextLong() throws IOException {return Long.parseLong(next());}  public String nextLine() throws IOException {return br.readLine();}    public boolean ready() throws IOException {return br.ready(); }   } }
3	public class A {  public static void main(String[] args) throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(reader.readLine());   String str[] = reader.readLine().split(" ");   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = Integer.parseInt(str[i]);   }   Arrays.sort(a);   int k = 0;   for (int i = 0; i < n; i++) {    if (a[i] == 0){     continue;    }    for (int j = i + 1; j < n; j++) {     if (a[j] % a[i] == 0){      a[j] = 0;     }    }    k++;   }   System.out.println(k);  } }
5	public class C15A {  public static void main(String args[]){   Scanner sc=new Scanner(System.in);   int n=sc.nextInt();   int t=sc.nextInt();   double nm[][]=new double[n][2];   int a=0;   int b=0;   for(int i=0;i<n;i++){    a=sc.nextInt();    b=sc.nextInt();    nm[i][0]=a-(double)b/2;    nm[i][1]=a+(double)b/2;   }    Arrays.sort(nm, new ArrayColumnComparator(1));   int sum=0;   for(int i=0;i<n-1;i++){    if(nm[i+1][0]-nm[i][1]==t)     sum++;    else if(nm[i+1][0]-nm[i][1]>t){     sum+=2;    }   }   System.out.println(sum+2);  } } class ArrayColumnComparator implements Comparator {  private int cm = 0;  ArrayColumnComparator(int cm) {   this.cm = cm;  }  public int compare(Object o1, Object o2) {   double[] row1 = (double[])o1;   double[] row2 = (double[])o2;   int i;   if (row1[cm]>row2[cm])    i=1;   else if(row1[cm]<row2[cm])    i=-1;   else i=0;   return i;  } }
4	public class D1517 {  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);  int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int[][] costRight = new int[n][m - 1];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m - 1; j++) {   costRight[i][j] = sc.nextInt();  }  }  int[][] costDown = new int[n - 1][m];  for (int i = 0; i < n - 1; i++) {  for (int j = 0; j < m; j++) {   costDown[i][j] = sc.nextInt();  }  }  if (k % 2 == 1) {  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   pw.print(-1 + " ");   }   pw.println();  }  pw.close();  return;  }  int[][][] dp = new int[k + 1][n][m];  for (int w = 2; w <= k; w += 2) {  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   dp[w][i][j] = (int) 1e9;   if (i + 1 < n)    dp[w][i][j] = Math.min(dp[w][i][j], 2 * costDown[i][j] + dp[w - 2][i + 1][j]);   if (i - 1 >= 0)    dp[w][i][j] = Math.min(dp[w][i][j], 2 * costDown[i - 1][j] + dp[w - 2][i - 1][j]);   if (j + 1 < m)    dp[w][i][j] = Math.min(dp[w][i][j], 2 * costRight[i][j] + dp[w - 2][i][j + 1]);   if (j - 1 >= 0)    dp[w][i][j] = Math.min(dp[w][i][j], 2 * costRight[i][j - 1] + dp[w - 2][i][j - 1]);   }  }  }  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   pw.print(dp[k][i][j] + " ");  }  pw.println();  }  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;  }  } }
5	public class Test {    static BufferedReader reader;    static StringTokenizer tokenizer;    static PrintWriter writer;    static int nextInt() throws IOException {      return Integer.parseInt(nextToken());    }    static long nextLong() throws IOException {      return Long.parseLong(nextToken());    }    static double nextDouble() throws 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));      tokenizer = null;      writer = new PrintWriter(System.out);      solve();      reader.close();      writer.close();    }    private static void solve() throws IOException {     int n=nextInt();     int[] a=new int[n];     int first=0;     for (int i=0;i<n;i++)     {      a[i]=nextInt();      first+=a[i];     }     Arrays.sort(a);     int ans=1;     int last=a[n-1];     first-=a[n-ans];     while (true)     {      if (first<last)       break;      ans++;      last+=a[n-ans];      first-=a[n-ans];     }     writer.print(ans);    }   }
6	public class Main implements Runnable { private void solution() throws IOException {  int n = in.nextInt();  int m = in.nextInt();  boolean[][] adj = new boolean[n][n];  long res = 0;  for (int i = 0; i < m; ++i) {  int x = in.nextInt();  int y = in.nextInt();  adj[x - 1][y - 1] = true;  adj[y - 1][x - 1] = true;  }  final long[][] dp = new long[1 << n][n];  for (int i = 0; i < n; ++i) {  for (int mask = 0; mask < (1 << (n - i)); ++mask) {   for (int j = 0; j < n - i; ++j) {   dp[mask][j] = 0;   }  }  dp[0][0] = 1;  for (int mask = 0; mask < (1 << (n - i)); ++mask) {   for (int j = 0; j < n - i; ++j) {   if (dp[mask][j] != 0) {    long am = dp[mask][j];    for (int k = 0; k < n - i; ++k) {    if (((mask >> k) & 1) == 0 && adj[j + i][k + i]) {     dp[mask | (1 << k)][k] += am;    }    }   }   }   if (((mask >> 0) & 1) != 0) {   res += dp[mask][0];   }  }  }  out.println((res - m) / 2); }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  private class Scanner {  BufferedReader reader;  StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  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 int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
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);  } } }
0	public class Subtractions {  public static void main(String[] args) {   Scanner s=new Scanner(System.in);  int t=s.nextInt();  while(t--!=0){  int a=s.nextInt();  int b=s.nextInt();  int min=Math.min(a, b);  int max=Math.max(a, b);  int ops=0;  while(true){   int quo=max/min;   ops+=quo;   int rem=max%min;   max=Math.max(rem, min);   min=Math.min(min, rem);   if(rem==0) break;  }  System.out.println(ops);  } } }
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");   } }
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();   }  } }
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) {    TreeSet<Integer> set = new TreeSet<>();    int n = in.nextInt();    for (int i = 0; i < n; i++) {     int x = in.nextInt();     set.add(x);    }    int ans = 0;    while (!set.isEmpty()) {     ans++;     int minimal = set.first();     int cur = minimal;     while (cur <= 100) {      set.remove(cur);      cur += minimal;     }    }    out.println(ans);   }  }  static class InputReader {   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private InputStream stream;   public InputReader(InputStream stream) {    this.stream = stream;   }   private boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   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 nextInt() {    int c = read();    while (isWhitespace(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 (!isWhitespace(c));    return res * sgn;   }  } }
6	public class E1 { static byte[] buf = new byte[1<<26];  static int bp = -1;   public static void main(String[] args) throws IOException {    DataInputStream in = new DataInputStream(System.in);     in.read(buf, 0, 1<<26);  int t = nni();  for (int z = 0; z < t; z++) {  int n = nni();  int m = nni();  int[][] mat = new int[n][m];  int[] rmax = new int[n];  int tot = 0;  HashSet<Integer> care = new HashSet<>();  for (int i = 0; i < n; i++) {   PriorityQueue<Integer> cols = new PriorityQueue<>();   for (int j = 0; j < m; j++) {   mat[i][j] = nni();   cols.add(-(mat[i][j]*2000+j));   rmax[i] = Math.max(rmax[i], mat[i][j]);   }   tot += rmax[i];   for (int j = 0; j < Math.min(m, n); j++)   care.add((-cols.poll())%2000);  }  List<Integer> cal = care.stream().sorted().collect(Collectors.toList());  int ret = tot;  if (Math.min(m, n)==1) {   System.out.println(ret);  } else if (Math.min(m, n)==2) {   for (int a = 0; a < cal.size(); a++) {   int la = cal.get(a);   for (int d = 0; d < cal.size(); d++) {    if (d==a)    continue;    int ld = cal.get(d);    for (int i = 0; i < n; i++) {    int tret = 0;    for (int x = 0; x < n; x++) {     tret += Math.max(mat[x][ld], mat[(i+x)%n][la]);    }    ret = Math.max(ret, tret);    }   }   }   System.out.println(ret);  } else if (Math.min(m, n)==3) {   for (int a = 0; a < cal.size(); a++) {   int la = cal.get(a);   for (int b = a+1; b < cal.size(); b++) {    int lb = cal.get(b);    for (int d = 0; d < cal.size(); d++) {    if (d==a)     continue;    if (d==b)     continue;    int ld = cal.get(d);    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {     int tret = 0;     for (int x = 0; x < n; x++) {      tret += Math.max(mat[x][ld], Math.max(mat[(i+x)%n][la], mat[(j+x)%n][lb]));     }     ret = Math.max(ret, tret);     }    }    }   }   }   System.out.println(ret);  } else if (Math.min(m, n)==4) {   for (int a = 0; a < cal.size(); a++) {   int la = cal.get(a);   for (int b = a+1; b < cal.size(); b++) {    int lb = cal.get(b);    for (int c = b+1; c < cal.size(); c++) {    int lc = cal.get(c);    for (int d = 0; d < cal.size(); d++) {     if (d==a)     continue;     if (d==b)     continue;     if (d==c)     continue;     int ld = cal.get(d);     for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      for (int k = 0; k < n; k++) {      int tret = 0;      for (int x = 0; x < n; x++) {       tret += Math.max(mat[x][ld], Math.max(mat[(i+x)%n][la], Math.max(mat[(j+x)%n][lb], mat[(k+x)%n][lc])));      }      ret = Math.max(ret, tret);      }     }     }    }    }   }   }   System.out.println(ret);  }  } }  public static int nni() {   int ret = 0;   byte b = buf[++bp];   while (true) {    ret = ret*10+b-'0';    b = buf[++bp];    if (b<'0'||b>'9') {    while (buf[bp+1]=='\r'||buf[bp+1]=='\n'||buf[bp+1]==' ') {++bp;}    break;    }   }   return ret;  } }
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); }  }
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);   E1RotateColumnsEasyVersion solver = new E1RotateColumnsEasyVersion();   solver.solve(1, in, out);   out.close();  }  static class E1RotateColumnsEasyVersion {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int t = in.nextInt();    for (int i = 0; i < t; i++) {     solve(in, out);    }   }   private void solve(InputReader in, PrintWriter out) {    int n = in.nextInt(), m = in.nextInt();    int[][] a = new int[n][];    for (int i = 0; i < n; i++) {     a[i] = in.readIntArray(m);    }    out.println(solve(n, m, a));   }   private int solve(int n, int m, int[][] a) {    Cell[] cells = new Cell[n * m];    for (int i = 0, index = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      cells[index++] = new Cell(i, j, a[i][j]);      if (index == cells.length)       break;     }    }    Arrays.sort(cells, Comparator.comparingInt(cell -> -cell.x));    HashSet<Integer> colset = new HashSet<>();    for (int i = 0; colset.size() < n && colset.size() < m; i++) {     colset.add(cells[i].j);    }    ArrayList<Integer> cols = new ArrayList<>();    cols.addAll(colset);    int answer = 0;    for (long perm = 0; perm < pow(n, cols.size() - 1); perm++) {     long p = perm;     int[] offset = new int[cols.size()];     for (int col = 0; col < cols.size(); col++) {      offset[col] = (int) (p % n);      p /= n;     }     int sum = 0;     for (int row = 0; row < n; row++) {      int max = 0;      for (int col = 0; col < cols.size(); col++) {       int cur = a[(row + offset[col]) % n][cols.get(col)];       max = Math.max(max, cur);      }      sum += max;     }     answer = Math.max(answer, sum);    }    return answer;   }   private long pow(int base, int exponent) {    long p = 1;    for (int i = 0; i < exponent; i++) {     p *= base;    }    return p;   }   private class Cell {    final int i;    final int j;    final int x;    private Cell(int i, int j, int x) {     this.i = i;     this.j = j;     this.x = x;    }   }  }  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 int[] readIntArray(int n) {    int[] x = new int[n];    for (int i = 0; i < n; i++) {     x[i] = nextInt();    }    return x;   }  } }
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()); } }
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 mod = (int) 1e9 + 7;   public void solve(int testNumber, InputReader in, PrintWriter out) {    long x = in.readLong();    long k = in.readLong();    if (x == 0) {     out.println(0);     return;    }    long ans = (BigInteger.valueOf(MathUtil.pow(2, k + 1, mod)).multiply(BigInteger.valueOf(x))).mod(BigInteger.valueOf(mod)).longValue();    long sub = (mod + MathUtil.pow(2, k, mod) - 1) % mod;    out.println((mod + ans - sub) % mod);   }  }  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 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 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 MathUtil {   public static long pow(long a, long b, long mod) {    long ans = 1;    while (b > 0) {     if (b % 2 == 1) ans = (ans * a) % mod;     a = (a * a) % mod;     b /= 2;    }    return ans;   }  } }
6	public class Main {  public static void main(String[] args) {   new Thread(null, new Runnable() {    public void run() {     new Main().solve();    }   }, "1", 1 << 26).start();  }  void solve() {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   E2RotateColumnsHardVersion solver = new E2RotateColumnsHardVersion();   int testCount = in.scanInt();   for (int i = 1; i <= testCount; i++)    solver.solve(i, in, out);   out.close();  }  static class E2RotateColumnsHardVersion {   int[][] dp;   int[] cur;   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    int m = in.scanInt();    int[][] ar = new int[n][m];    int[][] max = new int[m][2];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) ar[i][j] = in.scanInt();    }    for (int i = 0; i < m; i++) {     for (int j = 0; j < n; j++) {      max[i][0] = Math.max(max[i][0], ar[j][i]);     }     max[i][1] = i;    }    CodeHash.shuffle(max);    Arrays.sort(max, new Comparator<int[]>() {     public int compare(int[] o1, int[] o2) {      return -o1[0] + o2[0];     }    });    dp = new int[2][1 << n];    cur = new int[1 << n];    for (int i = 0; i < Math.min(m, n); i++) {     Arrays.fill(cur, 0);     Arrays.fill(dp[i & 1], 0);     for (int j = 0; j < 1 << n; j++) {      for (int k = 0; k < n; k++) {       int sum = 0;       for (int l = 0; l < n; l++) {        if ((j & (1 << l)) != 0) {         sum += (ar[(k + l) % n][max[i][1]]);        }       }       cur[j] = Math.max(cur[j], sum);      }     }     for (int j = 0; j < (1 << n); j++) {      for (int k = j; ; k = (k - 1) & j) {       dp[i & 1][j] = Math.max(dp[i & 1][j], dp[(i - 1) & 1][k] + cur[j ^ k]);       if (k == 0) break;      }     }    }    out.println(dp[Math.min(n, m) & 1 ^ 1][(1 << n) - 1]);   }  }  static class CodeHash {   public static void shuffle(int[][] ar) {    Random rd = new Random(new Random().nextInt());    for (int i = 0; i < ar.length; i++) {     int index = rd.nextInt(ar.length);     int[] temp = ar[i];     ar[i] = ar[index];     ar[index] = temp;    }   }  }  static class ScanReader {   private byte[] buf = new byte[4 * 1024];   private int index;   private BufferedInputStream in;   private int total;   public ScanReader(InputStream inputStream) {    in = new BufferedInputStream(inputStream);   }   private int scan() {    if (index >= total) {     index = 0;     try {      total = in.read(buf);     } catch (Exception e) {      e.printStackTrace();     }     if (total <= 0) return -1;    }    return buf[index++];   }   public int scanInt() {    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();     }    }    return neg * integer;   }   private boolean isWhiteSpace(int n) {    if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;    else return false;   }  } }
5	public class A{  public static void main(String[] args) throws Exception{   new A().run();  }  void run() throws Exception{     BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(sc.readLine());   ArrayList<Integer> a = new ArrayList<Integer>();     StringTokenizer st = new StringTokenizer(sc.readLine(), " ");   boolean allOne = true;   for(int i = 0; i < n; i++){    int val = Integer.parseInt(st.nextToken());    if(val!=1)allOne = false;    a.add(val);   }   if(allOne){a.remove(n-1); a.add(2);}   else a.add(1);   Collections.sort(a);   System.out.print(a.get(0));   for(int i = 1; i < n; i++)    System.out.print(" " + a.get(i));   System.out.println();  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   inputClass in = new inputClass(inputStream);   PrintWriter out = new PrintWriter(outputStream);   APaintTheNumbers solver = new APaintTheNumbers();   solver.solve(1, in, out);   out.close();  }  static class APaintTheNumbers {   public void solve(int testNumber, inputClass sc, PrintWriter out) {    int n = sc.nextInt();    Integer[] tab = new Integer[n];    for (int i = 0; i < n; i++) {     tab[i] = sc.nextInt();    }    Arrays.sort(tab);    boolean[] done = new boolean[n];    int ans = 0;    for (int i = 0; i < n; i++) {     if (!done[i]) {      ans++;      done[i] = true;      for (int j = i + 1; j < n; j++) {       if (!done[j] && tab[j] % tab[i] == 0) {        done[j] = true;       }      }     }    }    out.println(ans);   }  }  static class inputClass {   BufferedReader br;   StringTokenizer st;   public inputClass(InputStream in) {    br = new BufferedReader(new InputStreamReader(in));   }   public String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }  } }
5	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer split = new StringTokenizer(in.readLine());   int n = Integer.parseInt(split.nextToken());   double t = Double.parseDouble(split.nextToken());   House[] xaxis = new House[n];   for (int i = 0; i < n; i++) {    split = new StringTokenizer(in.readLine());    xaxis[i] = new House(Double.parseDouble(split.nextToken()), Double.parseDouble(split.nextToken()));   }   Arrays.sort(xaxis);   int count = 2;   for (int i = 0; i < xaxis.length - 1; i++) {    double free = (xaxis[i + 1].getX() - xaxis[i + 1].getSize() / 2.0) - (xaxis[i].getX() + xaxis[i].getSize() / 2.0);    if (free / t == 1.0) {     count++;    } else if (free / t > 1.0) {     count += 2;    }   }   System.out.println(count);  } } class House implements Comparable<House> {  private double x;  private double size;  public House(double x, double size) {   this.x = x;   this.size = size;  }  public double getX() {   return x;  }  public double getSize() {   return size;  }  public int compareTo(House o) {   if (this.x > o.getX()) {    return 1;   } else if (this.x == o.getX()) {    return 0;   }   return -1;  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   Input in = new Input(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, Input in, PrintWriter out) {    try {     int n = in.readInt();     int[] a = new int[n];     for (int i = 0; i < n; i++) {      a[i] = in.readInt();     }     Arrays.sort(a);     boolean[] b = new boolean[n];     int ans = 0;     while (true) {      int x = 0;      for (int i = 0; i < n; i++) {       if (!b[i] && x == 0) {        x = a[i];       }       if (x != 0 && a[i] % x == 0) {        b[i] = true;       }      }      if (x == 0) {       break;      }      ans++;     }     out.println(ans);    } catch (Exception e) {     throw new RuntimeException(e);    }   }  }  static class Input {   public final BufferedReader reader;   private String line = "";   private int pos = 0;   public Input(InputStream inputStream) {    reader = new BufferedReader(new InputStreamReader(inputStream));   }   private boolean isSpace(char ch) {    return ch <= 32;   }   public String readWord() throws IOException {    skip();    int start = pos;    while (pos < line.length() && !isSpace(line.charAt(pos))) {     pos++;    }    return line.substring(start, pos);   }   public int readInt() throws IOException {    return Integer.parseInt(readWord());   }   private void skip() throws IOException {    while (true) {     if (pos >= line.length()) {      line = reader.readLine();      pos = 0;     }     while (pos < line.length() && isSpace(line.charAt(pos))) {      pos++;     }     if (pos < line.length()) {      return;     }    }   }  } }
3	public class A {  static void solve() throws Exception {  int n = scanInt();  int a[] = new int[n];  for (int i = 0; i < n; i++) {  a[i] = scanInt();  }  sort(a);  int ans = 0;  ans: while (true) {  for (int i = 0;; i++) {   if (i == n) {   break ans;   }   if (a[i] != 0) {   ++ans;   int t = a[i];   a[i] = 0;   for (i++; i < n; i++) {    if (a[i] % t == 0) {    a[i] = 0;    }   }   break;   }  }  }  out.print(ans); }  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);  } } }
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(); }        }
5	public class Div1_526C {  static int nV;  static ArrayList<Integer>[] chldn;  static int root;  static int[][] anc; static int[] depth;  static int[] num;  static int[] nLoc;  static int[][] tree;  public static void main(String[] args) throws IOException {  BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  PrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  nV = Integer.parseInt(reader.readLine());  chldn = new ArrayList[nV];  for (int i = 0; i < nV; i++) {  chldn[i] = new ArrayList<>();  }  anc = new int[nV][21];  depth = new int[nV];  num = new int[nV];  nLoc = new int[nV];  tree = new int[nV * 4][2];  for (int[] a : tree) {  a[0] = a[1] = -1;  }  root = 0;  StringTokenizer inputData = new StringTokenizer(reader.readLine());  for (int i = 0; i < nV; i++) {  num[i] = Integer.parseInt(inputData.nextToken());  nLoc[num[i]] = i;  }  inputData = new StringTokenizer(reader.readLine());  for (int i = 1; i < nV; i++) {  anc[i][0] = Integer.parseInt(inputData.nextToken()) - 1;  chldn[anc[i][0]].add(i);  }  preprocess();  build(1, 0, nV - 1);  int nQ = Integer.parseInt(reader.readLine());  while (nQ-- > 0) {  inputData = new StringTokenizer(reader.readLine());  if (inputData.nextToken().equals("1")) {   int a = Integer.parseInt(inputData.nextToken()) - 1;   int b = Integer.parseInt(inputData.nextToken()) - 1;   int temp = num[a];   num[a] = num[b];   num[b] = temp;   nLoc[num[a]] = a;   nLoc[num[b]] = b;   update(1, 0, nV - 1, num[a]);   update(1, 0, nV - 1, num[b]);  } else {   printer.println(query(1, 0, nV - 1, nLoc[0], nLoc[0]) + 1);  }  }  printer.close(); }  static void build(int nI, int cL, int cR) {  if (cL == cR) {  tree[nI][0] = nLoc[cL];  tree[nI][1] = nLoc[cL];  } else {  int mid = (cL + cR) >> 1;  build(nI * 2, cL, mid);  build(nI * 2 + 1, mid + 1, cR);  if (tree[nI * 2][0] != -1 && tree[nI * 2 + 1][0] != -1) {   merge(tree[nI * 2][0], tree[nI * 2][1], tree[nI * 2 + 1][0], tree[nI * 2 + 1][1]);   tree[nI][0] = mResp[0];   tree[nI][1] = mResp[1];  }  } }  static int query(int nI, int cL, int cR, int e1, int e2) {  if (cL == cR) {  merge(e1, e2, nLoc[cL], nLoc[cL]);  if (mResp[0] != -1) {   return cL;  } else {   return cL - 1;  }  }  int mid = (cL + cR) >> 1;  merge(tree[nI * 2][0], tree[nI * 2][1], e1, e2);  if (mResp[0] != -1) {  return query(nI * 2 + 1, mid + 1, cR, mResp[0], mResp[1]);  }  return query(nI * 2, cL, mid, e1, e2); }  static void update(int nI, int cL, int cR, int uI) {  if (cL == cR) {  tree[nI][0] = nLoc[cL];  tree[nI][1] = nLoc[cL];  } else {  int mid = (cL + cR) >> 1;  if (uI <= mid) {   update(nI * 2, cL, mid, uI);  } else {   update(nI * 2 + 1, mid + 1, cR, uI);  }  merge(tree[nI * 2][0], tree[nI * 2][1], tree[nI * 2 + 1][0], tree[nI * 2 + 1][1]);  tree[nI][0] = mResp[0];  tree[nI][1] = mResp[1];  } }  static int[] mResp = new int[2];  static void merge1(int... a) {  for (int i = 0; i < 3; i++) {  if (a[i] == -1) {   mResp[0] = mResp[1] = -1;   return;  }  }  if (onPath(a[0], a[1], a[2])) {  mResp[0] = a[0];  mResp[1] = a[1];  return;  }  if (onPath(a[0], a[2], a[1])) {  mResp[0] = a[0];  mResp[1] = a[2];  return;  }  if (onPath(a[1], a[2], a[0])) {  mResp[0] = a[1];  mResp[1] = a[2];  return;  }  mResp[0] = mResp[1] = -1; }  static void merge(int... a) {  merge1(a[0], a[1], a[2]);  merge1(mResp[0], mResp[1], a[3]); }  static boolean onPath(int a, int b, int c) {  if (a == c || b == c) {  return true;  }  if (depth[a] > depth[c]) {  a = jump(a, depth[a] - depth[c] - 1);  }  if (depth[b] > depth[c]) {  b = jump(b, depth[b] - depth[c] - 1);  }  if (a == b) {  return false;  }  if (anc[a][0] == c || anc[b][0] == c) {  return true;  }  return false; }   static void preprocess() {  anc[root][0] = root;  fParent(root);  for (int k = 1; k <= 20; k++) {  for (int i = 0; i < nV; i++) {   anc[i][k] = anc[anc[i][k - 1]][k - 1];  }  } }  static void fParent(int cV) {  for (int aV : chldn[cV]) {  anc[aV][0] = cV;  depth[aV] = depth[cV] + 1;  fParent(aV);  } }  static int fLCA(int a, int b) {  if (depth[a] > depth[b]) {  int temp = b;  b = a;  a = temp;  }  b = jump(b, depth[b] - depth[a]);  if (a == b) {  return a;  }  for (int i = 20; i >= 0; i--) {  if (anc[a][i] != anc[b][i]) {   a = anc[a][i];   b = anc[b][i];  }  }  return anc[a][0]; }  static int jump(int cV, int d) {  for (int i = 0; i <= 20; i++) {  if ((d & (1 << i)) != 0) {   cV = anc[cV][i];  }  }  return cV; }  static Comparator<Integer> BY_DEPTH = new Comparator<Integer>() {  public int compare(Integer o1, Integer o2) {  return -Integer.compare(depth[o1], depth[o2]);  } }; }
6	public class D {  Reader in = new Reader(System.in);  PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {   new D().run();  }  int n, m;  boolean[][] adjacency;   void run() throws IOException {   n = in.nextInt();   m = in.nextInt();   adjacency = new boolean[n+1][n];   for (int i = 0; i < m; i++) {    int u = in.nextInt(), v = in.nextInt();    adjacency[u-1][v-1] = adjacency[v-1][u-1] = true;    }   final int MASK_BOUND = (1 << n);             long[][] dp = new long[MASK_BOUND][n];   for (int i = 0; i < n; i++)    dp[1<<i][i] = 1;   long sum = 0;   for (int mask = 1; mask < MASK_BOUND; mask++) {    int lowestVertex = (int) (Math.log(lowest(mask)) / Math.log(2));    for (int i = 0; i < n; i++) {     if (bit(i, mask) && i != lowestVertex) {      for (int j = 0; j < n; j++) {       if (adjacency[j][i]) {        dp[mask][i] += dp[mask^(1<<i)][j];       }      }            if (count(mask) >= 3 && adjacency[lowestVertex][i])       sum += dp[mask][i];     } else {          }    }   }   out.println(sum / 2);    out.flush();  }    int count(int mask) {   int count = 0;   while (mask > 0) {    if ((mask & 1) == 1)     count++;    mask >>= 1;   }   return count;  }     int lowest(int mask) {          return mask & (-mask);  }    boolean bit(int index, int mask) {   return ((1 << index) & mask) > 0;  }  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() );   }  } }
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 C43 implements Runnable {  public Scanner in;  public PrintWriter out;  final static String TASK_NAME = "";  C43() throws IOException {   in = new Scanner( System.in );     out = new PrintWriter( System.out );  }  void close() throws IOException {   out.close();  }  public void run() {   try {    solve();    close();   } catch ( Exception e ) {    e.printStackTrace();   }  }  public void solve() throws IOException {   int n = in.nextInt();   char[] c = in.next().toCharArray();   int t = 0;   for ( int i = 0; i < n; i ++ ) {    if ( c[i] == 'T' ) {     t ++;    }   }   int ct = 0;   for ( int i = 0; i < t; i ++ ) {    if ( c[i] == 'T' ) {     ct ++;    }   }   int r = 0;   for ( int i = 0; i < n; i ++ ) {    r = Math.max( r, ct );    if ( c[i] == 'T' ) {     ct --;    }    if ( c[( i + t ) % n] == 'T' ) {     ct ++;    }   }   out.println( t - r );  }  public static void main( String[] args ) throws IOException {   new Thread( new C43() ).start();  } }
1	public final class round_364_c {  static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static FastScanner sc=new FastScanner(br);  static PrintWriter out=new PrintWriter(System.out);  public static void main(String args[]) throws Exception {  int n=sc.nextInt();char[] arr=sc.next().toCharArray();int[] sum=new int[123];int[][] pre=new int[123][n+1];  char[] a=new char[n+1];  for(int i=1;i<=n;i++)  {  a[i]=arr[i-1];  }  boolean[] v=new boolean[123];  for(int i=1;i<=n;i++)  {  sum[a[i]]++;v[a[i]]=true;  for(int j=65;j<=90;j++)  {   pre[j][i]=sum[j];  }  for(int j=97;j<=122;j++)  {   pre[j][i]=sum[j];  }  }  long min=Integer.MAX_VALUE;  for(int i=1;i<=n;i++)  {  int low=0,high=n-i+1;boolean got=false;  while(low<high)  {   int mid=(low+high)>>1;   boolean curr=true;   for(int j=65;j<=90;j++)   {   if(v[j])   {    if(pre[j][i+mid]-pre[j][i-1]<=0)    {    curr=false;    break;    }   }   }   for(int j=97;j<=122;j++)   {   if(v[j])   {    if(pre[j][i+mid]-pre[j][i-1]<=0)    {    curr=false;    break;    }   }   }   if(curr)   {   got=true;   high=mid;   }   else   {   low=mid+1;   }  }  if(got)  {   min=Math.min(min,(i+low)-i+1);  }  }  out.println(min);  out.close(); } } class FastScanner {  BufferedReader in;  StringTokenizer st;  public FastScanner(BufferedReader in) {   this.in = in;  }   public String nextToken() throws Exception {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  public String next() throws Exception {  return nextToken().toString(); }   public int nextInt() throws Exception {   return Integer.parseInt(nextToken());  }  public long nextLong() throws Exception {   return Long.parseLong(nextToken());  }  public double nextDouble() throws Exception {   return Double.parseDouble(nextToken());  } }
2	public class TaskC {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  BigInteger x = new BigInteger(sc.next());  BigInteger k = new BigInteger(sc.next());  BigInteger mod = new BigInteger(String.valueOf((int) (Math.pow(10, 9) + 7)));  BigInteger two = new BigInteger("2");  BigInteger interm = two.modPow(k, mod);  BigInteger res = interm.multiply(x).add(interm.multiply(x)).subtract(interm).add(BigInteger.ONE).mod(mod);  if(x.equals(BigInteger.ZERO)) {  System.out.println("0");  return;  }  System.out.println(res); } }
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(); } }
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);   TaskB solver = new TaskB();   solver.solve(1, in, out);   out.close();  } } class TaskB { public void solve(int testNumber, Scanner in, PrintWriter out) {  long n = in.nextLong() ;  int k = in.nextInt();  long top = 1L * k * (k+1) / 2L - k + 1;  if ( n == 1L ){  out.print(0);  return;  }  if ( n > top ){  out.print(-1);  return;  }  int ans = 0;  if ( n > 0 ){  ++ans;  n -= k;  k -= 2;  }  while ( n > 0 ){  ++ans;  n -= k;  k--;  }  out.print(ans); } }
1	public class C implements Runnable {  private static final boolean USE_FILE_IO = false;  private static final String FILE_IN = "c.in";  private static final String FILE_OUT = "c.out";  BufferedReader in;  PrintWriter out;  StringTokenizer tokenizer = new StringTokenizer("");  public static void main(String[] args) {   new Thread(new C()).start();  }  int n, h, t;  char[] c;  private void solve() throws IOException {   n = nextInt();   c = nextToken().toCharArray();   if (c.length != n) {    throw new IllegalStateException();   }   for (char l : c)    if (l == 'H') {     h++;    }   t = n - h;   if (h == 0) {    out.print(0);    return;   }   int answer = Integer.MAX_VALUE;   for (int hLo = 0; hLo < n; hLo++)    if (c[hLo] == 'H') {     int hHi = (hLo + h) % n;     int current = 0;     int j = hLo;     while (j != hHi) {      if (c[j] == 'T') {       current++;      }      j = (j + 1) % n;     }     answer = Math.min(answer, current);    }   out.print(answer);  }  public void run() {   long timeStart = System.currentTimeMillis();   try {    if (USE_FILE_IO) {     in = new BufferedReader(new FileReader(FILE_IN));     out = new PrintWriter(new FileWriter(FILE_OUT));    } else {     in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(new OutputStreamWriter(System.out));    }    solve();    in.close();    out.close();   } catch (IOException e) {    throw new IllegalStateException(e);   }   long timeEnd = System.currentTimeMillis();   System.out.println("Time spent: " + (timeEnd - timeStart) + " ms");  }  private String nextToken() throws IOException {   while (!tokenizer.hasMoreTokens()) {    String line = in.readLine();    if (line == null) {     return null;    }    tokenizer = new StringTokenizer(line);   }   return tokenizer.nextToken();  }  private int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  private BigInteger nextBigInt() throws IOException {   return new BigInteger(nextToken());  }  private long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  private double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
4	public class temp {  public static void main(String str[]){   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int m = sc.nextInt();   int k = sc.nextInt();   int arr[][] = new int[n][m];   int cross[][] = new int[n][m-1];   int up[][] = new int[n-1][m];   for(int i=0;i<n;i++){    for(int j=0;j<m-1;j++){     cross[i][j] = sc.nextInt();    }   }   for(int i=0;i<n-1;i++){    for(int j=0;j<m;j++){     up[i][j] = sc.nextInt();    }   }   int[][] fans = new int[n][m];    if (k % 2 != 0) {     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       fans[i][j] = -1;      }     }    }    else {     int[][][] ans = new int[(k/2)+1][n][m];     for (int l = 1; l <= k / 2; l++){      for (int i = 0; i < n ; i++) {       for (int j = 0; j < m; j++) {        int min = Integer.MAX_VALUE;        if(i>0){         min = Math.min(min, up[i-1][j] + ans[l-1][i-1][j]);        }        if(j>0){         min = Math.min(min, cross[i][j-1] + ans[l-1][i][j-1]);        }        if(i<n-1){         min = Math.min(min, up[i][j] + ans[l-1][i+1][j]);        }        if(j<m-1){         min = Math.min(min, cross[i][j] + ans[l-1][i][j+1]);        }        ans[l][i][j] = min;       }      }     }     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       fans[i][j] = 2*ans[k/2][i][j];      }     }    }   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     System.out.print(fans[i][j]+" ");    }    System.out.println();   }   } }
3	public class GFG {  static int count=0;   public static void main (String[] args) {  Scanner ob=new Scanner(System.in);  int n;  long MOD=(long)(1e9+7);  int f=0,s=0;  n=ob.nextInt();  long dp[][]=new long[n+2][n+2];  dp[0][1]=1;  char ch='s';  char p;  for(int i=1;i<=n;i++)  {   p=ch;   ch=ob.next().charAt(0);   if(p=='f')   {    for(int j=1;j<=n;j++)    dp[i][j+1]=dp[i-1][j];   }   else   {    for(int j=n;j>0;j--)    {     dp[i][j]=(dp[i][j+1]+dp[i-1][j])%MOD;    }   }  }   long ans=0;   for(int i=1;i<=n;i++)  {   ans=(ans+dp[n][i])%MOD;  }  System.out.println(ans); } }
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));  } }
2	public class candies { public void run() throws Exception {  Scanner file = new Scanner(System.in);  int actions = file.nextInt();  int left = file.nextInt();  int start = 0;  int c = 1;  while (true) {  start += c;  if (c + (start - left) == actions) break;  c++;  }  System.out.println(start - left); }  public static void main(String[] args) throws Exception {  new candies().run(); } }
3	public class C {   private static int[][][] dp; private static boolean[] wasLoop; private static int MOD=1000000007; private static int n;  public static void solve(FastScanner fs) {  n=fs.nextInt();  dp=new int[2][n][n];  for (int i=0; i<dp.length; i++)  for (int j=0; j<dp[i].length; j++)   Arrays.fill(dp[i][j], -1);  wasLoop=new boolean[n];  for (int i=0; i<n; i++)  wasLoop[i]=fs.next().equals("f");   int ans=go(0, 0, 0);  System.out.println(ans); }  private static int go(int firstInLoop, int index, int indentLevel) {  if (index>=n)  return 1;  if (dp[firstInLoop][index][indentLevel]!=-1)  return dp[firstInLoop][index][indentLevel];     if (firstInLoop==1)  return dp[firstInLoop][index][indentLevel]=go(wasLoop[index]?1:0, index+1, indentLevel+(wasLoop[index]?1:0));     if (indentLevel==0) {  return dp[firstInLoop][index][indentLevel]=go(wasLoop[index]?1:0, index+1, wasLoop[index]?1:0);  }  else {    int total=0;  total+=go(firstInLoop, index, indentLevel-1);  total+=go(wasLoop[index]?1:0, index+1, indentLevel+(wasLoop[index]?1:0));  total%=MOD;  return dp[firstInLoop][index][indentLevel]=total;  } }      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;  } } }
1	public class A_IQTest {  static int n;  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   n = s.nextInt();     int[] nums = new int[n];     for (int i = 0; i < n; i++) {    nums[i] = s.nextInt();   }        int ei = -1;   int oi = -1;   int ecnt = 0;   int ocnt = 0;   for (int i = 0; i < n; i++) {    if(nums[i] % 2 == 0){     ei = i;     ecnt++;    }else{     oi = i;     ocnt++;    }   }   if(ecnt == 1){    System.out.println(ei+1);   }else{    System.out.println(oi+1);   }  } }
2	public class C_3 {  public static void main(String[] args) throws Exception {   FastReader in = new FastReader(System.in);   PrintWriter pw = new PrintWriter(System.out);   long mod = (long) 1e9 + 7;   long xx = in.nextLong(), kk = in.nextLong();   if(xx == 0){    pw.println(0); pw.close();    return;   }   BigInteger x = BigInteger.valueOf(xx), k = BigInteger.valueOf(kk);      BigInteger MOD = BigInteger.valueOf(mod);   BigInteger a = BigInteger.valueOf(2).modPow(BigInteger.valueOf(kk+1), MOD);   BigInteger b = BigInteger.valueOf(2).modPow(BigInteger.valueOf(kk), MOD);    BigInteger s = (a.multiply(x)).mod(MOD);   s = s.subtract(b.mod(MOD));   s = s.add(BigInteger.ONE);   s = s.mod(MOD);   s = s.add(MOD);   s = s.mod(MOD);         pw.println(s);    pw.close();  }   static void debug(Object... obj) {   System.err.println(Arrays.deepToString(obj));  }  static class FastReader {   static final int ints[] = new int[128];   InputStream is;   private byte[] inbuf = new byte[1024];   private int lenbuf = 0, ptrbuf = 0;   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);   }     } }
0	public class CF125D2A {    public static void main(String[] args) {   Scanner sc = new Scanner (System.in);   System.out.println("0 0 "+ sc.nextInt());  } }
1	public class A { public static boolean ok(int []x,int d,int X) {  for(int i=0;i<x.length;i++)  if(Math.abs(x[i]-X)<d)   return false;  return true; } public static void main(String[] args) throws IOException {  Scanner sc=new Scanner(System.in);  PrintWriter pw=new PrintWriter(System.out);  int ans=0;  int n=sc.nextInt(),d=sc.nextInt();  TreeSet<Integer> set=new TreeSet();  int []x=new int [n];  for(int i=0;i<n;i++)  x[i]=sc.nextInt();  for(int i=0;i<n;i++)  {  int x1=x[i]+d;  if (ok(x,d,x1))   set.add(x1);  x1=x[i]-d;  if (ok(x,d,x1))   set.add(x1);      }  pw.println(set.size());     pw.close();   }   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 Scanner(String s) throws FileNotFoundException {  br = new BufferedReader(new FileReader(s)); } public int nextInt() throws IOException {  return Integer.parseInt(next()); } public double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public long nextLong() throws IOException {  return Long.parseLong(next()); }  public String nextLine() throws IOException {  return br.readLine(); }  public boolean ready() throws IOException {  return br.ready(); } } }
1	public class Main{  public static void main(String[] args) throws IOException {      open ("input.txt", "output.txt", false, true);   char[] alph = " ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();   Pattern pat = Pattern.compile("[A-Z]+[\\d]+");   Matcher mat;   boolean b ;   String s;   int index, coef, row, col;   int n = nextInt();   String[] tmp;   char[] c;   for (int i=0; i<n; i++)   {    s = nextLine();    c = s.toCharArray();    mat = pat.matcher(s);    b = mat.matches();    if (b)    {         index = c.length-1;     coef = 1;     row = 0;     while (c[index]>='0' && c[index]<='9')     {      row += (c[index]-'0')*coef;      coef*=10;      index--;     }     coef = 1;     col = 0;     while (index>=0)     {      col += (Arrays.binarySearch(alph, c[index]))*coef;           coef*=26;      index--;     }     out.println("R"+row+"C"+col);    }    else    {     tmp = s.split("R|C");              col = Integer.parseInt(tmp[2]);     char[] temp = new char[10];     int len = 0;     int v = 0;     while (col>0)     {      index = col%26;      if (index==0)       { index=26;       v = 1;       }      else v = 0;      temp[len]=alph[index];           col = (col/26) - v;      len++;     }     for (int j=len-1; j>=0; j--)     {      out.print(temp[j]);     }     out.println(tmp[1]);    }   }   close();  }   static StringTokenizer st;  static StreamTokenizer strTok;  static BufferedReader in;  static PrintWriter out;   static String nextToken(boolean f) throws IOException {   if (f) {    return in.readLine();   } else {    while (st == null || !st.hasMoreTokens()) {     st = new StringTokenizer(in.readLine());    }    return st.nextToken();   }  }   static String nextLine() throws IOException {   return nextToken(true);  }   static int nextInt() throws NumberFormatException, IOException {   return Integer.parseInt(nextToken(false));  }   static long nextLong() throws NumberFormatException, IOException {   return Long.parseLong(nextToken(false));  }   static double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextToken(false));  }   static char nextChar() throws IOException {   return ((char)in.read());  }   static void close(){   out.flush();   out.close();  }   static void open(String filein, String fileout, boolean flag, boolean console) throws IOException{   if (flag) {    strTok = new StreamTokenizer(new FileReader (new File(filein)));    in = new BufferedReader(new FileReader (new File(filein)));    out = new PrintWriter(new FileWriter(new File (fileout)));   } else {    if (console){     strTok = new StreamTokenizer(new InputStreamReader (System.in, "ISO-8859-1"));     in = new BufferedReader (new InputStreamReader (System.in, "ISO-8859-1"));     out = new PrintWriter (new OutputStreamWriter (System.out, "ISO-8859-1"));    } else {     strTok = new StreamTokenizer(new FileReader (new File("input.txt")));     in = new BufferedReader(new FileReader (new File("input.txt")));     out = new PrintWriter(new FileWriter(new File ("output.txt")));    }   }  } }
2	public class CF489_C { static long mod = 1000000007;  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  long x = s.nextLong(), k = s.nextLong();  if (x == 0) {  System.out.println(0);  return;  }  long max = x % mod;  long temp = power(2, k, mod);  temp %= mod;  max = (max % mod) * (temp % mod);  max %= mod;  long min = max % mod;  min = mod(min - (temp - 1));  min %= mod;  long num = mod(max - min + 1);  long n = num % mod;  n = (n % mod) * (min % mod + max % mod);  n = n % mod;  n %= mod;  long ans = n % mod * modInverse(num, mod);  System.out.println(ans % mod);  }  static long modInverse(long a, long m) {  long m0 = m;  long y = 0, x = 1;  if (m == 1)  return 0;  while (a > 1) {    long q = a / m;  long t = m;       m = a % m;  a = t;  t = y;     y = x - q * y;  x = t;  }    if (x < 0)  x += m0;  return x; }  static long mod(long val) {  val %= mod;  if (val < 0)  val += mod;  return val; }  static long power(long x, long y, long p) {   long res = 1;     x = x % p;  while (y > 0) {      if ((y & 1) == 1)   res = (res * x) % p;       y = y >> 1;  x = (x * x) % p;  }  return res; } }
1	public class A{   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));     PrintWriter out = new PrintWriter(System.out);     int[][] d = new int[5][3];   int[][] d2 = new int[5][3];     int N = Integer.parseInt(br.readLine());   for (int i = 0; i < N; i++) {    String r = br.readLine();    int len = r.length();    int fin = 0;    if(r.charAt(r.length()-1) == 'S')     fin = 0;    if(r.charAt(r.length()-1) == 'M')     fin = 1;    if(r.charAt(r.length()-1) == 'L')     fin = 2;    d[len][fin]++;   }     for (int i = 0; i < N; i++) {    String r = br.readLine();    int len = r.length();    int fin = 0;    if(r.charAt(r.length()-1) == 'S')     fin = 0;    if(r.charAt(r.length()-1) == 'M')     fin = 1;    if(r.charAt(r.length()-1) == 'L')     fin = 2;    d2[len][fin]++;   }     int ans = 0;   for (int i = 0; i < d.length; i++) {    int sum = 0;    int sum2 = 0;    for (int j = 0; j < d[0].length; j++) {     sum += d[i][j];     sum2 += d2[i][j];     ans += Math.max(0, d2[i][j] - d[i][j]);    }      }   System.out.println(ans);   out.close();  }  }
1	public class a {   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()%2;   int z = 0;  for(int i=0;i<n;i++) z+=(a[i] == 0)?1:0;  if (z == 1) z = 0;  else z = 1;   for(int i=0;i<n;i++)  if (a[i] == z){   System.out.println(i+1);   break;  } } }
2	public class R574B {  public static void main(String[] args) {  JS scan = new JS();  long n = scan.nextInt();  long put = 1;  long k = scan.nextInt();  long have = 0;  long moves = 0;  while(have < k) {  have += put;  put++;  moves++;  }   long ans = 0;  moves += have-k;  ans += have-k;  long lo = 0;  long hi = n-moves;  long bs = 0;  while(lo <= hi) {    long mid = (lo+hi)/2;  long left = (n-moves)-mid+put-1;  long rr = tri(left)-tri(put);    if(rr <= mid) {   bs = mid;   hi = mid-1;  }  else {   lo = mid+1;  }  }  System.out.println(ans+bs); }  static long tri(long n) {  return n*(n-1)/2; }  static class JS{  public int BS = 1<<16;  public char NC = (char)0;  byte[] buf = new byte[BS];  int bId = 0, size = 0;  char c = NC;  double num = 1;  BufferedInputStream in;  public JS() {  in = new BufferedInputStream(System.in, BS);  }  public JS(String s) throws FileNotFoundException {  in = new BufferedInputStream(new FileInputStream(new File(s)), BS);  }  public char nextChar(){  while(bId==size) {   try {   size = in.read(buf);   }catch(Exception e) {   return NC;   }     if(size==-1)return NC;   bId=0;  }  return (char)buf[bId++];  }  public int nextInt() {  return (int)nextLong();  }  public long nextLong() {  num=1;  boolean neg = false;  if(c==NC)c=nextChar();  for(;(c<'0' || c>'9'); c = nextChar()) {   if(c=='-')neg=true;  }  long res = 0;  for(; c>='0' && c <='9'; c=nextChar()) {   res = (res<<3)+(res<<1)+c-'0';   num*=10;  }  return neg?-res:res;  }  public double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }  public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }  public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  } } }
2	public class Problem2 implements Runnable {  public void run() {   Scanner scanner = new Scanner(System.in);   PrintWriter writer = new PrintWriter(System.out);   long n = scanner.nextLong();   long k = scanner.nextLong();   long count = 1;    if (n == 1) {    writer.println(0);    writer.close();    return;   }   if (k >= n) {    writer.println(1);    writer.close();    return;   }   long answer = 0;   while (k > 1) {    if (k > 2000) {     if (count + k <= n) {      if (count + (k - 1 + k - 1000) * 500 <= n) {       count += (k - 1 + k - 1000) * 500;       k -= 1000;       answer += 1000;      }     }    }    if ((count + k - 1) <= n) {      count += (k - 1);      answer++;    }    if (count + k - 100000000000000000l > n) {     k -= 99999999999999999l;    }    if (count + k - 10000000000000000l > n) {     k -= 9999999999999999l;    }    if (count + k - 1000000000000000l > n) {     k -= 999999999999999l;    }    if (count + k - 100000000000000l > n) {     k -= 99999999999999l;    }    if (count + k - 10000000000000l > n) {     k -= 9999999999999l;    }    if (count + k - 1000000000000l > n) {     k -= 999999999999l;    }    if (count + k - 100000000000l > n) {     k -= 99999999999l;    }    if (count + k - 10000000000l > n) {     k -= 9999999999l;    }    if (count + k - 1000000000l > n) {     k -= 999999999l;    }    if (count + k - 100000000l > n) {     k -= 99999999l;    }    if (count + k - 10000000l > n) {     k -= 9999999l;    }    if (count + k - 1000000l > n) {     k -= 999999l;    }    if (count + k - 100000l > n) {     k -= 99999l;    }    if (count + k - 10000l > n) {     k -= 9999l;    }    if (count + k - 1000l > n) {     k -= 999l;    }    if (count + k - 100l > n) {     k -= 99l;    }     if (n - count + 1 < k) {     k = n - count + 1;    } else {     k--;    }   }    if (count == n) {    writer.println(answer);   } else {    writer.println(-1);   }   writer.close();  }  public static void main(String[] args) {   new Problem2().run();  } }
0	public class A {  public static void main(String[] args) {   long fib[] = { 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170, 1836311903, 2971215073L, 4807526976L, 7778742049L, 12586269025L, 20365011074L, 32951280099L, 53316291173L, 86267571272L, 139583862445L, 225851433717L, 365435296162L, 591286729879L, 956722026041L, 1548008755920L, 2504730781961L, 4052739537881L, 6557470319842L, 10610209857723L };   int i = Arrays.binarySearch(fib, new Scanner(System.in).nextLong());   if (i < 4)    if (i == 3)     System.out.println("0 1 1");    else if (fib[i] == 1)     System.out.println("0 0 1");    else     System.out.println("0 0 0");   else    System.out.println(fib[i - 4] + " " + fib[i - 3] + " " + fib[i - 1]);  } }
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 Main { boolean eof;  public static void main(String[] args) throws IOException {  new Main().run(); }  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()); }  BufferedReader br; StringTokenizer st; PrintWriter out;  void run() throws IOException {  InputStream input = System.in;  PrintStream output = System.out;  try {  File f = new File("trips.in");  if (f.exists() && f.canRead()) {   input = new FileInputStream(f);   output = new PrintStream("trips.out");  }  } catch (Throwable e) {  }  br = new BufferedReader(new InputStreamReader(input));  out = new PrintWriter(output);  solve();  br.close();  out.close(); }  class Pair implements Comparable<Pair> {  int x, y;  Pair(int x, int y) {  this.x = x;  this.y = y;  }  public int compareTo(Pair p) {  if (x > p.x) {   return 1;  } else if (x < p.x) {   return -1;  } else {   return 0;  }  } }  long nextLong() {  return Long.parseLong(nextToken()); }  long ans;  void nod(long a, long b){  if (a == 0 || b == 0){    } else if (a > b){  ans += a / b;  nod(a % b, b);  } else {  ans += b / a;  nod(a, b % a);  } }  void solve() {  long a = nextLong(), b = nextLong();  ans = 0;  nod(a, b);  out.println(ans); } }
5	public class A {  public static void main(String[] args) {   Scanner s = new Scanner(new InputStreamReader(System.in));   int n = s.nextInt();   if (n == 1) {    System.out.println("NO");    System.exit(0);   }   int[] nums = new int[n];   for (int i = 0; i < n; i++) {    nums[i] = s.nextInt();   }   Arrays.sort(nums);   int x = 1;   while (x < n && nums[x] == nums[x - 1])    x++;   if (x == n) {    System.out.println("NO");    System.exit(0);   } else {    System.out.println(nums[x]);    System.exit(0);   }  } }
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);    DExplorerSpace solver = new DExplorerSpace();    solver.solve(1, in, out);    out.close();   }  }  static class DExplorerSpace {   public void solve(int testNumber, FastInput in, FastOutput out) {    int n = in.ri();    int m = in.ri();    int k = in.ri();    int[][] lr = new int[n][m - 1];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m - 1; j++) {      lr[i][j] = in.ri();     }    }    int[][] ud = new int[n - 1][m];    for (int i = 0; i < n - 1; i++) {     for (int j = 0; j < m; j++) {      ud[i][j] = in.ri();     }    }    if (k % 2 == 1) {     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       out.append(-1).append(' ');      }      out.println();     }     return;    }    k /= 2;    int inf = (int) 1e9;    int[][][] dp = new int[k + 1][n][m];    for (int i = 1; i <= k; i++) {     for (int j = 0; j < n; j++) {      for (int t = 0; t < m; t++) {       dp[i][j][t] = inf;             if (t > 0) {        dp[i][j][t] = Math.min(dp[i][j][t], dp[i - 1][j][t - 1] + lr[j][t - 1]);       }             if (t + 1 < m) {        dp[i][j][t] = Math.min(dp[i][j][t], dp[i - 1][j][t + 1] + lr[j][t]);       }             if (j + 1 < n) {        dp[i][j][t] = Math.min(dp[i][j][t], dp[i - 1][j + 1][t] + ud[j][t]);       }             if (j > 0) {        dp[i][j][t] = Math.min(dp[i][j][t], dp[i - 1][j - 1][t] + ud[j - 1][t]);       }      }     }    }    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      out.append(dp[k][i][j] * 2).append(' ');     }     out.println();    }   }  }  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();   }  }  static class FastInput {   private final InputStream is;   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 int ri() {    return readInt();   }   public int readInt() {    int sign = 1;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+' ? 1 : -1;     next = read();    }    int val = 0;    if (sign == 1) {     while (next >= '0' && next <= '9') {      val = val * 10 + next - '0';      next = read();     }    } else {     while (next >= '0' && next <= '9') {      val = val * 10 - next + '0';      next = read();     }    }    return val;   }  } }
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();   }  } }
3	public class cf1 implements Runnable {   static void addMap(int curr, HashMap<Integer, Integer> map, HashMap<Integer, Integer>[] hm, int j) {   int prev = 0;   if(map.get(curr) != null)  prev = map.get(curr);   int val = 0;   if(hm[j].get(curr) != null)  val = hm[j].get(curr);   if(prev + 1 <= val)  return;   hm[j].put(curr, prev + 1); }  public void run() {   InputReader s = new InputReader(System.in);  PrintWriter w = new PrintWriter(System.out);   int n = s.nextInt();   int[] a = new int[n];   HashMap<Integer, Integer>[] hm = new HashMap[n];   for(int i = 0; i < n; i++) {  a[i] = s.nextInt();  hm[i] = new HashMap<Integer, Integer>();  }   HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();   for(int i = 0; i < n; i++) {    int curr = 0;    for(int j = i; j < n; j++) {   curr += a[j];   addMap(curr, map, hm, j);  }    for(Map.Entry<Integer, Integer> e : hm[i].entrySet()) {     if(map.get(e.getKey()) != null && map.get(e.getKey()) >= e.getValue())   continue;     map.put(e.getKey(), e.getValue());  }  }   int key = -1;  int value = 0;   for(Map.Entry<Integer, Integer> e : map.entrySet()) {    if(e.getValue() > value) {   key = e.getKey(); value = e.getValue();  }  }   w.println(value);   int prev = -1;   for(int i = 0; i < n; i++) {    int curr = 0;    for(int j = i; j > prev; j--) {     curr += a[j];     if(curr == key) {   w.println((j + 1) + " " + (i + 1));   prev = i;   break;   }  }  }   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 cf1(),"cf1",1<<26).start(); } }
6	public class mainE {  public static PrintWriter out = new PrintWriter(System.out);  public static FastScanner enter = new FastScanner(System.in);  public static void main(String[] args) throws IOException {   int t=enter.nextInt();   for (int i = 0; i < t; i++) {    solve();   }   out.close();  }  public static int[][] arr=new int[13][2010];  public static pair[] par= new pair[2010];  private static void solve() throws IOException{   int n=enter.nextInt();   int m=enter.nextInt();   for (int i = 0; i <n ; i++) {    for (int j = 0; j <m ; j++) {     arr[i][j]=enter.nextInt();    }   }   for (int i = 0; i <n ; i++) {    for (int j = m; j <m+3 ; j++) {     arr[i][j]=0;    }   }   m=m+3;   for (int i = 0; i <m ; i++) {    int max=-1;    for (int j = 0; j <n ; j++) {     max=Math.max(arr[j][i], max);    }    par[i]=new pair(max,i);   }   Arrays.sort(par,0,m, pair::compareTo);   int i0=par[0].st;   int i1=par[1].st;   int i2=par[2].st;   int i3=par[3].st;   int ans=-1;   for (int i = 0; i <n ; i++) {    for (int j = 0; j <n ; j++) {     for (int k = 0; k <n ; k++) {      for (int l = 0; l <n ; l++) {       int first=Math.max(Math.max(arr[i][i0],arr[j][i1]), Math.max(arr[k][i2],arr[l][i3]));       int second=Math.max(Math.max(arr[(i+1)%n][i0],arr[(j+1)%n][i1]), Math.max(arr[(k+1)%n][i2],arr[(l+1)%n][i3]));       int third=Math.max(Math.max(arr[(i+2)%n][i0],arr[(j+2)%n][i1]), Math.max(arr[(k+2)%n][i2],arr[(l+2)%n][i3]));       int fourth=Math.max(Math.max(arr[(i+3)%n][i0],arr[(j+3)%n][i1]), Math.max(arr[(k+3)%n][i2],arr[(l+3)%n][i3]));       if(n==1) {        second=0;        third=0;        fourth=0;       }       else if(n==2){        third=0;        fourth=0;       }       else if(n==3){        fourth=0;       }       ans=Math.max(ans, first+second+fourth+third);      }     }    }   }   System.out.println(ans);   }  static class pair implements Comparable<pair>{   int max,st;   public pair(int max, int st) {    this.max = max;    this.st = st;   }   @Override   public int compareTo(pair o) {    return -Integer.compare(max, o.max);   }  }  static class FastScanner {   BufferedReader br;   StringTokenizer stok;   FastScanner(InputStream is) {    br = new BufferedReader(new InputStreamReader(is));   }   String next() throws IOException {    while (stok == null || !stok.hasMoreTokens()) {     String s = br.readLine();     if (s == null) {      return null;     }     stok = new StringTokenizer(s);    }    return stok.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());   }   char nextChar() throws IOException {    return (char) (br.read());   }   String nextLine() throws IOException {    return br.readLine();   }  } }
5	public class Main {  void A(){  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int a = sc.nextInt();  int b = sc.nextInt();  int[] h = new int[n];  for(int i=0; i<n; i++){  h[i] = sc.nextInt();  }  Arrays.sort(h);  System.out.println(h[b]-h[b-1]); }  public static void main(String[] args) {  new Main().A(); } }
0	public class C { static long n = 0;  static void R (long a,long b){  n += a/b;  a = a%b;  if(a==0) return;  R(b,a);  } public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  long a = sc.nextLong();  long b = sc.nextLong();  R(a,b);  System.out.println(n); } }
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(in, out);   out.close();  } } class TaskA {  int n;  int m;  String answer = "I'm too stupid to solve this problem";  public void solve(InputReader in, PrintWriter out) {   n = in.nextInt();   out.println("0 0 " + n);    }     } 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());  } }
1	public class B {  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();    if(n%2==1) {     ans.append("NO\n");     continue;    }    n/=2;    double sq=Math.sqrt(n);    if(Math.floor(sq)==Math.ceil(sq)) {     ans.append("YES\n");     continue;    }    if(n%2==1) {     ans.append("NO\n");     continue;    }    n/=2;    sq=Math.sqrt(n);    if(Math.floor(sq)==Math.ceil(sq)) {     ans.append("YES\n");     continue;    }    ans.append("NO\n");   }   System.out.println(ans);  } }
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 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);   }  } }
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);  } }
3	public class Main{ static HashMap<Integer,ArrayList<seg>> ma; static class seg{  seg(int a,int b){  l=a;r=b;  }  int l,r; } static int n,sum,dex; static int arr[]=new int[1600]; public static void main(String argas[]){  Scanner cin=new Scanner(System.in);  ma=new HashMap();  n=cin.nextInt();  for(int i=1;i<=n;i++){  arr[i]=cin.nextInt();  sum=0;  for(int j=i;j>0;j--){   sum+=arr[j];   if(ma.containsKey(sum)) ma.get(sum).add(new seg(j,i));   else {   ma.put(sum, new ArrayList<seg>());   ma.get(sum).add(new seg(j,i));   }  }  }  int ans=0,te;  ArrayList<seg> best=new ArrayList(),now,temp;  Iterator it=ma.entrySet().iterator();  while(it.hasNext()){  now=new ArrayList();  te=0;  Map.Entry entry=(Map.Entry) it.next();  temp=(ArrayList<seg>) entry.getValue();  dex=0;  for(int i=0;i<temp.size();i++){   if(temp.get(i).l>dex){   dex=temp.get(i).r;   te++;   now.add(new seg(temp.get(i).l,temp.get(i).r));   }  }  if(te>ans){   ans=te;   best=now;  }  }  System.out.println(ans);  for(int i=0;i<best.size();i++){  System.out.println(best.get(i).l+" "+best.get(i).r);  } } }
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());   }  } }
2	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 {   long n,x,y,c;  public void solve(int testNumber, FastScanner in, FastPrinter out) {  n=in.nextLong(); x=in.nextLong(); y=in.nextLong(); c=in.nextLong(); long td=-1,tup=2*(n-1);  while(Math.abs(td-tup)>1){  long mid=(td+tup)/2;   if(chk(mid))tup=mid;   else td=mid;  }   out.println(tup);  }  private boolean chk(long t) {  long ct=-3;   long d=x,w=y;   if(w>d){    long tt=w;    w=d;d=tt;   }   if(t>=d+w-2) ct+=d*w;   else if(t<w&&t<d) {       ct+=(t+1)*(t+2)/2;   }   else if(t>=w&&t<d) {       ct+=w*(w+1)/2;    long k=t-(w-1);    ct+=k*w;   }   else if(t>=w&&t>=d) {        ct+=w*d;    long k=w-2-(t-d);    ct-=k*(k+1)/2;   }     w=x;d=n+1-y;   if(w>d){    long tt=w;    w=d;d=tt;   }   if(t>=d+w-2) ct+=d*w;   else if(t<w&&t<d) {       ct+=(t+1)*(t+2)/2;   }   else if(t>=w&&t<d) {       ct+=w*(w+1)/2;    long k=t-(w-1);    ct+=k*w;   }   else if(t>=w&&t>=d) {        ct+=w*d;    long k=w-2-(t-d);    ct-=k*(k+1)/2;   }   w=n+1-x;d=y;   if(w>d){    long tt=w;    w=d;d=tt;   }   if(t>=d+w-2) ct+=d*w;   else if(t<w&&t<d) {       ct+=(t+1)*(t+2)/2;   }   else if(t>=w&&t<d) {       ct+=w*(w+1)/2;    long k=t-(w-1);    ct+=k*w;   }   else if(t>=w&&t>=d) {        ct+=w*d;    long k=w-2-(t-d);    ct-=k*(k+1)/2;   }   w=n+1-x;d=n+1-y;   if(w>d){    long tt=w;    w=d;d=tt;   }   if(t>=d+w-2) ct+=d*w;   else if(t<w&&t<d) {       ct+=(t+1)*(t+2)/2;   }   else if(t>=w&&t<d) {       ct+=w*(w+1)/2;    long k=t-(w-1);    ct+=k*w;   }   else if(t>=w&&t>=d) {        ct+=w*d;    long k=w-2-(t-d);    ct-=k*(k+1)/2;   }   ct-=Math.min(t,x-1);   ct-=Math.min(t,y-1);   ct-=Math.min(t,n-x);   ct-=Math.min(t,n-y);     if(ct>=c)return true;   else   return false;  } } 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 long nextLong() {   return Long.parseLong(next());  }  public String readLine() {   try {    return super.readLine();   } catch (IOException e) {    return null;   }  }  } class FastPrinter extends PrintWriter {  public FastPrinter(OutputStream out) {   super(out);  }  public FastPrinter(Writer out) {   super(out);  }  }
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(); } }
1	public class Solution {  public static void main(String str[]) throws Exception{   Scanner sc = new Scanner(System.in);   BufferedWriter output = new BufferedWriter(     new OutputStreamWriter(System.out));   int t = sc.nextInt();   while(t-->0){    int n = sc.nextInt();    if((n%2==0 && Math.pow(n/2,0.5)%1.0==0) || (n%4==0 && Math.pow(n/4,0.5)%1.0==0) ) output.write("YES\n");    else {     output.write("NO\n");    }   }   output.flush();  } }
5	public class Main {   public static void main(String[] args) throws IOException {     BufferedReader in=new BufferedReader(new InputStreamReader(System.in));   PrintWriter out=new PrintWriter(System.out);   int mod=1000000007;   String[] input=in.readLine().split(" ");   int n=Integer.parseInt(input[0]);   int a=Integer.parseInt(input[1]);   int b=Integer.parseInt(input[2]);   String[] h=in.readLine().split(" ");   int[] mas=new int[n];   for(int i=0; i<n; i++){    mas[i]=Integer.parseInt(h[i]);   }   Arrays.sort(mas);   int l=mas[b-1];   int r=mas[b];   int count=0;   if(l==r) count=0;   else count=r-l;   out.println(count);   out.close();  } }
3	public class Main {  public static void main(String args[]) {   Scanner sc = new Scanner(System.in);   int n=sc.nextInt();   int arr[]=new int[n];   for (int i=0;i<n;i++){    arr[i]=sc.nextInt();   }   boolean vis[]=new boolean[n];   int c=0;   for (int i=0;i<n;i++){    int min=200;    for (int j=0;j<n;j++){     if (!vis[j] && min>arr[j]){      min=arr[j];     }    }    for (int j=0;j<n;j++){     if (!vis[j]&&arr[j]%min==0){      vis[j]=true;     }    }    if (min!=200){     c++;    }else break;   }   System.out.println(c);  } }
1	public class Test5 {  static StreamTokenizer st = new StreamTokenizer(new InputStreamReader(System.in));  static int[] m;  public static void main(String[] z) throws Exception {   PrintWriter pw = new PrintWriter(System.out);   Scanner s = new Scanner(System.in);   int a = ni(), b=ni(), o=2;   m = new int[a];   for(int q=0; q<a; q++) m[q] = ni();   Arrays.sort(m);   for(int q=1; q<a; q++){    if(m[q]-m[q-1]==b*2) o++;    else if(m[q]-m[q-1]>b*2) o+=2;   }   System.out.println(o);   pw.flush();  }  static int ni() throws Exception{   st.nextToken();   return (int)st.nval;  }  static String ns() throws Exception{   st.nextToken();   return st.sval;  }  static long gcd(long a, long b){   for(; a>0 && b>0;)    if(a>b) a%=b;   else b%=a;   return a+b;  }  static class PyraSort {   private static int heapSize;   public static void sort(int[] a) {    buildHeap(a);    while (heapSize > 1) {     swap(a, 0, heapSize - 1);     heapSize--;     heapify(a, 0);    }   }   private static void buildHeap(int[] a) {    heapSize = a.length;    for (int i = a.length / 2; i >= 0; i--) {     heapify(a, i);    }   }   private static void heapify(int[] a, int i) {    int l = 2 * i + 2;    int r = 2 * i + 1;    int largest = i;    if (l < heapSize && a[i] < a[l]) {     largest = l;    }    if (r < heapSize && a[largest] < a[r]) {     largest = r;    }    if (i != largest) {     swap(a, i, largest);     heapify(a, largest);    }   }   private static void swap(int[] a, int i, int j) {    a[i] ^= a[j] ^= a[i];    a[j] ^= a[i];   }  } }
2	public class B implements Runnable {    private static final String TASK_NAME_FOR_IO = "";    private static final String FILE_IN = TASK_NAME_FOR_IO + ".in";  private static final String FILE_OUT = TASK_NAME_FOR_IO + ".out";  BufferedReader in;  PrintWriter out;  StringTokenizer tokenizer = new StringTokenizer("");  public static void main(String[] args) {   new Thread(new B()).start();  }  private void solve() throws IOException {   long n = nextLong();   long k = nextLong();   n--;   k--;   long answer = 0;   while (n > 0 && k >= 1) {    if (k > 2000) {     long step1000 = (k + (k - 999)) * 500;     if (n - step1000 >= 0) {      n -= step1000;      answer += 1000;      k -= 1000;      continue;     }    }    if (n - k >= 0) {     n -= k;     answer++;    }    k--;    k = Math.min(n, k);   }   if (n == 0) {    out.println(answer);   } else {    out.println(-1);   }  }  public void run() {   long timeStart = System.currentTimeMillis();   boolean fileIO = TASK_NAME_FOR_IO.length() > 0;   try {    if (fileIO) {     in = new BufferedReader(new FileReader(FILE_IN));     out = new PrintWriter(new FileWriter(FILE_OUT));    } else {     in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(new OutputStreamWriter(System.out));    }    solve();    in.close();    out.close();   } catch (IOException e) {    throw new IllegalStateException(e);   }   long timeEnd = System.currentTimeMillis();   if (fileIO) {    System.out.println("Time spent: " + (timeEnd - timeStart) + " ms");   }  }  private String nextToken() throws IOException {   while (!tokenizer.hasMoreTokens()) {    String line = in.readLine();    if (line == null) {     return null;    }    tokenizer = new StringTokenizer(line);   }   return tokenizer.nextToken();  }  private int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  private BigInteger nextBigInt() throws IOException {   return new BigInteger(nextToken());  }  private long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  private double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
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;  } }
5	public class CF22_1 {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);   int num=sc.nextInt();  if(num!=1)  {   ArrayList<Integer>data=new ArrayList<Integer>();   for (int i=0;i<num;i++){    data.add(sc.nextInt());      }   Collections.sort(data);     int ind=1;    while( data.get(ind-1)==data.get(ind) )    {    ind++;    if(ind ==data.size())     break;    }     if(data.size()>ind)   System.out.println(data.get(ind));   else    System.out.println("NO");       }  else   System.out.println("NO");  }  }
0	public class p343a {  public static void main(String args[])  {   Scanner sc = new Scanner(System.in);   System.out.println();   long a = sc.nextLong();   long b = sc.nextLong();   if(a==b) System.out.println("1");   else if(b==1) System.out.println(a);   else if(a==1) System.out.println(b);   else if(a>b) System.out.println(count(a,b));   else System.out.println(count(b,a));  }  public static long count(long a,long b)  {   long count = 0;   while(b!=1)   {    long c = a/b;    count += c;    long d = a-(c*b);    a = b;    b = d;    if(b==1)    {     count += a;     break;    }   }   return count;  } }
3	public class TaskF {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[] a = new int[n + 1];   for (int i = 1; i <= n; i++) {    a[i] = in.nextInt();   }   int[] prefixSum = new int[n + 1];   prefixSum[0] = 0;   for (int i = 1; i <= n; i++) {    prefixSum[i] = prefixSum[i - 1] + a[i];   }   Map<Integer, List<Segment>> sumToSegments = new HashMap<>();   for (int i = 1; i <= n; i++) {    for (int j = i; j <= n; j++) {     int sum = prefixSum[j] - prefixSum[i - 1];     sumToSegments       .computeIfAbsent(sum, $ -> new ArrayList<>())       .add(Segment.make(i, j));    }   }   List<Segment> bestSegments = null;   for (int sum : sumToSegments.keySet()) {    List<Segment> segments = sumToSegments.get(sum);    int size = segments.size();    int[] f = new int[size];    int[] next = new int[size];    boolean[] take = new boolean[size];    f[size - 1] = 1;    next[size - 1] = -1;    take[size - 1] = true;    int bestStartIndex = size - 1;    for (int i = size - 2; i >= 0; i--) {     int nextIndex;     if (segments.get(i).q >= segments.get(size - 1).p) {      nextIndex = -1;     } else {      int L = i + 1;      int R = size - 1;      while (L < R) {       int M = (L + R) / 2;       if (segments.get(i).q >= segments.get(M).p) {        L = M + 1;       } else {        R = M;       }      }      nextIndex = L;     }     f[i] = 1 + ((nextIndex == -1) ? 0 : f[nextIndex]);     next[i] = nextIndex;     take[i] = true;     if (f[i + 1] > f[i]) {      take[i] = false;      f[i] = f[i + 1];      next[i] = i + 1;     }     if (bestStartIndex == -1 || f[i] > f[bestStartIndex]) {      bestStartIndex = i;     }    }        List<Segment> maxForSum = new ArrayList<>();    int index = bestStartIndex;    do {     if (take[index]) {      maxForSum.add(segments.get(index));     }     index = next[index];    } while (index != -1);    if (bestSegments == null || maxForSum.size() > bestSegments.size()) {     bestSegments = maxForSum;    }   }   System.out.println(bestSegments.size());   for (Segment segment : bestSegments) {    System.out.printf("%s %s%n", segment.p, segment.q);   }   in.close();  }  private static class Segment {   public final int p;   public final int q;   private Segment(int p, int q) {    this.p = p;    this.q = q;   }   public static Segment make(int p, int q) {    return new Segment(p, q);   }  } }
3	public final class Solution {  BufferedReader br;  StringTokenizer st;   {   st = null;   br = new BufferedReader(new InputStreamReader(System.in));  }   public static void main(String[] args) throws Exception {   new Solution().run();  }   void run() throws Exception {   int n = ni();   int[] a = new int[n];   for(int i=0; i<n; i++) a[i] = ni();   for(int i=1; i<n; i++) a[i] += a[i-1];     HashMap<Integer, List<Point>> map = new HashMap<>();   for(int i=0; i<n; i++) {    for(int j=i; j<n; j++) {     int sum = getSum(a, i, j);     if(!map.containsKey(sum)) map.put(sum, new ArrayList<>());     map.get(sum).add(new Point(i+1, j+1));    }   }     for(int key : map.keySet()) {    Collections.sort(map.get(key), new Comparator<Point>() {     @Override     public int compare(Point p1, Point p2) {      if(p1.x == p2.x) return p1.y - p2.y;      return p1.x - p2.x;     }    });   }     Stack<Point> stack = new Stack<>();   for(int key : map.keySet()) {    Stack<Point> st = getPairs(map.get(key));    if(st.size() > stack.size()) stack = st;   }     pl(stack.size());   while(!stack.isEmpty()) {    Point p = stack.pop();    pl(p.x + " " + p.y);   }  }   Stack<Point> getPairs(List<Point> list) {   Stack<Point> stack = new Stack<>();   stack.push(list.get(0));   for(int i=1; i<list.size(); i++) {    Point p = list.get(i);    if(p.x >= stack.peek().x && p.x <= stack.peek().y) {     Point p2 = stack.pop();     if(p2.y < p.y) {      stack.push(p2);     } else {      stack.push(p );     }    } else {     stack.push(p);    }   }   return stack;  }   int getSum(int[] a, int l, int r) {   return (l == 0) ? a[r] : a[r] - a[l-1];  }   class Node {   HashSet<Integer> adj;   public Node() {    adj = new HashSet<>();   }  }     String nt() throws Exception {   if(st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine(), " ");   }   return st.nextToken();  }   int ni() throws Exception {   return Integer.parseInt(nt());  }   long nl() throws Exception {   return Long.parseLong(nt());  }   void p(Object o) {   System.out.print(o);  }   void pl(Object o) {   System.out.println(o);  } }
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 = new int[n];   int sum = 0;   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();    sum += a[i];   }   Arrays.sort(a);   int res = 0;   int mySum = 0;   int hisSum = sum;   for (int i = n - 1; i >= 0; i--) {    mySum += a[i];    hisSum -= a[i];    res++;    if (mySum > hisSum) break;   }   out.println(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 (IOException e) {     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }  public int nextInt() {   return Integer.parseInt(next());  }   } class OutputWriter {  private final PrintWriter writer;  public OutputWriter(OutputStream outputStream) {   writer = new PrintWriter(outputStream);  }  public OutputWriter(Writer writer) {   this.writer = new PrintWriter(writer);  }  public void print(Object... objects) {   for (int i = 0; i < objects.length; i++) {    writer.print(objects[i]);   }  }  public void println(Object... objects) {   print(objects);   writer.println();  }  public void close() {   writer.close();  } }
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; } }
4	public class Main {  static boolean LOCAL = false;  Scanner sc = new Scanner(System.in);   void run() {   char[] cs = sc.nextLine().toCharArray();   int res = 0;   for (int s1 = 0; s1 < cs.length; s1++) {    for (int s2 = s1 + 1; s2 < cs.length; s2++) {     int len = 0;     while (s2 + len < cs.length && cs[s1 + len] == cs[s2 + len]) {      len++;     }     res = max(res, len);    }   }   System.out.println(res);  }   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();  } }
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);   ARaskrashivanieChisel solver = new ARaskrashivanieChisel();   solver.solve(1, in, out);   out.close();  }  static class ARaskrashivanieChisel {   public void solve(int testNumber, InputReader in, OutputWriter out) {    final int MAX = 100;    int n = in.nextInt();    int[] a = in.nextSortedIntArray(n);    int ret = 0;    boolean[] used = new boolean[MAX + 1];    for (int i = 0; i < n; i++) {     if (!used[a[i]]) {      used[a[i]] = true;      ret++;      for (int j = i + 1; j < n; j++) {       if (a[j] % a[i] == 0 && !used[a[j]]) {        used[a[j]] = true;       }      }     }    }    out.println(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 close() {    writer.close();   }   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 int[] nextIntArray(int n) {    int[] array = new int[n];    for (int i = 0; i < n; ++i) array[i] = nextInt();    return array;   }   public int[] nextSortedIntArray(int n) {    int array[] = nextIntArray(n);    Arrays.sort(array);    return array;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
5	public class CFA {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  private static long MOD = 1000L * 1000L * 1000L + 7;  private static final int[] dx = {0, -1, 0, 1};  private static final int[] dy = {1, 0, -1, 0};  private static final String yes = "Yes";  private static final String no = "No";  int n;  int m;  char[][] mat;  long base = 397;  void solve() throws IOException {   n = nextInt();   m = nextInt();   mat = new char[n][m];   for (int i = 0; i < n; i++) {    mat[i] = nextString().toCharArray();   }   int alpha = 26;   long[] pow = new long[alpha];   pow[0] = 1;   for (int i = 1; i < alpha; i++) {    pow[i] = pow[i - 1] * base % MOD;   }   long res = 0;   for (int l = 0; l < m; l++) {       long[] hash = new long[n];    long[] mask = new long[n];    for (int r = l; r < m; r++) {     for (int i = 0; i < n; i++) {      hash[i] += pow[mat[i][r] - 'a'];      hash[i] %= MOD;      mask[i] = mask[i] ^ (1L << (mat[i][r] - 'a'));     }     int start = 0;     while (start < n) {      if ((mask[start] & (mask[start] - 1)) != 0) {       start++;       continue;      }      int end = start;      List<Long> l1 = new ArrayList<>();      while (end < n && (mask[end] & (mask[end] - 1)) == 0) {       l1.add(hash[end]);       end++;      }      start = end;      res += manacher(l1);     }    }   }   outln(res);  }  long manacher(List<Long> arr) {   int len = arr.size();   long[] t = new long[len * 2 + 3];   t[0] = -1;   t[len * 2 + 2] = -2;   for (int i = 0; i < len; i++) {    t[2 * i + 1] = -3;    t[2 * i + 2] = arr.get(i);   }   t[len * 2 + 1] = -3;   int[] p = new int[t.length];   int center = 0, right = 0;   for (int i = 1; i < t.length - 1; i++) {    int mirror = 2 * center - i;    if (right > i) {     p[i] = Math.min(right - i, p[mirror]);    }        while (t[i + (1 + p[i])] == t[i - (1 + p[i])]) {     p[i]++;    }           if (i + p[i] > right) {     center = i;     right = i + p[i];    }   }   long res = 0;   for (int i = 0; i < 2 * len; i++) {    int parLength = p[i + 2];    if (i % 2 == 0) {     res += (parLength + 1) / 2;    }    else {     res += parLength / 2;    }   }   return res;  }  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);  }  private void formatPrint(double val) {   outln(String.format("%.9f%n", val));  }  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());  } }
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 a = in.nextLong();   long b = in.nextLong();   long res = 0;   while (b > 0) {    res += a / b;    long t = a % b;    a = b;    b = t;   }   out.println(res);  } } class InputReader {  public BufferedReader reader;  public 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 long nextLong() {   return Long.parseLong(next());  }  }
4	public class C {  static class Struct {   int x, y, count;   public Struct(int xx, int yy, int c) {    x = xx;    y = yy;    count = c;   }  }  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(new FileReader("input.txt"));   int n = sc.nextInt();   int m = sc.nextInt();   FileWriter fw=new FileWriter("output.txt");   boolean[][] grid = new boolean[n][m];   int[] dx = new int[] { 1, 0, -1, 0 };   int[] dy = new int[] { 0, -1, 0, 1 };   int k = sc.nextInt();   LinkedList<Struct> a = new LinkedList<Struct>();   for (int i = 0; i < k; i++) {    a.add(new Struct(sc.nextInt() - 1, sc.nextInt() - 1, 0));   }   int max = Integer.MIN_VALUE, maxX = -1, maxY = -1;   while (!a.isEmpty()) {    Struct tmp = a.remove();    if (grid[tmp.x][tmp.y] == true)     continue;    grid[tmp.x][tmp.y] = true;    if (tmp.count > max) {     max = tmp.count;     maxX = tmp.x;     maxY = tmp.y;    }    for (int i = 0; i < 4; i++) {     int nx = tmp.x + dx[i];     int ny = tmp.y + dy[i];     if (nx < n && nx >= 0 && ny < m && ny >= 0) {      if (grid[nx][ny] == false) {       a.add(new Struct(nx, ny, tmp.count + 1));      }     }    }   }   fw.write((maxX + 1) + " " + (maxY + 1)+"\n");   System.out.println((maxX + 1) + " " + (maxY + 1));   fw.flush();  } }
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());  } }
1	public class B {  public static void main(String[] args){   Scanner in = new Scanner(System.in);   int t = in.nextInt();   while(t > 0){    t --;    int n = in.nextInt();    if(n % 2 != 0){     System.out.println("NO");     continue;    }    int a = n / 2;    int x = (int)Math.sqrt(a);    if(x * x == a || (x + 1) * (x + 1) == a){     System.out.println("YES");     continue;    }    a = n / 4;    if(n % 4 != 0){     System.out.println("NO");     continue;    }    x = (int)Math.sqrt(a);    if(x * x == a || (x + 1) * (x + 1) == a){     System.out.println("YES");     continue;    }    System.out.println("NO");    }   } }
5	public class Solution implements Runnable {        public void solve() throws Exception {     int n = sc.nextInt();   int a = sc.nextInt();   int b = sc.nextInt();   long h[] = new long[n];     for (int i = 0;i < n; ++ i) {    h[i] = sc.nextLong();   }   Arrays.sort(h);   long l = h[n - a];   long r = h[n - a - 1];   out.println(l - r);  }           static String filename = "";  static boolean fromFile = false;   BufferedReader in;  PrintWriter out;  FastScanner sc;   public static void main(String[] args) {   new Thread(null, new Solution(), "", 1 << 25).start();  }   public void run() {   try {    init();    solve();   } catch (Exception e) {    throw new RuntimeException(e);   } finally {    out.close();   }  }   void init() throws Exception {   if (fromFile) {    in = new BufferedReader(new FileReader(filename+".in"));    out = new PrintWriter(new FileWriter(filename+".out"));   } else {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);   }   sc = new FastScanner(in);  } } 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());  }   public BigInteger nextBigInteger() throws IOException {   return new BigInteger(nextToken());  }   public BigDecimal nextBigDecimal() throws IOException {   return new BigDecimal(nextToken());  } }
5	public class A implements Runnable{     public void run() {   int n = nextInt();   int[] arr = new int[n];   boolean allOne = true;   for (int i = 0; i < n; ++i) {    arr[i] = nextInt();    if (arr[i] != 1) {     allOne = false;    }   }   Arrays.sort(arr);   if (!allOne) {    out.print("1 ");   }   for (int i = 0; i < n-1; ++i) {    out.print(arr[i] + " ");   }   if (allOne) {    out.print("2");   }   out.println();   out.flush();  }   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 A())).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());  }    }
5	public class A { public static void main(String args[]){  Scanner in = new Scanner(System.in); int n=in.nextInt(),s=0; int[] a= new int[n]; for (int i=0;i<n;i++) {a[i]=in.nextInt(); s+=a[i];} Arrays.sort(a); int k=0,ans=0; for (int i=n-1;i>=0;i--)  if (k<=s/2) {k+=a[i];ans++;} System.out.println(ans);     }  }
2	public class prob {   public static long ans(long x, long y, long p)  {   long r = 1;    x = x % p;   while (y > 0)   {    if((y & 1)==1)     r = (r * x) % p;    y = y >> 1;    x = (x * x) % p;   }   return r;  } public static void main (String[] args) throws java.lang.Exception {  Scanner scan = new Scanner(System.in);  long x = scan.nextLong();  long k = scan.nextLong();  long v = 1000000007L;  if(x>0){  long p = ((2*x)-1)%v;  long a = ans(2L,k,v);  long b = (p*a)%v;  System.out.println((b+1)%v);  }  else{  System.out.println(0);  } } }
5	public class A135 {  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();   }   Arrays.sort(arr);   int[] ans = new int[n];     if (arr[n-1] == 1) {    for (int i = 0 ;i < n; i++) {     ans[i] = arr[i];    }    ans[n-1] = 2;   } else {    ans[0] = 1;    for (int i = 1; i < n; i++) {     ans[i] = arr[i-1];    }   }   StringBuffer buf = new StringBuffer();   for (int i = 0; i < n; i++) {    buf.append(ans[i]);    if (i != n-1) buf.append(' ');   }   System.out.print(buf.toString());  } }
1	public class Solution {  StreamTokenizer in;  PrintWriter out;  public static void main(String[] args) throws Exception {   new Solution().run();  }  public void run() throws Exception {   in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));   out = new PrintWriter (new OutputStreamWriter(System.out));   solve();   out.flush();  }  int nextInt() throws Exception {   in.nextToken();   return (int) in.nval;  }  String next() throws Exception {   in.nextToken();   return in.sval;  }  public void solve() throws Exception {   int n=nextInt();   String s=next();   String ss = s + s;   int t = 0;   for (int i = 0; i < n; i++) {    if (s.charAt(i) == 'T') {     t++;    }   }   if (t == 1 || t == n - 1) {    out.println(0);   } else {    int sum = 0;    for (int i = 0; i < t; i++) {     if (s.charAt(i) == 'T') {      sum++;     }    }       int max = sum;    for (int i = 0; i < s.length(); i++) {     if (ss.charAt(i) == 'T') {      if (ss.charAt(i + t) == 'H') {       sum--;      }     } else {      if (ss.charAt(i + t) == 'T') {       sum++;       max = Math.max(max, sum);      }     }    }    out.println(t - max);   }  } }
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()); } }
0	public class LuckyDivision{  public static void main(String [] args){   Scanner input = new Scanner(System.in);   int a = input.nextInt();   if(a%4 == 0) System.out.println("YES");   else if(a%7 == 0) System.out.println("YES");   else if(a%47 == 0) System.out.println("YES");   else if(a%74 == 0) System.out.println("YES");   else if(a%447 == 0) System.out.println("YES");   else if(a%474 == 0) System.out.println("YES");   else if(a%477 == 0) System.out.println("YES");   else if(a%747 == 0) System.out.println("YES");   else if(a%774 == 0) System.out.println("YES");   else System.out.println("NO");  } }
5	public class A {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int k = in.nextInt() - 1;   Point[] A = new Point[n];   for (int i = 0; i < n; i++)    A[i] = new Point(in.nextInt(), in.nextInt());   Arrays.sort(A, new Comparator<Point>() {    public int compare(Point o1, Point o2) {     if (o1.x != o2.x)      return o2.x - o1.x;     if (o1.y != o2.y)      return o1.y - o2.y;     return 0;    }   });   int i = k;   int j = k;   while (i >= 0 && A[i].x == A[k].x && A[i].y == A[k].y)    i--;   while (j < n && A[j].x == A[k].x && A[j].y == A[k].y)    j++;   System.out.println(j - i - 1);  } }
0	public class Hexadecimal {  public static void main(String [] args){   Scanner s = new Scanner(new InputStreamReader(System.in));   int x = s.nextInt();   System.out.println(x + " " + 0 + " " + 0);  } }
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);   APaintTheNumbers solver = new APaintTheNumbers();   solver.solve(1, in, out);   out.close();  }  static class APaintTheNumbers {   public void solve(int testNumber, FastReader s, PrintWriter w) {    int n = s.nextInt();    boolean[] b = new boolean[n];    int[] a = new int[n];    int ans = 0;    for (int i = 0; i < n; i++) {     a[i] = s.nextInt();    }    func.sort(a);    for (int i = 0; i < n; i++) {     if (!b[i]) {      ans++;      b[i] = true;      for (int j = i + 1; j < n; j++) {             if (a[j] % a[i] == 0) {        b[j] = true;       }      }     }    }    w.println(ans);   }  }  static class FastReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private FastReader.SpaceCharFilter filter;   public FastReader(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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  static class func {   public static void sort(int[] arr) {    int n = arr.length, mid, h, s, l, i, j, k;    int[] res = new int[n];    for (s = 1; s < n; s <<= 1) {     for (l = 0; l < n - 1; l += (s << 1)) {      h = Math.min(l + (s << 1) - 1, n - 1);      mid = Math.min(l + s - 1, n - 1);      i = l;      j = mid + 1;      k = l;      while (i <= mid && j <= h) res[k++] = (arr[i] <= arr[j] ? arr[i++] : arr[j++]);      while (i <= mid) res[k++] = arr[i++];      while (j <= h) res[k++] = arr[j++];      for (k = l; k <= h; k++) arr[k] = res[k];     }    }   }  } }
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(); } } }
0	public class Main implements Runnable {      public void solve() throws Throwable {   long a = sc.nextLong();   long b = sc.nextLong();   long ans = 0;   while (a > 0 && b > 0) {    if (a > b) {     ans += a/b;     a %= b;    } else {     ans += b/a;     b %= a;    }   }   out.println(ans);  }   static Throwable t;   BufferedReader reader;  FastScanner sc;  PrintWriter out;   public static void main(String[] args) throws Throwable {   Thread thread = new Thread(null, new Main(), "", 1 << 26);   thread.start();   thread.join();   if (Main.t != null)    throw t;  }  @Override  public void run() {   try {    reader = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    sc = new FastScanner(reader);    solve();   } catch (Throwable t) {    Main.t = t;   } finally {    out.close();   }  } } 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 double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }   public long nextLong() throws IOException {   return Long.parseLong(nextToken());  } }
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);  } }
3	public class Main2 {  static long mod = 998244353;  static FastScanner scanner;  static Set<Long> second = new HashSet<>();  static boolean applied = false;  public static void main(String[] args) {   scanner = new FastScanner();   int n = scanner.nextInt();   int[] a = scanner.nextIntArray(n);   int[] colors = new int[n];   ADUtils.sort(a);   int color = 0;   for (int i = 0; i < n; i++) {    if (colors[i] != 0) continue;    color++;    for (int j = i; j < n; j++) {     if (a[j] % a[i] == 0) colors[j] = color;    }   }   System.out.println(color);  }  static class WithIdx implements Comparable<WithIdx>{   int val, idx;   public WithIdx(int val, int idx) {    this.val = val;    this.idx = idx;   }   @Override   public int compareTo(WithIdx o) {    return Integer.compare(val, o.val);   }  }  public static class FastScanner {   BufferedReader br;   StringTokenizer st;   public FastScanner() {    br = new BufferedReader(new InputStreamReader(System.in));   }   String nextToken() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {           e.printStackTrace();     }    }    return st.nextToken();   }   String nextLine() {    try {     return br.readLine();    } catch (Exception e) {     e.printStackTrace();     throw new RuntimeException();    }   }   int nextInt() {    return Integer.parseInt(nextToken());   }   long nextLong() {    return Long.parseLong(nextToken());   }   double nextDouble() {    return Double.parseDouble(nextToken());   }   int[] nextIntArray(int n) {    int[] res = new int[n];    for (int i = 0; i < n; i++) res[i] = nextInt();    return res;   }   long[] nextLongArray(int n) {    long[] res = new long[n];    for (int i = 0; i < n; i++) res[i] = nextLong();    return res;   }   String[] nextStringArray(int n) {    String[] res = new String[n];    for (int i = 0; i < n; i++) res[i] = nextToken();    return res;   }  }  static class PrefixSums {   long[] sums;   public PrefixSums(long[] sums) {    this.sums = sums;   }   public long sum(int fromInclusive, int toExclusive) {    if (fromInclusive > toExclusive) throw new IllegalArgumentException("Wrong value");    return sums[toExclusive] - sums[fromInclusive];   }   public static PrefixSums of(int[] ar) {    long[] sums = new long[ar.length + 1];    for (int i = 1; i <= ar.length; i++) {     sums[i] = sums[i - 1] + ar[i - 1];    }    return new PrefixSums(sums);   }   public static PrefixSums of(long[] ar) {    long[] sums = new long[ar.length + 1];    for (int i = 1; i <= ar.length; i++) {     sums[i] = sums[i - 1] + ar[i - 1];    }    return new PrefixSums(sums);   }  }  static class ADUtils {   static void sort(int[] ar) {    Random rnd = ThreadLocalRandom.current();    for (int i = ar.length - 1; i > 0; i--)    {     int index = rnd.nextInt(i + 1);         int a = ar[index];     ar[index] = ar[i];     ar[i] = a;    }    Arrays.sort(ar);   }   static void reverse(int[] arr) {    int last = arr.length / 2;    for (int i = 0; i < last; i++) {     int tmp = arr[i];     arr[i] = arr[arr.length - 1 - i];     arr[arr.length - 1 - i] = tmp;    }   }   static void sort(long[] ar) {    Random rnd = ThreadLocalRandom.current();    for (int i = ar.length - 1; i > 0; i--)    {     int index = rnd.nextInt(i + 1);         long a = ar[index];     ar[index] = ar[i];     ar[i] = a;    }    Arrays.sort(ar);   }  }  static class MathUtils {   static long[] FIRST_PRIMES = {     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, 1009, 1013,     1019, 1021, 1031, 1033, 1039, 1049, 1051};   static long[] primes(int to) {    long[] all = new long[to + 1];    long[] primes = new long[to + 1];    all[1] = 1;    int primesLength = 0;    for (int i = 2; i <= to; i ++) {     if (all[i] == 0) {      primes[primesLength++] = i;      all[i] = i;     }     for (int j = 0; j < primesLength && i * primes[j] <= to && all[i] >= primes[j]; j++) {      all[(int) (i * primes[j])] = primes[j];     }    }    return Arrays.copyOf(primes, primesLength);   }   static long modpow(long b, long e, long m) {    long result = 1;    while (e > 0) {     if ((e & 1) == 1) {           result = (result * b) % m;     }     b = (b * b) % m;     e >>= 1;    }    return result;   }   static long submod(long x, long y, long m) {    return (x - y + m) % m;   }  } }
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");  } }
6	public class D11 {  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);  n = nextInt();  m = nextInt();   g = new boolean[n][n];  for (int i = 0; i < m; i++) {  int a = nextInt()-1, b = nextInt()-1;  g[a][b] = g[b][a] = true;  }   long ans = 0;  for (int i = n; i > 0; i--) {    long cur = calc(g, i-1);  ans += cur;  }   out.println(ans/2);   out.flush(); }  static int n, m, V; static boolean[][] g;    static long calc(boolean[][] bs,int n){   long[][] dp=new long[1<<n][n];   for(int i=0;i<n;i++){     if(bs[i][n])       dp[1<<i][i] ++;   }   for(int i=1;i<1<<n;i++){     for(int j=0;j<n;j++)if(((i>>j)&1)==1)       for(int k=0;k<n;k++)if(((i>>k)&1)==0 && bs[j][k]){         dp[i|(1<<k)][k] += dp[i][j];       }   }   long res=0;   for(int i=0;i<1<<n;i++)for(int j=0;j<n;j++)if(Integer.bitCount(i)>=2&&bs[j][n])res+=dp[i][j];   return res; } }
3	public class typeA { public static void main(String[] args) {  FastReader s = new FastReader();  int n = s.nextInt();  int[] arr = new int[n];  for(int i=0;i<n;i++) {  arr[i]=s.nextInt();  }  boolean[] arr2 = new boolean[n];  Arrays.sort(arr);  for(int i=0;i<arr2.length;i++) {  arr2[i]=true;  }   for(int i=0;i<n-1;i++) {  for(int j=i+1;j<n;j++) {   if(arr[j]%arr[i]==0) {    arr2[j]=false;   }   }  }  int count=0;  for(int i=0;i<n;i++) {  if(arr2[i]==true) {   count++;  }  }  System.out.println(count); } 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 {  public static void main(String[] args) throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer tokenizer = new StringTokenizer(reader.readLine());   int n = Integer.parseInt(tokenizer.nextToken());   int k = Integer.parseInt(tokenizer.nextToken());   System.out.println((int)(n-(-3.0+Math.sqrt(9.0+8.0*(n+k)))/2.0));  } }
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();    }   }  } }
5	public class D { public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);   BigInteger ans = BigInteger.ZERO;  int n = sc.nextInt();  int arr[] = new int[n];  long cum[] = new long[n];   for (int i = 0; i < n; i++)  arr[i] = sc.nextInt();        for (int i = 0; i < cum.length; i++)  {  cum[i] = arr[i];  if(i > 0)   cum[i] += cum[i-1];  }   for (int i = 0; i < n; i++)  ans = ans.add(BigInteger.valueOf((1l*(i+1)*arr[i] - cum[i])));   HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();  for (int i = 0; i < n; i++)  {  ans = ans.subtract(BigInteger.valueOf(map.getOrDefault(arr[i]-1, 0)));  ans = ans.add(BigInteger.valueOf(map.getOrDefault(arr[i]+1, 0)));  map.put(arr[i], map.getOrDefault(arr[i], 0)+1);  }   pw.println(ans);  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();  } } }
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 n2{  public static void main(String[] args) throws Exception{   BufferedReader in=new BufferedReader(new InputStreamReader(System.in));   int n=Integer.parseInt(in.readLine());   int[] S=new int[4];   int[] L=new int[4];   int m=0;   for(int i=0;i<n;i++){    String s=in.readLine();    if(s.charAt(s.length()-1)=='L'){     L[s.length()-1]++;    }    if(s.charAt(s.length()-1)=='S'){     S[s.length()-1]++;    }    if(s.charAt(s.length()-1)=='M'){     m++;    }   }   for(int i=0;i<n;i++){    String s=in.readLine();    if(s.charAt(s.length()-1)=='L'){     L[s.length()-1]--;    }    if(s.charAt(s.length()-1)=='S'){     S[s.length()-1]--;    }    if(s.charAt(s.length()-1)=='M'){     m--;    }   }   int count=0;   for(int i=0;i<=3;i++){    if(S[i]>0){     count+=S[i];    }    if(L[i]>0){     count+=L[i];    }   }   if(m>0){    count+=m;   }   System.out.println(count);  } }
4	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);   DExplorerSpace solver = new DExplorerSpace();   solver.solve(1, in, out);   out.close();  }  static class DExplorerSpace {   int n;   int m;   int k;   int[][] col;   int[][] row;   long[][][] memo;   public void readInput(Scanner sc) {    n = sc.nextInt();    m = sc.nextInt();    k = sc.nextInt();    col = new int[n][m - 1];    for (int i = 0; i < n; i++)     for (int j = 0; j < m - 1; j++)      col[i][j] = sc.nextInt();    row = new int[n - 1][m];    for (int i = 0; i < n - 1; i++)     for (int j = 0; j < m; j++)      row[i][j] = sc.nextInt();   }   public void solve(int testNumber, Scanner sc, PrintWriter pw) {    int q = 1;    while (q-- > 0) {     readInput(sc);     if (k % 2 == 1) {      for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++)        pw.print(-1 + " ");       pw.println();      }      return;     }     memo = new long[k + 1][n][m];     for (long[][] x : memo)      for (long[] y : x)       Arrays.fill(y, -1);     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       pw.print(2l * dp(i, j, k / 2) + " ");      }      pw.println();     }    }   }   private long dp(int i, int j, int rem) {    if (rem == 0)     return 0;    if (memo[rem][i][j] != -1)     return memo[rem][i][j];    long min = (long) 1e18;    if (j <= m - 2)     min = Math.min(min, col[i][j] + dp(i, j + 1, rem - 1));    if (j > 0)     min = Math.min(min, col[i][j - 1] + dp(i, j - 1, rem - 1));    if (i <= n - 2)     min = Math.min(min, row[i][j] + dp(i + 1, j, rem - 1));    if (i > 0)     min = Math.min(min, row[i - 1][j] + dp(i - 1, j, rem - 1));    return memo[rem][i][j] = min;   }  }  static class Scanner {   StringTokenizer st;   BufferedReader br;   public Scanner(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }   public String next() {    try {     while (st == null || !st.hasMoreTokens())      st = new StringTokenizer(br.readLine());     return st.nextToken();    } catch (Exception e) {     throw new RuntimeException(e);    }   }   public int nextInt() {    return Integer.parseInt(next());   }  } }
2	public class Main{  static StreamTokenizer in=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  static BufferedReader buffer=new BufferedReader(new InputStreamReader(System.in));  static Scanner sc=new Scanner(System.in);  static PrintWriter out=new PrintWriter(System.out);   static final int inf=10000000;  public static void main(String args[])throws Exception {   double n,k;   n=sc.nextDouble();   k=sc.nextDouble();   double ans=0;   ans=Math.sqrt(2.25+2*(n+k))-1.5;   System.out.printf("%.0f\n",n-ans);  }  static void ssort(int arr[]){   int len=arr.length;   for(int i=0;i<len;i++){    int t=(int)(len*Math.random());    int temp=arr[t];    arr[t]=arr[i];    arr[i]=temp;   }   Arrays.sort(arr);  }  static int getInt()throws Exception{   in.nextToken();   return (int)in.nval;  } } 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;  } }
4	public class substring { public static void main(String[] args) { Scanner input = new Scanner(System.in); String s = input.nextLine(); Boolean found = false; int i = s.length(); while(found==false) { i--; ArrayList<String> sub = new ArrayList<String>(); for(int j = 0; j <= s.length() - i; j++) { if(sub.contains(s.substring(j, j+i))) found = true; else sub.add(s.substring(j, j+i)); } } System.out.println(i); } }
6	public class Main {  private static final int SIM = 1; private static final int NAO = 2;  public static void main(String[] args) {  Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));   int n = in.nextInt();  int m = in.nextInt();  int[][] a = new int[n][m];  int[][] graphVerticial = null;  int[][] graphDiagonal = null;   for(int i = 0; i < n; i++) {  for(int j = 0; j < m; j++) {   a[i][j] = in.nextInt();  }  }   graphVerticial = createGraphVertical(n, m, a);  graphDiagonal = createGraphDiagonal(n, m, a);      int result = 0;  int k = 1;  int piso = 0;  int teto = 1000000000;   while(true) {    k = (int) Math.ceil((teto - piso) / 2.0) + piso;    if(isOk(n, k, graphVerticial, graphDiagonal)) {   result = Math.max(result, k);   piso = k;  }  else{   teto = k - 1;  }       if(teto <= piso) break;    }   System.out.println(result);   }  public static int[][] createGraphVertical(int n, int m, int[][] a){   int[][] graph = new int[n][n];   for(int i = 0; i < n; i++) {    for(int j = 0; j < n; j++) {     if(i == j) continue;   if(i > j) {graph[i][j] = graph[j][i]; continue;}     graph[i][j] = Integer.MAX_VALUE;     for(int k = 0; k < m; k++) {   graph[i][j] = Math.min(graph[i][j], Math.abs(a[i][k] - a[j][k]));   }  }  }   return graph; }  public static int[][] createGraphDiagonal(int n, int m, int[][] a){   int[][] graph = new int[n][n];   for(int i = 0; i < n; i++) {    for(int j = 0; j < n; j++) {     graph[i][j] = Integer.MAX_VALUE;     for(int k = 0; k < m - 1; k++) {   graph[i][j] = Math.min(graph[i][j], Math.abs(a[j][k] - a[i][k + 1]));   }  }  }   return graph; }  public static int hasPath(int n, int k, int origem, int destino, int conjunto, int[][] graph, int[][][] pd) {        if(pd[origem][destino][conjunto] != 0) return pd[origem][destino][conjunto];   if(conjunto == 0) {  return origem == destino ? SIM : NAO;  }  else if(origem == destino){  return NAO;  }   for(int i = 0; i < n; i++) {    if(i == origem) continue;    int novoConjunto = conjunto - (1 << i);  boolean pertenceConjunto = ((conjunto >> i) % 2) == 1;    if(pertenceConjunto && graph[origem][i] >= k && hasPath(n, k, i, destino, novoConjunto, graph, pd) == SIM) {   pd[origem][destino][conjunto] = SIM;   return pd[origem][destino][conjunto];  }  }   pd[origem][destino][conjunto] = NAO;   return pd[origem][destino][conjunto];   }  public static boolean isOk(int n, int k, int[][] graphVertical, int[][] graphDiagonal) {   int conjunto = (int) Math.pow(2, n) - 1;   int[][][] pd = new int[n][n][(int)Math.pow(2, n)];   for(int i = 0; i < n; i++) {    for(int j = 0; j < n; j++) {     if(i == j && n > 1) continue;     int novoConjunto = conjunto - (1 << i);     if(graphDiagonal[i][j] >= k && hasPath(n, k, i, j, novoConjunto, graphVertical, pd) == SIM) {   return true;   }     }  }   return false;   }  public static void print(int[][] graph) {   for(int i = 0; i < graph.length; i++) {    for(int j = 0; j < graph.length; j++) {      System.out.print(graph[i][j] + " ");     }    System.out.println();    }   }  public static void print(int n) {   List<Integer> bits = new Vector<>();   while(n > 0) {    bits.add(n % 2);  n /= 2;  }   for(int i = bits.size() - 1; i >= 0; i--) {  System.out.print(bits.get(i));  }   System.out.println();   }  }
0	public class e { public static class FastReader { BufferedReader br; StringTokenizer st;    public FastReader() {  br = new BufferedReader(new InputStreamReader(System.in)); }  String next() {  while (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(br.readLine());  } catch (Exception r) {   r.printStackTrace();  }  }  return st.nextToken(); }  int nextInt() {  return Integer.parseInt(next()); }  double nextDouble() {  return Double.parseDouble(next()); }  long nextLong() {  return Long.parseLong(next()); }  String nextLine() {  String str = "";  try {  str = br.readLine();  } catch (Exception r) {  r.printStackTrace();  }  return str; } } static ArrayList<String>list1=new ArrayList<String>(); static void combine(String instr, StringBuffer outstr, int index,int k) { if(outstr.length()==k) {  list1.add(outstr.toString());return; } if(outstr.toString().length()==0) outstr.append(instr.charAt(index));  for (int i = 0; i < instr.length(); i++)  {   outstr.append(instr.charAt(i));     combine(instr, outstr, i + 1,k);   outstr.deleteCharAt(outstr.length() - 1);  }  index++; } static ArrayList<ArrayList<Integer>>l=new ArrayList<>(); static void comb(int n,int k,int ind,ArrayList<Integer>list) { if(k==0) {  l.add(new ArrayList<>(list));  return; }   for(int i=ind;i<=n;i++) {  list.add(i);  comb(n,k-1,ind+1,list);   list.remove(list.size()-1);   }      }  public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));  public static void main(String[] args) {   FastReader in=new FastReader(); HashMap<Integer,Integer>map=new HashMap<Integer,Integer>();  int n=in.nextInt(); int r=in.nextInt();   double theta=(double)360/(double)n;   double b=1-((double)2/(double)(1-Math.cos((double)2*Math.PI/(double)n))); double x=Math.sqrt(1-b)-1; double ans=(double)r/(double)x; System.out.println(ans);    } }
5	public class codeforces  {   public static void main(String[] args)  {   InputReader in = new InputReader(System.in);   PrintWriter pw = new PrintWriter(System.out);   int n = in.nextInt();   long U = in.nextLong();   long[] E = new long[n];   double max = -1;     for(int i=0;i<n;i++)   E[i] = in.nextLong();     for(int k=1;k<n-1;k++)   {   int i = k + 1, j = n - 1, mid = 0;   double T = 0;      while(i < j)   {    mid = (int)Math.ceil((double)(i+j)/2);       if(E[mid] - E[k-1] <= U)    i = mid;    else    j = mid - 1;   }      j = k;   k = i;   i = j - 1;      T = E[k] - E[j];   T /= E[k] - E[i];      if(E[k] - E[i] <= U)    max = Math.max(max, T);      k = j;   }      pw.println(max);     pw.flush();   pw.close();  }        public static ArrayList Divisors(long n)  {   ArrayList<Long> div = new ArrayList<>();      for (long i=1; i<=Math.sqrt(n); i++)   {    if (n%i == 0)    {     div.add(i);           if(n/i != i)      div.add(n/i);    }   }   return div;  }    public static int BinarySearch(long[] a, long k)  {   int n = a.length;   int i = 0, j = n-1;   int mid = 0;     if(k < a[0])   return 0;   else if(k >= a[n-1])   return n;   else   {   while(j - i > 1)   {    mid = (i+j)/2;       if(k >= a[mid])    i = mid;    else    j = mid;   }   }     return i+1;  }  public static long GCD(long a,long b)  {   if(b==0)   return a;   else   return GCD(b,a%b);  }    static class pair implements Comparable<pair>  {   Integer x, y;   pair(int x,int 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 == 0 && p.y - y == 0 ;   }   return false;   }     public int hashCode()   {   return new Long(x).hashCode()*31 + new Long(y).hashCode();   }  }    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);   }  }    static class CodeX {   public static void sort(long arr[]) {    merge_sort(arr, 0, arr.length - 1);   }    private static void merge_sort(long A[], long start, long end) {    if (start < end) {     long mid = (start + end) / 2;     merge_sort(A, start, mid);     merge_sort(A, mid + 1, end);     merge(A, start, mid, end);    }    }    private static void merge(long A[], long start,long mid, long end) {    long p = start, q = mid + 1;    long Arr[] = new long[(int)(end - start + 1)];    long k = 0;     for (int i = (int)start; i <= end; i++) {     if (p > mid)      Arr[(int)k++] = A[(int)q++];      else if (q > end)      Arr[(int)k++] = A[(int)p++];      else if (A[(int)p] < A[(int)q])      Arr[(int)k++] = A[(int)p++];      else      Arr[(int)k++] = A[(int)q++];    }    for (int i = 0; i < k; i++) {     A[(int)start++] = Arr[i];    }    }   }  }
5	public class A {  public static void main(String[] args) throws IOException {   new A().run();  }  BufferedReader br;  StringTokenizer st = new StringTokenizer("");  private void run() throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));   int n = nextInt();   Set<Integer> set = new TreeSet<Integer>();   for (int i = 0; i < n; i++) {    set.add(nextInt());   }   set.remove(set.iterator().next());   PrintWriter pw = new PrintWriter(System.out);   if (set.isEmpty()) {    pw.println("NO");   } else {    pw.println(set.iterator().next());   }   pw.close();  }  int nextInt() throws IOException {   while (!st.hasMoreElements()) {    st = new StringTokenizer(br.readLine());   }   return Integer.parseInt(st.nextToken());  } }
1	public class B {  public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));  public static void main(String[] args) throws IOException {  readInput();  out.close(); }  static boolean sq(long x) {  long l = 1;  long r = (int)Math.sqrt(1e16)+1;  while (l+1<r) {  long m = (l+r)>>1;  if (m * m > x) r = m;  else l = m;  }  return l*l == x; }  static boolean solve(long x) {  if ((x&1)==1) return false;  if ((x & (x-1)) == 0) return true;  long num = 2;  while (num < x && x % num == 0) {  if (sq(x/num)) return true;  num*=2;  }  return false; }  public static void readInput() throws IOException {     int t = Integer.parseInt(br.readLine());  while (t-->0) {  int x = Integer.parseInt(br.readLine());  out.println(solve(x) ? "YES":"NO");  } } }
3	public class Main {  private static final int MAX = 5000 + 10,mod = 1000000007;  private static char [] S;  private static int n;  private static Integer [] [] dp = new Integer[MAX][MAX];  private static int solve(int pos,int open){   if(pos == n) return (open == 0) ? 1 : 0;   if (dp[pos][open] != null) return dp[pos][open];   int res = 0;   if (S[pos] == 's') {    res = solve(pos + 1,open);    if (open > 0) res += solve(pos,open - 1);    if (res >= mod) res -= mod;   }   else {    res = solve(pos+1,open + 1);   }   return dp[pos][open] = res;  }  public static void main(String[] args) throws Exception{   IO io = new IO(null,null);   n = io.getNextInt();   S = new char[n];   for (int i = 0;i < n;i++) S[i] = io.getNext().charAt(0);   io.println(solve(0,0));   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();  } }
6	public class Test { static PrintWriter writer =  new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  static int readInt() {  int ans = 0;  boolean neg = false;  try {  boolean start = false;  for (int c = 0; (c = System.in.read()) != -1; ) {   if (c == '-') {   start = true;   neg = true;   continue;   } else if (c >= '0' && c <= '9') {   start = true;   ans = ans * 10 + c - '0';   } else if (start) break;  }  } catch (IOException e) {  }  return neg ? -ans : ans; }  static long readLong() {  long ans = 0;  boolean neg = false;  try {  boolean start = false;  for (int c = 0; (c = System.in.read()) != -1; ) {   if (c == '-') {   start = true;   neg = true;   continue;   } else if (c >= '0' && c <= '9') {   start = true;   ans = ans * 10 + c - '0';   } else if (start) break;  }  } catch (IOException e) {  }  return neg ? -ans : ans; }  static String readLine() {  StringBuilder b = new StringBuilder();  try {  boolean start = false;  for (int c = 0; (c = System.in.read()) != -1; ) {   if (Character.isLetterOrDigit(c)) {   start = true;   b.append((char) c);   } else if (start) break;  }  } catch (IOException e) {  }  return b.toString(); }  public static void main(String[] args) {  Test te = new Test();  te.start();  writer.flush(); }  int[] buf = new int[10];  int best(int[][] a, int c) {  int ans = 0;  if (c == a[0].length) {  for (int i = 0; i < a.length; i++)   ans += Arrays.stream(a[i]).max().getAsInt();  return ans;  }  for (int r = 0; r <= a.length; r++) {  for (int i = 0; i < a.length; i++)   buf[(i+1) % a.length] = a[i][c];  for (int i = 0; i < a.length; i++)   a[i][c] = buf[i];  ans = Math.max(ans, best(a, c+1));  }  return ans; }  void start() {  int t = readInt();  while (t-- > 0) {  int n = readInt(), m = readInt();  int[][] a = new int[n][m];  int[][] e = new int[n*m][];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++) {   a[i][j] = readInt();   e[i*m+j] = new int[]{a[i][j], j};   }  Arrays.sort(e, (x, y) -> x[0] == y[0] ? Integer.compare(x[1], y[1])   : Integer.compare(y[0], x[0]));  Set<Integer> cols = new HashSet<>();  for (int[] x : e) {   cols.add(x[1]);   if (cols.size() >= n) break;  }  int[] cs = cols.stream().mapToInt(Integer::intValue).toArray();  int[][] na = new int[n][cs.length];  for (int i = 0; i < n; i++)   for (int j = 0; j < cs.length; j++)   na[i][j] = a[i][cs[j]];  writer.println(best(na, 0));  } } }
1	public class A {  int n;  void run()throws IOException{  Scanner sc = new Scanner(new InputStreamReader(System.in));   n = sc.nextInt();  int i,tmp,even,odd,e,o;  even=odd=e=o=0;  for(i=1;i<=n;i++){  tmp = sc.nextInt();  if(tmp%2==0){   e++;   if(even==0) even=i;  } else{   o++;   if(odd==0) odd=i;  }  }  if(e>1) System.out.println(odd);  else System.out.println(even); }  public static void main(String[] args)throws IOException {  new A().run(); } }
5	public class Main { private static StreamTokenizer in; private static PrintWriter out;  private static int nextInt() throws Exception {  in.nextToken();  return (int)in.nval; }  private static String nextString() throws Exception {  in.nextToken();  return in.sval; }  public static void main(String[] args) throws Exception {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(System.out);   int n = nextInt(), t = nextInt() * 2;  int[][] a = new int[n][2];  for (int i=0; i<n; i++) {  a[i][0] = nextInt() * 2;  a[i][1] = nextInt() * 2;  }   Arrays.sort(a, new Comparator<int[]>() {  public int compare(int[] a, int[] b) {   return a[0]>b[0]?1:a[1]<b[1]?-1:0;  }  });   int s = 2;   for (int i=0; i<n-1; i++) {  int g = (a[i+1][0]-a[i][0])-(a[i+1][1]+a[i][1])/2;  if (g > t) s += 2;  if (g == t) s+= 1;  }  out.println(s);     out.flush(); } }
1	public class Main implements Runnable { private boolean _ReadFromFile = false; private boolean _WriteToFile = false; static final String TASK_ID = "in"; static final String IN_FILE = TASK_ID + ".in"; static final String OUT_FILE = TASK_ID + ".out"; BufferedReader reader; StringTokenizer tokenizer; PrintWriter writer; private String alphabet;  private void core() throws Exception {  int n = nextInt();  alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";  for (int test = 0; test < n; test++) {  String input = reader.readLine();  StringTokenizer st = new StringTokenizer(input, alphabet);    ArrayList<Integer> have = new ArrayList<Integer>();  while (st.hasMoreElements()) {   String kString = st.nextToken();   have.add(Integer.parseInt(kString));  }  if (have.size() == 2)   writer.println(twoInts(have.get(0), have.get(1)));  else {   String row = "";   int col = 0;   for (int i = 0; i < input.length(); i++) {   if (Character.isDigit(input.charAt(i))) {    row = input.substring(0, i);    col = Integer.parseInt(input.substring(i));    break;   }   }   writer.println(oneInt(row, col));  }  } } private String oneInt(String row, int col) {  return "R" + col + "C" + toNum(row); } private int toNum(String row) {  int res = 0;  for (int i = 0; i < row.length(); i++) {  res = res * 26 + row.charAt(i) - 'A' + 1;  }  return res; } private String twoInts(Integer row, Integer col) {  return toAlpha(col) + row; } private String toAlpha(Integer col) {  String res = "";  while (col > 0) {  if (col % 26 > 0) {   res = alphabet.charAt(col % 26 - 1) + res;   col /= 26;  }  else {   res = "Z" + res;   col -= 26;   col /= 26;  }  }  return res; } void debug(Object...os) {  System.out.println(Arrays.deepToString(os)); }   public static void main(String[] args) throws InterruptedException {   Thread thread = new Thread(new Main());   thread.start();   thread.join();  } public void run() {   try {   reader = _ReadFromFile ? new BufferedReader(new FileReader(IN_FILE)) : new BufferedReader(new InputStreamReader(System.in));   writer = _WriteToFile ? new PrintWriter(OUT_FILE) : new PrintWriter(new BufferedOutputStream(System.out));    tokenizer = null;    core();    reader.close();    writer.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }  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 nextToken() throws Exception {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  } }
5	public class A {  static StreamTokenizer st;  static PrintWriter pw;  static class Sort implements Comparable<Sort> {   int x,y;   public int compareTo(Sort arg0) {    if (this.x==arg0.x)     return this.y-arg0.y;    return -(this.x-arg0.x);   }  }  public static void main(String[] args) throws IOException{   st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));   pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   int n = nextInt();   int k = nextInt();   Sort[]a = new Sort[n+1];   for (int i = 1; i <= n; i++) {    a[i] = new Sort();    a[i].x = nextInt();    a[i].y = nextInt();   }   Arrays.sort(a,1, n+1);                   int ans = 0;   for (int i = 1; i <= n; i++) {    if (a[i].x==a[k].x && a[i].y==a[k].y)     ans++;   }   System.out.println(ans);   pw.close();  }  private static int nextInt() throws IOException{   st.nextToken();   return (int) st.nval;  } }
5	public class A implements Runnable {  private MyScanner in;  private PrintWriter out;  private void solve() {   int n = in.nextInt();   int[] a = new int[n];   int max = -1, maxp = -1;   for (int i = 0; i < n; ++i) {    a[i] = in.nextInt();    if (a[i] > max) {     max = a[i];     maxp = i;    }   }   if (max == 1) {    for (int i = 0; i < n - 1; ++i) {     out.print(1 + " ");    }    out.println(2);    return;   }   a[maxp] = 1;   Arrays.sort(a);   for (int i = 0; i < n; ++i) {    out.print(a[i] + " ");   }   out.println();  }  @Override  public void run() {   in = new MyScanner();   out = new PrintWriter(System.out);   solve();   in.close();   out.close();  }  public static void main(String[] args) {   new A().run();  }  static class MyScanner {   private BufferedReader br;   private StringTokenizer st;   public MyScanner() {    br = new BufferedReader(new InputStreamReader(System.in));   }   public void close() {    try {     br.close();    } catch (IOException e) {     e.printStackTrace();    }   }   private String nextToken() {    while (st == null || !st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();      return null;     }    }    return st.nextToken();   }   public String nextLine() {    try {     return br.readLine();    } catch (IOException e) {     e.printStackTrace();     return null;    }   }   public String next() {    return nextToken();   }   public int nextInt() {    return Integer.parseInt(nextToken());   }   public long nextLong() {    return Long.parseLong(nextToken());   }   public double nextDouble() {    return Double.parseDouble(nextToken());   }  } }
3	public class A {  public static void main(String[] args) {   FastScanner scanner = new FastScanner();   PrintWriter out = new PrintWriter(System.out, false);   int n = scanner.nextInt();   int[] arr = new int[n];   for(int i = 0; i < n; i++) {    arr[i] = scanner.nextInt();   }     Arrays.sort(arr);   int[] cols = new int[n];   Arrays.fill(cols, -1);   int ans = 0;   for(int i = 0; i < n; i++) {    if (cols[i] == -1) {     cols[i] = ans++;     for(int j = i + 1; j < n; j++) {      if (arr[j] % arr[i] == 0) cols[j] = cols[i];     }    }   }   out.println(ans);   out.flush();  }   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;   }  } }
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; } }
2	public class B {  BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof;  long f(int x, int y, int sz) {  if (x > y) {  int tmp = x;  x = y;  y = tmp;  }  if (sz <= x)  return (long) sz * (sz + 1) / 2;  if (sz >= x + y - 1)  return (long) x * y;  long val = x * (x + 1) / 2;  if (sz <= y)  return val + (long) (sz - x) * x;  long rest = x + y - 1 - sz;  return (long) x * y - (long) rest * (rest + 1) / 2; }  long count(int x, int y, int n, int time) {  long DL = f(x + 1, y + 1, time + 1);  long DR = f(n - x, y + 1, time + 1);  long UL = f(x + 1, n - y, time + 1);  long UR = f(n - x, n - y, time + 1);   long L = Math.min(x + 1, time + 1);  long R = Math.min(n - x, time + 1);  long U = Math.min(n - y, time + 1);  long D = Math.min(y + 1, time + 1);   return DL + DR + UL + UR - L - R - U - D + 1; }  void solve() throws IOException {  int n = nextInt();  int x = nextInt() - 1;  int y = nextInt() - 1;  long need = nextLong();  if (need == 1) {  out.println(0);  return;  }  int low = 0;  int high = Math.max(x, n - 1 - x) + Math.max(y, n - 1 - y);     while (low < high - 1) {  int mid = (int) (((long) low + high) / 2);  if (count(x, y, n, mid) >= need)   high = mid;  else   low = mid;  }  out.println(high);  }  B() 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 B(); }  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()); } }
0	public class A {  public static void main(String args[]) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int f1 = 0;   int f2 = 1;   int f3 = 1;   while (f3 < n) {    f1 = f2;    f2 = f3;    f3 = f1 + f2;   }   if (n == 0) {    System.out.println(0 + " " + 0 + " " + 0);   } else if (f3 == n) {    System.out.println(f1 + " " + f1 + " " + (f2 - f1));   } else {    System.out.println("I'm too stupid to solve this problem");   }  } }
4	public class Main {  static public void main(String args[]) throws Exception {   Scanner s = new Scanner(System.in);   int n = s.nextInt(), m = s.nextInt(), K = s.nextInt();   int[][] p = new int[n][m - 1];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m - 1; j++) {     p[i][j] = s.nextInt();    }   }   int[][] v = new int[n - 1][m];   for (int i = 0; i < n - 1; i++) {    for (int j = 0; j < m; j++) {     v[i][j] = s.nextInt();    }   }   if (K % 2 == 1){    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      System.out.print("-1 ");     }     System.out.println();    }    return;   }   long[][][] dp = new long[K + 1][n][m];   for (int k = 2; k <= K; k += 2) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      long res = Long.MAX_VALUE;      if (i + 1 < n) {       res = Math.min(res, dp[k - 2][i + 1][j] + v[i][j] * 2);      }      if (i - 1 >= 0) {       res = Math.min(res, dp[k - 2][i - 1][j] + v[i - 1][j] * 2);      }      if (j + 1 < m) {       res = Math.min(res, dp[k - 2][i][j + 1] + p[i][j] * 2);      }      if (j - 1 >= 0) {       res = Math.min(res, dp[k - 2][i][j - 1] + p[i][j - 1] * 2);      }      dp[k][i][j] = res;     }    }   }   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     System.out.print(dp[K][i][j] + " ");    }    System.out.println();   }  } }
3	public class CF_1141F2 {  public static void main(String args[]) throws Exception {   BufferedScanner in = new BufferedScanner(new InputStreamReader(System.in));   PrintStream out = new PrintStream(new BufferedOutputStream(System.out));   int n = in.nextInt();   int[] arr = in.nextN(n);   HashMap<Integer, ArrayList<Point>> lp = new HashMap<>();   for (int i = 0; i < n; i++) {    int curr = 0;    for (int j = i; j >= 0; j--) {     curr += arr[j];     if (!lp.containsKey(curr)) lp.put(curr, new ArrayList<>());     lp.get(curr).add(new Point(j, i));    }   }   ArrayList<Point> retPs = new ArrayList<>();   for (ArrayList<Point> ps : lp.values()) {    Collections.sort(ps, (a, b) -> a.y - b.y);    ArrayList<Point> currPs = new ArrayList<>();    for (int i = 0; i < ps.size(); ) {     Point curr = ps.get(i);     currPs.add(curr);     while (i < ps.size() && ps.get(i).x <= curr.y) i++;    }    if(currPs.size() > retPs.size()) retPs = currPs;   }   out.println(retPs.size());   for (Point p : retPs) out.println((p.x + 1) + " " + (p.y + 1));    out.close();   in.close();  }  static class BufferedScanner {   private BufferedReader in;   private StringTokenizer st;   BufferedScanner(Reader in) throws IOException {    this.in = new BufferedReader(in);    st = new StringTokenizer(this.in.readLine());   }   int nextInt() throws IOException {    return Integer.parseInt(next());   }   long nextLong() throws IOException {    return Long.parseLong(next());   }   int[] nextN(int n) throws IOException {    int[] ret = new int[n];    for (int i = 0; i < n; i++) ret[i] = this.nextInt();    return ret;   }   long[] nextNL(int n) throws IOException {    long[] ret = new long[n];    for (int i = 0; i < n; i++) ret[i] = this.nextLong();    return ret;   }   String next() throws IOException {    if (!st.hasMoreElements()) st = new StringTokenizer(in.readLine());    return st.nextToken();   }   void close() throws IOException {    in.close();   }  } }
6	public class E1 {  public static void main(String[] args) throws Exception {  FastScanner sc = new FastScanner(System.in);  FastPrinter out = new FastPrinter(System.out);  int T = sc.nextInt();  for (int i = 0; i < T; i++) {  new E1().run(sc, out);  }  out.close(); }  int N, M, arr[][], ans;  public void run(FastScanner sc, FastPrinter out) throws Exception {  N = sc.nextInt();  M = sc.nextInt();  arr = new int[N][M];  int[][] nums = new int[N * M][3];  int count = 0;  for (int i = 0; i < N; i++) {  for (int j = 0; j < M; j++) {   int v = sc.nextInt();   arr[i][j] = v;   nums[count++] = new int[] { v, j, i };  }  }  Arrays.sort(nums, new Comparator<int[]>() {  @Override  public int compare(int[] a, int[] b) {   return b[0] - a[0];  }  });     if (N == 4 && M > 1) {  int colCount = 0;  HashMap<Integer, Integer> map = new HashMap<>();    for (int i = 0; i < 8; i++) {   int col = nums[i][1];   Integer newCol = map.get(col);   if (newCol == null) {   map.put(col, colCount++);   }  }  int[][] arr = new int[N][colCount];  for (int i = 0; i < 8; i++) {   int val = nums[i][0];   int col = map.get(nums[i][1]);   int row = nums[i][2];   arr[row][col] = val;  }    solve(0, arr);  } else {  ans = 0;  for (int i = 0; i < N; i++) {   ans += nums[i][0];  }  }  System.out.println(ans); }  private void solve(int index, int[][] arr) {  if (index == arr[0].length) {  int temp = 0;  for (int i = 0; i < arr.length; i++) {   int m = 0;   for (int j = 0; j < arr[i].length; j++) {   m = Math.max(m, arr[i][j]);   }   temp += m;  }  ans = Math.max(temp, ans);  } else {  for (int t = 0; t < N; t++) {   int v = arr[0][index];   for (int i = 0; i < N - 1; i++) {   arr[i][index] = arr[i + 1][index];   }   arr[N - 1][index] = v;   solve(index + 1, arr);  }  }  }  static class FastScanner {  final private int BUFFER_SIZE = 1 << 10;  private DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;  public FastScanner() {  this(System.in);  }  public FastScanner(InputStream stream) {  din = new DataInputStream(stream);  buffer = new byte[BUFFER_SIZE];  bufferPointer = bytesRead = 0;  }  public FastScanner(String fileName) throws IOException {  Path p = Paths.get(fileName);  buffer = Files.readAllBytes(p);  bytesRead = buffer.length;  }  int[] nextIntArray(int N) throws IOException {  int[] arr = new int[N];  for (int i = 0; i < N; i++) {   arr[i] = nextInt();  }  return arr;  }  String nextLine() throws IOException {  int c = read();  while (c != -1 && isEndline(c))   c = read();  if (c == -1) {   return null;  }  StringBuilder res = new StringBuilder();  do {   if (c >= 0) {   res.appendCodePoint(c);   }   c = read();  } while (!isEndline(c));  return res.toString();  }  boolean isEndline(int c) {  return c == '\n' || c == '\r' || c == -1;  }  String next() throws Exception {  int c = readOutSpaces();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  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 {  if (din == null) {   bufferPointer = 0;   bytesRead = -1;  } else {   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++];  }  private int readOutSpaces() throws IOException {  while (true) {   if (bufferPointer == bytesRead) fillBuffer();   int c = buffer[bufferPointer++];   if (!isSpaceChar(c)) {   return c;   }  }  }  public void close() throws IOException {  if (din == null) return;  din.close();  }  public int[][] readGraph(int N, int M, boolean zeroIndexed, boolean bidirectional) throws Exception {  int[][] adj = new int[N][];  int[] numNodes = new int[N];  int[][] input = new int[M][2];  for (int i = 0; i < M; i++) {   int a = nextInt();   int b = nextInt();   if (zeroIndexed) {   a--;   b--;   }   input[i][0] = a;   input[i][1] = b;   numNodes[a]++;   if (bidirectional) numNodes[b]++;  }  for (int i = 0; i < N; i++) {   adj[i] = new int[numNodes[i]];   numNodes[i] = 0;  }  for (int i = 0; i < M; i++) {   int a = input[i][0];   int b = input[i][1];   adj[a][numNodes[a]++] = b;   if (bidirectional) adj[b][numNodes[b]++] = a;  }  return adj;  }  public int[][][] readWeightedGraph(int N, int M, boolean zeroIndexed, boolean bidirectional) throws Exception {  int[][][] adj = new int[N][][];  int[] numNodes = new int[N];  int[][] input = new int[M][3];  for (int i = 0; i < M; i++) {   int a = nextInt();   int b = nextInt();   if (zeroIndexed) {   a--;   b--;   }   int d = nextInt();   input[i][0] = a;   input[i][1] = b;   input[i][2] = d;   numNodes[a]++;   if (bidirectional) numNodes[b]++;  }  for (int i = 0; i < N; i++) {   adj[i] = new int[numNodes[i]][2];   numNodes[i] = 0;  }  for (int i = 0; i < M; i++) {   int a = input[i][0];   int b = input[i][1];   int d = input[i][2];   adj[a][numNodes[a]][0] = b;   adj[a][numNodes[a]][1] = d;   numNodes[a]++;   if (bidirectional) {   adj[b][numNodes[b]][0] = a;   adj[b][numNodes[b]][1] = d;   numNodes[b]++;   }  }  return adj;  } }  static class FastPrinter {  static final char ENDL = '\n';  StringBuilder buf;  PrintWriter pw;  public FastPrinter(OutputStream stream) {  buf = new StringBuilder();  pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream)));  }  public FastPrinter(String fileName) throws Exception {  buf = new StringBuilder();  pw = new PrintWriter(new BufferedWriter(new FileWriter(fileName)));  }  public FastPrinter(StringBuilder buf) {  this.buf = buf;  }  public void print(int a) {  buf.append(a);  }  public void print(long a) {  buf.append(a);  }  public void print(char a) {  buf.append(a);  }  public void print(char[] a) {  buf.append(a);  }  public void print(double a) {  buf.append(a);  }  public void print(String a) {  buf.append(a);  }  public void print(Object a) {  buf.append(a.toString());  }  public void println() {  buf.append(ENDL);  }  public void println(int a) {  buf.append(a);  buf.append(ENDL);  }  public void println(long a) {  buf.append(a);  buf.append(ENDL);  }  public void println(char a) {  buf.append(a);  buf.append(ENDL);  }  public void println(char[] a) {  buf.append(a);  buf.append(ENDL);  }  public void println(double a) {  buf.append(a);  buf.append(ENDL);  }  public void println(String a) {  buf.append(a);  buf.append(ENDL);  }  public void println(Object a) {  buf.append(a.toString());  buf.append(ENDL);  }  public void printf(String format, Object... args) {  buf.append(String.format(format, args));  }  public void close() {  pw.print(buf);  pw.close();  }  public void flush() {  pw.print(buf);  pw.flush();  buf.setLength(0);  }  } }
2	public class template { public static void main(String[] args) {  FastScanner sc = new FastScanner();  PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));  int n = sc.nextInt();  int k = sc.nextInt();  long left = 0;  long right = n;  long mid = left+right/2;  while(left<=right) {  mid = (left+(right))/2;  if(((mid+1)*mid)/2-(n-mid)==k) {   pw.println(n-mid);   pw.close();   break;  }  else if(((mid+1)*mid)/2-(n-mid)>k) {   right = mid-1;  }  else left = mid+1;  } } } @SuppressWarnings("all") class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner(String s) {   try {    br = new BufferedReader(new FileReader(s));   } catch (FileNotFoundException e) {       e.printStackTrace();   }  }  public FastScanner() {   br = new BufferedReader(new InputStreamReader(System.in));  }  String nextToken() {   while (st == null || !st.hasMoreElements()) {    try {     st = new StringTokenizer(br.readLine());    } catch (IOException e) {         e.printStackTrace();    }   }   return st.nextToken();  }  int nextInt() {   return Integer.parseInt(nextToken());  }  long nextLong() {   return Long.parseLong(nextToken());  }  double nextDouble() {   return Double.parseDouble(nextToken());  } }
0	public class solution {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   boolean ok = (n % 4 == 0) || (n % 7 == 0) || (n % 47 == 0) || (n % 74 == 0) || (n % 447 == 0) || (n % 474 == 0) || (n % 477 == 0) || (n % 744 == 0) || (n % 747 == 0) || (n % 774 == 0);   if (ok) System.out.println("YES"); else System.out.println("NO");  } }
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); } }
3	public class R455D2PC {  public static void main(String[] args) {   final int MAX = 5000;   final int MODULO = 1000000007;   Scanner in = new Scanner(System.in);   int n = in.nextInt();   in.nextLine();   int pre = 0;   int size = 0;   int[] block = new int[MAX];   for (int i = 0; i < n; i++) {    String command = in.nextLine();    if (command.startsWith("s")) {     block[size++] = pre;     pre = 0;    } else {     pre++;    }   }   if (pre != 0) {    System.out.println(0);    return;   }   int[][] result = new int[2][MAX + 1];   int currentMax = 0;   int preIndex = 0;   result[preIndex][0] = 1;   for (int i = 1; i < size; i++) {    int currentIndex = preIndex ^ 1;    int j = block[i - 1];    for (int k = currentMax; k >= 0; k--) {     result[currentIndex][k + j] = (result[currentIndex][k + j + 1] + result[preIndex][k]) % MODULO;    }    for (int k = j - 1; k >= 0; k--) {     result[currentIndex][k] = result[currentIndex][j];    }    currentMax += j;    preIndex = currentIndex;     }   int sum = 0;   for (int i = 0; i <= currentMax; i++) {    sum = (sum + result[preIndex][i]) % MODULO;   }     System.out.println(sum);  } }
0	public class three {  static boolean check;  public static void main(String[] args) {   check = true;   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   String s = n + "";   recurse(n, s.length(), "4");   if (!check)    System.out.println("YES");   else {    recurse(n, s.length(), "7");    if (!check)     System.out.println("YES");    else     System.out.println("NO");   }  }  private static void recurse(int n, int length, String string) {   int k = Integer.parseInt(string);   if (n % k == 0) {    check = false;   } else if (string.length() <= length && check) {    recurse(n, length, string + "4");    recurse(n, length, string + "7");   }  } }
4	public class Main {  static Scanner cin = new Scanner(new BufferedReader(new InputStreamReader(System.in)));  static PrintWriter cout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  public static void main(String[] agrs) throws IOException{     String line = cin.nextLine();     HashMap<String, Integer> map = new HashMap<String, Integer>();   int ans = 0;   for (int i = 0; i < line.length(); ++i) {    StringBuffer str = new StringBuffer("");    for (int j = i; j < line.length(); ++j) {     str.append(line.charAt(j));         if (!map.containsKey(str.toString())) {           map.put(str.toString(), 1);     } else {      ans = str.length() > ans ? str.length() : ans;     }    }   }     cout.println(ans);     cin.close();   cout.close();  } }
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());  } }
0	public class A {   public static void main(String[] args) {   Scanner scan = new Scanner(System.in);  int a = scan.nextInt();  Queue<Integer> q = new LinkedList<Integer>();  q.add(4);  q.add(7);  boolean luck = false;  while(!q.isEmpty() && !luck)  {  int f = q.poll();  if(a%f == 0)  {   luck = true;   break;  }  if(f<a)  {   int t = (f+"").length();   int tt = (int)Math.pow(10, t);   q.add(tt*4+f);   q.add(tt*7+f);  }  }  if(luck)  System.out.println("YES");  else  System.out.println("NO");   } }
0	public class ex1 {  public static void main(String[] args) {  int n,i,j;  Scanner scan = new Scanner(System.in);  n = Integer.parseInt(scan.nextLine());  if(n>=0)  System.out.println(n);  else if(n<0) {  n=-1*n;  i=n/10;  j=(n/100)*10+n%10;  i=-i;  j=-j;  if(i>=j)   System.out.println(i);  else   System.out.println(j);  } }  }
5	public class test {  public static void main(String[] args)  {   Scanner in=new Scanner(System.in);   int n=in.nextInt();   int t=in.nextInt();     House[] houses=new House[n];     for(int i=0;i<n;i++)   {    houses[i]=new House(in.nextInt(),in.nextInt());   }     Arrays.sort(houses);     int count=2;     for(int i=0;i<n-1;i++)   {    double start=houses[i].x+(double)houses[i].a/2;    double end=houses[i+1].x-(double)houses[i+1].a/2;       if(end-start==t)   count++;    if(end-start>t)   count+=2;   }     System.out.println(count);   } } class House implements Comparable<House> {  int x;  int a;   public House(int _x, int _a)  { x=_x; a=_a;  }  @Override  public int compareTo(House o) { return x-o.x;  }  }
3	public class default_dst {  public static void main(String[] args) {   in = new FastReader();   int n=ni();   int[] arr=takeIntegerArrayInput(n);   HashMap<Long,ArrayList<pair>> hm=new HashMap<>();   int max_size=0;   long S=-1;   for (int i=0;i<arr.length;i++){    long sum=0;    for (int j=i;j>=0;j--){     sum+=arr[j];     if (!hm.containsKey(sum)){      hm.put(sum,new ArrayList<>());     }     if (hm.get(sum).size()==0||hm.get(sum).get(hm.get(sum).size()-1).y<j){      hm.get(sum).add(new pair(j,i));     }     if (hm.get(sum).size()>max_size){      max_size=hm.get(sum).size();      S=sum;     }    }   }   System.out.println(max_size);   StringBuilder sb=new StringBuilder();   for (int i=0;i<hm.get(S).size();i++){    sb.append(hm.get(S).get(i)).append("\n");   }   System.out.print(sb.toString());   }  static class pair{   int x;   int y;   pair(int x,int y){    this.x=x;    this.y=y;   }   @Override   public String toString(){    return (this.x+1)+" "+(this.y+1);   }  }  public static long binarySearch(long low, long high) {   while (high - low > 1) {    long mid = (high - low)/2 + low;       if (works(mid)) {     high = mid;    } else {     low = mid;    }   }   return (works(low) ? low : high);  }  static long fast_exp_with_mod(long base, long exp) {   long MOD=1000000000+7;   long res=1;   while(exp>0) {    if(exp%2==1) res=(res*base)%MOD;    base=(base*base)%MOD;    exp/=2;   }   return res%MOD;  }  public static long gcd(long a, long b)  {   if (a == 0)    return b;   return gcd(b%a, a);  }  static class my_no{   long num;   long denom;   @Override   public String toString() {    if (denom<0){     this.num=-this.num;     this.denom=-this.denom;    }    if (num==0)return "0";    return (num+"/"+denom);   }   my_no(int no){    this.num=no;    this.denom=1;   }   my_no(long num,long denom){    this.num=num;    this.denom=denom;   }   my_no multiply(my_no obj){    long num1=obj.num;    long denom1=obj.denom;    long n=num1*num;    long d=denom1*denom;    long gcd=gcd(n,d);    n/=gcd;    d/=gcd;    return new my_no(n,d);   }       my_no multiply(int no){    long n=num*no;    long d=denom;    long gcd=gcd(n,d);    n/=gcd;    d/=gcd;    return new my_no(n,d);   }  }  static void memset(int[][] arr,int val){   for (int i=0;i<arr.length;i++){    for (int j=0;j<arr[i].length;j++){     arr[i][j]=val;    }   }  }  static void memset(int[] arr,int val){   for (int i=0;i<arr.length;i++){    arr[i]=val;   }  }   static void memset(long[][] arr,long val){   for (int i=0;i<arr.length;i++){    for (int j=0;j<arr[i].length;j++){     arr[i][j]=val;    }   }  }  static void memset(long[] arr,long val){   for (int i=0;i<arr.length;i++){    arr[i]=val;   }  }  static private boolean works(long test){   return true;  }   static void reverse(char[] arr ,int i,int j){   if (i==j)    return;   while (i<j){    char temp=arr[i];    arr[i]=arr[j];    arr[j]=temp;    ++i;    --j;   }  }  static int[] takeIntegerArrayInput(int no){   int[] arr=new int[no];   for (int i=0;i<no;++i){    arr[i]=ni();   }   return arr;  }  static long fast_Multiply(long no , long pow){   long result=1;   while (pow>0){    if ((pow&1)==1){     result=result*no;    }    no=no*no;    pow>>=1;   }   return result;  }  static long[] takeLongArrayInput(int no){   long[] arr=new long[no];   for (int i=0;i<no;++i){    arr[i]=ni();   }   return arr;  }  static final long MOD = (long)1e9+7;  static FastReader in;   static void p(Object o){   System.out.print(o);  }  static void pn(Object o){   System.out.println(o);  }  static String n(){   return in.next();  }  static String nln(){   return in.nextLine();  }  static int ni(){   return Integer.parseInt(in.next());  }  static int[] ia(int N){   int[] a = new int[N];   for(int i = 0; i<N; i++)a[i] = ni();   return a;  }  static long[] la(int N){   long[] a = new long[N];   for(int i = 0; i<N; i++)a[i] = nl();   return a;  }  static long nl(){   return Long.parseLong(in.next());  }  static double nd(){   return Double.parseDouble(in.next());  }  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();   }   String nextLine(){    String str = "";    try{     str = br.readLine();    }catch (IOException e){     e.printStackTrace();    }    return str;   }  }  static void println(String[] arr){   for (int i=0;i<arr.length;++i){    System.out.println(arr[i]);   }  } }
0	public class HexadecimalsTheorem {  public void solve() {   Scanner sc = new Scanner(System.in);   long n = sc.nextLong();   ArrayList<Long> a = new ArrayList<Long>();   a.add(0l);   a.add(1L);   a.add(1L);   int i = 1, j = 2;   while ((a.get(i) + a.get(j)) <= n) {    a.add((a.get(i) + a.get(j)));    i++;    j++;   }   if (a.contains(n)) {    if (n == 0) {     System.out.println("0 0 0");    } else if (n == 1) {     System.out.println("0 0 1");    } else if (n == 2) {     System.out.println("0 1 1");    } else {     System.out.println(a.get(j - 4) + " " + a.get(j - 3) + " " + a.get(j - 1));    }   } else {    System.out.println("I'm too stupid to solve this problem");   }   }  public static void main(String[] args) {   new HexadecimalsTheorem().solve();  } }
1	public class IQTest implements Runnable { public static void main(String[] args) throws Exception {  new IQTest().run(); }  private void solve() throws Exception {  int n = nextInt();  int a[] = new int[n];  for (int i = 0; i < a.length; i++)  {  a[i] = nextInt();  }  int c0 = 0, c1 = 0;  for (int i = 0; i < a.length; i++)  {  a[i] = a[i] % 2;  if (a[i] == 0)   c0++;  else   c1++;  }  int f = 0;  if (c0 > c1)  f = 1;  else  f = 0;  int r = 0;  for (int i = 0; i < a.length; i++)  {  if (a[i] == f)  {   r = i + 1;   break;  }  }  out.println(r); }   private BufferedReader in; PrintWriter out; StringTokenizer tokenizer;  public void run() {   try  {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new BufferedOutputStream(System.out));  solve();  out.flush();  in.close();  out.close();  }  catch (Exception e)  {  e.printStackTrace();    } }  String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens())  {  tokenizer = new StringTokenizer(in.readLine());  }  return tokenizer.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()); } }
2	public class b2 { public static void main(String[] args) throws IOException {  input.init(System.in);  int n = input.nextInt(), x = input.nextInt(), y = input.nextInt(), c = input.nextInt();  long lo = 0, hi = 2*n;  while(hi > lo+1)  {   long mid = (hi+lo)/2;   long covered = go(n, x, y, mid);   if(covered < c)    lo = mid;   else hi = mid;  }  if(go(n, x, y, lo) < c) lo++;  System.out.println(lo);  } public static long go(int n, int x, int y, long d) {  long res = d*d + (d+1)*(d+1);  long maxLeft = d - x;  if(maxLeft >= 0) res -= (maxLeft+1)*(maxLeft+1);  long maxTop = d - y;  if(maxTop >= 0) res -= (maxTop+1)*(maxTop+1);  long maxRight = d - (n+1-x);  if(maxRight >= 0) res -= (maxRight+1)*(maxRight+1);  long maxBot = d - (n+1-y);  if(maxBot >= 0) res -= (maxBot+1)*(maxBot+1);  long maxTopLeft = d - (x+y);  if(maxTopLeft >= 0) res += (maxTopLeft+1)*(maxTopLeft+2)/2;  long maxTopRight = d - ((n+1-x)+y);  if(maxTopRight >= 0) res += (maxTopRight+1)*(maxTopRight+2)/2;  long maxBotLeft = d - (x+(n+1-y));  if(maxBotLeft >= 0) res += (maxBotLeft+1)*(maxBotLeft+2)/2;  long maxBotRight = d - ((n+1-x)+(n+1-y));  if(maxBotRight >= 0) res += (maxBotRight+1)*(maxBotRight+2)/2;  return res; } 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() );  } } }
5	public class Main implements Runnable {  class Segment {  int l, r;  Segment(int l, int r) {  this.l = l;  this.r = r;  }  @Override  public boolean equals(Object obj) {  Segment o = (Segment)obj;  return l == o.l && r == o.r;  }  @Override  public int hashCode() {  return 1000 * l + r;  } }  public void _main() throws IOException {  int n = nextInt();  int t = nextInt();  int[] x = new int[n];  int[] a = new int[n];  for (int i = 0; i < n; i++) {  x[i] = nextInt();  a[i] = nextInt();  }   Set<Segment> set = new HashSet<Segment>();  for (int i = 0; i < n; i++) {  int l = 2 * x[i] + a[i];  int r = 2 * x[i] + a[i] + 2 * t;  boolean ok = true;  for (int j = 0; j < n; j++) {   if (i == j) continue;   int L = Math.max(l, 2 * x[j] - a[j]);   int R = Math.min(r, 2 * x[j] + a[j]);     if (L < R) {   ok = false;   break;   }  }  if (ok)   set.add(new Segment(l, r));    l = 2 * x[i] - a[i] - 2 * t;  r = 2 * x[i] - a[i];    ok = true;  for (int j = 0; j < n; j++) {   if (i == j) continue;   int L = Math.max(l, 2 * x[j] - a[j]);   int R = Math.min(r, 2 * x[j] + a[j]);   if (L < R) {   ok = false;   break;   }  }  if (ok)   set.add(new Segment(l, r));  }  out.print(set.size()); }  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);  } } }
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();  } }
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 sdffsdf {  public static void main(String[] args) {  try{  File file = new File("input.txt");  Scanner sc = new Scanner(file);  String s = sc.nextLine();  String[] seperatedd = s.split(" ");  int x = Integer.parseInt(seperatedd[0]);  int y = Integer.parseInt(seperatedd[1]);  int[][] grid = new int[x][y];  for(int i = 0; i < x; i++)  {   for(int j = 0; j < y; j++)   {   grid[i][j] = 0;   }  }  s = sc.nextLine();  int z = Integer.parseInt(s);  LinkedList<Point> BFS = new LinkedList<Point>();  s = sc.nextLine();  String[] seperated = s.split(" ");  for(int i = 0; i < seperated.length; i = i + 2)  {   Point temp = new Point();   temp.x = Integer.parseInt(seperated[i])-1;   temp.y = Integer.parseInt(seperated[i+1])-1;   grid[temp.x][temp.y] = 1;   BFS.addLast(temp);  }  while(!BFS.isEmpty())  {   Point temp = new Point();   temp = BFS.removeFirst();   int k = temp.x;   int l = temp.y;     if(!(l+1 >= y || grid[k][l+1] == 1))   {   Point temp1 = new Point();   temp1.x = k;   temp1.y = l+1;   grid[temp1.x][temp1.y] = 1;   BFS.addLast(temp1);   }   if(!(k+1 >= x || grid[k+1][l] == 1))   {   Point temp1 = new Point();   temp1.x = k+1;   temp1.y = l;   grid[temp1.x][temp1.y] = 1;   BFS.addLast(temp1);   }          if(!(l-1 < 0 || grid[k][l-1] == 1))   {   Point temp1 = new Point();   temp1.x = k;   temp1.y = l-1;   grid[temp1.x][temp1.y] = 1;   BFS.addLast(temp1);   }   if(!(k-1 < 0 || grid[k-1][l] == 1))   {   Point temp1 = new Point();   temp1.x = k-1;   temp1.y = l;   grid[temp1.x][temp1.y] = 1;   BFS.addLast(temp1);   }   if(BFS.isEmpty())   {  try {    File fil = new File("output.txt");    PrintWriter out = new PrintWriter(fil);    int v1 = (int)temp.getX() + 1;    int v2 = (int)temp.getY() + 1;    out.println(v1 + " " + v2);     out.close();    }   catch (Exception e) {}   }  }  }  catch (Exception e) {  System.out.println("nbvnb");  }  } }
1	public class JavaApplication2 {    public static void main(String[] args) throws IOException {     BufferedReader sc= new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(sc.readLine().split(" ")[0]);   ArrayList<String> tshr = new ArrayList<>(n);   for (int i = 0; i < n; i++) {    tshr.add(sc.readLine());   }   for (int i = 0; i < n; i++) {    tshr.remove(sc.readLine());   }   System.out.println(tshr.size());                 }  }
5	public class A { Scanner in = new Scanner(System.in);  public class Houses implements Comparable<Houses>{  double x;  double a;   public Houses(double xVal, double aVal){  x = xVal-aVal/2;  a = aVal;  }  @Override  public int compareTo(Houses o) {  return (int) (x - o.x);  }  }  public void solve2(ArrayList<Houses> list,int t){  Collections.sort(list);  int count = 2;    for(int f = 0; f < list.size()-1; f++){   if(list.get(f+1).x-list.get(f).x-list.get(f).a > t){   count+=2;  }  else if(list.get(f+1).x-list.get(f).x-list.get(f).a == t){   count++;  }    }   System.out.println(count); }  public void solve(){  ArrayList<Houses> list = new ArrayList<Houses>();  int n = in.nextInt();  int t = in.nextInt();  for(int i = 0; i < n; i++){  list.add(new Houses(in.nextDouble(),in.nextDouble()));  }   solve2(list,t); }  public static void main(String[] args){  A p = new A();  p.solve(); } }
4	public class GiveString23A {  public static void main(String[] args)  {   Scanner in = new Scanner(System.in);   String stroke = in.next();   char[] s = new char [stroke.length()];   for (int i=0;i<stroke.length();i++)    s[i]=stroke.charAt(i);   int dlina = 0;   for (int i=0;i<s.length-1;i++)    for (int j=i+1;j<s.length;j++)     for (int k=0;k<(s.length-j);k++)      if (s[i]==s[j])      {       int ik=i+k;       int jk = j+k;       if (s[ik]==s[jk])       {        if (dlina<k+1)         dlina=k+1;        }       else       break;      }     System.out.println(dlina);  } }
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()); } }
5	public class Seq2 {  static void metod() {   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 min = a[0];   for (int i = 1; i < a.length; i++) {    if (a[i] < min)     min = a[i];   }     int min2 = min;   boolean t = false;   for (int i = 0; i < a.length; i++) {    if (a[i] != min) {     if (!t) {      min2 = a[i];      t = true;     } else {      if (min2 > a[i])       min2 = a[i];     }    }   }   System.out.println((min == min2) ? "NO" : min2);    }  public static void main(String[] args) {   Seq2.metod();  } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   long mod = (long) 1e9 + 7;   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    char ar[] = new char[n];    for (int i = 0; i < n; i++) {     ar[i] = in.readString().charAt(0);    }    long dp[][] = new long[n + 1][n + 1];    for (int i = 0; i < n; i++) {     dp[n - 1][i] = 1;    }    long prev = n;    for (int i = n - 2; i >= 0; i--) {     if (ar[i] == 'f') {      if (ar[i + 1] == 's') {       for (int j = n - 2; j >= 0; j--) {        dp[i][j] = dp[i + 1][j + 1];       }      } else {       for (int j = n - 2; j >= 0; j--) {        dp[i][j] = dp[i + 1][j + 1];       }      }     } else {      for (int j = n - 1; j >= 0; j--) {       if (prev < 0) {        prev += mod;       }       dp[i][j] = prev;       prev = prev - dp[i + 1][j];      }     }     prev = 0;     for (int j = 0; j < n; j++) {      prev += dp[i][j];      prev = prev % mod;     }    }    out.println(dp[0][0] % mod);   }  }  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 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) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
2	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);   BSportivnayaMafiya solver = new BSportivnayaMafiya();   solver.solve(1, in, out);   out.close();  }  static class BSportivnayaMafiya {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.readInt();    int k = in.readInt();    int have = 0;    for (int x = 1; ; x++) {     have += x;     if (have < k) {      continue;     }     if (have - (n - x) == k) {      out.print(n - x);      return;     }    }   }  }  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 close() {    writer.close();   }   public void print(int i) {    writer.print(i);   }  } }
2	public class Main {  public static void main(String[] args) {  try {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter pw = new PrintWriter(System.out);    String[] param = br.readLine().split(" ");  long n = Long.parseLong(param[0])-1;  long k = Long.parseLong(param[1])-1;  long max = k*(k+1)/2;  long answer;  if (n > max) answer = -1;  else {   long margin = max - n;   long m = Math.max(0,(long)Math.floor((1.0+Math.sqrt(1+8*margin))/2.0)-1);   long min = m*(m+1)/2;   while (min <= margin) { m++; min = m*(m+1)/2; }   answer = k - m + 1;  }  pw.println(answer);    pw.close();  br.close();  } catch (IOException e) {  e.printStackTrace();  return;  } } }
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();  } }
6	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);   TaskE2 solver = new TaskE2();   solver.solve(1, in, out);   out.close();  }  static class TaskE2 {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int t = in.nextInt();    while (t-- > 0) {     int n = in.nextInt(), m = in.nextInt();     int[][] a = new int[m][n];     int[] bestMask = new int[1 << n];     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       a[j][i] = in.nextInt();      }     }     int[] dp = new int[1 << n];     for (int i = 0; i < m; i++) {      int[] array = a[i];      for (int j = 0; j < n; j++) {       int val = array[j];       for (int mask = 0; mask < 1 << n; mask++) {        if ((mask & (1 << j)) == 0) {         dp[mask | (1 << j)] = Math.max(dp[mask | (1 << j)], dp[mask] + val);        }       }      }      for (int mask = 0; mask < 1 << n; mask++) {       int best = 0;       int cur = mask;       for (int j = 0; j < n; j++) {        best = Math.max(best, dp[cur]);        cur = (cur >> 1) | ((cur & 1) << (n - 1));       }       for (int j = 0; j < n; j++) {        dp[cur] = best;        cur = (cur >> 1) | ((cur & 1) << (n - 1));       }      }     }     out.println(dp[(1 << n) - 1]);    }   }  }  static class FastScanner {   BufferedReader br;   StringTokenizer st;   public FastScanner(InputStream in) {    br = new BufferedReader(new InputStreamReader(in));   }   public FastScanner(String fileName) {    try {     br = new BufferedReader(new FileReader(fileName));    } catch (FileNotFoundException e) {     e.printStackTrace();    }   }   public int nextInt() {    return Integer.parseInt(next());   }   public String next() {    while (st == null || !st.hasMoreElements()) {     String line = null;     try {      line = br.readLine();     } catch (IOException e) {     }     st = new StringTokenizer(line);    }    return st.nextToken();   }  } }
6	public class ProblemD {    static int N; static boolean[][] graph;  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(" ");  int n = Integer.valueOf(data[0]);  N = n;  int m = Integer.valueOf(data[1]);  graph = new boolean[n][n];  for (int i = 0 ; i < m ; i++) {  String[] line = s.readLine().split(" ");  int a = Integer.valueOf(line[0])-1;  int b = Integer.valueOf(line[1])-1;  graph[a][b] = true;  graph[b][a] = true;  }   long ans = 0;  for (int i = 0 ; i < n ; i++) {  ans += doit(i);  }  ans /= 2;   out.println(ans);  out.flush(); }  static long doit(int n) {  long[][] dp = new long[1<<n][n];  for (int i = 0 ; i < n ; i++) {  if (graph[i][n]) {   dp[1<<i][i] = 1;  }  }   for (int i = 0 ; i < (1<<n) ; i++) {  for (int j = 0 ; j < n ; j++) {   if (dp[i][j] >= 1) {   for (int k = 0 ; k < n ; k++) {    if (graph[j][k] && (i & (1<<k)) == 0) {    dp[i|1<<k][k] += dp[i][j];    }   }   }  }  }   long ret = 0;  for (int i = 0 ; i < (1<<n) ; i++) {  if (Integer.bitCount(i) >= 2) {   for (int j = 0 ; j < n ; j++) {   if (graph[j][n]) {    ret += dp[i][j];   }   }  }  }  return ret; }   static void generateLarge() {  System.out.println("19 171");  for (int i = 1 ; i <= 19 ; i++) {  for (int j = i+1 ; j <= 19 ; j++) {   System.out.println(i + " " + j);  }  } }  public static void debug(Object... os){  System.err.println(Arrays.deepToString(os)); } }
6	public class cf11d { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  int m = in.nextInt();  boolean[][] g = new boolean[n][n];  boolean[] ok = new boolean[1<<n];  int[] f = new int[1<<n];  for(int i=1; i<(1<<n); i++) {  ok[i] = Integer.bitCount(i)>=3;  f[i] = first(i);  }  for(int i=0; i<m; i++) {  int a = in.nextInt()-1;  int b = in.nextInt()-1;  g[a][b] = g[b][a] = true;  }  long[][] dp = new long[n][1<<n];  for(int i=0; i<n; i++)  dp[i][1<<i] = 1;  for(int i=1; i<(1<<n); i++)  for(int j=0; j<n; j++)   for(int k=f[i]+1; k<n; k++)   if((i&(1<<k)) == 0 && g[j][k])    dp[k][i^(1<<k)] += dp[j][i];  long ret = 0;  for(int i=1; i<(1<<n); i++)  for(int j=0; j<n; j++)   if(ok[i] && j != f[i])   ret += g[j][f[i]]?dp[j][i]:0;  System.out.println(ret/2); } static int first(int x) {  int ret = 0;  while(x%2==0) {  x/=2;  ret++;  }  return ret; } }
5	public class con111_A {  public static void main( final String[] args ) throws IOException {   final BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );   final int n = Integer.parseInt( br.readLine() );   final int[] a = new int[n];   final String[] parts = br.readLine().split( " " );   for ( int i = 0; i < n; ++i ) {    a[ i ] = Integer.parseInt( parts[ i ] );   }   System.out.println( solve( n, a ) );  }  private static int solve( final int n, final int[] a ) {   Arrays.sort( a );   int sum = 0;   for ( int i = 0; i < n; ++i ) {    sum += a[ i ];   }   int res = 0;   int ms = 0;   for ( int i = n - 1; i >= 0; --i ) {    if ( ms > sum / 2 ) {     break;    } else {     ms += a[ i ];     ++res;    }   }   return res;  } }
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[] a = new int[n];    for (int i = 0; i < n; ++i) a[i] = in.nextInt();    boolean[] done = new boolean[n];    int res = 0;    while (true) {     int bi = -1;     for (int i = 0; i < n; ++i)      if (!done[i]) {       if (bi < 0 || a[i] < a[bi]) bi = i;      }     if (bi < 0) break;     ++res;     for (int i = 0; i < n; ++i) if (!done[i] && a[i] % a[bi] == 0) done[i] = true;    }    out.println(res);   }  }  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());   }  } }
0	public class Hexadecimal { public static void main(String args[]){  Scanner input = new Scanner(System.in);  int n = input.nextInt();  System.out.print("0 0 " + n); } }
0	public class Main {  long solve(long a, long b) {   if (a == 0) {    return 0;   }   long answer = a / b;   a %= b;   if (a != 0) {    answer += 1 + solve(b - a, a);   }   return answer;  }  public void run() {   try {    long a = reader.nextLong();    long b = reader.nextLong();    writer.println(solve(a, b));   } catch (IOException ex) {   }   writer.close();  }  InputReader reader;  PrintWriter writer;  Main() {   reader = new InputReader();   writer = new PrintWriter(System.out);  }  public static void main(String[] args) {   new Main().run();  } } class InputReader {  BufferedReader reader;  StringTokenizer tokenizer;  InputReader() {   reader = new BufferedReader(new InputStreamReader(System.in));   tokenizer = new StringTokenizer("");  }  String next() throws IOException {   while (!tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }  Integer nextInt() throws IOException {   return Integer.parseInt(next());  }  Long nextLong() throws IOException {   return Long.parseLong(next());  } }
1	public class A {  public static void main(String[] args) {  JS in = new JS();  int n = in.nextInt();  int m1 = 0;  int s1 = 0;  int l1 = 0;  int ss1 = 0;  int sss1 = 0;  int ssss1 = 0;  int ll1 = 0;  int lll1 = 0;  int llll1 = 0;   int m2 = 0;  int s2 = 0;  int l2 = 0;  int ss2 = 0;  int sss2 = 0;  int ssss2 = 0;  int ll2 = 0;  int lll2 = 0;  int llll2 = 0;  for(int i = 0; i < n; i++) {  String s = in.next();  if(s.equals("S")) s1++;  else if(s.equals("M"))m1++;  else if(s.equals("L"))l1++;  else if(s.equals("XS")) ss1++;  else if(s.equals("XXS")) sss1++;  else if(s.equals("XXXS")) ssss1++;  else if(s.equals("XL")) ll1++;  else if(s.equals("XXL")) lll1++;  else if(s.equals("XXXL")) llll1++;  }  for(int i = 0; i < n; i++) {  String s = in.next();  if(s.equals("S")) s2++;  else if(s.equals("M"))m2++;  else if(s.equals("L"))l2++;  else if(s.equals("XS")) ss2++;  else if(s.equals("XXS")) sss2++;  else if(s.equals("XXXS")) ssss2++;  else if(s.equals("XL")) ll2++;  else if(s.equals("XXL")) lll2++;  else if(s.equals("XXXL")) llll2++;  }   int res = 0;  int res1 = 0;    res1 += Math.abs(m2-m1);  res1 += Math.abs(s2-s1);  res1 += Math.abs(l2-l1);  res += res1/2;  res1 = 0;   res1 += Math.abs(ss2-ss1);  res1 += Math.abs(ll2-ll1);  res += res1/2;  res1 = 0;   res1 += Math.abs(sss2-sss1);  res1 += Math.abs(lll2-lll1);  res += res1/2;  res1 = 0;   res1 += Math.abs(ssss2-ssss1);  res1 += Math.abs(llll2-llll1);  res += res1/2;  res1 = 0;  System.out.println(res);    }   static class JS{  public int BS = 1<<16;  public char NC = (char)0;  byte[] buf = new byte[BS];  int bId = 0, size = 0;  char c = NC;  double num = 1;  BufferedInputStream in;   public JS() {  in = new BufferedInputStream(System.in, BS);  }   public JS(String s) throws FileNotFoundException {  in = new BufferedInputStream(new FileInputStream(new File(s)), BS);  }   public char nextChar(){  while(bId==size) {   try {   size = in.read(buf);   }catch(Exception e) {   return NC;   }     if(size==-1)return NC;   bId=0;  }  return (char)buf[bId++];  }   public int nextInt() {  return (int)nextLong();  }   public long nextLong() {  num=1;  boolean neg = false;  if(c==NC)c=nextChar();  for(;(c<'0' || c>'9'); c = nextChar()) {   if(c=='-')neg=true;  }  long res = 0;  for(; c>='0' && c <='9'; c=nextChar()) {   res = (res<<3)+(res<<1)+c-'0';   num*=10;  }  return neg?-res:res;  }   public double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }   public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }   public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  } } }
1	public class C { String line; StringTokenizer inputParser; BufferedReader is; FileInputStream fstream; DataInputStream in;  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);  }   }  int NextInt() {  String n = inputParser.nextToken();  int val = Integer.parseInt(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];  C c = new C(filePath); }  public C(String inputFile) {   openInput(inputFile);    readNextLine();  int N=NextInt();  boolean [] p = new boolean[N];  readNextLine();  int h=0;  for(int i=0; i<N; i++)  {  p[i]=line.charAt(i)=='H';  if(p[i])h++;  }     int ret=N;   for(int i=0; i<N; i++)  {  int m=0;  for(int j=i; j<i+h; j++)  {   int n=j%N;   if(!p[n])m++;  }  ret=Math.min(ret, m);  }   System.out.println(ret);  closeInput(); }   }
5	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();   TreeMap<Integer, Integer> map=new TreeMap<Integer, Integer>();  BigInteger ans=new BigInteger("0");  long sum=0;  for(int i=0;i<n;i++){  sum+=a[i];  map.put(a[i], map.getOrDefault(a[i], 0)+1);  int cntSame=map.get(a[i]);  int cntLess=map.getOrDefault(a[i]-1, 0);  int cntMore=map.getOrDefault(a[i]+1, 0);  long sum2=sum;  sum2-=1L*cntSame*a[i];  sum2-=1L*cntLess*(a[i]-1);  sum2-=1L*cntMore*(a[i]+1);  int cnt=i+1-(cntSame+cntLess+cntMore);  ans = ans.subtract(BigInteger.valueOf(sum2));  ans= ans.add(BigInteger.valueOf(1L*cnt*a[i]));    }  pw.println(ans);  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;} } }
5	public class Solution {  public static void main(String[] args) throws IOException  {   new Solution().run();  }  StreamTokenizer in;  Scanner ins;  PrintWriter out;   int nextInt() throws IOException  {   in.nextToken();    return (int)in.nval;  }    void run() throws IOException  {   if(System.getProperty("ONLINE_JUDGE")!=null)   {    in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));    ins = new Scanner(System.in);    out = new PrintWriter(System.out);   }   else   {       in = new StreamTokenizer(new BufferedReader(new FileReader("input.txt")));       ins = new Scanner(new FileReader("input.txt"));    out = new PrintWriter(new FileWriter("output.txt"));   }   int n = nextInt(),a = nextInt(),b = nextInt();   b--;   int [] A = new int[n];   for(int i = 0; i < n ;i++)   {    A[i] = nextInt();   }   Arrays.sort(A);   if(A[b] == A[b+1])    out.print(0);   else    out.print(A[b+1]- A[b]);   out.close();  }     class Team implements Comparable  {   public int p,t;   public int compareTo(Object obj)   {    Team a = (Team) obj;    if(p>a.p || p==a.p && t<a.t)           return -1;    else         if(p==a.p && t==a.t)      return 0;     else      return 1;   }    } }
3	public class CFC {  static int n;  static int[][] dp;  static boolean[] s;  public static void main(String[] args) throws IOException {   FastScanner in = new FastScanner(System.in);      n = in.nextInt();   if(n == 1){    System.out.println(1);    return;   }   dp = new int[n][n+1];   s = new boolean[n];   for(int i = 0;i <n; i++)s[i] = in.next().equals("s");   for(int j = 0;j < n; j++){    if(s[n-2])dp[n-1][j] = j+1;    else dp[n-1][j] = 1;   }   int suma , sumb;   for(int i = n-2; i >= 0; i--){    if(i == 0 ? true : s[i-1]){     if(s[i]) {      for (int j = 0; j < n; j++) {       dp[i][j] = ((j == 0 ? 0 : dp[i][j - 1]) + dp[i + 1][j]) % 1000000007;      }     }     else{      for(int j = 0;j < n; j++){       dp[i][j] = ((j == 0 ? 0 : dp[i][j-1]) + dp[i+1][j+1]) % 1000000007;      }     }    }    else{     if(s[i]){      for(int j = 0;j < n; j++){       dp[i][j] = dp[i+1][j];      }     }     else{      for(int j = 0;j < n; j++){       dp[i][j] = dp[i+1][j+1];      }     }    }   }   System.out.println(dp[0][0]);  }  private static class FastScanner {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   public FastScanner(InputStream stream) {    this.stream = stream;   }   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++];   }   boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   boolean isEndline(int c) {    return c == '\n' || c == '\r' || c == -1;   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String next() {    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 (isEndline(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isEndline(c));    return res.toString();   }  } }
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)); } }
1	public class A implements Runnable {  public void run() {   long startTime = System.nanoTime();   int n = nextInt();   String[] all = new String[9];   all[0] = "M";   for (int i = 0; i < 4; i++) {    String s = "";    for (int j = 0; j < i; j++) {     s += "X";    }    all[2 * i + 1] = s + "S";    all[2 * i + 2] = s + "L";   }   Map<String, Integer> map1 = new HashMap<>();   Map<String, Integer> map2 = new HashMap<>();   for (String s : all) {    map1.put(s, 0);    map2.put(s, 0);   }   for (int i = 0; i < n; i++) {    String s = nextToken();    map1.put(s, map1.get(s) + 1);   }   for (int i = 0; i < n; i++) {    String s = nextToken();    map2.put(s, map2.get(s) + 1);   }   int res = 0;   for (String s : all) {    int a = map1.get(s);    int b = map2.get(s);    if (a > b) {     res += a - b;    }   }   println(res);   if (fileIOMode) {    System.out.println((System.nanoTime() - startTime) / 1e9);   }   out.close();  }    private static boolean fileIOMode;  private static BufferedReader in;  private static PrintWriter out;  private static StringTokenizer tokenizer;  public static void main(String[] args) throws Exception {   fileIOMode = args.length > 0 && args[0].equals("!");   if (fileIOMode) {    in = new BufferedReader(new FileReader("a.in"));    out = new PrintWriter("a.out");   } else {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);   }   tokenizer = new StringTokenizer("");   new Thread(new A()).start();  }  private static String nextLine() {   try {    return in.readLine();   } catch (IOException e) {    return null;   }  }  private static String nextToken() {   while (!tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(nextLine());   }   return tokenizer.nextToken();  }  private static int nextInt() {   return Integer.parseInt(nextToken());  }  private static long nextLong() {   return Long.parseLong(nextToken());  }  private static double nextDouble() {   return Double.parseDouble(nextToken());  }  private static BigInteger nextBigInteger() {   return new BigInteger(nextToken());  }  private static void print(Object o) {   if (fileIOMode) {    System.out.print(o);   }   out.print(o);  }  private static void println(Object o) {   if (fileIOMode) {    System.out.println(o);   }   out.println(o);  }  private static void printf(String s, Object... o) {   if (fileIOMode) {    System.out.printf(s, o);   }   out.printf(s, o);  } }
1	public class temp {  void solve() {  FastReader sc =new FastReader();  int n = sc.nextInt();   ArrayList<String> a[] = new ArrayList[5];   for(int i=0;i<=4;i++)  a[i] = new ArrayList<>();   for(int i=0;i<n;i++)  {  String s = sc.next();  a[s.length()].add(s);  }   int ans = 0;   for(int i=0;i<n;i++)  {  String s = sc.next();  if(a[s.length()].contains(s))   a[s.length()].remove(new String(s));  }   for(int i=1;i<=4;i++)  ans+=a[i].size();   System.out.println(ans); }   public static void main(String[] args)  {   new temp().solve();  }   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;   }  } }
3	public class C {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   int n = s.nextInt();   List<String> commands = IntStream.range(0, n).boxed().map(x -> s.next()).collect(Collectors.toList());   List<Integer> ways = new ArrayList<>();   ways.add(1);   boolean lastWasS = false;   for (String command : commands) {    boolean isS = "s".equals(command);    if (lastWasS) {     for (int i = 1; i < ways.size(); ++i) {      int waysNumber = (ways.get(i-1) + ways.get(i)) % 1_000_000_007;      ways.set(i, waysNumber);     }    }    if (!isS) {     ways.add(0);    }    lastWasS = isS;   }   System.out.println(ways.stream().reduce(0, (a, b) -> (a + b) % 1_000_000_007));  } }
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)); }  }
5	public class A {  int IOMode = 0;  String taskName = "";  void solve() throws IOException {   int n = nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = nextInt();   Arrays.sort(a);   int z = 0;   for (int i = 0; i < n; i++) {    if (a[i] != 1) z++;   }   if (z == 0 && n > 1) a[n - 2] = 2;   if (n == 1 && a[0] == 1) {    out.println(2);    return;   }   out.print("1 ");   for (int i = 0; i < n - 1; i++)    out.print(a[i] + " ");  }  public static void main(String[] args) throws IOException {   if (args.length > 0 && args[0].equals("Abra")) debugMode = true;   new A().run();  }  long startTime = System.nanoTime(), tempTime = startTime, finishTime = startTime;  long startMem = Runtime.getRuntime().totalMemory(), finishMem = startMem;  void run() throws IOException {   init();   if (debugMode) {    con.println("Start");    con.println("Console output:");   }   solve();   finishTime = System.nanoTime();   finishMem = Runtime.getRuntime().totalMemory();   out.flush();   if (debugMode) {    int maxSymbols = 1000, c = 0;    BufferedReader tbr = new BufferedReader(new FileReader("input.txt"));    char[] a = new char[maxSymbols];    tbr.read(a);    if (a[0] != 0) {     con.println();     con.println("File input:");     con.print(a);    }    boolean left = true;    for (int i = 0; i < maxSymbols; i++) left = left && a[i] != 0;    if (left) con.println("...");    else con.println();    tbr = new BufferedReader(new FileReader("output.txt"));    a = new char[maxSymbols];    tbr.read(a);    if (a[0] != 0) {     con.println();     con.println("File output:");     con.print(a);    }    left = true;    for (int i = 0; i < maxSymbols; i++) left = left && a[i] != 0;    if (left) con.println("...");    else con.println();    con.println("Time passed: " + (finishTime - startTime) / 1000000000.0 + " sec");    con.println("Memory used: " + (finishMem - startMem) + " bytes");    con.println("Total memory: " + Runtime.getRuntime().totalMemory() + " bytes");   }  }  boolean tick(double x) {   if (System.nanoTime() - tempTime > x) {    tempTime = System.nanoTime();    con.println("Tick at " + (tempTime - startTime) / 1000000000 + " sec");    con.print(" ");    return true;   }   return false;  }  void printTime() {   con.println((System.nanoTime() - tempTime) + " nanos passed");   tempTime = System.nanoTime();  }  static boolean debugMode = false;  PrintStream con = System.out;  void init() throws IOException {   if (debugMode && IOMode != 3) {    br = new BufferedReader(new FileReader("input.txt"));    out = new PrintWriter(new FileWriter("output.txt"));   } else    switch (IOMode) {     case 0:      br = new BufferedReader(new InputStreamReader(System.in));      out = new PrintWriter(System.out);      break;     case 1:      br = new BufferedReader(new FileReader(taskName + ".in"));      out = new PrintWriter(new FileWriter(taskName + ".out"));      break;     case 2:      br = new BufferedReader(new FileReader("input.txt"));      out = new PrintWriter(new FileWriter("output.txt"));      break;     case 3:      out = new PrintWriter(new FileWriter("input.txt"));      break;    }  }  BufferedReader br;  PrintWriter out;  StringTokenizer in;  boolean hasMoreTokens() throws IOException {   while (in == null || !in.hasMoreTokens()) {    String line = br.readLine();    if (line == null) return false;    in = new StringTokenizer(line);   }   return true;  }  String nextString() throws IOException {   return hasMoreTokens() ? in.nextToken() : null;  }  int nextInt() throws IOException {   return Integer.parseInt(nextString());  }  long nextLong() throws IOException {   return Long.parseLong(nextString());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextString());  } }
6	public class ASimpleTask {  static StreamTokenizer st;  static int nextInt() {  try {  st.nextToken();  } catch (IOException e) {    e.printStackTrace();  }  return (int) st.nval; }  static int[][] edges; static long[][] dp;  public static void main(String[] args) {  st = new StreamTokenizer(new BufferedReader(new InputStreamReader(   System.in)));  int n = nextInt();  int m = nextInt();  edges = new int[n][n];  for (int i = 0; i < m; i++) {  int from = nextInt() - 1;  int to = nextInt() - 1;  edges[from][to] = edges[to][from] = 1;  }  dp = new long[(1 << n) + 1][n + 1];  for (int mask = 1; mask < (1 << n); mask++) {  for (int i = 0; i < n; i++) {   if (Integer.bitCount(mask) == 1 && (mask & (1 << i)) != 0) {   dp[mask][i] = 1;   continue;   }   if (Integer.bitCount(mask) > 1 && (mask & (1 << i)) != 0    && first(mask, n) != i) {   for (int j = 0; j < n; j++) {    if (edges[i][j] == 1) {    dp[mask][i] += dp[mask ^ (1 << i)][j];    }   }   }  }  }  long count = 0;  for (int mask = 1; mask < (1 << n); mask++) {  for (int i = 0; i < n; i++) {   if (Integer.bitCount(mask) >= 3    && edges[i][first(mask, n)] != 0)   count += dp[mask][i];  }  }  System.out.println(count / 2);  }  static int first(int mask, int n) {  for (int i = 0; i < n; i++) {  if ((mask & (1 << i)) != 0)   return i;  }  return -1; } }
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 Main {  public static void main(String[] args) { Scanner input = new Scanner(System.in); Pattern rc_style = Pattern.compile("R[0-9]+C[0-9]+"); int n = input.nextInt();  while(n-- > 0) {  String str = input.next();  Matcher m = rc_style.matcher(str);   if(m.matches()) {  String nums[] = str.split("[RC]");  String row = nums[1];  String col = nums[2];   String buffer = "";  int col_num = Integer.valueOf(col);  while(col_num > 0) {   if(col_num % 26 > 0) {  buffer += (char)(col_num % 26 + 'A' - 1);  col_num /= 26;   } else {  buffer += 'Z';  col_num /= 26;  col_num--;   }  }  for(int i = buffer.length() - 1; i >= 0; i--)   System.out.print(buffer.charAt(i));   System.out.println(row);   } else {  String col = str.split("[0-9]+")[0];  String row = str.split("[A-Z]+")[1];  int col_num = 0;  int shift = 1;  for(int i = col.length() - 1; i >= 0; i--) {   col_num += (int) (col.charAt(i) - 'A' + 1) * shift;   shift *= 26;  }  System.out.println("R" + row + "C" + col_num);  } }  } }
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();   }   int min;   int count = 0;   int c = 0;   while (count != n) {    min = 1000;    for (int i = 0; i < n; i++) {     if (a[i] < min) {      min = a[i];     }    }    for (int i = 0; i < n; i++) {     if (a[i] != 1000 && a[i] % min == 0) {      count++;      a[i] = 1000;     }    }    c++;   }   System.out.println(c);  } }
3	public class Solution{   static class Node implements Comparable<Node>{   int sum;   int l;   int r;   Node next;   int nb;   Node ini;   boolean not;   public Node(int sum,int l,int r){    this.sum = sum;    this.l = l;    this.r = r;    nb = 0;    not = false;    ini = null;   }     @Override   public int compareTo(Node node){    if(sum-node.sum!=0) return sum-node.sum;    else if(l-node.l!=0) return l-node.l;    else return r - node.r;   }  }   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);     int n = Integer.parseInt(st.nextToken());     TreeSet<Node> ts = new TreeSet<Node>();     st = new StringTokenizer(br.readLine());   int[] a = new int[n+1];   for(int i=1;i<=n;i++) a[i] = Integer.parseInt(st.nextToken());     int[] s = new int[n+1];   for(int i=1;i<=n;i++) s[i] = s[i-1] + a[i];     for(int i=1;i<=n;i++){    for(int j=i;j<=n;j++){     ts.add(new Node(s[j]-s[i-1],i,j));    }   }   int minvalue = -2000*(int)Math.pow(10,5);   int maxvalue = 2000*(int)Math.pow(10,5);   ts.add(new Node(minvalue,0,0));   ts.add(new Node(maxvalue,0,0));     Node node = ts.higher(ts.first());     int sum = 0;          int max = 0;   Node m = null;     while(node.sum!=maxvalue){       sum = node.sum;    while(node.sum==sum){     node = ts.higher(node);    }       Node var = ts.lower(node);       max = 0;    while(var.sum==sum){         Node next = ts.higher(new Node(sum,var.r+1,0));         if(max>1+next.nb){      var.nb = max;      var.ini = m;     }     else if(next.ini==null){          var.nb = 1 + next.nb;      var.next = next;      if(max<var.nb){       max = var.nb;       m = var;      }                }else{           var.nb = 1 + next.nb;      var.next = next.ini;      if(max<var.nb){       max = var.nb;       m = var;      }          }             var = ts.lower(var);              }          }     int k = 0;   Node best = new Node(minvalue,0,0);      for(Node var:ts){    if(k<var.nb){     k = var.nb;     best = var;     if(var.ini!=null) best = var.ini;    }   }     if(k==0) System.out.println("erreur");   else{       out.println(k);    sum = best.sum;    while(best.sum==sum){     out.println(best.l+" "+best.r);     best = best.next;    }      }        out.flush();    }  }
0	public class HexadecimalsTheorem {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int num = in.nextInt();   LinkedList<Integer> result = new LinkedList<Integer>();   int temp0 = 1;   int temp1 = 1;   int temp2 = 0;   result.add(0);   result.add(0);   result.add(0);   result.add(temp0);   result.add(temp1);   if (num == 2) {    System.out.println(0 + " " + 1 + " " + 1);   } else if (num == 0) {    System.out.println(0 + " " + 0 + " " + 0);   } else {    while (temp2 < num) {     temp2 = temp1 + temp0;     result.add(temp2);     temp0 = temp1;     temp1 = temp2;    }    int length = result.size();    System.out.println(result.get(length - 5) + " "      + result.get(length - 4) + " " + result.get(length - 2));   }  } }
3	public class CF1141F1 {  static FastReader s;  static PrintWriter out;  static String INPUT = "7\n" +    "4 1 2 2 1 5 3\n";  public static void main(String[] args) {   long time = System.currentTimeMillis();   boolean oj = System.getProperty("ONLINE_JUDGE") != null;   out = new PrintWriter(System.out);   s = new FastReader(oj);   int n = s.nextInt();   int[] arr = s.nextIntArray(n);   int[] sum = new int[n];   sum[0] = arr[0];   for (int i = 1; i < n; i++) {    sum[i] = sum[i - 1] + arr[i];   }    HashMap<Integer, ArrayList<pair>> map = new HashMap<>();   for (int i = 0; i < n; i++) {    for (int j = i; j < n; j++) {     if(i == 0) {      ArrayList<pair> list = map.getOrDefault(sum[j], new ArrayList<>());      list.add(new pair(i, j));      map.put(sum[j], list);     } else {      ArrayList<pair> list = map.getOrDefault(sum[j] - sum[i - 1], new ArrayList<>());      list.add(new pair(i, j));      map.put(sum[j] - sum[i - 1], list);     }    }   }   ArrayList<Integer> keys = new ArrayList<>(map.keySet());   ArrayList<pair> ans = null;   for (int curr : keys) {    ArrayList<pair> list = map.get(curr);    Collections.sort(list);    ArrayList<pair> smallAns = new ArrayList<>();    smallAns.add(list.get(0));    for (int k = 1; k < list.size(); k++) {     if(list.get(k).start > smallAns.get(smallAns.size() - 1).finish) {      smallAns.add(list.get(k));     }    }    if(ans == null) {     ans = smallAns;    } else {     if(ans.size() < smallAns.size()) {      ans = smallAns;     }    }   }      StringBuilder ans1 = new StringBuilder();   ans1.append(ans.size() + "\n");   for (pair p : ans) {    ans1.append((p.start + 1) + " " + (p.finish + 1));    ans1.append("\n");   }   out.println(ans1);   if (!oj) {    System.out.println(Arrays.deepToString(new Object[]{System.currentTimeMillis() - time + " ms"}));   }   out.flush();  }  private static class pair implements Comparable<pair>{   int start;   int finish;   public pair(int start, int finish) {    this.start = start;    this.finish = finish;   }    @Override   public int compareTo(pair o) {    return Integer.compare(this.finish, o.finish);   }   @Override   public String toString() {    return this.start + " " + this.finish;   }  }  private static class Matrix {   static long[][] I;   static long mod = 1000000007;   public static long[][] exp(long[][] M, long n) {    if (n <= 0) {     I = new long[M.length][M.length];     for (int i = 0; i < M.length; i++) {      I[i][i] = 1L;     }     return I;    }    if (n == 1) return M;    long[][] res = exp(M, n / 2);    res = mult(res, res);    if (n % 2 == 0) return res;    return mult(res, M);   }   public static long[][] mult(long[][] p, long[][] q) {    long[][] r = new long[p.length][q[0].length];    for (int i = 0; i < p.length; i++)     for (int j = 0; j < q[0].length; j++)      for (int k = 0; k < q.length; k++) {       r[i][j] += p[i][k] * q[k][j];       r[i][j] %= mod;      }    return r;   }  }  private static class Maths {   static ArrayList<Long> printDivisors(long n) {       ArrayList<Long> list = new ArrayList<>();    for (long i = 1; i <= Math.sqrt(n); i++) {     if (n % i == 0) {      if (n / i == i) {       list.add(i);      } else {       list.add(i);       list.add(n / i);      }     }    }    return list;   }      private static long gcd(long a, long b) {    if (b == 0) {     return a;    }    return gcd(b, a % b);   }       static long[] extendedEuclidean(long p, long q) {    if (q == 0)     return new long[]{p, 1, 0};    long[] vals = extendedEuclidean(q, p % q);    long d = vals[0];    long a = vals[2];    long b = vals[1] - (p / q) * vals[2];    return new long[]{d, a, b};   }      static long power(long x, long y, long p) {    long res = 1;    x = x % p;    while (y > 0) {     if ((y & 1) == 1)      res = (res * x) % p;     y = y >> 1;     x = (x * x) % p;    }    return res;   }             static long inv(long a, long m) {    long m0 = m, t, q;    long x0 = 0, x1 = 1;    if (m == 1)     return 0;        while (a > 1) {     q = a / m;     t = m;     m = a % m;     a = t;     t = x0;     x0 = x1 - q * x0;     x1 = t;    }        if (x1 < 0)     x1 += m0;    return x1;   }                          static long findMinX(long num[], long rem[], long k) {    int prod = 1;    for (int i = 0; i < k; i++)     prod *= num[i];    int result = 0;    for (int i = 0; i < k; i++) {     long pp = prod / num[i];     result += rem[i] * inv(pp, num[i]) * pp;    }    return result % prod;   }  }  private static class BS {     private static int binarySearch(int[] arr, int ele) {    int low = 0;    int high = arr.length - 1;    while (low <= high) {     int mid = (low + high) / 2;     if (arr[mid] == ele) {      return mid;     } else if (ele < arr[mid]) {      high = mid - 1;     } else {      low = mid + 1;     }    }    return -1;   }      private static int binarySearchFirstOccurence(int[] arr, int ele) {    int low = 0;    int high = arr.length - 1;    int ans = -1;    while (low <= high) {     int mid = (low + high) / 2;     if (arr[mid] == ele) {      ans = mid;      high = mid - 1;     } else if (ele < arr[mid]) {      high = mid - 1;     } else {      low = mid + 1;     }    }    return ans;   }      private static int binarySearchLastOccurence(int[] arr, int ele) {    int low = 0;    int high = arr.length - 1;    int ans = -1;    while (low <= high) {     int mid = (low + high) / 2;     if (arr[mid] == ele) {      ans = mid;      low = mid + 1;     } else if (ele < arr[mid]) {      high = mid - 1;     } else {      low = mid + 1;     }    }    return ans;   }  }  private static class arrays {     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(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 sort(int[] arr) {    sort(arr, 0, arr.length - 1);   }  }  private static class UnionFindDisjointSet {   int[] parent;   int[] size;   int n;   int size1;   public UnionFindDisjointSet(int n) {    this.n = n;    this.parent = new int[n];    this.size = new int[n];    for (int i = 0; i < n; i++) {     parent[i] = i;    }    for (int i = 0; i < n; i++) {     size[i] = 1;    }    this.size1 = n;   }   private int numDisjointSets() {    System.out.println(size1);    return size1;   }   private boolean find(int a, int b) {    int rootA = root(a);    int rootB = root(b);    if (rootA == rootB) {     return true;    }    return false;   }   private int root(int b) {    if (parent[b] != b) {     return parent[b] = root(parent[b]);    }    return b;   }   private void union(int a, int b) {    int rootA = root(a);    int rootB = root(b);    if (rootA == rootB) {     return;    }    if (size[rootA] < size[rootB]) {     parent[rootA] = parent[rootB];     size[rootB] += size[rootA];    } else {     parent[rootB] = parent[rootA];     size[rootA] += size[rootB];    }    size1--;    System.out.println(Arrays.toString(parent));   }  }  private static class SegTree {   int[] st;   int[] arr;   public SegTree(int[] arr) {    this.arr = arr;    int size = (int) Math.ceil(Math.log(arr.length) / Math.log(2));    st = new int[(int) ((2 * Math.pow(2, size)) - 1)];    buildSegmentTree(1, 0, arr.length - 1);   }      private void buildSegmentTree(int index, int L, int R) {    if (L == R) {     st[index] = arr[L];     return;    }    buildSegmentTree(index * 2, L, (L + R) / 2);    buildSegmentTree(index * 2 + 1, (L + R) / 2 + 1, R);    st[index] = Math.min(st[index * 2], st[index * 2 + 1]);   }      private int Query(int queL, int queR) {    return Query1(1, 0, arr.length - 1, queL, queR);   }        private int Query1(int index, int segL, int segR, int queL, int queR) {    if (queL > segR || queR < segL) {     return -1;    }    if (queL <= segL && queR >= segR) {     return st[index];    }    int ans1 = Query1(index * 2, segL, (segL + segR) / 2, queL, queR);    int ans2 = Query1(index * 2 + 1, (segL + segR) / 2 + 1, segR, queL, queR);    if (ans1 == -1) {     return ans2;    }    if (ans2 == -1) {     return ans1;    }    return Math.min(ans1, ans2);   }   private void update(int idx, int val) {    update1(1, 0, arr.length - 1, idx, val);   }   private void update1(int node, int queL, int queR, int idx, int val) {           if (queL == queR) {         arr[idx] += val;     st[node] += val;    } else {     int mid = (queL + queR) / 2;     if (queL <= idx && idx <= mid) {           update1(2 * node, queL, mid, idx, val);     } else {           update1(2 * node + 1, mid + 1, queR, idx, val);     }         st[node] = Math.min(st[2 * node], st[2 * node + 1]);    }   }  }  private static class FastReader {   InputStream is;   public FastReader(boolean onlineJudge) {    is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());   }   byte[] inbuf = new byte[1024];   public int lenbuf = 0, ptrbuf = 0;   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++];   }   boolean isSpaceChar(int c) {    return !(c >= 33 && c <= 126);   }   int skip() {    int b;    while ((b = readByte()) != -1 && isSpaceChar(b))     ;    return b;   }   double nextDouble() {    return Double.parseDouble(next());   }   char nextChar() {    return (char) skip();   }   String next() {    int b = skip();    StringBuilder sb = new StringBuilder();    while (!(isSpaceChar(b))) {     sb.appendCodePoint(b);     b = readByte();    }    return sb.toString();   }   String nextLine() {    int b = skip();    StringBuilder sb = new StringBuilder();    while ((!isSpaceChar(b) || b == ' ')) {     sb.appendCodePoint(b);     b = readByte();    }    return sb.toString();   }   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);   }   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 * 10 + (b - '0');     } else {      return minus ? -num : num;     }     b = readByte();    }   }   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 * 10 + (b - '0');     } else {      return minus ? -num : num;     }     b = readByte();    }   }   char[][] nextMatrix(int n, int m) {    char[][] map = new char[n][];    for (int i = 0; i < n; i++)     map[i] = next(m);    return map;   }   int[] nextIntArray(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }   long[] nextLongArray(int n) {    long[] a = new long[n];    for (int i = 0; i < n; i++)     a[i] = nextLong();    return a;   }   int[][] next2DInt(int n, int m) {    int[][] arr = new int[n][];    for (int i = 0; i < n; i++) {     arr[i] = nextIntArray(m);    }    return arr;   }   long[][] next2DLong(int n, int m) {    long[][] arr = new long[n][];    for (int i = 0; i < n; i++) {     arr[i] = nextLongArray(m);    }    return arr;   }   int[] shuffle(int[] arr) {    Random r = new Random();    for (int i = 1, j; i < arr.length; i++) {     j = r.nextInt(i);     arr[i] = arr[i] ^ arr[j];     arr[j] = arr[i] ^ arr[j];     arr[i] = arr[i] ^ arr[j];    }    return arr;   }   int[] uniq(int[] arr) {    Arrays.sort(arr);    int[] rv = new int[arr.length];    int pos = 0;    rv[pos++] = arr[0];    for (int i = 1; i < arr.length; i++) {     if (arr[i] != arr[i - 1]) {      rv[pos++] = arr[i];     }    }    return Arrays.copyOf(rv, pos);   }  } }
4	public class ProblemC {  static int[] dx = {1, 0, 0, -1}; static int[] dy = {0, 1, -1, 0};   public static void main(String[] args) throws IOException {  BufferedReader s = new BufferedReader(new FileReader("input.txt"));  PrintWriter out = new PrintWriter(new FileWriter("output.txt"));    String[] nm = s.readLine().split(" ");  int n = Integer.valueOf(nm[0]);  int m = Integer.valueOf(nm[1]);  int k = Integer.valueOf(s.readLine());   int[][] dp = new int[n][m];  for (int i = 0 ; i < n ; i++) {  Arrays.fill(dp[i], Integer.MAX_VALUE);  }  String[] st = s.readLine().split(" ");  int[][] trees = new int[k][2];  for (int l = 0 ; l < k ; l++) {  trees[l][0] = Integer.valueOf(st[l*2])-1;  trees[l][1] = Integer.valueOf(st[l*2+1])-1;  }   int maxtime = -1;  int max_x = -1;  int max_y = -1;  for (int i = 0 ; i < n ; i++) {  for (int j = 0 ; j < m ; j++) {   int minDist = n+m;   for (int l = 0 ; l < k ; l++) {   minDist = Math.min(minDist, Math.abs(i - trees[l][0]) + Math.abs(j - trees[l][1]));   }   if (maxtime < minDist) {   maxtime = minDist;   max_x = i+1;   max_y = j+1;   }  }  }      out.println(max_x + " " + max_y);  out.flush(); }  public static void debug(Object... os){  System.err.println(Arrays.deepToString(os)); } }
6	public class Main11D {  private FastScanner in;  private PrintWriter out;  public void solve() throws IOException {   int N = in.nextInt();   int M = in.nextInt();   int[][] edges = new int[N][N];   for(int i = 0; i < M; i++){    int a = in.nextInt() - 1;    int b = in.nextInt() - 1;    edges[a][b] = 1;    edges[b][a] = 1;   }   int globalCountMasks = 1 << N;   int[][] masks = new int[N + 1][];   int[] countMasks = new int[N + 1];   for(int i = 0; i <= N; i++){    masks[i] = new int[combinations(N, i)];   }   for(int i = 0; i < globalCountMasks; i++){    int c = countBit1(i);    masks[c][countMasks[c]] = i;    countMasks[c]++;   }   long globalCountCycles = 0;   long[][] count = new long[globalCountMasks][N];   for(int a = 0; a < N - 2; a++){    int aBit = 1 << a;    count[aBit][a] = 1;    long countCycles = 0;    for(int i = 2; i <= N; i++){     for(int m = 0; m < countMasks[i]; m++){      int mask = masks[i][m];      if((mask & aBit) == 0) continue;      if((mask & (aBit - 1)) > 0) continue;      count[mask][a] = 0;      for(int v = a + 1; v < N; v++){       int vBit = 1 << v;       if((mask & vBit) == 0) continue;       count[mask][v] = 0;       for(int t = a; t < N; t++){        if((mask & (1 << t)) == 0 || t == v || edges[v][t] == 0) continue;        count[mask][v] += count[mask ^ vBit][t];       }       if(edges[a][v] == 1 && mask != (aBit | vBit)){        countCycles += count[mask][v];       }      }     }    }    globalCountCycles += countCycles / 2;   }   out.println(globalCountCycles);  }  private int countBit1(int k){   int c = 0;   while(k > 0){    c += k & 1;    k >>= 1;   }   return c;  }  private int combinations(int n, int k){   if(k > n || k < 0){    throw new IllegalArgumentException();   }   int r = 1;   for(int i = 1; i <= k; i++){    r = r * (n + 1 - i) / i;   }   return r;  }  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());   }  }  public static void main(String[] arg) {   new Main11D().run();  } }
4	public class D {   static int mod = (int) (1e9+7);  static InputReader in;  static PrintWriter out;    static void solve()  {    in = new InputReader(System.in);   out = new PrintWriter(System.out);      int t = 1;     while(t-- > 0) {   int n = in.nextInt();   int m = in.nextInt();   int K = in.nextInt();      long[][] x = new long[n][];      for(int i = 0; i < n; i++) {    x[i] = in.nextLongArray(m - 1);   }      long[][] y = new long[n - 1][];   for(int i = 0; i < n - 1; i++) {    y[i] = in.nextLongArray(m);   }      if(K % 2 != 0) {    for(int i = 0; i < n; i++) {     for(int j = 0; j < m; j++) {     out.print("-1 ");     }     out.println();    }    continue;   }   K /= 2;      long[][][] dp = new long[K + 1][n][m];      for(int i = 0; i < n; i++) {    for(int j = 0; j < m; j++) {    for(int k = 1; k <= K; k++) {     dp[k][i][j] = Integer.MAX_VALUE;    }    }   }      for(int k = 1; k <= K; k++) {    for(int i = 0; i < n; i++) {    for(int j = 0; j < m; j++) {     if(i + 1 < n) {     dp[k][i][j] = Math.min(dp[k][i][j], dp[k - 1][i + 1][j] + 2 * y[i][j]);     }     if(i - 1 >= 0) {     dp[k][i][j] = Math.min(dp[k][i][j], dp[k - 1][i - 1][j] + 2 * y[i - 1][j]);     }     if(j + 1 < m) {     dp[k][i][j] = Math.min(dp[k][i][j], dp[k - 1][i][j + 1] + 2 * x[i][j]);     }     if(j - 1 >= 0) {     dp[k][i][j] = Math.min(dp[k][i][j], dp[k - 1][i][j - 1] + 2 * x[i][j - 1]);     }    }    }   }      for(int i = 0; i < n; i++) {    for(int j = 0; j < m; j++) {    out.print(dp[K][i][j] + " ");    }    out.println();   }      }     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 int[][] graph(int from[], int to[], int n)  {   int g[][] = new int[n][];   int cnt[] = new int[n];   for (int i = 0; i < from.length; i++) {    cnt[from[i]]++;    cnt[to[i]]++;   }   for (int i = 0; i < n; i++) {    g[i] = new int[cnt[i]];   }   Arrays.fill(cnt, 0);   for (int i = 0; i < from.length; i++) {    g[from[i]][cnt[from[i]]++] = to[i];    g[to[i]][cnt[to[i]]++] = from[i];   }   return g;  }   static class Pair implements Comparable<Pair>{   int x,y,z;    Pair (int x,int y,int z){  this.x=x;  this.y=y;  this.z=z;  }     public int compareTo(Pair o) {  if (this.x == o.x)   return Integer.compare(this.y,o.y);  return Integer.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;   }   public int hashCode() {    return new Integer(x).hashCode() * 31 + new Integer(y).hashCode();   }     @Override   public String toString() {   return x + " " + y;   }   }    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 int abs(int a, int b) {   return (int) Math.abs(a - b);  }  static long abs(long a, long b) {   return (long) Math.abs(a - b);  }  static int max(int a, int b) {   if (a > b) {    return a;   } else {    return b;   }  }  static int min(int a, int b) {   if (a > b) {    return b;   } else {    return a;   }  }  static long max(long a, long b) {   if (a > b) {    return a;   } else {    return b;   }  }  static long min(long a, long b) {   if (a > b) {    return b;   } else {    return a;   }  }  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;   }   if (p == 1) {    return n;   }   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);   }  } }
4	public class Main { public static void main(String[] args) {  InputStream inputStream;  try {  inputStream = new FileInputStream("input.txt");  } catch (IOException e) {  throw new RuntimeException(e);  }  OutputStream outputStream;  try {  outputStream = new FileOutputStream("output.txt");  } catch (IOException e) {  throw new RuntimeException(e);  }  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 maxdist = -1, maxrow = -1, maxcol = -1;  int rows = in.ri(), cols = in.ri();  int k = in.ri();  IntPair[] points = new IntPair[k];  for(int i = 0; i < k; i++) points[i] = new IntPair(in.ri(), in.ri());  for(int row = 1; row <= rows; row++) {   for(int col = 1; col <= cols; col++) {   int mindist = Integer.MAX_VALUE;   for(int i = 0; i < k; i++)    mindist = Math.min(mindist, Math.abs(row - points[i].first) + Math.abs(col - points[i].second));   if (mindist > maxdist){    maxdist = mindist;    maxrow = row;    maxcol = col;   }   }  }  out.printLine(maxrow, maxcol);  } } 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 ri(){  return readInt(); }  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); } } class OutputWriter { private final PrintWriter writer;  public OutputWriter(OutputStream outputStream) {  writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } 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 IntPair implements Comparable<IntPair> { public int first, second;  public IntPair(int first, int second) {  this.first = first;  this.second = second; } public String toString() {  return "(" + first + "," + second + ")"; }  public boolean equals(Object o) {  if (this == o) return true;  if (o == null || getClass() != o.getClass()) return false;  IntPair intPair = (IntPair) o;  return first == intPair.first && second == intPair.second;  }  public int hashCode() {  int result = first;  result = 31 * result + second;  return result; }  public int compareTo(IntPair o) {  if (first < o.first)  return -1;  if (first > o.first)  return 1;  if (second < o.second)  return -1;  if (second > o.second)  return 1;  return 0; } }
4	public class C {  public static void main(String[] args) throws Exception  {  new C(new Scanner(new File("input.txt")), new PrintWriter("output.txt"));  }  int oo = 987654321;  int W, H;  public C(Scanner in, PrintWriter out)  {  W = in.nextInt();  H = in.nextInt();   int[][] grid = new int[W][H];  for (int[] gri : grid)   Arrays.fill(gri, oo);    ArrayDeque<Node> q = new ArrayDeque<Node>();  int K = in.nextInt();  for (int u=0; u<K; u++)  {   q.add(new Node(in.nextInt()-1, in.nextInt()-1, 0));   while (q.size() > 0)   {    Node cur = q.poll();    if (grid[cur.x][cur.y] <= cur.d)     continue;    grid[cur.x][cur.y] = cur.d;    if (cur.x+1<W)     q.add(new Node(cur.x+1, cur.y, cur.d+1));    if (cur.x>0)     q.add(new Node(cur.x-1, cur.y, cur.d+1));    if (cur.y+1<H)     q.add(new Node(cur.x, cur.y+1, cur.d+1));    if (cur.y>0)     q.add(new Node(cur.x, cur.y-1, cur.d+1));   }  }   int res = 0;  for (int j=0; j<H; j++)   for (int i=0; i<W; i++)    res = Math.max(res, grid[i][j]);   for (int j=0; j<H; j++)   for (int i=0; i<W; i++)    if (res == grid[i][j])    {     out.printf("%d %d%n", i+1, j+1);     out.close();     return;    }  } } class Node {  int x, y, d;  public Node(int xx, int yy, int dd)  {  x=xx; y=yy; d=dd;  } }
6	public class D {  public void run(Scanner in, PrintWriter out) {   int n = in.nextInt();   int[][] graph = new int[n][n];   int m = in.nextInt();   for (int i = 0; i < m; i++) {    int x = in.nextInt() - 1;    int y = in.nextInt() - 1;    graph[x][y] = 1;    graph[y][x] = 1;   }   long[][] dyn = new long[1 << n][n];   for (int i = 0; i < n; i++) {    dyn[1 << i][i] = 1;   }   long answer = 0;   for (int mask = 1; mask < 1 << n; mask++) {    int start = Integer.numberOfTrailingZeros(mask);    for (int i = 0; i < n; i++) {     if ((mask & (1 << i)) == 0) continue;     for (int j = start + 1; j < n; j++) {      if (graph[i][j] > 0 && (mask & (1 << j)) == 0) {       dyn[mask + (1 << j)][j] += dyn[mask][i];      }     }     if (graph[i][start] > 0) {      answer += dyn[mask][i];     }    }   }   out.println((answer - m)/ 2);  }  public static void main(String[] args) {   try (Scanner in = new Scanner(System.in);    PrintWriter out = new PrintWriter(System.out)   ) {    new D().run(in, out);   } catch (Exception e) {    e.printStackTrace();   }  } }
0	public class subtractions {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);   int n=sc.nextInt();     while(n-->0){    int a=sc.nextInt();    int b=sc.nextInt();       int c=0;    while(a!=0 && b!=0){     if(a>b){      int t=a;      a=b;      b=t;     }     c+=b/a;     b=b%a;    }    System.out.println(c);   }  } }
5	public class codeee {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);   int n=sc.nextInt();   if(n==1){System.out.println(1); return;}   int []mas=new int[n];   int sum=0;   for (int i = 0; i < n; i++) {    mas[i]=sc.nextInt();    sum+=mas[i];   }   Arrays.sort(mas);   int sum1=0;   int ans=0;   for(int i=0;i<n;i++){    sum1+=mas[n-i-1];    if(sum1>(sum-sum1)){     ans=i;     break;    }   }   System.out.println(ans+1);  } }
1	public class IQTest implements Runnable {  BufferedReader in;  PrintWriter out;  StringTokenizer tok;  public static void main(String[] args) {   new Thread(new IQTest()).start();  }  void solve() throws IOException {   int n = nextInt();   List<Integer> l1 = new ArrayList<Integer>();   List<Integer> l2 = new ArrayList<Integer>();   for (int i = 0; i < n; ++i) {    int k = nextInt();    if (k % 2 == 0) l1.add(i + 1);    else l2.add(i + 1);   }   if (l1.size() == 1)    out.println(l1.get(0));   else out.println(l2.get(0));  }  public void run() {   try {    in = new BufferedReader(new InputStreamReader(System.in));       out = new PrintWriter(System.out);       solve();    out.flush();    out.close();    in.close();   } catch (IOException e) {       e.printStackTrace();   }  }  String nextLine() throws IOException {   tok = null;   return in.readLine();  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  String nextToken() throws IOException {   while (tok == null || !tok.hasMoreTokens()) {    tok = new StringTokenizer(in.readLine());   }   return tok.nextToken();  } }
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)); } }
0	public class A125D2 {  public static void main(String[] args) throws Exception {  InputReader in = new InputReader(System.in);  System.out.println(0 + " " + 0 + " " + in.nextInt()); }  static 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());  } } }
4	public class A0023 {  public static void main(String args[]) throws Exception {   new A0023();  }  A0023() throws Exception {   PandaScanner sc = null;   PrintWriter out = null;   try {    sc = new PandaScanner(System.in);    out = new PrintWriter(System.out);   } catch (Exception ignored) {   }   String s = sc.next();   int i = s.length() - 1;   Test: for (; i > 0; i--) {    HashSet<String> set = new HashSet<String>();    for (int j = 0; j + i <= s.length(); j++) {     String ss = s.substring(j, j + i);     if (set.contains(ss)) {      break Test;     }     set.add(ss);    }   }   out.println(i);   out.close();   System.exit(0);  }    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 B { private Scanner in; private PrintWriter out;  public void solve() {  String str = in.next();   List<String> sp = new ArrayList<String>();  StringBuilder sb = null;  int kind = -1;  for(int i = 0;i < str.length();i++){  char c = str.charAt(i);  if(c >= 'A' && c <= 'Z' && kind != 0){   if(sb != null){   sp.add(sb.toString());   }   sb = new StringBuilder();   kind = 0;  }  if(c >= '0' && c <= '9' && kind != 1){   if(sb != null){   sp.add(sb.toString());   }   sb = new StringBuilder();   kind = 1;  }  sb.append(c);  }  sp.add(sb.toString());  if(sp.size() == 2){    String bc = sp.get(0);  int v = 0;  for(int i = 0;i < bc.length();i++){   v = 26 * v + (bc.charAt(i) - 'A' + 1);  }    out.println("R" + sp.get(1) + "C" + Integer.toString(v));  }else{      int v = Integer.parseInt(sp.get(3));  StringBuilder sbb = new StringBuilder();  for(;v > 0;v/=26){   v--;   sbb.append((char)((v % 26) + 'A'));  }  sbb.reverse();    out.println(sbb.toString() + sp.get(1));  }   out.flush(); }  public void run() throws Exception {   in = new Scanner(System.in);  out = new PrintWriter(System.out);   int n = in.nextInt();  for(int i = 1;i <= n;i++){  long t = System.currentTimeMillis();  solve();  } }   public static void main(String[] args) throws Exception {  new B().run(); }  private int ni() { return Integer.parseInt(in.next()); } private static void tr(Object... o) { System.out.println(o.length == 1 ? o[0] : Arrays.toString(o)); } private void tra(int[] a) {System.out.println(Arrays.toString(a));} private void tra(int[][] a) {  for(int[] e : a){  System.out.println(Arrays.toString(e));  } }  }
5	public class CodeForces {  public void solve() throws IOException {  int n=nextInt();  int t=nextInt();  double larr[]=new double [n];  double rarr[]=new double [n];   for(int i=0;i<n;i++){  double x=nextDouble();  double r=nextDouble();  larr[i]=x-r/2;  rarr[i]=x+r/2;  }  Arrays.sort(larr);  Arrays.sort(rarr);   int counter=2;  for(int i=1;i<n;i++){  if(larr[i]-rarr[i-1]>t){   counter+=2;  } else if(larr[i]-rarr[i-1]==t){   counter++;  }  }   writer.print(counter); }  public static void main(String[] args) {  new CodeForces().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 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);   G1PleilistDlyaPolikarpaUproshennayaVersiya solver = new G1PleilistDlyaPolikarpaUproshennayaVersiya();   solver.solve(1, in, out);   out.close();  }  static class G1PleilistDlyaPolikarpaUproshennayaVersiya {   static final int MOD = (int) 1e9 + 7;   int n;   int t;   int[][] a = new int[15][2];   long[][] mem = new long[1 << 15][4];   public void solve(int testNumber, InputReader in, PrintWriter out) {    for (int i = 0; i < (1 << 15); i++) {     for (int h = 0; h < 4; h++) {      mem[i][h] = -1;     }    }    n = in.nextInt();    t = in.nextInt();    for (int i = 0; i < n; i++) {     a[i][0] = in.nextInt();     a[i][1] = in.nextInt();    }    out.println(doit(0, 0, 0));   }   private long doit(int mask, int genre, int sum) {    if (mem[mask][genre] != -1) {     return mem[mask][genre];    }    if (sum > t) {     mem[mask][genre] = 0;     return mem[mask][genre];    }    if (sum == t) {     mem[mask][genre] = 1;     return mem[mask][genre];    }    long ct = 0;    for (int i = 0; i < n; i++) {     if ((mask & (1 << i)) > 0 || genre == a[i][1]) {      continue;     }     ct = (ct + doit(mask | (1 << i), a[i][1], sum + a[i][0])) % MOD;    }    mem[mask][genre] = ct;    return mem[mask][genre];   }  }  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());   }  } }
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());   }  } }
0	public class myTemplate {    public static void main(String[] args) throws Exception{     java.io.BufferedReader br = new java.io.BufferedReader(new      java.io.InputStreamReader(System.in));     int ch[],arr[];   int x,i,j,k,t,n=Integer.parseInt(br.readLine());        if(n>0)    System.out.println(n);   else   {           x= n/100;       x = x*10 + n%10;       if(n/10 > x)     System.out.println(n/10);    else    System.out.println(x);      }    } }
1	public class R495A { public static void main(String[] args) {  Scanner scan=new Scanner(System.in);  int n=scan.nextInt(), k=scan.nextInt();  int[] a=new int[n];  for(int i=0;i<n;i++) a[i]=scan.nextInt();  int res=2;  for(int i=0;i<n-1;i++) {  if(a[i+1]-a[i]>2*k) res+=2;  else if(a[i+1]-a[i]==2*k) res++;  }  System.out.println(res); } }
5	public class Main implements Runnable { private BufferedReader in; private PrintWriter out; private StringTokenizer st; private Random rnd;  private void solve() throws IOException {  int n = nextInt();   int[] a = new int[n];  int max = 0;  for(int i = 0; i < n; i++) {  a[i] = nextInt();  if(a[i] > a[max]) max = i;  }   int value = 1;   if(a[max] == 1) value = 2;   a[max] = value;   Arrays.sort(a);   for(int i = 0; i < n; i++) {  out.print(a[i]);  out.print(' ');  } }   public static void main(String[] args) {  new Main().run(); }   public void run() {  try {  try {   in = new BufferedReader(new FileReader("INPUT.TXT"));   out = new PrintWriter(new FileWriter("OUTPUT.TXT"));  } catch(FileNotFoundException e) {   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 PracticeProblem {   public static class FastReader  {   BufferedReader br;   StringTokenizer st;   public FastReader() throws FileNotFoundException   {    br = new BufferedReader(new FileReader(new File("input.txt")));   }   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 FastReader in;  public static PrintWriter out;  public static final int INF = Integer.MAX_VALUE;  public static int n, m;  public static final int[] dr = {-1, 0, 0, +1};  public static final int[] dc = {0, -1, +1, 0};  public static void main(String[] args) throws FileNotFoundException  {   in = new FastReader();   out = new PrintWriter(new File("output.txt"));   solve();   out.close();  }  private static void solve()  {   n = in.nextInt();   m = in.nextInt();   int k = in.nextInt();   int[][] timeToBurn = new int[n][m];   for (int i = 0; i < n; i++)    Arrays.fill(timeToBurn[i], INF);   for (int i = 0; i < k; i++)   {    int r = in.nextInt() - 1;    int c = in.nextInt() - 1;    for (int j = 0; j < n; j++)    {     for (int l = 0; l < m; l++)     {      timeToBurn[j][l] = min(timeToBurn[j][l], abs(r - j) + abs(c - l));     }    }   }   int max = -1;   Point p = null;   for (int i = 0; i < n; i++)   {    for (int j = 0; j < m; j++)    {     if (timeToBurn[i][j] > max)     {      max = timeToBurn[i][j];      p = new Point(i, j);     }    }   }   out.println((p.x + 1) + " " + (p.y + 1));  } }
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]);  }  }
4	public class FireAgain {  public static void main(String[] args) throws IOException {  System.setIn(new FileInputStream("input.txt"));  System.setOut(new PrintStream("output.txt"));   BufferedReader r = new BufferedReader(new InputStreamReader(System.in));  String s[] = r.readLine().split("\\s+");  int n = Integer.parseInt(s[0]);  int m = Integer.parseInt(s[1]);  int k = Integer.parseInt(r.readLine());  int[][] a = new int[n][m];  for(int i = 0; i < n; i++) {  for(int j = 0; j < m; j++)   a[i][j] = Integer.MAX_VALUE;  }  assert k >= 1 && k < n * m;  int max = 0;  StringTokenizer st = new StringTokenizer(r.readLine());  assert st.countTokens() == k;  for(; k > 0; k--) {  int x = Integer.parseInt(st.nextToken()) - 1;  int y = Integer.parseInt(st.nextToken()) - 1;  assert x >= 1 && x <= n && y >= 1 && y <= n;   for(int i = 0; i < n; i++) {   for(int j = 0; j < m; j++) {   int d = Math.abs(i - x) + Math.abs(j - y);   if(a[i][j] > d)    a[i][j] = d;   if(k == 1 && a[i][j] > max)    max = a[i][j];   }  }  }  for(int i = 0; i < n; i++) {  for(int j = 0; j < m; j++) {   if(a[i][j] == max) {   System.out.println((i + 1) + " " + (j + 1));   return;   }  }  }  } }
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();  }     }
4	public class Main { public static void main(String args[]) throws IOException  {  Scanner c = new Scanner(new FileReader("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  int N=c.nextInt();  int M=c.nextInt();  int A[][]=new int[N][M];  for(int i=0;i<N;i++)  Arrays.fill(A[i],Integer.MAX_VALUE/100);  int K=c.nextInt();  for(int i=0;i<K;i++)  {  int x=c.nextInt()-1;  int y=c.nextInt()-1;  for(int i1=0;i1<N;i1++)   {   for(int j1=0;j1<M;j1++)   A[i1][j1]=Math.min(A[i1][j1],Math.abs(i1-x)+Math.abs(j1-y));   }  }  int maxi=0;  int maxj=0;  for(int i=0;i<N;i++)  {  for(int j=0;j<M;j++)   {   if(A[i][j]>A[maxi][maxj])   {   maxi=i;   maxj=j;   }   }  }  out.println((maxi+1)+" "+(maxj+1));  out.close();  } }
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 {  class Pair{  public int a;  public int b;  public Pair(int a, int b) {    this.a = a;  this.b = b;  } }  public void solve(int testNumber, Scanner in, PrintWriter out) {   int n = in.nextInt();   int k = in.nextInt(); --k;   ArrayList<Pair> list = new ArrayList<Pair>();  for (int i = 1; i <= n; ++i){    int num = in.nextInt();    int pen = in.nextInt();  Pair t = new Pair(num, pen);   list.add(t);   }   Collections.sort(list, new Comparator<Pair>(){   public int compare(Pair o1, Pair o2){   if (o1.a != o2.a){    return (o2.a - o1.a);   }   return (o1.b - o2.b);   }  });   int res = 1;   Pair compare = list.get(k);   int i = k - 1;   while (i >= 0){    Pair t = list.get(i);    if (t.a == compare.a && t.b == compare.b){     --i;     ++res;     continue;    }else{     break;    }   }   i = k + 1;   while (i < list.size()){    Pair t = list.get(i);    if (t.a == compare.a && t.b == compare.b){     ++res; ++i;     continue;    }else{     break;    }   }   out.println(res);   return;  } }
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; } }
1	public class code1 {   public static long[][] cnt;  public static void main(String[] args)  {  InputReader in = new InputReader(System.in);  PrintWriter pw = new PrintWriter(System.out);                  int n = in.nextInt();  long d = in.nextInt();  long[] a = new long[n];  for(int i=0; i<n; i++)   a[i] = in.nextLong();      int ans = 0;    HashSet<Long> set = new HashSet<>();    for(int i=1; i<n; i++)  {          long dis = (long) Math.abs(a[i]-a[i-1]);     if(dis==2*d)   ans++;     if(dis-(long)2*d>0)   ans += 2;       }  pw.println(ans+2);                  pw.flush();  pw.close();  }           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 c = 0;   public static long mod = 1000000007;  public static int d;  public static int p;  public static int q;  public static boolean flag;  public static long INF= Long.MAX_VALUE;   public static long fun(int[] a, int[] b, int m,int n) {  long result =0;  for(int i=0; i<m; i++)   for(int j=0; j<m; j++)   {   long[] fib = new long[Math.max(2, n+2)];   fib[1] = a[i];   fib[2] = b[j];   for(int k=3; k<=n; k++)    fib[k] = (fib[k-1]%mod + fib[k-2]%mod)%mod;   result = (result%mod + fib[n]%mod)%mod;   }    return result;    }     public static double slope(pair p1, pair p2)  {  double m = INF;  if((p1.x - p2.x)!=0)  m = (p1.y - p2.y)/(p1.x - p2.x);       return Math.abs(m);    }     public static int count(String[] s, int f)  {  int count = 0;  int n = s[0].length();    if(f==1)  {  for(int i = 0; i<n; i++)  {   for(int j=0; j<n; j++)   {   if(i%2==0)   {    if(j%2==0 && s[i].charAt(j)=='0')    count++;    if(j%2==1 && s[i].charAt(j)=='1')    count++;   }   if(i%2==1)   {    if(j%2==1 && s[i].charAt(j)=='0')    count++;    if(j%2==0 && s[i].charAt(j)=='1')    count++;   }      }  }  }  else  {     count = 0;    for(int i = 0; i<n; i++)  {   for(int j=0; j<n; j++)   {   if(i%2==1)   {    if(j%2==0 && s[i].charAt(j)=='0')    count++;    if(j%2==1 && s[i].charAt(j)=='1')    count++;   }   if(i%2==0)   {    if(j%2==1 && s[i].charAt(j)=='0')    count++;    if(j%2==0 && s[i].charAt(j)=='1')    count++;   }      }  }   }       return count;        }    public static int gcd(int p2, int p22)  {   if (p2 == 0)    return (int) p22;   return gcd(p22%p2, p2);  }         public static int findGCD(int arr[], int n)  {   int result = arr[0];   for (int i=1; i<n; i++)    result = gcd(arr[i], result);     return result;  }     public static void nextGreater(long[] a, int[] ans)  {    Stack<Integer> stk = new Stack<>();  stk.push(0);      for(int i=1; i<a.length; i++)  {     if(!stk.isEmpty())   {   int s = stk.pop();   while(a[s]<a[i])   {   ans[s] = i;   if(!stk.isEmpty())    s = stk.pop();   else    break;   }   if(a[s]>=a[i])   stk.push(s);   }     stk.push(i);     }  return;    }   public static void nextGreaterRev(long[] a, int[] ans)  {    int n = a.length;  int[] pans = new int[n];  Arrays.fill(pans, -1);  long[] arev = new long[n];  for(int i=0; i<n; i++)   arev[i] = a[n-1-i];    Stack<Integer> stk = new Stack<>();  stk.push(0);      for(int i=1; i<n; i++)  {     if(!stk.isEmpty())   {   int s = stk.pop();   while(arev[s]<arev[i])   {   pans[s] = n - i-1;   if(!stk.isEmpty())    s = stk.pop();   else    break;   }   if(arev[s]>=arev[i])   stk.push(s);   }     stk.push(i);     }           for(int i=0; i<n; i++)   ans[i] = pans[n-i-1];        return;    }     public static void nextSmaller(long[] a, int[] ans)  {    Stack<Integer> stk = new Stack<>();  stk.push(0);      for(int i=1; i<a.length; i++)  {     if(!stk.isEmpty())   {   int s = stk.pop();   while(a[s]>a[i])   {   ans[s] = i;   if(!stk.isEmpty())    s = stk.pop();   else    break;   }   if(a[s]<=a[i])   stk.push(s);   }     stk.push(i);     }  return;    }        public static long lcm(int[] numbers) {   long lcm = 1;   int divisor = 2;   while (true) {    int cnt = 0;    boolean divisible = false;    for (int i = 0; i < numbers.length; i++) {     if (numbers[i] == 0) {      return 0;     } else if (numbers[i] < 0) {      numbers[i] = numbers[i] * (-1);     }     if (numbers[i] == 1) {      cnt++;     }     if (numbers[i] % divisor == 0) {      divisible = true;      numbers[i] = numbers[i] / divisor;     }    }    if (divisible) {     lcm = lcm * divisor;    } else {     divisor++;    }    if (cnt == numbers.length) {     return lcm;    }   }  }  public static long fact(long n) {    long factorial = 1;   for(int i = 1; i <= n; i++)    {     factorial *= i;    }   return factorial;  }  public static void factSieve(int[] a, int n) {      for(int i=2; i<=n; i+=2)   a[i] = 2;      for(int i=3; i<=n; i+=2)  {   if(a[i]==0)   {   a[i] = i;      for(int j=i; j*i<=n; j++)   {    a[i*j] = i;    }   }  }    int k = 1000;  while(k!=1)  {   System.out.print(a[k]+" ");   k /= a[k];     }  }    public static int lowerLimit(int[] a, int n) {  int ans = 0;    int ll = 0;  int rl = a.length-1;    if(a[0]>n)   return 0;  if(a[0]==n)   return 1;  else if(a[rl]<=n)   return rl+1;    while(ll<=rl)  {     int mid = (ll+rl)/2;   if(a[mid]==n)   {   ans = mid + 1;   break;   }     else if(a[mid]>n)   {   rl = mid-1;      }   else   {   ans = mid+1;   ll = mid+1;   }  }    return ans;  }     public static long choose(long total, long choose){   if(total < choose)    return 0;   if(choose == 0 || choose == total)    return 1;   return (choose(total-1,choose-1)+choose(total-1,choose))%mod;  }   public static int[] suffle(int[] a,Random gen)  {  int n = a.length;  for(int i=0;i<n;i++)  {   int ind = gen.nextInt(n-i)+i;   int temp = a[ind];   a[ind] = a[i];   a[i] = temp;  }  return a;  }   public static long[] sort(long[] a)  {  Random gen = new Random();  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;  }    Arrays.sort(a);  return a;  }   public static pair[] sort(pair[] a)  {  Random gen = new Random();  int n = a.length;  for(int i=0;i<n;i++)  {   int ind = gen.nextInt(n-i)+i;   pair temp = a[ind];   a[ind] = a[i];   a[i] = temp;  }    Arrays.sort(a);  return a;  }     public static int[] sort(int[] a)  {  Random gen = new Random();  int n = a.length;  for(int i=0;i<n;i++)  {   int ind = gen.nextInt(n-i)+i;   int temp = a[ind];   a[ind] = a[i];   a[i] = temp;  }    Arrays.sort(a);  return a;  }   public static int floorSearch(int arr[], int low, int high, int x)  {   if (low > high)    return -1;     if (x > arr[high])    return high;   int mid = (low+high)/2;       if (mid > 0 && arr[mid-1] < x && x < arr[mid])    return mid-1;     if (x < arr[mid])    return floorSearch(arr, low, mid-1, x);     return floorSearch(arr, mid+1, high, x);  }     public static void swap(int a, int b){  int temp = a;  a = b;  b = temp;  }  public static ArrayList<Integer> primeFactorization(int n)  {  ArrayList<Integer> a =new ArrayList<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 lowerbound(ArrayList<Long> net, long c2) {  int i=Collections.binarySearch(net, c2);  if(i<0)   i = -(i+2);  return i;      }   public static int lowerboundArray(long[] psum, long c2) {  int i=Arrays.binarySearch(psum, c2);  if(i<0)   i = -(i+2);  return i;      }   public static int lowerboundArray(int[] psum, int c2) {  int i=Arrays.binarySearch(psum, c2);  if(i<0)   i = -(i+2);  return i;      }     public static int uperboundArray(long[] psum, long c2) {  int i=Arrays.binarySearch(psum, c2);  if(i<0)   i = -(i+1);  return i;      }     public static int uperbound(ArrayList<Long> net, long c2) {  int i=Collections.binarySearch(net, c2);  if(i<0)   i = -(i+1);  return i;      }     public static int GCD(int a,int b)  {  if(b==0)   return a;  else   return GCD(b,a%b);  }   public static long GCD(long a,long b)  {  if(b==0)   return a;  else   return GCD(b,a%b);  }   public static void extendedEuclid(int A,int B)  {  if(B==0)  {   d = A;   p = 1 ;   q = 0;  }  else  {   extendedEuclid(B, A%B);   int temp = p;   p = q;   q = temp - (A/B)*q;  }  }   public static long LCM(long a,long b)  {  return (a*b)/GCD(a,b);  }   public static int LCM(int a,int b)  {  return (a*b)/GCD(a,b);  }   public static int binaryExponentiation(int x,int n)  {   int result=1;   while(n>0)   {    if(n % 2 ==1)     result=result * x;    x=x*x;    n=n/2;   }   return result;  }     public static int[] countDer(int n)  {   int der[] = new int[n + 1];      der[0] = 1;   der[1] = 0;   der[2] = 1;      for (int i = 3; i <= n; ++i)    der[i] = (i - 1) * (der[i - 1] + der[i - 2]);         return der;  }     static long binomialCoeff(int n, int k)   {   long C[][] = new long[n+1][k+1];   int i, j;         for (i = 0; i <= n; i++)   {    for (j = 0; j <= Math.min(i, k); j++)    {         if (j == 0 || j == i)      C[i][j] = 1;            else      C[i][j] = C[i-1][j-1] + C[i-1][j];    }   }      return C[n][k];   }   public static long binaryExponentiation(long x,long n)  {   long result=1;   while(n>0)   {    if(n % 2 ==1)     result=result * x;    x=(x%mod * x%mod)%mod;    n=n/2;   }   return result;  }   public static int modularExponentiation(int x,int n,int M)  {   int result=1;   while(n>0)   {    if(n % 2 ==1)     result=(result * x)%M;    x=(x%M*x%M)%M;    n=n/2;   }   return result;  }   public static long modularExponentiation(long x,long n,long M)  {   long result=1;   while(n>0)   {    if(n % 2 ==1)     result=(result %M* x%M)%M;    x=(x*x)%M;    n=n/2;   }   return result;  }   public static int modInverse(int A,int M)  {   return modularExponentiation(A,M-2,M);  }   public static long modInverse(long A,long M)  {   return modularExponentiation(A,M-2,M);  }     public static boolean checkYear(int year)  {  if (year % 400 == 0)    return true;      if (year % 100 == 0)    return false;      if (year % 4 == 0)    return true;   return false;  }   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 class pair implements Comparable<pair>  {  Long x, y;   pair(long 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;   if(p.x-x==0 && p.y-y==0)    return true;   else   return false;   }   return false;  }   public int hashCode() {   return new Long(x).hashCode() * 31 + new Long(y).hashCode();  }  }     static class triplet implements Comparable<triplet>  {  Integer x,y;  Long z;  triplet(Integer l,Integer m,long z)  {   this.x = l;   this.y = m;   this.z = z;  }    public int compareTo(triplet o)  {   int result = x.compareTo(o.x);   if(result==0)   result = y.compareTo(o.y);   if(result==0)   result = z.compareTo(o.z);    return result;  }    public boolean equlas(Object o)  {   if(o instanceof triplet)   {   triplet p = (triplet)o;   return x==p.x && y==p.y && z==p.z;   }   return false;  }    public String toString()  {   return x+" "+y+" "+z;  }  public int hashCode()  {   return new Long(x).hashCode()*31 + new Long(y).hashCode() + new Long(z).hashCode();   }  }   static class spair implements Comparable<spair>  {  String x;  Integer y;   spair(String x, int y) {   this.x = x;   this.y = y;  }   public int compareTo(spair o) {     String s1 = x + o.x;   String s2 = o.x + x;   long p1 = cnt[y][0] + cnt[o.y][0];   long p2 = p1;     p1 += cnt[y][1] * cnt[o.y][2];   p2 += cnt[o.y][1] * cnt[y][2];     if(p1==p2)    return 0;   if(p1>p2)   return -1;     return 1;            }   public String toString() {   return x + " " + y;  }    } }
6	public class cf1209e1_2 {  public static void main(String[] args) throws IOException {   int t = ri();   while (t --> 0) {    int n = rni(), m = ni(), a[][] = new int[m][n], dp[] = new int[1 << n];    for (int i = 0; i < n; ++i) {     int[] row = ria(m);     for (int j = 0; j < m; ++j) {      a[j][i] = row[j];     }    }    for (int i = 0; i < m; ++i) {     for (int r = 0; r < 1 << n; ++r) {      for (int j = 0; j < n; ++j) {       if ((r & (1 << j)) == 0) {        continue;       }       dp[r] = max(dp[r], dp[r ^ (1 << j)] + a[i][j]);      }     }     for (int r = 0; r < 1 << n; ++r) {      int s = r;      for (int j = 0; j < n; ++j) {       if ((s & 1) != 0) {        s = (s >> 1) | (1 << (n - 1));       } else {        s >>= 1;       }       dp[s] = max(dp[s], dp[r]);      }     }    }    prln(dp[(1 << n) - 1]);   }   close();  }  static BufferedReader __in = new BufferedReader(new InputStreamReader(System.in));  static PrintWriter __out = new PrintWriter(new OutputStreamWriter(System.out));  static StringTokenizer input;  static Random __rand = new Random();          static final int IBIG = 1000000007;  static final int IMAX = 2147483647;  static final int IMIN = -2147483648;  static final long LMAX = 9223372036854775807L;  static final long LMIN = -9223372036854775808L;   static int minof(int a, int b, int c) {return min(a, min(b, c));}  static int minof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); int min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static long minof(long a, long b, long c) {return min(a, min(b, c));}  static long minof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); long min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static int maxof(int a, int b, int c) {return max(a, max(b, c));}  static int maxof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); int max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static long maxof(long a, long b, long c) {return max(a, max(b, c));}  static long maxof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); long max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static int powi(int a, int b) {if (a == 0) return 0; int ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static long powl(long a, int b) {if (a == 0) return 0; long ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static int fli(double d) {return (int) d;}  static int cei(double d) {return (int) ceil(d);}  static long fll(double d) {return (long) d;}  static long cel(double d) {return (long) ceil(d);}  static int gcf(int a, int b) {return b == 0 ? a : gcf(b, a % b);}  static long gcf(long a, long b) {return b == 0 ? a : gcf(b, a % b);}  static int lcm(int a, int b) {return a * b / gcf(a, b);}  static long lcm(long a, long b) {return a * b / gcf(a, b);}  static int randInt(int min, int max) {return __rand.nextInt(max - min + 1) + min;}  static long mix(long x) {x += 0x9e3779b97f4a7c15L; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9L; x = (x ^ (x >> 27)) * 0x94d049bb133111ebL; return x ^ (x >> 31);}   static void reverse(int[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {int swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(long[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {long swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(double[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {double swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(char[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {char swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void shuffle(int[] a) {int n = a.length - 1; for (int i = 0; i < n; ++i) {int ind = randInt(i, n); int swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}  static void shuffle(long[] a) {int n = a.length - 1; for (int i = 0; i < n; ++i) {int ind = randInt(i, n); long swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}  static void shuffle(double[] a) {int n = a.length - 1; for (int i = 0; i < n; ++i) {int ind = randInt(i, n); double swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}  static void rsort(int[] a) {shuffle(a); sort(a);}  static void rsort(long[] a) {shuffle(a); sort(a);}  static void rsort(double[] a) {shuffle(a); sort(a);}  static int[] copy(int[] a) {int[] ans = new int[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static long[] copy(long[] a) {long[] ans = new long[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static double[] copy(double[] a) {double[] ans = new double[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static char[] copy(char[] a) {char[] ans = new char[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}   static void r() throws IOException {input = new StringTokenizer(rline());}  static int ri() throws IOException {return Integer.parseInt(rline());}  static long rl() throws IOException {return Long.parseLong(rline());}  static double rd() throws IOException {return Double.parseDouble(rline());}  static int[] ria(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni(); return a;}  static int[] riam1(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni() - 1; return a;}  static long[] rla(int n) throws IOException {long[] a = new long[n]; r(); for (int i = 0; i < n; ++i) a[i] = nl(); return a;}  static double[] rda(int n) throws IOException {double[] a = new double[n]; r(); for (int i = 0; i < n; ++i) a[i] = nd(); return a;}  static char[] rcha() throws IOException {return rline().toCharArray();}  static String rline() throws IOException {return __in.readLine();}  static String n() {return input.nextToken();}  static int rni() throws IOException {r(); return ni();}  static int ni() {return Integer.parseInt(n());}  static long rnl() throws IOException {r(); return nl();}  static long nl() {return Long.parseLong(n());}  static double rnd() throws IOException {r(); return nd();}  static double nd() {return Double.parseDouble(n());}   static void pr(int i) {__out.print(i);}  static void prln(int i) {__out.println(i);}  static void pr(long l) {__out.print(l);}  static void prln(long l) {__out.println(l);}  static void pr(double d) {__out.print(d);}  static void prln(double d) {__out.println(d);}  static void pr(char c) {__out.print(c);}  static void prln(char c) {__out.println(c);}  static void pr(char[] s) {__out.print(new String(s));}  static void prln(char[] s) {__out.println(new String(s));}  static void pr(String s) {__out.print(s);}  static void prln(String s) {__out.println(s);}  static void pr(Object o) {__out.print(o);}  static void prln(Object o) {__out.println(o);}  static void prln() {__out.println();}  static void pryes() {prln("yes");}  static void pry() {prln("Yes");}  static void prY() {prln("YES");}  static void prno() {prln("no");}  static void prn() {prln("No");}  static void prN() {prln("NO");}  static boolean pryesno(boolean b) {prln(b ? "yes" : "no"); return b;};  static boolean pryn(boolean b) {prln(b ? "Yes" : "No"); return b;}  static boolean prYN(boolean b) {prln(b ? "YES" : "NO"); return b;}  static void prln(int... a) {for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i); if (a.length > 0) prln(a[a.length - 1]); else prln();}  static void prln(long... a) {for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i); if (a.length > 0) prln(a[a.length - 1]); else prln();}  static void prln(double... a) {for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i); if (a.length > 0) prln(a[a.length - 1]); else prln();}  static <T> void prln(Collection<T> c) {int n = c.size() - 1; Iterator<T> iter = c.iterator(); for (int i = 0; i < n; pr(iter.next()), pr(' '), ++i); if (n >= 0) prln(iter.next()); else prln();}  static void h() {prln("hlfd"); flush();}  static void flush() {__out.flush();}  static void close() {__out.close();} }
2	public class PipelineRedo { public static void main(String[] args){  FastScanner sc = new FastScanner();  long n = sc.nextLong() - 1;  long k = sc.nextInt() - 1;   if(n==0){  System.out.println(0);  return;  }else if(n <= k){  System.out.println(1);  return;  }else if(n > k*(k+1)/2){  System.out.println(-1);  return;  }         long rightSum = k*(k+1)/2;  long lo = 1;  long hi = k;  while(lo < hi){  long mid = lo + (hi-lo+1)/2;  long val = rightSum - mid*(mid-1)/2;    if(val <= n){   hi = mid -1;  }else{   lo = mid;  }  }      if(rightSum - (lo+1)*(lo)/2 == n){  System.out.println(k - (lo+1) + 1);  }else{  System.out.println(1 + (k - (lo+1) + 1));  } }  public static class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner(String s) {  try {   br = new BufferedReader(new FileReader(s));  } catch (FileNotFoundException e) {     e.printStackTrace();  }  }  public FastScanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  String nextToken() {  while (st == null || !st.hasMoreElements()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {      e.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(nextToken());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  } } }
5	public class Main {           private void solve() throws IOException {  int n = nextInt();  int[] arr = new int[n];  int count = 0;  for (int x = 0; x < n; x++) {  arr[x] = nextInt();  count+= arr[x];  }  Arrays.sort(arr);  count /=2;  int result = 0, sum = 0;  for (int x = arr.length - 1; x >= 0; x--) {  sum += arr[x];  result++;  if (sum > count) {   break;  }  }  System.out.println(result); }  public static void main(String[] args) {  try {  br = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    new Main().solve();  out.close();  } catch (Throwable e) {  System.out.println(e);  System.exit(239);  } } static BufferedReader br; static StringTokenizer st; static PrintWriter out;  static String nextToken() throws IOException {  while (st == null || !st.hasMoreTokens()) {  String line = br.readLine();  if (line == null) {   return null;  }  st = new StringTokenizer(line);  }  return st.nextToken(); }  static int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  static long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  static double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  static int[] nextIntArray(int n) throws IOException {  int[] temp = new int[n];  for (int x = 0; x < n; x++) {  temp[x] = nextInt();  }  return temp; }  static long[] nextLongArray(int n) throws IOException {  long[] temp = new long[n];  for (int x = 0; x < n; x++) {  temp[x] = nextLong();  }  return temp; }  static String[] nextArray(int n) throws IOException {  String[] temp = new String[n];  for (int x = 0; x < n; x++) {  temp[x] = nextToken();  }  return temp; } }
3	public class Main {  public static void main(String args[])  {   FastReader input=new FastReader();   PrintWriter out=new PrintWriter(System.out);   int T=1;   while(T-->0)   {    int n=input.nextInt();    int a[]=new int[n];    for(int i=0;i<n;i++)    {     a[i]=input.nextInt();    }    HashMap<Integer,ArrayList<Pair>> map=new HashMap<>();    for(int i=0;i<n;i++)    {     int sum=0;     for(int j=i;j<n;j++)     {      sum+=a[j];      if(map.containsKey(sum))      {       map.get(sum).add(new Pair(i,j));      }      else      {       map.put(sum,new ArrayList<>());       map.get(sum).add(new Pair(i,j));      }     }    }    int max=Integer.MIN_VALUE;    Iterator it=map.entrySet().iterator();    ArrayList<Pair> setBlocks=new ArrayList<>();    while(it.hasNext())    {     Map.Entry e=(Map.Entry)it.next();     ArrayList<Pair> list=(ArrayList)e.getValue();     Collections.sort(list, new Comparator<Pair>() {      @Override      public int compare(Pair o1, Pair o2) {       if(o1.l==o2.l)       {        return o1.r-o2.r;       }       else       {        return o1.l-o2.l;       }      }     });     Pair1 sufMin[]=new Pair1[list.size()];     TreeSet<Pair> set=new TreeSet<>(new Comparator<Pair>() {      @Override      public int compare(Pair o1, Pair o2) {       if(o1.l==o2.l)       {        return o1.r-o2.r;       }       else       {        return o1.l-o2.l;       }      }     });     int min=Integer.MAX_VALUE;     int index=-1;     for(int j=list.size()-1;j>=0;j--)     {      if(min>=list.get(j).r)      {       min=list.get(j).r;       index=j;      }      sufMin[j]=new Pair1(min,index);      set.add(new Pair(list.get(j).l,j));     }     int count=0;     int j=0;     ArrayList<Pair> blocks=new ArrayList<>();     while(j<list.size())     {      int m=sufMin[j].min;      int ind=sufMin[j].index;      blocks.add(list.get(ind));      count++;      Pair p=new Pair(m+1,0);      if(set.ceiling(p)==null)      {       break;      }      else      {       Pair p1=set.ceiling(p);       j=p1.r;      }     }     if(max<count)     {      max=count;      setBlocks=blocks;     }    }    out.println(max);    for(int i=0;i<setBlocks.size();i++)    {     out.println((setBlocks.get(i).l+1)+" "+(setBlocks.get(i).r+1));    }   }   out.close();  }  public static class Pair1  {   int min,index;   Pair1(int min,int index)   {    this.min=min;    this.index=index;   }  }  public static class Pair  {   int l,r;   Pair(int l,int r)   {    this.l=l;    this.r=r;   }  }  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 B {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   long n = sc.nextLong();   long k = sc.nextLong();   if (n == 1) {    System.out.println(0);   } else if (n <= k) {    System.out.println(1);   } else {    n--;    k--;    BigInteger K = BigInteger.valueOf(k);    BigInteger N = BigInteger.valueOf(n);    BigInteger high = BigInteger.valueOf(k + 1);    BigInteger low = BigInteger.valueOf(1);    BigInteger mid;    while (low.compareTo(high) < 0) {     mid = low.add(high.subtract(low).shiftRight(1));     BigInteger elemCnt = K.subtract(mid).add(BigInteger.ONE);     BigInteger sum = elemCnt.multiply(       mid.shiftLeft(1).add(elemCnt.subtract(BigInteger.ONE)))       .shiftRight(1);     if (sum.compareTo(N) > 0) {      low = mid.add(BigInteger.valueOf(1));     } else {      high = mid;     }    }    BigInteger elemCnt = K.subtract(low).add(BigInteger.ONE);    BigInteger sum = elemCnt.multiply(      low.shiftLeft(1).add(elemCnt.subtract(BigInteger.ONE)))      .shiftRight(1);    BigInteger rem = N.subtract(sum);    if (rem.equals(BigInteger.ZERO)) {     System.out.println(elemCnt);    } else if (rem.compareTo(low) < 0) {     System.out.println(elemCnt.add(BigInteger.ONE));    } else {     System.out.println(-1);    }   }  } }
0	public class luckydivision { public static int i(String s){  return Integer.parseInt(s); } public static boolean solve(String k, int n){  int temp = i(k);  if(temp > n){  return false;  }  if(n % temp == 0)  return true;  if(solve(k + "7", n))  return true;  return solve(k + "4", n); } public static void main(String args[]) throws Exception {  BufferedReader r = new BufferedReader(new InputStreamReader(System.in));  int n = i(r.readLine());  boolean i = solve("7", n);  boolean j = solve("4", n);  if(i || j){  System.out.println("YES");  } else {  System.out.println("NO");  } } }
4	public class Main {  static boolean used[][];  static int n;  static int m;  public static void main(String[] args) throws IOException {   br = new BufferedReader(new FileReader("input.txt"));   PrintWriter out = new PrintWriter("output.txt");   n = nextInt();   m = nextInt();   int k = nextInt();   used = new boolean[n][m];   Deque<point> deq = new ArrayDeque<>();   for (int i = 0; i < k; i++) {    deq.addLast(new point(nextInt() - 1, nextInt() - 1));    used[deq.peekLast().x][deq.peekLast().y] = true;   }   point last = new point(0, 0);   while (!deq.isEmpty()) {    point v = deq.pollFirst();    int x = v.x;    int y = v.y;    if (checker(x, y + 1)) {     last = new point(x, y + 1);     deq.addLast(new point(x, y + 1));     used[x][y + 1] = true;    }    if (checker(x, y - 1)) {     last = new point(x, y - 1);     deq.addLast(new point(x, y - 1));     used[x][y - 1] = true;    }    if (checker(x + 1, y)) {     last = new point(x + 1, y);     deq.addLast(new point(x + 1, y));     used[x + 1][y] = true;    }    if (checker(x - 1, y)) {     last = new point(x - 1, y);     deq.addLast(new point(x - 1, y));     used[x - 1][y] = true;    }   }   out.println(last.x + 1 + " " + (last.y + 1));   out.close();  }  static boolean checker(int x, int y) {   if (x < n && y < m && x >= 0 && y >= 0 && !used[x][y]) return true;   return false;  }   static StringTokenizer st = new StringTokenizer("");  static BufferedReader br;  static String next() throws IOException {   while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());   return st.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt(next());  }  static long nextLong() throws IOException {   return Long.parseLong(next());  } } class point {  int x, y;  public point(int x, int y) {   this.x = x;   this.y = y;  } }
0	public class A {  ArrayList<Integer> list = new ArrayList<Integer>();     boolean valid(int n) {   Queue<Integer> q = new LinkedList<Integer>();   q.add(4);   q.add(7);   int crnt;   while(!q.isEmpty()) {    crnt = q.poll();    if(n%crnt == 0) return true;    if ( crnt*10 + 4 <= 1000 ) q.add(crnt*10 + 4);    if ( crnt*10 + 7 <= 1000 ) q.add(crnt*10 + 7);   }   return false;  }   void dfs(int n){   if(n>1000)return;   if(n!=0)list.add(n);   n = n*10;   dfs(n+4);   dfs(n+7);  }  void run() {   Scanner s = new Scanner(System.in);   int n = s.nextInt();   if (valid(n)) {    System.out.println("YES");   } else {    System.out.println("NO");   }  }  public static void main(String[] args) {   new A().run();  } }
6	public class CFContest {  public static void main(String[] args) throws Exception {   boolean local = System.getProperty("ONLINE_JUDGE") == null;   boolean async = true;   Charset charset = Charset.forName("ascii");   FastIO io = local ? new FastIO(new FileInputStream("D:\\DATABASE\\TESTCASE\\Code.in"), System.out, charset) : new FastIO(System.in, System.out, charset);   Task task = new Task(io, new Debug(local));   if (async) {    Thread t = new Thread(null, task, "dalt", 1 << 27);    t.setPriority(Thread.MAX_PRIORITY);    t.start();    t.join();   } else {    task.run();   }   if (local) {    io.cache.append("\n\n--memory -- \n" + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20) + "M");   }   io.flush();  }  public static class Task implements Runnable {   final FastIO io;   final Debug debug;   int inf = (int) 1e8;   long lInf = (long) 1e18;   public Task(FastIO io, Debug debug) {    this.io = io;    this.debug = debug;   }   @Override   public void run() {    int t = io.readInt();    while (t-- > 0)     solve1();   }    public void solve1() {    cache.clear();    int n = io.readInt();    int m = io.readInt();    Col[] mat = new Col[m];    for (int i = 0; i < m; i++) {     mat[i] = new Col();     mat[i].data = new int[n];    }    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      int v = io.readInt();      mat[j].data[i] = v;      mat[j].max = Math.max(mat[j].max, v);     }    }    Arrays.sort(mat, (a, b) -> -(a.max - b.max));    mat = Arrays.copyOf(mat, Math.min(n, m));    io.cache.append(bf(mat, getCol(n), n, 0)).append('\n');   }   public void enhance(Col mask, Col c, Col ans, int n) {    for (int i = 0; i < n; i++) {     ans.data[i] = Math.max(mask.get(i), c.get(i));    }   }   Deque<Col> cache = new ArrayDeque<>();   public Col getCol(int n) {    if (cache.isEmpty()) {     Col col = new Col();     col.data = new int[n];     return col;    }    return cache.removeFirst();   }   public void destroy(Col c) {    c.offset = 0;    c.max = 0;    cache.addLast(c);   }   public int bf(Col[] cols, Col mask, int n, int k) {    if (k >= cols.length) {     int sum = 0;     for (int i = 0; i < n; i++) {      sum += mask.data[i];     }     return sum;    }    int max = 0;    cols[k].offset = 0;    for (int i = 0; i < n; i++) {     Col c = getCol(n);     enhance(mask, cols[k], c, n);     max = Math.max(max, bf(cols, c, n, k + 1));     destroy(c);     cols[k].turn();    }    return max;   }  }  public static class Col {   int[] data;   int offset;   public int get(int i) {    return data[(i + offset) % data.length];   }   public void turn() {    offset++;   }   int max;  }   public static class FastIO {   public final StringBuilder cache = new StringBuilder(20 << 20);   private final InputStream is;   private final OutputStream os;   private final Charset charset;   private StringBuilder defaultStringBuf = new StringBuilder(1 << 8);   private byte[] buf = new byte[1 << 20];   private int bufLen;   private int bufOffset;   private int next;   public FastIO(InputStream is, OutputStream os, Charset charset) {    this.is = is;    this.os = os;    this.charset = charset;   }   public FastIO(InputStream is, OutputStream os) {    this(is, os, Charset.forName("ascii"));   }   private int read() {    while (bufLen == bufOffset) {     bufOffset = 0;     try {      bufLen = is.read(buf);     } catch (IOException e) {      throw new RuntimeException(e);     }     if (bufLen == -1) {      return -1;     }    }    return buf[bufOffset++];   }   public void skipBlank() {    while (next >= 0 && next <= 32) {     next = read();    }   }   public int readInt() {    int sign = 1;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+' ? 1 : -1;     next = read();    }    int val = 0;    if (sign == 1) {     while (next >= '0' && next <= '9') {      val = val * 10 + next - '0';      next = read();     }    } else {     while (next >= '0' && next <= '9') {      val = val * 10 - next + '0';      next = read();     }    }    return val;   }   public long readLong() {    int sign = 1;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+' ? 1 : -1;     next = read();    }    long val = 0;    if (sign == 1) {     while (next >= '0' && next <= '9') {      val = val * 10 + next - '0';      next = read();     }    } else {     while (next >= '0' && next <= '9') {      val = val * 10 - next + '0';      next = read();     }    }    return val;   }   public double readDouble() {    boolean sign = true;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+';     next = read();    }    long val = 0;    while (next >= '0' && next <= '9') {     val = val * 10 + next - '0';     next = read();    }    if (next != '.') {     return sign ? val : -val;    }    next = read();    long radix = 1;    long point = 0;    while (next >= '0' && next <= '9') {     point = point * 10 + next - '0';     radix = radix * 10;     next = read();    }    double result = val + (double) point / radix;    return sign ? result : -result;   }   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);   }   public int readLine(char[] data, int offset) {    int originalOffset = offset;    while (next != -1 && next != '\n') {     data[offset++] = (char) next;     next = read();    }    return offset - originalOffset;   }   public int readString(char[] data, int offset) {    skipBlank();    int originalOffset = offset;    while (next > 32) {     data[offset++] = (char) next;     next = read();    }    return offset - originalOffset;   }   public int readString(byte[] data, int offset) {    skipBlank();    int originalOffset = offset;    while (next > 32) {     data[offset++] = (byte) next;     next = read();    }    return offset - originalOffset;   }   public char readChar() {    skipBlank();    char c = (char) next;    next = read();    return c;   }   public void flush() {    try {     os.write(cache.toString().getBytes(charset));     os.flush();     cache.setLength(0);    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public boolean hasMore() {    skipBlank();    return next != -1;   }  }  public static class Debug {   private boolean allowDebug;   public Debug(boolean allowDebug) {    this.allowDebug = allowDebug;   }   public void assertTrue(boolean flag) {    if (!allowDebug) {     return;    }    if (!flag) {     fail();    }   }   public void fail() {    throw new RuntimeException();   }   public void assertFalse(boolean flag) {    if (!allowDebug) {     return;    }    if (flag) {     fail();    }   }   private void outputName(String name) {    System.out.print(name + " = ");   }   public void debug(String name, int x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, long x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, double x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, int[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, long[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, double[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, Object x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, Object... x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.deepToString(x));   }  } }
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);   BSportMafia solver = new BSportMafia();   solver.solve(1, in, out);   out.close();  }  static class BSportMafia {   int MAXN = 200005;   PrintWriter out;   InputReader in;   public void solve(int testNumber, InputReader in, PrintWriter out) {    this.out = out;    this.in = in;    long n = nl();    long k = nl();    long i = 0;    k += n;    for (i = 0; i < MAXN; i++) {     long x = (i * (i + 3)) / 2;     if (k == x) {      pn(n - i);      return;     }    }   }   long nl() {    return in.nextLong();   }   void pn(long zx) {    out.println(zx);   }  }  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 long nextLong() {    return Long.parseLong(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();   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
3	public class x1141F  {  public static void main(String omkar[]) throws Exception  {   BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));    StringTokenizer st = new StringTokenizer(infile.readLine());   int N = Integer.parseInt(st.nextToken());   int[] arr = new int[N];   st = new StringTokenizer(infile.readLine());   for(int i=0; i < N; i++)    arr[i] = Integer.parseInt(st.nextToken());   HashMap<Long, ArrayList<Integer>> map = new HashMap<Long, ArrayList<Integer>>();   for(int r=0; r < N; r++)   {    long sum = 0L;    for(int i=r; i >= 0; i--)    {     sum += arr[i];     if(!map.containsKey(sum))     map.put(sum, new ArrayList<Integer>());     map.get(sum).add(i);     map.get(sum).add(r);    }   }   ArrayList<Integer> res = new ArrayList<Integer>();   for(long key: map.keySet())   {    ArrayList<Integer> ls = map.get(key);    ArrayList<Integer> temp = new ArrayList<Integer>();    temp.add(ls.get(0));    temp.add(ls.get(1));    int r = ls.get(1);    for(int i=2; i < ls.size(); i+=2)     if(r < ls.get(i))     {     r = ls.get(i+1);     temp.add(ls.get(i));     temp.add(ls.get(i+1));     }    if(res.size() < temp.size())     res = temp;   }   System.out.println(res.size()/2);   StringBuilder sb = new StringBuilder();   for(int i=0; i < res.size(); i+=2)   {    sb.append((1+res.get(i))+" "+(1+res.get(i+1)));    sb.append("\n");   }   System.out.print(sb);  }  }
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);   }  } }
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());  } }
5	public class A135 { public static void main(String[] args) throws Exception {  BufferedReader r = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(r.readLine());  int[] ar = new int[n];  StringTokenizer st = new StringTokenizer(r.readLine());  for (int x = 0; x < n; x++) {  ar[x] = Integer.parseInt(st.nextToken());  }  Arrays.sort(ar);  if (n == 1) {   System.out.println(ar[0]==1?"2":"1");  return;  }  if (ar[n - 1] == 1) {  ar[n - 2] = 2;  }  System.out.print("1");  for (int x = 0; x < n - 1; x++) {  System.out.print(" " + ar[x]);  }  System.out.println(); } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   final int P = (int) 1e9 + 7;   int n;   char[] commands;   int[][] memo;   public void solve(int testNumber, InputReader in, PrintWriter out) {    n = in.nextInt();    commands = new char[n];    memo = new int[n][12345];    for (int i = 0; i < n; i++) {     commands[i] = in.next().charAt(0);     for (int j = 0; j < 12345; j++) {      memo[i][j] = -1;     }    }    out.print(solve(1, 0));   }   int add(int a, int b) {    return ((a % P) + (b % P)) % P;   }   int solve(int i, int indents) {    if (i == n) return 1;    if (memo[i][indents] != -1) return memo[i][indents];    int answer;    if (commands[i - 1] == 'f') {     answer = solve(i + 1, indents + 1);    } else {     if (indents == 0) {      answer = solve(i + 1, indents);     } else {      answer = add(solve(i, indents - 1), solve(i + 1, indents));     }    }    return memo[i][indents] = answer;   }  }  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());   }  } }
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 EdC { static long[] mods = {1000000007, 998244353, 1000000009}; static long mod = mods[0]; public static MyScanner sc;  public static PrintWriter out;  static char[][] grid;  static int n;  static int t;  static int[][] dp;  static int[] times;  static int[] genre; public static void main(String[] omkar) throws Exception{    sc = new MyScanner();  out = new PrintWriter(System.out);  n = sc.nextInt();  t = sc.nextInt();  times = new int[n];  genre = new int[n];  for(int j =0 ;j<n;j++){   times[j] = sc.nextInt();   genre[j] = sc.nextInt();   }  dp = new int[1<<n][4];  for(int j = 0;j<1<<n;j++)   Arrays.fill(dp[j], -1);  for(int j=0;j<1<<n;j++){   letsgodp(j, 1);   letsgodp(j, 2);   letsgodp(j, 3);  }  int ans = 0;  for(int j=0;j<1<<n;j++){   int time = 0;   for(int k = 0;k<n;k++){   if (((1<<k) & j) != 0){    time+=times[k];   }   }   if (time == t){   ans+=dp[j][1];   ans%=mod;   ans+=dp[j][2];   ans%=mod;   ans+=dp[j][3];   ans%=mod;   }  }  out.println(ans);  out.close();  } public static void letsgodp(int mask, int dg){  if (dp[mask][dg] != -1)  return;  dp[mask][dg] = 0;  for(int j = 0;j<n;j++){  if (((1<<j) & mask) != 0 && genre[j] == dg){   int submask = mask - (1<<j);   int og1 = genre[j]+1 > 3 ? genre[j]-2 : genre[j]+1;   int og2 = genre[j]+2 > 3 ? genre[j]-1 : genre[j]+2;   if (submask != 0){   letsgodp(submask, og1);   letsgodp(submask, og2);   dp[mask][dg] +=(dp[submask][og1] + dp[submask][og2]);   dp[mask][dg] %=mod;   }   else{   dp[mask][dg] = 1;   }  }  } } public static void sort(int[] array){  ArrayList<Integer> copy = new ArrayList<Integer>();  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;   }    } }
4	public class D{  static void sort(int[] A){   int n = A.length;   Random rnd = new Random();   for(int i=0; i<n; ++i){    int tmp = A[i];    int randomPos = i + rnd.nextInt(n-i);    A[i] = A[randomPos];    A[randomPos] = tmp;   }   Arrays.sort(A);  }  public static void main(String args[])  {   Scanner sc=new Scanner(System.in);        {    int n = sc.nextInt();    int m=sc.nextInt();    int steps=sc.nextInt();    long arr[][][] = new long[n][m][5];    for(int j=0;j<n;j++)    {     for(int k=0;k<m-1;k++)     {      long num=sc.nextLong();      arr[j][k][1]=num;      arr[j][k+1][3]=num;     }    }    for(int j=0;j<n-1;j++)    {     for(int k=0;k<m;k++)     {      long num=sc.nextLong();      arr[j][k][2]=num;      arr[j+1][k][4]=num;     }    }    long temp[][]=new long[n][m];    long ans[][]=new long[n][m];    for(int i=0;i<steps/2;i++)    {     for(int j=0;j<n;j++)     {      for(int k=0;k<m;k++)      {       long min=Long.MAX_VALUE;       if(k>0)       {        long f=arr[j][k][3]+ans[j][k-1];        min=Math.min(min,f);       }       if(k<m-1)       {        long f=arr[j][k][1]+ans[j][k+1];        min=Math.min(min,f);       }       if(j>0)       {        long f=arr[j][k][4]+ans[j-1][k];        min=Math.min(min,f);       }       if(j<n-1)       {        long f=arr[j][k][2]+ans[j+1][k];        min=Math.min(min,f);       }       temp[j][k]=min;      }     }     for(int j=0;j<n;j++)     {      for(int k=0;k<m;k++)      {       ans[j][k]=temp[j][k];      }     }    }     StringBuilder p=new StringBuilder();    for(int j=0;j<n;j++)    {     for(int k=0;k<m;k++)     {      if(steps%2!=0)      {       p.append(-1+" ");      }      else      {      p.append(2*ans[j][k]+" ");}     }     p.append("\n");    }     System.out.println(p);   }  } }
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 Main { public static int n,m; public static void main(String[] arg) {  FastScanner scan = null;  PrintWriter out = null;  try{  scan = new FastScanner(new FileInputStream("input.txt"));  out = new PrintWriter(new FileOutputStream("output.txt"));  }catch(FileNotFoundException e){  scan = new FastScanner(System.in);  out = new PrintWriter(System.out);  }    n = scan.nextInt();  m = scan.nextInt();  int k = scan.nextInt();  int[][] board = new int[n+1][m+1];  String[] ins = scan.nextLine().split(" ",-1);  List<Integer> ps = new ArrayList<Integer>();  for(int i = 0; i < 2 * k; i += 2){  int a = Integer.parseInt(ins[i]);  int b = Integer.parseInt(ins[i+1]);  board[a][b] = 1;  ps.add(a * 2001 + b);  }   int retx = 1, rety = 1;  int[] dx = {0,1,0,-1};  int[] dy = {1,0,-1,0};  while(true){  boolean find = false;  List<Integer> ps2 = new ArrayList<Integer>();  for(Integer p : ps){   int i = p / 2001;   int j = p % 2001;   for(int q = 0; q < 4; q++){   int nx = i + dx[q];   int ny = j + dy[q];   if(in(nx,ny) && board[nx][ny] == 0){    board[nx][ny] = 1;    retx = nx;    rety = ny;    find = true;    ps2.add(nx * 2001 + ny);   }   }   board[i][j] = 2;  }  ps = ps2;  if(!find) break;  }  out.println(retx + " " + rety);  out.close(); } public static boolean in(int i, int j){  return (1 <= i && i <= n) && (1 <= j && j <= m); } 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();  }    String nextLine() {   try {    return br.readLine();   }   catch (Exception e) {    return null;   }  }  int nextInt() {  return Integer.parseInt(next());  }   long nextLong() {  return Long.parseLong(next());  }   double nextDouble() {  return Double.valueOf(next());  } } }
0	public class A { private static Scanner in;  public void run() {  long a = in.nextLong();  long b = in.nextLong();  long ans = 0;  while (a > 0 && b > 0) {  if (a >= b) {   ans += a / b;   a %= b;   continue;  }  ans += b / a;  b %= a;  }  System.out.println(ans); }  public static void main(String[] args) {  Locale.setDefault(Locale.US);  in = new Scanner(System.in);  new A().run();  in.close(); } }
1	public class Solution {  public static void main(String args[]) {  Scanner scanner = new Scanner(System.in);  int n = scanner.nextInt();  int[] arr = new int[n];  for (int i = 0; i < n; ++i) {   arr[i] = scanner.nextInt();  }  boolean isOdd = false;  if ((arr[0] % 2 == 0 && arr[1] % 2 == 0) || (arr[0] % 2 == 0 && arr[2] % 2 == 0)   || (arr[1] % 2 == 0 && arr[2] % 2 == 0)) {   isOdd = true;  }  if (isOdd) {   for (int i = 0; i < n; ++i) {   if (arr[i] % 2 == 1) {    System.out.println(i + 1);    break;   }   }  } else {   for (int i = 0; i < n; ++i) {   if (arr[i] % 2 == 0) {    System.out.println(i + 1);    break;   }   }  }  } }
6	public class Main { public static void main(String[] args) throws IOException {      new Main().run();   }  BufferedReader in; PrintWriter out; StringTokenizer st = new StringTokenizer("");  int vNum; int eNum; boolean[][] g;  void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  vNum = nextInt();  eNum = nextInt();  g = new boolean [vNum][vNum];  for (int e = 0; e < eNum; e++) {  int u = nextInt() - 1;  int v = nextInt() - 1;  g[u][v] = g[v][u] = true;  }       out.println(optimizedDP());   out.close(); }   long naiveDP() {  long[] count = new long [vNum + 1];  int size = 1 << vNum;  long[][] dp = new long [size][vNum];  for (int begin = 0; begin < vNum; begin++) {  for (long[] row : dp) fill(row, 0L);  dp[1 << begin][begin] = 1L;  for (int mask = 0; mask < size; mask++) {   int len = Integer.bitCount(mask);   for (int v = 0; v < vNum; v++) {   long cval = dp[mask][v];   if (cval == 0L) continue;   if (g[v][begin]) count[len] += cval;   for (int nv = 0; nv < vNum; nv++) {    if (g[v][nv]) {    int nmask = mask | (1 << nv);    if (nmask != mask)     dp[nmask][nv] += cval;    }   }   }  }  }  long ret = 0L;  for (int len = 3; len <= vNum; len++) {  if (count[len] % (len * 2) != 0) System.err.println("ERROR!");  ret += count[len] / len / 2;  }  return ret; }  long optimizedDP() {  long[] count = new long [vNum + 1];  long[][] dp = new long [1 << vNum][vNum];  for (int last = vNum - 1; last >= 0; last--) {  int size = 1 << last;  for (int mask = 0; mask < size; mask++)   fill(dp[mask], 0, last, 0L);  for (int nv = 0; nv < last; nv++)   if (g[last][nv]) dp[1 << nv][nv] = 1L;  for (int mask = 0; mask < size; mask++) {   int len = Integer.bitCount(mask) + 1;   for (int v = 0; v < last; v++) {   long cval = dp[mask][v];   if (cval == 0L) continue;   if (g[v][last]) count[len] += cval;   for (int nv = 0; nv < last; nv++) {    if (g[v][nv]) {    int nmask = mask | (1 << nv);    if (nmask != mask)     dp[nmask][nv] += cval;    }   }   }  }  }  long ret = 0L;  for (int len = 3; len <= vNum; len++) {  if (count[len] % 2 != 0) System.err.println("ERROR!");  ret += count[len] >> 1;  }  return ret; }  void genFullGraph(int vNum) {  this.vNum = vNum;  this.eNum = vNum * (vNum - 1) / 2;  g = new boolean [vNum][vNum];  for (int i = 0; i < vNum; i++)  for (int j = i + 1; j < vNum; j++)   g[i][j] = g[j][i] = true;    }   static long b2mb(long b) {  return b >> 20; }  static void checkMemory() {  System.err.println(b2mb(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) + "/" + b2mb(Runtime.getRuntime().totalMemory()) + " MB"); }   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; } }
3	public class Solution {  public static void main(String[] args) throws Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  StringTokenizer st = new StringTokenizer(br.readLine());  long[] a = new long[n];  for (int i = 0; i < a.length; i++) {  a[i] = Long.parseLong(st.nextToken());  }  long[] sum = new long[n];  sum[0] = a[0];  for (int i = 1; i < sum.length; i++) {  sum[i] = sum[i - 1] + a[i];  }  solve(a, sum);  }  private static void solve(long[] a, long[] sum) {  int n = a.length;  Map<Long, List<Pair>> map = new HashMap<>();  for (int j = 0; j < sum.length; j++) {  for (int i = 0; i <= j; i++) {   long k = getSum(sum, i, j);   if (map.containsKey(k)) {   map.get(k).add(new Pair(i, j));   } else {   List<Pair> arr = new ArrayList<>();   arr.add(new Pair(i, j));   map.put(k, arr);   }  }  }  int max = -1;  List<Pair> ans = null;  for (Map.Entry<Long, List<Pair>> entry : map.entrySet()) {  List<Pair> pairs = entry.getValue();   int prev = -1;  int count = 0;  List<Pair> temp = new ArrayList<Pair>();  for (Pair p : pairs) {   if (p.x > prev) {   prev = p.y;   temp.add(p);   count++;   }  }   if (count > max) {   ans = temp;   max = count;  }  }  if (max != -1) {  System.out.println(ans.size());  for (Pair p : ans) {   System.out.println((p.x + 1) + " " + (p.y + 1));  }  } }  private static long getSum(long[] sum, int l, int r) {  if (l == 0) {  return sum[r];  }  return sum[r] - sum[l - 1]; } } class Pair {  int x; int y;  Pair(int x, int y) {  this.x = x;  this.y = y; }  @Override public int hashCode() {  int h = 171 << 4;  h = h * x;  h = h * y;  return h; }  @Override public boolean equals(Object o) {  if (o instanceof Pair) {  Pair other = (Pair) o;  return this.x == other.x && this.y == other.y;  }  return false; }  @Override public String toString() {  return "Pair [x=" + x + ", y=" + y + "]"; } }
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);  } } }
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);  } }
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;  } }
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();  } } }
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();  } }
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);   TaskF2 solver = new TaskF2();   solver.solve(1, in, out);   out.close();  }  static class TaskF2 {   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();    }    HashMap<Integer, Stack<Interval>> map = new HashMap<>();    for (int i = 0; i < n; i++) {     int sum = 0;     for (int j = i; j < n; j++) {      sum += a[j];      if (map.containsKey(sum) == false) {       map.put(sum, new Stack<>());      }      Stack<Interval> stack = map.get(sum);      if (stack.isEmpty() || stack.get(stack.size() - 1).r < i) {       stack.push(new Interval(i, j));      } else if (stack.get(stack.size() - 1).r >= j) {       stack.pop();       stack.push(new Interval(i, j));      }     }    }    Stack<Interval> best = new Stack<>();    for (Stack<Interval> stack : map.values()) {     if (best.size() < stack.size()) {      best = stack;     }    }    out.println(best.size());    for (Interval i : best) {     out.println((i.l + 1) + " " + (i.r + 1));    }   }   class Interval {    int l;    int r;    Interval(int l, int r) {     this.l = l;     this.r = r;    }   }  }  static class InputReader {   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private InputStream stream;   public InputReader(InputStream stream) {    this.stream = stream;   }   private boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   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 nextInt() {    int c = read();    while (isWhitespace(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 (!isWhitespace(c));    return res * sgn;   }  } }
4	public class x23A { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  String input = sc.next();   int longest=0;  if(input.length()==1){  System.out.println(0);  System.exit(0);  }  if(input.length()==2){  if(input.charAt(0)==input.charAt(1)){   System.out.println(1);   System.exit(0);  }  else{  System.out.println(0);  System.exit(0);}  }  for(int a=0;a<input.length()-1;a++){  for(int b=a+1;b<input.length();b++){   for(int c=1;(c+b)<input.length()+1;c++){      if(input.substring(a,a+c).compareTo(input.substring(b,b+c))==0)   if(longest<c)longest=c;   }  }  }  System.out.println(longest);  } }
3	public class F2 {  private static int n;  private static int[] a;  private static Collection<Segment> answer;  public static void main(String[] args) {   in();   solution();   out();  }  private static void in() {   Scanner in = new Scanner(System.in);   n = in.nextInt();   a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }  }  private static void solution() {   HashMap<Long, LinkedList<Segment>> segments = new HashMap<>();   for (int i = 0; i < n; i++) {    long sum = 0;    for (int j = i; j < n; j++) {     sum += a[j];     if (segments.containsKey(sum)) {      segments.get(sum).add(new Segment(i, j));     } else {      LinkedList<Segment> toPut = new LinkedList<>();      toPut.add(new Segment(i, j));      segments.put(sum, toPut);     }    }   }   answer = null;   for (Map.Entry<Long, LinkedList<Segment>> sums : segments.entrySet()) {     LinkedList<Segment> currentSegments = sums.getValue();    Collections.sort(currentSegments);    LinkedList<Segment> segmentsWithoutCrossing = new LinkedList<>();    for (Segment segment : currentSegments) {      if ( segmentsWithoutCrossing.isEmpty() || !segmentsWithoutCrossing.getLast().isCrossingToNextSegment(segment)) {      segmentsWithoutCrossing.add(segment);     } else if (segmentsWithoutCrossing.getLast().getR() > segment.getR()) {      segmentsWithoutCrossing.removeLast();      segmentsWithoutCrossing.add(segment);     }    }    answer = segmentsWithoutCrossing.size() > (answer != null ? answer.size() : 0) ? segmentsWithoutCrossing : answer;   }  }  private static void out() {   System.out.println(answer.size());   for (Segment segment : answer) {    System.out.println( (segment.getL() + 1) + " " + (segment.getR() + 1));   }  } } class Segment implements Comparable<Segment>{  private int l, r;  Segment(int l, int r) {   this.l = l;   this.r = r;  }   int getL() {   return l;  }  int getR() {   return r;  }  @Override  public int compareTo(Segment segment) {   if (l == segment.l && r == segment.r) {    return 0;   }   return l != segment.l ? l - segment.l : r - segment.r;  }  boolean isCrossingToNextSegment(Segment segment) {   if (l == segment.l || r == segment.r) {    return true;   } else if (l < segment.l) {    return r >= segment.l;   } else if (r > segment.r) {    return l <= segment.r;   } else {    return true;   }  } }
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();  } }
2	public class Main { FastReader scn; PrintWriter out; String INPUT = "";  void solve() {  long n = scn.nextLong(), k = scn.nextLong(), mod = (int)1e9 + 7;  if(n == 0) {  out.println(0);  return;  }  n %= mod;  long x = (pow(2, k + 1, mod) * n) % mod;  long y = (pow(2, k, mod) + mod - 1) % mod;   long ans = ((x - y) % mod + mod) % mod;  out.println(ans); }  long pow(long a, long x, long m) {  if(x == 0) {  return 1;  }  long p = pow(a, x / 2, m);  p *= p;  p %= m;  if(x % 2 == 1) {  p *= a;  p %= m;  }  return p; }  long gcd(long a, long b) {  return b == 0 ? a : gcd(b, a % b); }  void run() throws Exception {  boolean onlineJudge = System.getProperty("ONLINE_JUDGE") != null;  out = new PrintWriter(System.out);  scn = new FastReader(onlineJudge);  long time = System.currentTimeMillis();  solve();  out.flush();  if (!onlineJudge) {  System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));  } }  public static void main(String[] args) throws Exception {  new Main().run(); }  class FastReader {  InputStream is;  public FastReader(boolean onlineJudge) {  is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());  }  byte[] inbuf = new byte[1024];  public int lenbuf = 0, ptrbuf = 0;  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++];  }  boolean isSpaceChar(int c) {  return !(c >= 33 && c <= 126);  }  int skip() {  int b;  while ((b = readByte()) != -1 && isSpaceChar(b))   ;  return b;  }  double nextDouble() {  return Double.parseDouble(next());  }  char nextChar() {  return (char) skip();  }  String next() {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(isSpaceChar(b))) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }  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);  }  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 * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }  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 * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }  char[][] nextMatrix(int n, int m) {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)   map[i] = next(m);  return map;  }  int[] nextArray(int n, boolean isOneInd) {  int k = isOneInd ? 1 : 0;  int[] a = new int[n + k];  for (int i = k; i < n + k; i++)   a[i] = nextInt();  return a;  }  int[] shuffle(int[] arr) {  Random r = new Random();  for (int i = 1, j; i < arr.length; i++) {   j = r.nextInt(i);   arr[i] = arr[i] ^ arr[j];   arr[j] = arr[i] ^ arr[j];   arr[i] = arr[i] ^ arr[j];  }  return arr;  } } }
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; } }
2	public class Alpha_Round {  public static void main(String[] args) throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));   String[] in = reader.readLine().split(" ");   long n = Long.parseLong(in[0]);   long k = Long.parseLong(in[1]);   long D = 9 + 8*k + 8*n;   long m = (long) ((-3 + Math.sqrt(D))/2);   writer.write((n - m) + "");   writer.close();  } }
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]);     }      } }  }
0	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputStreamReader in = new InputStreamReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); } } class TaskA {  public void solve(int testNumber, InputStreamReader inSt, PrintWriter out) {   InputReader in = new InputReader(inSt);   long a = in.nextLong();   long b = in.nextLong();   long result = 0;   while (b != 1) {    result += a / b;    long r = a % b;    long q = b;    long top = q % r;    long bottom = r;    result += q / r;    a = top;    b = bottom;   }   result += a;   out.println(result);  }  class InputReader {   public BufferedReader reader;   private String[] currentArray;   int curPointer;   public InputReader(InputStreamReader inputStreamReader) {    reader = new BufferedReader(inputStreamReader);   }   public String next() {    try {     currentArray = null;     return reader.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public void nextChars(char[] t) {    try {     currentArray = null;     reader.read(t);    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public char nextChar() {    try {     currentArray = null;     return (char) reader.read();    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public int nextInt() {    if ((currentArray == null) || (curPointer >= currentArray.length)) {     try {      currentArray = reader.readLine().split(" ");     } catch (IOException e) {      throw new RuntimeException(e);     }     curPointer = 0;    }    return Integer.parseInt(currentArray[curPointer++]);   }   public long nextLong() {    if ((currentArray == null) || (curPointer >= currentArray.length)) {     try {      currentArray = reader.readLine().split(" ");     } catch (IOException e) {      throw new RuntimeException(e);     }     curPointer = 0;    }    return Long.parseLong(currentArray[curPointer++]);   }  } }
2	public class Cf2 {  static boolean ok(long n, long k, long eatten) {   long moves = n-eatten;   long ans = moves*(moves+1)/2;   ans -= eatten;   return ans <= k;  }  public static void main(String[] args) {   FastReader in = new FastReader();   long n = in.nextInt();   long k = in.nextInt();   long left = 0, right = n;   while (left <= right) {    long middle = (left+right)/2;    if (ok(n, k, middle)) right = middle-1;    else left=middle+1;   }   System.out.println(left);  }  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;   }  } }
4	public class Main {  public static void main(String[] args) {   InputStream inputStream;   try {    inputStream = new FileInputStream("input.txt");   } catch (IOException e) {    throw new RuntimeException(e);   }   OutputStream outputStream;   try {    outputStream = new FileOutputStream("output.txt");   } catch (IOException e) {    throw new RuntimeException(e);   }   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  } } class TaskC {  public void solve(int testNumber, InputReader in, PrintWriter out) {   int n = in.nextInt();   int m = in.nextInt();   int k = in.nextInt();   Queue<Point> points = new LinkedList<Point>();   int[][] burnTime = new int[n][m];   boolean[][] visited = new boolean[n][m];   for (int i = 0; i < k; i++) {    int x = in.nextInt() - 1;    int y = in.nextInt() - 1;    visited[x][y] = true;    burnTime[x][y] = 0;    points.add(new Point(x, y));   }   int[] dx = new int[]{-1, 0, 0, 1};   int[] dy = new int[]{0, -1, 1, 0};   while (points.size() != 0) {    Point cur = points.poll();    int x = cur.x;    int y = cur.y;    for (int i = 0; i < dx.length; i++) {     int nextX = x + dx[i];     int nextY = y + dy[i];     if (nextX >= 0 && nextX < n && nextY >= 0 && nextY < m && (burnTime[x][y] + 1 < burnTime[nextX][nextY] || !visited[nextX][nextY])) {      points.add(new Point(nextX, nextY));      visited[nextX][nextY] = true;      burnTime[nextX][nextY] = burnTime[x][y] + 1;     }    }   }   int x, y;   x = y = 0;   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     if (burnTime[i][j] > burnTime[x][y]) {      x = i;      y = j;     }    }   }   out.printf("%d %d", x + 1, y + 1);  } } class Point {  int x;  int y;  public Point(int x, int y) {   this.x = x;   this.y = y;  } } 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());  } }
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));}  }
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)); } }
6	public class Main {  public static void main(String[] args) {     Scanner in = new Scanner(System.in);   int n = in.nextInt();   int m = in.nextInt();     boolean[][] graph = new boolean[n][n];     for(int i = 0; i < m; i++) {    int from = in.nextInt() - 1;    int to = in.nextInt() - 1;    graph[from][to] = true;    graph[to][from] = true;   }   int max = 1 << n;   long[][] dp = new long[max][n];   for(int mask = 1; mask < max; mask++) {    for(int i = 0; i < n; i++) {     int countMask = Integer.bitCount(mask);     boolean existSubSeti = (mask & (1 << i)) > 0;     if(countMask == 1 && existSubSeti) {      dp[mask][i] = 1;     }     else if(countMask > 1 && existSubSeti) {      int mask1 = mask ^ (1 << i);      for(int j = 0; j < n; j++) {       if(graph[j][i] && i != firstMask(mask, n)) {        dp[mask][i] += dp[mask1][j];       }      }     }    }   }     long counter = 0;   for(int mask = 1; mask < max; mask++) {    for(int i = 0; i < n; i++) {     if(Integer.bitCount(mask) >= 3 && graph[firstMask(mask, n)][i]) {      counter += dp[mask][i];     }    }      }   System.out.println(counter / 2);   in.close();  }   public static int firstMask(int mask, int n) {   for(int i = 0; i < n; i++) {    if((mask & (1 << i)) > 0) return i;   }   return -1;    } }
1	@SuppressWarnings("unchecked") public class P701A {  Map<Character, Integer> cc = new HashMap(72);  void add(char c) {  cc.put(c, cc.getOrDefault(c, 0) + 1); }  void rem(char c) {  Integer cnt = cc.get(c) - 1;  if (cnt != 0) {  cc.put(c, cnt);  } else {  cc.remove(c);  } }  public void run() throws Exception {  int n = nextInt();  char [] s = next().toCharArray();  BitSet bs = new BitSet();  for (char c : s) {  bs.set(c);  }  int t = bs.cardinality();   int m = Integer.MAX_VALUE;  for (int i = 0, j = 0; i < n; i++) {  while ((j < n) && (cc.size() < t)) {   add(s[j]);   j++;  }    if (cc.size() == t) {   m = Math.min(m, j - i);  }    rem(s[i]);  }   println(m); }  public static void main(String... args) throws Exception {  br = new BufferedReader(new InputStreamReader(System.in));  pw = new PrintWriter(new BufferedOutputStream(System.out));  new P701A().run();  br.close();  pw.close();  System.err.println("\n[Time : " + (System.currentTimeMillis() - startTime) + " ms]"); }  static long startTime = System.currentTimeMillis(); static BufferedReader br; static PrintWriter pw; StringTokenizer stok;  String nextToken() throws IOException {  while (stok == null || !stok.hasMoreTokens()) {  String s = br.readLine();  if (s == null) { return null; }  stok = new StringTokenizer(s);  }  return stok.nextToken(); }  void print(byte b) { print("" + b); } void print(int i) { print("" + i); } void print(long l) { print("" + l); } void print(double d) { print("" + d); } void print(char c) { print("" + c); } void print(Object o) {  if (o instanceof int[]) { print(Arrays.toString((int [])o));  } else if (o instanceof long[]) { print(Arrays.toString((long [])o));  } else if (o instanceof char[]) { print(Arrays.toString((char [])o));  } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));  } else if (o instanceof short[]) { print(Arrays.toString((short [])o));  } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));  } else if (o instanceof float[]) { print(Arrays.toString((float [])o));  } else if (o instanceof double[]) { print(Arrays.toString((double [])o));  } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));  } else { print("" + o); } } void print(String s) { pw.print(s); } void println() { println(""); } void println(byte b) { println("" + b); } void println(int i) { println("" + i); } void println(long l) { println("" + l); } void println(double d) { println("" + d); } void println(char c) { println("" + c); } void println(Object o) { print(o); println(); } void println(String s) { pw.println(s); } int nextInt() throws IOException { return Integer.parseInt(nextToken()); } long nextLong() throws IOException { return Long.parseLong(nextToken()); } double nextDouble() throws IOException { return Double.parseDouble(nextToken()); } char nextChar() throws IOException { return (char) (br.read()); } String next() throws IOException { return nextToken(); } String nextLine() throws IOException { return br.readLine(); } int [] readInt(int size) throws IOException {  int [] array = new int [size];  for (int i = 0; i < size; i++) { array[i] = nextInt(); }  return array; } long [] readLong(int size) throws IOException {  long [] array = new long [size];  for (int i = 0; i < size; i++) { array[i] = nextLong(); }  return array; } double [] readDouble(int size) throws IOException {  double [] array = new double [size];  for (int i = 0; i < size; i++) { array[i] = nextDouble(); }  return array; } String [] readLines(int size) throws IOException {  String [] array = new String [size];  for (int i = 0; i < size; i++) { array[i] = nextLine(); }  return array; }  int gcd(int a, int b) {  return ((b > 0) ? gcd(b, a % b) : a); } }
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();  }   Arrays.sort(arr);   int[] visited=new int[n];   int ans=0;   for(int i=0;i<n;i++)  {  if(visited[i]==0)  {   ans++;     for(int j=i+1;j<n;j++)   {   if(arr[j]%arr[i]==0&&visited[j]==0)   {    visited[j]=1;   }   }  }  }   System.out.println(ans);   }  }
4	public class D {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   int t = 1;   for (int i = 0; i < t; i++) {    solve(sc, pw);   }   pw.close();  }  static void solve(Scanner in, PrintWriter out){   int n = in.nextInt(), m = in.nextInt(), k = in.nextInt();   int[][] ri = new int[n][m - 1];   int[][] dn = new int[n - 1][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m - 1; j++) {     ri[i][j] = in.nextInt();    }   }   for (int i = 0; i < n - 1; i++) {    for (int j = 0; j < m; j++) {     dn[i][j] = in.nextInt();    }   }   long[][][] dp = new long[n][m][k + 1];   if (k % 2 == 1){    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      out.print(-1 +" ");     }     out.println();    }   }else{    for (int l = 2; l <= k; l += 2) {     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       long dm = Long.MAX_VALUE;       if (i > 0){        int pi = i - 1, pj = j;        dm = Math.min(dm, dp[pi][pj][l - 2] + dn[pi][pj] * 2);       }       if (j > 0){        int pi = i ,pj = j - 1;        dm = Math.min(dm, dp[pi][pj][l - 2] + ri[pi][pj] * 2);       }       if (i < n - 1){        dm = Math.min(dm, dp[i + 1][j][l - 2] + dn[i][j] * 2);       }       if (j < m - 1){        dm = Math.min(dm, dp[i][j + 1][l - 2] + ri[i][j] * 2);       }       dp[i][j][l] = dm;      }     }    }    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      if (dp[i][j][k] == Long.MAX_VALUE){       out.print(-1 +" ");      }else{       out.print(dp[i][j][k] +" ");      }     }     out.println();    }   }   }  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 (a == 0)    return b;   return gcd(b % a, a);  }    static long lcm(long a, long b)  {   return (a / gcd(a, b)) * b;  }  public static int[] sieveEratosthenes(int n) {   if (n <= 32) {    int[] primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31};    for (int i = 0; i < primes.length; i++) {     if (n < primes[i]) {      return Arrays.copyOf(primes, i);     }    }    return primes;   }   int u = n + 32;   double lu = Math.log(u);   int[] ret = new int[(int) (u / lu + u / lu / lu * 1.5)];   ret[0] = 2;   int pos = 1;   int[] isnp = new int[(n + 1) / 32 / 2 + 1];   int sup = (n + 1) / 32 / 2 + 1;   int[] tprimes = {3, 5, 7, 11, 13, 17, 19, 23, 29, 31};   for (int tp : tprimes) {    ret[pos++] = tp;    int[] ptn = new int[tp];    for (int i = (tp - 3) / 2; i < tp << 5; i += tp) ptn[i >> 5] |= 1 << (i & 31);    for (int j = 0; j < sup; j += tp) {     for (int i = 0; i < tp && i + j < sup; i++) {      isnp[j + i] |= ptn[i];     }    }   }        int[] magic = {0, 1, 23, 2, 29, 24, 19, 3, 30, 27, 25, 11, 20, 8, 4, 13, 31, 22, 28, 18, 26, 10, 7, 12, 21, 17, 9, 6, 16, 5, 15, 14};   int h = n / 2;   for (int i = 0; i < sup; i++) {    for (int j = ~isnp[i]; j != 0; j &= j - 1) {     int pp = i << 5 | magic[(j & -j) * 0x076be629 >>> 27];     int p = 2 * pp + 3;     if (p > n) break;     ret[pos++] = p;     if ((long) p * p > n) continue;     for (int q = (p * p - 3) / 2; q <= h; q += p) isnp[q >> 5] |= 1 << q;    }   }   return Arrays.copyOf(ret, pos);  }    public static long[] rdiv2(int n, int mod){   long[] arr = new long[n + 5];   arr[0] = 1;   long rev2 = (mod + 1) / 2;   for (int i = 1; i < n; i++) {    arr[i] = arr[i - 1] * rev2 % mod;   }   return arr;  }  static List<Integer> primeFactors(int n)  {     List<Integer> ls = new ArrayList<>();   if (n % 2 == 0) ls.add(2);   while (n%2==0)   {    n /= 2;   }        for (int i = 3; i <= Math.sqrt(n); i+= 2)   {       if (n % i == 0) ls.add(i);    while (n%i == 0)    {     n /= i;    }   }   if (n > 1) ls.add(n);   return ls;  } }
0	public class ProblemA {  static final int INF = 100000000;  public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);   String[] nmd = in.readLine().split(" ");  long a = Long.valueOf(nmd[0]);  long b = Long.valueOf(nmd[1]);  long cnt = 0;  while (true) {  if (a == 0) {   break;  }  if (a >= b) {   cnt += a / b;   a = a % b;  } else {   if (b % a == 0) {   cnt += b / a - 1;   b = a;   } else {   cnt += b / a;   b = b % a;     }  }  }  out.println(cnt);  out.flush(); }   public static void debug(Object... o) {  System.err.println(Arrays.deepToString(o)); } }
3	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int N = Integer.parseInt(sc.next());   int[] a = new int[N];   int[] flag = new int[N];   int ans = 0;   for (int i=0;i<N;i++) {    a[i] = Integer.parseInt(sc.next());   }   Arrays.sort(a);   for (int i=0;i<N;i++) {    int used = 0;    for (int j=0;j<N;j++) {     if (flag[j]==1) {      continue;     } else {      if (a[j]%a[i]==0) {       used=1;       flag[j]=1;      }     }    }    if (used==1) {     ans++;    }   }   System.out.println(ans);  } }
4	public class LRS {    public static String lcp(String s, String t) {   int n = Math.min(s.length(), t.length());   for (int i = 0; i < n; i++) {    if (s.charAt(i) != t.charAt(i))     return s.substring(0, i);   }   return s.substring(0, n);  }    public static String lrs(String s) {      int N = s.length();   String[] suffixes = new String[N];   for (int i = 0; i < N; i++) {    suffixes[i] = s.substring(i, N);   }      Arrays.sort(suffixes);      String lrs = "";   for (int i = 0; i < N - 1; i++) {    String x = lcp(suffixes[i], suffixes[i+1]);    if (x.length() > lrs.length())     lrs = x;   }   return lrs;  }      public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   String s = br.readLine();   s = s.replaceAll("\\s+", " ");   System.out.println(lrs(s).length());  } }
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 final class TaskC {   private static final int MODULO = 1_000_000_000 + 7;   public void solve(int __, InputReader in, PrintWriter out) {    long qty = in.nextLong();    long months = in.nextLong();    if (qty == 0) {     out.println(0);     return;    }    qty %= MODULO;    long pow = pow(2, months + 1);    qty = (qty * pow) % MODULO;    long sub = (pow - 2 + MODULO) % MODULO * pow(2, MODULO - 2) % MODULO;    qty = (qty - sub + MODULO) % MODULO;    out.println(qty);   }   private long pow(long base, long power) {    long result = 1;    while (power > 0) {     if ((power & 1) != 0) {      result = (result * base) % MODULO;     }     base = (base * base) % MODULO;     power >>>= 1;    }    return result;   }  }  static class InputReader {   private final BufferedReader reader;   private StringTokenizer tokenizer;   public InputReader(InputStream in) {    reader = new BufferedReader(new InputStreamReader(in));   }   public long nextLong() {    return Long.parseLong(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;   }  } }
2	public class Main { public static void main(String[] args) throws IOException {  (new Main()).solve(); }  public Main() { }  MyReader in = new MyReader(); PrintWriter out = new PrintWriter(System.out);  void solve() throws IOException {          long n = in.nextLong();  long k = in.nextLong();  long sum = 1;  long count = 0;   long index = k - 1;   long[] delta = {1000000000, 100000000, 10000000, 1000000, 100000, 10000, 1000, 100, 10, 1, 0};   while (index > 0) {  if (index + sum <= n) {   for (int d = 0; d < delta.length; d++) {   if (delta[d] < index) {    long m = (2 * index - delta[d])*(delta[d] + 1)/2;    if (m + sum <= n) {    sum += m;    index -= (delta[d] + 1);    count += (delta[d] + 1);    }   }   }  } else {   index = n - sum;  }  }  if (sum == n) {  out.println(count);  } else {  out.println(-1);  }     out.close(); }  }; class MyReader { private BufferedReader in; String[] parsed; int index = 0;  public MyReader() {  in = new BufferedReader(new InputStreamReader(System.in)); }  public int nextInt() throws NumberFormatException, IOException {  if (parsed == null || parsed.length == index) {  read();  }  return Integer.parseInt(parsed[index++]); }  public long nextLong() throws NumberFormatException, IOException {  if (parsed == null || parsed.length == index) {  read();  }  return Long.parseLong(parsed[index++]); }  public String nextString() throws IOException {  if (parsed == null || parsed.length == index) {  read();  }  return parsed[index++]; }  private void read() throws IOException {  parsed = in.readLine().split(" ");  index = 0; }  public String readLine() throws IOException {  return in.readLine(); } };
6	public class D { private Scanner in; private PrintWriter out;  private boolean[][] g;  public void solve() {  n = ni();  int m = ni();  g = new boolean[n][n];  for(int i = 0;i < m;i++){  int f = ni();  int t = ni();  g[f-1][t-1] = true;  g[t-1][f-1] = true;  }   long ret = 0L;  cache = new long[20 << 19];  for(int i = 0;i < n;i++){  start = i;  ret += rec(1 << start, i, 0);  }  out.println(ret/2); }  private long[] cache; private int n; private int start;  private long rec(int passed, int cur, int depth) {  int code = cur << 19 | passed;  if(cache[code] != 0)return cache[code];  long ret = 0L;   if(g[cur][start] && depth >= 2)ret++;  for(int i = start + 1;i < n;i++){  if((passed & (1 << i)) == 0 && g[cur][i]){   ret += rec(passed | (1 << i), i, depth + 1);  }  }   cache[code] = ret;  return ret; }  public void run() throws Exception {        in = new Scanner(System.in);  System.setOut(new PrintStream(new BufferedOutputStream(System.out)));  out = new PrintWriter(System.out);    int n = 1;  for(int i = 1;i <= n;i++){  long t = System.currentTimeMillis();  solve();  out.flush();  System.err.printf("%04d/%04d %7d%n", i, n, System.currentTimeMillis() - t);  } }   public static void main(String[] args) throws Exception {  new D().run(); }  private int ni() { return Integer.parseInt(in.next()); } private static void tr(Object... o) { System.out.println(o.length == 1 ? o[0] : Arrays.toString(o)); } private void tra(int[] a) {System.out.println(Arrays.toString(a));} private void tra(int[][] a) {  for(int[] e : a){  System.out.println(Arrays.toString(e));  } }  }
4	public class Main {   public static void main(String[] args) throws NumberFormatException, IOException  {   Scanner sc = new Scanner(new File("input.txt"));     int n = sc.nextInt();   int m =sc.nextInt();   sc.nextLine();   int k =sc.nextInt();   int les[][] = new int[n][m];   PrintWriter out = new PrintWriter(new FileWriter("output.txt"));      ArrayList<Integer[]> list = new ArrayList();   sc.nextLine();   for(int i = 0;i<k;i++)   {       Integer[] ii = new Integer[2];    ii[0] = sc.nextInt()-1;    ii[1] = sc.nextInt()-1;    list.add(ii);      }   sc.close();   int maxr = 0;   int maxi = 0;   int maxj = 0;   for(int i = 0;i<n;i++)   {    for(int j = 0;j<m;j++)    {     int minr = 100000;     int mini = 0;     int minj = 0;     for(int f = 0;f<k;f++)     {      Integer[] ii = list.get(f);      int ww = Math.abs(ii[0] - i);      int hh = Math.abs(ii[1] - j);      int r = ww+hh;      if(r<minr)      {       minr = r;       mini=i;       minj=j;      }          }     if(maxr<minr&&minr<100000)     {      maxi = mini;      maxj = minj;      maxr = minr;     }    }   }     out.print((maxi+1)+" "+(maxj+1));   out.close();    }        }
1	public class Third{ static long mod=1000000007;   public static void main(String[] args) throws Exception{      InputReader in = new InputReader(System.in);    PrintWriter pw=new PrintWriter(System.out);                 int n=in.readInt();      String a=in.readString();  char c[]=a.toCharArray();  HashSet<Character>ht=new HashSet<Character>();  Deque<Character>q=new LinkedList<Character>();  HashSet<Character>hs=new HashSet<Character>();  HashMap<Character,Integer>hm=new HashMap<Character,Integer>();  for(int i=0;i<n;i++)  {   ht.add(c[i]);  }  int t=ht.size();  q.addLast(c[0]);  hs.add(c[0]);  hm.put(c[0],1);  int ans=Integer.MAX_VALUE;  if(hs.size()==t)  {     ans=min(ans,q.size());  }    for(int i=1;i<n;i++)  {   q.addLast(c[i]);  hs.add(c[i]);  if(hm.containsKey(c[i]))  {   int x=hm.get(c[i]);   hm.put(c[i],x+1);  }  else   hm.put(c[i],1);   while(hs.size()==t)   {      ans=min(ans,q.size());   char ch=q.peekFirst();   int x=hm.get(ch);   if(x==1)    break;   else    {    hm.put(ch, x-1);    q.pollFirst();    }      }          }  pw.println(ans);           pw.close();  }    public static long gcd(long x,long y) { if(x%y==0)  return y; else  return gcd(y,x%y); } public static int gcd(int x,int y) { if(x%y==0)  return y; else  return gcd(y,x%y); } 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; } static class Pair implements Comparable<Pair> { int a,b; Pair (int a,int b) {  this.a=a;  this.b=b; }  public int compareTo(Pair o) {   if(this.a!=o.a)  return Integer.compare(this.a,o.a);  else  return Integer.compare(this.b, o.b);   } public boolean equals(Object o) {   if (o instanceof Pair) {    Pair p = (Pair)o;    return p.a == a && p.b == b;   }   return false;  }  public int hashCode() {   return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();  }  }   static long sort(int a[]) { int n=a.length; int b[]=new int[n];  return mergeSort(a,b,0,n-1);} static long mergeSort(int a[],int b[],long left,long right) { long c=0;if(left<right) { long mid=left+(right-left)/2;  c= mergeSort(a,b,left,mid);  c+=mergeSort(a,b,mid+1,right);  c+=merge(a,b,left,mid+1,right); }  return c; } static long merge(int a[],int b[],long left,long mid,long right) {long c=0;int i=(int)left;int j=(int)mid; int k=(int)left; while(i<=(int)mid-1&&j<=(int)right) { if(a[i]<=a[j]) {b[k++]=a[i++]; } else { b[k++]=a[j++];c+=mid-i;}} while (i <= (int)mid - 1) b[k++] = a[i++]; while (j <= (int)right) b[k++] = a[j++]; for (i=(int)left; i <= (int)right; i++)  a[i] = b[i]; return c; }  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; }   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 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();    StringBuilder res = new StringBuilder();    do    {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   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 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 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);   }  }                           }
3	public class Main {  private static InputReader reader = new InputReader(System.in);  private static PrintWriter writer = new PrintWriter(System.out);  public static void main(String[] args) {   int n = readInt();   long[] a = readLongArray(n);   HashMap<Long, List<Block>> blocks = new HashMap<>();   for (int j = 0; j < n; j++) {    long sum = 0;    for (int i = j; i >= 0; i--) {     sum += a[i];     if (!blocks.containsKey(sum))      blocks.put(sum, new LinkedList<>());     List<Block> blockList = blocks.get(sum);     if (blockList.size() > 0 && blockList.get(blockList.size() - 1).r == j) continue;     blockList.add(new Block(i, j));    }   }   List<Block> bestBlocks = new LinkedList<>();   for(long sum : blocks.keySet()) {    List<Block> blockList = blocks.get(sum);    List<Block> curBest = new LinkedList<>();    int lastR = -1;    for(Block block : blockList) {     if (block.l > lastR) {      curBest.add(block);      lastR = block.r;     }    }    if (curBest.size() > bestBlocks.size()) {     bestBlocks = curBest;    }   }   writer.println(bestBlocks.size());   for(Block block : bestBlocks) {    writer.printf("%d %d\n", block.l + 1, block.r + 1);   }   writer.flush();  }  private static int readInt() {   return reader.nextInt();  }  private static long readLong() {   return Long.parseLong(reader.next());  }  private static int[] readIntArray(int size) {   int[] array = new int[size];   for (int i = 0; i < size; i++) {    array[i] = readInt();   }   return array;  }  private static long[] readLongArray(int size) {   long[] array = new long[size];   for (int i = 0; i < size; i++) {    array[i] = readLong();   }   return array;  }  private static void reverseIntArray(int[] array) {   for (int i = 0; i < array.length / 2; i++) {    int temp = array[i];    array[i] = array[array.length - i - 1];    array[array.length - i - 1] = temp;   }  }  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());   }  }  private static class Block {   int l, r;   Block(int l, int r) {    this.l = l;    this.r = r;   }  } }
4	public class Codeforces {  public static void main(String args[])throws Exception  {   BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));   StringBuilder sb=new StringBuilder();   String s[]=bu.readLine().split(" ");   int n=Integer.parseInt(s[0]),m=Integer.parseInt(s[1]),k=Integer.parseInt(s[2]);   int i,j,max=n*m,in[][]=new int[n][m],x=0;   if(k%2==1)   {    for(i=0;i<n;i++)    {     for(j=0;j<m;j++) sb.append("-1 ");     sb.append("\n");    }    System.out.print(sb);    return;   }   for(i=0;i<n;i++)   for(j=0;j<m;j++) in[i][j]=x++;   ArrayList<Edge> g[]=new ArrayList[max];   for(i=0;i<max;i++) g[i]=new ArrayList<>();   for(i=0;i<n;i++)   {    s=bu.readLine().split(" ");    for(j=0;j<m-1;j++)    {     int u=in[i][j],v=in[i][j+1],w=Integer.parseInt(s[j]);     g[u].add(new Edge(v,w));     g[v].add(new Edge(u,w));    }   }   for(i=0;i<n-1;i++)   {    s=bu.readLine().split(" ");    for(j=0;j<m;j++)    {     int u=in[i][j],v=in[i+1][j],w=Integer.parseInt(s[j]);     g[u].add(new Edge(v,w));     g[v].add(new Edge(u,w));    }   }   k/=2;   int dp[][]=new int[k][max];   for(i=0;i<max;i++)   {    dp[0][i]=Integer.MAX_VALUE;    for(Edge e:g[i])    dp[0][i]=Math.min(dp[0][i],2*e.w);   }   for(i=1;i<k;i++)   for(j=0;j<max;j++)   {    dp[i][j]=Integer.MAX_VALUE;    for(Edge e:g[j])    dp[i][j]=Math.min(dp[i][j],dp[i-1][e.v]+2*e.w);   }   for(i=0;i<n;i++)   {    for(j=0;j<m;j++)    sb.append(dp[k-1][in[i][j]]+" ");    sb.append("\n");   }   System.out.print(sb);  }  static class Edge  {   int v,w,d;   Edge(int a,int b)   {    v=a;    w=b;    d=0;   }  } }
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);   }  } }
0	public class MargariteBestPresent_1080B {  private static int f(int x) {  return (x%2==0)?x/2:(x-1)/2-x; }  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n,r,l;  n = sc.nextInt();  while(n-->0) {  l = sc.nextInt();  r = sc.nextInt();   System.out.println(f(r)-f(l-1));  }  sc.close(); } }
0	public class Mai {  public static void main(String[] args) throws IOException{  Scanner cin = new Scanner(System.in);   int t, n, m;   t = cin.nextInt();   while(t > 0) {  t--;  int sum = 0;  n = cin.nextInt();  m = cin.nextInt();  while(n > 0 && m > 0) {   if(n < m) {   int k = n;   n = m;   m = k;   }   sum += n / m; n %= m;  }    System.out.println(sum);  } } }
4	public class C {  void run() throws IOException {  int n = ni(), m = ni(), k = ni(), q = n * m, h = 0, t = 0, inf = 123456;  int[] x = new int[q], y = new int[q];  int[][] d = new int[n][m];  for (int i = 0; i < n; i++)  for (int j = 0; j < m; j++)   d[i][j] = inf;  for (int i = 0; i < k; i++) {  int u = ni() - 1, v = ni() - 1;  d[u][v] = 0;  x[t] = u;  y[t] = v;  t++;  }  if (k < q)  while (t != h) {   int u = x[h], v = y[h];   int l = d[u][v] + 1;   h++;   if (u > 0 && d[u - 1][v] > l) {   d[u - 1][v] = l;   x[t] = u - 1;   y[t] = v;   t++;   }   if (u < n - 1 && d[u + 1][v] > l) {   d[u + 1][v] = l;   x[t] = u + 1;   y[t] = v;   t++;   }   if (v > 0 && d[u][v - 1] > l) {   d[u][v - 1] = l;   x[t] = u;   y[t] = v - 1;   t++;   }   if (v < m - 1 && d[u][v + 1] > l) {   d[u][v + 1] = l;   x[t] = u;   y[t] = v + 1;   t++;   }  }  int max = 0, tx = 0, ty = 0;  for (int i = 0; i < n; i++)  for (int j = 0; j < m; j++)   if (d[i][j] > max) {   max = d[i][j];   tx = i;   ty = j;   }  pw.print(1 + tx + " " + (1 + ty)); }  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 {  BufferedReader _br = new BufferedReader(new FileReader(new File("input.txt")));  PrintWriter _pw = new PrintWriter(new FileWriter(new File("output.txt")));  new C(_br, _pw).run();  _br.close();  _pw.close(); }  public C(BufferedReader _br, PrintWriter _pw) {  br = _br;  pw = _pw; } }
4	public class P1 { public static void main(String[] args) {  String s = null;   try {   Scanner sc = new Scanner(System.in);  s = sc.next();    }  catch (Exception e) {  e.printStackTrace();  }   int n = s.length();   HashSet<String> h = new HashSet<String>();  String t=null;  boolean b;  int lmax = 0;  for (int i=0; i<n; i++) {  for (int j=i+1; j<=n; j++) {   t = s.substring(i, j);   b = h.add(t);   if (b==false) {   if (j-i>lmax) {    lmax = j-i;    }   }  }  }  System.out.println(lmax); } }
4	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 << 27).start();  }  static class Pair {   int f;   int s;   int p;   PrintWriter w;      Pair(int f, int s) {       this.f = f;    this.s = s;              }   public static Comparator<Pair> wc = new Comparator<Pair>() {    public int compare(Pair e1,Pair e2){        if(Math.abs(e1.f)-Math.abs(e2.f)!=0){        return -1*(Math.abs(e1.f)-Math.abs(e2.f));    }    else{        return(Math.abs(e1.s)-Math.abs(e2.s));    }   }};  }  public Integer[] sort(Integer[] a) {   Arrays.sort(a);   return a;  }  public Long[] sort(Long[] a) {   Arrays.sort(a);   return a;  }  public static ArrayList<Integer> sieve(int N) {   int i, j, flag;   ArrayList<Integer> p = new ArrayList<Integer>();   for (i = 1; i < N; i++) {    if (i == 1 || i == 0)     continue;    flag = 1;    for (j = 2; j <= i / 2; ++j) {     if (i % j == 0) {      flag = 0;      break;     }    }    if (flag == 1) {     p.add(i);    }   }   return p;  }  public static long gcd(long a, long b) {   if (b == 0)    return a;   else    return gcd(b, a % b);  }  public static int gcd(int a, int b) {   if (b == 0)    return a;   else    return gcd(b, a % b);  }    public static int dfs(int s, ArrayList<Integer>[] g, long[] dist, boolean[] v, PrintWriter w, int p) {   v[s] = true;   int ans = 1;     int t = g[s].size();     for (int i = 0; i < t; i++) {    int x = g[s].get(i);    if (!v[x]) {         ans = Math.min(ans, dfs(x, g, dist, v, w, s));    } else if (x != p) {         ans = 0;    }   }     return ans;  }    public static int bfs(int s, ArrayList<Integer>[] g, long[] dist, boolean[] b, PrintWriter w, int p) {   b[s] = true;   int siz = 1;     Queue<Integer> q = new LinkedList<>();   q.add(s);   while (q.size() != 0) {    int i = q.poll();    Iterator<Integer> it = g[i].listIterator();    int z = 0;    while (it.hasNext()) {     z = it.next();     if (!b[z]) {      b[z] = true;           dist[z] = dist[i] + 1;           q.add(z);     } else if (z != p) {      siz = 0;     }    }   }   return siz;  }  public static int lower(int a[], int x) {   int l = -1, r = a.length;   while (l + 1 < r) {    int m = (l + r) >>> 1;    if (a[m] >= x)     r = m;    else     l = m;   }   return r;  }  public static int upper(int a[], int x) {   int l = -1, r = a.length;   while (l + 1 < r) {    int m = (l + r) >>> 1;    if (a[m] <= x)     l = m;    else     r = m;   }   return l + 1;  }  public static int lower(ArrayList<Integer> a, int x) {   int l = -1, r = a.size();   while (l + 1 < r) {    int m = (l + r) >>> 1;    if (a.get(m) >= x)     r = m;    else     l = m;   }   return r;  }  public static int upper(ArrayList<Integer> a, int x) {   int l = -1, r = a.size();   while (l + 1 < r) {    int m = (l + r) >>> 1;    if (a.get(m) <= x)     l = m;    else     r = m;   }   return l + 1;  }  public static 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;   if (y % 2 == 0)    return p;   else    return (x * p) % m;  }  public void yesOrNo(boolean f){   if(f){    w.println("YES");   }   else{    w.println("NO");   }  }       int oo = (int) 1e9;  int[] parent;  int[] dist;  int[] height;  boolean[] vis;      char[][] g;        long[][][] dp;  long mod;  int n;  int m;  int k;  long[][] pre;      int[][] col;  int[][] row;  PrintWriter w = new PrintWriter(System.out);  public void run() {   InputReader sc = new InputReader(System.in);   int defaultValue = 0;   mod = 1000000007;   int test = 1;     while (test-- > 0) {    n = sc.nextInt();    m = sc.nextInt();    k = sc.nextInt();    col = new int[n][m-1];    row = new int[n-1][m];    dp = new long[n][m][21];    for(int i=0;i<n;i++){     for(int j=0;j<m;j++){      Arrays.fill(dp[i][j],oo);     }    }     for(int i=0;i<n;i++){     for(int j=0;j<m-1;j++){      col[i][j] = sc.nextInt();     }    }    for(int i=0;i<n-1;i++){     for(int j=0;j<m;j++){      row[i][j] = sc.nextInt();     }    }    if(k%2!=0){     for(int i=0;i<n;i++){      for(int j=0;j<m;j++){       w.print(-1+" ");      }      w.println("");     }    }    else{     for(int i=0;i<n;i++){      for(int j=0;j<m;j++){       long ans = sol(i,j,k/2);       w.print((ans*2)+" ");      }      w.println("");     }          }       }   w.flush();   w.close();  }  public long sol(int i, int j, int steps){   if(steps == 0)return 0;   else if(dp[i][j][steps]!=oo)return dp[i][j][steps];   else{    long ans = oo;    if(i-1>-1){     ans = Math.min(ans,sol(i-1,j,steps-1)+row[i-1][j]);    }    if(i+1<n){     ans = Math.min(ans,sol(i+1,j,steps-1)+row[i][j]);    }    if(j-1>-1){     ans = Math.min(ans,sol(i,j-1,steps-1)+col[i][j-1]);    }    if(j+1<m){     ans = Math.min(ans,sol(i,j+1,steps-1)+col[i][j]);    }    dp[i][j][steps] = Math.min(dp[i][j][steps],ans);    return dp[i][j][steps];   }  }    }
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(); } }
1	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)));  int n = nextInt();  char[]a = next().toCharArray();  int[]cnt = new int[256];  for (int i = 0; i < n; i++) {  cnt[a[i]]++;  }  int alldiff = 0;  for (int i = 0; i < 256; i++) {  if (cnt[i] > 0)   alldiff++;  }  Arrays.fill(cnt, 0);  int diff = 0, right = -1, ans = n+5;  for (int i = 0; i < n; i++) {  if (right < i) {   cnt[a[i]]++;   diff = 1;   right = i;  }  while (right < n-1 && diff < alldiff) {   right++;   cnt[a[right]]++;   if (cnt[a[right]]==1)   diff++;  }  if (diff==alldiff && right-i+1 < ans) {   ans = right-i+1;  }  cnt[a[i]]--;  if (cnt[a[i]]==0)   diff--;  }  System.out.println(ans);  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(); } }
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");  } }
0	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   if ((n%4==0)||(n%7==0)||(n%44==0)||(n%47==0)||(n%74==0)||(n%77==0)||(n%444==0)||(n%447==0)||(n%474==0)||(n%477==0)||(n%744==0)||(n%747==0)||(n%774==0)||(n%777==0)) {    System.out.println("YES");   } else {    System.out.println("NO");   }  } }
0	public class Main { public static void main(String[] args) throws IOException {  (new Main()).solve(); }  public void Main() { }  void solve() throws IOException {      MyReader in = new MyReader();  PrintWriter out = new PrintWriter(System.out);     int n = in.nextInt();  out.print("0 0 ");  out.print(n);  out.close(); } }; class MyReader { private BufferedReader in; String[] parsed; int index = 0;  public MyReader() {  in = new BufferedReader(new InputStreamReader(System.in)); }  public int nextInt() throws NumberFormatException, IOException {  if (parsed == null || parsed.length == index) {  read();  }  return Integer.parseInt(parsed[index++]); }  public long nextLong() throws NumberFormatException, IOException {  if (parsed == null || parsed.length == index) {  read();  }  return Long.parseLong(parsed[index++]); }  public String nextString() throws IOException {  if (parsed == null || parsed.length == index) {  read();  }  return parsed[index++]; }  private void read() throws IOException {  parsed = in.readLine().split(" ");  index = 0; }  public String readLine() throws IOException {  return in.readLine(); } };
5	public class CF113_Div2_A implements Runnable {  BufferedReader in; PrintWriter out; StringTokenizer tok;  final boolean ONLINE_JUDGE = (System.getProperty("ONLINE_JUDGE") != null);  public static void main(String[] args) {  new Thread(null, new CF113_Div2_A(), "", 256 * (1L << 20)).start(); }  @Override public void run() {  try {  long startTime = System.currentTimeMillis();  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");  }  Locale.setDefault(Locale.US);  tok = new StringTokenizer("");  solve();  in.close();  out.close();  long endTime = System.currentTimeMillis();  System.err.println("Time = " + (endTime - startTime));  long freeMemory = Runtime.getRuntime().freeMemory();  long totalMemory = Runtime.getRuntime().totalMemory();  System.err.println("Memory = " + ((totalMemory - freeMemory) >> 10));  } 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()); }   static class Utils {  private Utils() {}  public static void mergeSort(int[] a) {  mergeSort(a, 0, a.length - 1);  }  private static final int MAGIC_VALUE = 50;  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 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 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;  }  }  }  void debug(Object... o) {  if (!ONLINE_JUDGE) {  System.err.println(Arrays.deepToString(o));  } }   class Team implements Comparable<Team>{  int cnt, time;  public Team(int cnt, int time) {  this.cnt = cnt;  this.time = time;  }  @Override  public int compareTo(Team x) {  if (cnt == x.cnt) return time - x.time;  return x.cnt - cnt;  }  @Override  public int hashCode() {  final int prime = 31;  int result = 1;  result = prime * result + getOuterType().hashCode();  result = prime * result + cnt;  result = prime * result + time;  return result;  }  @Override  public boolean equals(Object obj) {  if (this == obj)   return true;  if (obj == null)   return false;  if (getClass() != obj.getClass())   return false;  Team other = (Team) obj;  if (!getOuterType().equals(other.getOuterType()))   return false;  if (cnt != other.cnt)   return false;  if (time != other.time)   return false;  return true;  }  private CF113_Div2_A getOuterType() {  return CF113_Div2_A.this;  }      }  void solve() throws IOException {  int n = readInt();  int k = readInt();  k--;  Team[] a = new Team[n];  for (int i =0 ; i < n; i++) {  a[i] = new Team(readInt(), readInt());  }  Arrays.sort(a);  int res = 1;  for (int i = k-1; i >= 0; i--) {  if (a[k].equals(a[i])) res++;  }  for (int i = k+1; i < n; i++) {  if (a[k].equals(a[i])) res++;  }  out.print(res);   } }
4	public class Contest35_3 {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new FileReader("input.txt"));   String[] s = in.readLine().split(" ");   int n = Integer.parseInt(s[0]);   int m = Integer.parseInt(s[1]);   int k = Integer.parseInt(in.readLine());   s = in.readLine().split(" ");   Point[] inp = new Point[k];   int p = 0;   for (int i = 0; i < k; i++) {    inp[i] = new Point(Integer.parseInt(s[p++]),      Integer.parseInt(s[p++]));   }   int max = -1;   int maxx = -1;   int maxy = -1;   int i;   int j, dist;   for (i = 1; i <= n; i++) {    for (j = 1; j <= m; j++) {     dist = 1000000;     for (int l = 0; l < inp.length; l++) {      dist = Math.min(        Math.abs(inp[l].x - i) + Math.abs(inp[l].y - j),        dist);     }     if (dist > max) {      max = dist;      maxx = i;      maxy = j;     }    }   }   String res = maxx + " " + maxy + "\n";   FileWriter out = new FileWriter(new File("output.txt"));   out.append(res);   out.flush();   out.close();  } }
2	public class Main{  final long mod = (int)1e9+7, IINF = (long)1e19;  final int MAX = (int)1e6+1, MX = (int)1e7+1, INF = (int)1e9;  DecimalFormat df = new DecimalFormat("0.0000000000000");  FastReader in;  PrintWriter out;  static boolean multipleTC = false, memory = false;  public static void main(String[] args) throws Exception{   if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 26).start();   else new Main().run();  }  void run() throws Exception{   in = new FastReader();   out = new PrintWriter(System.out);   for(int i = 1, t = (multipleTC)?ni():1; i<=t; i++)solve(i);   out.flush();    out.close();  }  void solve(int TC) throws Exception{   long x = nl(), k = nl();   if(x==0)pn(0);   else {    x%=mod;    long p = modPow(2,k);    long b = mul((x-1+mod)%mod,p), e = mul(x,p);    long ans = c(e)%mod;    ans -= c(b)%mod;    ans%=mod;    if(ans<0)ans+=mod;    ans = mul(ans, 2);    ans = mul(ans, modPow(p, mod-2));    pn(ans);   }  }  long modPow(long a, long p){   long o = 1;   while(p>0){    if((p&1)==1)o = mul(a,o);    a = mul(a,a);    p>>=1;   }   return o;  }     long mul(long a, long b){   if(a>=mod)a%=mod;   if(b>=mod)b%=mod;   a*=b;   if(a>=mod)a%=mod;   return a;  }   long c(long c){   return (c*c+c)/2;  }   int[] reverse(int[] a){   int[] o = new int[a.length];   for(int i = 0; i< a.length; i++)o[i] = a[a.length-i-1];   return o;   }  int[] sort(int[] a){   if(a.length==1)return a;   int mid = a.length/2;   int[] b = sort(Arrays.copyOfRange(a,0,mid)), c = sort(Arrays.copyOfRange(a,mid,a.length));   for(int i = 0, j = 0, k = 0; i< a.length; i++){    if(j<b.length && k<c.length){     if(b[j]<c[k])a[i] = b[j++];     else a[i] = c[k++];    }else if(j<b.length)a[i] = b[j++];    else a[i] = c[k++];   }   return a;  }  long[] sort(long[] a){   if(a.length==1)return a;   int mid = a.length/2;   long[] b = sort(Arrays.copyOfRange(a,0,mid)), c = sort(Arrays.copyOfRange(a,mid,a.length));   for(int i = 0, j = 0, k = 0; i< a.length; i++){    if(j<b.length && k<c.length){     if(b[j]<c[k])a[i] = b[j++];     else a[i] = c[k++];    }else if(j<b.length)a[i] = b[j++];    else a[i] = c[k++];   }   return a;  }  int[] ia(int ind,int n){   int[] out = new int[ind+n];   for(int i = 0; i< n; i++)out[ind+i] = ni();   return out;  }  long[] la(int ind, int n){   long[] out = new long[ind+n];   for(int i = 0; i< n; i++)out[ind+i] = nl();   return out;  }  double[] da(int ind, int n){   double[] out = new double[ind+n];   for(int i = 0; i< n; i++)out[ind+i] = nd();   return out;  }  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 bitcount(long n){return (n==0)?0:(1+bitcount(n&(n-1)));}  void p(Object o){out.print(o);}  void pn(Object o){out.println(o);}  void pni(Object o){out.println(o);out.flush();}  String n(){return in.next();}  String nln(){return in.nextLine();}  int ni(){return Integer.parseInt(in.next());}  long nl(){return Long.parseLong(in.next());}  double nd(){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(){    while (st == null || !st.hasMoreElements()){     try{      st = new StringTokenizer(br.readLine());     }catch (IOException e){      e.printStackTrace();     }    }    return st.nextToken();   }   String nextLine(){    String str = "";    try{     str = br.readLine();    }catch (IOException e){     e.printStackTrace();    }     return str;   }  } }
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));  } } }
4	public class ExplorerSpace {  private 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;  }  }    public static int[][][] dp;   public static boolean valid(int i, int j, int n, int m) {  return i>=0 && i<n &&j>=0 && j<m; }  public static void solution(int n, int m, int k, int[][] h, int[][] v)   {  if(k%2==1)  {  for(int i = 0; i<n; i++)  {   for(int j = 0; j<m; j++)    out.print(-1+" ");     out.println();     }    return;  }   dp = new int[n][m][k/2+1];   for(int t = 1; t<=k/2; t++)  {  for(int i = 0; i<n; i++)  {   for(int j = 0; j<m; j++)   {   dp[i][j][t] = Integer.MAX_VALUE;      }  }  }   for(int i = 0; i<n; i++)  {  for(int j = 0; j<m; j++)  {   dp[i][j][0] = 0;     }  }     for(int t = 1; t<=k/2; t++)  {  for(int i = 0; i<n; i++)  {   for(int j = 0; j<m; j++)   {   if(valid(i,j+1,n,m))    dp[i][j][t] = Math.min(dp[i][j][t], h[i][j] + dp[i][j+1][t-1]);      if(valid(i,j-1,n,m))    dp[i][j][t] = Math.min(dp[i][j][t], h[i][j-1] + dp[i][j-1][t-1]);      if(valid(i+1,j,n,m))    dp[i][j][t] = Math.min(dp[i][j][t], v[i][j] + dp[i+1][j][t-1]);      if(valid(i-1,j,n,m))    dp[i][j][t] = Math.min(dp[i][j][t], v[i-1][j] + dp[i-1][j][t-1]);     }  }  }     for(int i = 0; i<n; i++)  {  for(int j = 0; j<m; j++)   out.print((dp[i][j][k/2]*2)+" ");    out.println();  }   }   private static PrintWriter out = new PrintWriter(System.out); public static void main (String[] args) { MyScanner s = new MyScanner();    int n = s.nextInt();  int m = s.nextInt();  int k = s.nextInt();   int[][] h = new int[n][m-1];   for(int i = 0; i<n; i++)  {  for(int j = 0; j<m-1; j++)  {   h[i][j] = s.nextInt();  }  }   int[][] v = new int[n-1][m];   for(int i = 0; i<n-1; i++)  {  for(int j = 0; j<m; j++)  {   v[i][j] = s.nextInt();  }  }     solution(n,m,k,h,v);   out.flush();  out.close();  } }
6	public class MotherOfDragons { static boolean[][] adjMatrix; public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int k = sc.nextInt();   adjMatrix = new boolean[n][n];  for (int i = 0; i < n; i++)  for (int j = 0; j < n; j++)   adjMatrix[i][j] = sc.nextInt() == 1;   long[] edges = new long[n];  for (int i = 0; i < n; i++)  {  long val = 0;  for (int j = 0; j < n; j++)   if(adjMatrix[i][j] || i == j)   val |= 1l<<j;  edges[i] = val;  }   int h = n/2;   int[] cliques = new int[1<<h];  for (int i = 1; i < 1<<h; i++)  {  int nodes = i;  for (int j = 0; j < h; j++)   if((i & (1 << j)) != 0)   nodes &= edges[j];  if(nodes == i)   cliques[i] = Integer.bitCount(i);  }   for (int i = 1; i < 1<<h; i++)  for (int j = 0; j < h; j++)   if((i & (1 << j)) != 0)   cliques[i] = Math.max(cliques[i], cliques[i ^ (1<<j)]);   int max = 0;  for (int i = 0; i < cliques.length; i++)  max = Math.max(max, cliques[i]);  for (int i = 1; i < 1<<(n-h); i++)  {  long all = -1l;  long tmp = (1l*i)<<h;  for (int j = h; j < n; j++)   if((tmp & (1l << j)) != 0)   all &= edges[j];  long node = all&tmp;  if(node != tmp)   continue;  int connected = (int)(all & ((1<<h)-1));  max = Math.max(max, cliques[connected] + Integer.bitCount(i));  }   System.out.printf("%.12f\n", (k*k*((max-1)/(2.0*max)))); }  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  { return Double.parseDouble(next()); }  } }
4	public class A23 implements Runnable {  private void Solution() throws IOException {  String s = in.readLine();  int n = s.length(), ans = 0;  for (int i = 0; i < n; i ++) {  for (int j = i; j < n; j ++) {   for (int k = i+1; k <= n; k ++) {   for (int g = k; g <= n; g ++) {    if (s.substring(i,j).equals(s.substring(k,g))) {    int l = s.substring(i,j).length();    ans = Math.max(ans, l);    }   }   }  }  }  System.out.println(ans); }  public static void main(String args[]) {  new A23().run(); }  BufferedReader in; StringTokenizer tokenizer;  public void run() {  try {    in = new BufferedReader(new InputStreamReader(System.in));    tokenizer = null;    Solution();    in.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   } }  int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(nextToken()); }  String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens())  tokenizer = new StringTokenizer(in.readLine());  return tokenizer.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);  A solver = new A();  solver.solve(1, in, out);  out.close(); } } class A { public void solve(int testNumber, InputReader in, PrintWriter out) {   int n = in.readInt();   int a = in.readInt();   int b = in.readInt();   int[] hs = new int[n];   for (int i=0;i<n;i++){    hs[i]=in.readInt();   }   Arrays.sort(hs);   out.println(hs[b]-hs[b-1]); } } class InputReader {  BufferedReader in;  public InputReader(InputStream stream) {   in = new BufferedReader(new InputStreamReader(stream));  }  public int skipSpace() {   int c;   try {    while (true) {     c = in.read();     if (c < 0) {      throw new InputMismatchException();     }     if (c > 32) {      break;     }    }   } catch (IOException e) {    throw new InputMismatchException();   }   return c;  }  public int readInt() {   int res = 0;   boolean sign = false;   int c = skipSpace();   try {    if (c == '-') {     sign = true;     c = in.read();    }    while (true) {     if (c >= '0' && c <= '9') {      res = res * 10 + c - '0';     } else {      throw new InputMismatchException();     }     c = in.read();     if (c <= 32) {      break;     }    }    if (sign) {     res = -res;    }    return res;   } catch (IOException e) {    throw new InputMismatchException();   }  }  }
6	public class Main {  void solve() {   int n=ni(),m=ni();   int a[][]=new int[n+1][m+1];   for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) a[i][j]=ni();   if(n==1){    int mn=Integer.MAX_VALUE;    for(int i=1;i<m;i++) mn=Math.min(mn,Math.abs(a[1][i]-a[1][i+1]));    pw.println(mn) ;    return ;   }   mn1=new int[n+1][n+1];   mn2=new int[n+1][n+1];   for(int i=1;i<=n;i++){    for(int j=1;j<=n;j++){     if(i==j) continue;     mn1[i][j]=mn2[i][j]=Integer.MAX_VALUE;     for(int k=1;k<=m;k++){      mn1[i][j]=Math.min(mn1[i][j],Math.abs(a[i][k]-a[j][k]));          }     for(int k=1;k<m;k++){      mn2[i][j]=Math.min(mn2[i][j],Math.abs(a[i][k+1]-a[j][k]));     }         }   }     dp=new int[17][1<<16][17];   for(int i=1;i<17;i++) for(int j=0;j<(1<<16);j++) Arrays.fill(dp[i][j],-1);   int ans=0;   for(int i=1;i<=n;i++){    ans=Math.max(ans,go(2,1<<(i-1),i,i,n));   }   pw.println(ans);  }  int mn1[][],mn2[][];  int dp[][][];  int go(int i,int mask,int prev,int first,int n){   if(i>n){      return mn2[first][prev];   }   if(dp[first][mask][prev]!=-1) return dp[first][mask][prev];   int cc=0;   for(int k=1;k<=n;k++){    if((mask&(1<<(k-1)))==0){     cc=Math.max(cc,Math.min(mn1[prev][k],go(i+1,mask|(1<<(k-1)),k,first,n)));        }   }   dp[first][mask][prev]=cc;   return cc;  }   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 Main().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(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); } }
6	public class Main {  static MyScanner scan;  static PrintWriter pw;  static long MOD = 1_000_000_007;  static long INF = 1_000_000_000_000_000_000L;  static long inf = 2_000_000_000;  public static void main(String[] args) {   new Thread(null, null, "BaZ", 1 << 27) {    public void run() {     try {      solve();     } catch (Exception e) {      e.printStackTrace();      System.exit(1);     }    }   }.start();  }  static int n,m,need,a[][],dp[][][],real[][];  static void solve() throws IOException  {     initIo(false);   StringBuilder sb = new StringBuilder();   int t = ni();   while(t-->0) {    n = ni();    m = ni();    a = new int[n][m];    for(int i=0;i<n;++i) {     for(int j=0;j<m;++j) {      a[i][j] = ni();     }    }    need = min(n,m);    Pair max_in_cols[] = new Pair[m];    for(int COL=0;COL<m;++COL) {     int max = 0;     for(int i=0;i<n;++i) {      max = max(max, a[i][COL]);     }     max_in_cols[COL] = new Pair(max, COL);    }    real = new int[n][need];    Arrays.sort(max_in_cols);    for(int i=0;i<need;++i) {     int COL = max_in_cols[m-1-i].y;     for(int j=0;j<n;++j) {      real[j][i] = a[j][COL];     }    }     dp = new int[need][n+1][(1<<n)];    for(int i=0;i<need;++i) {     for(int j=0;j<=n;++j) {      for(int k=0;k<(1<<n);++k) {       dp[i][j][k] = -1;      }     }    }    pl(f(0, n, 0));   }   pw.flush();   pw.close();  }  static int f(int idx, int bias, int mask) {     if(idx==need) {    return 0;   }   if(dp[idx][bias][mask]!=-1) {    return dp[idx][bias][mask];   }      if(bias==n) {    int max = 0;    for(int b=0;b<n;++b) {     max = max(max, f(idx, b, mask));    }       dp[idx][bias][mask] = max;    return max;   }   else {    int max = f(idx+1, n, mask);    for(int i=0;i<n;++i) {     if((mask&(1<<i))==0) {      max = max(max, real[(i-bias+n)%n][idx] + f(idx, bias, mask | (1<<i)));     }    }       dp[idx][bias][mask] = max;    return max;   }  }  static class Pair implements Comparable<Pair>  {   int x,y;   Pair(int x,int y)   {    this.x=x;    this.y=y;   }   public int compareTo(Pair other)   {    if(this.x!=other.x)     return this.x-other.x;    return this.y-other.y;   }   public String toString()   {    return "("+x+","+y+")";   }  }  static void initIo(boolean isFileIO) throws IOException {   scan = new MyScanner(isFileIO);   if(isFileIO) {    pw = new PrintWriter("/Users/amandeep/Desktop/output.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 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 class MyScanner  {   BufferedReader br;   StringTokenizer st;   MyScanner(boolean readingFromFile) throws IOException   {    if(readingFromFile) {     br = new BufferedReader(new FileReader("/Users/amandeep/Desktop/input.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());   }  } }
6	public class Solution {  private static StringTokenizer st; private static int n; private static int k;  private static boolean[][] graph; private static int[] dp; private static int maxCliqueSize;  public static void main(String[] args) throws Exception {  BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  st = new StringTokenizer(reader.readLine());  n = Integer.parseInt(st.nextToken());  k = Integer.parseInt(st.nextToken());  graph = new boolean[n][n];  dp = new int[1 << (n / 2)];  for (int i = 0; i < n; ++i) {  st = new StringTokenizer(reader.readLine());   for (int j = 0; j < n; ++j)   graph[i][j] = st.nextToken().equals("1");  }  reader.close();    int size1 = n / 2;  int border = 1 << size1;  for (int mask = 1; mask < border; ++mask) {     boolean isComplete = true;  for (int i = 0; i < size1; ++i) {   if (((mask >> i) & 1) == 0)   continue;   for (int j = i + 1; j < size1; ++j) {   if (((mask >> j) & 1) == 0)    continue;    if (!graph[i][j]) {    isComplete = false;    break;   }   }   if (!isComplete)   break;  }   if (isComplete)   dp[mask] = Integer.bitCount(mask);  }  for (int mask = 1; mask < border; ++mask) {  for (int i = 0; i < size1; ++i) {   if (((mask >> i) & 1) == 0) {   dp[mask | (1 << i)] = Math.max(dp[mask | (1 << i)], dp[mask]);   }  }  }    maxCliqueSize = 1;  int size2 = n - n /2;  border = (1 << size2);  for (int mask = 0; mask < border; ++mask) {   boolean isComplete = true;  for (int i = 0; i < size2; ++i) {   if (((mask >> i) & 1) == 0)   continue;   for (int j = i + 1; j < size2; ++j) {   if (((mask >> j) & 1) != 0 && !graph[i + size1][j + size1]) {    isComplete = false;    break;   }   }   if (!isComplete)   break;  }   if (!isComplete)   continue;   int mask1 = (1 << size1) - 1;   for (int i = 0; i < size2; ++i) {   if (((mask >> i) & 1) == 0)   continue;   for (int j = 0; j < size1; ++j) {   if (!graph[j][i + size1] && ((mask1 >> j) & 1) != 0)    mask1 ^= (1 << j);   }  }   maxCliqueSize = Math.max(maxCliqueSize, dp[mask1] + Integer.bitCount(mask));  }    double answer = (1.0 * k * k * (maxCliqueSize - 1) / (2 * maxCliqueSize));  System.out.printf("%.15f", answer); } }
3	public class Main {   static int mod = (int) (1e9+7);   static int MAX = (int)2e5+5;   static void solve()   {     int n = i();     String[] s = new String[n];     for(int i = 0 ; i<n ; i++)     {      s[i] = s();     }     int[][] dp = new int[n][n];     dp[0][0] = 1;     for(int i = 1; i<n; i++)     {      if(s[i-1].equals("f"))      {       for (int j = i-1 ; j>=0 ; j--)       {        dp[i][j+1] = dp[i-1][j];       }      }      else      {       int suff = 0;       for(int j = i-1; j>=0 ; j--)       {        suff += dp[i-1][j];        if(suff>=mod) suff-= mod;        dp[i][j] = suff;       }      }     }     int sum = 0;     for (int i=0 ; i<n; i++)     {      sum = sum+dp[n-1][i];      if(sum>=mod)       sum-=mod;     }     out.println(sum);     out.close();   }      static InputReader sc = new InputReader(System.in);   static PrintWriter out = new PrintWriter(System.out);   public static void main(String[] args)   {     new Thread(null,new Runnable() {     @Override     public void run() {      try{       solve();      }      catch(Exception e){       e.printStackTrace();      }     }     },"1",1<<26).start();   }   static class Pair implements Comparable<Pair>{     int x,y,i;     Pair (int x,int y,int i)     {       this.x = x;       this.y = y;       this.i = i;     }          Pair (int x,int y)     {       this.x = x;       this.y = y;     }       public int compareTo(Pair o)     {       return -(this.y-o.y);     }         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 + " "+i;     }       public int hashCode()     {       return new Long(x).hashCode() * 31 + new Long(y).hashCode();     }   }    static class Merge   {     public static void sort(int inputArr[])     {       int length = inputArr.length;       doMergeSort(inputArr,0, length - 1);     }     private static void doMergeSort(int[] 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(int[]array,int lowerIndex, int middle, int higherIndex)     {       int[] temp=new int[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 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){     a%=mod;     b%=mod;     long x=(a*b);     return x%mod;   }    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 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 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;   }    static long mulmod(long a,long b,long m) {     if (m <= 1000000009) return a * b % m;     long res = 0;     while (a > 0)     {       if ((a&1)!=0)       {         res += b;         if (res >= m) res -= m;       }       a >>= 1;       b <<= 1;       if (b >= m) b -= m;     }     return res;   }   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);   }   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 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();  } }
3	public class HelloWorld{   public static void main(String []args){   final long MOD = 1000000007;   Scanner scan = new Scanner(System.in);   int now = 1;   int maxStatements = scan.nextInt();   long[] dp = new long[maxStatements + 1];   dp[now] = 1;   while(maxStatements > 0)   {    String add = scan.next();    if (add.equals("f"))    {     now++;    }    else    {     for (int k = 1; k <= now; k++)     {      dp[k] = ((dp[k] + dp[k-1]) % MOD);     }    }    maxStatements--;   }   System.out.println(dp[now]);  } }
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 class HexadecimalTheorem {   public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  PrintWriter out = new PrintWriter(System.out);  out.printf("%d %d %d%n", 0, 0, n);  out.flush(); } }
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 CF1185G2 { static final int MD = 1000000007; static int[][] solve1(int[] aa, int t, int n) {  int[][] da = new int[t + 1][n + 1];  da[0][0] = 1;  for (int i = 0; i < n; i++) {  int a = aa[i];  for (int s = t - 1; s >= 0; s--)   for (int m = 0; m < n; m++) {   int x = da[s][m];   if (x != 0) {    int s_ = s + a;    if (s_ <= t)    da[s_][m + 1] = (da[s_][m + 1] + x) % MD;   }   }  }  return da; } static int[][][] solve2(int[] aa, int[] bb, int t, int na, int nb) {  int[][] da = solve1(aa, t, na);  int[][][] dab = new int[t + 1][na + 1][nb + 1];  for (int s = 0; s <= t; s++)  for (int ma = 0; ma <= na; ma++)   dab[s][ma][0] = da[s][ma];  for (int i = 0; i < nb; i++) {  int b = bb[i];  for (int s = t - 1; s >= 0; s--)   for (int ma = 0; ma <= na; ma++)   for (int mb = 0; mb < nb; mb++) {    int x = dab[s][ma][mb];    if (x != 0) {    int s_ = s + b;    if (s_ <= t)     dab[s_][ma][mb + 1] = (dab[s_][ma][mb + 1] + x) % MD;    }   }  }  return dab; } static long power(int a, int k) {  if (k == 0)  return 1;  long p = power(a, k / 2);  p = p * p % MD;  if (k % 2 == 1)  p = p * a % MD;  return p; } static int[] ff, gg; static int ch(int n, int k) {  return (int) ((long) ff[n] * gg[n - k] % MD * gg[k] % MD); } static int[][][] init(int n, int na, int nb, int nc) {  ff = new int[n + 1];  gg = new int[n + 1];  for (int i = 0, f = 1; i <= n; i++) {  ff[i] = f;  gg[i] = (int) power(f, MD - 2);  f = (int) ((long) f * (i + 1) % MD);  }  int[][][] dp = new int[na + 1][nb + 1][nc + 1];  for (int ma = 0; ma <= na; ma++)  for (int mb = 0; mb <= nb; mb++)   for (int mc = 0; mc <= nc; mc++) {   int x = (int) ((long) ff[ma + mb + mc] * gg[ma] % MD * gg[mb] % MD * gg[mc] % MD);   for (int ma_ = ma == 0 ? 0 : 1; ma_ <= ma; ma_++) {    int cha = ma == 0 ? 1 : ch(ma - 1, ma_ - 1);    for (int mb_ = mb == 0 ? 0 : 1; mb_ <= mb; mb_++) {    int chb = mb == 0 ? 1 : ch(mb - 1, mb_ - 1);    for (int mc_ = mc == 0 ? 0 : 1; mc_ <= mc; mc_++) {     int chc = mc == 0 ? 1 : ch(mc - 1, mc_ - 1);     int y = dp[ma_][mb_][mc_];     if (y == 0)     continue;     x = (int) ((x - (long) y * cha % MD * chb % MD * chc) % MD);    }    }   }   if (x < 0)    x += MD;   dp[ma][mb][mc] = x;   }  for (int ma = 0; ma <= na; ma++)  for (int mb = 0; mb <= nb; mb++)   for (int mc = 0; mc <= nc; mc++)   dp[ma][mb][mc] = (int) ((long) dp[ma][mb][mc] * ff[ma] % MD * ff[mb] % MD * ff[mc] % MD);  return dp; } 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 t = Integer.parseInt(st.nextToken());  int[] aa = new int[n];  int[] bb = new int[n];  int[] cc = new int[n];  int na = 0, nb = 0, nc = 0;  for (int i = 0; i < n; i++) {  st = new StringTokenizer(br.readLine());  int a = Integer.parseInt(st.nextToken());  int g = Integer.parseInt(st.nextToken());  if (g == 1)   aa[na++] = a;  else if (g == 2)   bb[nb++] = a;  else   cc[nc++] = a;  }  int[][][] dp = init(n, na, nb, nc);  int[][][] dab = solve2(aa, bb, t, na, nb);  int[][] dc = solve1(cc, t, nc);  int ans = 0;  for (int tab = 0; tab <= t; tab++) {  int tc = t - tab;  for (int ma = 0; ma <= na; ma++)   for (int mb = 0; mb <= nb; mb++) {   int xab = dab[tab][ma][mb];   if (xab == 0)    continue;   for (int mc = 0; mc <= nc; mc++) {    int xc = dc[tc][mc];    if (xc == 0)    continue;    ans = (int) ((ans + (long) xab * xc * dp[ma][mb][mc]) % MD);   }   }  }  System.out.println(ans); } }
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(); } }
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 Subtraction {  static long c=0;  public static void main(String[] args) throws IOException {   BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));   int n=Integer.parseInt(reader.readLine());   while (n-->0){    String l=reader.readLine();    String[] a=l.split(" ");    long A=Long.parseLong(a[0]);    long B=Long.parseLong(a[1]);    c=0;    gcd(A,B);    System.out.println(c);   }  }  private static void gcd(long a, long b) {   if (b==0)    return ;   c=c+a/b;   gcd(b,a%b);  } }
2	public class B { public static void main(String [] args) throws IOException {  Scanner in = new Scanner(System.in);  long n = in.nextLong();  long k = in.nextLong();  if(n == 1)  {  System.out.println(0);  return;  }  if(n <= k)  {  System.out.println(1);  return;  }  long lb = 2, ub = k;  long sum = ((k)*(k-1))/2;  if(sum+1 < n)  {  System.out.println(-1);  return;  }  while(ub - lb > 1)  {  long mid = (lb+ub)/2;  long s = ((mid-1)*(mid-2))/2;  if(n - (sum-s+1) < 0)   lb = mid;  else   ub = mid;  }  long rem = n - (sum - ((ub-1)*(ub-2))/2 + 1);  long res = k - ub + 1;  if(rem == 0)  {  System.out.println(res);  return;  }  rem++;  if(!(rem >= 2 && rem < ub))  {  System.out.println(-1);  return;  }  System.out.println(res+1);  } }
4	public class Main{   static class FastReader {   BufferedReader br;   StringTokenizer st;   public FastReader() {   boolean env=System.getProperty("ONLINE_JUDGE") != null;      if(!env) {    try {   br=new BufferedReader(new FileReader("src\\input.txt"));   } catch (FileNotFoundException e) {   e.printStackTrace();   }   }   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());   }   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 long MOD=(long)1e9+7;   static void debug(Object... o) {   System.out.println(Arrays.deepToString(o));  }  static FastReader sc=new FastReader();  static PrintWriter out=new PrintWriter(System.out);    static int code(int x,int y) {  return 505*x+y;  }  static class pair{  int x,y;  pair(int a,int b){   this.x=a;   this.y=b;  }  public boolean equals(Object obj) {   if(obj == null || obj.getClass()!= this.getClass()) return false;    pair p = (pair) obj;    return (this.x==p.x && this.y==p.y);   }  public int hashCode() {    return Objects.hash(x,y);   }  }  static int hor[][],ver[][];  static int moves[][]= {{-1,0},{1,0},{0,-1},{0,1}};  static int n,m;  static int dp[][][];  static int solve(int x,int y,int k) {  if(k==0) {   return 0;  }  if(dp[x][y][k]!=0) return dp[x][y][k];  int min=(int)MOD;  for(int mo[]: moves) {  int X=x+mo[0],Y=y+mo[1];  if(X<0 || X>=n || Y<0 || Y>=m) continue;  int val=0;  if(mo[0]==1) val=ver[x][y];  else if(mo[0]==-1) val=ver[x-1][y];  else if(mo[1]==1) val=hor[x][y];  else val=hor[x][y-1];  min=Math.min(min, 2*val+solve(X,Y,k-2));  }  return dp[x][y][k]=min;  }   public static void main (String[] args) throws java.lang.Exception {  int test=1;    while(test-->0) {   n=sc.nextInt();m=sc.nextInt();   int k=sc.nextInt();   if(k%2!=0) {   for(int i=0;i<n;i++) {    for(int j=0;j<m;j++) out.print(-1+" ");    out.println();   }   continue;   }   hor=new int[n][m-1];   ver=new int[n-1][m];   for(int i=0;i<n;i++) {   for(int j=0;j<m-1;j++) {    hor[i][j]=sc.nextInt();   }   }   for(int i=0;i<n-1;i++) {   for(int j=0;j<m;j++) {    ver[i][j]=sc.nextInt();   }   }   dp=new int[n][m][k+1];   for(int i=0;i<n;i++) {   for(int j=0;j<m;j++) {    out.print(solve(i,j,k)+" ");   }   out.println();   }     }   out.flush();   out.close();  } }
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();   if (n==1&&arr[0]==1) {    System.out.println(2);    return;   }    Arrays.sort(arr);   if (arr[n-1]==1)    arr[n-2] = 2;   buf.append(1);   for (int i=0;i<n-1;i++)    buf.append(' ').append(arr[i]);   buf.append('\n');   System.out.print(buf);  }  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));  } }
2	public class Main2 {  static int mod = 1000000007;  static FastScanner scanner;  public static void main(String[] args) {   scanner = new FastScanner();   long n = scanner.nextInt();   long k = scanner.nextInt();   if (sum(n) == k) {    System.out.println(0);    return;   }   long s = 0;   long e = n + 1;   while (s < e - 1) {    long m = (s + e) / 2;    long put = sum(n - m);    long candiesLeft = put - m;    if (candiesLeft == k) {     System.out.println(m);     return;    }    if (candiesLeft > k) {     s = m;    } else {     e = m;    }   }  }  static long sum(long n) {   long last = 1 + n - 1;   return ((1 + last) * n) / 2;  }  static class WithIdx {   int val, idx;   public WithIdx(int val, int idx) {    this.val = val;    this.idx = idx;   }  }  public static class FastScanner {   BufferedReader br;   StringTokenizer st;   public FastScanner() {    br = new BufferedReader(new InputStreamReader(System.in));   }   String nextToken() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {           e.printStackTrace();     }    }    return st.nextToken();   }   String nextLine() {    try {     return br.readLine();    } catch (Exception e) {     e.printStackTrace();     throw new RuntimeException();    }   }   int nextInt() {    return Integer.parseInt(nextToken());   }   long nextLong() {    return Long.parseLong(nextToken());   }   double nextDouble() {    return Double.parseDouble(nextToken());   }   int[] nextIntArray(int n) {    int[] res = new int[n];    for (int i = 0; i < n; i++) res[i] = nextInt();    return res;   }   long[] nextLongArray(int n) {    long[] res = new long[n];    for (int i = 0; i < n; i++) res[i] = nextLong();    return res;   }   String[] nextStringArray(int n) {    String[] res = new String[n];    for (int i = 0; i < n; i++) res[i] = nextToken();    return res;   }  }  static class PrefixSums {   long[] sums;   public PrefixSums(long[] sums) {    this.sums = sums;   }   public long sum(int fromInclusive, int toExclusive) {    if (fromInclusive > toExclusive) throw new IllegalArgumentException("Wrong value");    return sums[toExclusive] - sums[fromInclusive];   }   public static PrefixSums of(int[] ar) {    long[] sums = new long[ar.length + 1];    for (int i = 1; i <= ar.length; i++) {     sums[i] = sums[i - 1] + ar[i - 1];    }    return new PrefixSums(sums);   }   public static PrefixSums of(long[] ar) {    long[] sums = new long[ar.length + 1];    for (int i = 1; i <= ar.length; i++) {     sums[i] = sums[i - 1] + ar[i - 1];    }    return new PrefixSums(sums);   }  }  static class ADUtils {   static void sort(int[] ar) {    Random rnd = ThreadLocalRandom.current();    for (int i = ar.length - 1; i > 0; i--)    {     int index = rnd.nextInt(i + 1);         int a = ar[index];     ar[index] = ar[i];     ar[i] = a;    }    Arrays.sort(ar);   }   static void reverse(int[] arr) {    int last = arr.length / 2;    for (int i = 0; i < last; i++) {     int tmp = arr[i];     arr[i] = arr[arr.length - 1 - i];     arr[arr.length - 1 - i] = tmp;    }   }   static void sort(long[] ar) {    Random rnd = ThreadLocalRandom.current();    for (int i = ar.length - 1; i > 0; i--)    {     int index = rnd.nextInt(i + 1);         long a = ar[index];     ar[index] = ar[i];     ar[i] = a;    }    Arrays.sort(ar);   }  }  static class MathUtils {   static long[] FIRST_PRIMES = {     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, 1009, 1013,     1019, 1021, 1031, 1033, 1039, 1049, 1051};   static long[] primes(int to) {    long[] all = new long[to + 1];    long[] primes = new long[to + 1];    all[1] = 1;    int primesLength = 0;    for (int i = 2; i <= to; i ++) {     if (all[i] == 0) {      primes[primesLength++] = i;      all[i] = i;     }     for (int j = 0; j < primesLength && i * primes[j] <= to && all[i] >= primes[j]; j++) {      all[(int) (i * primes[j])] = primes[j];     }    }    return Arrays.copyOf(primes, primesLength);   }   static long modpow(long b, long e, long m) {    long result = 1;    while (e > 0) {     if ((e & 1) == 1) {           result = (result * b) % m;     }     b = (b * b) % m;     e >>= 1;    }    return result;   }   static long submod(long x, long y, long m) {    return (x - y + m) % m;   }  } }
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");  }  } }
6	public class Main {  static FastScanner fs=new FastScanner();  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();   }   int Int() {    return Integer.parseInt(next());   }   long Long() {    return Long.parseLong(next());   }   String Str(){    return next();   }  }   public static void main (String[] args) throws java.lang.Exception {   PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   int T=1;   for(int t=0;t<T;t++){    int n=Int();    int k=Int();    int A[][]=new int[n][2];    for(int i=0;i<A.length;i++){     A[i][0]=Int();     A[i][1]=Int()-1;    }    Arrays.sort(A,(a,b)->{     return a[1]-b[1];    });    Solution sol=new Solution(out);    sol.solution(A,k);   }   out.close();  }   public static int Int(){   return fs.Int();  }  public static long Long(){   return fs.Long();  }  public static String Str(){   return fs.Str();  } }    class Solution{  PrintWriter out;  public Solution(PrintWriter out){   this.out=out;  }   int mod=1000000007;  long dp3[][][][];  public void solution(int A[][],int T){   long res=0;   int n=A.length;   long dp1[][]=new long[n+1][T+1];   long dp2[][][]=new long[n+1][n+1][T+1];   dp3=new long[n+1][n+1][n+1][3];      long f[]=new long[n+1];   f[0]=f[1]=1;   for(int i=2;i<f.length;i++){    f[i]=f[i-1]*i;    f[i]%=mod;   }   for(int i=0;i<dp3.length;i++){    for(int j=0;j<dp3[0].length;j++){     for(int k=0;k<dp3[0][0].length;k++){      Arrays.fill(dp3[i][j][k],-1);     }    }   }    dp1[0][0]=1;   for(int i=0;i<A.length;i++){    int p=A[i][0],type=A[i][1];    if(type==0){     long newdp[][]=new long[dp1.length][dp1[0].length];     for(int cnt=1;cnt<=n;cnt++){      for(int j=1;j<dp1[0].length;j++){       if(j>=p){        newdp[cnt][j]+=dp1[cnt-1][j-p];        newdp[cnt][j]%=mod;       }      }     }     for(int cnt=0;cnt<=n;cnt++){      for(int j=0;j<dp1[0].length;j++){       newdp[cnt][j]+=dp1[cnt][j];       newdp[cnt][j]%=mod;      }     }     dp1=newdp;    }    else{     break;    }   }     dp2[0][0][0]=1;   for(int i=0;i<A.length;i++){    int p=A[i][0],type=A[i][1];    if(type!=0){     long newdp[][][]=new long[dp2.length][dp2[0].length][dp2[0][0].length];     for(int a=0;a<dp2.length;a++){      for(int b=0;b<dp2[0].length;b++){       for(int j=0;j<dp2[0][0].length;j++){        if(j>=p){         if(type==1){          if(a-1>=0){           newdp[a][b][j]+=dp2[a-1][b][j-p];          }         }         else{          if(b-1>=0) {           newdp[a][b][j]+=dp2[a][b-1][j-p];          }         }        }        newdp[a][b][j]%=mod;       }      }     }     for(int a=0;a<dp2.length;a++){      for(int b=0;b<dp2[0].length;b++){       for(int j=0;j<dp2[0][0].length;j++){        newdp[a][b][j]+=dp2[a][b][j];        newdp[a][b][j]%=mod;       }      }     }     dp2=newdp;    }   }    dp3[1][0][0][0]=1;   dp3[0][1][0][1]=1;   dp3[0][0][1][2]=1;   dfs(n,n,n,0);dfs(n,n,n,1);dfs(n,n,n,2);       for(int i=0;i<dp3.length;i++){    for(int j=0;j<dp3[0].length;j++){     for(int k=0;k<dp3[0][0].length;k++){      for(int cur=0;cur<3;cur++){       for(int t=0;t<=T;t++){        int aprice=t;        int bcprice=T-t;        long cnt1=dp1[i][aprice];        long cnt2=dp2[j][k][bcprice];        long combination=dp3[i][j][k][cur];        long p1=(cnt1*f[i])%mod;        long p2=(((f[j]*f[k])%mod)*cnt2)%mod;        long p3=(p1*p2)%mod;        res+=(p3*combination)%mod;        res%=mod;       }      }     }    }   }       out.println(res);  }  public long dfs(int a,int b,int c,int cur){   if(a<0||b<0||c<0){    return 0;   }   if(a==0&&b==0&&c==0){    return 0;   }   if(dp3[a][b][c][cur]!=-1)return dp3[a][b][c][cur];   long res=0;   if(cur==0){    res+=dfs(a-1,b,c,1);    res%=mod;    res+=dfs(a-1,b,c,2);    res%=mod;   }   else if(cur==1){    res+=dfs(a,b-1,c,0);    res%=mod;    res+=dfs(a,b-1,c,2);    res%=mod;   }   else{    res+=dfs(a,b,c-1,0);    res%=mod;    res+=dfs(a,b,c-1,1);    res%=mod;   }   res%=mod;   dp3[a][b][c][cur]=res;   return res;  } }
2	public class Solution {   private static final long MODULUS = 1000000007;  private static final boolean DEBUG = false;  private static long modularPow(long base, long exponent, long modulus) {   long result = 1;   while (exponent > 0) {    if (exponent % 2 == 1) {     result = (result * base) % modulus;    }    exponent >>= 1;    base = (base * base) % modulus;   }   return result;  }  public static void main(String[] args) throws FileNotFoundException {   long beginTime = System.nanoTime();   InputStream is = DEBUG ? new FileInputStream("resources/codeforcesedu43/ProblemC-1.in") : System.in;   try (Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(is)))) {    long x = scanner.nextLong();    long k = scanner.nextLong();    if (x != 0) {     x = (2 * x - 1) % MODULUS;     long twoPowK = modularPow(2, k, MODULUS);     x = (x * twoPowK + 1) % MODULUS;    }    System.out.println(x % 1000000007);   }   System.err.println( "Done in " + ((System.nanoTime() - beginTime) / 1e9) + " seconds.");  } }
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);  } }
2	public class Codechef { public static void main (String[] args) throws java.lang.Exception {   Scanner in=new Scanner(System.in);  long x=in.nextLong();  long k=in.nextLong();   long mod=1000000007;  long get=power(2,k,mod);  long ans=((get%mod)*((2*x)%mod))%mod-get+1;  if(ans<0)  ans+=mod;  if(x==0)  ans=0;  System.out.println(ans);   } static long power(long x, long y, long p)  {     long res = 1;            x = x % p;     while (y > 0)   {           if((y & 1)==1)     res = (res * x) % p;             y = y >> 1;    x = (x * x) % p;   }   return res;  } }
3	public class Solve6 {  public static void main(String[] args) throws IOException {   PrintWriter pw = new PrintWriter(System.out);   new Solve6().solve(pw);   pw.flush();   pw.close();  }  public void solve(PrintWriter pw) throws IOException {   FastReader sc = new FastReader();   int n = sc.nextInt();   int[] a = new int[n + 1];   for (int i = 1; i <= n; i++) {    a[i] = sc.nextInt();   }   HashMap<Integer, LinkedList<Pair<Integer, Integer>>> h = new HashMap();   for (int i = 1; i <= n; i++) {    int s = 0;    for (int j = i; j >= 1; j--) {     s += a[j];     LinkedList<Pair<Integer, Integer>> l;     if (!h.containsKey(s)) {      l = new LinkedList();     } else {      l = h.get(s);     }     l.add(new Pair(j, i));     h.put(s, l);    }   }   LinkedList<Pair<Integer, Integer>>[] l = new LinkedList[h.size() + 1];   for (int i = 1; i <= h.size(); i++) {    l[i] = new LinkedList();   }   int k = 0, max = 0, index = 0;   for (LinkedList<Pair<Integer, Integer>> temp : h.values()) {    k++;    int i = 0, size = 0;    for (Pair<Integer, Integer> pair : temp) {     if (pair.getKey() > i) {      i = pair.getValue();      l[k].add(pair);      size++;      if (size > max) {       max = size;       index = k;      }     }    }   }   pw.println(l[index].size());   for (Pair<Integer, Integer> pair : l[index]) {    pw.println(pair.getKey() + " " + pair.getValue());   }  }  static class FastReader {   StringTokenizer st;   BufferedReader br;   public FastReader() {    br = new BufferedReader(new InputStreamReader(System.in));   }   public boolean hasNext() throws IOException {    String s = br.readLine();    if (s == null || s.isEmpty()) {     return false;    }    st = new StringTokenizer(s);    return true;   }   public String next() throws IOException {    if (st == null || !st.hasMoreTokens()) {     String s = br.readLine();     if (s.isEmpty()) {      return null;     }     st = new StringTokenizer(s);    }    return st.nextToken();   }   public int nextInt() throws IOException {    return Integer.parseInt(next());   }   public double nextDouble() throws IOException {    return Double.parseDouble(next());   }   public long nextLong() throws IOException {    return Long.parseLong(next());   }   public String nextLine() throws IOException {    return br.readLine();   }  } }
2	public class B_574 {  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   String[] input = br.readLine().split(" ");   int N = Integer.valueOf(input[0]);   int K = Integer.valueOf(input[1]);   long sum = 0;   for(int i = 0; i < N; i++){    if(sum - (N - i) == K){     System.out.println(Integer.valueOf(N-i));     return;    }    sum += (i+1);   }   System.out.println("0");  } }
5	public class Houses implements Runnable {  private void solve() throws IOException {   int n = nextInt();   int t = nextInt();   int[] x = new int[n];   int[] a = new int[n];   for (int i = 0; i < n; ++i) {    x[i] = nextInt() * 2;    a[i] = nextInt();   }   Set<Integer> res = new HashSet<Integer>();   for (int i = 0; i < n; ++i) {    if (valid(n, t, x, a, x[i] + a[i] + t))     res.add(x[i] + a[i] + t);    if (valid(n, t, x, a, x[i] - a[i] - t))     res.add(x[i] - a[i] - t);   }   writer.println(res.size());  }  private boolean valid(int n, int t, int[] x, int[] a, int pos) {   for (int i = 0; i < n; ++i) {    if (Math.abs(pos - x[i]) < a[i] + t)     return false;   }   return true;  }  public static void main(String[] args) {   new Houses().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 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();  } }
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 C35 {  public static int mod = 1000000007; public static long INF = (1L << 60);  static int n,m; static class Pair {  int x,y;  Pair(int x,int y)  {  this.x=x;  this.y=y;  }  @Override  public int hashCode()  {  final int prime = 31;  int result = 1;  result = prime * result + x;  result = prime * result + y;  return result;  }  @Override  public boolean equals(Object obj)  {  if (this == obj)   return true;  if (obj == null)   return false;  if (getClass() != obj.getClass())   return false;  Pair other = (Pair) obj;  if (x != other.x)   return false;  if (y != other.y)   return false;  return true;  } } static boolean[][] burned; static int[] dx={-1,0,1,0}; static int[] dy={0,-1,0,1}; static boolean isvalid(int x,int y) {  return x>=0&&x<n&&y>=0&&y<m; } public static void main(String[] args) throws IOException {  Scanner in = new Scanner("input.txt");  PrintWriter out = new PrintWriter(new FileWriter("output.txt"));  n=in.nextInt();  m=in.nextInt();  burned=new boolean[n][m];  int k=in.nextInt();  Set<Pair> set=new HashSet<Pair>();  Pair prev=null;  for(int i=0;i<k;i++)  {  int x=in.nextInt();  int y=in.nextInt();  burned[x-1][y-1]=true;  set.add(prev=new Pair(x-1, y-1));  }  while(!set.isEmpty())  {  Set<Pair> tempset=new HashSet<>();  for(Pair p : set)  {  int x=p.x;  int y=p.y;  prev=p;  for(int i=0;i<4;i++)  {   if(isvalid(x+dx[i], y+dy[i])&&!burned[x+dx[i]][y+dy[i]])   {   tempset.add(new Pair(x+dx[i], y+dy[i]));   burned[x+dx[i]][y+dy[i]]=true;   }  }  }  set=tempset;  }  out.printf("%d %d\n",(prev.x+1),(prev.y+1));  out.close();  }  public static long pow(long x, long n)  {  long res = 1;  for (long p = x; n > 0; n >>= 1, p = (p * p))  {  if ((n & 1) != 0)   {   res = (res * p);  }  }  return res; }  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 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();}  } }
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();   }  } }
4	public class C35 {  public static void main(String[] args) throws IOException {   Scanner in = new Scanner(new File("input.txt"));   PrintWriter out = new PrintWriter("output.txt");   int n = in.nextInt() , m = in.nextInt();   int k = in.nextInt();   int[] x = new int[k];   int[] y = new int[k];   int res = 0;   for (int i = 0 ; i < k ; i++) {    x[i] = in.nextInt();    y[i] = in.nextInt();   }   int xx = 1 , yy = 1;   for (int i = 1 ; i <= n ; i++)    for (int j = 1 ; j <= m ; j++) {     int cnt = Integer.MAX_VALUE;     for (int l = 0 ; l < k ; l++) {      int time = Math.abs(i - x[l]) + Math.abs(j - y[l]);      cnt = Math.min(cnt , time);     }     if (cnt > res) {      res = cnt;      xx = i;      yy = j;     }     res = Math.max(res , cnt);    }   out.print(xx + " " + yy);   out.close();  } }
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;  } }
4	public class D {  static boolean isValid(int n, int m, int i, int j){   return 0<=i && i<n && 0<=j && j<m;  }  public static void main(String[] args) throws IOException {   Soumit sc = new Soumit();   int n = sc.nextInt();   int m = sc.nextInt();   int k = sc.nextInt();   StringBuilder sb = new StringBuilder();   if(k%2==1){    for(int i=0;i<n;i++){     for(int j=0;j<m;j++){      sb.append("-1 ");     }     sb.append("\n");    }    System.out.println(sb);    System.exit(0);   }   k/=2;   long[][] horizontaledge = new long[n][m-1];   long[][] verticaledge = new long[n-1][m];   for(int i=0;i<n;i++)    horizontaledge[i] = sc.nextLongArray(m-1);   for(int i=0;i<n-1;i++)    verticaledge[i] = sc.nextLongArray(m);   long[][][] dp = new long[11][n][m];   for(int i=0;i<n;i++){    for(int j=0;j<m;j++){     dp[0][i][j] = 0;    }   }   for(int i=1;i<=k;i++){    for(int j1=0;j1<n;j1++){     for(int j2=0;j2<m;j2++){      long min = Long.MAX_VALUE/2000;           if(isValid(n, m, j1-1, j2)){       min = Math.min(dp[i-1][j1-1][j2]+verticaledge[j1-1][j2], min);      }            if(isValid(n, m, j1+1, j2)){       min = Math.min(min, dp[i-1][j1+1][j2]+verticaledge[j1][j2]);      }            if(isValid(n, m, j1, j2-1)){       min = Math.min(min, dp[i-1][j1][j2-1]+horizontaledge[j1][j2-1]);      }            if(isValid(n, m, j1, j2+1)){       min = Math.min(min, dp[i-1][j1][j2+1]+horizontaledge[j1][j2]);      }      dp[i][j1][j2] = min;     }    }   }   for(int i=0;i<n;i++){    for(int j=0;j<m;j++){     sb.append(dp[k][i][j]*2).append(" ");    }    sb.append("\n");   }   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();   }  } }
1	public class Main {  static Reader scan;  static PrintWriter pw;  static int n,k,left[],right[],arr[];  static long MOD = 1000000007,count[],dp[];  public static void main(String[] args) {   new Thread(null,null,"BaZ",1<<25)   {    public void run()    {     try     {      solve();     }     catch(Exception e)     {      e.printStackTrace();      System.exit(1);     }    }   }.start();  }  static void solve() throws IOException  {   scan = new Reader();   pw = new PrintWriter(System.out,true);   StringBuilder sb = new StringBuilder();   n = ni();   k = ni();   int stack[] = new int[1000001];   int top = -1;   arr = new int[n];   left = new int[n];   right = new int[n];   for(int i=0;i<n;++i) {    arr[i] = ni();    while(top>=0 && arr[stack[top]]<=arr[i])     top--;    if(top==-1)     left[i] = 0;    else left[i] = stack[top]+1;    stack[++top] = i;   }   top = -1;   for(int i=n-1;i>=0;--i) {    while(top>=0 && arr[stack[top]]<arr[i])     top--;    if(top==-1)     right[i] = n-1;    else right[i] = stack[top]-1;    stack[++top] = i;   }        dp = new long[n+1];   for(int i=0;i<=n;++i) {    if(i<k)    continue;    dp[i] = dp[i-k+1] + (i-k+1);   }   count = new long[n];   long ans = 0;   for(int i=0;i<n;++i) {    int len = right[i]-left[i]+1;    int lef = i-left[i];    int rig = right[i]-i;    long count = dp[len] - dp[lef] - dp[rig];    if(count>=MOD)    count%=MOD;    ans += count*arr[i];    if(ans>=MOD)     ans%=MOD;   }   pl(ans);   pw.flush();   pw.close();  }  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()  {   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 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 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();   }  } }
2	public class C {  public static void main(String[] args) throws IOException {   init(System.in);   BigInteger x = new BigInteger(next());   if (x.compareTo(BigInteger.ZERO) == 0) {    System.out.println(0);    return;   }   BigInteger k = new BigInteger(next());   BigInteger mod = new BigInteger("1000000007");   BigInteger two = BigInteger.ONE.add(BigInteger.ONE);   BigInteger ans = two.modPow(k, mod);   ans = ans.multiply(two.multiply(x).subtract(BigInteger.ONE)).add(BigInteger.ONE).mod(mod);   System.out.println(ans);  }    private static BufferedReader reader;  private static StringTokenizer tokenizer;  private static void init(InputStream inputStream) {   reader = new BufferedReader(new InputStreamReader(inputStream));   tokenizer = new StringTokenizer("");  }  private 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();  }         }
5	public class D { FastScanner in; PrintWriter out; boolean systemIO = true;    public void solve() {  int n = in.nextInt();  HashMap<Long, Integer> map = new HashMap();  BigInteger sum = BigInteger.ZERO;  BigInteger ans = BigInteger.valueOf(0);  for (int i = 0; i < n; i++) {  long x = in.nextLong();  ans = ans.add(BigInteger.valueOf(i * x));  if (map.containsKey(x + 1)) {   ans = ans.add(BigInteger.valueOf(map.get(x + 1)));  }  if (map.containsKey(x - 1)) {   ans = ans.subtract(BigInteger.valueOf(map.get(x - 1)));  }  if (map.containsKey(x)) {   map.put(x, map.get(x) + 1);  } else {   map.put(x, 1);  }  ans = ans.subtract(sum);  sum = sum.add(BigInteger.valueOf(x));  }  out.print(ans.toString()); }  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(); } }
0	public class ChessKing {    public static void main(String[] args) { Scanner input = new Scanner(System.in); long size = input.nextLong(); long a = input.nextLong(); long b = input.nextLong(); long sum = a+b;  long d = sum-2;  long d1 = size*2 - sum; if(d<d1) System.out.println("White"); else if(d>d1) System.out.println("Black"); else System.out.println("White");   }  }
1	public class Round364C { public static void main(String[] args) throws NumberFormatException, IOException {  Scanner sc = new Scanner(System.in);  n = sc.nextInt();  k = 0;   String line = sc.nextLine();   ArrayList<Character> poks = new ArrayList<Character>();  boolean ex[] = new boolean[256];   for(int i=0; i<n; i++)  {  if(!ex[line.charAt(i)])  {   ex[line.charAt(i)] = true;   poks.add(line.charAt(i));  }  }     int l = 0;  int r = 0;  int dist = 1;  int occ[] = new int[256];  occ[line.charAt(0)] = 1;   int min = n;  while(r < n)  {  if(dist == poks.size())   min = Math.min(min, r - l + 1);  if(l < r && dist == poks.size())  {     occ[line.charAt(l)]--;   if(occ[line.charAt(l)] == 0)   dist--;   l++;   continue;  }  if(r < n-1){   occ[line.charAt(r+1)]++;   if(occ[line.charAt(r+1)] == 1)   dist++;  }  r++;  }  System.out.println(min);   }  static int n,k; static int dp[][][];  static class Scanner {  BufferedReader br;  StringTokenizer st;  Scanner(FileReader f) {  br = new BufferedReader(f);  }  public boolean ready() throws IOException {  return br.ready();  }  Scanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s));  }  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 NumberFormatException, IOException {  return Integer.parseInt(next());  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  } } }
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());  } } }
2	public class C { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int[][] M = {   {2, mod-1},   {0, 1}  };  long n = nl();  if(n == 0){  out.println(0);  return;  }   n = n*2%mod;  long K = nl();  int[] v = new int[]{(int)n, 1};  out.println(pow(M, v, K)[0]); }   public static final int mod = 1000000007; public static final long m2 = (long)mod*mod; public static final long BIG = 8L*m2;   public static int[] pow(int[][] A, int[] v, long e) {  for(int i = 0;i < v.length;i++){  if(v[i] >= mod)v[i] %= mod;  }  int[][] MUL = A;  for(;e > 0;e>>>=1) {  if((e&1)==1)v = mul(MUL, v);  MUL = p2(MUL);  }  return v; }   public static int[] mul(int[][] A, int[] v) {  int m = A.length;  int n = v.length;  int[] w = new int[m];  for(int i = 0;i < m;i++){  long sum = 0;  for(int k = 0;k < n;k++){   sum += (long)A[i][k] * v[k];   if(sum >= BIG)sum -= BIG;  }  w[i] = (int)(sum % mod);  }  return w; }   public static int[][] p2(int[][] A) {  int n = A.length;  int[][] C = new int[n][n];  for(int i = 0;i < n;i++){  long[] sum = new long[n];  for(int k = 0;k < n;k++){   for(int j = 0;j < n;j++){   sum[j] += (long)A[i][k] * A[k][j];   if(sum[j] >= BIG)sum[j] -= BIG;   }  }  for(int j = 0;j < n;j++){   C[i][j] = (int)(sum[j] % mod);  }  }  return C; }   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)); } }
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 A {  Scanner scan = new Scanner(System.in);   void solve() {  int n = scan.nextInt();  String[]A = new String[n];  String[]B = new String[n];  int res =0;  for(int i=0;i<n;i++)A[i]=scan.next();  for(int i=0;i<n;i++)B[i]=scan.next();  for(int i=0;i<A.length;i++) {  boolean fnd = false;  for(int j=0;j<B.length;j++) {   if(A[i].equals(B[j])) {   fnd = true;   B[j]="";   break;   }  }  if(!fnd)res++;  }  System.out.println(res); }  public static void main(String[] args) {  new A().solve(); } }
0	public class Solution {  Scanner in = new Scanner(System.in);  void run() throws Exception {   int tests = in.nextInt();   while (tests > 0) {    --tests;    int a = in.nextInt();    int b = in.nextInt();    int res = 0;    while (a > 0 && b > 0) {     if (a >= b) {      res += a / b;      a %= b;     }     else {      res += b / a;      b %= a;     }    }    System.out.println(res);   }  }  public static void main(String args[]) throws Exception {   new Solution().run();  } }
6	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);   FElongatedMatrix solver = new FElongatedMatrix();   solver.solve(1, in, out);   out.close();  }  static class FElongatedMatrix {   int n;   int m;   int[][] arr;   int[][] memo;   int[][][] memo2;   int first;   public void readInput(Scanner sc) {    n = sc.nextInt();    m = sc.nextInt();    arr = new int[n][m];    for (int i = 0; i < n; i++)     for (int j = 0; j < m; j++)      arr[i][j] = sc.nextInt();   }   public void solve(int testNumber, Scanner sc, PrintWriter pw) {    int tc = 1;    while (tc-- > 0) {     readInput(sc);     int max = 0;     memo2 = new int[2][n][n];     for (int[][] x : memo2)      for (int[] y : x)       Arrays.fill(y, -1);     for (int i = 0; i < n; i++) {      memo = new int[n][1 << n];      for (int[] y : memo)       Arrays.fill(y, -1);      first = i;      max = Math.max(max, dp(1 << i, i));     }     pw.println(max);    }   }   private int dp(int msk, int prev) {    if (msk == (1 << n) - 1)     return getLast(first, prev);    if (memo[prev][msk] != -1)     return memo[prev][msk];    int max = 0;    for (int i = 0; i < n; i++) {     if ((msk & 1 << i) == 0)      max = Math.max(max, Math.min(getDiff(prev, i), dp(msk | 1 << i, i)));    }    return memo[prev][msk] = max;   }   private int getLast(int i, int j) {    if (memo2[0][i][j] != -1)     return memo2[0][i][j];    int min = Integer.MAX_VALUE;    for (int k = 0; k < m - 1; k++)     min = Math.min(min, Math.abs(arr[i][k] - arr[j][k + 1]));    return memo2[0][i][j] = min;   }   private int getDiff(int i, int j) {    if (memo2[1][i][j] != -1)     return memo2[1][i][j];    int min = Integer.MAX_VALUE;    for (int k = 0; k < m; k++)     min = Math.min(min, Math.abs(arr[i][k] - arr[j][k]));    return memo2[1][i][j] = min;   }  }  static class Scanner {   StringTokenizer st;   BufferedReader br;   public Scanner(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }   public String next() {    try {     while (st == null || !st.hasMoreTokens())      st = new StringTokenizer(br.readLine());     return st.nextToken();    } catch (Exception e) {     throw new RuntimeException(e);    }   }   public int nextInt() {    return Integer.parseInt(next());   }  } }
6	public class Main { public static void main(String[] args) throws Exception {  Thread thread = new Thread(null, new TaskAdapter(), "", 1 << 27);  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);   FElongatedMatrix solver = new FElongatedMatrix();   solver.solve(1, in, out);   out.close();  } }  static class FElongatedMatrix {  public void solve(int testNumber, FastInput in, FastOutput out) {  int n = in.readInt();  int m = in.readInt();  int[][] mat = new int[n][m];  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   mat[i][j] = in.readInt();   }  }   int[][] minDist = new int[n][n];  SequenceUtils.deepFill(minDist, (int) 1e9);  for (int i = 0; i < n; i++) {   for (int j = 0; j < n; j++) {   for (int k = 0; k < m; k++) {    minDist[i][j] = Math.min(minDist[i][j], Math.abs(mat[i][k] - mat[j][k]));   }   }  }  int[][] minDistBetweenHeadAndTail = new int[n][n];  SequenceUtils.deepFill(minDistBetweenHeadAndTail, (int) 1e9);  for (int i = 0; i < n; i++) {   for (int j = 0; j < n; j++) {   for (int k = 1; k < m; k++) {    minDistBetweenHeadAndTail[i][j] = Math.min(minDistBetweenHeadAndTail[i][j], Math.abs(mat[i][k] - mat[j][k - 1]));   }   }  }   Log2 log2 = new Log2();  BitOperator bo = new BitOperator();  int[][][] dp = new int[1 << n][n][n];  for (int i = 1; i < (1 << n); i++) {   if (i == Integer.lowestOneBit(i)) {   dp[i][log2.floorLog(i)][log2.floorLog(i)] = (int) 1e9;   continue;   }   for (int j = 0; j < n; j++) {   for (int k = 0; k < n; k++) {    if (bo.bitAt(i, j) == 0) {    continue;    }    for (int t = 0; t < n; t++) {    dp[i][j][k] = Math.max(dp[i][j][k],     Math.min(dp[bo.setBit(i, j, false)][t][k],      minDist[j][t]));    }   }   }  }   int ans = 0;  for (int i = 0; i < n; i++) {   for (int j = 0; j < n; j++) {   ans = Math.max(ans, Math.min(dp[(1 << n) - 1][i][j], minDistBetweenHeadAndTail[j][i]));   }  }  out.println(ans);  }  }  static class SequenceUtils {  public static void deepFill(Object array, int val) {  if (!array.getClass().isArray()) {   throw new IllegalArgumentException();  }  if (array instanceof int[]) {   int[] intArray = (int[]) array;   Arrays.fill(intArray, val);  } else {   Object[] objArray = (Object[]) array;   for (Object obj : objArray) {   deepFill(obj, val);   }  }  }  }  static class Log2 {  public int floorLog(int x) {  return 31 - Integer.numberOfLeadingZeros(x);  }  }  static class FastInput {  private final InputStream is;  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 int readInt() {  int sign = 1;   skipBlank();  if (next == '+' || next == '-') {   sign = next == '+' ? 1 : -1;   next = read();  }   int val = 0;  if (sign == 1) {   while (next >= '0' && next <= '9') {   val = val * 10 + next - '0';   next = read();   }  } else {   while (next >= '0' && next <= '9') {   val = val * 10 - next + '0';   next = read();   }  }   return val;  }  }  static class BitOperator {  public int bitAt(int x, int i) {  return (x >> i) & 1;  }  public int setBit(int x, int i, boolean v) {  if (v) {   x |= 1 << i;  } else {   x &= ~(1 << i);  }  return x;  }  }  static class FastOutput implements AutoCloseable, Closeable {  private StringBuilder cache = new StringBuilder(10 << 20);  private final Writer os;  public FastOutput(Writer os) {  this.os = os;  }  public FastOutput(OutputStream os) {  this(new OutputStreamWriter(os));  }  public FastOutput println(int c) {  cache.append(c).append('\n');  return this;  }  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();  }  } }
2	public class B { static FastReader scan; static PrintWriter out;  public static void main(String[] args) throws FileNotFoundException {  Solver solver = new Solver();  scan = new FastReader();  out = new PrintWriter(System.out);  int testCases = 1;  for(int i = 1; i <= testCases; i++) {   solver.solve();  }  out.close(); }  static class Solver {   void solve() {  long n = scan.nextLong(), k = scan.nextLong();  long low = 0, high = n;  while(true) {   long mid = (low+high)/2;   long s = sum(n-mid);   if(s - mid == k) {   out.println(mid);   return;   }   else if(s - mid < k) {   high = mid-1;   }   else low = mid+1;     }    }   static long sum(long a) {  if(a == 0) return 0;  return (a+1)*a/2;  }   }   static class DSU {  int[] root, size;  int n;  DSU(int n) {  this.n = n;  root = new int[n];  size = new int[n];  for (int i = 0; i < n; i++) {   root[i] = i;   size[i] = 1;  }  }  int findParent(int idx) {  while (root[idx] != idx) {   root[idx] = root[root[idx]];   idx = root[idx];  }  return idx;  }  boolean union(int x, int y) {  int parX = findParent(x);  int parY = findParent(y);  if (parX == parY)   return false;  if (size[parX] < size[parY]) {   root[parY] = parX;   size[parX] += size[parY];  } else {   root[parX] = parY;   size[parY] += size[parX];  }  return true;  } }  static class Extra {  static void sort(int[] a) {  Integer[] aa = new Integer[a.length];  for (int i = 0; i < aa.length; i++)   aa[i] = a[i];  Arrays.sort(aa);  for (int i = 0; i < aa.length; i++)   a[i] = aa[i];  }  static void sort(long[] a) {  Long[] aa = new Long[a.length];  for (int i = 0; i < aa.length; i++)   aa[i] = a[i];  Arrays.sort(aa);  for (int i = 0; i < aa.length; i++)   a[i] = aa[i];  }  static void sort(double[] a) {  Double[] aa = new Double[a.length];  for (int i = 0; i < aa.length; i++)   aa[i] = a[i];  Arrays.sort(aa);  for (int i = 0; i < aa.length; i++)   a[i] = aa[i];  }  static void sort(char[] a) {  Character[] aa = new Character[a.length];  for (int i = 0; i < aa.length; i++)   aa[i] = a[i];  Arrays.sort(aa);  for (int i = 0; i < aa.length; i++)   a[i] = aa[i];  }  static long gcd(long a, long b) {  while (b > 0) {   long temp = b;   b = a % b;   a = temp;  }  return a;  }  static long lcm(long a, long b) {  return a * (b / gcd(a, b));  }  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 (long i = 5; i * i <= n; i = i + 6) {   if (n % i == 0 || n % (i + 2) == 0)   return false;  }  return true;  } }  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());  }  int[] nextIntArray(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());  }  long[] nextLongArray(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  double nextDouble() {  return Double.parseDouble(next());  }  double[] nextDoubleArray(int n) {  double[] a = new double[n];  for (int i = 0; i < n; i++)   a[i] = nextDouble();  return a;  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  } } }
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");        } } }
2	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 long check(long mid,long x,long y,long n)  {   long ans=2*mid*mid+2*mid+1;   long uleft=Math.max(0,mid-x+1);   long dleft=Math.max(0,mid-(n-x));   long lleft=Math.max(0,mid-y+1);   long rleft=Math.max(0,mid-(n-y));   ans-=uleft*uleft+dleft*dleft+lleft*lleft+rleft*rleft;     ans+=(Math.max(0,mid-(x+y-1))*(Math.max(0,mid-(x+y-1))+1))/2;   ans+=(Math.max(0,mid-(x+n-y))*(Math.max(0,mid-(x+n-y))+1))/2;   ans+=(Math.max(0,mid-(y+n-x))*(Math.max(0,mid-(y+n-x))+1))/2;   ans+=(Math.max(0,mid-(n-x+n-y+1))*(Math.max(0,mid-(n-x+n-y+1))+1))/2;   return ans;  }  public static void main(String[] args)throws IOException  {   PrintWriter out= new PrintWriter(System.out);   Reader sc=new Reader();   long n=sc.l();   long x=sc.l();   long y=sc.l();   long c=sc.l();   long low=0;   long high=(long)Math.pow(10,9);   while(low<high)   {    long mid=(low+high)/2;    if(check(mid,x,y,n)>=c)    high=mid;    else    low=mid+1;   }   out.println(low);   out.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 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 Main {  public static void main(String[] args) {   InputStream inputStream;   try {    inputStream = new FileInputStream("input.txt");   } catch (IOException e) {    throw new RuntimeException(e);   }   OutputStream outputStream;   try {    outputStream = new FileOutputStream("output.txt");   } catch (IOException e) {    throw new RuntimeException(e);   }   InputReader in = new InputReader(inputStream);   OutputWriter out = new OutputWriter(outputStream);   CFireAgain solver = new CFireAgain();   solver.solve(1, in, out);   out.close();  }  static class CFireAgain {   private int n;   private int m;   private int K;   private boolean[][] vis;   private Queue<Util.Pair<Integer>> queue = new LinkedList<>();   private Util.Pair<Integer> p;   private boolean isValid(int x, int y) {    return x >= 1 && x <= n && y >= 1 && y <= m && !vis[x][y];   }   private void bfs() {    while (!queue.isEmpty()) {     p = queue.poll();     if (isValid(p.x + 1, p.y)) {      queue.offer(new Util.Pair<>(p.x + 1, p.y));      vis[p.x + 1][p.y] = true;     }     if (isValid(p.x - 1, p.y)) {      queue.offer(new Util.Pair<>(p.x - 1, p.y));      vis[p.x - 1][p.y] = true;     }     if (isValid(p.x, p.y + 1)) {      queue.offer(new Util.Pair<>(p.x, p.y + 1));      vis[p.x][p.y + 1] = true;     }     if (isValid(p.x, p.y - 1)) {      queue.offer(new Util.Pair<>(p.x, p.y - 1));      vis[p.x][p.y - 1] = true;     }    }   }   public void solve(int testNumber, InputReader in, OutputWriter out) {    n = in.nextInt();    m = in.nextInt();    K = in.nextInt();    vis = new boolean[n + 1][m + 1];    for (int i = 0; i < K; i++) {     int a = in.nextInt(), b = in.nextInt();     vis[a][b] = true;     queue.offer(new Util.Pair<>(a, b));    }    bfs();    out.println(p.x + " " + p.y);    out.flush();   }  }  static class OutputWriter {   private final PrintWriter writer;   private ArrayList<String> res = new ArrayList<>();   private StringBuilder sb = new StringBuilder("");   public OutputWriter(OutputStream outputStream) {    writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));   }   public OutputWriter(Writer writer) {    this.writer = new PrintWriter(writer);   }   public void println(Object... objects) {    for (int i = 0; i < objects.length; i++) {     sb.append(objects[i]);    }    res.add(sb.toString());    sb = new StringBuilder("");   }   public void close() {    writer.close();   }   public void flush() {    for (String str : res) writer.printf("%s\n", str);    res.clear();    sb = new StringBuilder("");   }  }  static class Util {   public static class Pair<T> {    public T x;    public T y;    public Pair(T x, T y) {     this.x = x;     this.y = y;    }    public boolean equals(Object obj) {     if (obj == this) return true;     if (!(obj instanceof Util.Pair)) return false;     Util.Pair<T> pair = (Util.Pair<T>) obj;     return this.x == pair.x && this.y == pair.y;    }    public String toString() {     return ("(" + this.x + "," + this.y + ")");    }    public int hashCode() {     return Objects.hash(x, y);    }   }  }  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[8192];   private int curChar;   private int numChars;   public InputReader(InputStream stream) {    this.stream = stream;   }   public InputReader(FileInputStream file) {    this.stream = file;   }   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 = (res << 3) + (res << 1) + c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
6	public class G1 {  static final int mod = (int) (1e9 + 7);  static final int UNCALC = -1;  static int[][][] memo;  static int n, t[], genre[];  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   n = sc.nextInt();   t = new int[n];   int T = sc.nextInt();   genre = new int[n];   for (int i = 0; i < n; i++) {    t[i] = sc.nextInt();    genre[i] = sc.nextInt();   }   memo = new int[4][1 << n][T+1];   for (int[][] a : memo)    for (int[] b : a)     Arrays.fill(b, UNCALC);   out.println(dp(0, 0, T));   out.flush();   out.close();  }  static int dp(int last, int mask, int rem) {   if (rem==0) return 1;   if (memo[last][mask][rem] != UNCALC) return memo[last][mask][rem];   int cnt = 0;   for (int i = 0; i < n; i++) {    if (genre[i] == last || t[i] > rem || (mask & 1 << i) != 0) continue;    cnt = (cnt + dp(genre[i], mask | 1 << i, rem - t[i]))%mod;   }   return memo[last][mask][rem] = cnt;  }  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 int[] nextIntArray(int n) throws IOException {    int[] a = new int[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    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 Integer[] nextIntegerArray(int n) throws IOException {    Integer[] a = new Integer[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }   public double[] nextDoubleArray(int n) throws IOException {    double[] ans = new double[n];    for (int i = 0; i < n; i++)     ans[i] = nextDouble();    return ans;   }   public short nextShort() throws IOException {    return Short.parseShort(next());   }  } }
0	public class C125 { public static void main(String[] args) throws IOException {  BufferedReader r = new BufferedReader(new InputStreamReader(System.in));  String s = r.readLine();  int n = new Integer(s);  System.out.println("0 0 "+n); } }
3	public class Codechef {    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();    Arrays.sort(a);    ArrayList<Integer>al=new ArrayList();    int k=a[0];    int count=0;    for(int j=0;j<n;j++)    {k=a[j];     if(Collections.frequency(al,a[j])==0)     {for(int i=0;i<n;i++)    {if(a[i]%k==0)    {al.add(a[i]);}}    count++;}}    System.out.println(count);}}
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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   static int n;   static int m;   static int steps;   static long[][] distJ;   static long[][] distI;   static long[][][] memo;   public void solve(int testNumber, InputReader in, OutputWriter out) {    n = in.nextInt();    m = in.nextInt();    steps = in.nextInt();    memo = new long[n][m][steps];    distJ = new long[n][m - 1];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m - 1; j++) {      distJ[i][j] = in.nextLong();     }    }    distI = new long[n - 1][m];    for (int i = 0; i < n - 1; i++) {     for (int j = 0; j < m; j++) {      distI[i][j] = in.nextLong();     }    }     for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      if (steps % 2 != 0) {       out.print(-1 + " ");      } else {       out.print(2 * lowestCost(i, j, steps / 2) + " ");      }     }     out.println();    }   }   private long lowestCost(int i, int j, int distance) {    if (distance == 0) {     return 0;    }    if (memo[i][j][distance] > 0) {     return memo[i][j][distance];    }    long minDist = Long.MAX_VALUE;       if (j < m - 1) {         minDist = Math.min(minDist, distJ[i][j] + lowestCost(i, j + 1, distance - 1));    }    if (j > 0) {         minDist = Math.min(minDist, distJ[i][j - 1] + lowestCost(i, j - 1, distance - 1));    }    if (i < n - 1) {         minDist = Math.min(minDist, distI[i][j] + lowestCost(i + 1, j, distance - 1));    }    if (i > 0) {         minDist = Math.min(minDist, distI[i - 1][j] + lowestCost(i - 1, j, distance - 1));    }        memo[i][j][distance] = minDist;    return minDist;   }  }  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();   }  }  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 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);   }  } }
6	public class Main {  private StreamTokenizer in;  private BufferedWriter out;  public void solve() throws Exception {   int n = nextInt(), m = nextInt();   int[] ss = new int[n];   for (int i=0; i<m; i++)   {    int a = nextInt(), b = nextInt();    a--;b--;    ss[a]|=1<<b;    ss[b]|=1<<a;   }   long[][] res = new long[n][1<<n];   int[] cnt = new int[1<<n], first = new int[1<<n];   for (int i=0; i<n; i++)   {    res[i][1<<i] = 1;    first[1<<i] = i;    cnt[1<<i] = 1;   }   long ans = 0;   for (int mask = 0; mask<1<<n; mask++)   {    for (int last = first[mask]; last<n; last++)    {     if (res[last][mask]==0)      continue;     if (cnt[mask]>2)     {      if ((ss[last]&(1<<first[mask]))!=0)       ans+=res[last][mask];     }     int m2 = (~mask) & ss[last];     for (int next = first[mask]+1; next<n; next++)     {      if ((m2&(1<<next))==0) continue;      int mask2 = mask|1<<next;      res[next][mask2]+=res[last][mask];      cnt[mask2] = cnt[mask]+1;      first[mask2] = first[mask];     }    }   }   ans/=2;   out.write(ans+"\n");  }   public int nextInt() throws Exception  {   in.nextToken();   return (int)in.nval;  }  public void run() {   try {    in = new StreamTokenizer(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) {   new Main().run();  } }
0	public class Main { 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()); }  float nextFloat() { return Float.parseFloat(next()); }  boolean nextBoolean() { return Boolean.parseBoolean(next()); }  String nextLine()  {  String str = "";  try  {   str = br.readLine();  }  catch (IOException e)  {   e.printStackTrace();  }  return str;  } } static long modExp(long x, long n, long mod)  {  long result = 1;  while(n > 0)  {   if(n % 2 == 1)    result = (result%mod * x%mod)%mod;   x = (x%mod * x%mod)%mod;   n=n/2;  }  return result; } static long gcd(long a, long b) {  if(a==0) return b;  return gcd(b%a,a); } public static void main(String[] args) throws IOException {  FastReader fr = new FastReader();  long n = fr.nextLong();  long x = fr.nextLong();  long y = fr.nextLong();  long w = Long.min(x,y) - 1 + (x - Long.min(x,y)) + (y - Long.min(x,y));  long b = n - Long.max(x,y) + (Long.max(x,y) - x) + (Long.max(x,y) - y);  if(w <= b) System.out.println("White");  else System.out.println("Black");  } } class Pair<U, V> {  public final U first;    public final V second;    private Pair(U first, V second)  {  this.first = first;  this.second = second;  }  @Override  public boolean equals(Object o)  {  if (this == o) return true;   if (o == null || getClass() != o.getClass()) return false;   Pair<?, ?> pair = (Pair<?, ?>) o;   if (!first.equals(pair.first)) return false;  return second.equals(pair.second);  }  @Override  public int hashCode()  {  return 31 * first.hashCode() + second.hashCode();  }  public static <U, V> Pair <U, V> of(U a, V b)  {  return new Pair<>(a, b);  } } class myComp implements Comparator<Pair> { public int compare(Pair a,Pair b) {  if(a.first != b.first) return ((int)a.first - (int)b.first);  if(a.second != b.second) return ((int)a.second - (int)b.second);  return 0; } } class BIT   { public long[] m_array;  public BIT(long[] dat) {  m_array = new long[dat.length + 1];  Arrays.fill(m_array,0);  for(int i = 0; i < dat.length; i++)  {  m_array[i + 1] = dat[i];  }  for(int i = 1; i < m_array.length; i++)  {  int j = i + (i & -i);  if(j < m_array.length)  {   m_array[j] = m_array[j] + m_array[i];  }  } }  public final long prefix_query(int i) {  long result = 0;  for(++i; i > 0; i = i - (i & -i))  {  result = result + m_array[i];  }  return result; }  public final long range_query(int fro, int to) {  if(fro == 0)  {  return prefix_query(to);  }  else  {  return (prefix_query(to) - prefix_query(fro - 1));  } }  public void update(int i, long add) {  for(++i; i < m_array.length; i = i + (i & -i))  {  m_array[i] = m_array[i] + add;  } } }
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); } }
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 ;     }    }   }  }
5	public class SecondOrderStatistics implements Runnable { public static void main(String[] args) throws Exception {  new SecondOrderStatistics().run(); }  private void solve() throws Exception {  int n = nextInt();  SortedSet<Integer> sset = new TreeSet<Integer>();  for (int i = 0; i < n; i++)  {  int a = nextInt();  sset.add(a);  }  if (sset.size() < 2)  out.println("NO");  else  {  Integer v[] = (Integer[]) sset.toArray(new Integer[sset.size()]);  sort(v);  out.println(v[1]);  } }   private BufferedReader in; PrintWriter out; StringTokenizer tokenizer;  public void run() {   try  {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new BufferedOutputStream(System.out));  solve();  out.flush();  in.close();  out.close();  }  catch (Exception e)  {  e.printStackTrace();    } }  String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens())  {  tokenizer = new StringTokenizer(in.readLine());  }  return tokenizer.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()); } }
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 Main {  static void insert(TreeMap<Integer, Integer>map,int v,int d) {  if(!map.containsKey(v))map.put(v, 0);  map.put(v, d+map.get(v));  if(map.get(v)==0)map.remove(v); }  static void cut(TreeSet<Integer> cuts, TreeMap<Integer, Integer>segments,int v) {  int upper = cuts.higher(v) , lower = cuts.lower(v);  insert(segments, upper-lower, -1);  insert(segments, upper-v, 1);  insert(segments, v-lower, 1);  cuts.add(v); }  public static void main(String[] args) throws Throwable {  Scanner sc = new Scanner(System.in);  int w = sc.nextInt(), h = sc.nextInt() , n = sc.nextInt();  TreeSet<Integer> vCuts = new TreeSet<>() , hCuts = new TreeSet<>();  TreeMap<Integer, Integer> vSegments = new TreeMap<>() , hSegments = new TreeMap<>();  vCuts.add(0);vCuts.add(w);  hCuts.add(0);hCuts.add(h);  insert(vSegments, w, 1);  insert(hSegments, h, 1);  StringBuilder sb = new StringBuilder();  while(n-->0)  {  if(sc.next().equals("H"))   cut(hCuts, hSegments, sc.nextInt());  else   cut(vCuts, vSegments, sc.nextInt());  sb.append(1l*hSegments.lastKey() * vSegments.lastKey() + "\n");  }  System.out.println(sb); }  static class Scanner {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s) {br = new BufferedReader(new InputStreamReader(s));}  public Scanner(String file) throws FileNotFoundException {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 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 int[] nexIntArray() throws Throwable {  st = new StringTokenizer(br.readLine());  int[] a = new int[st.countTokens()];  for (int i = 0; i < a.length; i++)a[i] = nextInt();  return a;  }  public boolean ready() throws IOException {return br.ready();} } }
4	public class A implements Runnable {  String file = "input";   void init() throws IOException  {     input = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(new BufferedOutputStream(System.out));  }   void solve() throws IOException  {   String s = next();   int res = 0;   int L = s.length();   for(int i = 0; i < L; i++)    for(int j = i + 1; j <= L; j++)    {     String ss = s.substring(i, j);     int k = s.indexOf(ss);         if(k >= 0)     {      if(s.substring(k + 1).indexOf(ss) >= 0) res = max(res, j - i);     }    }   System.out.println(res);  }   String next() throws IOException  {   if(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;   public static void main(String[] args) throws IOException  {   new Thread(null, new A(), "", 1 << 20).start();  }   public void run()  {   try   {    init();    solve();    out.close();     }   catch(Exception e)   {    e.printStackTrace();    System.exit(1);   }  } }
1	public class A {  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());   ArrayList<String> s1 = new ArrayList<String>();   ArrayList<String> s2 = new ArrayList<String>();   for(int i=0; i<n; i++) s1.add(bf.readLine());   for(int i=0; i<n; i++) s2.add(bf.readLine());   Map<String, Integer> mp1 = new HashMap<String, Integer>();   Map<String, Integer> mp2 = new HashMap<String, Integer>();   for(String s : s1) mp1.put(s, 0);   for(String s : s1) mp1.put(s, mp1.get(s)+1);   for(String s : s2) mp2.put(s, 0);   for(String s : s2) mp2.put(s, mp2.get(s)+1);   for(String s : mp1.keySet()) {   while(mp1.get(s) > 0) {    if(mp2.containsKey(s)) {     if(mp2.get(s) > 0) {     mp1.put(s, mp1.get(s)-1);     mp2.put(s, mp2.get(s)-1);    }    else break;    }    else break;   }   }   for(String s : mp2.keySet()) {   while(mp2.get(s) > 0) {    if(mp1.containsKey(s)) {     if(mp1.get(s) > 0) {     mp2.put(s, mp2.get(s)-1);     mp1.put(s, mp1.get(s)-1);    }    else break;    }    else break;   }   }   long sum = 0;   for(String s : mp1.keySet()) sum += mp1.get(s);   out.println(sum);                  out.close(); System.exit(0);  } }
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");    }  }
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();  }  } }
4	public class Solution {  static int n,m,h[][],v[][];  public static void main(String[] args) {   Scanner input=new Scanner(System.in);    n=input.nextInt();    m=input.nextInt();    int k=input.nextInt();    h=new int[n][m-1];    for (int i = 0; i <n ; i++) {     for (int j = 0; j <m-1 ; j++) {      h[i][j]=input.nextInt();     }    }    v=new int[n][m];    for (int i = 0; i <n-1 ; i++) {     for (int j = 0; j <m ; j++) {      v[i][j]=input.nextInt();     }    }    int ans[][]=new int[n][m];    dp=new int[501][501][11];   for (int aa[]:ans    ) { Arrays.fill(aa,-1);   }   if (k%2==0) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      ans[i][j] = dfs(i, j, k / 2) * 2;     }    }   }   for (int i = 0; i <n ; i++) {    for (int j = 0; j <m ; j++) {     System.out.print(ans[i][j]+" ");    }    System.out.println();   }  }  static int dp[][][];  private static int dfs(int i, int j, int k) {   if (k==0) return 0;   if (dp[i][j][k]!=0){    return dp[i][j][k];   }     int ans=Integer.MAX_VALUE;   if (j-1>=0)   ans=dfs(i, j-1, k-1)+h[i][j-1];   if (i<n-1)   ans=Math.min(ans,dfs(i+1, j, k-1)+v[i][j]);   if (i>0)   ans=Math.min(ans,dfs(i-1, j, k-1)+v[i-1][j]);   if (j<m-1)   ans=Math.min(ans,dfs(i, j+1, k-1)+h[i][j]);   return dp[i][j][k]= ans;  }  }
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(); } }
6	public class newProgram9 {  public static void main(String[] args) throws IOException {     FastIO in = new FastIO();   int t = in.ni();     while (t-- > 0) {    int n = in.ni();    int m = in.ni();    int a[][] = new int[n][m];    int b[][] = new int[m][n];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      a[i][j] = in.ni();      b[j][i] = a[i][j];     }    }    for (int i = 0; i < m; i++) {     Arrays.sort(b[i]);    }    Data d[] = new Data[m];    for (int i = 0; i < m; i++) {     d[i] = new Data(-b[i][n - 1], i);    }    Arrays.sort(d);    int col = Math.min(n, m);    int c[][] = new int[n][col];    for (int i = 0; i < col; i++) {     for (int j = 0; j < n; j++) {      c[j][i] = a[j][d[i].b];     }    }                         System.out.println(ans(c, n, col, 0));   }   in.bw.flush();  }  private static int ans(int c[][], int n, int m, int col) {   if (col == m) {    int sum = 0;    for (int i = 0; i < n; i++) {     int max = 0;     for (int j = 0; j < m; j++) {           max = Math.max(c[i][j], max);     }     sum += max;        }       return sum;   } else {    int max = ans(c, n, m, col + 1);    int curr[] = new int[n];    for (int i = 0; i < n; i++) {     curr[i] = c[i][col];    }    for (int i = 1; i < n; i++) {     for (int j = 0; j < n; j++) {      c[j][col] = curr[(i + j) % n];     }     max = Math.max(max, ans(c, n, m, col + 1));    }    return max;   }  }  static class FastIO {   private final BufferedReader br;   private final BufferedWriter bw;   private String s[];   private int index;   private final StringBuilder sb;   public FastIO() throws IOException {    br = new BufferedReader(new InputStreamReader(System.in));    bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));    s = br.readLine().split(" ");    sb = new StringBuilder();    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 int[][][] gwtree(int n) throws IOException {    int m = n - 1;    int adja[][] = new int[n + 1][];    int weight[][] = new int[n + 1][];    int from[] = new int[m];    int to[] = new int[m];    int count[] = new int[n + 1];    int cost[] = new int[n + 1];    for (int i = 0; i < m; i++) {     from[i] = i + 1;     to[i] = ni();     cost[i] = ni();     count[from[i]]++;     count[to[i]]++;    }    for (int i = 0; i <= n; i++) {     adja[i] = new int[count[i]];     weight[i] = new int[count[i]];    }    for (int i = 0; i < m; i++) {     adja[from[i]][count[from[i]] - 1] = to[i];     adja[to[i]][count[to[i]] - 1] = from[i];     weight[from[i]][count[from[i]] - 1] = cost[i];     weight[to[i]][count[to[i]] - 1] = cost[i];     count[from[i]]--;     count[to[i]]--;    }    return new int[][][] { adja, weight };   }   public int[][][] gwg(int n, int m) throws IOException {    int adja[][] = new int[n + 1][];    int weight[][] = new int[n + 1][];    int from[] = new int[m];    int to[] = new int[m];    int count[] = new int[n + 1];    int cost[] = new int[n + 1];    for (int i = 0; i < m; i++) {     from[i] = ni();     to[i] = ni();     cost[i] = ni();     count[from[i]]++;     count[to[i]]++;    }    for (int i = 0; i <= n; i++) {     adja[i] = new int[count[i]];     weight[i] = new int[count[i]];    }    for (int i = 0; i < m; i++) {     adja[from[i]][count[from[i]] - 1] = to[i];     adja[to[i]][count[to[i]] - 1] = from[i];     weight[from[i]][count[from[i]] - 1] = cost[i];     weight[to[i]][count[to[i]] - 1] = cost[i];     count[from[i]]--;     count[to[i]]--;    }    return new int[][][] { adja, weight };   }   public int[][] gtree(int n) throws IOException {    int adja[][] = new int[n + 1][];    int from[] = new int[n - 1];    int to[] = new int[n - 1];    int count[] = new int[n + 1];    for (int i = 0; i < n - 1; i++) {     from[i] = i + 1;     to[i] = ni();     count[from[i]]++;     count[to[i]]++;    }    for (int i = 0; i <= n; i++) {     adja[i] = new int[count[i]];    }    for (int i = 0; i < n - 1; i++) {     adja[from[i]][--count[from[i]]] = to[i];     adja[to[i]][--count[to[i]]] = from[i];    }    return adja;   }   public int[][] gg(int n, int m) throws IOException {    int adja[][] = new int[n + 1][];    int from[] = new int[m];    int to[] = new int[m];    int count[] = new int[n + 1];    for (int i = 0; i < m; i++) {     from[i] = ni();     to[i] = ni();     count[from[i]]++;     count[to[i]]++;    }    for (int i = 0; i <= n; i++) {     adja[i] = new int[count[i]];    }    for (int i = 0; i < m; i++) {     adja[from[i]][--count[from[i]]] = to[i];     adja[to[i]][--count[to[i]]] = from[i];    }    return adja;   }   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();    }   }  }  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;    }   }  } }
5	public class Solution {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt(), k = in.nextInt();   int x[] = new int[n];   for (int i = 0; i < n; i++) {    int p = in.nextInt(), t = in.nextInt();    x[i] = (50 - p) * 100 + t;   }   Arrays.sort(x);   int cnt = 0;   for (int q: x)    if (q == x[k - 1]) cnt++;   System.out.println(cnt);  } }
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);  } }
0	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 long recurse(long a, long b) {   if (b <= 1) return a;   return Math.max(a, b)/Math.min(a,b) + recurse(Math.max(a, b) - Math.min(a, b)*(Math.max(a,b)/Math.min(a, b)), Math.min(a, b));  }  public void solve(int testNumber, InputReader in, OutputWriter out) {   long a = in.readLong(), b = in.readLong(), i = 0;          out.print(recurse(a, b));  } } 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 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 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); } } class OutputWriter { private final PrintWriter writer;  public OutputWriter(OutputStream outputStream) {  writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public void close() {  writer.close(); } public void print(long i) {  writer.print(i); } }
0	public class CFA {  private void work() throws IOException {  Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(   System.in)));  while (sc.hasNextInt()) {  int n = sc.nextInt();  int a = n;  int b = n / 10;  int c;  if (n < 0) {   n = -n;   c = -((n / 100) * 10 + n % 10);  } else {   c = (n / 100) * 10 + n % 10;  }  System.out.println(Math.max(a, Math.max(b, c)));  }  System.out.close(); }  private int gcd(int a, int b) {  return b == 0 ? a : gcd(b, a % b); }  public static void main(String[] args) throws IOException {  new CFA().work(); } }
3	public class CF1141F { public static void main(String[] args) throws Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  String[] split = br.readLine().split(" ");  int[] terms = new int[n];  int[] sums = new int[n+1];  for(int i=0; i<n; i++) {  terms[i] = Integer.parseInt(split[i]);  sums[i+1] = sums[i]+terms[i];  }  ArrayList<Block> blocks = new ArrayList<>();  for(int i=0; i<n; i++)  for(int j=i; j<n; j++){   int s = sums[j+1]-sums[i];   blocks.add(new Block(i, j, s));  }  Collections.sort(blocks);  ArrayList<Block> best = new ArrayList<>();  int i = 0;  while(i<blocks.size()){  int curSum = blocks.get(i).sum;  ArrayList<Block> curBlocks = new ArrayList<>();  while(i<blocks.size() && blocks.get(i).sum==curSum) curBlocks.add(blocks.get(i++));  int[] memo = new int[curBlocks.size()+1];  Arrays.fill(memo, -1);  memo[curBlocks.size()] = 0;  for(int j=curBlocks.size()-1; j>=0; j--){   int idx = Collections.binarySearch(curBlocks, new Block(curBlocks.get(j).r+1, curBlocks.get(j).r+1, curBlocks.get(j).sum));   if(idx<0) idx = -(idx+1);   memo[j] = Math.max(memo[j+1], 1+memo[idx]);  }  if(memo[0]>best.size()){   best = new ArrayList<>();   int idx = 0;   while(memo[idx]>=1){   if(memo[idx]>memo[idx+1]) best.add(curBlocks.get(idx));   idx++;   }  }  }  StringBuilder sb = new StringBuilder();  sb.append(best.size()).append("\n");  for(Block b : best){  sb.append(b.l+1).append(" ").append(b.r+1).append("\n");  }  System.out.print(sb); }  static class Block implements Comparable<Block>{  int l, r, sum;   Block(int a, int b, int c){  l = a;  r = b;  sum = c;  }  @Override  public int compareTo(Block o) {  if(sum==o.sum){   if(l==o.l) return r-o.r;   return l-o.l;  }  return sum-o.sum;  } } }
2	public class codeforcesreturn { static class edge {  int u;  int v;  public edge(int u, int v) {  this.u = u;  this.v = v;  }  }  static ArrayList<Integer>[] adjlist; static int[][] adjmatrix; static int[][] adjmatrix2; static boolean[] vis; static boolean[] intialvis; static boolean[] vis2; static int[] counter; static int V, E; static Stack<Integer> st; static ArrayList<Integer> arrylist; static boolean flag; static int[] dx = new int[] { 1, -1, 0, 0 }; static int[] dy = new int[] { 0, 0, 1, -1 }; static int[] Arr; static PrintWriter pw; static boolean ans = true;;  public static long gcd(long u, long v) {  if (u == 0)  return v;  return gcd(v % u, u); }  public static void bib(int u) {  vis[u] = true;  for (int v : adjlist[u]) {  if (!vis[v]) {   counter[v] = 1 ^ counter[u];   bib(v);  } else if (counter[v] != (1 ^ counter[u]))   ans = false;  } }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);  int n = sc.nextInt();  int k = sc.nextInt();  int sum = n;  for (long i = 0; i < 1e5; i++) {  if (i * (i + 1) / 2 - (n - i) == k) {   System.out.println(n - i);   break;  }  } }  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();  }  } }
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);   TaskE1 solver = new TaskE1();   solver.solve(1, in, out);   out.close();  }  static class TaskE1 {   int n;   int m;   int[][] map;   int[][] dp;   int two(int idx) {    return 1 << idx;   }   boolean contain(int mask, int idx) {    return (mask & two(idx)) > 0;   }   int best(int mask, int col) {    int res = 0;    for (int rot = 0; rot < n; rot++) {     int sum = 0;     for (int i = 0; i < n; i++) {      int curRow = (rot + i) % n;      if (contain(mask, curRow)) {       sum += map[i][col];      }     }     res = Math.max(res, sum);    }    return res;   }   int rec(int col, int used) {    if (col == m)     return 0;    int res = dp[col][used];    if (res != -1)     return res;    res = 0;    for (int mask = 0; mask < two(n); mask++)     if ((mask & used) == 0) {      res = Math.max(res, rec(col + 1, used | mask) + best(mask, col));     }    dp[col][used] = res;    return res;   }   public void solve(int testNumber, InputReader in, PrintWriter out) {    int t = in.nextInt();    for (int test = 0; test < t; test++) {     n = in.nextInt();     m = in.nextInt();     map = new int[n][m];     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       map[i][j] = in.nextInt();      }     }     dp = new int[m][1 << n];     for (int[] aux : dp)      Arrays.fill(aux, -1);     int ans = rec(0, 0);     out.println(ans);    }   }  }  static class InputReader {   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private InputStream stream;   public InputReader(InputStream stream) {    this.stream = stream;   }   private boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   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 nextInt() {    int c = read();    while (isWhitespace(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 (!isWhitespace(c));    return res * sgn;   }  } }
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 ques1 {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int b = sc.nextInt();   ArrayList<Integer> ar=new ArrayList<>();   for(int i=0;i<b;i++){    ar.add(sc.nextInt());   }   Collections.sort(ar);   int count=0;   int i=0;   while(ar.size()!=0)   {    int tmep=ar.get(i);    int v=ar.remove(i);    count++;    int j=0;    while(j<ar.size()){     if(ar.get(j)%tmep==0){      int a=ar.remove(j);     }     else      j++;    }   }   System.out.println(count);   } }
5	public class Round113_A {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int k = in.nextInt() - 1;   Obe[] a = new Obe[n];   for (int i = 0; i < n; i++)    a[i] = new Obe(in.nextInt(), in.nextInt());   Arrays.sort(a);   int c = 0;   int p = 0, d = 0;   if (k > -1 && k < n) {    c = 1;    p = a[k].p;    d = a[k].d;   } else {    System.out.println(c);    return;   }   for (int i = k + 1; i < n; i++) {    if (a[i].p == p && a[i].d == d)     c++;   }   for (int i = k - 1; i > -1; i--) {    if (a[i].p == p && a[i].d == d)     c++;   }   System.out.println(c);  } } class Obe implements Comparable<Obe> {  int p, d;  public Obe(int pe, int de) {   p = pe;   d = de;  }  @Override  public int compareTo(Obe o) {   int x = new Integer(o.p).compareTo(this.p);   if (x != 0)    return x;   return new Integer(this.d).compareTo(o.d);  } }
6	public class Main { public static BufferedReader in; public static PrintWriter out;  public static void main(String[] args) throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  boolean showLineError = true;  if (showLineError) {  solve();  out.close();  } else {  try {   solve();  } catch (Exception e) {  } finally {   out.close();  }  }  }  static void debug(Object... os) {  out.println(Arrays.deepToString(os)); }  private static void solve() throws IOException {  String[] line = nss();  int n = Integer.parseInt(line[0]);  int m = Integer.parseInt(line[1]);  boolean[][] matrix = new boolean[n][n];  for (int i = 0; i < m; i++) {  line = nss();  int u = Integer.parseInt(line[0]) - 1;  int v = Integer.parseInt(line[1]) - 1;  matrix[u][v] = matrix[v][u] = true;  }  long[][] dp = new long[1<<n][n];  for(int i=0;i<n;i++)  dp[1<<i][i]=1;  long ret=0;  for(int mask =0;mask< 1<<n;mask++){  for(int last =0;last<n;last++)   if((mask & (1<<last))!=0){   int first=-1;   for(first=0;first<n;first++)    if((mask & (1<<first))!=0)    break;   for(int add =first;add<n;add++)    if((mask & (1<<add))==0 && matrix[last][add])    dp[mask+ (1<<add)][add]+=dp[mask][last];       if(Long.bitCount(mask)>2 && matrix[first][last])    ret+=dp[mask][last];   }  }  out.println(ret/2L);  }  private static String[] nss() throws IOException {  return in.readLine().split(" "); }  private static int ni() throws NumberFormatException, IOException {  return Integer.parseInt(in.readLine()); } }
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; } }
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;  } }
2	public class Main {  static long m = 1000000007;  static long powmod(long x, long y, long p)  {     long res = 1;        x = x % p;   while (y > 0)   {           if((y & 1)==1)     res = (res * x) % p;           y = y >> 1;    x = (x * x) % p;   }   return res;  }  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;  }  public static void main(String args[] ) throws Exception {   Scanner sc = new Scanner(System.in);   long x = sc.nextLong();   long k = sc.nextLong();   if(x>0) {    long d= powmod(2,k,m);    long ans= mulmod(d,2,m)%m;    ans= mulmod(ans,x,m)%m;    ans++;    ans%=m;    ans= (ans-d+m)%m;    System.out.println(ans);   }   else    System.out.println(0);  } }
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 A {  String fileName = "<name>";  public TreeSet<Integer> set = new TreeSet<>();  public int getLowerDist(int x) {   Integer higher = set.higher(x);   Integer lower = set.lower(x);   if (higher == null)    return lower;   if (lower == null)    return higher;   if (Math.abs(x - higher) < Math.abs(x - lower)) {    return higher;   } else {    return lower;   }  }  public void solve() throws IOException {   int n = nextInt();   int d = nextInt();   int[] a = new int[n];   Set<Integer> ans = new HashSet<>((int) 1e6, 1f);   for (int i = 0; i < n; i++) {    a[i] = nextInt();    set.add(a[i]);   }   for (int i = 0; i < n; i++) {    int pos1 = a[i] + d;    int pos2 = a[i] - d;    if (!set.contains(pos1) && Math.abs(pos1 - getLowerDist(pos1)) == d) {     ans.add(pos1);    }    if (!set.contains(pos2) && Math.abs(pos2 - getLowerDist(pos2)) == d) {     ans.add(pos2);    }   }   out.print(ans.size());  }  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);   }  }  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 long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);   new A().run();  } }
1	public class Main { private static StreamTokenizer in; private static PrintWriter out; private static int nextInt() throws Exception { in.nextToken(); return (int)in.nval; } private static String nextString() throws Exception { in.nextToken(); return in.sval; } public static void main(String[] args) throws Exception { in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(System.out); int n = nextInt(); byte f = (byte)nextInt(); byte s = (byte)nextInt(); byte t = (byte)nextInt(); boolean bf = false; boolean bs = false; boolean bt = false; if((f&1) == 0){bf = true;} if((s&1) == 0){bs = true;} if((t&1) == 0){bt = true;} if((!bf)&&bs&&bt){System.out.println(1);return;} if(bf&&(!bs)&&bt){System.out.println(2);return;} if(bf&&bs&&(!bt)){System.out.println(3);return;} if(bf&&!bs&&!bt){System.out.println(1);return;} if(!bf&&bs&&!bt){System.out.println(2);return;} if(!bf&&!bs&&bt){System.out.println(3);return;} for(int i = 4; i<=n; i++){ byte g = (byte) nextInt(); if(((g+f)&1) == 1){System.out.println(i); return;} }  out.flush(); } }
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);   }  } }
2	public class cf3 implements Runnable{   final static long mod = (long)1e9 + 7;   static long modExp(long x, long pow) {   x = x % mod;    long res = 1;     while (pow > 0) {     if (pow % 2 == 1)    res = res * x % mod;     pow = pow / 2;   x = x * x % mod;   }    return res; }  public void run() {    InputReader s = new InputReader(System.in);  PrintWriter w = new PrintWriter(System.out);   int t = 1;    while(t-- > 0) {    long x = s.nextLong(), k = s.nextLong();    if(x == 0) {   w.println(0); continue;  }    x = x % mod;    long res = (modExp(2, k + 1) * x % mod + 1) % mod;  res = (res + mod - modExp(2, k)) % mod;    w.println(res);  }   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 cf3(),"cf3",1<<26).start(); } }
3	public class code_1 {  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();   Arrays.sort(a);   for(int i=0;i<n-1;i++) {    if(a[i]!=-1) {   for(int j=i+1;j<n;j++) {      if(a[j]%a[i]==0)    a[j]=-1;   }  }  }   int count=0;   for(int i=0;i<n;i++) {    if(a[i]!=-1)   count++;  }   System.out.println(count);  } }
4	public class Main1 {  static int dr[] = { 0, 0, 1, -1 }; static int dc[] = { 1, -1, 0, 0 };  static boolean isValid(int r, int c) {  if (r >= n || r < 0 || c >= m || c < 0)  return false;  return true; }  static int grid[][]; static int n, m;  public static void main(String[] args) throws IOException {  FastReader input = new FastReader();  PrintWriter out = new PrintWriter("output.txt");  n = input.nextInt();  m = input.nextInt();  grid = new int[n][m];  int k = input.nextInt();  for (int i = 0; i < n; i++) {  Arrays.fill(grid[i], Integer.MAX_VALUE);  }  Queue<Pair> q = new LinkedList<Pair>();  for (int i = 0; i < k; i++) {  int x = input.nextInt() - 1;  int y = input.nextInt() - 1;   q.add(new Pair(x, y));  grid[x][y] = 0;   while (!q.isEmpty()) {   Pair cur = q.poll();   for (int j = 0; j < dr.length; j++) {   int r = cur.x;   int c = cur.y;   int nr = r + dr[j];   int nc = c + dc[j];   int dist = grid[r][c] + 1;    if (isValid(nr, nc) && grid[nr][nc] > dist) {    grid[nr][nc] = dist;    q.add(new Pair(nr, nc));   }   }  }  }  int max = -1;  int x = -1;  int y = -1;  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   if (grid[i][j] > max) {   max = grid[i][j];   x = i + 1;   y = j + 1;   }  }  }  out.println(x + " " + y);  out.flush(); }  static class FastReader {  BufferedReader br;  StringTokenizer st;  public FastReader() throws FileNotFoundException {  br = new BufferedReader(new FileReader(new File("input.txt")));  }  String next() throws IOException {  while (st == null || !st.hasMoreElements()) {   st = new StringTokenizer(br.readLine());  }  return st.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());  }  String nextLine() throws IOException {  String str = "";  str = br.readLine();  return str;  } }  static class con {  static int IINF = (int) 1e9;  static int _IINF = (int) -1e9;  static long LINF = (long) 1e15;  static long _LINF = (long) -1e15;  static double EPS = 1e-9; }  static class Triple implements Comparable<Triple> {  int x;  int y;  int z;  Triple(int x, int y, int z) {  this.x = x;  this.y = y;  this.z = z;  }  @Override  public int compareTo(Triple o) {  if (x == o.x && y == o.y)   return z - o.z;  if (x == o.x)   return y - o.y;  return x - o.x;  } }  static class Pair implements Comparable<Pair> {  int x;  int y;  Pair(int x, int y) {  this.x = x;  this.y = y;  }  @Override  public int compareTo(Pair o) {  if (x == o.x)   return y - o.y;  return x - o.x;  }  @Override  public String toString() {   return "(" + x + ", " + y + ")";  }  }  static void shuffle(int[] a) {  for (int i = 0; i < a.length; i++) {  int r = i + (int) (Math.random() * (a.length - i));  int tmp = a[r];  a[r] = a[i];  a[i] = tmp;  } }  static int gcd(int a, int b) {  return b == 0 ? a : gcd(b, a % b); } }
0	public class ProblemA {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   long n = sc.nextLong();   long[] answer = new long[3];   if (n == 1) {    answer[0] = 0;    answer[1] = 0;    answer[2] = 1;   } else if (n > 1) {    long f1 = 0;    long f2 = 1;    long m = 0;    while (m < n) {     answer[0] = answer[1];     answer[1] = f1;     answer[2] = f2;     m = f1 + f2;     f1 = f2;     f2 = m;    }    answer[2] = answer[1];   }   System.out.println(answer[0] + " " + answer[1] + " " + answer[2]);  } }
1	public class Iq {  static void metod() throws Exception {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[] m = new int[n];   for (int i = 0; i < n; i++)    m[i] = in.nextInt();   byte k = 0;   if (m[0] % 2 == 0) {    if (m[1] % 2 == 0) {     k = 0;    } else {     if (m[2] % 2 == 0) {      System.out.println(2);      return;     } else {      System.out.println(1);      return;     }    }   } else {    if (m[1] % 2 == 1) {     k = 1;    } else {     if (m[2] % 2 == 0) {      System.out.println(1);      return;     } else {      System.out.println(2);      return;     }    }   }   if (k == 0) {    for (int i = 0; i < m.length; i++) {     if (m[i] % 2 == 1) {      System.out.println(i + 1);      break;     }    }   } else {    for (int i = 0; i < m.length; i++) {     if (m[i] % 2 == 0) {      System.out.println(i + 1);      break;     }    }   }  }  public static void main(String args[]) throws Exception {   Iq.metod();  } }
3	public class AG1 {  public static void main(String[] Args){   FastReader scan=new FastReader();   int n=scan.nextInt();   int[] arr=new int[n];   for (int i = 0; i <n ; i++) {    arr[i]=scan.nextInt();   }   Arrays.sort(arr);   boolean[] done=new boolean[n];   int ans=0;   for(int i=0;i<n;i++){    if(!done[i]){     done[i]=true;     ans++;     for(int j=i+1;j<n;j++){      if(arr[j]%arr[i]==0){       done[j]=true;      }     }    }   }   System.out.println(ans);  }  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;   }  } }
4	public class Main{ public static void main(String args[]){  Scanner cin = new Scanner(System.in);  String str;  int i,j,k;  int cnt = 0;  char [] strArray;   str = cin.next();  strArray = str.toCharArray();   for(i = 0; i < strArray.length; i ++)  for(j = i + 1; j < strArray.length; j ++)  {   for(k = 0; (((i + k) < strArray.length && (j + k) < strArray.length) && (strArray[i + k] == strArray[j + k])); k ++)   if(k + 1> cnt) cnt = k + 1;  }   System.out.println(cnt); } }
4	public class ExplorerSpace {  static int n;  static int m;  static int k;  static int [][] rows;  static int [][] cols;  static int max;  static int orix;  static int oriy;  static int [][] dirs = new int[][]{{0,1},{0,-1},{1,0},{-1,0}};  static int [][][][][] mem;  public static void main(String[] args) {   FastScanner fs = new FastScanner();   n = fs.nextInt();   m =fs.nextInt();   k = fs.nextInt();   rows = new int[n][m-1];   cols = new int[n-1][m];   for(int i = 0; i < n; i++){    for(int j = 0; j < m-1; j++){     rows[i][j] = fs.nextInt();    }   }   for(int i = 0; i < n-1; i++){    for(int j = 0; j < m; j++){     cols[i][j] = fs.nextInt();    }   }   int [][][] res = new int[100][n][m];   for(int o = 2; o <= k; o+=2){    for(int i = 0; i < n; i++){     for(int j = 0; j < m; j++){      res[o][i][j] = 0x3f3f3f3f;      if(i>0){       res[o][i][j] = Math.min(res[o][i][j], res[o-2][i-1][j] + 2*cols[i-1][j]);      }      if(i+1<n){       res[o][i][j] = Math.min(res[o][i][j], res[o-2][i+1][j] + 2 * cols[i][j]);      }      if(j>0){       res[o][i][j] = Math.min(res[o][i][j], res[o-2][i][j-1] + 2 * rows[i][j-1]);      }      if(j+1<m){       res[o][i][j] = Math.min(res[o][i][j], res[o-2][i][j+1] + 2 * rows[i][j]);      }     }    }   }   for(int i = 0; i < n; i++){    for(int j = 0; j < m;j ++){     if(k%2==1){      System.out.print(-1+" ");     }else{      System.out.print(res[k][i][j] + " ");     }    }    System.out.println();   }  }                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());   }   long nextLong(){    return Long.parseLong(next());   }  } }
6	public class main{  static int max = 5000+1; static FastReader in = new FastReader(); static PrintWriter out = new PrintWriter(System.out); static int N = 18; static int[][] mn1 = new int[N][N];  static int[][] mn2 = new int[N][N]; static int[][] dp = new int[1<<N][N]; static int n,m;  static void solve(){  n = in.nextInt(); m = in.nextInt();  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();  for(int i=0;i<n;i++){  Arrays.fill(mn1[i],Integer.MAX_VALUE);  Arrays.fill(mn2[i],Integer.MAX_VALUE);  }   for(int i=0;i<n;i++)  for(int j=0;j<n;j++)   for(int k=0;k<m;k++){   mn1[i][j] = Math.min(mn1[i][j],Math.abs(a[i][k]-a[j][k]));   if(k<=m-2)    mn2[i][j] = Math.min(mn2[i][j],Math.abs(a[i][k]-a[j][k+1]));   }  int ans = 0;  for(int i=0;i<n;i++){  for(int x=0;x<1<<n;x++)Arrays.fill(dp[x],-1);  for(int j=0;j<n;j++)dp[1<<j][j] = 0;  dp[1<<i][i] = Integer.MAX_VALUE;  for(int j=0;j<n;j++)   ans = Math.max(ans,Math.min(mn2[j][i],calc((1 << n) - 1, j)));  }  out.println(ans); }  static int calc(int mask, int v){  if (dp[mask][v] != -1)  return dp[mask][v];  dp[mask][v] = 0;  for(int u=0;u<n;u++) if (v != u && (((mask >> u) & 1)>0))  dp[mask][v] = Math.max(dp[mask][v], Math.min(mn1[u][v], calc(mask ^ (1 << v), u)));  return dp[mask][v]; }  public static void main(String[] args){  solve();  out.flush();  out.close(); }  static 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(){    while (st == null || !st.hasMoreElements()){     try{      st = new StringTokenizer(br.readLine());     }catch (IOException e){      e.printStackTrace();     }    }    return st.nextToken();   }   String nextLine(){    String str = "";    try{      str = br.readLine();    }catch (IOException e){     e.printStackTrace();    }    return str;   }   int nextInt(){return Integer.parseInt(in.next());}  long nextLong(){return Long.parseLong(in.next());}  double nextDouble(){return Double.parseDouble(in.next());}  } }
4	public class P23A {  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  String s = in.nextLine();  int max = 0;  for(int i = 0; i < s.length(); i++)  for(int k = s.length(); k > max + i; k--)   if(s.substring(i + 1).contains(s.substring(i,k)))   max = k - i;  System.out.println(max); } }
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;  } }
5	public class Beta15PA {   public static void main(String[] args) {   Beta15PA temp = new Beta15PA();  temp.solve(); }  public void solve() {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt(), t = scan.nextInt();  House[] houses = new House[n];  for(int i=0; i<n; i++) {  houses[i] = new House(scan.nextInt(), scan.nextInt());  }  Arrays.sort(houses);  int res = 2;  for(int i=0; i<n-1; i++) {  double cnt = houses[i+1].coordinate - houses[i].coordinate;  cnt -= 1.0*(houses[i+1].side+houses[i].side)/2;  if(cnt>t) res += 2;  else if(Math.abs(cnt-t)<1e-7) res += 1;  }  System.out.println(res); }  public class House implements Comparable<House> {  public int coordinate, side;  public House(int coordinate, int side) {  this.coordinate = coordinate;  this.side = side;  }  @Override  public int compareTo(House arg0) {    return this.coordinate - arg0.coordinate;  }   } }
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);  } }
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);  } }   }
2	public class Main {  PrintWriter out = new PrintWriter(System.out, false);  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer stok = null;  String next() {   while (stok == null || !stok.hasMoreTokens())    try {     stok = new StringTokenizer(in.readLine());    } catch (IOException e) { throw new RuntimeException(e); }   return stok.nextToken();  }  public static void main(String args[]) throws IOException {   if (args.length > 0) {    setIn(new FileInputStream(args[0] + ".inp"));    setOut(new PrintStream(args[0] + ".out"));   }   Main solver = new Main();   solver.out.flush();  }    long n = parseLong(next()), k = parseLong(next());  long delta = 9 + 8 * (n + k);  long a = (-3 + (long)sqrt(delta)) / 2;  long b = n - a;  {   out.println(b);  } }
6	public class Main {  private FastScanner in; private PrintWriter out;  public void solve() throws IOException {  int N = in.nextInt();  int M = in.nextInt();  int[][] edges = new int[N][N];  for (int i = 0; i < M; i++) {  int a = in.nextInt() - 1;  int b = in.nextInt() - 1;  edges[a][b] = 1;  edges[b][a] = 1;  }  int globalCountMasks = 1 << N;  int[][] masks = new int[N + 1][];  int[] countMasks = new int[N + 1];  for (int i = 0; i <= N; i++) {  masks[i] = new int[combinations(N, i)];  }  for (int i = 0; i < globalCountMasks; i++) {  int c = countBit1(i);  masks[c][countMasks[c]] = i;  countMasks[c]++;  }  long globalCountCycles = 0;  long[][] count = new long[globalCountMasks][N];  for (int a = 0; a < N - 2; a++) {  int aBit = 1 << a;  count[aBit][a] = 1;  long countCycles = 0;  for (int i = 2; i <= N; i++) {   for (int m = 0; m < countMasks[i]; m++) {   int mask = masks[i][m];   if ((mask & aBit) == 0)    continue;   if ((mask & (aBit - 1)) > 0)    continue;   count[mask][a] = 0;   for (int v = a + 1; v < N; v++) {    int vBit = 1 << v;    if ((mask & vBit) == 0)    continue;    count[mask][v] = 0;    for (int t = a; t < N; t++) {    if ((mask & (1 << t)) == 0 || t == v     || edges[v][t] == 0)     continue;    count[mask][v] += count[mask ^ vBit][t];    }    if (edges[a][v] == 1 && mask != (aBit | vBit)) {    countCycles += count[mask][v];    }   }   }  }  globalCountCycles += countCycles / 2;  }  out.println(globalCountCycles); }  private int countBit1(int k) {  int c = 0;  while (k > 0) {  c += k & 1;  k >>= 1;  }  return c; }  private int combinations(int n, int k) {  if (k > n || k < 0) {  throw new IllegalArgumentException();  }  int r = 1;  for (int i = 1; i <= k; i++) {  r = r * (n + 1 - i) / i;  }  return r; }  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());  } }  public static void main(String[] arg) {  new Main().run(); } }
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 Problem {  static int mod = (int) (1e9+7);  static InputReader in;  static PrintWriter out;  static int[] rt;  static int[] size;  static void initialize(int n){   rt = new int[n + 1];   size = new int[n + 1];   for(int i = 0; i < rt.length; i++){    rt[i] = i;    size[i] = 1;   }  }   static int root(int x){   while(rt[x] != x){    rt[x] = rt[rt[x]];    x = rt[x];   }   return x;  }   static long union(int x,int y){   int root_x = root(x);   int root_y = root(y);   if(root_x == root_y) return 0;   long val = size[root_x] *1l* size[root_y];   if(size[root_x]<size[root_y]){    rt[root_x] = rt[root_y];    size[root_y] += size[root_x];   }   else{    rt[root_y] = rt[root_x];    size[root_x] += size[root_y];      }     return val;  }   static void solve()  {   in = new InputReader(System.in);   out = new PrintWriter(System.out);        int t = 1;     while(t-- > 0){    int n = in.nextInt();    int[] arr = in.nextIntArray(n);    ArrayList<Pair> list = new ArrayList<>();       for(int i = 1; i < n; i++){     int u = in.nextInt() - 1;     int v = in.nextInt() - 1;     list.add(new Pair(u, v, Math.max(arr[u],arr[v])));    }    list.sort((p1,p2) -> Integer.compare(p1.i, p2.i));    initialize(n);    long s1 = 0;    for(int i = 0; i < list.size(); i++){     s1 += union(list.get(i).x, list.get(i).y) * list.get(i).i;    }    for(int i = 0; i < list.size(); i++){     Pair p = list.get(i);     p.i = Math.min(arr[p.x],arr[p.y]);    }    list.sort((p1,p2) -> -Integer.compare(p1.i, p2.i));    initialize(n);    long s2 = 0;    for(int i = 0; i < list.size(); i++){     s2 += union(list.get(i).x, list.get(i).y) * list.get(i).i;    }       out.println(s1 - s2);   }     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>  {   int x,y;   int i;    Pair (int x,int y)   {     this.x = x;     this.y = y;   }   Pair (int x,int y, int i)   {     this.x = x;     this.y = y;     this.i = i;   }   public int compareTo(Pair o)   {    if(this.x != o.x)     return -Integer.compare(this.x, o.y);    return -Integer.compare(this.y,o.y);       }   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 + " "+i;   }     }   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 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;  }  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);   }  } }
1	public class B {  public static void main(String[] args) throws IOException {   BufferedReader br= new BufferedReader(new InputStreamReader(System.in));   int t= Integer.parseInt(br.readLine());   while (t-->0)   {    String[] s1= br.readLine().split(" ");    int n= Integer.parseInt(s1[0]);        int x= 1;    boolean ans=true;    while (n%2==0){     x*=2;     n/=2;    }    if (x==1) ans= false;    int z= (int)Math.sqrt(n);    if (z*z!=n) ans= false;    if (ans) System.out.println("YES");    else System.out.println("NO");   }  } }
5	public class A {  private static StreamTokenizer in = null;  private static PrintWriter out = null;   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 (double) 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);     new A().solve();   out.flush();  }   public void solve() throws IOException {   int n = nextInt();   int min = Integer.MAX_VALUE;   int res = Integer.MAX_VALUE;   for (int i=0; i<n; ++i) {    int d = nextInt();    if (d<min) {     res = min;     min = d;    } else if (d>min && d<res)     res = d;   }   if (res == Integer.MAX_VALUE)    out.println("NO");   else    out.println(res);  } }
2	public class MainA {  public static void main(String[] args) throws Exception {     Scanner in = new Scanner(new BufferedInputStream(System.in));   PrintStream out = new PrintStream(System.out);          Solution solution = new Solution(in, out);   solution.solve();     in.close();   out.close();  }  static private class Solution {   final int inf = (int)1e9;     int n, x, y, c;   int f(int u, int r, int sec){    if(u == 0 && r == 0)     return 0;    if(u == 0){     return r - 1;    }    if(r == 0){     return u - 1;    }    return Math.min(sec - 1, u - 1 + r - 1);   }   boolean isok(int sec){    int up = x - 1;    int down = n - x;    int right = n - y;    int left = y - 1;    int u = 0, d = 0, r = 0, l = 0;    int total = 1;    int add = 4;    for(int i = 1; i <= sec; i++){     int cc = 0;     if(i > up && ++cc > 0) u++;     if(i > down && ++cc > 0) d++;     if(i > right && ++cc > 0) r++;     if(i > left && ++cc > 0) l++;     total += add - cc;     total -= Math.max(0, f(u, r, i));     total -= Math.max(0, f(u, l, i));     total -= Math.max(0, f(d, r, i));     total -= Math.max(0, f(d, l, i));     if(total >= c) return true;     add += 4;    }    return false;   }   public void solve() {    n = in.nextInt();    x = in.nextInt();    y = in.nextInt();    c = in.nextInt();    if(c == 1){     out.println(0);     return;    }    int lo = 0, hi = 60000;    while(lo < hi){     int mid = (lo + hi)/2;     if(isok(mid)){      hi = mid;     }     else{      lo = mid + 1;     }    }    out.println(lo);   }   public Solution(Scanner in, PrintStream out) {    this.in = in;    this.out = out;   }   Scanner in;   PrintStream out;  } }
5	public class C {  public static void main(String... args) {   Scanner sc = new Scanner(System.in);     int n = sc.nextInt();   sc.nextLine();   int[] x = new int[n];     int max=0, pos=-1;   for(int i=0; i<n; i++) {    x[i]=sc.nextInt();    if (max<x[i]) {     max=x[i];     pos=i;    }   }   x[pos] = (max==1) ? 2 : 1;     Arrays.sort(x);   for(int i=0; i<n; i++)    System.out.print(x[i]+" ");  }  }
4	public class C { Scanner in; PrintWriter out;  String INPUT = "";  void solve() {  int n = ni();  int m = ni();  int k = ni();  int[] x = new int[k];  int[] y = new int[k];  for(int i = 0;i < k;i++){  x[i] = ni() - 1;  y[i] = ni() - 1;  }  int max = -1;  int maxi = -1;  int maxj = -1;  for(int i = 0;i < n;i++){  for(int j = 0;j < m;j++){   int min = Integer.MAX_VALUE;   for(int l = 0;l < k;l++){   min = Math.min(min, Math.abs(x[l] - i) + Math.abs(y[l] - j));   }   if(min > max){   max = min;   maxi = i;   maxj = j;   }  }  }   out.println((maxi+1) + " " + (maxj+1)); }  void run() throws Exception {  in = INPUT.isEmpty() ? new Scanner(new File("input.txt")) : new Scanner(INPUT);  out = INPUT.isEmpty() ? new PrintWriter("output.txt") : new PrintWriter(System.out);  solve();  out.flush(); }   public static void main(String[] args) throws Exception {  new C().run(); }  int ni() { return Integer.parseInt(in.next()); } void tr(Object... o) { if(INPUT.length() != 0)System.out.println(o.length > 1 || o[0].getClass().isArray() ? Arrays.deepToString(o) : o[0]); } static String join(int[] a, int d){StringBuilder sb = new StringBuilder();for(int v : a){sb.append(v + d + " ");}return sb.toString();} }
1	public class _1000_A {  public static void main(String[] args) throws IOException {  HashMap<String, Integer> map1 = new HashMap<>(), map2 = new HashMap<>(); int N = readInt();  for(int i = 1; i<=N; i++) {  String s = read(); if(!map1.containsKey(s)) map1.put(s, 1); else map1.put(s, map1.get(s)+1);  }  int tot = 0; for(int i = 1; i<=N; i++) {  String s = read(); if(!map2.containsKey(s)) map2.put(s, 1); else map2.put(s, map2.get(s)+1);  }  for(String s : map2.keySet()) {  tot += Math.max(0, map2.get(s) - (map1.containsKey(s) ? map1.get(s) : 0));  }  println(tot); exit(); }  final private static int BUFFER_SIZE = 1 << 16; private static DataInputStream din = new DataInputStream(System.in); private static byte[] buffer = new byte[BUFFER_SIZE]; private static int bufferPointer = 0, bytesRead = 0; static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  public static 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 static String read() throws IOException {  byte[] ret = new byte[1024];  int idx = 0;  byte c = Read();  while (c <= ' ') {  c = Read();  }  do {  ret[idx++] = c;  c = Read();  } while (c != -1 && c != ' ' && c != '\n' && c != '\r');  return new String(ret, 0, idx); }  public static int readInt() 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 static long readLong() 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 static double readDouble() 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 static void fillBuffer() throws IOException {  bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);  if (bytesRead == -1)  buffer[0] = -1; }  private static byte Read() throws IOException {  if (bufferPointer == bytesRead)  fillBuffer();  return buffer[bufferPointer++]; }  static void print(Object o) {  pr.print(o); }  static void println(Object o) {  pr.println(o); }  static void flush() {  pr.flush(); }  static void println() {  pr.println(); }  static void exit() throws IOException {  din.close();  pr.close();  System.exit(0); } }
5	public class Village{ static class House implements Comparable<House>{  public double center, length;  public House(double center, double length){  this.center = center;  this.length = length;  }  public double getRight(){  return center + length/2;  }  public double getLeft(){  return center - length/2;  }  public int compareTo(House h){  return this.center < h.center ? -1 : this.center == h.center ? 0 : 1;  }  } public static void main(String[] args){  Scanner in = new Scanner(System.in);  String[] fline = in.nextLine().split("\\s+");  int N = Integer.parseInt(fline[0]);  int T = Integer.parseInt(fline[1]);  House[] houses = new House[N];  for (int i = 0; i < N; i++){  String[] house = in.nextLine().split("\\s+");  houses[i] = new House(Double.parseDouble(house[0]), Double.parseDouble(house[1]));  }  Arrays.sort(houses);  int count = 2;  for (int i = 0; i < houses.length - 1; i++){    double diff = houses[i+1].getLeft() - houses[i].getRight();  if (diff < T) continue;  if (Math.abs(diff - T) < 1E-12) count++;  else count+=2;  }  System.out.println(count); } }
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);  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 d = in.nextInt();  Set<Integer> pts = new HashSet<>();  int[] x = in.nextIntArray(n);  for (int i = 0; i < n; i++) {   pts.add(x[i] - d);   pts.add(x[i] + d);  }  Set<Integer> ans = new HashSet<>();  for (int pt : pts) {   int min = (int) (1e9 + 10);   for (int i = 0; i < n; i++) {   min = Math.min(Math.abs(x[i] - pt), min);   }   if (min >= d) {   ans.add(pt);   }  }  out.println(ans.size());  }  }  static class InputReader {  private InputStream stream;  private byte[] buf = new byte[1 << 13];  private int curChar;  private int numChars;  public InputReader(InputStream stream) {  this.stream = stream;  }  public 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 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 static boolean isSpaceChar(int c) {  return c == 32 || c == 10 || c == 13 || c == 9 || c == -1;  }  public int[] nextIntArray(int n) {  int[] arr = new int[n];  for (int i = 0; i < n; i++) {   arr[i] = nextInt();  }  return arr;  }  } }
4	public class C { public static void main(String[] args) throws Exception {  final int fuck = 2001;  Scanner in = new Scanner(new File("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  int n = in.nextInt(), m = in.nextInt();  int[] D = new int[ fuck*fuck ], Q = new int[ fuck*(fuck + 1) ],  dx = new int[] { 1, -1, 0, 0},  dy = new int[] { 0, 0, -1, 1};  Arrays.fill(D, -1);  int H = -1, T = 0;  int k = in.nextInt(), ans = 0;  for(int i = 0; i < k; ++i) {  int x = in.nextInt(), y = in.nextInt();  D[x * fuck + y] = 0;   ++H; H %= Q.length;  ans = Q[H] = x * fuck + y;  }   while(H >= T) {  int idx = Q[T++]; T %= Q.length;  int x = idx / fuck, y = idx % fuck;  for(int i = 0; i < 4; ++i) {   int wtf = (dx[i] + x) * fuck + (dy[i] + y);   if(dx[i] + x <= n && dx[i] + x >= 1 && dy[i] + y <= m && dy[i] + y >= 1 && D[wtf] == -1) {   D[wtf] = D[idx] + 1;   ++H; H %= Q.length;   Q[H] = wtf;    if(D[wtf] >= D[ans])    ans = wtf;   }  }  }  out.println((ans / fuck) + " " + (ans % fuck));  out.close();  in.close(); } }
4	public class Main{  public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));  static long MOD = (long) (1e9 + 7);   static long MOD2 = MOD * MOD;  static FastReader sc = new FastReader();  static int pInf = Integer.MAX_VALUE;  static int nInf = Integer.MIN_VALUE;  static long ded = (long)(1e17)+9;  public static void main(String[] args) throws Exception {   int test = 1;   for (int i = 1; i <= test; i++){    solve();   }   out.flush();   out.close();  }  static int n,m;  static int[][] hor,ver;  static Long[][][] dp;  static void solve(){   n = sc.nextInt();   m = sc.nextInt();   int k = sc.nextInt();   dp = new Long[n+1][m+1][k+1];   hor = new int[n][m-1];   ver = new int[n-1][m];   for(int i = 0; i < n; i++){    for(int j = 0; j < m-1; j++){     hor[i][j] = sc.nextInt();    }   }   for(int i = 0; i < n-1; i++){    for(int j = 0; j < m; j++){     ver[i][j] = sc.nextInt();    }   }   if(k%2==1){    for(int i = 0; i < n; i++){     for(int j = 0; j < m; j++){      out.print(-1+" ");     }     out.println();    }    return;   }   k = k/2;   for(int i = 0; i < n; i++){    for(int j = 0; j < m; j++){     long[] dp = new long[k+1];     for(int l = 1; l <= k; l++){      dp[l] = cal(i,j,l);     }     for(int l = 1; l <= k; l++){      for(int g = 1; g < l; g++){       dp[l] = Math.min(dp[l],dp[g]+dp[l-g]);      }     }     out.print(2*dp[k]+" ");    }    out.println();   }  }  static long cal(int i, int j,int k){   if(k==0)return 0;   if(dp[i][j][k]!=null)return dp[i][j][k];   long ans = ded;   for(int h = 0; h < 4; h++){    int ni = i+di[h];    int nj = j+dj[h];    if(e(ni,nj)){     int cost = 0;     if(ni==i){      if(nj>j){       cost = hor[i][j];      }else{       cost = hor[i][nj];      }     }if(nj==j){      if(ni>i){       cost = ver[i][j];      }else{       cost = ver[ni][j];      }     }     ans = Math.min(ans,(cost)+cal(ni,nj,k-1));    }   }   return dp[i][j][k] = ans;  }  static int[] di = new int[]{0,-1,0,1};  static int[] dj = new int[]{-1,0,1,0};  static boolean e(int i, int j){   return i>=0&&j>=0&&i<n&&j<m;  }  static class Pair implements Comparable<Pair> {   int x;   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;   }   @Override   public String toString() {    return "Pair{" + "x=" + x + ", y=" + y + '}';   }   public boolean equals(Pair o){    return this.x==o.x&&this.y==o.y;   }  }  public static long mul(long a, long b) {   return ((a % MOD) * (b % MOD)) % MOD;  }  public static long add(long a, long b) {   return ((a % MOD) + (b % MOD)) % MOD;  }  public static long c2(long n) {   if ((n & 1) == 0) {    return mul(n / 2, n - 1);   } else {    return mul(n, (n - 1) / 2);   }  }   static final Random random = new Random();  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 long countSetBits(long n) {   if (n == 0) return 0;   return 1 + countSetBits(n & (n - 1));  }   static long gcd(long A, long B) {   if (B == 0) return A;   return gcd(B, A % B);  }   static long fastExpo(long x, long n) {   if (n == 0) return 1;   if ((n & 1) == 0) return fastExpo((x * x) % MOD, n / 2) % MOD;   return ((x % MOD) * fastExpo((x * x) % MOD, (n - 1) / 2)) % MOD;  }   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 <= Math.sqrt(n); i += 6)    if (n % i == 0 || n % (i + 2) == 0) return false;   return true;  }  public static long modinv(long x) {   return modpow(x, MOD - 2);  }  public static long modpow(long a, long b) {   if (b == 0) {    return 1;   }   long x = modpow(a, b / 2);   x = (x * x) % MOD;   if (b % 2 == 1) {    return (x * a) % MOD;   }   return x;  }   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;   }  } }
5	public class Twins {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[] val = new int[n];   for (int i=0; i<n; i++)    val[i] = in.nextInt();   Arrays.sort(val);   int sum = 0, count = 0;   for (int i=n-1; i>=0; i--) {    count++;    sum += val[i];    int his = 0;    for (int j=0; j<i; j++) his += val[j];    if (his < sum) break;   }   System.out.println(count);  } }
3	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[] arr = new int[n];   arr[0] = sc.nextInt();   for (int i = 1; i < n; i++) {    arr[i] = arr[i - 1] + sc.nextInt();   }   HashMap<Integer, List<Pair>> map = new HashMap<>();   for (int i = 0; i < n; i++) {    if (map.containsKey(arr[i])) map.get(arr[i]).add(new Pair(0, i));    else {     List<Pair> l = new ArrayList<>();     l.add(new Pair(0, i));     map.put(arr[i], l);    }    for (int j = 1; j <= i; j++) {     int ss = arr[i] - arr[j - 1];     if (map.containsKey(ss)) map.get(ss).add(new Pair(j, i));     else {      List<Pair> l = new ArrayList<>();      l.add(new Pair(j, i));      map.put(ss, l);     }    }   }   List<Pair> el = null;   for (List<Pair> value : map.values()) {    value.sort(Comparator.comparingInt(Pair::getStart));    ArrayList<Pair> ps = new ArrayList<>();    Pair last = value.get(0);    for (int i = 1; i < value.size(); i++) {     if (last.getEnd() < value.get(i).getStart()) {      ps.add(last);      last = value.get(i);     }     else if (last.getEnd() > value.get(i).getEnd()) last = value.get(i);    }    ps.add(last);    if (el == null) el = ps;    else if (ps.size() > el.size()) el = ps;   }   System.out.println(el.size());   for (Pair pair : el) {    System.out.println((pair.getStart() + 1) + " " + (pair.getEnd() + 1));   }  } } class Pair {  private final int start;  private final int end;  public int getStart() {   return start;  }  public int getEnd() {   return end;  }  public Pair(int start, int end) {   this.start = start;   this.end = end;  } }
3	public class A {  FastScanner in;  PrintWriter out;  void solve() {   int n = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }   Arrays.sort(a);   int res = 0;   for (int i = 0; i < n; i++) {    boolean ok = false;    for (int j = 0; j < i; j++) {     if (a[i] % a[j] == 0) {      ok = true;     }    }    if (!ok) {     res++;    }   }   out.println(res);  }  void run() {   try {    in = new FastScanner(new File("A.in"));    out = new PrintWriter(new File("A.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 A().runIO();  } }
3	public class Main {  public static void main(String[] args) {   solve(System.in,System.out);  }  static void solve(InputStream inStream, PrintStream printStream) {   Scanner in = new Scanner(inStream);   int n = in.nextInt();   long[] sums = new long[n];   for (int i = 1; i < n; i++) {    sums[i]=0;   }   sums[0]=1;   long mod = 1000000007;   for (int i = 0; i < n; i++) {    if (in.next().equals("f") ) {     for (int j = n-1; j > 0 ; j--) {      sums[j]=sums[j-1];     }     sums[0]=0;    } else {     for (int j = n-2; j >= 0 ; j--) {      sums[j] += sums[j+1];      if (sums[j]>=mod) {       sums[j]-=mod;      }     }    }   }      printStream.println(sums[0]);  }  }
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;  } } }
5	public class A111 {  public static void main(String args[])throws Exception  {   Scanner in=new Scanner(System.in);      PrintWriter pw=new PrintWriter(System.out);   int n,i,j,k=0,l;   n=in.nextInt();   int a[]=new int[n];   int sum=0,sum1=0;   for(i=0;i<n;i++)   {    a[i]=in.nextInt();    sum+=a[i];    }    Arrays.sort(a);   for(j=n-1;j>=0;j--)   {    sum1+=a[j];    k++;    if(sum1*2>sum)    break;    }    pw.println(k);   pw.flush();  } }
5	public class C { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = null;  private void solution() throws IOException {  int n = nextInt();  int[] mas = new int[n];  for (int i = 0; i < n; i++) {  mas[i] = nextInt();  }  Arrays.sort(mas);  if (mas[n - 1] == 1) {  mas[n - 1] = 2;  } else {  mas[n - 1] = 1;  }  Arrays.sort(mas);  for (int i = 0; i < n; i++) {  System.out.print(mas[i] + " ");  }  }  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 static void main(String args[]) throws IOException {  new C().solution(); } }
0	public class A { public static void main(String[] args){  FastScanner sc = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  String cur = sc.nextToken();  int first = Integer.parseInt(cur);  if(cur.length() > 1){  String second = cur.substring(0,cur.length()-1);  if(Character.isDigit(second.charAt(second.length()-1))){   first = Math.max(first, Integer.parseInt(second));  }  }   if(cur.length() > 2){  String third = cur.substring(0,cur.length()-2) + cur.charAt(cur.length()-1);  if(Character.isDigit(cur.charAt(cur.length()-2))){   first = Math.max(first, Integer.parseInt(third));  }  }  System.out.println(first);  out.close(); }  public static class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner(String s) {  try {   br = new BufferedReader(new FileReader(s));  } catch (FileNotFoundException e) {     e.printStackTrace();  }  }  public FastScanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  String nextToken() {  while (st == null || !st.hasMoreElements()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {      e.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(nextToken());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  } } }
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());  }  }
1	public class q1 { public static void main(String[] args)  {  Scanner s=new Scanner(System.in);  int n=s.nextInt();  int[] arr1=new int[9];  int[] arr2=new int[9];  String ss;  s.nextLine();  for(int i=0;i<n;i++)  {  ss=s.nextLine();  if(ss.equals("M"))   arr1[0]++;  else if(ss.equals("S"))   arr1[1]++;  else if(ss.equals("L"))   arr1[2]++;  else if(ss.equals("XS"))   arr1[3]++;  else if(ss.equals("XL"))   arr1[4]++;  else if(ss.equals("XXS"))   arr1[5]++;  else if(ss.equals("XXL"))   arr1[6]++;  else if(ss.equals("XXXS"))   arr1[7]++;  else if(ss.equals("XXXL"))   arr1[8]++;  }  for(int i=0;i<n;i++)  {  ss=s.nextLine();  if(ss.equals("M"))   arr2[0]++;  else if(ss.equals("S"))   arr2[1]++;  else if(ss.equals("L"))   arr2[2]++;  else if(ss.equals("XS"))   arr2[3]++;  else if(ss.equals("XL"))   arr2[4]++;  else if(ss.equals("XXS"))   arr2[5]++;  else if(ss.equals("XXL"))   arr2[6]++;  else if(ss.equals("XXXS"))   arr2[7]++;  else if(ss.equals("XXXL"))   arr2[8]++;  }  int min;  for(int i=0;i<9;i++)  {  if(arr1[i]<arr2[i])   min=arr1[i];  else   min=arr2[i];  arr1[i]-=min;  arr2[i]-=min;  }  int sum=0;  for(int i=0;i<9;i++)  {  sum+=arr1[i];  }  System.out.println(sum);   } }
4	@SuppressWarnings("unused") public class round35C {  static class state{   int x, y, time;   public state(int xx, int yy, int t){    x = xx;    y = yy;    time = t;   }  }  static int N,M;  static int [] dx = new int [] {1,-1,0,0};  static int [] dy = new int [] {0,0,1,-1};  static Queue<state> bfs = new LinkedList<round35C.state>();  public static Point runBFS(){   boolean [][] vis = new boolean [N + 1][M + 1];   int max = -(int)1e9;   int bestx = -1;   int besty = -1;   while(!bfs.isEmpty()){    state p = bfs.poll();    int x = p.x;    int y = p.y;    int time = p.time;    if(vis[x][y])     continue;    vis[x][y] = true;    if(time > max){     max = time;     bestx = x + 1;     besty = y + 1;    }    for(int i = 0 ; i < 4 ; ++i){     int nx = x + dx[i];     int ny = y + dy[i];     if(nx < 0 || ny < 0 || nx >= N || ny >= M)      continue;     if(vis[nx][ny] == false)      bfs.offer(new state(nx, ny, time + 1));    }   }   return new Point(bestx, besty);  }  public static void main(String[] args)throws IOException {   BufferedReader br = new BufferedReader(new FileReader("input.txt"));   PrintWriter out = new PrintWriter("output.txt");   String [] use = null;   use = br.readLine().split(" ");   N = parseInt(use[0]);   M = parseInt(use[1]);   int K = parseInt(br.readLine());   use = br.readLine().split(" ");   for(int i = 0 ; i < 2 * K ; i += 2){    int f = parseInt(use[i]) - 1;    int t = parseInt(use[i + 1]) - 1;    bfs.offer(new state(f, t, 0));   }   Point ans = runBFS();   out.println(ans.x + " " + ans.y);   out.flush();   out.close();  } }
5	public class P015A {  public static void main(String[] args) {   Scanner inScanner = new Scanner(System.in);   int n = inScanner.nextInt();   int t = inScanner.nextInt();   House[] houses = new House[n];   for (int i = 0; i < n; i++)    houses[i] = new House(inScanner.nextInt(), inScanner.nextInt());   Arrays.sort(houses);   int sum = 2;   for (int i = 1; i < n; i++) {    double space = houses[i].leftX - houses[i - 1].rightX;    if (space >= t)     sum++;    if (space > t)     sum++;   }   System.out.println(sum);  }  private static class House implements Comparable<House> {   int x;   double leftX;   double rightX;   public House(int x, int size) {    super();    this.x = x;    leftX = x - (double) size / 2;    rightX = x + (double) size / 2;   }   @Override   public int compareTo(House o) {    return x - o.x;   }  } }
0	public class CFA_200 {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  long x = sc.nextLong();  long y = sc.nextLong();   System.out.println(Wilf_tree(x, y));   sc.close(); }  static long Wilf_tree(long a,long b) {  if(a==0||b==0)  return 0;  if(a>=b)  return a/b+Wilf_tree(a%b, b);  else  return b/a+Wilf_tree(a, b%a); } }
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; }   }
2	public class SportMafia {  int n,k; int nCand;  private void readData(BufferedReader bin) throws IOException {  String s = bin.readLine();  String []ss = s.split(" ");  n = Integer.parseInt(ss[0]);  k = Integer.parseInt(ss[1]); }  void printRes() {  System.out.println(nCand); }   private void calculate() {   double p;  p = -1.5 + Math.sqrt(2.25 + 2.0*(n+k));  nCand = (int)Math.round(n-p); }  public static void main(String[] args) throws IOException {   BufferedReader bin = new BufferedReader(   new InputStreamReader(System.in));  SportMafia l = new SportMafia();  l.readData(bin);  l.calculate();  l.printRes(); } }
5	public class Main2 {  public static void main(String[] args) throws Exception {   new Main2().run();  }  public void solve() throws Exception {   n = nextInt();   int a[]= new int[n], pos = 1;   for(int i=0; i<n; i++)    a[i] = nextInt();   Arrays.sort(a);   if(n == 1){    out.println("NO"); return;   }   boolean has = false;   for(; pos<n; pos++){    if(a[pos] != a[0]){     has = true;     break;    }   }   if(!has){    out.println("NO");   }   else{    out.println(a[pos]);   }  }  public int n, m;  public void run() throws Exception {   inter = new StreamTokenizer(new BufferedReader(new InputStreamReader(     System.in)));   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(new OutputStreamWriter(System.out));   solve();   out.flush();  }  public BufferedReader in;  public StreamTokenizer inter;  public PrintWriter out;  public int nextInt() throws Exception {   inter.nextToken();   return (int) inter.nval;  }  public String nextLine() throws Exception{   return in.readLine();  } }
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(); } }
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;     }           }
3	public class Test {  int readInt() {   int ans = 0;   boolean neg = false;   try {    boolean start = false;    for (int c = 0; (c = System.in.read()) != -1; ) {     if (c == '-') {      start = true;      neg = true;      continue;     } else if (c >= '0' && c <= '9') {      start = true;      ans = ans * 10 + c - '0';     } else if (start) break;    }   } catch (IOException e) {   }   return neg ? -ans : ans;  }  final int N = 5010;  final int M = 1_000_000_007;  long[][] dp = new long[2][N];  long[] sums = new long[N];  char[] p = new char[N];  Scanner sca = new Scanner(System.in);  void start() {   int n = Integer.parseInt(sca.nextLine());   int idx = 0;   Arrays.fill(dp[idx], 0);   dp[idx][0] = 1;   for (int i = 0; i < n; i++) p[i] = sca.nextLine().charAt(0);   for (int i = 0; i < n;) {    int nidx = idx ^ 1;    Arrays.fill(dp[nidx], 0);    Arrays.fill(sums, 0);    int j = i;    while (p[j] != 's') j++;    int levels = j - i;    i = j+1;    for (j = n; j >= 0; j--) {     sums[j] = sums[j + 1] + dp[idx][j];     if (sums[j] >= M) sums[j] -= M;    }    for (j = 0; j <= n; j++) {     int ind = j + levels;     if (ind > n) continue;     dp[nidx][ind] = sums[j];    }    idx = nidx;   }   long ans = 0;   for (int i = 0; i <= n; i++) {    ans += dp[idx][i];    if (ans >= M) ans -=M;   }   System.out.println(ans);  }  public static void main(String[] args) {   new Test().start();  } }
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();   }  } }
2	public class My { public static void main(String[] args) {  new My().go(); }   void go() {  Scanner in = new Scanner(System.in);  long n = in.nextLong();  int k = in.nextInt();  int mn = 0, mx = k + 1;  while (mn < mx) {  int mid = (mn + mx) / 2;  if (works(n, k, mid)) {   mx = mid;  } else {   mn = mid + 1;  }  }  if (mn > k) {  pl("-1");  } else {  pl((mn - 1) + "");  } }  boolean works(long n, int k, int use) {  return 1 + T(k - 1) - T(k - use) >= n; }  long T(int n) {  return n * (long)(n + 1) / 2; }  void p(String s) {  System.out.print(s); }  void pl(String s) {  System.out.println(s); } }
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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.nextInt();    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = in.nextInt();    }    Arrays.sort(a);    boolean[] dead = new boolean[n];    int ans = 0;    for (int i = 0; i < n; i++) {     if (dead[i]) {      continue;     }     ++ans;     for (int j = i; j < n; j++) {      if (a[j] % a[i] == 0) {       dead[j] = true;      }     }    }    out.println(ans);   }  }  static 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 {      st = new StringTokenizer(in.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }  } }
3	public class D {  private void solve() {   br = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   int n = nextInt(), m = nextInt();   boolean[][] used = new boolean[n + 1][m + 1];   for (int j = 1; j <= (m + 1) / 2; j++) {    int x1 = 1, x2 = n;    for (int i = 1; i <= n; i++) {     if (x1 <= n && !used[x1][j]) {      out.println(x1 + " " + j);      used[x1++][j] = true;     }     if (x2 > 0 && !used[x2][m - j + 1]) {      out.println(x2 + " " + (m - j + 1));      used[x2--][m - j + 1] = true;     }    }   }   out.close();  }  public static void main(String[] args) {   new D().solve();  }  private BufferedReader br;  private StringTokenizer st;  private PrintWriter out;  private String next() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     throw new RuntimeException(e);    }   }   return st.nextToken();  }  private int nextInt() {   return Integer.parseInt(next());  }  private long nextLong() {   return Long.parseLong(next());  }  private double nextDouble() {   return Double.parseDouble(next());  } }
0	public class Test{  public static void main(String[] args) {   Scanner in= new Scanner(System.in);   int n=in.nextInt();   if(n%7==0 || n%4==0 || n%47==0 || n%74==0 || n%447==0 || n%474==0 || n%477==0 || n%747==0 || n%774==0){    System.out.println("YES");   }else    System.out.println("NO");    } }
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);   TaskE solver = new TaskE();   solver.solve(1, in, out);   out.close();  }  static class TaskE {   int n;   double k;   boolean[][] g;   public void solve(int testNumber, InputReader in, OutputWriter out) {    n = in.readInt();    k = in.readInt();    g = new boolean[n][n];    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      g[i][j] = in.readInt() == 1;     }    }    double answer = solve();    out.printFormat("%.20f", answer);   }   private double solve() {    int firstPartSize = g.length / 2;    int secondPartSize = g.length - firstPartSize;    int[] firstPart = findMaxCliqueSize(firstPartSize);    int m1Full = (1 << firstPartSize) - 1;    int maxCliqueSize = 1;    for (int m = 0; m < 1 << secondPartSize; m++) {     if (isClique(secondPartSize, m, firstPartSize)) {      int m1 = m1Full;      for (int j = 0; j < secondPartSize; j++) {       if (bit(m, j)) {        for (int i = 0; i < firstPartSize; i++) {         if (bit(m1, i) && !g[i][j + firstPartSize]) {          m1 ^= 1 << i;         }        }       }      }      int firstCliqueSize = firstPart[m1];      int secondCliqueSize = Integer.bitCount(m);      int curCliqueSize = firstCliqueSize + secondCliqueSize;      if (curCliqueSize > maxCliqueSize) {       maxCliqueSize = curCliqueSize;      }     }    }    return k * k * (maxCliqueSize - 1) / (2 * maxCliqueSize);   }   private int[] findMaxCliqueSize(int size) {    int[] dp = new int[1 << size];    for (int m = 1; m < 1 << size; m++) {     if (isClique(size, m, 0)) {      dp[m] = Integer.bitCount(m);     }    }    for (int m = 1; m < 1 << size; m++) {     for (int i = 0; i < size; i++) {      if ((m >> i & 1) == 0) {       dp[m | (1 << i)] = Math.max(dp[m | (1 << i)], dp[m]);      }     }    }    return dp;   }   private boolean isClique(int size, int m, int offset) {    for (int i = 0; i < size; i++) {     if (bit(m, i)) {      for (int j = i + 1; j < size; j++) {       if (bit(m, j) && !g[i + offset][j + offset]) {        return false;       }      }     }    }    return true;   }   private boolean bit(int m, int b) {    return (m >> b & 1) != 0;   }  }  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 printFormat(String format, Object... objects) {    writer.printf(format, objects);   }   public void close() {    writer.close();   }  } }
0	public class Main { static Scanner scan = new Scanner (System.in); static PrintStream out = System.out;  static int n; static void solve () {  System.out.println (0 + " " + 0 + " " + n); }  public static void main (String[] args) {  n = scan.nextInt();  solve (); } }
3	public class PaintNumbers {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[] nums = new int[n];   for (int i = 0; i < n; i++) {    nums[i] = in.nextInt();   }   boolean[] visited = new boolean[n];   int min = Integer.MAX_VALUE;   int a = 0;   boolean cont = true;   while (cont) {    for (int i = 0; i < n; i++) {     if (!visited[i]) {      min = Math.min(min, nums[i]);     }    }    cont = false;    for (int i = 0; i < n; i++) {     if (!visited[i] && nums[i] % min == 0) {      cont = true;      visited[i] = true;     }    }    a++;    min = Integer.MAX_VALUE;   }   System.out.println(a - 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 size = in.readInt();  int[] array = IOUtils.readIntArray(in, size);  Arrays.sort(array);  if (array[size - 1] == 1)  array[size - 1] = 2;  else  array[size - 1] = 1;  Arrays.sort(array);  out.printLine(Array.wrap(array).toArray()); } } 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 static boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  } class OutputWriter { private final PrintWriter writer;  public OutputWriter(OutputStream outputStream) {  writer = new PrintWriter(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; }  } abstract class Array<T> extends AbstractList<T> {  public static List<Integer> wrap(int...array) {  return new IntArray(array); }  protected static class IntArray extends Array<Integer> {  protected final int[] array;  protected IntArray(int[] array) {  this.array = array;  }  public int size() {  return array.length;  }  public Integer get(int index) {  return array[index];  }  public Integer set(int index, Integer value) {  int result = array[index];  array[index] = value;  return result;  } }  }
2	public class Main { public static void main (String[] args) throws java.lang.Exception {  Scanner scan=new Scanner(System.in);  long x=scan.nextLong();  long k=scan.nextLong();  long MOD=1000000007;  if(x==0){System.out.println(0);return;}  x%=MOD;  long a=(new Num()).pow(2L,k+1);  long b=(new Num()).pow(2L,k);  long res=(a*x)%MOD-b+1;  if(res<0){res+=MOD;}  System.out.println(res%MOD); } } class Num{ long MOD=1000000007; long pow(long x,long k){  long base=x%MOD;  long res=1;  while(k>0){  if((k&1)==1){   res=(res*base)%MOD;  }  base=(base*base)%MOD;  k>>=1;  }  return res; } }
2	public class main { InputStream is; PrintWriter out; static long mod=pow(10,9)+7; int dx[]= {0,0,1,-1},dy[]={+1,-1,0,0}; void solve() {  long x=nl();  long k=nl();  if(x==0)  {  out.println(0);  return;  }  long term=(pow(2,k,mod))%mod;  long last=((x%mod)*pow(2,k+1,mod))%mod;  long sumdom=((2*last)%mod+(((term-1+mod)%mod)*((-2+mod)%mod))%mod)%mod;  sumdom=(sumdom*term)%mod;  sumdom=(sumdom*pow(2,mod-2,mod))%mod;  sumdom=(sumdom*pow(term,mod-2,mod))%mod;  out.println(sumdom);    } int bsdown(ArrayList<Integer> al,int l) {  int low=0,high=al.size()-1,ans=-1;  while(low<=high) {  int mid=low+(high-low)/2;  if(al.get(mid)<=l) {   low=mid+1;   ans=mid;  }else   high=mid-1;   }  return ans; } 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 arr[][]; int small[]; void pre(int n) {  small=new int[n+1];  for(int i=2;i*i<=n;i++)  {  for(int j=i;j*i<=n;j++)  {   if(small[i*j]==0)   small[i*j]=i;  }  }  for(int i=0;i<=n;i++)  {  if(small[i]==0)   small[i]=i;  } } public static int count(long 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>{     long x;   long y,k;   int i,h;   String s;  Pair (long x,long y,int i){  this.x=x;  this.y=y;  this.i=i;  }     public int compareTo(Pair o) {  if(this.x!=o.x)   return Long.compare(this.x,o.x);  return Long.compare(this.y,o.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() ;  }         @Override   public String toString() {    return "("+x + " " + y +" "+k+" "+i+" )";   }    }     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(x%y==0)  return y;  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 main().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();  }  }  }
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; } }
6	public class Main {  static ArrayList<Integer> cols;  static int ans, n, a[][];  public static void main(String[] args) throws Exception {   Scanner sc = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int tc = sc.nextInt();   while (tc-- > 0) {    ans = 0;    n = sc.nextInt();    int m = sc.nextInt();    boolean[] taken = new boolean[m];    PriorityQueue<Pair> pq = new PriorityQueue<>();    a = new int[n][m];    for (int i = 0; i < n; i++)     for (int j = 0; j < m; j++) {      int cur = sc.nextInt();      pq.add(new Pair(i, j, cur));      a[i][j] = cur;     }    cols = new ArrayList<>();    while (!pq.isEmpty() && cols.size() < 8) {     Pair cur = pq.remove();     if (!taken[cur.j]) cols.add(cur.j);     taken[cur.j] = true;    }    solve(0,new int [cols.size()]);    out.println(ans);   }   out.flush();   out.close();  }  static void solve(int i, int[] p) {   if (i == cols.size()) {    int[] max = new int[n];    for (int k = 0; k < cols.size(); k++) {     int j = cols.get(k);     for (int ii = 0; ii < n; ii++) {      int idx = (ii + p[k]) % n;      max[idx] = Math.max(max[idx], a[ii][j]);     }    }    int poss = 0;    for (int x : max)     poss += x;    ans = Math.max(ans, poss);    return;   }   for (int j = 0; j < n; j++) {    p[i] = j;    solve(i + 1, p);   }  }   static class Pair implements Comparable<Pair> {   int i, j, val;   public Pair(int i, int j, int val) {    this.i = i;    this.j = j;    this.val = val;   }   @Override   public int compareTo(Pair o) {    return o.val - val;   }  }   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());   }   int[] nextIntArray(int n) throws IOException {    int[] a = new int[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }   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);   }  } }
5	public class Main{ public static void main(String[] args){  new Main().run(); }  void run(){  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int t = sc.nextInt() * 2;  H[] tbl = new H[n];  for(int i = 0; i < n; i++)tbl[i] = new H(sc.nextInt()*2, sc.nextInt()*2);  Arrays.sort(tbl);  TreeSet<Integer> cand = new TreeSet<Integer>();   for(int i = 0; i < n; i++){  int left = tbl[i].x - tbl[i].len / 2 - t / 2;  if(!cand.contains(left)){   if(i > 0 && tbl[i-1].x + tbl[i-1].len/2 > left - t/2){      }else{   cand.add(left);   }  }  int right = tbl[i].x + tbl[i].len / 2 + t/2;  if(!cand.contains(right)){   if(i < n-1 && tbl[i+1].x - tbl[i+1].len/2 < right + t/2){      }else{   cand.add(right);   }  }  }  System.out.println(cand.size()); }  class H implements Comparable<H>{  int x, len;  H(int a, int b){  x = a;  len = b;  }  public int compareTo(H h){  return this.x - h.x;  } } }
1	public class Tsk1 {  static void metod() throws Exception {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   String s = in.next();   String ss = s + s;   int t = 0;   for (int i = 0; i < n; i++) {    if (s.charAt(i) == 'T') {     t++;    }   }   if (t == 1 || t == n - 1) {    System.out.println(0);   } else {    int sum = 0;    for (int i = 0; i < t; i++) {     if (s.charAt(i) == 'T') {      sum++;     }    }       int max = sum;    for (int i = 0; i < s.length(); i++) {     if (ss.charAt(i) == 'T') {      if (ss.charAt(i + t) == 'H') {       sum--;      }     } else {      if (ss.charAt(i + t) == 'T') {       sum++;       max = Math.max(max, sum);      }     }    }    System.out.println(t - max);   }  }  public static void main(String[] args) throws Exception {   Tsk1.metod();  } }
5	public class A_135 {    public static void main(String[] args) {   Scanner in=new Scanner(System.in);     int n=in.nextInt();     int[] mas=new int[n];     for(int i=0;i<n;i++){    mas[i]=in.nextInt();   }     Arrays.sort(mas);     PrintWriter out=new PrintWriter(System.out);     boolean isEd=true;   for(int i=0;i<n;i++)    if(mas[i]!=1){     isEd=false;     break;    }     if(!isEd)    out.print('1');     for(int i=0;i<n-1;i++){    out.print(' ');    out.print(mas[i]);   }     if(isEd)    out.print(" 2");     out.flush();  } }
5	public class Main { public static void main(String[] args) {  Scanner in =new Scanner(System.in);  int n = in.nextInt();  int k = in.nextInt();  int[] arr = new int[n];  for(int i = 0; i < n; i++)  arr[i] = in.nextInt();  for(int i = n-1; i > 0; i--)  arr[i] -= arr[i-1];  arr[0] = 0;  Arrays.sort(arr);  long sum = 0;  for(int i = n-k; i >= 0; i--)  sum += arr[i];  System.out.println(sum); } }
6	public class C {  static int n, m, a[][]; static int[][] memo;  static int[] getCol(int col, int shift) {  int[] ans = new int[n];  for (int i = 0, j = shift; i < n; i++, j = (j + 1) % n) {  ans[i] = a[j][col];  }  return ans;  }  static int dp(int col, int msk) {  if (col == m)  return 0;  if (memo[msk][col] != -1)  return memo[msk][col];  int ans = 0;  for (int shift = 0; shift < n; shift++) {  int[] currCol = getCol(col, shift);  for (int nxtMsk = 0; nxtMsk < 1 << n; nxtMsk++) {   if ((nxtMsk & msk) != msk)   continue;   int curr = 0;   int diff = msk ^ nxtMsk;   for (int i = 0; i < n; i++)   if ((diff & 1 << i) != 0)    curr += currCol[i];   ans = Math.max(ans, dp(col + 1, nxtMsk) + curr);  }  }  return memo[msk][col] = ans; }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out);  int tc = sc.nextInt();  while (tc-- > 0) {  n = sc.nextInt();  m = sc.nextInt();  memo = new int[1 << n][m];  for (int[] x : memo)   Arrays.fill(x, -1);  a = new int[n][m];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++)   a[i][j] = sc.nextInt();  out.println(dp(0, 0));  }  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();  }  }  static void sort(int[] a) {  shuffle(a);  Arrays.sort(a); }  static void shuffle(int[] a) {  int n = a.length;  Random rand = new Random();  for (int i = 0; i < n; i++) {  int tmpIdx = rand.nextInt(n);  int tmp = a[i];  a[i] = a[tmpIdx];  a[tmpIdx] = tmp;  } } }
6	public class D {  Reader in = new Reader(System.in);  PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {   new D().run();  }  int n, m;  boolean[][] adjacency;  void run() throws IOException {   n = in.nextInt();   m = in.nextInt();   adjacency = new boolean[n+1][n];   for (int i = 0; i < m; i++) {    int u = in.nextInt(), v = in.nextInt();    adjacency[u-1][v-1] = adjacency[v-1][u-1] = true;   }   final int MAX_MASK = (1 << n) - 1;   long[][] dp = new long[MAX_MASK+1][n];   for (int i = 0; i < n; i++)    dp[1<<i][i] = 1;   long sum = 0;   for (int mask = 1; mask <= MAX_MASK; mask++) {    int lowestBit = first(mask);    for (int i = 0; i < n; i++) {     if (bit(i, mask) && i != lowestBit) {      for (int j = 0; j < n; j++) {       if (adjacency[j][i]) {        dp[mask][i] += dp[mask^(1<<i)][j];       }      }      if (count(mask) >= 3 && adjacency[lowestBit][i])       sum += dp[mask][i];     } else {          }    }   }   out.println(sum / 2);   out.flush();  }  int count(int mask) {   int count = 0;   while (mask > 0) {    if ((mask & 1) == 1)     count++;    mask >>= 1;   }   return count;  }  int first(int mask) {   int index = 0;   while (mask > 0) {    if ((mask & 1) == 1)     return index;    mask >>= 1;    index++;   }   return -1;  }  boolean bit(int index, int mask) {   return ((1 << index) & mask) > 0;  }  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() );   }  } }
0	public final class subtractions {  static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static FastScanner sc=new FastScanner(br);  static PrintWriter out=new PrintWriter(System.out);  static long solve(long a,long b) {  if(a<=0 || b<=0)  {  return 0;  }  else  {  long max=Math.max(a,b),min=Math.min(a,b);  long low=1,high=(long)(1e9);  while(low<high)  {   long mid=(low+high)>>1,val=(min*mid),curr=max-val;   if(curr<min)   {   high=mid;   }   else   {   low=mid+1;   }  }  return low+solve(min,max-(low*min));  } }  public static void main(String args[]) throws Exception {  int t=sc.nextInt();  while(t>0)  {  long a=sc.nextLong(),b=sc.nextLong();  out.println(solve(a,b));  t--;  }  out.close(); } } class FastScanner {  BufferedReader in;  StringTokenizer st;  public FastScanner(BufferedReader in) {   this.in = in;  }   public String nextToken() throws Exception {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  public String next() throws Exception {  return nextToken().toString(); }   public int nextInt() throws Exception {   return Integer.parseInt(nextToken());  }  public long nextLong() throws Exception {   return Long.parseLong(nextToken());  }  public double nextDouble() throws Exception {   return Double.parseDouble(nextToken());  } }
4	public class incendio {  void dbg(Object...os) { System.err.println(Arrays.deepToString(os)); }  static StringTokenizer _stk; static BufferedReader input; static PrintWriter output;  static String next(){return _stk.nextToken();} static int nextInt(){return Integer.parseInt(next());}  static String readln()throws IOException {String l=input.readLine();_stk=l==null?null:new StringTokenizer(l," ");return l;}  public static void main(String[] args) throws IOException {   input = new BufferedReader(new FileReader("input.txt"));   output = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));   new incendio();   output.close();  }    incendio() throws IOException {   readln();   M = nextInt(); N = nextInt();   readln();   final int K = nextInt();   int xf[]=new int[K], yf[]=new int[K];   readln();   for(int i=0; i<K; i++) {    xf[i]=nextInt();    yf[i]=nextInt();   }     int best=-1, xbest=0, ybest=0;   for(int i=1; i<=M; i++) {    for(int j=1; j<=N; j++) {     int dist=Integer.MAX_VALUE;     for(int k=0; k<K; k++) {      dist = Math.min(dist, Math.abs(i-xf[k])+Math.abs(j-yf[k]));     }     if(dist>best) {      best=dist;      xbest=i;      ybest=j;     }    }   }   output.println(xbest+" "+ybest);  }   int M, N; }
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 k = in.nextInt();   Team[] t = new Team[N];   for (int i=0; i<N; i++) t[i] = new Team(in.nextInt(), in.nextInt());   Arrays.sort(t);   int p_k = t[k-1].p, t_k = t[k-1].t;   int count = 0;   for (int i=0; i<N; i++) if (t[i].p==p_k && t[i].t ==t_k) count++;   out.println(count); } } class Team implements Comparable<Team>{  int p, t;  Team(int a, int b) { p=a; t=b;}  public int compareTo(Team g) {   if (p < g.p) return 1;   if (p > g.p) return -1;   if (t < g.t) return -1;   if (t > g.t) return 1;   return 0;  }  }
4	public class Main implements Runnable { Scanner in; PrintWriter out;  public static void main(String[] args) throws FileNotFoundException, IOException {  new Thread(new Main()).start(); }  public class Pair {  public long last;  public long count;  public int L;  Pair(long l, long c) {last = l; count = c;}  Pair(long l, long c, int L) {last = l; count = c; this.L = L;} }  public void run() {  final String name = "B-small";    in = new Scanner(System.in);  out = new PrintWriter(System.out);     String s = in.next().trim();  int n = s.length();  boolean[][] a = new boolean[n][n];  for (int i = 0; i < n; ++i)  for (int j = i + 1; j < n; ++j)   a[i][j] = (s.charAt(i) == s.charAt(j));  int max = 0;  for (int i = 0; i < n; ++i)  for (int j = i + 1; j < n; ++j)  {   int k =0;   while (i + k < n && j + k < n && a[i + k][j + k])    ++k;     if (max < k)    max = k;  }   out.println(max);  out.flush(); } }
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)); } }
1	public class A { public static void main(String[] args){  Scanner in = new Scanner(System.in);  int n = in.nextInt();  int a[] = new int[100];  for (int i = 0;i<n;i++) a[i] = in.nextInt()%2;  if (a[0]==a[1] || a[0]==a[2]){  for (int i = 1;i<n;i++)   if (a[i] != a[0]) {   System.out.println(i+1);   break;   }  } else{  System.out.println(1);  } } }
2	public class Main {   static long[] dx = new long[]{0, 1, 0, -1}; static long[] dy = new long[]{-1, 0, 1, 0}; public static void main(String[] args) {  Scanner r = new Scanner(System.in);   long N = r.nextLong();  long X = r.nextLong();  long Y = r.nextLong();  long C = r.nextLong();   long lo = 0, hi = N * 2;   while(lo < hi){  long T = (lo + hi) / 2;    long[] NX = new long[4];  long[] NY = new long[4];    for(int d = 0; d < 4; d++){   NX[d] = X + dx[d] * T;   NY[d] = Y + dy[d] * T;  }    long ret = (T + 1) * (T + 1) + T * T;    ret -= half(1 - NY[0]);  ret -= half(NY[2] - N);  ret -= half(NX[1] - N);  ret -= half(1 - NX[3]);    ret += quarter(1 - NY[0] - (N - X + 1));  ret += quarter(1 - NY[0] - (X));  ret += quarter(NY[2] - N - (N - X + 1));  ret += quarter(NY[2] - N - (X));    if(ret < C)lo = T + 1;  else hi = T;  }   System.out.println(lo);   } private static long half(long x) {  if(x <= 0)return 0;  else return 2 * quarter(x) - x; } private static long quarter(long x){  if(x <= 0)return 0;  return x * (x + 1) / 2; } }
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();  } }
1	public class B1 {  static Scanner in;  public static void main( String[] args ) throws FileNotFoundException {   in = new Scanner( System.in );   int tn = in.nextInt();   for ( int i = 0; i < tn; i ++ ) {    String s = in.next();      char[] c = s.toCharArray();    boolean second = true;    second &= c[0] == 'R';    int r = s.indexOf( "C" );    if ( r > 0 ) {     second &= isNumber( s.substring( 1, r ) ) && isNumber( s.substring( r + 1 ) );    } else {     second = false;    }    if ( second ) {     System.out.println( toLetters( s.substring( r + 1 ) ) + s.substring( 1, r ) );    } else {     r = 0;     while ( c[r] >= 'A' && c[r] <= 'Z' ) {      r ++;     }     System.out.println( "R" + s.substring( r ) + "C" + fromLetters( s.substring( 0, r ) ) );    }       }  }  private static int fromLetters( String s ) {   int r = 0;   int l = s.length();   for ( int i = 0; i < l; i ++ ) {    r = r * 26 + s.charAt( i ) - 'A';   }   r ++;   for ( int i = 1, c = 26; i < l; i ++, c *= 26 ) {    r += c;   }   return r;  }  private static String toLetters( String s ) {   int x = new Integer( s ) - 1;   int c = 26;   int l = 1;   while ( true ) {    if ( x < c ) {     String r = "";     for ( int i = 0; i < l; i ++ ) {      r = ( char ) ( 'A' + x % 26 ) + r;      x /= 26;     }     return r;    }    x -= c;    c *= 26;    l ++;   }  }  private static boolean isNumber( String s ) {   try {    int x = new Integer( s );   } catch ( NumberFormatException e ) {    return false;   }   return true;  } }
3	public class paint { static PriorityQueue<Integer> sequence;  public static void main (String [] args) throws IOException {  BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out, true);  int numSeq = Integer.parseInt(f.readLine());  sequence = new PriorityQueue<Integer>();    StringTokenizer st = new StringTokenizer(f.readLine());  for(int i = 0; i < numSeq; i++) {   sequence.add(Integer.parseInt(st.nextToken()));  }    int numColors = 0;  while(sequence.size() > 0) {   numColors++;   int smallest = sequence.poll();   PriorityQueue<Integer> temp = new PriorityQueue<Integer>();   for(int each: sequence) {   if(each % smallest != 0) {    temp.add(each);   }   }   sequence = temp;  }    System.out.println(numColors);  out.close(); }  }
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);   TaskBR574D2 solver = new TaskBR574D2();   solver.solve(1, in, out);   out.close();  }  static class TaskBR574D2 {   public void solve(int testNumber, Scanner in, PrintWriter out) {    long n = in.nextLong();    long k = in.nextLong();    long r = (long) (Math.sqrt(9 + 8 * (n + k)) - 3) / 2;    out.println(n - r);   }  } }
5	public class A {   public static void main(String[] args) throws Exception {   int n = nextInt(), b = nextInt(), a = nextInt();     int[] mas = new int[n];   for(int i = 0; i<n; i++) {    mas[i] = nextInt();   }   Arrays.sort(mas);     if(mas[a - 1] == mas[a]) {    exit(0);   }     println(mas[a] - mas[a-1]);  }        private static StreamTokenizer in;  private static PrintWriter out;  private static BufferedReader inB;   private static boolean FILE=false;   private static int nextInt() throws Exception{   in.nextToken();   return (int)in.nval;  }   private static String nextString() throws Exception{   in.nextToken();   return in.sval;  }   static{   try {    out = new PrintWriter(FILE ? (new FileOutputStream("output.txt")) : System.out);    inB = new BufferedReader(new InputStreamReader(FILE ? new FileInputStream("input.txt") : System.in));   } catch(Exception e) {e.printStackTrace();}   in = new StreamTokenizer(inB);  }         private static void println(Object o) throws Exception {   out.println(o);   out.flush();  }  private static void exit(Object o) throws Exception {   println(o);   exit();  }  private static void exit() {   System.exit(0);  }  private static final int INF = Integer.MAX_VALUE;  private static final int MINF = Integer.MIN_VALUE;  }
4	public class ArFireAgain {   int n, m, k;  int dx[] = { 0, 0, 1, -1, 1, 1, -1, -1 };  int dy[] = { 1, -1, 0, 0, 1, -1, 1, -1 };  int[][] dist;  ArrayList<Pair> arr;    Scanner sc;  PrintWriter out;  public void solve() {   try {    sc = new Scanner(new FileReader("input.txt"));    out = new PrintWriter("output.txt");   } catch (FileNotFoundException e) {    e.printStackTrace();   }     n = sc.nextInt();   m = sc.nextInt();   k = sc.nextInt();   arr = new ArrayList<Pair>();   for (int i=0; i<k; i++) {    int x = sc.nextInt()-1;    int y = sc.nextInt()-1;    Pair p = new Pair(x, y);    arr.add(p);   }      Pair last = bfs();   out.println(last.x + " " + last.y);   out.flush();   out.close();  }   boolean inBoard(int x, int y) {   return x >= n || x < 0 || y >= m || y < 0;  }  boolean isValid(int x, int y) {   return x >= 0 && y >= 0 && x < n && y < m;  }  private Pair bfs() {     Queue<Pair> q = new LinkedList<Pair>();   dist = new int[n][m];      for (int i=0; i<n; i++) {    for (int j=0; j<m; j++) {     dist[i][j] = -1;    }   }      for (int i=0; i<k; i++) {    dist[arr.get(i).x][arr.get(i).y] = 0;    q.add(arr.get(i));   }      while(!q.isEmpty()) {    Pair cur = q.remove();    for (int d=0; d<4; d++) {     int X = cur.x + dx[d];     int Y = cur.y + dy[d];     if (isValid(X, Y) && dist[X][Y] == -1) {      dist[X][Y] = dist[cur.x][cur.y] + 1;      Pair p = new Pair(X, Y);      q.add(p);     }    }       }      Pair res = null;   int maxx = -1;   for (int i=0; i<n; i++) {    for (int j=0; j<m; j++) {     if (dist[i][j] > maxx) {      maxx = dist[i][j];      res = new Pair(i+1, j+1);     }    }   }   return res;  }    class Pair {   int x, y;   Pair(int x, int y) {    this.x = x;    this.y = y;   }  }  public static void main(String[] args) {   new ArFireAgain().solve();  } }
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(); } }
6	public class Template implements Runnable {  private void solve() throws IOException {   int n = nextInt();   int m = nextInt();   boolean[][] g = new boolean[n][n];   for (int i = 0; i < m; ++i) {    int a = nextInt() - 1;    int b = nextInt() - 1;    g[a][b] = true;    g[b][a] = true;   }     long[] am = new long[n + 1];   long[][] ways = new long[1 << n][n];   for (int start = 0; start < n; ++start) {    for (int mask = 0; mask < (1 << (n - start)); ++mask)     for (int last = start; last < n; ++last) {      ways[mask][last - start] = 0;     }    ways[1][0] = 1;    for (int mask = 0; mask < (1 << (n - start)); ++mask) {     int cnt = 0;     int tmp = mask;     while (tmp > 0) {      ++cnt;      tmp = tmp & (tmp - 1);     }     for (int last = start; last < n; ++last)      if (ways[mask][last - start] > 0) {       long amm = ways[mask][last - start];       for (int i = start; i < n; ++i)        if ((mask & (1 << (i - start))) == 0 && g[last][i]) {         ways[mask | (1 << (i - start))][i - start] += amm;        }       if (g[last][start])        am[cnt] += ways[mask][last - start];      }    }   }   long res = 0;   for (int cnt = 3; cnt <= n; ++cnt) {    if (am[cnt] % (2) != 0)     throw new RuntimeException();    res += am[cnt] / (2);   }   writer.println(res);  }   public static void main(String[] args) {   new Template().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	@SuppressWarnings("unused") public class A { public static void main(String[] args) throws Exception {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  TreeSet<Integer> set = new TreeSet<Integer>();  set.add(n);  try {  String s = Integer.toString(n);  s = s.substring(0, s.length() - 1);  set.add(Integer.parseInt(s));  } catch (Exception e) {  }  try {  String s = Integer.toString(n);  s = s.substring(0, s.length() - 2) + s.charAt(s.length() - 1);  set.add(Integer.parseInt(s));  } catch (Exception e) {  }  System.out.println(max(set)); } }
5	public class A { static int [] reverse = new int [257]; public static void main (String [] arg) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int [] A =new int [n];  for (int i = 0; i<A.length; ++i) A[i] = sc.nextInt();  Arrays.sort(A);  if (n == 1) {  System.out.println( (A[0] == 1) ? "2" : "1");  return;  } else if (A[0] == A[A.length-1] && A[0] == 1) {  System.out.print("1");  for (int i = 1; i<n-1; ++i) System.out.print(" " + A[i]);  System.out.println(" 2");  return;  } else if (A[0] == A[A.length-1]) {  System.out.print("1");  for (int i = 1; i<n; ++i) System.out.print(" " + A[i]);  System.out.println();  return;  }    for (int i = 0; i<A.length; ++i) {  int prev = (i == 0) ? Integer.MAX_VALUE : A[i-1];  int next = (i == A.length-1) ? Integer.MAX_VALUE : A[i+1];  int ans = Math.min(prev, Math.min(next, A[i]));  if (i == 0) ans = 1;    System.out.print((i == 0) ? "" + ans : " " + ans);  }  System.out.println();    }  }
3	public class CFC {  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();   long[] dp0 = new long[10 + n];   long[] dp1 = new long[10 + n];   long[] pre = new long[10 + n];   dp0[0] = 1;   String[] arr = new String[n];   for (int i = 0; i < n; i++) {    arr[i] = nextString();   }   String s = "s";   for (int i = 0; i < n; i++) {    Arrays.fill(dp1, 0);    if (i == 0) {     dp0[0] = 1;     dp1[0] = 1;    }    else {     if (arr[i - 1].equals(s)) {      for (int j = 0; j <= n + 5; j++) {       dp1[j] = pre[j];      }     }     else {      for (int j = 1; j <= n + 5; j++) {       dp1[j] = dp0[j - 1];      }     }    }    Arrays.fill(pre, 0);    pre[n + 5] = dp1[n + 5];    for (int j = n + 4; j >= 0; j--) {     pre[j] = pre[j + 1] + dp1[j];     pre[j] %= MOD;    }    for (int j = 0; j <= n + 5; j++) {     dp0[j] = dp1[j];    }   }   long res = 0;   for (int j = 0; j <= n + 5; j++) {    res += dp0[j];    res %= MOD;   }   out(res);  }  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;   }  }  int gcd(int a, int b) {   while(a != 0 && b != 0) {    int 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 CFC() 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 CFC();  }  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());  } }
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;   }  } }
0	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   String input = in.nextLine();   if (input.equals("1"))    System.out.println("NO");   else {    if (checkNum(input))     System.out.println("YES");    else {     int i = 2;     while (i < Integer.parseInt(input)) {      if (checkNum(i + "")) {       if (Integer.parseInt(input) % i != 0)        i++;       else        break;      } else       i++;     }     if (i == Integer.parseInt(input))      System.out.println("NO");     else      System.out.println("YES");    }   }  }  public static boolean checkNum(String s) {   int i = 0;   int flag = 0;   while (i < s.length()) {    if (s.charAt(i) == '4' || s.charAt(i) == '7') {     flag = 1;     i++;    } else     return false;   }   if (flag == 1)    return true;   return false;  } }
0	public class Main {  static long mod=((long)1e9)+7;  public static int gcd(int a,int b){if(b==0)return a;else return gcd(b,a%b);}  public static long pow_mod(long x,long y){long res=1;x=x%mod;while(y > 0){if((y & 1)==1)res=(res * x)%mod;y=y>>1;x =(x * x)%mod;}return res;}  public static int lower_bound(int[]arr,int val){int lo=0;int hi=arr.length-1;while(lo<hi){int mid=lo+((hi-lo+1)/2);if(arr[mid]==val){return mid;}else if(arr[mid]>val){hi=mid-1;}else lo=mid;}if(arr[lo]<=val)return lo;else return -1;}  public static int upper_bound(int[]arr,int val){int lo=0;int hi=arr.length-1;while(lo<hi){int mid=lo+((hi-lo)/2);if(arr[mid]==val){return mid;}else if(arr[mid]>val){hi=mid;;}else lo=mid+1;}if(arr[lo]>=val)return lo;else return -1;}   public static void main (String[] args) throws java.lang.Exception  {   Reader sn = new Reader();   Print p = new Print();   int n = sn.nextInt();   while((n--) > 0){    int a = sn.nextInt();    int b = sn.nextInt();    int small = Math.min(a , b);    int large = Math.max(a , b);    long steps = 0;    while(small != 0){     steps += (long)(large/small);     int large1 = small;     small = large % small;     large = large1;    }    p.printLine(Long.toString(steps));   }   p.close();  } } class Pair implements Comparable<Pair> {  int val;  int in;  Pair(int a, int b){  val=a;   in=b;  }  @Override  public int compareTo(Pair o) {  if(val==o.val)  return Integer.compare(in,o.in);  else  return Integer.compare(val,o.val);  }} class Reader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;   public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }   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 String readWord()throws IOException   {  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() 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();   }  } class Print {  private final BufferedWriter bw;  public Print()  {   bw=new BufferedWriter(new OutputStreamWriter(System.out));  }  public void print(String str)throws IOException  {   bw.append(str);  }  public void printLine(String str)throws IOException  {   print(str);   bw.append("\n");  }  public void close()throws IOException  {   bw.close();  }}
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);  } }
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();  } } }
3	@SuppressWarnings("Duplicates") public class solveLOL {  FastScanner in;  PrintWriter out;  boolean systemIO = true, multitests = false;  int INF = Integer.MAX_VALUE / 2;   void solve() {   int n = in.nextInt();   int arr[] = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = in.nextInt();   }   Arrays.sort(arr);   boolean used[] = new boolean[n];   int k = 0;   for (int i = 0; i < n; i++) {    if (!used[i]) {     used[i] = true;     for (int j = i + 1; j < n; j++) {      if (!used[j] && arr[j] % arr[i] == 0) {       used[j] = true;      }     }     k++;    }   }   System.out.println(k);   }  class pair implements Comparable<pair> {   int a;   int b;   pair(int A, int B) {    this.a = A;    this.b = B;   }   public int compareTo(pair o) {    return a != o.a ? Double.compare(a, o.a) : b - o.b;   }  }  void shuffleArray(long[] ar) {   Random rnd = ThreadLocalRandom.current();   for (int i = ar.length - 1; i > 0; i--) {    int index = rnd.nextInt(i + 1);    long a = ar[index];    ar[index] = ar[i];    ar[i] = a;   }  }  void printArray(long[] ar) {   for (long k : ar) {    System.out.print(k + " ");   }   System.out.println();  }  void reverseArray(long[] ar) {   for (int i = 0, j = ar.length - 1; i < j; i++, j--) {    long a = ar[i];    ar[i] = ar[j];    ar[j] = a;   }  }  private void run() throws IOException {   if (systemIO) {    in = new solveLOL.FastScanner(System.in);    out = new PrintWriter(System.out);   } else {    in = new solveLOL.FastScanner(new File("input.txt"));    out = new PrintWriter(new File("output.txt"));   }   for (int t = multitests ? in.nextInt() : 1; t-- > 0; )    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 solveLOL().run();  } }
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()); }  final int oo = Integer.MAX_VALUE;  int [][]s; int n, ALL; public void run() throws Exception{  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  n = nextInt();  char []a = next().toCharArray();  s = new int[n][52];  boolean []set = new boolean[52];  for(int i = 0; i < n; ++i) {  int pos = get(a[i]);  if (!set[pos]) {   ++ALL;   set[pos] = true;  }  for(int j = 0; j < 52; ++j) {   if (i > 0) {   s[i][j] += s[i-1][j];   }   if (j == pos) {   s[i][j]++;   }  }  }  int ret = oo;  for(int i = 0; i < n; ++i) {  ret = Math.min(ret, get(i));  }  out.println(ret);  out.close(); }  private int get(int i) {  int lo = i - 1, hi = n;  while(hi - lo > 1) {  int m = lo + (hi - lo) / 2;  int c = 0;  for(int j = 0; j < 52; ++j) {   if (sum(j, i, m) > 0) {   ++c;   }  }  if (c < ALL) {   lo = m;  } else {   hi = m;  }  }  if (hi != n) {  return hi - i + 1;  }  return oo; }  private int sum(int pos, int l, int r) {  int ret = s[r][pos];  if (l > 0) ret -= s[l - 1][pos];  return ret; }  private int get(char x) {  if ('a' <= x && x <= 'z') return (int)(x - 'a');  return (int)(x - 'A' + 26); }  public static void main(String[] args) throws Exception{  new Main().run(); } }
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 [] nums = new int[n];   args = br.readLine().split(" ");   for (int i = 0; i < n; i++) {    nums[i] = Integer.parseInt(args[i]);   }   Arrays.sort(nums);   int min = nums[0];   for (int i = 1; i < n; i++) {    if (nums[i]>min) {     System.out.println(nums[i]); return;    }   }   System.out.println("NO");  } }
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);  } }
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 SimpleCycles();   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 SimpleCycles implements Solver {  public void solve(int testNumber, InputReader in, PrintWriter out) {   int n = in.nextInt();   int m = in.nextInt();   boolean[][] g = new boolean[n][n];   for (int i = 0; i < m; ++i) {    int u = in.nextInt();    int v = in.nextInt();    --u;    --v;    g[u][v] = g[v][u] = true;   }   HashMap<Integer, Integer> pointer = new HashMap<Integer, Integer> () ;   for (int i =0 ; i < n; ++i) {    pointer.put(1 << i, i);   }   long[][] dm = new long[1 << n][n];   for (int i = 0; i < n; ++i) {    dm[1 << i][i] = 1;   }   for (int i = 0; i < (1 << n); ++i) {    for (int j = 0; j < n; ++j) {     if (dm[i][j] == 0) continue;     int k = pointer.get(i - (i & (i - 1)));     for (int u = k + 1; u < n; ++u) {      if (g[j][u] && (i & (1 << u)) == 0) {       dm[i | (1 << u)][u] += dm[i][j];      }     }    }   }   long res = 0;   for (int i = 0; i < (1 << n); ++i) {    for (int j = 0; j < n; ++j)     if (Integer.bitCount(i) >= 3) {      int c = pointer.get(i - (i & (i - 1)));      if (g[c][j]) res += (long) dm[i][j];     }   }   out.print(res / 2);  } }
2	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()); }  private long nextLong() throws Exception{  return Long.parseLong(next()); }  private double nextDouble() throws Exception{  return Double.parseDouble(next()); }  public void run() throws Exception{  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  long n = nextLong();  if (n == 1) {  System.out.println(0);  return;  }  long k = nextLong();  long t = 1-(k-1) + k*(k+1)/2-1;  if (t < n){  System.out.println(-1);  return;  }  long l = 0;  long r = k;  while(r - l > 1) {  long m = (r + l)/2;  long s = 1 - m + k*(k+1)/2 - (k-m)*(k-m+1)/2;    if (s >= n){   r = m;  }else{   l = m;  }  }  System.out.println(r);  out.close(); }   public static void main(String[] args) throws Exception{  new Main().run(); } }
5	public class Solution15A {     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 Solution15A().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);     }   }     static class Utils {      private Utils() {}      public static void mergeSort(int[] a) {       mergeSort(a, 0, a.length - 1);     }      private static void mergeSort(int[] a, int leftIndex, int rightIndex) {       final int MAGIC_VALUE = 50;       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 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;       }     }   }     class Square implements Comparable<Square>{   public Square(int x, int a){    this.x = x;    this.a = a;   }      @Override  public int compareTo(Square o) {   if(this.x > o.x) return 1;   if(this.x < o.x) return -1;   return 0;  }   public int a, x;   }        void solve() throws IOException{   int n = readInt();   int t = readInt();   Square[] houses = new Square[n];   for(int i = 0; i < n; i++){    int a = readInt();    int b = readInt();    houses[i] = new Square(a, b);   }   Arrays.sort(houses);   int count = 0;   for(int i = 0; i < n; i++){    if(i == 0) count++;    else{    if(houses[i].x - houses[i].a/2.0 - t > houses[i-1].x + houses[i-1].a/2.0)     count++;    }    if(i == n - 1) count++;    else{    if(houses[i].x + houses[i].a/2.0 + t <= houses[i+1].x - houses[i+1].a/2.0)     count++;    }   }   out.println(count);   }     static double distance(long x1, long y1, long x2, long y2){   return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));   }     static long gcd(long a, long b){   while(a != b){    if(a < b) a -=b;    else b -= a;   }   return a;   }     static long lcm(long a, long b){   return a * b /gcd(a, b);   } }
0	public class substraction {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);  int t=sc.nextInt();  while (t>0) {  long a=sc.nextLong();  long b=sc.nextLong();  int op=0;  if (a>b) {   while (a%b!=0) {   op+=a/b;   a=a%b;   long c=b;   b=a;   a=c;     }   op+=a/b;  }  else{   while (b%a!=0) {   op+=b/a;   b=b%a;   long c=a;   a=b;   b=c;     }   op+=b/a;  }      System.out.println(op);  t--;  }  } }
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));  } } }
1	public class TimePass {  InputStream is;  PrintWriter out;  String INPUT = "";     boolean codechef=true;   void solve()  {   int t=ni();   while(t-->0) {    int n=ni();    int root=(int)Math.sqrt(n/2);    int rootn = (int)Math.sqrt(n);    if (n==1 || n%2!=0) {     out.println("NO");     continue;    }    if (root*root == n/2 || (rootn*rootn == n && rootn%2==0)) {     out.println("YES");    } else {     out.println("NO");    }   }  }   static int comp(int a,int b){   return a+1097*b;  }   static long printNcR(int n, int r)  {         long p = 1, k = 1;         if (n - r < r) {    r = n - r;   }    if (r != 0) {    while (r > 0) {     p *= n;     k *= r;          long m = __gcd(p, k);                   p /= m;     k /= m;      n--;     r--;    }              }   else {    p = 1;   }      return p;  }   static long __gcd(long n1, long n2)  {   long gcd = 1;    for (int i = 1; i <= n1 && i <= n2; ++i) {       if (n1 % i == 0 && n2 % i == 0) {     gcd = i;    }   }   return gcd;  }  static long[][] dp;   static long desc(int[] a,int l,int r) {   if (l==r) return 0;   if (dp[l][r]!=-1) return dp[l][r];   dp[l][r] = a[r]-a[l] + Math.min(desc(a,l+1,r),desc(a,l,r-1));   return dp[l][r];  }   static int getMax(int arr[], int n)  {   int mx = arr[0];   for (int i = 1; i < n; i++)    if (arr[i] > mx)     mx = arr[i];   return mx;  }      static void countSort(int arr[], int n, int exp)  {   int output[] = new int[n];   int i;   int count[] = new int[10];   Arrays.fill(count, 0);      for (i = 0; i < n; i++)    count[(arr[i] / exp) % 10]++;         for (i = 1; i < 10; i++)    count[i] += count[i - 1];      for (i = n - 1; i >= 0; i--) {    output[count[(arr[i] / exp) % 10] - 1] = arr[i];    count[(arr[i] / exp) % 10]--;   }         for (i = 0; i < n; i++)    arr[i] = output[i];  }      static void radixsort(int arr[], int n)  {     int m = getMax(arr, n);           for (int exp = 1; m / exp > 0; exp *= 10)    countSort(arr, n, exp);  }   static int MAX=1500;   static int prime[], countdiv[];    static int[] getDivisorsArray() {   int n=20000005;   int[] mind = new int[n];   Arrays.fill(mind, -1);   for(int i=2;i<n;i++){    if (mind[i]==-1){     for(int j=i;j<n;j+=i){      if (mind[j]==-1){       mind[j]=i;      }     }    }   }                         return mind;  }       void SieveOfEratosthenes()  {   for (int i = 2; i * i < MAX; ++i)   {    if (prime[i]==0)     for (int j = i * i; j < MAX; j += i)      prime[j] = i;   }        for (int i = 1; i < MAX; ++i)    if (prime[i]==0)     prime[i] = i;  }       int largestGCDSubsequence(int arr[], int n)  {   int ans = 0;   for (int i=0; i < n; ++i)   {    int element = arr[i];          while (element > 1)    {     int div = prime[element];                ++countdiv[div];            ans = Math.max(ans, countdiv[div]);       while (element % div==0)      element /= div;    }   }     return ans;  }      static boolean check(int x)  {   char[] a=(""+x).toCharArray();   int s=0;   for(int i=0;i<a.length;i++)   {    s+=a[i]-'0';    s%=3;   }   if(s==0)return true;   return false;  }     static int[][] packD(int n,int[] from,int[] to)  {   int[][] g=new int[n][];   int[] p=new int[n];   for(int f:from)   {    p[f]++;   }   int m=from.length;   for(int i=0;i<n;i++)   {    g[i]=new int[p[i]];   }   for(int i=0;i<m;i++)   {    g[from[i]][--p[from[i]]]=to[i];   }   return g;  }   static class Pair3  {   int a,b,c;   public Pair3(int a,int b,int c)   {    this.a=a;    this.b=b;    this.c=c;   }  }    static class Pair  {   int a,b;   public Pair(int a,int b)   {    this.a=a;    this.b=b;   }  }   static long lcm(long a,long b)  {   long val=a;   val*=b;   return (val/gcd(a,b));  }   static long gcd(long a,long b)  {   if(a==0)return b;   return gcd(b%a,a);  }   static int pow(int a, int b, int p)  {   long ans = 1, base = a;   while (b!=0)   {    if ((b & 1)!=0)    {     ans *= base;     ans%= p;    }    base *= base;    base%= p;    b >>= 1;   }   return (int)ans;  }   static int inv(int x, int p)  {   return pow(x, p - 2, p);  }    void run() throws Exception  {   if(codechef)oj=true;   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 TimePass().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)); } }
3	public class PaintTheNumers {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);      int nums = sc.nextInt();     HashSet<Integer> elements = new HashSet<Integer>();   for (int i = 0; i < nums; i++) {    elements.add(sc.nextInt());   }     ArrayList<Integer> sortedElements = new ArrayList<Integer>(elements);   Collections.sort(sortedElements);     ArrayList<Integer> lcms = new ArrayList<Integer>();     outer:   for (int i = 0; i < sortedElements.size(); i++) {    int ele = sortedElements.get(i);    for (int j = 0; j < lcms.size(); j++) {     if (ele % lcms.get(j) == 0) {      continue outer;     }    }    lcms.add(ele);   }   System.out.println(lcms.size());   sc.close();  } }
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");  } } }
3	public class maestro{  public static void main(String[] args){   Scanner sc = new Scanner(System.in);   int N = sc.nextInt();   long mod = (long)Math.pow(10,9)+7;   long[][] arr = new long[N][N];   arr[0][0]=1;   for (int i=1;i<N;i++){    char c = sc.next().charAt(0);    if (c=='f'){     for (int j=1;j<N;j++) arr[i][j] = arr[i - 1][j - 1];    }    else {     long sum=0;     for (int j=N-1;j>=0;j--){      sum=(sum+arr[i-1][j])%mod;      arr[i][j] = sum;     }    }   }   long ans=0;   for (int i=0;i<N;i++) ans=(ans+arr[N-1][i])%mod;   System.out.println(ans);  } }
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)); } }
3	public class D {  int [][] adjList ;  int dfs(int u , int p )  {   int size = 1 ;   for(int v : adjList[u])    if(v != p )    {     int curr = dfs(v, u) ;     size += curr ;    }   return size ;  }  void main() throws Exception  {   Scanner sc = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int n = sc.nextInt() ;   int [] a = new int [n] ;   boolean [] vis = new boolean[n] ;   int cnt = 0 ;   for(int i = 0 ;i < n ; i++)    a[i] = sc.nextInt() ;   sort(a);   for(int i = 0 ;i < n ; i ++)   {    if(!vis[i])    {     for(int j= i ; j < n ; j++)      if(a[j] % a[i] == 0)       vis[j] = true ;     cnt ++ ;    }   }   out.println(cnt);   out.flush();   out.close();  }  class SegmentTree  {   int [] sTree ;   int [] lazy ;   int N ;   SegmentTree(int n)   {    N = 1 << (32 - Integer.numberOfLeadingZeros(n - 1)) ;    sTree = new int [N << 1] ;    lazy= new int [N << 1] ;   }   void push(int node , int b , int e , int mid)   {    sTree[node << 1] += (mid - b + 1) * lazy[node] ;    sTree[node << 1 | 1] += (e - mid) * lazy[node] ;    lazy[node << 1] += lazy[node] ;    lazy[node << 1 | 1] += lazy[node] ;    lazy[node] = 0 ;   }   void updateRange(int node , int b , int e , int i , int j , int val)   {    if(i > e || j < b)return;    if(i <= b && e <= j)    {     sTree[node] += (e - b + 1) * val ;     lazy[node] += val ;     return;    }    int mid = b + e >> 1 ;    push(node , b , e , mid) ;    updateRange(node << 1 , b , mid , i , j , val);    updateRange(node << 1 | 1 , mid + 1 , e , i , j , val);    sTree[node] = sTree[node << 1] + sTree[node << 1 | 1] ;   }   int query(int node , int b , int e , int i , int j)   {    if(i > e || j < b)     return 0 ;    if(i <= b && e <= j)     return sTree[node] ;    int mid = b + e >> 1 ;    push(node , b , e , mid);    return query(node << 1 , b , mid , i , j) + query(node << 1 | 1 , mid + 1 , e , i , j) ;   }  }  class Compressor  {   TreeSet<Integer> set = new TreeSet<>() ;   TreeMap<Integer ,Integer> map = new TreeMap<>() ;   void add(int x)   {    set.add(x) ;   }   void fix()   {    for(int x : set)     map.put(x , map.size() + 1) ;   }   int get(int x)   {    return map.get(x) ;   }  }  class Scanner  {   BufferedReader br ;   StringTokenizer st ;   Scanner(InputStream in)   {    br = new BufferedReader(new InputStreamReader(in)) ;   }   String next() throws Exception   {    while (st == null || !st.hasMoreTokens())     st = new StringTokenizer(br.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()) ;   }  }  public static void main (String [] args) throws Exception {(new D()).main();} }
2	public class Main {  public static void main(String[] args) throws IOException {   new Main().run();  }  StreamTokenizer in;  PrintWriter out;   public static void deb(String n, Object n1) {   System.out.println(n + " is : " + n1);  }  public static void deb(int[] A) {   for (Object oo : A) {    System.out.print(oo + " ");   }   System.out.println("");  }  public static void deb(boolean[] A) {   for (Object oo : A) {    System.out.print(oo + " ");   }   System.out.println("");  }  public static void deb(double[] A) {   for (Object oo : A) {    System.out.print(oo + " ");   }   System.out.println("");  }  public static void deb(String[] A) {   for (Object oo : A) {    System.out.print(oo + " ");   }   System.out.println("");  }  public static void deb(int[][] A) {   for (int i = 0; i < A.length; i++) {    for (Object oo : A[i]) {     System.out.print(oo + " ");    }    System.out.println("");   }  }  public static void deb(double[][] A) {   for (int i = 0; i < A.length; i++) {    for (Object oo : A[i]) {     System.out.print(oo + " ");    }    System.out.println("");   }  }  public static void deb(long[][] A) {   for (int i = 0; i < A.length; i++) {    for (Object oo : A[i]) {     System.out.print(oo + " ");    }    System.out.println("");   }  }  public static void deb(String[][] A) {   for (int i = 0; i < A.length; i++) {    for (Object oo : A[i]) {     System.out.print(oo + " ");    }    System.out.println("");   }  }    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();  }   @SuppressWarnings("unchecked")  void solve() throws IOException {      BufferedReader re= new BufferedReader(new InputStreamReader(System.in));  Scanner sc= new Scanner(System.in);  long n=sc.nextLong(),k=sc.nextLong();  if(k*(k-1)/2<n-1)    System.out.println("-1");  else{  long ff=k*(k-1)/2;  ff=-2*(n-1-ff);    long up=k,dw=0;  while(up-dw>1){  long c=(up+dw)/2;  if(c*(c-1)<=ff)dw=c;  else up=c;   }  if(n==1)  { System.out.println("0");  return;  }   System.out.println(k-dw);  }  } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   private final int MOD = (int) (1e9 + 7);   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.nextInt();    String[] arr = new String[n];    for (int i = 0; i < n; i++) {     arr[i] = in.nextString();    }    int[] dp = new int[n];    Arrays.parallelSetAll(dp, i -> 0);    dp[0] = 1;    int cnt = 0;    for (int i = 0; i < n; i++) {     if (arr[i].equals("f")) {      cnt++;      continue;     }     calc(dp, n, cnt);     cnt = 0;    }    int sum = 0;    for (int i = 0; i < n; i++) {     sum += dp[i];     sum %= MOD;    }    out.println(sum);   }   private void calc(int[] dp, int n, int cnt) {    for (int i = n - 1; i >= 0; i--) {     if (i != n - 1) dp[i] += dp[i + 1];     dp[i] %= MOD;    }    int[] tmp = new int[n];    for (int i = 0; i < n; i++) {     tmp[(i + cnt) % n] = dp[i];    }    Arrays.parallelSetAll(dp, i -> tmp[i]);   }  }  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) throws IOException {   InputStream input = System.in;   OutputStream output = System.out;   InputReader in = new InputReader(new FileReader(new File("input.txt")));   PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));   Solution s = new Solution();   s.solve(1, in, out);   out.close();  }  static class Solution {   static int[][] grid;   static int[] dx = {0, 0, 1, -1};   static int[] dy = {1, -1, 0, 0};   static int n, m;   public void solve(int cs, InputReader in, PrintWriter out) {    n = in.nextInt();    m = in.nextInt();    int k = in.nextInt();    grid = new int[n][m];    for (int[] d : grid)     Arrays.fill(d, -1);    for (int i = 0; i < k; i++) {     Pair tree = new Pair(in.nextInt()-1, in.nextInt()-1);     bfs(tree);    }    int max = 0, idx1 = 0, idx2 = 0;    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      if (grid[i][j] > max) {       max = grid[i][j];       idx1 = i;       idx2 = j;      }     }    }    out.printf("%d %d%n", idx1+1, idx2+1);    }   public boolean isValid(int i, int j) {    return i >= 0 && i < n && j >= 0 && j < m;   }    static class Pair {    int x, y;    public Pair(int x, int y) {     this.x = x;     this.y = y;    }   }   public void bfs(Pair src) {    Queue<Pair> q = new LinkedList<>();    grid[src.x][src.y] = 0;    q.add(src);    while (!q.isEmpty()) {     Pair p = q.poll();     for (int k = 0; k < 4; k++) {      int nx = p.x+dx[k];      int ny = p.y+dy[k];      if (isValid(nx, ny)) {       if (grid[nx][ny] > grid[p.x][p.y]+1 || grid[nx][ny] == -1) {        grid[nx][ny] = grid[p.x][p.y] + 1;        q.add(new Pair(nx, ny));       }      }     }    }   }  }  static class InputReader {   BufferedReader br;   StringTokenizer st;   public InputReader(InputStream i) {    br = new BufferedReader(new InputStreamReader(i), 32768);    st = null;   }     public InputReader(FileReader s) {    br = new BufferedReader(s);    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());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    try {     return br.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }  } }
3	public class Main {  public static void main(String[] args) throws IOException {  int n = in.nextInt();  int[] a = in.nextIntArray(n);  sort(a);  int ans = 0;  boolean[] done = new boolean[n];  for(int i = 0; i < n; i ++) {  if(done[i])   continue;  ans ++;  for(int j = i + 1; j < n; j ++)   if(a[j] % a[i] == 0)   done[j] = true;  }  out.write(ans + "\n");  out.flush(); }  public static FastReader in = new FastReader(); public static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));  public static void gcj(int cn, Object ans) throws IOException {  System.out.print("Case #" + cn + ": " + ans + "\n"); }  public static ArrayList <Integer>[] ALArrayI(int size) {  ArrayList <Integer>[] l = new ArrayList[size];  for(int i = 0; i < size; i ++)  l[i] = new ArrayList <> ();  return l; }  public static ArrayList <Long>[] ALArrayL(int size) {  ArrayList <Long>[] l = new ArrayList[size];  for(int i = 0; i < size; i ++)  l[i] = new ArrayList <> ();  return l; }  public static Integer[] integerList(int fi, int fo) {  Integer[] l = new Integer[fo - fi];  for(int i = 0; i < fo - fi; i ++)  l[i] = fi + i;  return l; } }  class Graph { TreeSet <Integer>[] g;  public Graph(int n) {  g = new TreeSet[n];  for(int i = 0; i < n; i ++)  g[i] = new TreeSet <> (); }  public void addEdge(int u, int v) {  g[u].add(v); }  public TreeSet <Integer> getAdj(int u) {  return g[u]; }  public int nodes() {  return g.length; } }  class FastReader {  BufferedReader br;  StringTokenizer st;   public FastReader() {   br = new BufferedReader(new InputStreamReader(System.in));  }   public String next() {   while (st == null || !st.hasMoreElements()) {    try {     st = new StringTokenizer(br.readLine());    } catch (IOException e) {     e.printStackTrace();    }   }   return st.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 String nextLine() {   String str = "";   try {    str = br.readLine();   } catch (IOException e) {    e.printStackTrace();   }   return str;  }   public int[] nextIntArray(int n) {  int[] a = new int[n];  for(int i = 0; i < n; i ++)   a[i] = nextInt();  return a;  }   public Integer[] nextIntegerArray(int n) {  Integer[] a = new Integer[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 String[] nextStringArray(int n) {  String[] a = new String[n];  for(int i = 0; i < n; i ++)   a[i] = next();  return 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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    String[] a = new String[n];    String[] b = new String[n];    for (int i = 0; i < n; i++) {     a[i] = in.next();    }    for (int i = 0; i < n; i++) {     b[i] = in.next();    }    int ans = 0;    for (int i = 1; i < 5; i++) {     int a1 = 0, b1 = 0, c1 = 0;     for (int j = 0; j < n; j++) {      if (a[j].length() == i) {       if (a[j].charAt(i - 1) == 'M') {        a1++;       } else if (a[j].charAt(i - 1) == 'S') {        b1++;       } else {        c1++;       }      }     }     for (int j = 0; j < n; j++) {      if (b[j].length() == i) {       if (b[j].charAt(i - 1) == 'M') {        a1--;       } else if (b[j].charAt(i - 1) == 'S') {        b1--;       } else {        c1--;       }      }     }     if (a1 > 0) ans += a1;     if (b1 > 0) ans += b1;     if (c1 > 0) ans += c1;    }    out.println(ans);   }  }  static class InputReader {   private InputStream stream;   private byte[] inbuf = new byte[1024];   private int lenbuf = 0;   private int ptrbuf = 0;   public InputReader(InputStream stream) {    this.stream = stream;   }   private int readByte() {    if (lenbuf == -1) throw new UnknownError();    if (ptrbuf >= lenbuf) {     ptrbuf = 0;     try {      lenbuf = stream.read(inbuf);     } catch (IOException e) {      throw new UnknownError();     }     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;   }   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 * 10 + (b - '0');     } else {      return minus ? -num : num;     }     b = readByte();    }   }  }  static class OutputWriter extends PrintWriter {   public OutputWriter(OutputStream out) {    super(out);   }   public OutputWriter(Writer out) {    super(out);   }   public void close() {    super.close();   }  } }
2	public class B176 {  public static void main(String[] args) {   Scanner in = new Scanner(new BufferedInputStream(System.in));   PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));   long n = in.nextLong() - 1;   long k = in.nextLong() - 1;   if (k * (k + 1) / 2 < n) out.println(-1);   else if (n == 0) out.println(0);   else if (n < k) out.println(1);   else {    long t = binSearch(n, k, 1, k);    long ans = k - t + 1;    if (k * (k + 1) / 2 - t * (t - 1) / 2 != n) ans++;    out.println(ans);   }   out.close();  }  private static long binSearch(long n, long k, long from, long to) {   if (from == to) return from;   long mid = (from + to) / 2;   if (k * (k + 1) / 2 - mid * (mid - 1) / 2 > n) return binSearch(n, k, mid + 1, to);   else return binSearch(n, k, from, mid);  } }
1	public class A6 { public static void main(String[] args) {  Scanner in = new Scanner(System.in);   int n = in.nextInt();  int d = in.nextInt();  int ans=2;   int[] a = new int[n];   for(int i=0;i<n;i++)  a[i] = in.nextInt();   for(int i=1;i<n;i++)  {  if(a[i]-a[i-1]>2*d)  {   ans += 2;  }  else if(a[i]-a[i-1]==2*d)   ans += 1;  }   System.out.println(ans); } }
1	public class Solution {  public static void main(String [] args) throws IOException  {   PrintWriter pw=new PrintWriter(System.out);   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());   String str=st.nextToken();   char [] arr=str.toCharArray();   Arrays.sort(arr);   int weight=arr[0]-96;   char a=arr[0];   int included=1;   for(int i=1;i<arr.length;++i)   {    if(included==k)     break;    char c=arr[i];    if(c-a<2)     continue;       weight+=arr[i]-96;    ++included;    a=arr[i];      }   if(included==k)    pw.println(weight);   else    pw.println(-1);   pw.close();  } }
2	public class Main {  static long MOD = (long) 1e9 + 7; static long[][] identity = {{1, 0}, {0, 1}};  public static void main(String[] args) {  FastScanner input = new FastScanner(System.in);   long x = input.nextLong();  long k = input.nextLong();   long[][] matrix = {  {2, MOD - 1},  {0, 1}  };   if (x == 0)  System.out.println(0);  else if (k == 0) {  System.out.println((x * 2) % MOD);  } else {  x %= MOD;  matrix = matrixexpo(k, matrix);  long low = (x * matrix[0][0] + matrix[0][1]) % MOD;  long hi = x * mathpow(k, 2) % MOD;  System.out.println((low + hi) % MOD);  } }  static long mathpow(long k, long x) {  if (k == 0)  return 1L;  else return mathpow(k / 2, (x * x) % MOD) * (k % 2 == 1 ? x : 1) % MOD; }  static long[][] matrixexpo(long k, long[][] matrix) {  if (k == 0)  return identity;  if (k % 2 == 0)  return matrixexpo(k / 2, multiply(matrix, matrix));  else  return multiply(matrix, matrixexpo(k / 2, multiply(matrix, matrix))); }  static long[][] multiply(long[][] arr, long[][] brr) {  int n = arr.length, m = arr[0].length, p = brr[0].length;   long[][] product = new long[n][p];   for (int i = 0; i < n; i++)  for (int j = 0; j < p; j++)   for (int k = 0; k < m; k++)   product[i][j] = (product[i][j] + arr[i][k] * brr[k][j]) % MOD;  return product; }   static class FastScanner {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  public FastScanner(InputStream stream) {  this.stream = stream;  }  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++];  }  boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  boolean isEndline(int c) {  return c == '\n' || c == '\r' || c == -1;  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  String next() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  String nextLine() {  int c = read();  while (isEndline(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isEndline(c));  return res.toString();  } } }
5	public class Main { public static void main(String args[]) throws IOException  {  Scanner c=new Scanner(System.in);  int N=c.nextInt();  int A[]=new int[N];  for(int i=0;i<N;i++)   {  A[i]=c.nextInt();  }  Arrays.sort(A);  int sum=0;  for(int i=0;i<N;i++)   {  sum+=A[i];  }  int my=0;  int coins=0;  for(int i=N-1;i>=0;i--)   {  coins++;    my+=A[i];  if(my>sum-my)   {   System.out.println(coins);   break;   }  }  } }
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);   }  } }
4	public class Main{   static class Run implements Runnable{       final boolean consoleIO = false;    final String inFile = "input.txt";    final String outFile = "output.txt";       int n,m,k;    int[][] field;    boolean[][] visited;       LinkedList<Point> queue;    int[][] steps = {{0,1},{1,0},{0,-1},{-1,0}};       void wave() {     for(Point p:queue)      visited[p.y][p.x] = true;         while(!queue.isEmpty()) {      Point cur = queue.removeFirst();      for(int i = 0; i < steps.length; ++i) {       Point tmp = new Point(cur.x+steps[i][0],cur.y+steps[i][1]);             if(ok(tmp)&&!visited[tmp.y][tmp.x]) {        queue.add(tmp);        visited[tmp.y][tmp.x] = true;        field[tmp.y][tmp.x] = field[cur.y][cur.x]+1;       }      }     }    }       boolean ok(Point p) {     return p.x>=0 && p.y>=0 && p.x<n && p.y<m;    }       @Override    public void run() {     n = nextInt();     m = nextInt();     k = nextInt();         queue = new LinkedList<Point>();     for(int i = 0; i < k; ++i)      queue.add(new Point(nextInt()-1,nextInt()-1));         field = new int[m][n];     visited = new boolean[m][n];     wave();         Point maxP = new Point(0,0);     int maxV = Integer.MIN_VALUE;         for(int i = 0; i < m; ++i)      for(int j = 0; j < n; ++j)       if(field[i][j] > maxV) {        maxV = field[i][j];        maxP = new Point(j,i);       }         print((maxP.x+1)+" "+(maxP.y+1));     close();    }      BufferedReader in;    PrintWriter out;    StringTokenizer strTok;       Run() {     if (consoleIO) {      initConsoleIO();     }     else {      initFileIO();     }    }       void initConsoleIO() {     in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(new OutputStreamWriter(System.out));    }       void initFileIO() {     try {      in = new BufferedReader(new FileReader(inFile));      out = new PrintWriter(new FileWriter(outFile));     } catch (FileNotFoundException e) {      e.printStackTrace();     } catch (IOException e) {      e.printStackTrace();     }    }       void close() {     try {      in.close();      out.close();     } catch (IOException e) {      e.printStackTrace();     }    }       int nextInt() {     return Integer.parseInt(nextToken());    }       double nextDouble() {     return Double.parseDouble(nextToken());    }       float nextFloat() {     return Float.parseFloat(nextToken());    }       long nextLong() {     return Long.parseLong(nextToken());    }       String nextLine() {     try {      return in.readLine();     } catch (IOException e) {      return "__NULL";     }    }       boolean hasMoreTokens() {     return (strTok == null) || (strTok.hasMoreTokens());    }       String nextToken() {     while (strTok == null || !strTok.hasMoreTokens()) {      String line;      try {       line = in.readLine();       strTok = new StringTokenizer(line);      } catch (IOException e) {       e.printStackTrace();      }     }         return strTok.nextToken();    }       void cout(Object o){     System.out.println(o);    }       void print(Object o) {     out.write(o.toString());    }       void println(Object o) {     out.write(o.toString() + '\n');    }       void printf(String format, Object... args) {     out.printf(format, args);    }       String sprintf(String format, Object... args) {    return MessageFormat.format(format, args);   }   }     static class Pair<A, B> {    A a;    B b;       A f() {     return a;    }       B s() {     return b;    }       Pair(A a, B b) {     this.a = a;     this.b = b;    }       Pair(Pair<A, B> p) {     a = p.f();     b = p.s();    }   }     public static void main(String[] args) throws IOException {    Run run = new Run();    Thread thread = new Thread(run);    thread.run();   }  }
1	public class C{ public static void main(String[] args) {  InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out);  Solver solver = new Solver();  solver.solve(in, out);  out.close(); }  static class Solver{  public void solve(InputReader in, PrintWriter out) {  int n = in.nextInt();  String s = in.next();  HashMap<Character, Integer> map = new HashMap<>();  for (int i = 0; i < n; ++ i) {   map.put(s.charAt(i), 0);  }  int l = 0, r = 0, cnt = 0, ans = n;  char c;  while (l < n) {   while (r < n && cnt < map.size()) {   c = s.charAt(r);   map.put(c, map.get(c) + 1);   if (map.get(c) == 1) ++cnt;   ++r;   }     if (cnt == map.size() && r-l < ans)   ans = r-l;     c = s.charAt(l);   map.put(c, map.get(c)-1);   if (map.get(c) == 0) --cnt;   ++l;  }  out.println(ans);  } }  static class InputReader {  BufferedReader reader;  StringTokenizer tokenizer;  public InputReader (InputStream stream) {  reader = new BufferedReader(new InputStreamReader(stream));  }  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());  } } }
5	public class D {  public static class BIT {  long[] dat;   public BIT(int n){  dat = new long[n + 1];  }   public void add(int k, long a){   for(int i = k + 1; i < dat.length; i += i & -i){   dat[i] += a;   }  }   public long sum(int s, int t){   if(s > 0) return sum(0, t) - sum(0, s);    long 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();    long[] array = new long[n];  for(int i = 0; i < n; i++){ array[i] = sc.nextLong(); }    TreeSet<Long> value_set = new TreeSet<Long>();  for(int i = 0; i < n; i++){ value_set.add(array[i]); }  ArrayList<Long> value_list = new ArrayList<Long>(value_set);    BigInteger answer = BigInteger.ZERO;  final int bit_n = value_list.size();  BIT cnt_bit = new BIT(bit_n);  BIT val_bit = new BIT(bit_n);    for(int i = n - 1; i >= 0; i--){   final long value = array[i];   final int value_index = Collections.binarySearch(value_list, value);     int upper_pos = Collections.binarySearch(value_list, value + 2);   if(upper_pos < 0){ upper_pos = (-upper_pos) - 1; }   if(0 <= upper_pos && upper_pos < bit_n){   final long upper_sum = val_bit.sum(upper_pos, bit_n) - cnt_bit.sum(upper_pos, bit_n) * value;   answer = answer.add(BigInteger.valueOf(upper_sum));   }     int lower_pos = Collections.binarySearch(value_list, value - 2);   if(lower_pos < 0){ lower_pos = (-lower_pos) - 2; }   if(0 <= lower_pos && lower_pos < bit_n){   final long lower_sum = val_bit.sum(0, lower_pos + 1) - cnt_bit.sum(0, lower_pos + 1) * value;   answer = answer.add(BigInteger.valueOf(lower_sum));   }     cnt_bit.add(value_index, 1);   val_bit.add(value_index, value);     }    System.out.println(answer);  } }  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) {   }  } } }
5	public class ProblemA {  private void solve() throws IOException {  Scanner stdin = new Scanner(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));     int n = Integer.valueOf(stdin.nextInt());   int[] p = new int[n];   for (int i = 0; i < n; i++) {   p[i] = stdin.nextInt();   }     Arrays.sort(p);   if (p[n-1] == 1) {   p[n-1] = 2;   } else {   p[n-1] = 1;   out.print(p[n-1] + " ");   n--;   }     for (int i = 0; i < n; i++) {   out.print(p[i] + " ");   }        out.flush();   out.close(); }  public static void main(String[] args) throws IOException {  ProblemA solver = new ProblemA();   solver.solve(); } }
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);  }  }
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;  } }
3	public class PythInd { public static final int MOD = 1000000007;  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = Integer.parseInt(sc.nextLine());  String[] sTypes = new String[n];  for (int i = 0; i < n; i++) {  sTypes[i] = sc.nextLine();  }  sc.close();     int[][] dp = new int[n][n];  dp[0][0] = 1;  for (int i = 0; i < dp.length - 1; i++) {  if (sTypes[i].equals("s")) {   int curSum = 0;   for (int j = i + 1; j >= 0; j--) {   curSum = (dp[i][j] + curSum) % MOD;   dp[i + 1][j] += curSum;   dp[i + 1][j] %= MOD;   }  } else {   for (int j = 1; j <= i + 1; j++) {   dp[i + 1][j] += dp[i][j - 1];   dp[i + 1][j] %= MOD;   }  }  }  int ans = 0;  for (int i = 0; i < dp[0].length; i++) {  ans = (ans + dp[n - 1][i]) % MOD;  }  System.out.println(ans); } }
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); } }
0	public class two_squares {  public static void main(String[] args) throws Exception {  new two_squares().run(); }  public void run() throws Exception {  FastIO file = new FastIO();  double x1 = file.nextInt();  double y1 = file.nextInt();  double x2 = file.nextInt();  double y2 = file.nextInt();  double x3 = file.nextInt();  double y3 = file.nextInt();  double x4 = file.nextInt();  double y4 = file.nextInt();  double minx1, maxx1, miny1, maxy1;  minx1 = Math.min(x1, Math.min(x2, Math.min(x3, x4)));  maxx1 = Math.max(x1, Math.max(x2, Math.max(x3, x4)));  miny1 = Math.min(y1, Math.min(y2, Math.min(y3, y4)));  maxy1 = Math.max(y1, Math.max(y2, Math.max(y3, y4)));  double x5 = file.nextInt();  double y5 = file.nextInt();  double x6 = file.nextInt();  double y6 = file.nextInt();  double x7 = file.nextInt();  double y7 = file.nextInt();  double x8 = file.nextInt();  double y8 = file.nextInt();  double minx2, maxx2, miny2, maxy2;  minx2 = Math.min(x5, Math.min(x6, Math.min(x7, x8)));  maxx2 = Math.max(x5, Math.max(x6, Math.max(x7, x8)));  miny2 = Math.min(y5, Math.min(y6, Math.min(y7, y8)));  maxy2 = Math.max(y5, Math.max(y6, Math.max(y7, y8)));  Point _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16;  _1 = new Point(x1, y1);  _2 = new Point(x2, y2);  _3 = new Point(x3, y3);  _4 = new Point(x4, y4);  _5 = new Point(x5, y5);  _6 = new Point(x6, y6);  _7 = new Point(x7, y7);  _8 = new Point(x8, y8);  _9 = new Point(minx1, maxy1);  _10 = new Point(minx1, miny1);  _11 = new Point(maxx1, maxy1);  _12 = new Point(maxx1, miny1);  double m1 = (minx2 + maxx2) / 2;  double m2 = (miny2 + maxy2) / 2;  _13 = new Point(minx2, m2);  _14 = new Point(m1, miny2);  _15 = new Point(maxx2, m2);  _16 = new Point(m1, maxy2);  Point[] a = {_1, _2, _3, _4};  Point[] b = {_5, _6, _7, _8};  boolean works = false;  Line[] aa = {new Line(_9,_10), new Line(_10, _12), new Line(_12, _11), new Line(_11, _9)};  Line[] bb = {new Line(_13, _14), new Line(_14, _15), new Line(_15, _16), new Line(_16, _13)};  for (int i = 0; i < 4; i++) {  for (int j = 0; j < 4; j++) {   if (aa[i].intersection(bb[i]) != null) {   works = true;   }  }  }  for (Point p : b) {  if (p.x >= minx1 && p.x <= maxx1 && p.y >= miny1 && p.y <= maxy1) {   works = true;  }  }  for (Point p : a) {  boolean result = false;   for (int i = 0, j = b.length - 1; i < b.length; j = i++) {    if ((b[i].y > p.y) != (b[j].y > p.y) &&     (p.x < (b[j].x - b[i].x) * (p.y - b[i].y) / (b[j].y-b[i].y) + b[i].x)) {    result = !result;    }   }   if (result) works = true;  }  System.out.println(works ? "YES" : "NO"); } public static class Point {  double x, y;  public Point(double a, double b) {  x = a;  y = b;  } } public static class Line {  Point a, b;  public Line(Point x, Point y) {  a = x;  b = y;  }  public Point intersection(Line o) {  double x1 = a.x;  double y1 = a.y;  double x2 = b.x;  double y2 = b.y;  double x3 = o.a.x;  double y3 = o.a.y;  double x4 = o.b.x;  double y4 = o.b.y;  double denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);   double ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3))/denom;   double ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3))/denom;   if (ua >= 0.0f && ua <= 1.0f && ub >= 0.0f && ub <= 1.0f) {    return new Point((int) (x1 + ua*(x2 - x1)), (int) (y1 + ua*(y2 - y1)));   }   return null;  } } public static class FastIO {  BufferedReader br;  StringTokenizer st;  public FastIO() {  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 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 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; } }
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)); } }
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);  }  }
0	public class Question267A {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);   int t=sc.nextInt();   while (t--!=0){    int x=sc.nextInt();    int y=sc.nextInt();    int max=Math.max(x,y);    int min=Math.min(x,y);    int ans=0;    while (min>0 && max>0){     int temp=max;     ans+=temp/min;     max=min;     min=temp%min;    }    System.out.println(ans);   }  } }
4	public class Cbeta35 { public static void main(String[] args) { new Cbeta35(); } Scanner in; PrintWriter out;  int t; int n, m, k, oo; int[][] grid;  boolean debug = !true, multi = !true;  Cbeta35() {  if (multi) t = in.nextInt();  do {  if (multi) if (z(t--)) break;   try {   in = new Scanner(new File("input.txt"));   out = new PrintWriter(new File("output.txt"));  }  catch (Exception e) {   in = new Scanner(System.in);   out = new PrintWriter(System.out);  }   n = in.nextInt();  m = in.nextInt();  k = in.nextInt();   oo = n + m + 1;  grid = new int[n][m];  for (int i = 0; i < n; i++)   Arrays.fill(grid[i], oo);  for (int i = 0; i < k; i++) {   int x = in.nextInt() - 1;   int y = in.nextInt() - 1;   for (int j = 0; j < n; j++)   for (int kk = 0; kk < m; kk++) {    int dx = j - x < 0 ? x - j : j - x;    int dy = kk - y < 0 ? y - kk : kk - y;    grid[j][kk] = min(grid[j][kk], dx + dy);   }  }   int x = 0, y = 0;  int max = 0;  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++)   if (max < grid[i][j]) {    max = grid[i][j];    x = i; y = j;   }  out.printf("%d %d%n", x + 1, y + 1);  } while (debug || multi);  out.close(); }   int min(int a, int b) { if (a < b) return a; return b; }  int max(int a, int b) { if (a > b) return a; return b; }  long min(long a, long b) { if (a < b) return a; return b; }  long max(long a, long b) { if (a > b) return a; return b; }  boolean z(int x) { if (x == 0) return true; return false; }  boolean z(long x) { if (x == 0) return true; return false; }  void sort(int[] arr) {  int szArr = arr.length;  Random r = new Random();  for (int i = 0; i < szArr; i++) {  int j = r.nextInt(szArr);  arr[i] = arr[j]^(arr[i]^(arr[j] = arr[i]));  }  Arrays.sort(arr); }  class FS {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer("");  String next() {  while (!st.hasMoreTokens()) {   try { st = new StringTokenizer(br.readLine()); }   catch (Exception e) {}  } return st.nextToken();  }  int nextInt() { return Integer.parseInt(next()); }  long nextLong() { return Long.parseLong(next()); }  double nextDouble() { return Double.parseDouble(next()); } } }
4	public class practice {  public static void main(String[] args) throws FileNotFoundException {    Scanner scn = new Scanner(new FileReader("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  int n=scn.nextInt(),m=scn.nextInt(),k=scn.nextInt();  int[][] inf=new int[k][2];  for(int i=0;i<k;i++){   inf[i][0]=scn.nextInt();inf[i][1]=scn.nextInt();  }  int ans=0,x=1,y=1;  for(int i=1;i<=n;i++){   for(int j=1;j<=m;j++){   int temp=Integer.MAX_VALUE;   for(int l=0;l<k;l++){   temp=Math.min(temp, Math.abs(i-inf[l][0])+Math.abs(j-inf[l][1]));    }   if(temp>ans){    ans=temp;x=i;y=j;   }   }  }  out.print(x+ " " + y);   out.close();  } }
3	public class F1 {   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();   }  }     public static void main(String[] args) throws IOException {   Reader s=new Reader();  int n=s.nextInt();     int a[]=new int[n];     for(int i=0;i<n;i++){    a[i]=s.nextInt();   }     Map<Long,PriorityQueue<Node>> map=new HashMap();     for(int i=0;i<n;i++){    long sum=0;    for(int j=i;j<n;j++){     sum=sum+a[j];     PriorityQueue<Node> pq=map.get(sum);     if(pq==null){      pq=new PriorityQueue();      map.put(sum, pq);     }     pq.add(new Node(i,j));    }          }        Set<Long> keys=map.keySet();     Iterator<Long> itr=keys.iterator();   int max=0;   int solbackDp[]=null;   Node solA[]=new Node[0];   while(itr.hasNext()){    Long sum=itr.next();    PriorityQueue<Node> pq1=map.get(sum);                            ArrayList<Node> rangelist=new ArrayList<>();    rangelist.add(new Node(-1, -1));           Node last=rangelist.get(0);    while(!pq1.isEmpty()){     Node n1=pq1.poll();     if(n1.l!=last.l){      rangelist.add(n1);      last=n1;     }           }    int backTrack[]=new int[rangelist.size()];    int dp[]=new int[rangelist.size()];    Arrays.fill(dp, -1);    int ans=fun(0,dp,rangelist,backTrack);    if(ans>max){     max=ans;     solA=rangelist.toArray(solA);     solbackDp=backTrack;    }   }     System.out.println(max);        int pos=0;   while(solbackDp[pos]!=-1){    pos=solbackDp[pos];    System.out.println((solA[pos].l+1)+" "+(solA[pos].r+1));   }  }     static int fun(int pos, int[] dp, ArrayList<Node> rangeList, int[] bactTrack){     if(pos==rangeList.size()-1){    bactTrack[pos]=-1;    return 0;      }     if(dp[pos]!=-1){    return dp[pos];   }     int i=pos+1;   int maxAns=0;   int nextPos=-1;   for(;i<=rangeList.size()-1;i++){           if(rangeList.get(i).l>rangeList.get(pos).r){     int tempAns=1+fun(i, dp,rangeList, bactTrack);     if(tempAns>maxAns){      maxAns=tempAns;      nextPos=i;     }    }   }     dp[pos]=maxAns;   bactTrack[pos]=nextPos;   return maxAns;            }   static class Node implements Comparable<Node>{   int l;   int r;   public Node(int l, int r) {    this.l = l;    this.r = r;   }             @Override   public int compareTo(Node o2) {    if(this.l!=o2.l){     return this.l-o2.l;    } else{     return this.r-o2.r;    }   }    } }
5	public class A { private Scanner in; private PrintWriter out;  public void solve() {  int n = ni();  int t = ni();  Pair[] p = new Pair[n];  for(int i = 0;i < n;i++){  p[i] = new Pair();  p[i].x = ni();  p[i].a = ni();  }  Arrays.sort(p);   int ct = 2;  for(int i = 0;i < n - 1;i++){  float d = p[i + 1].x - (float)p[i + 1].a / 2 - p[i].x - (float)p[i].a / 2;  if(Math.abs(d - t) < EPS){   ct++;  }else if(d > t){   ct += 2;  }  }   out.println(ct); }  double EPS = 0.0001;  private static class Pair implements Comparable<Pair> {  public int x;  public int a;   @Override  public int compareTo(Pair o) {  return x - o.x;  } }  public void run() throws Exception {  in = new Scanner(System.in);  System.setOut(new PrintStream(new BufferedOutputStream(System.out)));  out = new PrintWriter(System.out);    int n = 1;  for(int i = 1;i <= n;i++){  long t = System.currentTimeMillis();  solve();  out.flush();  } }   public static void main(String[] args) throws Exception {  new A().run(); }  private int ni() { return Integer.parseInt(in.next()); } private static void tr(Object... o) { System.out.println(o.length == 1 ? o[0] : Arrays.toString(o)); } }
1	public class Main {  private static String encode(long rowNum) {  if(rowNum<=26) {   return String.valueOf((char)('A'+rowNum-1));  }  else {     if(rowNum%26==0){   return encode((long)Math.floor((double)rowNum/26)-1)    + String.valueOf((char)('A'+26-1));     }   else {   return encode((long)Math.floor((double)rowNum/26))    + String.valueOf((char)('A'+rowNum%26-1));   }  } }  private static long decode(String rowNum){  long result = 0;  char rowChars[] = rowNum.toCharArray();  for(int i=rowChars.length-1;i>=0;i--){  result+= (rowChars[i]-'A'+1) * (long)Math.pow(26,rowChars.length-i-1);  }  return result; }  public static void main(String arg[])throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  int t = Integer.parseInt(in.readLine());  Pattern p1 = Pattern.compile("R\\d+C\\d+");  Pattern p2 = Pattern.compile("\\d+");  for(int i=0;i<t;i++){  String input = in.readLine();  Matcher m1 = p1.matcher(input);  Matcher m2 = p2.matcher(input);  if(m1.matches()){   String result = "";   if(m2.find()){   result = m2.group();   }   if(m2.find()){   result = encode(Long.parseLong(m2.group()))+result;   }   System.out.println(result);  }  else {   String result = "R";   if(m2.find()){   result += m2.group();   }     result += "C";   System.out.println(result+decode(input.replaceAll(m2.group(),"")));  }  } } }
5	public class A{  public static void main(String[] args){   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   TreeSet<Integer> v = new TreeSet<Integer>();   for(int i=0;i<n;i++) v.add(sc.nextInt());   Iterator<Integer> it = v.iterator();   it.next();   it.remove();   System.out.println(v.isEmpty() ? "NO" : v.iterator().next());  } }
4	public class CF035C {  public static void main(String[] args) throws IOException {   Scanner s = new Scanner(new File("input.txt"));   int n = s.nextInt();   int m = s.nextInt();   int k = s.nextInt();   Queue<pair> q = new LinkedList<>();   PrintWriter out = new PrintWriter(new FileWriter("output.txt"));   boolean[][] visited = new boolean[n][m];   for (int i = 0; i < k; i++) {    int x = s.nextInt() - 1;    int y = s.nextInt() - 1;    visited[x][y] = true;    pair p = new pair(x,y);    q.add(p);   }   q.add(null);   int[] dx = {0,0,1,-1};   int[] dy = {1,-1,0,0};   int ansX = q.peek().x;   int ansY = q.peek().y;   while(true){    if(q.peek() == null){     q.poll();     q.add(null);    }    pair p = q.poll();    if(p == null){     break;    }    for (int i = 0; i < 4; i++) {     if(isValid(p.x + dx[i],p.y+dy[i],n,m) && !visited[p.x + dx[i]][p.y+dy[i]]){      q.add(new pair(p.x + dx[i],p.y+dy[i]));      ansX = p.x + dx[i];      ansY = p.y + dy[i];      visited[ansX][ansY] = true;     }    }   }   out.println((ansX+1) + " " + (ansY+1));   out.close();  }  public static boolean isValid(int x, int y,int n, int m){   return x >= 0 && x < n && y >= 0 && y < m;  }  private static class pair{   int x;   int y;   public pair(int x, int y) {    this.x = x;    this.y = y;   }  } }
3	public class Main{ static int max=Integer.MAX_VALUE,min=Integer.MIN_VALUE; static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st;  static int max(int a,int b)  {  return Math.max(a, b);  }  static int min(int a,int b)  {  return Math.min(a, b);  }  static int i()throws IOException  {  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  return Integer.parseInt(st.nextToken());  }  static long l()throws IOException  {  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  return Long.parseLong(st.nextToken());  }  static String s()throws IOException  {  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  return st.nextToken();  }  static double d()throws IOException  {  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  return Double.parseDouble(st.nextToken());  }  static void p(String p)  {  System.out.print(p);  }  static void p(int p)  {  System.out.print(p);  }  static void p(double p)  {  System.out.print(p);  }  static void p(long p)  {  System.out.print(p);  }  static void p(char p)  {  System.out.print(p);  }  static void p(boolean p)  {  System.out.print(p);  }  static void pl(String pl)  {  System.out.println(pl);  }  static void pl(int pl)  {  System.out.println(pl);  }  static void pl(char pl)  {  System.out.println(pl);  }  static void pl(double pl)  {  System.out.println(pl);  }  static void pl(long pl)  {  System.out.println(pl);  }  static void pl(boolean pl)  {  System.out.println(pl);  }  static void pl()  {  System.out.println();  }  static int[] ari(int n)throws IOException  {  int ar[]=new int[n];  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  for(int x=0;x<n;x++)   ar[x]=Integer.parseInt(st.nextToken());  return ar;  }  static int[][] ari(int n,int m)throws IOException  {  int ar[][]=new int[n][m];  for(int x=0;x<n;x++)  {   st=new StringTokenizer(br.readLine());   for(int y=0;y<m;y++)   ar[x][y]=Integer.parseInt(st.nextToken());  }  return ar;  }  static long[] arl(int n)throws IOException  {  long ar[]=new long[n];  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  for(int x=0;x<n;x++)   ar[x]=Long.parseLong(st.nextToken());  return ar;  }  static long[][] arl(int n,int m)throws IOException  {  long ar[][]=new long[n][m];  for(int x=0;x<n;x++)  {   st=new StringTokenizer(br.readLine());   for(int y=0;y<m;y++)   ar[x][y]=Long.parseLong(st.nextToken());  }  return ar;  }  static String[] ars(int n)throws IOException  {  String ar[]=new String[n];  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  for(int x=0;x<n;x++)   ar[x]=st.nextToken();  return ar;  }  static String[][] ars(int n,int m)throws IOException  {  String ar[][]=new String[n][m];  for(int x=0;x<n;x++)  {   st=new StringTokenizer(br.readLine());   for(int y=0;y<m;y++)   ar[x][y]=st.nextToken();  }  return ar;  }  static double[] ard(int n)throws IOException  {  double ar[]=new double[n];  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  for(int x=0;x<n;x++)   ar[x]=Double.parseDouble(st.nextToken());  return ar;  }  static double[][] ard(int n,int m)throws IOException  {  double ar[][]=new double[n][m];  for(int x=0;x<n;x++)  {   st=new StringTokenizer(br.readLine());   for(int y=0;y<m;y++)   ar[x][y]=Double.parseDouble(st.nextToken());  }  return ar;  }  static char[] arc(int n)throws IOException  {  char ar[]=new char[n];  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  for(int x=0;x<n;x++)   ar[x]=st.nextToken().charAt(0);  return ar;  }  static char[][] arc(int n,int m)throws IOException  {  char ar[][]=new char[n][m];  for(int x=0;x<n;x++)  {   st=new StringTokenizer(br.readLine());   for(int y=0;y<m;y++)   ar[x][y]=st.nextToken().charAt(0);  }  return ar;  }  static void par(int ar[])  {  for(int a:ar)   System.out.print(a+" ");  System.out.println();  }  static void par(int ar[][])  {  for(int a[]:ar)  {   for(int aa:a)   System.out.print(aa+" ");   System.out.println();  }  }  static void par(long ar[])  {  for(long a:ar)   System.out.print(a+" ");  System.out.println();  }  static void par(long ar[][])  {  for(long a[]:ar)  {   for(long aa:a)   System.out.print(aa+" ");   System.out.println();  }  }  static void par(String ar[])  {  for(String a:ar)   System.out.print(a+" ");  System.out.println();  }  static void par(String ar[][])  {  for(String a[]:ar)  {   for(String aa:a)   System.out.print(aa+" ");   System.out.println();  }  }  static void par(double ar[])  {  for(double a:ar)   System.out.print(a+" ");  System.out.println();  }  static void par(double ar[][])  {  for(double a[]:ar)  {   for(double aa:a)   System.out.print(aa+" ");   System.out.println();  }  }  static void par(char ar[])  {  for(char a:ar)   System.out.print(a+" ");  System.out.println();  }  static void par(char ar[][])  {  for(char a[]:ar)  {   for(char aa:a)   System.out.print(aa+" ");   System.out.println();  }  }  static public void main(String[] args)throws Exception{  st=new StringTokenizer(br.readLine());  int n=i();  int ar[]=ari(n);  Arrays.sort(ar);  int c=0;     for(int x=0;x<n;x++)   {   if(ar[x]!=-1)   {    c++;    for(int y=x+1;y<n;y++)    {    if(ar[y]!=-1)     {     if(ar[y]%ar[x]==0)     {     ar[y]=-1;     }     }    }    ar[x]=-1;   }   }   pl(c);                                          } }
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;   }  } }
5	public class A {  private void solve() throws IOException {   int n = nextInt();   int k = nextInt();   Point[] p = new Point[n];   for (int i = 0; i < n; i++)    p[i] = new Point(nextInt(), nextInt());   Arrays.sort(p, new Comparator<Point>() {    @Override    public int compare(Point o1, Point o2) {     if (o1.x == o2.x) return o1.y - o2.y;     return o2.x - o1.x;    }   });     Point cur = p[k - 1];   int res = 0;   for (int i = 0; i < p.length; i++) {    if (p[i].x == cur.x && p[i].y == cur.y) res++;   }   pl(res);  }  public static void main(String[] args) {   new A().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();  } }
2	public class C{ public static void main (String[] args) throws java.lang.Exception{  Scanner scan=new Scanner(System.in);  long x=scan.nextLong(), k=scan.nextLong();  long MOD = 1000000007;  if(x==0){  System.out.println("0");  return;  }  x %= MOD;  long ans= (((new myC()).fastPow(2L, k+1)*x)%MOD - (new myC()).fastPow(2L, k) + MOD + 1)% MOD;  ans %= MOD;  System.out.println(ans); } } class myC{ long MOD = 1000000007; long fastPow(long x, long k){  long bb=x%MOD, ans=1;  while(k > 0){  if((k&1)==1){   ans=(ans*bb)%MOD;  }  bb=(bb*bb)%MOD;  k>>=1;  }  return ans; } }
3	public class PhytonIndenter {  private static Scanner scanner = new Scanner(System.in);  private static int lineCount;  private static String[] commands;  public static void main(String args[]) {   lineCount = scanner.nextInt();   scanner.nextLine();   commands = new String[lineCount];   for (int i = 0; i < lineCount; i++) {    commands[i] = scanner.nextLine();   }   resolveWithDP();  }  private static void resolveWithDP() {   long dp[][] = new long[lineCount][5002];   long mod = 1000000007;   dp[0][0] = 1;   for (int i = 1; i < lineCount; i++) {    if ("f".equalsIgnoreCase(commands[i - 1])) {     dp[i][0] = 0;     for (int j = 1; j <= i; j++) {      dp[i][j] = dp[i - 1][j - 1];     }    } else {     long sum = 0;     for (int j = i - 1; j >= 0; j--) {      sum += dp[i - 1][j] % mod;      dp[i][j] = sum;     }    }   }   long result = 0;   for (int i = 0; i < lineCount; i++) {    result += dp[lineCount-1][i]%mod;    result %= mod;   }   System.out.println(result%mod);  } }
4	public class ExplorerSpace {  int[][] horizontal, vertical;  int n, m;  long[][][] dp;  int large = Integer.MAX_VALUE;  boolean isValid(int i, int j){   return i>=0 && j>=0 && i<n && j<m;  }  long getMin(int i, int j, int k){   if(k==0)    return 0;   if(dp[i][j][k]!=-1)    return dp[i][j][k];   long ans = large;   for (int a = 0; a < 2; a++) {    for (int d = 0; d < 2; d++) {     int dx = a==0 ? (d==0 ? +1 : -1) : 0;     int dy = a==1 ? (d==0 ? +1 : -1) : 0;     int x = i+dx;     int y = j+dy;     if(isValid(x, y)){      if(dx==0){       ans = Math.min(horizontal[i][Math.min(j, y)]+getMin(x, y, k-1), ans);      }else {       ans = Math.min(vertical[Math.min(i, x)][j]+getMin(x, y, k-1), ans);      }     }    }   }   dp[i][j][k] = ans;   return ans;  }  void solve() throws IOException {   n = getInt();   m = getInt();   dp = new long[n+1][m+1][11];   for (int i = 0; i < n+1; i++) {    for (int j = 0; j < m+1; j++) {     for (int k = 0; k < 11; k++) {      dp[i][j][k] = -1;     }    }   }   int k = getInt();   horizontal = new int[n][m-1];   vertical = new int[n-1][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m - 1; j++) {     horizontal[i][j] = getInt();    }   }   for (int i = 0; i < n - 1; i++) {    for (int j = 0; j < m; j++) {     vertical[i][j] = getInt();    }   }   if(k%2!=0){    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      print("-1 ");     }     println("");    }   }else {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      long ans = 2*getMin(i, j, k/2);      print(ans+" ");     }     println("");    }   }  }  public static void main(String[] args) throws Exception {   if (isOnlineJudge()) {    in = new BufferedReader(new InputStreamReader(System.in));    out = new BufferedWriter(new OutputStreamWriter(System.out));    new ExplorerSpace().solve();    out.flush();   } else {    Thread judge = new Thread();    in = new BufferedReader(new FileReader("input.txt"));    out = new BufferedWriter(new FileWriter("output.txt"));    judge.start();    new ExplorerSpace().solve();    out.flush();    judge.suspend();   }  }  static boolean isOnlineJudge(){   try {    return System.getProperty("ONLINE_JUDGE")!=null      || System.getProperty("LOCAL")==null;   }catch (Exception e){    return true;   }  }   static BufferedReader in;  static StringTokenizer st;  static BufferedWriter out;  static String getLine() throws IOException{   return in.readLine();  }  static String getToken() throws IOException{   if(st==null || !st.hasMoreTokens())    st = new StringTokenizer(getLine());   return st.nextToken();  }  static int getInt() throws IOException {   return Integer.parseInt(getToken());  }  static long getLong() throws IOException {   return Long.parseLong(getToken());  }  static void print(Object s) throws IOException{   out.write(String.valueOf(s));  }  static void println(Object s) throws IOException{   out.write(String.valueOf(s));   out.newLine();  } }
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;   public LoL(int x, int y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(LoL arg0) {    if (arg0.x == x) {     return y - arg0.y;    }    return arg0.x - x;   }  }  public void solve() throws IOException {     int n = readInt();   int a = readInt()-1;   int b = readInt()-1;   int [] d = new int [n];   for (int i = 0; i <n; i++){    d[i] = readInt();   }   mergeSort(d);   out.print(d[b+1]-d[b]);  } }
3	public class Main{  static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  static long mod=(long)1e9+7;  static long mod1=998244353;  static boolean sieve[];  static ArrayList<Integer> primes;  static long factorial[],invFactorial[];  static HashSet<Pair> graph[];  static boolean oj = System.getProperty("ONLINE_JUDGE") != null;  public static void main (String[] args) throws Exception {   String st[]=nl();   int n=pi(st[0]);   int input[]=new int[n];   st=nl();   for(int i=0;i<n;i++){    input[i]=pi(st[i]);   }   int ans=0;   Arrays.sort(input);   boolean dp[]=new boolean[n];   for(int i=0;i<n;i++){    if(!dp[i]){     ans++;     for(int j=input[i];j<=200;j+=input[i]){      for(int k=i;k<n;k++){       if(input[k]==j&&!dp[k])dp[k]=true;      }     }    }   }   out.println(ans);   out.flush();   out.close();  }  static String[] nl() throws Exception{   return br.readLine().split(" ");  }  static String[] nls() throws Exception{   return br.readLine().split("");  }  static int pi(String str) {   return Integer.parseInt(str);  }  static long pl(String str){   return Long.parseLong(str);  }  static double pd(String str){   return Double.parseDouble(str);  }  static void printPrecision(double d){   DecimalFormat ft = new DecimalFormat("0.000000000000000000000");   out.println(ft.format(d));  }  static void printMask(long mask){   System.out.println(Long.toBinaryString(mask));  }  static int countBit(int mask){   int ans=0;   while(mask!=0){    if(mask%2==1){     ans++;    }    mask/=2;   }   return ans;  }  static void Makegraph(int n){   graph=new HashSet[n];   for(int i=0;i<n;i++){    graph[i]=new HashSet<>();   }  }  static void addEdge(int a,int b){   graph[a].add(new Pair(b,1));  }  static void addEdge(int a,int b,int c){   graph[a].add(new Pair(b,c));  }   static class PairComp implements Comparator<Pair>{   public int compare(Pair p1,Pair p2){    return p1.u-p2.u;   }  }  static class Pair implements Comparable<Pair> {   int u;   int v;   int index=-1;   public Pair(int u, int v) {    this.u = u;    this.v = v;   }   public int hashCode() {    int hu = (int) (u ^ (u >>> 32));    int hv = (int) (v ^ (v >>> 32));    return 31 * hu + hv;   }   public boolean equals(Object o) {    Pair other = (Pair) o;    return u == other.u && v == other.v;   }   public int compareTo(Pair other) {    if(index!=other.index)     return Long.compare(index, other.index);    return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);   }   public String toString() {    return "[u=" + u + ", v=" + v + "]";   }  }  static class PairCompL implements Comparator<Pairl>{   public int compare(Pairl p1,Pairl p2){    if(p1.u-p2.u<0){     return -1;    }    else if(p1.u-p2.u>0){     return 1;    }    else{     if(p1.v-p2.v<0){      return -1;     }     else if(p1.v-p2.v>0){      return 1;     }     else{      return 0;     }    }   }  }  static class Pairl implements Comparable<Pairl> {    long u;    long v;    int index=-1;    public Pairl(long u, long v) {     this.u = u;     this.v = v;    }     public int hashCode() {     int hu = (int) (u ^ (u >>> 32));     int hv = (int) (v ^ (v >>> 32));     return 31 * hu + hv;    }     public boolean equals(Object o) {     Pairl other = (Pairl) o;     return u == other.u && v == other.v;    }     public int compareTo(Pairl other) {     if(index!=other.index)      return Long.compare(index, other.index);     return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);    }     public String toString() {     return "[u=" + u + ", v=" + v + "]";    }   }  public static void debug(Object... o) {   if(!oj)   System.out.println(Arrays.deepToString(o));  }  static long modulo(long a,long b,long c) {   long x=1;   long y=a;   while(b > 0){    if(b%2 == 1){     x=(x*y)%c;    }    y = (y*y)%c;    b /= 2;   }   return x%c;  }  static long gcd(long x, long y)  {   if(x==0)    return y;   if(y==0)    return x;   long r=0, a, b;   a = (x > y) ? x : y;   b = (x < y) ? x : y;   r = b;   while(a % b != 0)   {    r = a % b;    a = b;    b = r;   }   return r;  }  static void sieveMake(int n){   sieve=new boolean[n];   Arrays.fill(sieve,true);   sieve[0]=false;   sieve[1]=false;   for(int i=2;i*i<n;i++){    if(sieve[i]){     for(int j=i*i;j<n;j+=i){      sieve[j]=false;     }    }   }   primes=new ArrayList<Integer>();   for(int i=0;i<n;i++){    if(sieve[i]){     primes.add(i);    }   }    } }
0	public class A {  public void processInput() throws IOException {   Scanner in = new Scanner(System.in);   long n = in.nextLong();   long res = go(n);   System.out.printf(Locale.ENGLISH, "%d\n", res);   in.close();  }  public long go(long n) {   long res = n;   String str = String.valueOf(n);     StringBuilder sb = new StringBuilder(str);   sb.deleteCharAt(str.length() - 1);   if (sb.length() > 0 && !sb.toString().equals("-")) {    res = Math.max(res, Long.valueOf(sb.toString()));   }     if (str.length() > 1) {    if (str.charAt(str.length() - 2) != '-') {     sb = new StringBuilder(str);     sb.deleteCharAt(str.length() - 2);     res = Math.max(res, Long.valueOf(sb.toString()));    }   }     return res;  }  public static void main(String[] args) throws Exception {   A a = new A();   a.processInput();  } }
5	public class Solution implements Runnable {  public static void main(String[] args) {  (new Thread(null, new Solution(), "1", 1l << 28)).start(); }  public 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();  } }  BufferedReader in; PrintWriter out; StringTokenizer st = null;  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[] a = new int[n];  int sum = 0;  for (int i = 0; i < n; i++) sum += (a[i] = nextInt());  Arrays.sort(a);  int ans = 0;  int s = 0;  for (int i = n - 1; i >= 0; i--) {  s += a[i]; ans++;  if (2 * s > sum) break;  }  out.println(ans); }  }
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); } }
0	public class Round313A { private static final int LOCAL_ENV = 0;  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  try {  if (LOCAL_ENV == 1) {   in = new Scanner(new File("input.txt"));  }  } catch (FileNotFoundException e) {  in = new Scanner(System.in);  }  long n = in.nextLong();  if (n >= -9) {  System.out.println(n);  } else {  long absN = Math.abs(n);  long m1 = -(absN / 10);  long last = absN % 10;  long m2 = -((absN / 100) * 10 + last);  System.out.println(Math.max(m1, m2));  } } }
3	public class Main{  public static void main (String[] args) {  Scanner scan = new Scanner(System.in);   int n = scan.nextInt(), min[] = new int[n];  boolean used[] = new boolean[n];  HashSet<Integer> set = new HashSet<>();     for (int i = 0; i < n; i++) {  min[i] = scan.nextInt();  }   for (int i = 0; i < n; i++) {  for (int j = i + 1; j < n; j++) {   if (min[i] > min[j]) {    if (min[i] % min[j] == 0)    min[i] = min[j];   }   else if (min[j] % min[i] == 0)    min[j] = min[i];   }  }   for (int i = 0; i < n; i++) {  set.add(min[i]);  }   System.out.print(set.size()); } }
5	public class Main {  public static void main(String[] argv) {  new Main().run(); }  void run() {  in = new Scanner(System.in);  out = new PrintWriter(System.out);  try {  solve();  } finally {  out.close();  } }  PrintWriter out; Scanner in;  class Pair {  int x;  int y;  Pair(int x, int y) {  this.x = x;  this.y = y;  }  @Override  public String toString() {  return x + " " + y;  } }  int[] readArr(int size) {  int[] a = new int[size];  for (int i = 0; i < size; i++) {  a[i] = in.nextInt();  }  return a; }  void solve() {  int n = in.nextInt();  int k = in.nextInt();  Pair[] a = new Pair[n];  for (int i = 0; i < n; i++) {  a[i] = new Pair(in.nextInt(), in.nextInt());  }  Arrays.sort(a, new Comparator<Pair>() {   @Override  public int compare(Pair p1, Pair p2) {   if (p2.x != p1.x) {   return p2.x - p1.x;   }   return p1.y - p2.y;  }  });  int cnt = 1;  int ans = 0;  int[] res = new int[n];  res[0] = 1;  for (int i = 1; i < n; i++) {  if (!(a[i].x == a[i - 1].x && a[i].y == a[i - 1].y)) {   cnt++;  }  res[i] = cnt;    }  int el = res[k - 1];  for (int i = 0; i < n; i++) {  if (res[i] == el) {   ans++;  }  }  out.println(ans);  } }
6	public class Main { static final long MOD = 998244353;  static boolean[] visited;  public static void main(String[] args) throws IOException {   FastScanner sc = new FastScanner();   int Q = sc.nextInt();   for (int q = 0; q < Q; q++) {   int N = sc.nextInt();   int M = sc.nextInt();   int[][] grid = new int[N][M];   int[][] maxes = new int[M][2];   for (int i = 0; i < M; i++)    maxes[i][1] = i;   for (int i = 0; i < N; i++) {    for (int j = 0; j < M; j++) {    grid[i][j] = sc.nextInt();    maxes[j][0] = Math.max(maxes[j][0],grid[i][j]);    }   }   maxes = sort(maxes);   int[] keyCols = new int[Math.min(M, N)];   for (int i = 0; i < keyCols.length; i++)    keyCols[i] = maxes[i][1];      int ans = 0;   for (int x = 0; x < (int)Math.pow(N,N); x++) {    int[] base = baseN(keyCols.length,x);    int ansx = 0;    for (int i = 0; i < N; i++) {     int r = 0;     for (int j = 0; j < keyCols.length; j++) {     r = Math.max(r,grid[(i+base[j])%N][keyCols[j]]);     }     ansx += r;    }    ans = Math.max(ans,ansx);   }   System.out.println(ans);   }  }   public static int[] baseN(int N, int num) {  int[] ans = new int[N];  for (int i = N-1; i >= 0; i--) {   int pow = (int)Math.pow(N,i);   ans[i] = num/pow;   num -= ans[i]*pow;  }  return ans;  }   public static int[][] sort(int[][] array) {    Random rgen = new Random();  for (int i = 0; i< array.length; i++) {   int randomPosition = rgen.nextInt(array.length);   int[] temp = array[i];   array[i] = array[randomPosition];   array[randomPosition] = temp;  }  Arrays.sort(array, new Comparator<int[]>() {   @Override   public int compare(int[] arr1, int[] arr2) {      return arr2[0]-arr1[0];   }  });  return array; }   static class FastScanner {   BufferedReader br;   StringTokenizer st;    public FastScanner() {    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;   }  } }
1	public class Contest25_A {   static int[] parity;   public static void main(String[] args) {   Scanner scan = new Scanner(System.in);     int numberEntries = scan.nextInt();   scan.nextLine();   String[] numbers = scan.nextLine().split(" ");   numbers = parity(numbers);   int evenOdd = evenOdd(parity);     for (int i = 0; i < parity.length; i++) {    if (parity[i] == evenOdd) {     System.out.println(i + 1);     System.exit(0);    }   }        }  public static int evenOdd(int[] parity) {     int numberOnes = 0;   int numberZeroes = 0;     int one = parity[0];   int two = parity[1];   int three = parity[2];     if (one == 1)    numberOnes++;   else    numberZeroes++;     if (two == 1)    numberOnes++;   else    numberZeroes++;     if (three == 1)    numberOnes++;   else    numberZeroes++;     if (numberOnes >= 2)    return 0;   else    return 1;    }  public static String[] parity(String[] numbers) {   parity = new int[numbers.length];   for (int i = 0; i < numbers.length; i++) {    parity[i] = Integer.parseInt(numbers[i]) % 2;    numbers[i] = Integer.toString(parity[i]);   }   return numbers;  }  }
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;   }  } }
0	public class Main{  public static void main(String[] args) throws IOException{   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   List<Integer> fibs = new ArrayList<Integer>();   int fib0 = 0;   int fib1 = 1;   int fibN = fib0+fib1;   fibs.add(fib0);   fibs.add(fib1);   while(fibN < 1000000000){    fibs.add(fibN);    fib0 = fib1;    fib1 = fibN;    fibN = fib0+fib1;   }   int n = Integer.parseInt(br.readLine());     if(n == 0){System.out.println(0+" "+0+" "+0);}   else{    if(n == 1){System.out.println(0+" "+0+" "+1);}    else{     if(n == 2){System.out.println(0+" "+1+" "+1);}     else{   int i = fibs.indexOf(n);   System.out.println(fibs.get(i-4)+" "+fibs.get(i-3)+" "+fibs.get(i-1));  }}   } } }
4	public class Main20 {  static ArrayList<Integer> primes = new ArrayList<Integer>();  static boolean[] prime = new boolean[1001];  public static void gen(){   Arrays.fill(prime, true);   prime[0] = prime[1] = false;   for (int i = 2; i < 1001; i++) {    if (prime[i]){     primes.add(i);     for (int j = i*2; j < 1001; j+=i)      prime[j] = false;    }   }  }  public static boolean isVowel(char c){   Character r = Character.toLowerCase(c);   return (r == 'e' || r == 'a' || r == 'i' || r == 'o' || r == 'u'|| r == 'y');  }  public static void main(String[] args) throws IOException {   Scanner s = new Scanner(new InputStreamReader(System.in));   String str = s.next();   int x;   int max= 0;     for (int i = 0; i < str.length()-1; i++) {    for (int j = i+1; j < str.length(); j++) {     x = str.indexOf(str.substring(i,j),i+1) ;     if (x != -1){      if (j-i > max) max = j-i;     }    }   }   System.out.println(max);  } }
3	public class TaskA { public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringBuilder sb = new StringBuilder();  int n = Integer.parseInt(br.readLine());  String[] s = br.readLine().split(" ");  int[] arr = new int[n];  for (int i=0; i<n; i++) {  arr[i] = Integer.parseInt(s[i]);  }  Arrays.sort(arr);  boolean[] vis = new boolean[n];  int nColours = 0;  int nVis = 0;  int index = 0;  while (nVis<n) {  while (index<n && nVis<n) {   if (vis[index]) {   index++;   continue;   }   int val = arr[index];   nColours++;   while (index<n && nVis<n) {   if (vis[index]) {    index++;    continue;   }   if (arr[index]%val==0) {    vis[index] = true;    nVis++;   }   index++;   }   index = 0;  }  }  System.out.println(nColours);  } }
0	public class Test {    public static void main(String[] args) {   Scanner s = new Scanner(System.in);   int n = s.nextInt();   int k = 1;   int t = 0;   int y = 2;   int[] a = new int[100000];   if(n==0){    System.out.println(0+" "+0+" "+0);   }   else    if(n==1){    System.out.println(0+" "+0+" "+1);    }    else     if(n==2){     System.out.println(0+" "+1+" "+1);     }     else{      a[0] = 0;      a[1] = 1;      a[y] = a[y - 2] + a[y - 1];      while (a[y - 1] < n) {       a[y] = a[y - 2] + a[y - 1];       ++y;       }      System.out.println(a[y - 2] + " " + a[y - 4] + " " + a[y - 5]);    }        } }
1	public class A {  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 d = nextInt();  int[]x = new int[n];  for (int i = 0; i < n; i++) {  x[i] = nextInt();  }  int ans = 2;  for (int i = 1; i < n; i++) {  if (x[i]-x[i-1]==2*d)   ans++;  else if (x[i]-x[i-1] > 2*d)   ans += 2;  }  System.out.println(ans);  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(); } }
5	public class CDF22_A {  public static void main(String[] args) throws Exception {   Scanner sc = new Scanner(System.in);   int N = sc.nextInt();   int[] A = new int[N];   for (int i=0; i<N; i++)    A[i] = sc.nextInt();   Arrays.sort(A);   int i = 0;   while (i < A.length && A[i] == A[0]) i++;   System.out.println(i == A.length ? "NO" : A[i]);   sc.close();  } }
5	public class CottageTown {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   String[] in = sc.nextLine().split(" ");   int n = Integer.parseInt(in[0]);   int t = Integer.parseInt(in[1]);   int[] coor = new int[n];   int[] side = new int[n];   for (int i = 0; i < n; i++) {    in = sc.nextLine().split(" ");    coor[i] = Integer.parseInt(in[0]);    side[i] = Integer.parseInt(in[1]);   }   quickSort(coor, 0, n - 1, side);   int count = 2;   double dist;   for (int i = 0; i < n - 1; i++) {    dist = (coor[i + 1] - coor[i]) - (double)(side[i + 1] + side[i]) / 2.0;    if (dist > t) {     count += 2;    } else if (dist == t) {     count += 1;    }   }   System.out.println(count);  }  private static int partition(int[] arr, int left, int right, int[] temp) {   int i = left, j = right;   int tmp;   int pivot = arr[(left + right) / 2];   while (i <= j) {    while (arr[i] < pivot) {     i++;    }    while (arr[j] > pivot) {     j--;    }    if (i <= j) {     tmp = arr[i];     arr[i] = arr[j];     arr[j] = tmp;     tmp = temp[i];     temp[i] = temp[j];     temp[j] = tmp;     i++;     j--;    }   }   return i;  }  private static void quickSort(int[] arr, int left, int right, int[] temp) {   int index = partition(arr, left, right, temp);   if (left < index - 1) {    quickSort(arr, left, index - 1, temp);   }   if (index < right) {    quickSort(arr, index, right, temp);   }  } }
5	public class Main1    {    private InputStream is;    private PrintWriter out;    static int MOD = (int)(1e9+7);    ArrayList<Integer>[] amp;    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 Main1().soln();    }    char ch[][];    static ArrayList<Integer>[] g;    static ArrayList<Integer> ar[];    static long ok[];     static int phi[]=new int[500005];    void solve()    {    int n=ni();     int a[]=na(n);     long sum=0;     HashMap<Integer,Integer> hm=new HashMap();     BigInteger ans=(BigInteger.ZERO);     int count=0;     for(int i=n-1;i>=0;i--)     {      int tmp1=0;      int tmp2=0;      int tmp3=0;      if(hm.containsKey(a[i]))      tmp1=hm.get(a[i]);      if(hm.containsKey(a[i]+1))      tmp2=hm.get(a[i]+1);      if(hm.containsKey(a[i]-1))      tmp3=hm.get(a[i]-1);      long lol=sum;      lol-=((long)tmp1*(long)a[i]);      lol-=((long)tmp2*(long)(a[i]+1));      lol-=((long)tmp3*(long)(a[i]-1));      int fr=(count)-tmp1-tmp2-tmp3;      long fuck=(lol)-((long)fr*(long)a[i]);      ans=ans.add(BigInteger.valueOf(fuck));      if(!hm.containsKey(a[i]))      hm.put(a[i],1);      else      hm.put(a[i],hm.get(a[i])+1);      sum+=(long)a[i];      count++;          }     out.println(ans);    }    public static long multiply(long a)    {    return a*10;    }    public static long query1(int v,int start,int end,int l,int r,int x)    {    if(r < start || end < l)     {      return Long.MAX_VALUE;     }     if(l <= start && end <= r)     {      return (tre[v]);     }     int mid = (start + end) / 2;     long p1 = query1(2*v, start, mid, l, r,x);     long p2 = query1(2*v+1, mid+1, end, l, r,x);     return Math.min(p1, p2);    }    public static void update1(int v,int tl,int tr,int index,long a2)    {    if(tl==tr)     {      tre[v]=a2;     }     else     {      int mid=(tl+tr)/2;      if(tl <= index &&index <= mid)      {       update1(2*v,tl, mid, index, a2);      }      else      {       update1(2*v+1,mid+1,tr, index, a2);      }      tre[v]=(Math.min(tre[2*v],tre[2*v+1]));     }    }  static boolean visited[][];  static int a[][];    public static long query(int v,int start,int end,int l,int r,int x)    {    if(r < start || end < l)     {      return 0;     }     if(l <= start && end <= r)     {      return (tre[v]);     }     int mid = (start + end) / 2;     long p1 = query(2*v, start, mid, l, r,x);     long p2 = query(2*v+1, mid+1, end, l, r,x);     return Math.max(p1, p2);    }    public static void update(int v,int tl,int tr,int index,long a2)    {    if(tl==tr)     {      tre[v]=a2;     }     else     {      int mid=(tl+tr)/2;      if(tl <= index &&index <= mid)      {       update(2*v,tl, mid, index, a2);      }      else      {       update(2*v+1,mid+1,tr, index, a2);      }      tre[v]=(Math.max(tre[2*v],tre[2*v+1]));     }    }    static long tre[]=new long[400005];       boolean isPrime(int x)     {     if(x==0||x==1)      return false;     for(int i = 2;i*1L*i<=x;i++) if(x%i==0) return false;     return true;    }    int p ;    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;    }    public static long gcd(long a, long b){     if(b==0) return a;     return gcd(b,a%b);    }    class Pair1 implements Comparable<Pair1>{     long a;     long b;     long c;     Pair1(long x,long y,long z){     this.a=x;     this.b=y;     this.c=z;     }     public int hashCode() {      return Objects.hash();     }         @Override     public int compareTo(Pair1 arg0) {      return (int)(arg0.c-c);     }     }    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 int[][] nm(int n, int m) {     int[][] map = new int[n][m];     for (int i = 0; i < n; i++)     {      for(int j=0;j<m;j++)       map[i][j]=ni();     }     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) {  Scanner sc = new Scanner(System.in);   int n = sc.nextInt(), sum = 0;   Integer[] A = new Integer[n];   for (int i = 0 ; i < n ; i++) {  A[i] = sc.nextInt();  sum += A[i];  }   Arrays.sort(A, Collections.reverseOrder());   int c = 0, ans = 0;   while (ans <= sum) {  ans += A[c];  sum -= A[c];  c++;  }   System.out.println(c); } }
2	public class C {  static int mod = (int) (1e9+7);  static InputReader in;  static PrintWriter out;   public static void main(String[] args)  {   in = new InputReader(System.in);   out = new PrintWriter(System.out);      long x = in.nextLong();   long k = in.nextLong();     if(x == 0){    out.println(0);   }   else{     long mul = pow(2, k + 1, mod);   x %= mod;   mul = (mul * x) % mod;   long sub = pow(2, k, mod);   sub = (sub - 1 + mod) % mod;   mul = (mul - sub + mod) % mod;   out.println(mul);   }     out.close();  }   static class Pair implements Comparable<Pair>  {   int x,y;   int i;     Pair (int x,int y)   {     this.x = x;     this.y = y;   }   Pair (int x,int y, int i)   {     this.x = x;     this.y = y;     this.i = i;   }   public int compareTo(Pair o)   {    return Integer.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 + " "+i;   }     }    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 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;   }  } }
6	public class E { public static void main(String[] args) {  MyScanner sc = new MyScanner();  int t = sc.nextInt();  for(int w = 0; w < t; w++) {  int n = sc.nextInt(), m = sc.nextInt();  TreeSet<X> set = new TreeSet<X>();  int[][] grid = new int[n][m];  for(int i = 0; i < n; i++)   for(int j = 0; j < m; j++) {   grid[i][j] = sc.nextInt();   set.add(new X(i, j, grid[i][j]));   }  Y[] top4 = new Y[n];  int sum = 0;  for(int i = 0; i < n; i++) {   top4[i] = new Y(set.pollLast());   sum += top4[i].a;  }  Arrays.sort(top4);  HashSet<String> strs = new HashSet<String>();  AAA[] sss = new AAA[n];  boolean[] used = new boolean[n];  if(n == 4) {   for(int i = 0; i < 4; i++) {   int max = -1, jj = -1;   for(int j = 0; j < 4; j++) {    if(!used[j] && top4[j].a > max) {    max = top4[j].a;    jj = j;    }   }   used[jj] = true;   sss[i] = new AAA(max, jj);   }   for(int i = 0; i < n; i++)   strs.add(top4[i].i + " " + top4[i].j);  }  int ans = sum;  if(n == 4 && top4[0].j == top4[1].j && top4[2].j == top4[3].j && top4[0].j != top4[2].j) {   if(two(top4[0], top4[1]) != two(top4[2], top4[3])) {   ans = 0;   int oneCol = two(top4[0], top4[1]) ? top4[2].j : top4[0].j;   for(int i = 0; i < n; i++)    for(int j = 0; j < m; j++)    if(!strs.contains(i + " " + j)){     int no = -1;     for(int k = 0; k < 4; k++)     if(j == oneCol && top4[k].j == oneCol && two(top4[k], new Y(new X(i, j, 0))))      no = k;     ans = max(ans, sum - sss[no == sss[3].i ? 2 : 3].a + grid[i][j]);    }   }  }  out.println(ans);  }  out.close(); } static class AAA {  int a, i;  public AAA(int A, int I) {  a = A;   i = I;  } } static boolean two(Y y1, Y y2) {  return (y1.i - y2.i + 4) % 4 == 2; } static class Y implements Comparable<Y> {  int i, j, a;  public Y(X x) {  i = x.i;  j = x.j;  a = x.a;  }  public int compareTo(Y x) {  if(j == x.j)   return i - x.i;  return j - x.j;  } } static class X implements Comparable<X> {  int i, j, a;  public X(int I, int J, int A) {  i = I;  j = J;  a = A;  }  public int compareTo(X x) {  if(a == x.a && i == x.i)   return j - x.j;  else if(a == x.a)   return i - x.i;  return a - x.a;  } } public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static class MyScanner {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st;  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 D11 { static boolean[][] g; static int n, m; public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out); n = input.nextInt(); m = input.nextInt(); g = new boolean[n][n]; for(int i = 0; i<m; i++) {  int a = input.nextInt()-1, b = input.nextInt()-1;  g[a][b] = g[b][a] = true; } long res = 0; map = new HashMap<Integer, Long>(); for(int i = n-1; i>=0; i--) {  memo = new long[i+1][1<<(i+1)];  for(long[] A : memo) Arrays.fill(A, -1);  res += count(i, i, 1<<i)/2; } out.println(res); out.close(); } static long[][] memo; static HashMap<Integer, Long> map; static long count(int at, int start, int mask) { if(memo[at][mask] != -1) return memo[at][mask]; int bits = Integer.bitCount(mask); if(at == start && bits > 2) return 1; long res = 0; for(int i = 0; i<=start; i++) {  if(!g[at][i]) continue;  if(i != start && (mask & (1<<i)) > 0) continue;  if(i == start && bits <= 2) continue;  res += count(i, start, mask | (1<<i)); } return memo[at][mask] = res; } 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()); } } }
4	public class C35 {  public static int mod = 1000000007; public static long INF = (1L << 60);  static int n,m; static class Pair {  int x,y;  Pair(int x,int y)  {  this.x=x;  this.y=y;  } } static boolean[][] burned; static int[] dx={-1,0,1,0}; static int[] dy={0,-1,0,1}; static boolean isvalid(int x,int y) {  return x>=0&&x<n&&y>=0&&y<m; } public static void main(String[] args) throws IOException {  Scanner in = new Scanner("input.txt");  PrintWriter out = new PrintWriter(new FileWriter("output.txt"));  n=in.nextInt();  m=in.nextInt();  burned=new boolean[n][m];  int k=in.nextInt();  Queue<Pair> queue=new LinkedList<>();  Pair prev=null;  for(int i=0;i<k;i++)  {  int x=in.nextInt();  int y=in.nextInt();  burned[x-1][y-1]=true;  queue.add(prev=new Pair(x-1, y-1));  }  while(!queue.isEmpty())  {  Queue<Pair> tempqueue=new LinkedList<>();  for(Pair p : queue)  {  int x=p.x;  int y=p.y;  prev=p;  for(int i=0;i<4;i++)  {   if(isvalid(x+dx[i], y+dy[i])&&!burned[x+dx[i]][y+dy[i]])   {   tempqueue.add(new Pair(x+dx[i], y+dy[i]));   burned[x+dx[i]][y+dy[i]]=true;   }  }  }  queue=tempqueue;  }  out.printf("%d %d\n",(prev.x+1),(prev.y+1));  out.close();  }  public static long pow(long x, long n)  {  long res = 1;  for (long p = x; n > 0; n >>= 1, p = (p * p))  {  if ((n & 1) != 0)   {   res = (res * p);  }  }  return res; }  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 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();}  } }
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;  } }
5	public class A { @SuppressWarnings("unchecked") private static void solve() throws IOException {  ArrayList<Num> c = new ArrayList<Num>();  n = nextInt();  a = nextInt();  b = nextInt();  for(int i = 0; i < n; i++) {  int next = nextInt();  boolean found = false;  for(int j = 0; j < c.size(); j++) {   if(c.get(j).num == next) {   c.get(j).freq++;   found = true;   break;   }  }  if(!found)   c.add(new Num(next));  }  Collections.sort(c);  int below = 0;  int above = n;  boolean f = false;  for(int i = 0; i < c.size(); i++) {  below += c.get(i).freq;  above -= c.get(i).freq;  if(below == b && above == a) {   if(i == c.size())   break;   System.out.println(c.get(i+1).num - c.get(i).num);   f = true;   break;  }  }  if(!f)  System.out.println(0); }  static int n; static int a; static int b; public static void main(String[] args) {  try {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  out.close();  } catch (Throwable e) {  e.printStackTrace();  System.exit(239);  } }  static BufferedReader br; static StringTokenizer st; static PrintWriter out;  static String nextToken() throws IOException {  while (st == null || !st.hasMoreTokens()) {  String line = br.readLine();  if (line == null) {   return null;  }  st = new StringTokenizer(line);  }  return st.nextToken(); }  static int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  static long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  static double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } } class Num implements Comparable<Num> { int num; int freq; Num(int n) {  num = n;  freq = 1; } public int compareTo(Num other) {  return this.num - other.num; } }
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(); } }
0	public class C186D2A { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = in.nextInt();  if (n >= 0) {  out.println(Math.abs(n));  } else {  out.println(Math.max(n/10, (n/100)*10 + n%10));  }  out.flush(); } }
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;   }  } }
3	public class mainA {  public static PrintWriter out = new PrintWriter(System.out);  public static FastScanner enter = new FastScanner(System.in);  public static void main(String[] args) throws IOException {   solve();   out.close();  }  public static boolean[] was;  private static void solve() throws IOException{   int n=enter.nextInt();   int[] arr=new int[n];   was=new boolean[n];   for (int i = 0; i <n ; i++) {    arr[i]=enter.nextInt();   }   Arrays.sort(arr);   int ans=0;   for (int i = 0; i <n ; i++) {    if(was[i]) continue;    find(i, arr);    ans++;   }   out.println(ans);  }  public static void find (int num, int[] arr){   for (int i = num+1; i <arr.length ; i++) {    if(arr[i]%arr[num]==0) was[i]=true;   }  }  static class FastScanner {   BufferedReader br;   StringTokenizer stok;   FastScanner(InputStream is) {    br = new BufferedReader(new InputStreamReader(is));   }   String next() throws IOException {    while (stok == null || !stok.hasMoreTokens()) {     String s = br.readLine();     if (s == null) {      return null;     }     stok = new StringTokenizer(s);    }    return stok.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());   }   char nextChar() throws IOException {    return (char) (br.read());   }   String nextLine() throws IOException {    return br.readLine();   }  } }
1	public class A {    public static void main(String[] args) throws IOException  {     Scanner sc=new Scanner(System.in);   PrintWriter pw=new PrintWriter(System.out);   int n=sc.nextInt();   String []a=new String[n];   String []b=new String[n];     TreeMap<String,Integer> map1=new TreeMap(),map2=new TreeMap();   for(int i=0;i<n;i++)   {   String s=sc.next();   map1.put(s, map1.getOrDefault(s, 0)+1);      }   for(int i=0;i<n;i++)   {   String s=sc.next();   map2.put(s, map2.getOrDefault(s, 0)+1);      }   int ans=0;   for(String s:map2.keySet())   {   int cnt=map1.getOrDefault(s, 0);   ans+=Math.max(0, map2.get(s)-cnt);   }   pw.println(ans);   pw.close();  }      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 Scanner(String s) throws FileNotFoundException {  br = new BufferedReader(new FileReader(s));  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public boolean ready() throws IOException {  return br.ready();  } }    }
5	public class D implements Runnable{ public static void main (String[] args) {new Thread(null, new D(), "_cf", 1 << 28).start();}  public void run() {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  System.err.println("Go!");   int n = fs.nextInt();  Pair[] a = new Pair[n], b = new Pair[n];  for(int i = 0; i < n; i++) {  a[i] = new Pair(fs.nextInt(), i+1);  b[i] = new Pair(a[i].val, a[i].id);  }  Arrays.sort(a);   Fenwick_Tree ft = new Fenwick_Tree(n), ftFreq = new Fenwick_Tree(n);  BigInteger res = BigInteger.ZERO;  int[] update = new int[n];  int sum = 0;  for(int i = 0; i < n; i++) {   if(i + 1 == n || (i + 1 < n && a[i+1].val != a[i].val)) {   update[i] = sum+1;   sum = 0;  }  else {   sum++;  }  }  for(int i = 0; i < n; i++) {  int pos = a[i].id;  long val = a[i].val;  long right = ft.sum(n) - ft.sum(pos);  long freq = ftFreq.sum(n) - ftFreq.sum(pos);       res = add(res, right - (val * freq));     long left = ft.sum(pos);  freq = ftFreq.sum(pos);  res = add(res, (val * freq) - left);        if(update[i] > 0) {   ft.update(pos, val);   ftFreq.update(pos, 1);   int ptr = i-1;   while(ptr >= 0 && update[ptr] == 0) {   ft.update(a[ptr].id, val);   ftFreq.update(a[ptr].id, 1);   ptr--;   }  }  }   HashMap<Integer, Integer> freq = new HashMap<>();  for(int i = n-1; i >= 0; i--) {  if(!freq.containsKey(b[i].val+1)) {   if(!freq.containsKey(b[i].val)) freq.put(b[i].val, 0);   freq.put(b[i].val, freq.get(b[i].val)+1);   continue;  }  long fr = freq.get(b[i].val+1);   res = sub(res, fr * (b[i].val+1) - (fr * (b[i].val)));   if(!freq.containsKey(b[i].val)) freq.put(b[i].val, 0);  freq.put(b[i].val, freq.get(b[i].val)+1);  }    freq.clear();   for(int i = 0; i < n; i++) {  if(!freq.containsKey(b[i].val+1)) {   if(!freq.containsKey(b[i].val)) freq.put(b[i].val, 0);   freq.put(b[i].val, freq.get(b[i].val)+1);   continue;  }  long fr = freq.get(b[i].val+1);   res = add(res, (fr*(b[i].val+1)) - (fr*b[i].val));   if(!freq.containsKey(b[i].val)) freq.put(b[i].val, 0);  freq.put(b[i].val, freq.get(b[i].val)+1);  }   out.println(res);   out.close(); }  BigInteger add (BigInteger a, long b) {  BigInteger res = a.add(BigInteger.valueOf(b));  return res; }  BigInteger sub (BigInteger a, long b) {  BigInteger res = a.subtract(BigInteger.valueOf(b));  return res; }  class Pair implements Comparable<Pair> {  int val, id;  Pair (int a, int b) {  val = a;  id = b;  }   public int compareTo (Pair o) {  if(val == o.val) return Integer.compare(id, o.id);  return Integer.compare(o.val, val);  } }  class Fenwick_Tree {   long[] bit;  int n;   public Fenwick_Tree(int a) {  n = a + 1;  bit = new long[n];  }      void update (int index, long val) {  while(index < n) {   bit[index] += val;   index += (index & (-index));  }  }   long sum (int index) {  long sum = 0;  while(index > 0) {   sum += bit[index];   index -= (index & (-index));  }  return sum;  } }   void sort (int[] a) {  int n = a.length;  for(int i = 0; i < 1000; i++) {  Random r = new Random();  int x = r.nextInt(n), y = r.nextInt(n);  int temp = a[x];  a[x] = a[y];  a[y] = temp;  }  Arrays.sort(a); }  class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner() {  try {   br = new BufferedReader(new InputStreamReader(System.in));     st = new StringTokenizer("");  } 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 = "";  try {line = br.readLine();}  catch (Exception e) {e.printStackTrace();}  return line;  }  public Integer[] nextIntegerArray(int n) {  Integer[] a = new Integer[n];  for(int i = 0; i < n; i++) a[i] = nextInt();  return a;  }  public int[] nextIntArray(int n) {  int[] a = new int[n];  for(int i = 0; i < n; i++) a[i] = nextInt();  return a;  }  public char[] nextCharArray() {return nextLine().toCharArray();} } }
4	public class C { public static void main(String[] args) throws Exception {  File in = new File("input.txt"), out = new File("output.txt");  Scanner s;  PrintWriter pw;  if (in.exists()) {  s = new Scanner(in);  pw = new PrintWriter(out);  } else {  s = new Scanner(System.in);  pw = new PrintWriter(System.out);  }  int n = s.nextInt(), m = s.nextInt();  int k = s.nextInt();  List<int[]> list = new ArrayList<int[]>();  for (int t = 0; t < k; ++t) {  list.add(new int[] { s.nextInt() - 1, s.nextInt() - 1 });  }  int max = 0, mi = 1, mj = 1;  for (int i = 0; i < n; ++i) {  for (int j = 0; j < m; ++j) {   int min = Integer.MAX_VALUE;   for (int[] p : list) {   min = Math.min(min, Math.abs(i - p[0]) + Math.abs(j - p[1]));   }   if (min > max) {   max = Math.max(max, min);   mi = i + 1;   mj = j + 1;   }  }  }  pw.println(mi + " " + mj);  pw.close(); } }
0	public class ElevatorOrStairs {  private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); private static final OutputStreamWriter writer = new OutputStreamWriter(System.out);  public static void main(String...strings) throws Exception {  String[] specs = reader.readLine().split(" ");   int x = Integer.parseInt(specs[0]);  int y = Integer.parseInt(specs[1]);  int z = Integer.parseInt(specs[2]);  int t1 = Integer.parseInt(specs[3]);  int t2 = Integer.parseInt(specs[4]);  int t3 = Integer.parseInt(specs[5]);   reader.close();  String ans = solve(x, y, z, t1, t2, t3);  writer.append(ans);  writer.flush();  writer.close(); }  private static String solve(int x, int y, int z, int t1, int t2, int t3) {  int time_using_stairs = Math.abs(x - y) * t1;  int elevator_time_between_floor = Math.abs(x - z) * t2;  int elevator_from_z_to_x = elevator_time_between_floor + 2*t3;    int time_using_elevator = elevator_from_z_to_x + (Math.abs(x - y) * t2) + t3;    if(time_using_elevator <= time_using_stairs) {   return "YES";  }  return "NO"; } }
4	public class Main{  public static void main(String[] args)throws IOException{   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   String s=br.readLine();   int max=0;   for(int i=0;i<s.length();i++){    int len=0;    int k=i;    boolean flag=false;    for(int j=i+1;j<s.length();j++){     if(s.charAt(k)==s.charAt(j)){     len++;     k++;     flag=true;     }     else if(flag==true){      j=j-len;      k=i;      if(max<len)      max=len;      len=0;      flag=false;          }         }    if(max<len)    max=len;   }   System.out.print(max);  }}
6	public class Main {   static int V; static ArrayList<Integer> adjList [];  static int first(int a){  int idx = 0;  while (a > 0 && (a & 1) == 0) {   idx++;   a>>=1;  }  return idx; } static long Number_Of_Simple_Cycles () {  long dp [][] = new long[1 << V][V];   for (int i = 0 ; i < V ; ++i)  dp[1 << i][i] = 1;   for (int mask = 1 ; mask < 1 << V ; ++mask) {   if (Integer.bitCount(mask) <= 1) continue;   for (int current = 0 ; current < V ; ++current) {   if (((1 << current) & mask) == 0) continue;      for (int last : adjList[current])    if (current != first(mask))    {     dp[mask][current] += dp[mask ^ (1 << current)][last];    }   }  }   long ans = 0 ;  int allVisited = (1 << V) - 1;  for (int mask = 1 ; mask < 1 << V ; ++mask) {  if (Integer.bitCount(mask) < 3) continue;  for (int u = 0 ; u < V ; ++u) {   if (adjList[u].contains(first (mask)))   ans += dp[mask][u];  }  }  return ans >> 1; } public static void main(String[] args) throws Exception {  Scanner sc = new Scanner(System.in);  StringBuilder sb = new StringBuilder();  PrintWriter out = new PrintWriter(System.out);  V = sc.nextInt();  adjList = new ArrayList[V];  for (int i = 0 ; i < V ; ++i) adjList[i] = new ArrayList<>();  int E = sc.nextInt();  while (E -- > 0) {  int v = sc.nextInt() - 1;  int u = sc.nextInt() - 1;  adjList[v].add(u);  adjList[u].add(v);  }  out.print(Number_Of_Simple_Cycles());  out.flush();  out.close(); }   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 CottageVillage { Scanner in; PrintWriter out;  CottageVillage() {  in = new Scanner(System.in);  out = new PrintWriter(System.out); }  public void finalize() {  out.flush();  in.close();  out.close(); }  int ans(House a, House b, int t) {  int diff = b.cordl - a.cordr;   if(diff < t) return 0;  if(diff == t) return 1;  return 2; }  void solve() {  int  n = in.nextInt(),  t = in.nextInt() * 2;  House[] hs = new House[n];   for(int i = 0; i < n; ++i)  {  int   c = in.nextInt(),   l = in.nextInt();  hs[i] = new House(2 * c - l, 2 * c + l);  }   Arrays.sort(hs);     int co = 2;  for(int i = 0; i < n - 1; ++i)  co += ans(hs[i], hs[i + 1], t);   out.println(co); }  public static void main(String[] args) throws FileNotFoundException {  CottageVillage t = new CottageVillage();  t.solve();  t.finalize(); } } class House implements Comparable<House> { public int cordl, cordr;  public House(int c, int l) {  cordl = c;  cordr = l; }  @Override public int compareTo(House h) {  return cordl - h.cordl; } }
3	public class lets_do {  FastReader in;  PrintWriter out;  Helper_class h;  final long mod = 1000000009;  final int MAXN = 1000005;  final int lgN = 20;  final long INF = (long)1e18;  final long MAX_Ai = (long)1e12;  public static void main(String[] args) throws java.lang.Exception{   new lets_do().run();  }  void run() throws Exception{   in=new FastReader(System.in);   out = new PrintWriter(System.out);   h = new Helper_class();   int t = 1;   while(t--> 0)    solve();   out.flush();   out.close();  }  void solve(){   int n = h.ni();   long[] arr = new long[n];   int i = 0, j = 0;   for(i = 0; i < n; i++)    arr[i] = h.nl();   HashMap<Long, Integer> hmap = new HashMap<Long, Integer>();   int cnt = 0;   for(i = 0; i < n; i++){    long sum = 0;    for(j = i; j < n; j++){     sum += arr[j];     Integer x = hmap.get(sum);     if(x == null)      hmap.put(sum, cnt++);    }   }   TreeSet<Pair>[] tset = new TreeSet[cnt];   for(i = 0; i < cnt; i++)    tset[i] = new TreeSet<Pair>(com);   for(i = 0; i < n; i++){    long sum = 0;    for(j = i; j < n; j++){     sum += arr[j];     tset[hmap.get(sum)].add(new Pair(i, j));    }   }   int max = 0;   int ind = -1;   int max_x = 0, max_y = 0;   for(i = 0; i < cnt; i++){   int curr_y = tset[i].first().y;   int cnt1 = 1;    for(Pair yo : tset[i]){     if(yo.x > curr_y) {     cnt1++;     curr_y = yo.y;     }    }    if(max < cnt1) {    max = cnt1;    ind = i;    }   }   h.pn(max);   Pair hola_yee = new Pair(tset[ind].first().x, tset[ind].first().y);   h.pn((tset[ind].first().x + 1) +" "+(tset[ind].first().y + 1));   int curr_y = tset[ind].first().y;   for(Pair yo : tset[ind]){    if(yo.x > curr_y) {    curr_y = yo.y;    h.pn((yo.x + 1) +" "+(yo.y + 1));    }   }  }   static final Comparator<Pair> com=new Comparator<Pair>(){   public int compare(Pair a, Pair b){    if(Integer.compare(a.y, b.y) != 0)     return Integer.compare(a.y, b.y);    else     return Integer.compare(a.x, b.x);   }  };  class Pair{   int x;   int y;   Pair(int p, int q){    x = p;    y = q;   }  }  class Edge{   int u , v;   long wt;   Edge(int a, int b, long w){    u = a;    v = b;    wt = w;   }   int other(int x) {    return u ^ v ^ x;   }  }   class Helper_class{   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 bitcount(long n){return (n==0)?0:(1+bitcount(n&(n-1)));}   void p(Object o){out.print(o);}   void pn(Object o){out.println(o);}   void pni(Object o){out.println(o);out.flush();}   String n(){return in.next();}   String nln(){return in.nextLine();}   int ni(){return Integer.parseInt(in.next());}   long nl(){return Long.parseLong(in.next());}   double nd(){return Double.parseDouble(in.next());}   long mul(long a,long b){    if(a>=mod)a%=mod;    if(b>=mod)b%=mod;    a*=b;    if(a>=mod)a%=mod;    return a;   }   long modPow(long a, long p){    long o = 1;    while(p>0){     if((p&1)==1)o = mul(o,a);     a = mul(a,a);     p>>=1;    }    return o;   }   long add(long a, long b){    if(a>=mod)a%=mod;    if(b>=mod)b%=mod;    if(b<0)b+=mod;    a+=b;    if(a>=mod)a-=mod;    return a;   }  }  class FastReader{   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   public FastReader(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 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;   }  } }
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 A { FastScanner in; PrintWriter out; boolean systemIO = true;  public static void quickSort(int[] a, int from, int to) {  if (to - from <= 1) {  return;  }  int i = from;  int j = to - 1;  int x = a[from + (new Random()).nextInt(to - from)];  while (i <= j) {  while (a[i] < x) {   i++;  }  while (a[j] > x) {   j--;  }  if (i <= j) {   int t = a[i];   a[i] = a[j];   a[j] = t;   i++;   j--;  }  }  quickSort(a, from, j + 1);  quickSort(a, j + 1, to); }   public void solve() {  int n = in.nextInt();  HashSet<Long> ans = new HashSet<>();  Long d = in.nextLong();  long[] a = new long[n];  for (int i = 0; i < a.length; i++) {  a[i] = in.nextInt();  }  for (int i = 0; i < a.length; i++) {  long x = a[i] - d;  boolean flag = true;  for (int j = 0; j < a.length; j++) {   if (Math.abs(a[j] - x) < d) {   flag = false;   break;   }  }  if (flag) {   ans.add(x);  }  x = a[i] + d;  flag = true;  for (int j = 0; j < a.length; j++) {   if (Math.abs(a[j] - x) < d) {   flag = false;   break;   }  }  if (flag) {   ans.add(x);  }  }  out.println(ans.size()); }  public void run() {  try {  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();  } 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[] args) {  new A().run(); } }
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(); }  }
3	public class Main {  public static void main(String[] args) throws IOException {   PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));  FastScanner sc = new FastScanner();  int dp[][]=new int[6000][6000];  char a[]=new char[6000];  final int n=sc.nextInt();  boolean flag=false;  int cnt=0;  char pre='f';  for(int i=1;i<=n;i++)  {   a[i]=sc.next().charAt(0);  }  dp[1][1]=1;  final int mod=(int)1e9+7;  dp[1][1]=1;  for(int i=2;i<=n;i++)  {  if(a[i-1]=='s')  {   int now=0;   for(int j=5050;j>=1;j--)   {   now=(now+dp[i-1][j])%mod;   dp[i][j]=now;   }  }  else  {   for(int j=5050;j>=1;j--)   {   dp[i][j]=dp[i-1][j-1]%mod;   }  }  }  int ans=0;  for(int i=0;i<=5050;i++)  {  ans+= dp[n][i]%mod;  ans%=mod;  }  out.println(ans%mod);  out.flush(); }  static class FastScanner {  BufferedReader br;  StringTokenizer st;  private FastScanner() {  try {   br = new BufferedReader(new InputStreamReader(System.in));   st = new StringTokenizer(br.readLine());  } catch (Exception e){e.printStackTrace();}  }  private boolean hasNextToken()  {  if(st.countTokens()!=StreamTokenizer.TT_EOF)  {   return true;  }  else   return false;  }  private String next() {  if (st.hasMoreTokens()) return st.nextToken();  try {st = new StringTokenizer(br.readLine());}  catch (Exception e) {e.printStackTrace();}  return st.nextToken();  }  private BigInteger nextBigInteger(){return new BigInteger(next());}  private BigDecimal nextBigDecimal(){return new BigDecimal(next());}  private int nextInt() {return Integer.parseInt(next());}  private long nextLong() {return Long.parseLong(next());}  private double nextDouble() {return Double.parseDouble(next());}  private 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;  }  private int[] nextIntArray(int n) {  int[] a = new int[n];  for(int i = 0; i < n; i++) a[i] = nextInt();  return a;  }  private long[] nextLongArray(int n){  long[] a = new long[n];  for(int i = 0; i < n; i++) a[i] = nextLong();  return a;  }  private double[] nextDoubleArray(int n){  double[] a = new double[n];  for(int i = 0; i < n; i++) a[i] = nextDouble();  return a;  }  private 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;  }  private void sort(int arr[])  {  int cnt[]=new int[(1<<16)+1];  int ys[]=new int[arr.length];  for(int j=0;j<=16;j+=16){   Arrays.fill(cnt,0);   for(int x:arr){cnt[(x>>j&0xFFFF)+1]++;}   for(int i=1;i<cnt.length;i++){cnt[i]+=cnt[i-1];}   for(int x:arr){ys[cnt[x>>j&0xFFFF]++]=x;}   { final int t[]=arr;arr=ys;ys=t;}  }  if(arr[0]<0||arr[arr.length-1]>=0)return;  int i,j,c;  for(i=arr.length-1,c=0;arr[i]<0;i--,c++){ys[c]=arr[i];}  for(j=arr.length-1;i>=0;i--,j--){arr[j]=arr[i];}  for(i=c-1;i>=0;i--){arr[i]=ys[c-1-i];}  } } }
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);   TaskG solver = new TaskG();   solver.solve(1, in, out);   out.close();  }  static class TaskG {   static int[][] g;   static int n;   static int[] a;   static int[][] edges;   static long[] dp;   static long[] dpPathToRootWithDetours;   static int time = 0;   static int[] appearance;   static int[] firstAppearance;   static int[] depth;   public static void dfs(int i, int parE) {    firstAppearance[i] = time;    appearance[time++] = i;    dp[i] = a[i];    for (int eIndex : g[i]) {     if (eIndex == parE) continue;     int child = i ^ edges[eIndex][0] ^ edges[eIndex][1];     dfs(child, eIndex);     appearance[time++] = i;     dp[i] += Math.max(dp[child] - edges[eIndex][2] * 2, 0);    }   }   public static void dfs2(int i, int parE) {    if (i == 0) {     dpPathToRootWithDetours[i] = dp[i];    } else {     int par = i ^ edges[parE][0] ^ edges[parE][1];     depth[i] = depth[par] + 1;     dpPathToRootWithDetours[i] = dpPathToRootWithDetours[par] - Math.max(0, dp[i] - edges[parE][2] * 2);     dpPathToRootWithDetours[i] -= edges[parE][2];     dpPathToRootWithDetours[i] += dp[i];     long myPathWeight = Math.max(dp[i] - edges[parE][2] * 2, 0);     long change = dp[par] - myPathWeight - edges[parE][2] * 2;     change = Math.max(change, 0);     dp[i] += change;    }    for (int eIndex : g[i]) {     if (eIndex == parE) continue;     dfs2(i ^ edges[eIndex][0] ^ edges[eIndex][1], eIndex);    }   }   public void solve(int testNumber, InputReader in, PrintWriter out) {    n = in.NextInt();    int q = in.NextInt();    a = in.NextIntArray(n);    edges = new int[n - 1][3];    {     long[] count = new long[n];     for (int i = 0; i < n - 1; i++) {      int u = in.NextInt() - 1;      int v = in.NextInt() - 1;      int w = in.NextInt();      edges[i][0] = u;      edges[i][1] = v;      edges[i][2] = w;      count[u]++;      count[v]++;     }     g = new int[n][];     for (int i = 0; i < n; i++) {      g[i] = new int[(int) count[i]];     }     for (int i = 0; i < n - 1; i++) {      for (int j = 0; j < 2; j++) {       g[edges[i][j]][(int) --count[edges[i][j]]] = i;      }     }    }    dp = new long[n];    dpPathToRootWithDetours = new long[n];    depth = new int[n];    firstAppearance = new int[n];    appearance = new int[(n - 1) * 2 + 1];    dfs(0, -1);    dfs2(0, -1);    GraphLowestCommonAncestor.LCA lca = GraphLowestCommonAncestor.createLCA(appearance, firstAppearance, depth);    firstAppearance = null;    depth = null;    appearance = null;    edges = null;    g = null;    for (int i = 0; i < q; i++) {     int u = in.NextInt() - 1;     int v = in.NextInt() - 1;     int lcaI = lca.getLCA(u, v);     long res = dpPathToRootWithDetours[u] + dpPathToRootWithDetours[v] - 2 * dpPathToRootWithDetours[lcaI] + dp[lcaI];     out.println(res);    }   }  }  static class MinRangeSparseTable implements ISearchInRange {   private final int[][] sparseTables;   private final long[] array;   private final boolean reverseOrdered;   public MinRangeSparseTable(long[] array, boolean reverseOrdered) {    this.reverseOrdered = reverseOrdered;    this.array = array;    int LCALength = IntegerExtension.getNumberOfBits(array.length);    sparseTables = new int[LCALength][];    sparseTables[0] = new int[array.length];    for (int i = 0; i < array.length; i++) {     sparseTables[0][i] = i;    }    for (int i = 1; i < LCALength; i++) {     int size = 1 << i;     int jumpSize = 1 << (i - 1);     sparseTables[i] = new int[sparseTables[0].length - size + 1];     for (int j = 0; j < sparseTables[i].length; j++) {      sparseTables[i][j] = min(sparseTables[i - 1][j], sparseTables[i - 1][j + jumpSize]);     }    }   }   private int min(int a, int b) {    return ((array[a] < array[b]) ^ reverseOrdered) ? a : b;   }    public Pair<Long, Long> queryIndexValueInRange(long l, long r) {    int size = (int) (r - l + 1);    int LCAIndex = IntegerExtension.getNumberOfBits(size) - 1;    int sizeNeeded = 1 << LCAIndex;    int res = min(sparseTables[LCAIndex][(int) l], sparseTables[LCAIndex][(int) (r - sizeNeeded + 1)]);    return new Pair<>((long) res, array[res]);   }   public MinRangeSparseTable(long[] array) {    this(array, false);   }  }  static class GraphLowestCommonAncestor {   public static GraphLowestCommonAncestor.LCA createLCA(int[] appearances, final int[] firstAppearance, final int[] depth) {    return new GraphLowestCommonAncestor.LCA_MinRangeSparseTable(appearances, firstAppearance, depth);   }   public interface LCA {    int getLCA(int a, int b);   }   private static class LCA_MinRangeSparseTable implements GraphLowestCommonAncestor.LCA {    private final MinRangeSparseTable minRangeSparseTable;    private final int[] firstAppearance;    private final int[] indexToNode;    public LCA_MinRangeSparseTable(int[] appearances, final int[] firstAppearance, final int[] depth) {     this.firstAppearance = firstAppearance;     this.indexToNode = appearances;     long[] depthOrder = new long[appearances.length];     for (int i = 0; i < depthOrder.length; i++) {      depthOrder[i] = depth[appearances[i]];     }     minRangeSparseTable = new MinRangeSparseTable(depthOrder);    }     public int getLCA(int a, int b) {     a = firstAppearance[a];     b = firstAppearance[b];     int l = Math.min(a, b), r = Math.max(a, b);     return indexToNode[(int) (long) minRangeSparseTable.queryIndexValueInRange(l, r).first];    }   }  }  static 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(), " \t\n\r\f,");     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }   public int NextInt() {    return Integer.parseInt(next());   }   public int[] NextIntArray(int n) {    return NextIntArray(n, 0);   }   public int[] NextIntArray(int n, int offset) {    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = NextInt() + offset;    }    return a;   }  }  static interface ISearchInRange {  }  static class Pair<T1, T2> {   public T1 first;   public T2 second;   public Pair(T1 f, T2 s) {    first = f;    second = s;   }  }  static class IntegerExtension {   public static int getNumberOfBits(long i) {    return 64 - Long.numberOfLeadingZeros(i);   }  } }
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); } }
3	public class template { public static void main(String[] args) throws Exception {  FastScanner sc = new FastScanner();  PrintWriter pw = new PrintWriter(System.out);  int n = sc.nextInt();  Integer[] arr = new Integer[n];  for(int i=0;i<n;i++) {  arr[i]=sc.nextInt();  }  Arrays.sort(arr);  int ct = 0;  boolean[] ar = new boolean[n];  for(int i=0;i<n;i++) {  if(!ar[i]) {   ar[i]=true;   ct++;   int x = arr[i];   for(int j=0;j<n;j++) {   if(arr[j]%x==0) {    ar[j]=true;   }   }  }  }   pw.println(ct);  pw.close(); } } @SuppressWarnings("all") class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner(BufferedReader d) {   br=d;  }  public FastScanner(String s) {   try {    br = new BufferedReader(new FileReader(s));   } catch (FileNotFoundException e) {       e.printStackTrace();   }  }   public FastScanner() {   br = new BufferedReader(new InputStreamReader(System.in));  }   String nextToken() {   while (st == null || !st.hasMoreElements()) {    try {     st = new StringTokenizer(br.readLine());    } catch (IOException e) {         e.printStackTrace();    }   }   return st.nextToken();  }   int nextInt() {   return Integer.parseInt(nextToken());  }   long nextLong() {   return Long.parseLong(nextToken());  }   double nextDouble() {   return Double.parseDouble(nextToken());  } }
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());   }  } }
4	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new FileReader("input.txt"));   String dimensions = br.readLine();  String extractDim = "";  int n = 0, m;  for (int i = 0 ; i < dimensions.length() ; i++)  {  if(dimensions.charAt(i) == ' ')  {   n = Integer.parseInt(extractDim);   extractDim = "";   continue;  }  extractDim += dimensions.charAt(i);  }  m = Integer.parseInt(extractDim);    String burningTrees = br.readLine();   int k = Integer.parseInt(burningTrees);    Point[] coord = new Point[k];   String coordSet = br.readLine();  int spaceCount = 0;  String newCoord = "";  int s = 0;  for(int i = 0 ; i < coordSet.length() ; i++)  {  if(coordSet.charAt(i) == ' ')   spaceCount++;    if(spaceCount == 2)  {   String extractCoord = "";   int x = 0, y;   for (int j = 0 ; j < newCoord.length() ; j++)   {   if(newCoord.charAt(j) == ' ')   {    x = Integer.parseInt(extractCoord);    extractCoord = "";    continue;   }   extractCoord += newCoord.charAt(j);   }   y = Integer.parseInt(extractCoord);     coord[s] = new Point(x,y);   s++;   newCoord = "";   spaceCount = 0;   continue;  }    newCoord += coordSet.charAt(i);  }   String extractCoord = "";  int x = 0, y;  for (int j = 0 ; j < newCoord.length() ; j++)  {  if(newCoord.charAt(j) == ' ')  {   x = Integer.parseInt(extractCoord);   extractCoord = "";   continue;  }  extractCoord += newCoord.charAt(j);  }  y = Integer.parseInt(extractCoord);   coord[s] = new Point(x,y);  s++;   br.close();   int[][] forest = new int[n+2][m+2];   for(int i = 0 ; i < forest.length ; i++)  {  for(int j = 0 ; j < forest[i].length ; j++)  {   if(i == 0 || i == n+1 || j == 0 || j == m+1 )   forest[i][j] = 0;   else   forest[i][j] = 1;  }  }     Queue<Point> q = new LinkedList<>();   for(int i = 0 ; i < coord.length ; i++)  {  forest[coord[i].x][coord[i].y] = 0;  q.add(coord[i]);  }   Point tree = new Point();  while(!q.isEmpty())  {  Point temp = q.remove();  forest[temp.x][temp.y] = 0;    if(q.isEmpty())   tree = new Point(temp.x ,temp.y);  for(int i = -1 ; i <= 1 ; i++)  {   for(int j = -1; j <= 1; j++)   {   if(i != 0 && j != 0 || i == 0 && j == 0)    continue;   if(forest[temp.x+i][temp.y+j] == 0)    continue;   else   {    forest[temp.x+i][temp.y+j] = 0;    q.add(new Point(temp.x+i , temp.y+j));   }   }  }    }     BufferedWriter bw = new BufferedWriter(new FileWriter("output.txt"));  bw.write(tree.x + " " + tree.y);  bw.close();    } }
5	public class A {  int n;  int[] a;  public void run() throws IOException{   Scanner s = new Scanner(new InputStreamReader(System.in));     n = s.nextInt();   a = new int[n];   long sum = 0;   for (int i = 0; i < n; i++) {    a[i] = s.nextInt();    sum+=a[i];   }     Arrays.sort(a);     long mysum = 0;   int count = 0;   for (int i = n-1; i > -1; i--) {    if (mysum > sum)     break;       count++;    mysum+=a[i];    sum-=a[i];   }        System.out.println(count);    }   public static void main(String[] args) throws IOException {   (new A()).run();  } }
1	public class Main {  public static void main(String[] args) throws IOException {    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   String[] s = reader.readLine().split(" ");   int n = Integer.parseInt(s[0]);   int d = Integer.parseInt(s[1]);   List<Integer> list = new ArrayList<>();   s = reader.readLine().split(" ");   for (int i = 0; i < n; i++) {    list.add(Integer.parseInt(s[i]));   }   HashSet<Integer> set = new HashSet<>();   for (Integer i : list) {    set.add(i - d);    set.add(i + d);   }   HashSet<Integer> set2 = new HashSet<>();   for (Integer i : set) {    for (Integer x : list) {     if (Math.abs(i - x) < d) {      set2.add(i);    }    }   }   set.removeAll(set2);   System.out.println(set.size());  } }
6	public class MaeDosDragoes { public static PrintWriter saida = new PrintWriter(System.out, false); public static class Escanear {   BufferedReader reader;   StringTokenizer tokenizer;  public Escanear() {    this(new InputStreamReader(System.in));   }  public Escanear(Reader in) {    reader = new BufferedReader(in);   }   String proximo() {    while (tokenizer == null || !tokenizer.hasMoreElements()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return tokenizer.nextToken();   }     int nextInt() {    return Integer.parseInt(proximo());   }  }   public static void main(String[] args) {  Escanear fastScanner = new Escanear();   int proximoInt = fastScanner.nextInt();   double proximoDouble = fastScanner.nextInt();   long[] graph = new long[proximoInt];   for(Integer i = 0; i < proximoInt; i++) {    for(Integer j =0; j < proximoInt; j++) {     Integer val = fastScanner.nextInt();     if (val.equals(1) || i.equals(j)) {   graph[i] |= 1L << j;   }    }   }   int szLeft = proximoInt/2;   int szRight = proximoInt - szLeft;   int[] dp = new int[1 << szLeft];   int maxMask = 1 << szLeft;   for(int mask = 1; mask <maxMask; mask++) {    int curMask = mask;    for(int j = 0; j < szLeft; j++) {     if (((1 << j) & mask) > 0) {      curMask &= graph[j + szRight] >> szRight;      dp[mask] = Math.max(dp[mask], dp[mask ^ (1 << j)]);     }    }    if (mask == curMask) {     dp[mask] = Math.max(dp[mask],Integer.bitCount(mask));    }   }   int ans = 0;   int rmaxMask = 1 << szRight;   for(int mask = 0; mask < rmaxMask; mask++) {    int curMask = mask;    int oMask = maxMask -1;    for(int j = 0; j < szRight; j++) {     if (((1 << j) & mask) > 0) {      curMask &= (graph[j] & (rmaxMask-1));      oMask &= graph[j] >> szRight;     }    }    if (curMask != mask) continue;    ans = Math.max(ans, Integer.bitCount(mask) + dp[oMask]);   }   proximoDouble/=ans;   saida.println(proximoDouble * proximoDouble * (ans * (ans-1))/2);   saida.flush();  } }
5	public class Solution {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int n = in.nextInt();   int[] a = new int[n];   boolean has_more_than_one = false;   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();    if (a[i] > 1)     has_more_than_one = true;   }   Arrays.sort(a);   if (n == 1) {    if (a[0] == 1)     out.print(2);    else     out.print(1);   } else {    out.print(1 + " ");    for (int i = 1; i < n; i++) {     if (has_more_than_one || i < n - 1)      out.print(a[i - 1] + " ");     else      out.println(2);    }   }   out.close();  } }
3	public class PaintColor {  public static void main(String[] args) throws Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(br.readLine());   String input[] = br.readLine().split(" ");   int c = 0;   Set<Integer> s = new HashSet<>();   int arr[] = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = Integer.parseInt(input[i]);   }   Arrays.sort(arr);   for (int i = 0; i < n; i++) {    if (!s.contains(arr[i])) {     c++;     for (int j = i; j < n; j++) {      if (arr[j] % arr[i] == 0) {       s.add(arr[j]);      }     }    }   }   System.out.println(c);  } }
6	public class Main {  static PrintWriter out; static InputReader ir;  static void solve() {  int t = ir.nextInt();  while (t-- > 0) {  int n = ir.nextInt();  int m = ir.nextInt();  int[][] a = new int[n][];  for (int i = 0; i < n; i++) {   a[i] = ir.nextIntArray(m);  }  int[][][] comx = new int[n + 1][m][2];  for (int i = 0; i < m; i++) {   int[] b = new int[n];   for (int j = 0; j < n; j++) {   b[j] = a[j][i];   }   Arrays.sort(b);   for (int j = 0; j < n; j++) {   comx[j + 1][i][0] = comx[j][i][0] + b[n - 1 - j];   comx[j + 1][i][1] = i;   }  }  int[][][] org = new int[n + 1][m][2];  for (int i = 0; i <= n; i++)   for (int j = 0; j < m; j++) {   for (int k = 0; k < 2; k++) {    org[i][j][k] = comx[i][j][k];   }   }  for (int i = 1; i <= n; i++)   Arrays.sort(comx[i], new Comparator<int[]>() {   public int compare(int[] A, int[] B) {    return A[0] - B[0];   }   });      if (n == 1) {   out.println(comx[1][m - 1][0]);  } else if (n == 2) {   out.println(Math.max(comx[2][m - 1][0], m >= 2 ? comx[1][m - 1][0] + comx[1][m - 2][0] : 0));  } else if (n == 3) {   int res = Math.max(comx[3][m - 1][0],    m >= 3 ? comx[1][m - 1][0] + comx[1][m - 2][0] + comx[1][m - 3][0] : 0);   if (m >= 2) {   for (int i = 0; i < m; i++) {    int p = comx[2][i][0];    int ma = 0;    for (int j = 0; j < m; j++) {    if (comx[2][i][1] == j)     continue;    ma = Math.max(org[1][j][0], ma);    }    res = Math.max(res, p + ma);   }   }   out.println(res);  } else {   int res = Math.max(comx[4][m - 1][0],    m >= 4 ? comx[1][m - 1][0] + comx[1][m - 2][0] + comx[1][m - 3][0] + comx[1][m - 4][0] : 0);   if (m >= 2) {   for (int i = 0; i < m; i++) {    int p = comx[3][i][0];    int ma = 0;    for (int j = 0; j < m; j++) {    if (comx[3][i][1] == j)     continue;    ma = Math.max(org[1][j][0], ma);    }    res = Math.max(res, p + ma);   }   }   if (m >= 3) {   for (int i = 0; i < m; i++) {    int p = comx[2][i][0];    PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());    for (int j = 0; j < m; j++) {    if (comx[2][i][1] == j)     continue;    pq.add(org[1][j][0]);    }    res = Math.max(res, p + pq.poll() + pq.poll());   }   }   if (m >= 2) {   for (int i = 0; i < m; i++) {    int p = 0;    for (int j = 0; j < 4; j++) {    p = Math.max(p, a[j][i] + a[(j + 1) % 4][i]);    }    int ma = 0;    for (int j = 0; j < m; j++) {    if (i == j)     continue;    for (int k = 0; k < 4; k++) {     ma = Math.max(ma, a[k][j] + a[(k + 1) % 4][j]);    }    }    res = Math.max(res, p + ma);   }   for (int i = 0; i < m; i++) {    int p = 0;    for (int j = 0; j < 4; j++) {    p = Math.max(p, a[j][i] + a[(j + 2) % 4][i]);    }    int ma = 0;    for (int j = 0; j < m; j++) {    if (i == j)     continue;    for (int k = 0; k < 4; k++) {     ma = Math.max(ma, a[k][j] + a[(k + 2) % 4][j]);    }    }    res = Math.max(res, p + ma);   }   }   out.println(res);  }  }  }  public static void main(String[] args) {  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;  } }  static void tr(Object... o) {  out.println(Arrays.deepToString(o)); } }
1	public class utkarsh {  InputStream is;  PrintWriter out;   long mod = (long) (1e9 + 7);  boolean SHOW_TIME;   void solve() {        int n = ni();   int d = ni();   int a[] = na(n);   Arrays.sort(a);   int ans = 2;   for(int i = 0; i < n-1; i++) {    if(a[i+1] - a[i] == (2 * d)) ans++;    else if(a[i+1] - a[i] > (2 * d)) ans += 2;   }   out.println(ans);  }     public static void main(String[] args) { new utkarsh().run(); }  void run() {   is = System.in;   out = new PrintWriter(System.out);   long start = System.currentTimeMillis();   solve();   long end = System.currentTimeMillis();   if(SHOW_TIME) out.println("\n" + (end - start) + " ms");   out.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[] na(int n) {   int a[] = new int[n];   for(int i = 0; i < n; i++) { a[i] = ni(); }   return a;  }  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);  } }
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(); } }
4	public class Solution {  public static void main(String [] args){   Scanner in = new Scanner(System.in);   String ins = in.nextLine();   HashMap <String,Integer> sub = new HashMap<String,Integer>();   for (int i=0;i<ins.length();i++){    for (int j=i+1;j<=ins.length();j++){     String key = ins.substring(i,j);     if (sub.containsKey(key)){      sub.put(key,sub.get(key)+1);     } else {      sub.put(key,1);     }    }   }   int max = 0;   for (String key:sub.keySet()){    if (sub.get(key) >= 2 && key.length() > max){     max = key.length();    }   }   System.out.print(max);  } }
4	public class D {  static FastIO f; static long ve[][], he[][];  public static void main(String args[]) throws IOException {  f = new FastIO();  int n = f.ni(), m = f.ni(), k = f.ni(), i, j;  ve = new long[n-1][];  he = new long[n][];  long[][] ans = new long[n][m], pans = new long[n][m], temp;  for(i = 0; i < n; i++)  he[i] = f.nla(m-1);  for(i = 0; i < n-1; i++)  ve[i] = f.nla(m);  if(k%2 == 1)  {  for(i = 0; i < n; i++)   Arrays.fill(ans[i], -1L);  }  else  {  k /= 2;   while(k-->0)  {   for(i = 0; i < n; i++)   {   for(j = 0; j < m; j++)   {    ans[i][j] = Integer.MAX_VALUE;    if(i != 0)    ans[i][j] = Math.min(ans[i][j], pans[i-1][j] + 2*edge(i, j, i-1, j));    if(i != n-1)    ans[i][j] = Math.min(ans[i][j], pans[i+1][j] + 2*edge(i, j, i+1, j));    if(j != 0)    ans[i][j] = Math.min(ans[i][j], pans[i][j-1] + 2*edge(i, j, i, j-1));    if(j != m-1)    ans[i][j] = Math.min(ans[i][j], pans[i][j+1] + 2*edge(i, j, i, j+1));   }   }         temp = pans;   pans = ans;   ans = temp;  }   temp = pans;  pans = ans;  ans = temp;  }  for(i = 0; i < n; i++)  {  for(j = 0; j < m; j++)  {   f.out(ans[i][j] + " ");  }   f.out("\n");  }  f.flush(); }  public static void errorprint(long[][] p, int n, int m) throws IOException {  int i, j;  for(i = 0; i < n; i++)  {  for(j = 0; j < m; j++)  {   f.err(p[i][j] + " ");  }   f.err("\n");  }   f.err("\n"); }  public static long edge(int i, int j, int x, int y) {  if(i == x)  return he[i][Math.min(j, y)];  else  return ve[Math.min(i, x)][j]; }  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);  } } }
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);   CNastyaAndAWardrobe solver = new CNastyaAndAWardrobe();   solver.solve(1, in, out);   out.close();  }  static class CNastyaAndAWardrobe {   public void solve(int testNumber, InputReader in, PrintWriter out) {    long x = in.nextLong(), k = in.nextLong();    if (x != 0) {     long m = (int) 1e9 + 7;     x = x % m;     long res = in.fastPowerMod(2, k, m);     long res1 = (2 * res) % m;     long ans = ((res1 * x) % m - (res - 1) % m) % m;     ans = (ans + m) % m;     out.println(ans);    } else {     out.println(0);    }   }  }  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 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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public long fastPowerMod(long x, long y, long m) {    long res = 1;    x = x % m;    while (y > 0) {     if ((y & 1) == 1) {      res = (x * res) % m;     }     x = (x * x) % m;     y = y >> 1;    }    return res % m;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
6	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   G1playlist solver = new G1playlist();   solver.solve(1, in, out);   out.close();  }  static class G1playlist {   int mod = 1000000007;   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    int T = in.scanInt();    int[][] song = new int[n][2];    for (int i = 0; i < n; i++) {     song[i][0] = in.scanInt();     song[i][1] = in.scanInt() - 1;    }    int[][][] dp = new int[T + 1][(1 << n)][3];    for (int i = 0; i < n; i++)     if (song[i][0] <= T) {      dp[song[i][0]][(1 << i)][song[i][1]] = 1;     }    for (int t = 0; t <= T; t++) {     for (int i = 0; i < (1 << n); i++) {      for (int j = 0; j < 3; j++) {       if (dp[t][i][j] == 0) continue;       for (int k = 0; k < n; k++) {        if (((1 << k) & i) == 0 && t + song[k][0] <= T && song[k][1] != j)         dp[t + song[k][0]][(1 << k) | i][song[k][1]] = (dp[t + song[k][0]][(1 << k) | i][song[k][1]] + dp[t][i][j]) % mod;       }      }     }    }    long ans = 0;    for (int i = 0; i < (1 << n); i++) {     for (int j = 0; j < 3; j++) {      ans = (ans + dp[T][i][j]) % mod;     }    }    out.println(ans);   }  }  static class ScanReader {   private byte[] buf = new byte[4 * 1024];   private int index;   private BufferedInputStream in;   private int total;   public ScanReader(InputStream inputStream) {    in = new BufferedInputStream(inputStream);   }   private int scan() {    if (index >= total) {     index = 0;     try {      total = in.read(buf);     } catch (Exception e) {      e.printStackTrace();     }     if (total <= 0) return -1;    }    return buf[index++];   }   public int scanInt() {    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();     }    }    return neg * integer;   }   private boolean isWhiteSpace(int n) {    if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;    else return false;   }  } }
6	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   QuickScanner in = new QuickScanner(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, QuickScanner in, PrintWriter out) {    int n = in.nextInt();    int m = in.nextInt();    boolean[][] is = new boolean[n][n];    for (int i = 0; i < n; i++) {     is[i][i] = true;    }    long[][] dp = new long[1 << n | 1][n];    for (int i = 0; i < m; i++) {     int u = in.nextInt() - 1;     int v = in.nextInt() - 1;     is[u][v] = is[v][u] = true;     dp[(1 << u) + (1 << v)][v] = 1;     dp[(1 << u) + (1 << v)][u] = 1;    }    int k = 0;    long res = 0;    for (int mask = 1; mask < 1 << n; ++mask) {     boolean f = true;     for (int i = 0; i < n; i++) {      if ((mask & (1 << i)) != 0 && dp[mask][i] == 0) {       if (f) {        f = false;        k = i;       } else {        for (int j = k + 1; j < n; j++) {         if ((mask & (1 << j)) != 0 && is[i][j]) {          dp[mask][i] += dp[mask - (1 << i)][j];         }        }       }       if (is[k][i]) res += dp[mask][i];      }     }    }    out.println(res >> 1);   }  }  static class QuickScanner {   BufferedReader br;   StringTokenizer st;   InputStream is;   public QuickScanner(InputStream stream) {    is = stream;    br = new BufferedReader(new InputStreamReader(stream), 32768);   }   String nextToken() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(nextToken());   }  } }
4	public class A {  public static void main(String[] args) throws IOException {   new A().solve();  }  BufferedReader br;  StringTokenizer st = new StringTokenizer("");  private void solve() throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));   String s = nextToken();   int res = 0;   for (int i = 0; i < s.length(); i++) {    for (int j = i + 1; j < s.length(); j++) {     int k = 0;     while (k < s.length() - j && s.charAt(i + k) == s.charAt(j + k)) {      k++;     }     res = Math.max(res, k);    }   }   PrintWriter pw = new PrintWriter(System.out);   pw.println(res);   pw.close();  }  String nextToken() throws IOException {   while (!st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return st.nextToken();  } }
6	public class Ok_Simple { static BufferedReader reader; static StringTokenizer tokenizer; static boolean am[][]; static long dp[][]; static int n; public static void main(String[] args) throws IOException {  reader = new BufferedReader(new InputStreamReader(System.in));  int m;  n = NextInt();  m = NextInt();  am = new boolean[n][n];  dp = new long[n][1 << n];  for (int i = 0; i < n; ++i)  Arrays.fill(dp[i], -1);  for (int i = 0; i < m; ++i) {  int a = NextInt() - 1;  int b = NextInt() - 1;  am[a][b] = am[b][a] = true;  };  long res = 0;  for (int a = 0; a < n; ++a)  res += solve(a, (1 << a));  System.out.println(res / 2); } private static long solve(int b, int mask) {  int a = 0;  for (int i = 0 ;i < n; ++i)  if (((mask >> i) & 1) != 0)  {   a = i;   break;  }  if (dp[b][mask] >= 0)  return dp[b][mask];  long res = 0;  if (am[b][a] && Integer.bitCount(mask) > 2)  res = 1;  for (int i = a + 1; i < n; ++i)  if (((mask >> i) & 1) == 0 && am[b][i])   res += solve(i, mask ^ (1 << i));  return dp[b][mask] = res; } static int NextInt() throws NumberFormatException, IOException {  return Integer.parseInt(NextToken()); } static double NextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(NextToken()); } static long NextLong() throws NumberFormatException, IOException {  return Long.parseLong(NextToken()); } static String NextToken() throws IOException {  while(tokenizer == null || !tokenizer.hasMoreTokens()) {  tokenizer = new StringTokenizer(reader.readLine());  }  return tokenizer.nextToken(); } }
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(); } }
2	public class B {  public static void main(String[] args) {  doIt(); }  static void doIt() {  Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);  long n = sc.nextLong();  long k = sc.nextLong();  long msum = (k - 1) * k / 2 + 1;  long u = k;  long l = 0;  long m = (u + l) / 2;  while(l < u){  m = (u + l) / 2 + (u + l) % 2;  long sum = (m - 1) * m / 2;  if(n <= msum - sum) l = m;  else u = m - 1;  }  m = (u + l) / 2 + (u + l) % 2;  if(msum - (m - 1) * m / 2 < n) System.out.println(-1);  else System.out.println(k - m); } }
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);  ProblemCFireAgain solver = new ProblemCFireAgain ();  solver.solve (1, in, out);  out.close (); }  static class ProblemCFireAgain {  private static final byte[] dx = {-1, 0, 0, 1};  private static final byte[] dy = {0, -1, 1, 0};  private static int[][] lvl;  private static int max;  private static int n;  private static int m;  private static int k;  private static ProblemCFireAgain.Pair[] bgn;  private static ProblemCFireAgain.Pair res;   private static void bfs2d () {  Queue<ProblemCFireAgain.Pair> bfsq = new LinkedList<ProblemCFireAgain.Pair> ();  for (ProblemCFireAgain.Pair src : bgn) {   lvl[src.a][src.b] = 0;   bfsq.add (src);  }  while (!bfsq.isEmpty ()) {   ProblemCFireAgain.Pair op = bfsq.poll ();   int plvl = lvl[op.a][op.b];   if (plvl>max) {   res = op;   max = plvl;   }   for (int i = 0; i<4; i++) {   int newX = op.a+dx[i];   int newY = op.b+dy[i];    if (newX>0 && newX<=n && newY>0 && newY<=m && lvl[newX][newY] == -1) {    bfsq.add (new ProblemCFireAgain.Pair (newX, newY));    lvl[newX][newY] = (plvl+1);    }   }  }  }   public void solve (int testNumber, InputReader _in, PrintWriter _out) {    try (InputReader in = new InputReader (new FileInputStream ("input.txt"));   PrintWriter out = new PrintWriter (new BufferedWriter (new FileWriter ("output.txt")))) {   n = in.nextInt ();   m = in.nextInt ();   k = in.nextInt ();   bgn = new ProblemCFireAgain.Pair[k];   for (int i = 0; i<k; i++) {   bgn[i] = new ProblemCFireAgain.Pair (in.nextInt (), in.nextInt ());   }   max = Integer.MIN_VALUE;   lvl = new int[n+5][m+5];   for (int i = 0; i<n+4; i++) {   Arrays.fill (lvl[i], -1);   }   bfs2d ();   out.println (res);  } catch (Exception e) {   }  }   private static class Pair {  int a;  int b;    Pair (int a, int b) {   this.a = a;   this.b = b;  }      public String toString () {   return a+" "+b;  }      public boolean equals (Object o) {   if (this == o) return true;   if (!(o instanceof ProblemCFireAgain.Pair)) return false;   ProblemCFireAgain.Pair pair = (ProblemCFireAgain.Pair) o;   return a == pair.a && b == pair.b;  }      public int hashCode () {   return Objects.hash (a, b);  }    }   }  static class InputReader implements AutoCloseable {  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 {   String str;   if ((str = reader.readLine ()) != null) tokenizer = new StringTokenizer (str);   else return null;   } catch (IOException e) {   throw new RuntimeException (e);   }  }  return tokenizer.nextToken ();  }   public int nextInt () {  return Integer.parseInt (next ());  }     public void close () throws Exception {  reader.close ();  }   } }
0	public class A199 { static int n[][] = new int[][] { { -1, 0 }, { 1, 0 }, { 0, -1 }, { 0, 1 } };  public static void main(String[] args) throws IOException {  new A199().solve(); }  public void solve() throws IOException {  Scanner scan = new Scanner(System.in);  int N = scan.nextInt();        System.out.println("0 0 " + N ); } }
5	public class Test {  public static void main(String[] args)  {  Scanner t = new Scanner(System.in);  int n=t.nextInt();  int a[]= new int[n];  for(int i=0; i<n; i++)   a[i]=t.nextInt();  Arrays.sort(a);  int r=a[0];  for(int i=1; i<n; i++)   if(a[i]!=r)   {    System.out.println(a[i]);    System.exit(0);   }  System.out.println("NO");    } }
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));   }  } }
0	public class Main implements Runnable {  PrintWriter out;  Scanner in;  public static void main(String[] args) throws IOException {   new Thread(new Main()).start();  }  public void run() {   try {    out = new PrintWriter(new BufferedOutputStream(System.out));    in = new Scanner(System.in);    solve();    out.close();   } catch (IOException e) {    throw new IllegalStateException(e);   }  }  public void solve() throws IOException {   int n = in.nextInt();   if (n >= 0) {    out.println(n);   } else {    String s = String.valueOf(n);    int l = s.length();    String s1 = s.substring(0, l - 2);    if (s.charAt(l - 1) > s.charAt(l - 2)) {     s1 += s.charAt(l - 2);    } else {     s1 += s.charAt(l - 1);    }    out.println(Integer.parseInt(s1));   }  } }
6	public class SimpleTask {  public static void main(String[] args) throws Exception {   InputReader in = new InputReader(System.in);   int n = in.nextInt();   int m = in.nextInt();   int[] g = new int[n];   long[][] dp = new long[1 << n][n];   for (int i = 0; i < m; i++) {    int a = in.nextInt() - 1, b = in.nextInt() - 1;    g[a] |= (1 << b);    g[b] |= (1 << a);   }   int all = (1 << n) - 1;   for (int i = 0; i < n; i++) {    int l = (1 << i);    int left = all ^ (l - 1) ^ l;    for (int j = left; j > 0; j = (j - 1) & left)     if ((j & (j - 1)) != 0) {      dp[j | l][i] = 1;     }   }   for (int i = (1 << n) - 1; i > 0; i--) {    int last = i & -i;    for (int j = 0; j < n; j++) {     if (((1 << j) == last && (i & (i - 1)) != 0)       || ((1 << j) & i) == 0)      continue;     for (int k = 0; k < n; k++) {      if ((1 << k) >= last && ((1 << k) & g[j]) != 0        && ((1 << k) == last || ((1 << k) & i) == 0)) {       dp[i][j] += dp[i | (1 << k)][k];      }     }    }   }   long res = 0;   for (int i = 0; i < n; i++)    res += dp[(1 << i)][i];   System.out.println(res / 2);  }  static 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());   }  } }
4	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  PandaScanner in = new PandaScanner(inputStream);  PrintWriter out = new PrintWriter(outputStream);  A solver = new A();  solver.solve(1, in, out);  out.close(); } } class A {  public void solve(int testNumber, PandaScanner in, PrintWriter out) {   String s = in.next();   String[] ss = Substring.allSubstrings(s);   int res = 0;   for (String sss: ss) {    if (sss.length() <= res) continue;    if (Substring.occurences(s, sss).length > 1) {     res = sss.length();    }   }   out.println(res);  } } class PandaScanner {  public BufferedReader br;  public StringTokenizer st;  public InputStream in;  public PandaScanner(InputStream in) {   br = new BufferedReader(new InputStreamReader(this.in = in));  }  public String nextLine() {   try {    return br.readLine();   }   catch (Exception e) {    return null;   }  }  public String next() {   if (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(nextLine().trim());    return next();   }   return st.nextToken();  }  } class Substring {  public static String[] allSubstrings(String s) {   TreeSet<String> substrings = new TreeSet<String>();   int n = s.length();   for (int i = 0; i < n; i++) {    for (int j = i + 1; j < n; j++) {     substrings.add(s.substring(i, j));    }   }   return substrings.toArray(new String[0]);  }  public static int[] occurences(String s, String target) {   int n = s.length();   ArrayList<Integer> res = new ArrayList<Integer>();   int idx = s.indexOf(target);   while (idx != -1) {    res.add(idx);    if (idx == n - 1) break;    idx = s.indexOf(target, idx + 1);   }   n = res.size();   int[] arr = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = res.get(i);   }   return arr;  } }
1	public class Elektronnietablici { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer in; static PrintWriter out = new PrintWriter(System.out);  public static String nextToken() throws IOException{  while (in == null || !in.hasMoreTokens()){  in = new StringTokenizer(br.readLine());  }   return in.nextToken(); }  public static int nextInt() throws IOException{  return Integer.parseInt(nextToken()); }  public static double nextDouble() throws IOException{  return Double.parseDouble(nextToken()); }  public static void main(String[] args) throws IOException{  int n = nextInt();   String S;  for (int i = 0; i < n; i++) {  S = nextToken();    int f = 0;  if (S.charAt(0) == 'R' && S.charAt(1) >= '1' && S.charAt(1) <= '9'){   for (int j = 2; j < S.length(); j++) {   if (S.charAt(j) >= 'A' && S.charAt(j) <= 'Z'){    f = 1;    break;   }   }  }    if (f == 0){   String T1 = "";   String ans = "R";     int j;     for (j = 0; S.charAt(j) >= 'A' && S.charAt(j) <= 'Z'; j++) {   T1 += S.charAt(j);   }     ans += S.substring(j, S.length()) + "C";     int len = j;     j--;     int p = 1;   int z = 0;   for (; j >= 0; j--) {   z += (S.charAt(j) - 'A') * p;   p *= 26;   }     p = 1;   for (int k = 0; k < len; k++) {   z += p;   p *= 26;   }     ans += z;     out.println(ans);  }  else{   String T1 = "";   String ans = "";     int j;   for (j = 1; S.charAt(j) != 'C'; j++) {   ans += S.charAt(j);   }     T1 = S.substring(j + 1, S.length());   int z = Integer.parseInt(T1);   int p = 1;   int len = 0;     while (p <= z){   z -= p;   p *= 26;   len++;   }   p /= 26;     T1 = "";     for (int k = len - 1; k >= 0; k--) {   int l = z / p;      T1 += (char)(z / p + 'A');      z -= l * p;      p /= 26;   }   ans = T1 + ans;     out.println(ans);  }  }         out.close(); } }
3	public class PythonIndentation { public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  int N = Integer.parseInt(in.readLine());  int[][] dp = new int[N][N];  dp[0][0] = 1;  for(int i = 1; i < N; ++i) {  char lastCmd = in.readLine().charAt(0);  int[] sum = new int[N];  sum[N - 1] = dp[i - 1][N - 1];  for(int j = N - 2; j >= 0; --j)   sum[j] = (sum[j + 1] + dp[i - 1][j]) % 1000000007;  for(int j = 0; j < N; ++j) {   if(lastCmd == 'f' && j > 0)   dp[i][j] = dp[i - 1][j - 1];   else if(lastCmd == 's')   dp[i][j] = sum[j];  }  }  int ans = 0;  for(int i = 0; i < N; ++i)  ans = (ans + dp[N - 1][i]) % 1000000007;  System.out.println(ans); } }
1	public class B { 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();  if (n%2==1) {   System.out.println("NO");   continue;  }  n/=2;  int sqrt = (int)Math.sqrt(n);  if (sqrt*sqrt==n) {   System.out.println("YES");   continue;  }  if (n%2==1) {   System.out.println("NO");   continue;  }  n/=2;  sqrt = (int)Math.sqrt(n);  if (sqrt*sqrt==n) {   System.out.println("YES");   continue;  }  System.out.println("NO");  } } }
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();   }  }  }
4	public class c {  static boolean used[][]; static int n; static int m; static int a[][];   public static void main(String args[])throws Exception{  Scanner in =new Scanner(new File("input.txt"));  PrintWriter out=new PrintWriter(new File("output.txt"));  n = in.nextInt();  m = in.nextInt();  int k = in.nextInt();     int x[]=new int[k];  int y[]=new int[k];  for (int i = 0; i<k; i++){  x[i] = in.nextInt();  y[i] = in.nextInt();  }   int max = 0;  int xx = 1; int yy= 1;  for (int i = 1; i<=n; i++)  for (int j = 1; j<=m; j++){   int count = Integer.MAX_VALUE;   for (int l =0; l<k; l++)   count = Math.min(Math.abs(i - x[l]) + Math.abs(j - y[l]), count);    if (max < count){   max = count;   xx = i; yy = j;   }  }  out.println(xx + " " + yy);  out.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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    long MOD = 1000000007;    long[] current = new long[n + 3];       current[0] = 1;    for (int i = 0; i < n - 1; i++) {     String s = in.next();     if (s.equals("f")) {      for (int j = i + 1; j > 0; j--) {       current[j] = current[j - 1];       current[j] %= MOD;      }      current[0] = 0;     } else {      for (int j = i + 1; j >= 0; j--) {             current[j] = current[j + 1] + current[j];       current[j] %= MOD;      }                     }    }    long result = 0;    for (int i = 0; i <= n; i++) {     result += current[i];     result %= MOD;    }    out.println(result);   }  }  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 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 Main {     static final long MOD = 998244353L;   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();    String ans = "NO";    if (N%2==0 && isSquare(N/2))     ans = "YES";    if (N%4==0 && isSquare(N/4))     ans = "YES";    pw.println(ans);   }   pw.close();  }  public static boolean isSquare(int x) {   int s = (int)Math.round(Math.sqrt(x));   return s*s==x;  }   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;   }    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;   }  } }
1	public class Main {  FastScanner in;  PrintWriter out;  private void solve() throws IOException {   solveA();              }  private void solveA() throws IOException {   int n = in.nextInt();   TreeMap<String, Integer> map = new TreeMap<>();   for (int i = 0; i < n; i++) {    String s = in.next();    map.put(s, map.getOrDefault(s, 0) + 1);   }   for (int i = 0; i < n; i++) {    String s = in.next();    map.put(s, map.getOrDefault(s, 0) - 1);   }   long ans = 0;   for (String i : map.keySet())    ans += abs(map.get(i));   out.println(ans / 2);  }  private void solveB() throws IOException {   int n = in.nextInt();   int time = (int) 1e9, ans = -1;   for (int i = 0; i < n; i++) {    int a = in.nextInt() - i;    if ((a + (n - 1)) / n < time) {     time = (a + (n - 1)) / n;     ans = i;    }   }   out.println(ans + 1);  }  class PairC {   int i, j;   PairC(int i, int j) {    this.i = i;    this.j = j;   }   public String toString() {    return "(" + i + ", " + j + ")";   }  }  private void solveC() throws IOException {   int n = in.nextInt(), k = in.nextInt();   int[][] a = new int[4][n];   for (int i = 0; i < 4; i++)    for (int j = 0; j < n; j++)     a[i][j] = in.nextInt() - 1;   int[] empty = new int[4];   PairC[] from = new PairC[k];   for (int i = 1; i < 3; i++)    for (int j = 0; j < n; j++)     if (a[i][j] != -1)      from[a[i][j]] = new PairC(i, j);     else      empty[i]++;   PairC[] to = new PairC[k];   for (int i = 0; i < 4; i += 3)    for (int j = 0; j < n; j++)     if (a[i][j] != -1)      to[a[i][j]] = new PairC(i, j);   out.println(Arrays.toString(from));   out.println(Arrays.toString(to));   ArrayList<int[]> ans = new ArrayList<>();   int cnt = 0;   for (int i = 0; i < k; i++) {    if (abs(from[i].i - to[i].i) == 1) {     if (from[i].j == to[i].j) {      ans.add(new int[]{i, to[i].i, to[i].j});      a[from[i].i][from[i].j] = 0;      empty[from[i].i]++;      cnt++;     }    } else if (from[i].j == to[i].j && a[(from[i].i + to[i].i) / 2][to[i].j] == 0) {     ans.add(new int[]{i, (from[i].i + to[i].i) / 2, to[i].j});     ans.add(new int[]{i, to[i].i, to[i].j});     a[from[i].i][from[i].j] = 0;     empty[from[i].i]++;     cnt++;    }   }   for (int i = 1; i < 3; i++) {    if (empty[i] > 0) {     for (int j = 0; j < k; j++) {      if (from[j].i == i && true) {      }     }    }   }    while (true) {    boolean flag = false;    for (int i = 0; i < k; i++) {     if (abs(from[i].i - to[i].i) == 1 && abs(from[i].j - to[i].j) <= empty[i]) {     }    }    if (!flag)     break;   }   if (cnt == k) {    out.println(ans.size());    for (int[] i : ans) {     for (int j : i)      out.print(j + 1 + " ");     out.println();    }   } else    out.println(-1);  }  private void solveD() throws IOException {   int n = in.nextInt();   int[] a = new int[n * 2];   for (int i = 0; i < n * 2; i++)    a[i] = in.nextInt();   long ans = 0;   for (int i = 0; i < 2 * n; i += 2) {    int j = i + 1;    while (a[i] != a[j])     j++;    ans += j - i - 1;    while (j > i + 1)     a[j] = a[--j];   }   out.println(ans);  }  class PairE implements Comparable<PairE> {   long x, y;   int id;   boolean b;   PairE(long x, long y, int id) {    this.x = x;    this.y = y;    this.id = id;    b = false;   }   @Override   public int compareTo(PairE o) {    return x != o.x ? Long.compare(x, o.x) : Long.compare(y, o.y);   }  }  private void solveE() throws IOException {   int n = in.nextInt();   PairE[] p = new PairE[n];   for (int i = 0; i < n; i++)    p[i] = new PairE(in.nextLong(), in.nextLong(), i);   shuffle(p);   sort(p);   long X = 0, Y = 0;   long max = 225 * (long) 1e10;   for (int i = 0; i < n; i++) {    if ((X + p[i].x) * (X + p[i].x) + (Y + p[i].y) * (Y + p[i].y) < (X - p[i].x) * (X - p[i].x) + (Y - p[i].y) * (Y - p[i].y)) {     p[i].b = true;     X += p[i].x;     Y += p[i].y;    } else {     p[i].b = false;     X -= p[i].x;     Y -= p[i].y;    }   }   sort(p, comparingInt(o -> o.id));   for (int i = 0; i < n; i++) {    out.print(p[i].b ? 1 : -1);    if (i + 1 < n)     out.print(" ");   }   out.println();  }  void shuffle(PairE[] a) {   PairE b;   Random r = new Random();   for (int i = a.length - 1, j; i > 0; i--) {    j = r.nextInt(i + 1);    b = a[j];    a[j] = a[i];    a[i] = b;   }  }  private void solveF() throws IOException {  }  class FastScanner {   StringTokenizer st;   BufferedReader br;   FastScanner(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }   String next() throws IOException {    while (st == null || !st.hasMoreTokens())     st = new StringTokenizer(br.readLine());    return st.nextToken();   }   boolean hasNext() throws IOException {    return br.ready() || (st != null && st.hasMoreTokens());   }   int nextInt() throws IOException {    return Integer.parseInt(next());   }   long nextLong() throws IOException {    return Long.parseLong(next());   }   double nextDouble() throws IOException {    return Double.parseDouble(next().replace(',', '.'));   }   String nextLine() throws IOException {    return br.readLine();   }   boolean hasNextLine() throws IOException {    return br.ready();   }  }  private void run() throws IOException {   in = new FastScanner(System.in);   out = new PrintWriter(System.out);    solve();   out.flush();   out.close();  }  public static void main(String[] args) throws IOException {   new Main().run();  } }
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(); } }
3	public class C { static int [][] memo; static int n; static char [] c; static int mod = (int)1e9+7; static int dp(int ind, int loops){  if(ind == n)  return loops == 0?1:0;  if(memo[ind][loops] != -1)  return memo[ind][loops];  long ans = 0;  if(c[ind] == 's'){  ans = (ans + dp(ind+1, loops))%mod;  if(loops > 0)   ans = (ans + dp(ind, loops-1))%mod;  }  else{  ans = (ans + dp(ind+1, loops+1))%mod;  }  return memo[ind][loops] = (int) ans; } public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  n = sc.nextInt();  memo = new int[n+1][n+1];  for(int [] i:memo)  Arrays.fill(i, -1);  c = new char[n];  for (int i = 0; i < c.length; i++) {  c[i] = sc.next().charAt(0);  }  out.println(dp(0,0));  out.flush();  out.close(); }  static class Scanner {  BufferedReader bf;  StringTokenizer st;  public Scanner(InputStream i) {  bf = new BufferedReader(new InputStreamReader(i));  }  public String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(bf.readLine());  return st.nextToken();  }  public int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(next());  }  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 nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  } } }
0	public class Coder{   static class FastScanner{   BufferedReader s;   StringTokenizer st;     public FastScanner(){    st = new StringTokenizer("");    s = new BufferedReader(new InputStreamReader(System.in));   }     public int nextInt() throws IOException{    if(st.hasMoreTokens())     return Integer.parseInt(st.nextToken());    else{     st = new StringTokenizer(s.readLine());     return nextInt();    }   }  }     public static void main(String[] args) throws IOException{   FastScanner s = new FastScanner();   PrintWriter ww = new PrintWriter(new OutputStreamWriter(System.out));   int test = s.nextInt(); int cnt=0;   while(test-->0){    int a = s.nextInt();    int b = s.nextInt();    cnt=0;    while(a!=0 && b!=0){     int max = Math.max(a, b);     if(max == b){      int divi = b/a;      b -= divi*a;      cnt+=divi;     }else{      int divi = a/b;      a -= divi*b;      cnt+=divi;     }      }    ww.println(cnt);   }   ww.close();  } }
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[]) {  (new Main()).solve(); }  void solve() {  Scanner cin = new Scanner(System.in);  while( cin.hasNextInt() ) {   int n = cin.nextInt();  int arr[] = new int[n];  for(int i=0; i<n; ++i) {   arr[i] = cin.nextInt();  }   Arrays.sort(arr);   int ret[] = new int[n];  ret[0] = 1;  for(int i=0; i<n-1; ++i) { ret[i + 1] = arr[i]; }  if( arr[n - 1] == 1 ) { ret[n - 1] = 2; }   String glue = "";  for(int i=0; i<n; ++i) {   System.out.print(glue + ret[i]);   glue = " ";  }   System.out.println();  }  } }
3	public class Main {  public static void main(String[] args) {   new Thread(null, new Runnable() {    public void run() {     new Main().solve();    }   }, "1", 1 << 26).start();  }  void solve() {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   APaintTheNumbers solver = new APaintTheNumbers();   solver.solve(1, in, out);   out.close();  }  static class APaintTheNumbers {   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    int[] hash = new int[101];    boolean[] hash1 = new boolean[101];    for (int i = 0; i < n; i++) hash[in.scanInt()]++;    int ans = 0;    for (int i = 1; i <= 100; i++) {     if (hash1[i]) continue;     if (hash[i] == 0) continue;     for (int j = i; j <= 100; j += i) hash1[j] = true;     ans++;    }    out.println(ans);   }  }  static class ScanReader {   private byte[] buf = new byte[4 * 1024];   private int index;   private BufferedInputStream in;   private int total;   public ScanReader(InputStream inputStream) {    in = new BufferedInputStream(inputStream);   }   private int scan() {    if (index >= total) {     index = 0;     try {      total = in.read(buf);     } catch (Exception e) {      e.printStackTrace();     }     if (total <= 0) return -1;    }    return buf[index++];   }   public int scanInt() {    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();     }    }    return neg * integer;   }   private boolean isWhiteSpace(int n) {    if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;    else return false;   }  } }
4	public class A implements Runnable {  private void solve() throws IOException {   String str = nextToken();   for (int i=str.length()-1; i>=0; --i)    for (int j=0; j+i<=str.length(); ++j)     if (str.substring(j+1).contains(str.substring(j, j+i))) {      writer.println(i);      return;     }   writer.println(0);  }  public static void main(String[] args) {   new Thread(new A()).start();  }  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();  } }
2	public class P287B{ Scanner sc=new Scanner(System.in);  long n, k;  void run(){  n=sc.nextLong();  k=sc.nextLong();  solve(); }  void solve(){  long left=-1, right=k+1;  for(; right-left>1;){  long m=(left+right)/2;  long ub=k*(k+1)/2-(k-m)*(k-m+1)/2-(m-1);  if(ub>=n){   right=m;  }else{   left=m;  }  }  println(""+(right>k?-1:right)); }  void println(String s){  System.out.println(s); }  public static void main(String[] args){  Locale.setDefault(Locale.US);  new P287B().run(); } }
4	public class YoureGivenAString {  public static void main(String[] args) throws IOException {   BufferedReader f = new BufferedReader(new InputStreamReader(System.in));   String str = f.readLine();   int max = 0;   for (int i = 0; i < str.length(); i++)    for (int j = i+1; j <= str.length(); j++) {     String s = str.substring(i,j);     if (str.indexOf(s) >= 0 && str.substring(str.indexOf(s)+1).indexOf(s) >= 0)      max = Math.max(max, j-i);    }   System.out.println(max);  }  }
3	public class Soln {  public static int[] io(int n) {  int[] d = new int[n];  for (int i=0;i<n;i++) d[i] = f.nextInt();  return d; } public static int binlog( int bits ){   int log = 0;   if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }   if( bits >= 256 ) { bits >>>= 8; log += 8; }   if( bits >= 16 ) { bits >>>= 4; log += 4; }   if( bits >= 4 ) { bits >>>= 2; log += 2; }   return log + ( bits >>> 1 );  } 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 final long mod = (long)Math.pow(10, 9) + 7; static FastReader f=new FastReader();  public static void main (String[] args) throws IOException{  int n = f.nextInt();  int[] a = io(n);  HashMap<Integer,ArrayList<ivl>> hm = new HashMap<>();  for (int i=0;i<n;i++) {  int sum = 0;  for (int j=i;j<n;j++) {   sum+=a[j];   if (hm.get(sum)==null) hm.put(sum,new ArrayList<ivl>());   hm.get(sum).add(new ivl(i,j));  }  }  HashSet<ivl> hs = new HashSet<ivl>();   for (ArrayList<ivl> arr : hm.values()) {  Collections.sort(arr,new comp());  HashSet<ivl> temp = new HashSet<ivl>();  temp.add(arr.get(0));  int lastr = arr.get(0).r;  int num = 1;  for (ivl curr:arr) {   if (curr.l>lastr) {   lastr = curr.r;   num++;   temp.add(curr);   }  }  if (temp.size()>hs.size()) hs = temp;  }   System.out.println(hs.size());  for (ivl curr:hs) {  System.out.println((curr.l+1)+" "+(curr.r+1));  }  }  static class ivl{  int l,r;  ivl(int l,int r){  this.l=l;this.r=r;  } }  static class comp implements Comparator<ivl>{  public int compare(ivl a,ivl b) {  if (a.r - b.r == 0) return a.l-b.l;  return a.r-b.r;  } } }
6	public class Main {  private static boolean check(int n , int m , int k) {   for (int i = 0;i < n;i ++) {  for (int j = 0;j < n;j ++) {   for (int l = 0;l < (1 << n);l ++) {   dp[i][j][l] = - 1;   }  }  }  for (int i = 0;i < n;i ++) {  if (dfs(i , i , n , m , k , 0)) {   return true;  }  }  return false;   }   private static boolean dfs(int first , int current , int n , int m , int k , int bitmap) {   bitmap |= (1 << current);  if (bitmap == (1 << n) - 1) {    if (n == 1) {   if (m > 1) {   if (rowMinDist[current] >= k) {    return true;   } else {      return false;   }   } else {   return true;   }  } else {   if (m > 1) {   if (minDistBetweenHeadAndTail[first][current] >= k) {    return true;   } else {    return false;   }   } else {   return true;   }  }  } else {  if (dp[first][current][bitmap] >= 0) {   if (dp[first][current][bitmap] > 0) {   return true;   } else {   return false;   }  }    short ans = 0;  for (int i = 0;i < n;i ++) {   if ((bitmap & (1 << i)) == 0 && minDistBetweenRow[current][i] >= k) {      if (dfs(first , i , n , m , k , bitmap)) {    ans = 1;    break;   }   }  }    dp[first][current][bitmap] = ans;  if (ans > 0) {    return true;  } else {   return false;  }  }   }  private static short[][][] dp = new short[20][20][(1 << 17)];  private static int[][] input = new int[20][10010]; private static int[][] minDistBetweenRow = new int[20][20]; private static int[][] minDistBetweenHeadAndTail = new int[20][20]; private static int[] rowMinDist = new int[20];  public static void main(String[] args) {    Scanner scan = new Scanner(System.in);   int i , j , k , n , m;  n = scan.nextInt();  m = scan.nextInt();  for (i = 0;i < n;i ++) {  for (j = 0;j < m;j ++) {   input[i][j] = scan.nextInt();  }  }  for (i = 0;i < n;i ++) {  for (j = i + 1;j < n;j ++) {   int minDist = - 1;   for (k = 0;k < m;k ++) {   int dist = Math.abs(input[i][k] - input[j][k]);   if (dist < minDist || minDist < 0) {    minDist = dist;   }   }   minDistBetweenRow[i][j] = minDistBetweenRow[j][i] = minDist;   }  }  for (i = 0;i < n;i ++) {  for (j = 0;j < n;j ++) {   if (i != j) {      int minDist = - 1;   for (k = 0;k < m - 1;k ++) {       int dist = Math.abs(input[j][k] - input[i][k + 1]);    if (dist < minDist || minDist < 0) {    minDist = dist;    }   }   minDistBetweenHeadAndTail[i][j] = minDist;   }  }  }   for (i = 0;i < n;i ++) {  int minDist = - 1;  for (j = 0;j < m - 1;j ++) {   int dist = Math.abs(input[i][j] - input[i][j + 1]);   if (dist < minDist || minDist < 0) {   minDist = dist;   }  }  rowMinDist[i] = minDist;  }  int low = 0 , high = 1000000010;  while (low < high) {  int mid = (low + high) / 2;  if (check(n , m , mid)) {     low = mid + 1;  } else {   high = mid;  }  }  System.out.println(high - 1);  }    }
1	public class Main { private static boolean _READ_FROM_FILE = System.getProperty("ONLINE_JUDGE") == null; private static Scanner in; private static void core() {  int n = in.nextInt();  ArrayList<Character> all = new ArrayList<Character>();  for (char ch : in.next().toCharArray()) {  all.add(ch);  }   int res = Integer.MAX_VALUE;  for (int i = 0; i < n; i++) {  int now = calc(all);  res = Math.min(res, now);  all.add(all.get(0));  all.remove(0);  }  System.out.println(res); } private static int calc(ArrayList<Character> all) {  int nh = 0;  for (char ch: all) {  if (ch == 'H')   ++nh;  }  int r1 = 0;  for (int i = 0; i < nh; i++) {  if (all.get(i) != 'H')   ++r1;  }   int nt = all.size() - nh;  int r2 = 0;  for (int i = 0; i < nt; i++) {  if (all.get(i) != 'T')   ++r2;  }  return Math.min(r1, r2); } static void debug(Object...os) {  System.out.println(Arrays.deepToString(os)); } public static void main(String[] args) throws FileNotFoundException {  if (_READ_FROM_FILE)  System.setIn(new FileInputStream("in.in"));  in = new Scanner(System.in);  core(); } }
5	public class CodeForce {   private void solve() throws IOException {   final int N = nextInt();   int []A = new int[N];   for(int i = 0; i < N; i++) A[i] = nextInt();   Arrays.sort(A);   if(A[N-1] == 1) A[N-1] = 2;   else   A[N-1] = 1;   Arrays.sort(A);   for(int i = 0; i < N; i++)    System.out.print(A[i] + " ");  }   public static void main(String[] args) {   new CodeForce().run();  }  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter writer;  public void run() {   try {    reader = new BufferedReader(new InputStreamReader(System.in));    tokenizer = null;    writer = new PrintWriter(new FileOutputStream(new File("output.txt")));    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 nextLine() throws IOException {   return reader.readLine();  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  } }
1	public class lets_do {  InputReader in;  PrintWriter out;  Helper_class h;  final long mod=1000000007;  public static void main(String[] args) throws java.lang.Exception{   new lets_do().run();  }  void run() throws Exception{   in=new InputReader();   out = new PrintWriter(System.out);   h = new Helper_class();   int t=1;   while(t-->0)    solve();   out.flush();    out.close();  }  long[] arr;  int n;  HashMap<Integer,Integer> hmap=new HashMap<Integer,Integer>();  HashSet<Integer> hset=new HashSet<Integer>();  void solve(){   n=h.ni();   long d=h.nl();   int i=0;   arr=new long[n];   for(i=0;i<n;i++)    arr[i]=h.nl();   int count=2;   for(i=0;i<n-1;i++){    if(Math.abs(arr[i]-arr[i+1])>(2*d))     count+=2;    else if(Math.abs(arr[i]-arr[i+1])==(2*d))     count+=1;   }   h.pn(count);  }  class Helper_class{   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 bitcount(long n){return (n==0)?0:(1+bitcount(n&(n-1)));}   void p(Object o){out.print(o);}   void pn(Object o){out.println(o);}   void pni(Object o){out.println(o);out.flush();}   String n(){return in.next();}   String nln(){return in.nextLine();}   int ni(){return Integer.parseInt(in.next());}   long nl(){return Long.parseLong(in.next());}   double nd(){return Double.parseDouble(in.next());}   long mul(long a,long b){    if(a>=mod)a%=mod;    if(b>=mod)b%=mod;    a*=b;    if(a>=mod)a%=mod;    return a;   }   long modPow(long a, long p){    long o = 1;    while(p>0){     if((p&1)==1)o = mul(o,a);     a = mul(a,a);     p>>=1;    }    return o;   }   long add(long a, long b){    if(a>=mod)a%=mod;    if(b>=mod)b%=mod;    if(b<0)b+=mod;    a+=b;    if(a>=mod)a-=mod;    return a;   }  }  class InputReader{   BufferedReader br;   StringTokenizer st;   public InputReader(){    br = new BufferedReader(new InputStreamReader(System.in));   }    public InputReader(String s) throws Exception{    br = new BufferedReader(new FileReader(s));   }    String next(){    while (st == null || !st.hasMoreElements()){     try{      st = new StringTokenizer(br.readLine());     }catch (IOException e){      e.printStackTrace();     }    }    return st.nextToken();   }    String nextLine(){    String str = "";    try{     str = br.readLine();    }catch (IOException e){     e.printStackTrace();    }     return str;   }  } }
1	public class A {  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();  String[]a = new String[n], b = new String[n];  Map<String, Integer> map = new HashMap<String, Integer>();  for (int i = 0; i < n; i++) {  a[i] = next();  if (!map.containsKey(a[i]))   map.put(a[i], 0);  map.put(a[i], map.get(a[i])+1);  }  int ans = 0;  for (int i = 0; i < n; i++) {  b[i] = next();  if (!map.containsKey(b[i]))   ans++;  else {   map.put(b[i], map.get(b[i])-1);   if (map.get(b[i])==0)   map.remove(b[i]);  }  }  System.out.println(ans);  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(); } }
3	public class Main {  public static void main(String[] args) {   File file = new File("in.txt");   File fileOut = new File("out.txt");   InputStream inputStream = null;   OutputStream outputStream = null;      inputStream = System.in;   outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   Task solver = new Task();   solver.solve(1, in, out);   out.close();  }  } class Task {  private final int mod = 1000000007;  public void solve(int testNumber, InputReader in, PrintWriter out) {   Integer n = in.nextInt();   List<Character> comm = new ArrayList<>(n);   for(int i=0; i<n; i++){    comm.add(in.next().charAt(0));   }   long[][] dp = new long[n][n];   dp[0][0] = 1;   for(int i=1; i<n; i++){    Character lastComm = comm.get(i-1);    if(lastComm.equals('f')){     dp[i][0] = 0;     for(int j=1; j<n; j++){      dp[i][j] = dp[i-1][j-1];     }    }    else{     Long suffixSum = dp[i-1][n-1];     for(int j=n-1; j>=0; j--){      dp[i][j] = suffixSum;      if(j>0) {       suffixSum += dp[i - 1][j - 1] % mod;      }     }    }   }   Long finalSum = 0L;   for(int i=0; i<n; i++){    finalSum += dp[n-1][i] % mod;   }   out.println(finalSum % mod);  } }  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 String nextLine(){   try {    return reader.readLine();   } catch (IOException e){    throw new RuntimeException(e);   }  }  public int nextInt() {   return Integer.parseInt(next());  }  public long nextLong() { return Long.parseLong(next()); } }  class Pair<F, S> {  public final F first;  public final S second;    public Pair(F first, S second) {   this.first = first;   this.second = second;  }  @Override  public boolean equals(Object o) {   if (!(o instanceof Pair)) {    return false;   }   Pair<?, ?> p = (Pair<?, ?>) o;   return Objects.equals(p.first, first) && Objects.equals(p.second, second);  }  @Override  public int hashCode() {   return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode());  }  @Override  public String toString() {   return "(" + first + ", " + second + ')';  } } class IntPair extends Pair<Integer, Integer>{  public IntPair(Integer first, Integer second){   super(first, second);  } }
3	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 {   private static final int MOD = (int) 1e9 + 7;   private static final int N = 5000;   public void solve(int testNumber, Scanner in, PrintWriter out) {    int n = in.nextInt();    int[] dp = new int[N];    Arrays.fill(dp, 0);    dp[0] = 1;    String pre = null, ch;    for (int i = 0; i < n; ++i) {     ch = in.next();     if (i > 0) {      if (pre.equals("s")) {       int j = N - 1;       while (dp[j] == 0) {        --j;       }       long sum = 0;       for (; j >= 0; --j) {        sum += dp[j];        sum %= MOD;        dp[j] = (int) sum;       }      } else {       for (int k = N - 1; k > 0; --k) {        dp[k] = dp[k - 1];       }       dp[0] = 0;      }     }     pre = ch;    }    long sum = 0;    for (int i = 0; i < N; ++i) {     sum += dp[i];     sum %= MOD;    }    out.println(sum);   }  } }
0	public class Main {  static void solve() throws IOException {   int n = nextInt();   if (n >= 0) {    System.out.println(n);   } else {    String string = String.valueOf(n);    int v1 = Integer.valueOf(string.substring(0, string.length() - 1));    int v2 = Integer.valueOf(string.substring(0, string.length() - 2)      + string.charAt(string.length() - 1));    if (v1 >= v2) {     System.out.println(v1);    } else {     System.out.println(v2);    }   }    }  public static void main(String[] args) throws Exception {   reader = new BufferedReader(new InputStreamReader(System.in));   writer = new PrintWriter(System.out);   setTime();   solve();   printTime();   printMemory();   writer.close();  }  static BufferedReader reader;  static PrintWriter writer;  static StringTokenizer tok = new StringTokenizer("");  static long systemTime;  static void debug(Object... o) {   System.err.println(deepToString(o));  }  static void setTime() {   systemTime = System.currentTimeMillis();  }  static void printTime() {   System.err.println("Time consumed: "     + (System.currentTimeMillis() - systemTime));  }  static void printMemory() {   System.err.println("Memory consumed: "     + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime()       .freeMemory()) / 1000 + "kb");  }  static String next() {   while (!tok.hasMoreTokens()) {    String w = null;    try {     w = reader.readLine();    } catch (Exception e) {     e.printStackTrace();    }    if (w == null)     return null;    tok = new StringTokenizer(w);   }   return tok.nextToken();  }  static int nextInt() {   return Integer.parseInt(next());  }  static long nextLong() {   return Long.parseLong(next());  }  static double nextDouble() {   return Double.parseDouble(next());  }  static BigInteger nextBigInteger() {   return new BigInteger(next());  } }
3	public class B{  static long []sum;  static int n;  public static void main(String[] args) throws IOException {  Scanner sc=new Scanner();  PrintWriter out=new PrintWriter(System.out);  n=sc.nextInt();  sum=new long [n+1];  for(int i=1;i<=n;i++)  sum[i]=sc.nextInt()+sum[i-1];  HashMap<Long,Integer> map=new HashMap();  ArrayList<int []>[]adj=new ArrayList[n*n+10];  for(int i=0;i<adj.length;i++)  adj[i]=new ArrayList();  for(int r=1;r<=n;r++)   for(int l=1;l<=n;l++) {   if(r<l)   continue;   long x=sum[r]-sum[l-1];   map.put(x, map.getOrDefault(x, map.size()));   adj[map.get(x)].add(new int [] {l,r});  }  int ans=0;  int bestIdx=0;  for(int idx=0;idx<adj.length;idx++)  {  ArrayList<int[]>list=adj[idx];  if(list.isEmpty())   continue;  int curr=1;  int R=list.get(0)[1];  for(int i=1;i<list.size();i++)  {   int []tmp=list.get(i);   if(tmp[0]>R)   {   R=tmp[1];   curr++;   }  }  if(curr>=ans) {   ans=curr;   bestIdx=idx;  }  }  out.println(ans);  ArrayList<int[]>list=adj[bestIdx];  int R=list.get(0)[1];  out.println(list.get(0)[0]+" "+R);  for(int i=1;i<list.size();i++)  {  int []tmp=list.get(i);  if(tmp[0]>R)  {   R=tmp[1];   out.println(tmp[0]+" "+tmp[1]);  }  }  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());  } } }
1	public class ProblemA {  String fileName = "prizes";  public void solve() throws IOException {  int n = nextInt();  int d = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  int ans = 2;  for (int i = 1; i < n; i++) {  if (a[i] - a[i - 1] == 2 * d)   ans++;  if (a[i] - a[i - 1] > 2 * d)   ans += 2;  }  out.println(ans); }  public void run() {  try {   br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out, true);         solve();   out.close();  } catch (IOException e) {  e.printStackTrace();  System.exit(1);  } }  BufferedReader br; StringTokenizer in; static 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 long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  public static void main(String[] args) throws IOException {  new ProblemA().run(); } }
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); } }
4	public class practice { 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();   }  }   public static void main(String[] args) throws IOException {    Reader scn=new Reader("input.txt");  PrintWriter out = new PrintWriter(new File("output.txt"));  int n=scn.nextInt(),m=scn.nextInt(),k=scn.nextInt();  int[][] inf=new int[k][2];  for(int i=0;i<k;i++){   inf[i][0]=scn.nextInt();inf[i][1]=scn.nextInt();  }  int ans=0,x=1,y=1;  for(int i=1;i<=n;i++){   for(int j=1;j<=m;j++){   int temp=Integer.MAX_VALUE;   for(int l=0;l<k;l++){   temp=Math.min(temp, Math.abs(i-inf[l][0])+Math.abs(j-inf[l][1]));    }   if(temp>ans){    ans=temp;x=i;y=j;   }   }  }  out.print(x + " " + y);   out.close();  } }
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);   G1PlaylistForPolycarpEasyVersion solver = new G1PlaylistForPolycarpEasyVersion();   solver.solve(1, in, out);   out.close();  }  static class G1PlaylistForPolycarpEasyVersion {   public void solve(int testNumber, InputReader sc, PrintWriter out) {    int n = sc.nextInt();    int T = sc.nextInt();    int mod = (int) 1e9 + 7;    int dp[][][] = new int[1 << n][226][3];    int t[] = new int[n];    int g[] = new int[n];    for (int i = 0; i < n; ++i) {     t[i] = sc.nextInt();     g[i] = sc.nextInt() - 1;     dp[1 << i][t[i]][g[i]] = 1;    }    for (int i = 0; i < (1 << n); ++i) {     for (int j = 0; j < n; ++j) {      if ((i >> j & 1) == 1) {       int newMask = i ^ (1 << j);       for (int k = t[j]; k <= T; ++k) {        for (int l = 0; l < 3; ++l) {         if (l == g[j])          continue;         dp[i][k][g[j]] = (dp[i][k][g[j]] + dp[newMask][k - t[j]][l]) % mod;        }       }      }     }    }    long ans = 0;    for (int i = 0; i < (1 << n); ++i) {     for (int j = 0; j < 3; ++j) {      ans += dp[i][T][j];     }    }    ans %= mod;    out.print(ans);   }  }  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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
1	public class Main{  void solve() {   int n=ni();   long d=nl();   long x[]=new long[n+1];   for(int i=1;i<=n;i++) x[i]=nl();   Arrays.sort(x,1,n+1);   int ans=2;   for(int i=2;i<=n;i++){    long x1=x[i-1]+d,x2=x[i]-d;    if(x[i]-x1>=d) ans++;    if(x2-x[i-1]>=d && x1!=x2) ans++;      }   pw.println(ans);  }    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 Main().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)); } }
2	public class CFC {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  private static final long MOD = 1000L * 1000L * 1000L + 7;  private static final int[] dx = {0, -1, 0, 1};  private static final int[] dy = {1, 0, -1, 0};  private static final String yes = "Yes";  private static final String no = "No";  void solve() throws IOException {   long x = nextLong();   long k = nextLong();   if (x == 0) {    outln(0);    return;   }   x %= MOD;   long two = powMod(2, k, MOD);   long res = two;   res *= 2;   res %= MOD;   res *= x;   res %= MOD;   res -= two - 1;   while (res < 0) {    res += MOD;   }   while (res >= MOD) {    res -= MOD;   }   outln(res);  }  public long powMod(long N, long M, long MOD){   if(M == 0L)    return 1L;   long[] hp = new long[64];   boolean[] bp = new boolean[64];   hp[0] = N;   for(int i = 1; i < hp.length; i++) {    hp[i] = (hp[i - 1] * hp[i - 1]) % MOD;   }   for(int j = 0; j < hp.length; j++) {    if((M & (1L << j)) != 0)     bp[j] = true;   }   long res = 1;   for(int i = 0;i < bp.length; i++){    if(bp[i]) {     res = (res * hp[i]) % MOD;    }   }   return res;  }  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 CFC() 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 CFC();  }  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());  } }
4	public class St {  static void metod() throws Exception {   Scanner in = new Scanner(System.in);   String str = in.next();   int max = 0;   for (int i = 0; i < str.length(); i++) {    for (int j = i + 1; j < str.length() + 1; j++) {     for (int k = 0; k < str.length(); k++) {      for (int n = k + 1; n < str.length() + 1; n++) {       if ((str.substring(i, j).equals(str.substring(k, n)))         && (k != i)) {        if (j - i > max)         max = j - i;       }      }     }    }   }   System.out.println(max);  }  public static void main(String args[]) throws Exception {   St.metod();  } }
3	public class A {  PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer tok;  public void go() throws IOException  {   ntok();   int n = ipar();   ArrayList<Integer> list = new ArrayList<>();   ntok();   for (int i = 0; i < n; i++)   {    list.add(ipar());   }   Collections.sort(list);   HashSet<Integer> set = new HashSet<>();   for (int x : list)   {    boolean add = true;    for (int y : set)    {     if (x % y == 0)     {      add = false;      break;     }    }    if (add)    {     set.add(x);    }   }   out.println(set.size());   out.flush();   in.close();  }  public void ntok() throws IOException  {   tok = new StringTokenizer(in.readLine());  }  public int ipar()  {   return Integer.parseInt(tok.nextToken());  }  public int[] iapar(int n)  {   int[] arr = new int[n];   for (int i = 0; i < n; i++)   {    arr[i] = ipar();   }   return arr;  }  public long lpar()  {   return Long.parseLong(tok.nextToken());  }  public long[] lapar(int n)  {   long[] arr = new long[n];   for (int i = 0; i < n; i++)   {    arr[i] = lpar();   }   return arr;  }  public double dpar()  {   return Double.parseDouble(tok.nextToken());  }  public String spar()  {   return tok.nextToken();  }  public static void main(String[] args) throws IOException  {   new A().go();  } }
1	public class Solution1515B { public static void main(String[] args) {  InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out);  Solver1515B solver = new Solver1515B();  int n = in.nextInt();  for (int i = 0; i < n; i++) {  solver.solve(i, in, out);  }  out.close(); }  static class Solver1515B {  public void solve(int testNumber, InputReader in, PrintWriter out) {  int n = in.nextInt();  boolean f = false;  if (n % 2 == 0) {   int s = (int) Math.sqrt(n / 2);   if (s * s == n / 2) {   f = true;   }  }  if (n % 4 == 0) {   int s = (int) Math.sqrt(n / 4);   if (s * s == n / 4) {   f = true;   }  }  if (f) {   out.println("YES");  } else {   out.println("NO");  }  } }  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());  } } }
2	public class main {  static long d,x,y; public static void main(String[] args) {  FastScanner in = new FastScanner();    long x = in.nextLong(), k = in.nextLong();   long mod = 1000000007;   long one = pow(2,k,mod);   one %= mod;   long two = (2*x)%mod-1;   two %= mod;   long ans = (one*two)%mod+1;   ans %= mod;   if(ans<0)  ans += mod;   if(x==0)  System.out.println("0");  else  System.out.println(ans);    } private static long pow(long a, long b, long mod) {  if(b==0) return 1;   if(b==1)  return a;   if(b%2==0)  return pow((a*a)%mod,b/2,mod);  else  return (a*pow((a*a)%mod,(b-1)/2,mod))%mod;   }     }      class FastScanner { BufferedReader br; StringTokenizer st;  public FastScanner() {  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()); } }
4	public class Main { static int[][] to = { { 1, 0 }, { 0, 1 }, { -1, 0 }, { 0, -1 } };  public static void main(String[] args) throws FileNotFoundException {  InputReader in = new InputReader(System.in);      PrintWriter out = new PrintWriter(System.out);        int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();  int[][][] cost = new int[n][m][4];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m - 1; j++) {   int u = in.nextInt();   cost[i][j][1] = u;   cost[i][j + 1][3] = u;  }  }  for (int i = 0; i < n - 1; i++) {  for (int j = 0; j < m; j++) {   int u = in.nextInt();   cost[i][j][0] = u;   cost[i + 1][j][2] = u;  }  }  if (k % 2 == 0) {  k = k / 2;  int[][][] dp = new int[k + 1][n][m];   for (int i = 0; i <= k; i++) {   for (int x = 0; x < n; x++) {   for (int y = 0; y < m; y++) {    if (i == 0) {    dp[i][x][y] = 0;    } else {    int min = 1000000000;     for (int way = 0; way < to.length; way++) {     int nextx = x + to[way][0];     int nexty = y + to[way][1];     if (nextx >= 0 && nextx < n && nexty >= 0 && nexty < m) {     min = Math.min(min, dp[i - 1][nextx][nexty] + cost[x][y][way]);     }    }     dp[i][x][y] = min;    }   }   }  }   for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   if (j == m - 1) {    out.printf("%d\n", dp[k][i][j] * 2);   } else {    out.printf("%d ", dp[k][i][j] * 2);   }   }  }  } else {  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   if (j == m - 1) {    out.printf("-1\n");   } else {    out.printf("-1 ");   }   }  }  }  out.close(); }  static 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 in) {  br = new BufferedReader(new InputStreamReader(in));  }  public String next() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  }  return st.nextToken();  }  public boolean hasNext() {  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;  }  public int nextInt() {  return Integer.parseInt(next());  }  public long nextLong() {  return Long.parseLong(next());  }  public double nextDouble() {  return Double.parseDouble(next());  } } }
4	public class A23 {  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);   String s = nextString();   for (int i = s.length(); i > 0; i--) {  for (int j = 0; j+i-1 < s.length(); j++)   for (int k = j+1; k+i-1 < s.length(); k++)   if (s.substring(j, j+i).equals(s.substring(k, k+i))) {    out.println(i);    out.flush();    return;   }  }   out.println("0");   out.flush(); } }
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) {   int N = in.nextInt();   if(N >= 0)    out.println(N);   else {    N = Math.abs(N);    int v1 = - (N / 10);    int v2 = - (N / 100 * 10 + (N % 10));    out.println(Math.max(v1, v2));   }  } } 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;  }  }
6	public class Main implements Runnable { private void solution() throws IOException {  int n = in.nextInt();  int m = in.nextInt();  boolean[][] adj = new boolean[n][n];  long res = 0;  for (int i = 0; i < m; ++i) {  int x = in.nextInt();  int y = in.nextInt();  adj[x - 1][y - 1] = true;  adj[y - 1][x - 1] = true;  }  final long[][] dp = new long[1 << n][n];  for (int i = 0; i < n; ++i) {  int Limit = 1 << (n - i);  int nn = n - i;  for (int mask = 0; mask < Limit; ++mask) {   for (int j = 0; j < nn; ++j) {   dp[mask][j] = 0;   }  }  dp[0][0] = 1;  for (int mask = 0; mask < Limit; ++mask) {   if ((mask & 1) == 0) {   for (int j = 0; j < nn; ++j) {    if (dp[mask][j] != 0) {    long am = dp[mask][j];    for (int k = 0; k < nn; ++k) {     if (((mask >> k) & 1) == 0 && adj[j + i][k + i]) {     dp[mask | (1 << k)][k] += am;     }    }    }   }   } else {   res += dp[mask][0];   }  }  }  out.println((res - m) / 2); }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  private class Scanner {  BufferedReader reader;  StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  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 int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
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);   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();    String s = in.next();    HashMap<Character, Integer> indexMap = new HashMap<>();    for (int i = 0; i < n; i++) {     char c = s.charAt(i);     if (!indexMap.containsKey(c)) {      indexMap.put(c, indexMap.size());     }    }    int[] last = new int[indexMap.size()];    Arrays.fill(last, -1_000_000);    int answer = n;    for (int i = 0; i < n; i++) {     int index = indexMap.get(s.charAt(i));     last[index] = i;     int first = i;     for (int a : last) first = Math.min(first, a);     int visits = i - first + 1;     answer = Math.min(answer, visits);    }    out.println(answer);   }  } }
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;  }  } }
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(); } }
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");   }   }  } } }
0	public class A {  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter out;   public void solve() throws IOException {    int N = nextInt();  if( N >= 0) {  out.println(N);  return;  }   int ans = N/10;  int ans2 = N/100*10 + N%10;  out.println( Math.max(ans, ans2));   }   public static void main(String[] args) {  new A().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();  } }
4	public class p23a {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   char[] x = in.next().toCharArray();     int min = 0;   int max = x.length;   while(true) {    if(max-min == 1)     break;    int mid = (max+min)/2;    boolean eq = false;    for (int i = 0; i <= x.length-mid; i++) {     for (int j = 0; j <= x.length-mid; j++) {      if(j == i)       continue;      eq = true;      for (int k = 0; k < mid; k++) {       if(x[i+k] != x[j+k]) {        eq = false;        break;       }      }      if(eq)       break;     }     if(eq) break;    }    if(eq) {     min = mid;    } else {     max = mid;    }   }   System.out.println(min);    } }
3	public class Solve6 {  public static void main(String[] args) throws IOException {   PrintWriter pw = new PrintWriter(System.out);   new Solve6().solve(pw);   pw.flush();   pw.close();  }  public void solve(PrintWriter pw) throws IOException {   FastReader sc = new FastReader();   int n = sc.nextInt();   int[] a = new int[n + 1];   for (int i = 1; i <= n; i++) {    a[i] = sc.nextInt();   }   HashMap<Integer, LinkedList<Pair<Integer, Integer>>> h = new HashMap();   for (int i = 1; i <= n; i++) {    int s = 0;    for (int j = i; j >= 1; j--) {     s += a[j];     LinkedList<Pair<Integer, Integer>> l;     if (!h.containsKey(s)) {      l = new LinkedList();     } else {      l = h.get(s);     }     l.add(new Pair(j, i));     h.put(s, l);    }   }   int max = 0, index = 0;   for (Map.Entry<Integer, LinkedList<Pair<Integer, Integer>>> entrySet : h.entrySet()) {    int i = 0, size = 0;    for (Pair<Integer, Integer> pair : entrySet.getValue()) {     if (pair.getKey() > i) {      i = pair.getValue();      size++;     }    }    if (size > max) {     max = size;     index = entrySet.getKey();    }   }   pw.println(max);   int i = 0;   for (Pair<Integer, Integer> pair : h.get(index)) {    if (pair.getKey() > i) {     pw.println(pair.getKey() + " " + pair.getValue());     i = pair.getValue();    }   }  }  static class FastReader {   StringTokenizer st;   BufferedReader br;   public FastReader() {    br = new BufferedReader(new InputStreamReader(System.in));   }   public boolean hasNext() throws IOException {    String s = br.readLine();    if (s == null || s.isEmpty()) {     return false;    }    st = new StringTokenizer(s);    return true;   }   public String next() throws IOException {    if (st == null || !st.hasMoreTokens()) {     String s = br.readLine();     if (s.isEmpty()) {      return null;     }     st = new StringTokenizer(s);    }    return st.nextToken();   }   public int nextInt() throws IOException {    return Integer.parseInt(next());   }   public double nextDouble() throws IOException {    return Double.parseDouble(next());   }   public long nextLong() throws IOException {    return Long.parseLong(next());   }   public String nextLine() throws IOException {    return br.readLine();   }  } }
3	public class Main {  static BufferedReader reader;  static StringTokenizer tokenizer;  static PrintWriter writer;  static String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  static void banana() throws IOException {   int n = nextInt();   int[] a = new int[n];   int[] color = new int[n];   for (int i = 0; i < n; i++) {    a[i] = nextInt();   }   int c = 0;   while(true) {    int mn = 1000;    for (int i = 0; i < n; i++) {     if(color[i] == 0) {      mn = Math.min(mn, a[i]);     }    }    if (mn == 1000) {     break;    }    c++;    for (int i = 0; i < n; i++) {     if (color[i] == 0) {      if (a[i] % mn == 0) {       color[i] = c;      }     }    }   }   writer.println(c);  }  public static void main(String[] args) throws IOException {   reader = new BufferedReader(new InputStreamReader(System.in));   tokenizer = null;   writer = new PrintWriter(System.out);   banana();   reader.close();   writer.close();  } }
6	public class Main implements Runnable {   int n; long[][] f; boolean[][] e;  int bit(int value) {  return (1<<value); }  void solve() throws IOException {  n = nextInt();  int m = nextInt();  f = new long[1<<n][n];  e = new boolean[n][n];  for (int i = 0; i < (1<<n); ++i) {  for (int j = 0; j < n; ++j) {   f[i][j] = -1;  }  }  for (int i = 0; i < n; ++i) {  for (int j = 0; j < n; ++j) {   f[bit(i)|bit(j)][j] = 0;   e[i][j] = false;  }  }  for (int i = 0; i < m; ++i) {  int u = nextInt()-1;  int v = nextInt()-1;  e[u][v] = true;  e[v][u] = true;  if (u < v) {   f[bit(u)|bit(v)][v] = 1;  }  else {   f[bit(v)|bit(u)][u] = 1;  }  }  long answer = 0;  for (int i = 1; i < (1<<n); ++i) {  int start = 0;  while (((1<<start)&i) == 0) {   ++start;  }  int s = bit(start);  for (int nxt = start+1; nxt < n; ++nxt) {   int b = bit(nxt);   if ((b&i) > 0 && (b|s) != i) {   if (e[start][nxt]) {    answer += clc(i, nxt);   }   }  }  }  writer.print(answer>>1); }  long clc(int maska, int last) {  if (f[maska][last] == -1) {  int first = 0;  while (((1<<first)&maska) == 0) {   ++first;  }  f[maska][last] = 0;  for (int b = first+1; b < n; ++b) {   if ((bit(b)&maska)>0) {   if (e[b][last]) {    f[maska][last] += clc(maska^bit(last), b);   }   }  }   }  return f[maska][last]; }  public static void main(String[] args) throws InterruptedException {  new Thread(null, new Runnable() {    public void run() {     new Main().run();    }   },   "1",   1 << 25).start(); }  @Override public void run() {  try {  boolean fromStandart = true;  reader = new BufferedReader(fromStandart ? new InputStreamReader(System.in) : new FileReader(INFILE));    writer = new PrintWriter(new BufferedWriter(fromStandart ? new OutputStreamWriter(System.out) : new FileWriter(OUTFILE)));  tokenizer = null;   solve();  writer.flush();  } catch (Exception error) {  error.printStackTrace();  System.exit(1);  } }  static final String INFILE = "input.txt"; static final String OUTFILE = "output.txt";  BufferedReader reader; StringTokenizer tokenizer;  PrintWriter writer;  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 nextString() throws IOException {  return reader.readLine();  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }  }
1	public class C {  private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); private static PrintStream out = System.out;  public static void main(String[] args) throws NumberFormatException, IOException {  int n = Integer.parseInt(in.readLine());  char[] s = in.readLine().toCharArray();  HashSet<Character> all = new HashSet<Character>();  for (char c : s)  all.add(c);  int totalCount = all.size();  HashMap<Character, Integer> cnts = new HashMap<Character, Integer>();  int ans = Integer.MAX_VALUE;  int x = 0;  for (int y = 0; y < n; ++y) {  if (!cnts.containsKey(s[y]))   cnts.put(s[y], 0);  cnts.put(s[y], cnts.get(s[y]) + 1);  if (cnts.size() < totalCount)   continue;  while (cnts.get(s[x]) > 1) {   cnts.put(s[x], cnts.get(s[x]) - 1);   ++x;  }  ans = Math.min(ans, y - x + 1);  }  out.println(ans); } }
5	public class A {  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter writer;  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);   }  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens())    tokenizer = new StringTokenizer(reader.readLine());   return tokenizer.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 IOException {   int n = nextInt();   int[] a = new int[n];   for (int i = 0; i < a.length; i++) {    a[i] = nextInt();   }   Arrays.sort(a);   if (a[a.length - 1] == 1) {    for (int i = 0; i < a.length - 1; i++) {     writer.print(1 + " ");    }    writer.println(2 + "");    return;   }   for (int i = 0; i < a.length; i++) {    if (i == 0)     writer.print(1 + " ");    else     writer.print(a[i - 1] + " ");   }   writer.println();  }  static public void main(String[] args) {   new A().run();  } }
1	public class IQ { public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int[] a = new int[n];  for(int i = 0; i < n; i++)  a[i] = scan.nextInt();  for(int i = 0; i < n; i++) {  boolean x = a[i] % 2 == 0;  int c = 0;  for(int j = 0; j < n; j++) {   if(x != (a[j] % 2 == 0))   c++;  }  if(c == n-1) {   System.out.println(i+1);   break;  }  } } }
5	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);       HashMap<Integer, Integer> H = new HashMap<>();    long sum = A[0], count = 1;    BigInteger B = BigInteger.ZERO;    H.put(A[0], 1);    for(int i=1;i<N;i++){         B = B.add(BigInteger.valueOf(count*A[i]-sum));     if(!H.containsKey(A[i]))      H.put(A[i], 0);     H.put(A[i], H.get(A[i])+1);     if(H.containsKey(A[i]-1)){      int k = H.get(A[i]-1);           B = B.add(BigInteger.valueOf((k*(A[i]-1) - k*A[i])));     }     if(H.containsKey(A[i]+1)){      int k = H.get(A[i]+1);      B = B.add(BigInteger.valueOf((k*(A[i]+1) - k*A[i])));          }         sum+=A[i];count++;    }       out.println(B);    }  }  }  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);  } }
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(); } }
1	public class PlayingPiano {  public static void main(String[] args) {  Scanner scanner = new Scanner(System.in);  int n = scanner.nextInt();    List<Integer> as = new LinkedList<>();  int[] as2 = new int[n];    for (int i = 0; i < n; i++) {   int a = scanner.nextInt();   as.add(a);   as2[i] = a;  }      System.out.println(solve2(as2));   scanner.close(); }  public static String solve(List<Integer> as) {  List<Integer> fingers = new LinkedList<>();  fingers.add(1);  fingers.add(2);  fingers.add(3);  fingers.add(4);  fingers.add(5);    List<Integer> solution = assign(as, fingers, fingers);  if (solution == null) {   return "-1";  } else {   StringBuilder sb = new StringBuilder();   for (int b : solution) {   sb.append(b);   sb.append(" ");   }   sb.deleteCharAt(sb.length() - 1);   return sb.toString();  } }  private static List<Integer> assign(List<Integer> as, List<Integer> fingers, List<Integer> allFingers) {   if (fingers.isEmpty()) {  return null;  }     if (as.size() == 1) {  List<Integer> ret = new LinkedList<>();  ret.add(fingers.get(0));  return ret;  }     List<Integer> subList = as.subList(1, as.size());   for (int i = 0; i < fingers.size(); i++) {    List<Integer> subFingers = new LinkedList<>();  final int j = i;  if (as.get(0) < as.get(1)) {   subFingers = allFingers.stream()    .filter(p -> p > fingers.get(j)).collect(Collectors.toList());  } else if (as.get(0) > as.get(1)) {   subFingers = allFingers.stream()    .filter(p -> p < fingers.get(j)).collect(Collectors.toList());  } else {   subFingers = allFingers.stream()    .filter(p -> p != fingers.get(j)).collect(Collectors.toList());  }    List<Integer> ret = assign(subList, subFingers, allFingers);  if (ret != null) {   List<Integer> solution = new LinkedList<>();   solution.add(fingers.get(i));   solution.addAll(ret);   return solution;  }      }  return null;   }  public static String solve2(int[] as) {  int[] ret = new int[as.length];   if (as.length == 1) return "1";   if (as[0] < as[1]) ret[0] = 1;  else if (as[0] == as[1]) ret[0] = 3;  else ret[0] = 5;   for (int i = 1; i < as.length - 1; i++) {  if (as[i-1] < as[i] && ret[i-1] == 5) return "-1";  if (as[i-1] > as[i] && ret[i-1] == 1) return "-1";    if (as[i-1] < as[i] && as[i] < as[i+1]) {   ret[i] = ret[i-1] + 1;  } else if (as[i-1] == as[i] && as[i] < as[i+1]) {   ret[i] = ret[i-1] == 1 ? 2 : 1;  } else if (as[i-1] > as[i] && as[i] < as[i+1]) {   ret[i] = 1;  } else if (as[i-1] < as[i] && as[i] == as[i+1]) {   ret[i] = ret[i-1] + 1;  } else if (as[i-1] == as[i] && as[i] == as[i+1]) {   ret[i] = ret[i-1] == 4 ? 2 : 4;  } else if (as[i-1] > as[i] && as[i] == as[i+1]) {   ret[i] = ret[i-1] == 2 ? 1 : 2;  } else if (as[i-1] < as[i] && as[i] > as[i+1]) {   ret[i] = 5;  } else if (as[i-1] == as[i] && as[i] > as[i+1]) {   ret[i] = ret[i-1] == 5 ? 4 : 5;  } else if (as[i-1] > as[i] && as[i] > as[i+1]) {   ret[i] = ret[i-1] - 1;  }  }   if (as.length > 1) {  if (as[as.length - 1] > as[as.length - 2]) {   if (ret[as.length - 2] == 5)   return "-1";   ret[as.length - 1] = 5;  } else if (as[as.length - 1] == as[as.length - 2]) {   ret[as.length - 1] = ret[as.length - 2] == 5 ? 4 : 5;  } else {   if (ret[as.length - 2] == 1)   return "-1";   ret[as.length - 1] = 1;  }  }  StringBuilder sb = new StringBuilder();  for (int b : ret) {   sb.append(b);   sb.append(" ");  }  sb.deleteCharAt(sb.length() - 1);  return sb.toString(); } }
0	public class AAA { 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 m=Integer.parseInt(st.nextToken());  String a="";  String b="";  for(int i=0;i<1129;i++) {  a+="1";  b+="8";  }  a+="9";  b+="1";   System.out.println(a);  System.out.println(b); }  }
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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int N = in.nextInt();    Integer a[] = in.nextIntArray(N);    Arrays.sort(a);    int colors = 0;    for (int i = 0; i < N; i++) {     if (a[i] == -1) continue;     colors++;     for (int j = i + 1; j < N; j++) {      if (a[j] % a[i] == 0) {       a[j] = -1;      }     }    }    out.printLine(colors);   }  }  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());   }   public Integer[] nextIntArray(int size) {    Integer array[] = new Integer[size];    for (int i = 0; i < size; i++) {     array[i] = nextInt();    }    return array;   }  }  static class OutputWriter {   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();   }  } }
4	public class Solution {  public static void main(String[] args) throws Exception {   final String str;   final BufferedReader r = new BufferedReader(new InputStreamReader(System.in));   str = r.readLine();   int max = 0;   for (int x = 0; x < str.length(); x++) {    for (int y = x + 1; y < str.length(); y++) {     int c = 0;     for (;c + x < str.length() && y + c < str.length(); c++) {      if (str.charAt(x + c) != str.charAt(y + c)) {       break;      }     }     if (c > max) {      max = c;     }    }   }   System.out.println(max);  } }
4	public class EdE { static long[] mods = {1000000007, 998244353, 1000000009}; static long mod = mods[0]; public static MyScanner sc;  public static PrintWriter out;  static long[][][] paths;  static long[] powers501; public static void main(String[] havish) throws Exception{    sc = new MyScanner();  out = new PrintWriter(System.out);  int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  paths = new long[n+1][m+1][4];   powers501 = new long[5];  powers501[0] = 1;  for(int j = 1;j<5;j++){   powers501[j] = 501L*powers501[j-1];  }  long[][][]dp = new long[n+1][m+1][k/2+2];  for(int i = 1;i<=n;i++){   for(int j = 1;j<=m-1;j++){   int val = sc.nextInt();   paths[i][j][3] = val;   paths[i][j+1][2] = val;    }  }  for(int i = 1;i<=n-1;i++){   for(int j = 1;j<=m;j++){   int val = sc.nextInt();    paths[i][j][1] = val;   paths[i+1][j][0] = val;      }  }  for(int j = 1;j<=n;j++){   for(int i = 1;i<=m;i++){   Arrays.fill(dp[j][i], Integer.MAX_VALUE);   dp[j][i][0] = 0;   }  }  for(int steps = 1;steps<k/2+2;steps++){   for(int i = 1;i<=n;i++){   for(int j = 1;j<=m;j++){    if (i-1 > 0) {    dp[i][j][steps] = Math.min(dp[i-1][j][steps-1] + getVal(i, j, i-1, j), dp[i][j][steps]);    }    if (j-1 > 0) {    dp[i][j][steps] = Math.min(dp[i][j-1][steps-1] + getVal(i, j, i, j-1), dp[i][j][steps]);    }       if (i+1 <= n) {    dp[i][j][steps] = Math.min(dp[i+1][j][steps-1] + getVal(i, j, i+1, j), dp[i][j][steps]);    }    if (j+1 <= m) {    dp[i][j][steps] = Math.min(dp[i][j+1][steps-1] + getVal(i, j, i, j+1), dp[i][j][steps]);    }   }   }  }  if (k%2 == 1){   for(int j = 1;j<=n;j++){   for(int s = 1;s<=m;s++){    out.print(-1 + " ");   }   out.println();   }  }  else{   for(int j = 1;j<=n;j++){   for(int s = 1;s<=m;s++){    out.print(dp[j][s][k/2]*2L + " ");   }   out.println();   }  }         out.close();  } public static long getVal(int x1, int y1, int x2, int y2) {  if (x2 == x1+1)  return paths[x1][y1][1];  else if (x1 == x2+1)  return paths[x1][y1][0];  else if (y2 == y1 + 1)  return paths[x1][y1][3];  else  return paths[x1][y1][2]; } 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;   }    } }
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];  }      }   }
5	public class A {  final String filename = new String("A").toLowerCase();  void solve() throws Exception {  int n = nextInt();  int[] a = new int[n];  int m = -1;  for (int i = 0; i < n; i++) {  a[i] = nextInt();  if (m == -1 || a[i] > a[m]) {   m = i;  }  }  if (a[m] == 1)  a[m] = 2;  else  a[m] = 1;  Arrays.sort(a);  for (int i = 0; i < n; i++) {  out.print(a[i] + " ");  }  }  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(); } }
4	public class FireAgain {  Scanner in; PrintWriter out;  public static void main(String[] args) throws IOException {   new FireAgain().run();  }  void run() throws IOException {  in = new Scanner(new FileReader("input.txt"));   out = new PrintWriter(new FileWriter("output.txt"));  solve();  in.close();  out.close(); }  private void solve() {   int N = in.nextInt();  int M = in.nextInt();  int[][] burn = new int[N + 1][M + 1];  int K = in.nextInt();   int[] qx = new int[N * M];  int[] qy = new int[N * M];   int first = 0;  int last = 0;  for (int i = 0; i < K; i ++){  qx[last] = in.nextInt();  qy[last] = in.nextInt();  burn[qx[last]][qy[last]] = 1;  last ++;  }   while (first < last){  int x = qx[first];  int y = qy[first];  if (x - 1 > 0 && burn[x - 1][y] == 0){   burn[x - 1][y] = 1;   qx[last] = x - 1;   qy[last] = y;   last ++;  }  if (y - 1 > 0 && burn[x][y - 1] == 0){   burn[x][y - 1] = 1;   qx[last] = x;   qy[last] = y - 1;   last ++;  }  if (x + 1 <= N && burn[x + 1][y] == 0){   burn[x + 1][y] = 1;   qx[last] = x + 1;   qy[last] = y;   last ++;  }  if (y + 1 <= M && burn[x][y + 1] == 0){   burn[x][y + 1] = 1;   qx[last] = x;   qy[last] = y + 1;   last ++;  }  first ++;  }   out.println(qx[last - 1] + " " + qy[last - 1]); } }
4	public class R035CRetry {  public void debug(Object... objects) { System.err.println(Arrays.deepToString(objects)); }  public static final int INF = 987654321;  public static final long LINF = 987654321987654321L;  public static final double EPS = 1e-9;   Scanner scanner;  PrintWriter out;  boolean[][] bss;   public R035CRetry() {   try {    this.scanner = new Scanner(new File("input.txt"));    this.out = new PrintWriter("output.txt");   } catch(FileNotFoundException ex) { ex.printStackTrace(); }  }   class Point implements Comparable<Point> {   int x, y, count;   Point(int x, int y) { this.x = x; this.y = y; }   public int hashCode() { return x * 17 + y; }   public boolean equals(Object o) {    if(!(o instanceof Point)) return false;    Point that = (Point)o;    return this.x == that.x && this.y == that.y;   }   public int compareTo(Point that) { return this.count - that.count; }   public String toString() { return "(" + x + ", " + y + ":" + count + ")"; }  }    int[] dx = new int[] { 0, 0, -1, 1 };  int[] dy= new int[] { -1, 1, 0, 0 };  int n, m;   Queue<Point> q;   Point bfs() {   int max = -INF;   Point p = null;   while(!q.isEmpty()) {    Point cur = q.remove();    if(max < cur.count) { max = cur.count; p = cur; }    for(int i=0; i<dx.length; i++) {     int nx = cur.x + dx[i];     int ny = cur.y + dy[i];     if(nx < 0 || nx >= n) { continue; }     if(ny < 0 || ny >= m) { continue; }     Point np = new Point(nx, ny);     if(bss[nx][ny] ) { continue; }     np.count = cur.count+1;     bss[nx][ny] = true;     q.add(np);    }   }   return p;  }   private void solve() {   this.n = scanner.nextInt();   this.m = scanner.nextInt();   this.bss = new boolean[n][m];   int k = scanner.nextInt();   q = new LinkedList<Point>();   for(int i=0; i<k; i++) {    int x = scanner.nextInt() - 1;    int y = scanner.nextInt() - 1;    Point init = new Point(x, y);    init.count = 1;    q.add(init);    bss[x][y] = true;   }   Point p = bfs();   out.println((p.x+1) + " " + (p.y+1));  }   private void finish() { this.out.close(); }   public static void main(String[] args) {   R035CRetry obj = new R035CRetry();   obj.solve();   obj.finish();  } }
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 Main {  public static void main(String[] args) throws IOException {   BufferedReader r = new BufferedReader(new InputStreamReader(System.in));     int n = Integer.parseInt(r.readLine());     String[] line = r.readLine().split("[ ]+");     int[] a = new int[n];   for(int i = 0; i < n; i++)    a[i] = Integer.parseInt(line[i]);        Arrays.sort(a);     boolean found = false;   for(int i = 0; i < n && !found; i++)    if(a[i] != 1)found = true;        if(found){    System.out.println(1);    for(int i = 1; i < n; i++)     System.out.println(a[i-1]);   }else{    for(int i = 0; i < n-1; i++)     System.out.println(1);    System.out.println(2);   }  } }
6	public class E {  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 T = Integer.parseInt(bf.readLine());   for(int t=0; t<T; t++) {   StringTokenizer st = new StringTokenizer(bf.readLine());   int n = Integer.parseInt(st.nextToken());   int m = Integer.parseInt(st.nextToken());   int[][] a = new int[n][m];   for(int i=0; i<n; i++) {    st = new StringTokenizer(bf.readLine());    for(int j=0; j<m; j++) a[i][j] = Integer.parseInt(st.nextToken());    }      int[] max = new int[m];   for(int i=0; i<n; i++) {    for(int j=0; j<m; j++) {    if(a[i][j] > max[j]) max[j] = a[i][j];    }   }   int[][] pos = new int[m][2];   for(int i=0; i<m; i++) {    pos[i][0] = max[i];    pos[i][1] = i;   }   Arrays.sort(pos, new Comparator<int[]>() {    @Override    public int compare(int[] o1, int[] o2) {    return Integer.compare(o2[0], o1[0]);    }   });    int[][] new_a = new int[n][Math.min(n,m)];   for(int i=0; i<n; i++) {    for(int j=0; j<Math.min(n,m); j++) {    new_a[i][j] = a[i][pos[j][1]];    }   }   int exp = 1; for(int i=0; i<Math.min(n,m); i++) exp *= n;   int maxval = -1;   for(int i=0; i<exp; i++) {       int sum = 0;    for(int j=0; j<n; j++) {    int toAdd = 0;    int val = i;    for(int k=0; k<Math.min(n,m); k++) {     int tooAdd = new_a[(j+val)%n][k];     val /= n;     if(tooAdd > toAdd) toAdd = tooAdd;    }    sum += toAdd;    }    if(sum > maxval) maxval = sum;   }   out.println(maxval);   }           out.close(); System.exit(0);  } }
2	public class b{  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 sc = new FastReader();      double n = (double)sc.nextLong();   double k = (double)sc.nextLong();     double div = 9+8*n+8*k;   double ss = Math.sqrt(div);      ss = (ss-3)/2;   System.out.println( (int)(n-ss) ); } }
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);   G1PlaylistForPolycarpEasyVersion solver = new G1PlaylistForPolycarpEasyVersion();   solver.solve(1, in, out);   out.close();  }  static class G1PlaylistForPolycarpEasyVersion {   long mod = (int) 1e9 + 7;   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int T = in.nextInt();    int[] t = new int[n];    int[] g = new int[n];    for (int i = 0; i < n; i++) {     t[i] = in.nextInt();     g[i] = in.nextInt();    }    long[] fact = new long[n + 1];    fact[0] = 1;    for (int i = 1; i <= n; i++) {     fact[i] = (fact[i - 1] * i) % mod;    }    ArrayList<Integer> masks = new ArrayList<>();    long val = 0;    for (int i = 1; i < (1 << n); i++) {     int time = 0;     int[] count = new int[3];     for (int j = 0; j < n; j++) {      if ((i & (1 << j)) != 0) {       time += t[j];       count[g[j] - 1]++;      }     }     if (time == T) {      masks.add(i);      Arrays.sort(count);      long v = ((fact[count[0]] * fact[count[1]]) % mod * fact[count[2]]) % mod;      val += ((countUtil(count[0], count[1], count[2])) * v) % mod;     }    }    out.println(val%mod);   }   long countWays(int p, int q, int r, int last) {              if (p < 0 || q < 0 || r < 0)     return 0;                         if (p == 1 && q == 0 && r == 0 && last == 0)     return 1;        if (p == 0 && q == 1 && r == 0 && last == 1)     return 1;    if (p == 0 && q == 0 && r == 1 && last == 2)     return 1;                         if (last == 0)     return (countWays(p - 1, q, r, 1) +       countWays(p - 1, q, r, 2)) % mod;        if (last == 1)     return (countWays(p, q - 1, r, 0) +       countWays(p, q - 1, r, 2)) % mod;    if (last == 2)     return (countWays(p, q, r - 1, 0) +       countWays(p, q, r - 1, 1)) % mod;    return 0;   }   long countUtil(int p, int q, int r) {       return ((countWays(p, q, r, 0) +      countWays(p, q, r, 1)) % mod +      countWays(p, q, r, 2)) % mod;   }  }  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 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;   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
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 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");  } } }
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;  } } }
3	public class A {  public static void main(String[] args) {   Scanner input = new Scanner();   StringBuilder output = new StringBuilder();   int n = input.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = input.nextInt();   }   Arrays.sort(a);   boolean[] colored = new boolean[n];   int colors = 0;   for (int i = 0; i < n; i++) {    if (!colored[i]) {     colors ++;     colored[i] = true;     for (int j = i+1; j < n; j++) {      if (a[j] % a[i] == 0) {       colored[j] = true;      }     }    }   }   System.out.println(colors);  }  private static class Scanner {   BufferedReader br; StringTokenizer st;   public Scanner(Reader in) { br = new BufferedReader(in); }   public Scanner() { 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; }  } }
3	public class init { static class p{ int i; int c; public p(int i,int c) {  this.i=i;this.c=c;   } } static int mod=1000000007; 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++) { char c=s.next().charAt(0); if(c=='f')  a[i]=1;  } int dp[][]=new int[n+1][n+1]; for(int i=0;i<=n;i++) { for(int j=0;j<=n;j++)  dp[i][j]=-1; } System.out.println(ans(dp,1,0,a,n)); } public static int ans(int dp[][],int i,int j,int a[],int n) {  if(i==n) {    return 1;  }  if(dp[i][j]!=-1) {  return dp[i][j];  }  if(a[i-1]==1) {  int x=ans(dp,i+1,j+1,a,n);  if(x!=-1)   dp[i][j]=x%mod;  }  else {  int x=-1;  if(j!=0)  x=ans(dp,i,j-1,a,n);  int y=ans(dp,i+1,j,a,n);  if(x!=-1)   dp[i][j]=x%mod;  if(y!=-1) {   if(dp[i][j]==-1)   dp[i][j]=y%mod;   else   dp[i][j]+=y%mod;}  }  return dp[i][j]; } }
2	public class Main {  public static void main(String[] args) {  Scanner sc =new Scanner(System.in);  long n = sc.nextLong(), k = sc.nextLong();  long ans = 0, sum = 0;  while(ans < n) {  if(sum - (n-ans) == k) break;  ans++;  sum += ans;  }  sc.close();  System.out.println(n-ans); }    }
3	public class Main{     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();   Arrays.sort(a);   int ans = 0;   for(int i = 0; i< n; i++){    if(a[i] == -1)continue;    ans++;    for(int j = i+1; j< n; j++)if(a[j]%a[i] == 0)a[j] = -1;   }   pn(ans);  }   void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}  void exit(boolean b){if(!b)System.exit(0);}  long IINF = (long)1e18, mod = (long)1e9+7;  final int INF = (int)1e9, MX = (int)2e6+5;  DecimalFormat df = new DecimalFormat("0.00000000");  double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-6;  static boolean multipleTC = false, memory = false, fileIO = false;  FastReader in;PrintWriter out;  void run() throws Exception{   if(fileIO){    in = new FastReader("input.txt");    out = new PrintWriter("output.txt");   }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();  }  public static void main(String[] args) throws Exception{   if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();   else new Main().run();  }   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){out.print(o);}  void pn(Object o){out.println(o);}  void pni(Object o){out.println(o);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;   }  } }
4	public class CFC23A implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok;  public static void main(String[] args) {  new Thread(new CFC23A()).start(); }  void solve() throws IOException {  int res = 0;  String str = nextToken();  for(int i = 0; i < str.length(); ++i)  for(int j = i + 1; j <= str.length(); ++j)   if(isOk(str.substring(i, j), str))   res = max(res, j - i);  out.println(res); }  private boolean isOk(String substring, String str) {  int from = 0, kol = 0;  while(str.indexOf(substring, from) != -1 && kol < 2) {  ++kol;  from = str.indexOf(substring, from) + 1;  }  return kol >= 2; }  @Override public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();  out.flush();  out.close();  in.close();  } catch (IOException e) {    e.printStackTrace();  }  }  String nextLine() throws IOException {  tok = null;  return in.readLine(); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  String nextToken() throws IOException {  while (tok == null || !tok.hasMoreTokens()) {  tok = new StringTokenizer(in.readLine());  }  return tok.nextToken(); } }
1	public class Speadsheets {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = Integer.parseInt(sc.nextLine());   String code = "";     for (int i = 0; i < n; i++) {   long chResult = 0;   long chResult1 = 0;   long nResult = 0;   long nResult1 = 0;   boolean t = false;   boolean k = false;   code = sc.nextLine();   for (int j = 0; j < code.length(); j++) {    char c = code.charAt(j);    if (('Z' - c) < 33) {     if (t) {      chResult1 = chResult;      chResult = 0;      t = false;      k = true;     }     chResult = chResult * 26 + (26 - ('Z' - c));    } else {     t = true;     if (k) {      nResult1 = nResult;      nResult = 0;      k = false;     }     nResult = nResult * 10 + (9 - ('9' - c));    }   }   if (chResult1 == 0) {    System.out.println("R" + nResult + "C" + chResult);   } else {    System.out.println(convert(nResult) + nResult1);   }  }  }  private static String convert(long number) {   String [] chars = new String[]{"Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y"};   String result = "";   int rem = 0;   int m = 0;   while (number > 0) {   m = 0;    rem = (int) (number % 26);    result = chars[rem] + result;       if (number % 26 == 0) {    m = 1;    }    number = number / 26;    number = number - m;   }   return result;  } }
2	public class B { static char [] in = new char [1000000]; public static void main (String [] arg) throws Throwable {  int n = nextInt();  int k = nextInt();   long ate = 0;  long ans = -1;  for (long i = 1; ans < 0; ++i) {  long test = (i * (i+1)) / 2;  if (test < k) continue;    long adding_moves = i;  long eating_moves = n-i;  if (test - eating_moves == k) ans = eating_moves;  }  System.out.println(ans);   }                  static class Pair implements Comparable<Pair> {  int i,j;long L; public Pair(int xx, int yy, long LL){i=xx;j=yy;L=LL;}  public int compareTo(Pair p) { return (this.L < p.L) ? -1 : ((this.L == p.L && this.i < p.i) ? -1 : 1);} }  public static long nextLong() throws Throwable {  long i = System.in.read();boolean neg = false;while (i < 33) i = System.in.read();if (i == 45) {neg=true;i=48;}i = i - 48;  int j = System.in.read();while (j > 32) {i*=10;i+=j-48;j = System.in.read();}return (neg) ? -i : i; } public static int nextInt() throws Throwable {return (int)nextLong();} public static String next() throws Throwable {  int i = 0; while (i < 33 && i != -1) i = System.in.read(); int cptr = 0; while (i >= 33) { in[cptr++] = (char)i; i = System.in.read();}  return new String(in, 0,cptr); }  public static long gcdL(long a, long b) {while (b != 0) {long tmp = b;b = (a % b);a = tmp;}return a;} public static int gcd(int a, int b) {while (b != 0) {int tmp = b;b = (a % b);a = tmp;}return a;} public static int[] sieve(int LIM) {  int i,count = 0;  boolean [] b = new boolean [LIM];  for (i = 2;i<LIM; ++i) if (!b[i]) {count++; for (int j = i<<1; j<LIM; j+=i) b[j] = true;}  int [] primes = new int[count];  for (i = 2,count=0;i<LIM;++i) if (!b[i]) primes[count++] = i;  return primes; } public static int[] numPrimeFactors(int LIM) {  int i,count = 0;  int [] b = new int [LIM];  for (i = 2;i<LIM; ++i) if (b[i] == 0) {count++; for (int j = i; j<LIM; j+=i) b[j]++;}  return b; } public static StringBuilder stringFromArray(int [] a) {  StringBuilder b = new StringBuilder(9*a.length);  for (int i = 0; i<a.length; ++i) {  if (i != 0) b = b.append(' ');  b = b.append(a[i]);  }  return b; } public static long modPow (long a, long n, long MOD) { long S = 1; for (;n > 0; n>>=1, a=(a*a)%MOD) if ((n & 1) != 0) S = (a*S) % MOD; return S;} }
1	public class F {  public static void main(String[] args) throws Exception {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = sc.nextInt(), d = sc.nextInt();  int [] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = sc.nextInt();  }  Arrays.sort(a);  TreeSet<Integer> set = new TreeSet<>();  for (int i = 0; i < a.length; i++) {  int tmp = a[i] - d;  if(i == 0 || tmp > a[i-1] && tmp - a[i-1] >= d)   set.add(tmp);  tmp = a[i] + d;  if(i == n-1 || tmp < a[i+1] && a[i+1] - tmp >= d)   set.add(tmp);  }  out.println(set.size());  out.flush();  out.close(); }  static class Scanner {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s)  {  br = new BufferedReader(new InputStreamReader(s));  }  public Scanner(FileReader fileReader)  {  br = new BufferedReader(fileReader);  }  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 boolean ready() throws IOException  {  return br.ready();  } } }
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()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  String sti(String s) {  int res = 0;  int q = 1;  int qq = 0;  for (int i = 0; i < s.length(); i++) {  if (i > 0) qq += q;  res = res * 26 + s.charAt(i) - 'A';  q *= 26;  }  return Integer.toString(qq + res + 1); }  String its(String s) {  int q = Integer.parseInt(s);  String res = "";  int w = 26;  int l = 1;  while (q > w) {  q -= w;  l++;  w *= 26;  }  q--;  if (q == 0) return "A";  while (q > 0) {  res = "" + (char)('A' + q % 26) + res;  l--;  q /= 26;  }  for (; l > 0; l--) res = "A" + res;  return res; }    void solve() throws IOException {  int n = nextInt();  for (int i = 0; i < n; i++) {  String s = nextToken();  int j = 0;  while (!Character.isDigit(s.charAt(j))) j++;  int q = j + 1;  while (q < s.length() && Character.isDigit(s.charAt(q))) q++;  if (q == s.length()) {   out.println("R" + s.substring(j) + "C" + sti(s.substring(0, j)));  } else {   String w = s.substring(j, q);   while (!Character.isDigit(s.charAt(q))) q++;   out.println(its(s.substring(q)) + w);  }  } }  public void run() {  try {   in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  } catch (IOException e) {  e.printStackTrace();  }  out.flush(); } }
1	public class Main{  public static void main(String args[]){  Scanner sc=new Scanner(System.in);  int n=sc.nextInt();  int a[]=new int[n];  for(int i=0;i<n;i++)  a[i]=sc.nextInt();  Arrays.sort(a);   int t=1,c=0;  for(int i=1;i<n;i++){   if(a[i]==a[i-1])   {    if(i-2>=0&&a[i-2]==a[i-1]-1){     System.out.println("cslnb");     return;    }    c++;   }   if(a[i]==a[i-1]&&a[i]==0){   System.out.println("cslnb");   return;   }  }  if(c>1)  {   System.out.println("cslnb");   return;  }  for(int i=0;i<n;i++){   if((a[i]-i)%2!=0)   t=t^1;  }  if(t==1)  System.out.println("cslnb");  else  System.out.println("sjfnb");      }  }
6	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; }  private List<Integer> kmp(String x, String a) {  String s = a + "$" + x;  int[] oppa = new int[s.length()];  oppa[0] = 0;  int tmp = 0;  List<Integer> res = new ArrayList<Integer>();  for (int i = 1; i < s.length(); i++) {  while (tmp != 0 && s.charAt(tmp) != s.charAt(i)) {     tmp = oppa[tmp - 1];  }  if (s.charAt(tmp) == s.charAt(i))   tmp++;  oppa[i] = tmp;  if (tmp == a.length()) {   res.add(i - a.length() - a.length());  }  }  return res; }  double nextDouble(StreamTokenizer st) throws IOException {  st.nextToken();  return st.nval; }  String nextLine(StreamTokenizer st) throws IOException {  st.nextToken();  return st.sval; }  public void run1() throws IOException {  Scanner sc = new Scanner(new InputStreamReader(System.in));   int n = sc.nextInt();  int m = sc.nextInt();  boolean[][] arr = new boolean[n][n];  for (int i = 0; i < m; i++) {  int a = sc.nextInt();  int b = sc.nextInt();  arr[a - 1][b - 1] = true;  arr[b - 1][a - 1] = true;  }  long[][] res = new long[n][1 << n];  for (int mask = 1; mask < (1 << n); mask++) {  int min = -1;  for (int i = 0; i < n; i++) {   if ((mask & (1 << i)) != 0) {   if (min == -1) {    min = i;    if (mask == (1 << min))    res[min][mask] = 1;   }   for (int j = min + 1; j < n; j++)    if ((mask & (1 << j)) == 0 && arr[i][j]) {    res[j][mask | (1 << j)] += res[i][mask];    }   }  }  }  long r = 0;  for (int mask = 1; mask < (1 << n); mask++)  if (Integer.bitCount(mask) != 2)   for (int j = 0; j < n; j++) {   int i = 0;   while ((mask & (1 << i)) == 0)    i++;   if (arr[i][j])    r += res[j][mask];   }  System.out.println(r / 2); } }
1	public class Problem01B implements Runnable {  static final long[] x10 = new long[] { 1, 26, 26*26, 26*26*26, 26*26*26*26, 26*26*26*26*26, 26*26*26*26*26*26};  void solve() throws NumberFormatException, IOException {     int n = nextInt();   for (int i = 0; i < n; i++) {    String t = nextToken().toUpperCase();    StringBuffer rowString = new StringBuffer(t.length());    StringBuffer numb1 = new StringBuffer(t.length());    StringBuffer numb2 = new StringBuffer(t.length());    int stage = 0;    for (int j = 0; j < t.length(); j++) {;     char charAt = t.charAt(j);     if (charAt >= 'A') {      if (stage == 0) {       rowString.append(charAt);      } else {       stage++;      }     } else {      if (stage == 0 || stage == 2)       stage++;      switch (stage) {      case 1: numb1.append(charAt); break;      case 3: numb2.append(charAt); break;      }     }    }       if (stage == 1) {     long result = convertString(rowString);     System.out.print("R");     System.out.print(numb1.toString());     System.out.print("C");     System.out.println(result);    } else {     StringBuffer tmp = convertNumber(Long.parseLong(numb2.toString()));     System.out.print(tmp.toString());     System.out.println(numb1.toString());    }   }  }   public StringBuffer convertNumber(long n) {   StringBuffer sb2 = new StringBuffer();   long nmod26 = n % 26;   long ndiv26 = n / 26;   while (ndiv26 > 0 || nmod26 > 0) {    long tmp = 0;    if (nmod26 > 0) {     sb2.append((char) ('A' + nmod26 - 1));     tmp = ndiv26;    } else {     sb2.append('Z');     tmp = ndiv26 - 1;    }    nmod26 = tmp % 26;    ndiv26 = tmp / 26;   }     return sb2.reverse();  }   public long convertString(StringBuffer sb) {   long result = 0;   for (int i = 0; i < sb.length(); i++) {    long l = (sb.charAt(i) - 'A' + 1) * x10[sb.length() - i - 1];    result += l;   }   return result;  }   StringTokenizer st;  BufferedReader in;  PrintWriter out;   public static void main(String[] args) {   new Problem01B().run();  }  public void run() {   try {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();   } catch (Exception e) {    System.exit(9000);   } 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());  } }
5	public class Main{ public static void main(String[] args){  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  TreeSet<Integer> set = new TreeSet<Integer>();  for(int i=0;i<n;i++){  set.add(sc.nextInt());  }  if(set.size() >= 2)  System.out.println(set.toArray()[1]);  else  System.out.println("NO"); } }
6	public class main{  static int max = 5000+1; static FastReader in = new FastReader(); static PrintWriter out = new PrintWriter(System.out); static int N = 18; static int[][] mn1 = new int[N][N];  static int[][] mn2 = new int[N][N]; static int[][] dp = new int[1<<N][N]; static int n,m;  static void solve(){  n = in.nextInt(); m = in.nextInt();  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();  for(int i=0;i<n;i++){  Arrays.fill(mn1[i],Integer.MAX_VALUE);  Arrays.fill(mn2[i],Integer.MAX_VALUE);  }   for(int i=0;i<n;i++)  for(int j=0;j<n;j++)   for(int k=0;k<m;k++){   mn1[i][j] = Math.min(mn1[i][j],Math.abs(a[i][k]-a[j][k]));   if(k<=m-2)    mn2[i][j] = Math.min(mn2[i][j],Math.abs(a[i][k]-a[j][k+1]));   }  int ans = 0;  for(int i=0;i<n;i++){  for(int x=0;x<1<<n;x++)Arrays.fill(dp[x],-1);  for(int j=0;j<n;j++)dp[1<<j][j] = 0;  dp[1<<i][i] = Integer.MAX_VALUE;  for(int j=0;j<n;j++)   ans = Math.max(ans,Math.min(mn2[j][i],calc((1 << n) - 1, j)));  }  out.println(ans); }  static int calc(int mask, int v){  if (dp[mask][v] != -1)  return dp[mask][v];  dp[mask][v] = 0;  for(int u=0;u<n;u++) if (v != u && (((mask >> u) & 1)>0))  dp[mask][v] = Math.max(dp[mask][v], Math.min(mn1[u][v], calc(mask ^ (1 << v), u)));  return dp[mask][v]; }  public static void main(String[] args){  solve();  out.close(); }  static 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(){    while (st == null || !st.hasMoreElements()){     try{      st = new StringTokenizer(br.readLine());     }catch (IOException e){      e.printStackTrace();     }    }    return st.nextToken();   }   String nextLine(){    String str = "";    try{      str = br.readLine();    }catch (IOException e){     e.printStackTrace();    }    return str;   }   int nextInt(){return Integer.parseInt(in.next());}  long nextLong(){return Long.parseLong(in.next());}  double nextDouble(){return Double.parseDouble(in.next());}  } }
6	public class Main{     void pre() throws Exception{}  int n, t;  void solve(int TC) throws Exception{   n = ni();t = ni();   int[][] song = new int[n][];   for(int i = 0; i< n; i++)song[i] = new int[]{ni(), ni()-1};   long[][] dp = new long[1<<n][3];   for(int i = 0; i< dp.length; i++)    for(int j = 0; j< dp[i].length; j++)     dp[i][j] = -1;   pn(start(dp, song, 0, -1));  }  long start(long[][] dp, int[][] song, int mask, int prev){   long ti = 0;   for(int i = 0; i< n; i++){    if(((mask>>i)&1)==1)ti+=song[i][0];   }   if(ti==t)return 1;   if(prev != -1 && dp[mask][prev] != -1)return dp[mask][prev];   long ans = 0;   for(int i = 0; i< n; i++){    if(((mask>>i)&1)==0 && song[i][1] != prev && ti+song[i][0] <= t)     ans = (ans+start(dp, song, mask|(1<<i), song[i][1]))%mod;   }   if(prev!= -1)dp[mask][prev] = ans;   return ans;  }   void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}  long mod = (long)1e9+7, IINF = (long)1e18;  final int INF = (int)1e9, MX = (int)2e5+5;  DecimalFormat df = new DecimalFormat("0.00000000000");  double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-8;  static boolean multipleTC = false, memory = false;  FastReader in;PrintWriter out;  void run() throws Exception{   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();  }  public static void main(String[] args) throws Exception{   if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();   else new Main().run();  }  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){out.print(o);}  void pn(Object o){out.println(o);}  void pni(Object o){out.println(o);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;   }  } }
6	public class Main implements Runnable {  private int n;  private int nn;  private long[][] dp;  private boolean[][] gr;      private void solve() throws Throwable {   n = nextInt();   nn = 1 << n;   gr = new boolean[n][n];   dp = new long[n][nn];   for (int i = 0; i < n; i++) {    Arrays.fill(dp[i], -1);   }   int m = nextInt();   for (int i = 0; i < m; i++) {    int a = nextInt() - 1, b = nextInt() - 1;    gr[a][b] = gr[b][a] = true;   }   for (int i = 0; i < n; i++) {    dp[i][0] = 0;   }   for (int mask = 1; mask < nn; mask++) {    int bCount = Integer.bitCount(mask);    if (bCount < 2) {     dp[Integer.numberOfTrailingZeros(mask)][mask] = 0;    } else if (bCount == 2) {     int msk = mask;     int one = Integer.numberOfTrailingZeros(msk);     msk ^= (1 << one);     int two = Integer.numberOfTrailingZeros(msk);     dp[two][mask] = gr[one][two] ? 1 : 0;    }   }   long count = 0;   for (int mask = 1; mask < nn; mask++) {    if (Integer.bitCount(mask) < 3) continue;    int i = Integer.numberOfTrailingZeros(mask);    for (int j = i + 1; j < n; j++) {     int jj = 1 << j;     if (gr[i][j] && ((jj & mask) != 0)) {      count += Dp(j, mask);     }    }   }   pw.println(count / 2);  }  private long Dp(int j, int mask) {   if (dp[j][mask] != -1) return dp[j][mask];   int i = Integer.numberOfTrailingZeros(mask);   assert i < j;   int m = mask ^ (1 << j);   long ans = 0;   for (int p = i + 1; p < n; p++) {    if (!gr[p][j]) continue;    if ((mask & (1 << p)) == 0) continue;    ans += Dp(p, m);   }   dp[j][mask] = ans;   return ans;  }      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 {   Thread t = new Thread(new Main());   t.start();   t.join();   if (sError != null) {    throw sError;   }  }  public void run() {   try {    initStreams();    solve();   } catch (Throwable e) {    sError = e;   } finally {    if (pw != null)     pw.close();   }  } }
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());  } } }
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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.readInt();    int[] a = in.readIntArray(n);    ArrayUtils.sort(a);    boolean[] done = new boolean[n];    int answer = 0;    for (int i = 0; i < n; i++) {     if (done[i]) {      continue;     }     answer++;     for (int j = i; j < n; j++) {      if (a[j] % a[i] == 0) {       done[j] = true;      }     }    }    out.printLine(answer);   }  }  static class Sorter {   private static final int INSERTION_THRESHOLD = 16;   private Sorter() {   }   public static void sort(IntList list, IntComparator comparator) {    quickSort(list, 0, list.size() - 1, (Integer.bitCount(Integer.highestOneBit(list.size()) - 1) * 5) >> 1,      comparator);   }   private static void quickSort(IntList list, int from, int to, int remaining, IntComparator comparator) {    if (to - from < INSERTION_THRESHOLD) {     insertionSort(list, from, to, comparator);     return;    }    if (remaining == 0) {     heapSort(list, from, to, comparator);     return;    }    remaining--;    int pivotIndex = (from + to) >> 1;    int pivot = list.get(pivotIndex);    list.swap(pivotIndex, to);    int storeIndex = from;    int equalIndex = to;    for (int i = from; i < equalIndex; i++) {     int value = comparator.compare(list.get(i), pivot);     if (value < 0) {      list.swap(storeIndex++, i);     } else if (value == 0) {      list.swap(--equalIndex, i--);     }    }    quickSort(list, from, storeIndex - 1, remaining, comparator);    for (int i = equalIndex; i <= to; i++) {     list.swap(storeIndex++, i);    }    quickSort(list, storeIndex, to, remaining, comparator);   }   private static void heapSort(IntList list, int from, int to, IntComparator comparator) {    for (int i = (to + from - 1) >> 1; i >= from; i--) {     siftDown(list, i, to, comparator, from);    }    for (int i = to; i > from; i--) {     list.swap(from, i);     siftDown(list, from, i - 1, comparator, from);    }   }   private static void siftDown(IntList list, int start, int end, IntComparator comparator, int delta) {    int value = list.get(start);    while (true) {     int child = ((start - delta) << 1) + 1 + delta;     if (child > end) {      return;     }     int childValue = list.get(child);     if (child + 1 <= end) {      int otherValue = list.get(child + 1);      if (comparator.compare(otherValue, childValue) > 0) {       child++;       childValue = otherValue;      }     }     if (comparator.compare(value, childValue) >= 0) {      return;     }     list.swap(start, child);     start = child;    }   }   private static void insertionSort(IntList list, int from, int to, IntComparator comparator) {    for (int i = from + 1; i <= to; i++) {     int value = list.get(i);     for (int j = i - 1; j >= from; j--) {      if (comparator.compare(list.get(j), value) <= 0) {       break;      }      list.swap(j, j + 1);     }    }   }  }  static interface IntStream extends Iterable<Integer>, Comparable<IntStream> {   public IntIterator intIterator();   default public Iterator<Integer> iterator() {    return new Iterator<Integer>() {     private IntIterator it = intIterator();     public boolean hasNext() {      return it.isValid();     }     public Integer next() {      int result = it.value();      it.advance();      return result;     }    };   }   default public int compareTo(IntStream c) {    IntIterator it = intIterator();    IntIterator jt = c.intIterator();    while (it.isValid() && jt.isValid()) {     int i = it.value();     int j = jt.value();     if (i < j) {      return -1;     } else if (i > j) {      return 1;     }     it.advance();     jt.advance();    }    if (it.isValid()) {     return 1;    }    if (jt.isValid()) {     return -1;    }    return 0;   }  }  static interface IntComparator {   public static final IntComparator DEFAULT = (first, second) -> {    if (first < second) {     return -1;    }    if (first > second) {     return 1;    }    return 0;   };   public int compare(int first, int second);  }  static class IntArray extends IntAbstractStream implements IntList {   private int[] data;   public IntArray(int[] arr) {    data = arr;   }   public int size() {    return data.length;   }   public int get(int at) {    return data[at];   }   public void addAt(int index, int value) {    throw new UnsupportedOperationException();   }   public void removeAt(int index) {    throw new UnsupportedOperationException();   }   public void set(int index, int value) {    data[index] = value;   }  }  static interface IntIterator {   public int value() throws NoSuchElementException;   public boolean advance();   public boolean isValid();  }  static abstract class IntAbstractStream implements IntStream {   public String toString() {    StringBuilder builder = new StringBuilder();    boolean first = true;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     if (first) {      first = false;     } else {      builder.append(' ');     }     builder.append(it.value());    }    return builder.toString();   }   public boolean equals(Object o) {    if (!(o instanceof IntStream)) {     return false;    }    IntStream c = (IntStream) o;    IntIterator it = intIterator();    IntIterator jt = c.intIterator();    while (it.isValid() && jt.isValid()) {     if (it.value() != jt.value()) {      return false;     }     it.advance();     jt.advance();    }    return !it.isValid() && !jt.isValid();   }   public int hashCode() {    int result = 0;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     result *= 31;     result += it.value();    }    return result;   }  }  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[] readIntArray(int size) {    int[] array = new int[size];    for (int i = 0; i < size; i++) {     array[i] = readInt();    }    return array;   }   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 interface IntCollection extends IntStream {   public int size();   default public void add(int value) {    throw new UnsupportedOperationException();   }   default public IntCollection addAll(IntStream values) {    for (IntIterator it = values.intIterator(); it.isValid(); it.advance()) {     add(it.value());    }    return this;   }  }  static interface IntReversableCollection extends IntCollection {  }  static class IntArrayList extends IntAbstractStream implements IntList {   private int size;   private int[] data;   public IntArrayList() {    this(3);   }   public IntArrayList(int capacity) {    data = new int[capacity];   }   public IntArrayList(IntCollection c) {    this(c.size());    addAll(c);   }   public IntArrayList(IntStream c) {    this();    if (c instanceof IntCollection) {     ensureCapacity(((IntCollection) c).size());    }    addAll(c);   }   public IntArrayList(IntArrayList c) {    size = c.size();    data = c.data.clone();   }   public IntArrayList(int[] arr) {    size = arr.length;    data = arr.clone();   }   public int size() {    return size;   }   public int get(int at) {    if (at >= size) {     throw new IndexOutOfBoundsException("at = " + at + ", size = " + size);    }    return data[at];   }   private void ensureCapacity(int capacity) {    if (data.length >= capacity) {     return;    }    capacity = Math.max(2 * data.length, capacity);    data = Arrays.copyOf(data, capacity);   }   public void addAt(int index, int value) {    ensureCapacity(size + 1);    if (index > size || index < 0) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    if (index != size) {     System.arraycopy(data, index, data, index + 1, size - index);    }    data[index] = value;    size++;   }   public void removeAt(int index) {    if (index >= size || index < 0) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    if (index != size - 1) {     System.arraycopy(data, index + 1, data, index, size - index - 1);    }    size--;   }   public void set(int index, int value) {    if (index >= size) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    data[index] = value;   }  }  static class ArrayUtils {   public static int[] sort(int[] array) {    return sort(array, IntComparator.DEFAULT);   }   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) {    if (from == 0 && to == array.length) {     new IntArray(array).sort(comparator);    } else {     new IntArray(array).subList(from, to).sort(comparator);    }    return array;   }  }  static interface IntList extends IntReversableCollection {   public abstract int get(int index);   public abstract void set(int index, int value);   public abstract void addAt(int index, int value);   public abstract void removeAt(int index);   default public void swap(int first, int second) {    if (first == second) {     return;    }    int temp = get(first);    set(first, get(second));    set(second, temp);   }   default public IntIterator intIterator() {    return new IntIterator() {     private int at;     private boolean removed;     public int value() {      if (removed) {       throw new IllegalStateException();      }      return get(at);     }     public boolean advance() {      at++;      removed = false;      return isValid();     }     public boolean isValid() {      return !removed && at < size();     }     public void remove() {      removeAt(at);      at--;      removed = true;     }    };   }   default public void add(int value) {    addAt(size(), value);   }   default public IntList sort(IntComparator comparator) {    Sorter.sort(this, comparator);    return this;   }   default public IntList subList(final int from, final int to) {    return new IntList() {     private final int shift;     private final int size;     {      if (from < 0 || from > to || to > IntList.this.size()) {       throw new IndexOutOfBoundsException("from = " + from + ", to = " + to + ", size = " + size());      }      shift = from;      size = to - from;     }     public int size() {      return size;     }     public int get(int at) {      if (at < 0 || at >= size) {       throw new IndexOutOfBoundsException("at = " + at + ", size = " + size());      }      return IntList.this.get(at + shift);     }     public void addAt(int index, int value) {      throw new UnsupportedOperationException();     }     public void removeAt(int index) {      throw new UnsupportedOperationException();     }     public void set(int at, int value) {      if (at < 0 || at >= size) {       throw new IndexOutOfBoundsException("at = " + at + ", size = " + size());      }      IntList.this.set(at + shift, value);     }     public IntList compute() {      return new IntArrayList(this);     }    };   }  }  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 close() {    writer.close();   }   public void printLine(int i) {    writer.println(i);   }  } }
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());  } } }
1	public class Cgr14 {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader sc = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   Solver solver = new Solver();  int t = sc.nextInt();   while (t-- != 0) {    solver.solve(sc, out);   }   out.close();  }  static class Solver {   public void solve(InputReader sc, PrintWriter out) {    long n = sc.nextInt();    long l = 1;    long r = (long)1e5;    while(l<=r) {     long mid = (l+r)/2;     long needed = (mid*mid)*2;     if(needed==n) {      out.println("YES");      return;     }     if(needed>n) {      r = mid-1;     } else {      l = mid+1;     }    }    l = 1;    r = (long)1e5;    while(l<=r) {     long mid = (l+r)/2;     long needed = (mid*mid)*4;     if(needed==n) {      out.println("YES");      return;     }     if(needed>n) {      r = mid-1;     } else {      l = mid+1;     }    }    out.println("NO");   }  }  static void sort(int[] arr) {   Random rand = new Random();   int n = arr.length;   for (int i = 0; i < n; i++) {    int idx = rand.nextInt(n);    if (idx == i) continue;    arr[i] ^= arr[idx];    arr[idx] ^= arr[i];    arr[i] ^= arr[idx];   }   Arrays.sort(arr);  }  static void sort(long[] arr) {   Random rand = new Random();   int n = arr.length;   for (int i = 0; i < n; i++) {    int idx = rand.nextInt(n);    if (idx == i) continue;    arr[i] ^= arr[idx];    arr[idx] ^= arr[i];    arr[i] ^= arr[idx];   }   Arrays.sort(arr);  }  static void sortDec(int[] arr) {   Random rand = new Random();   int n = arr.length;   for (int i = 0; i < n; i++) {    int idx = rand.nextInt(n);    if (idx == i) continue;    arr[i] ^= arr[idx];    arr[idx] ^= arr[i];    arr[i] ^= arr[idx];   }   Arrays.sort(arr);   int l = 0;   int r = n - 1;   while (l < r) {    arr[l] ^= arr[r];    arr[r] ^= arr[l];    arr[l] ^= arr[r];    l++;    r--;   }  }  static void sortDec(long[] arr) {   Random rand = new Random();   int n = arr.length;   for (int i = 0; i < n; i++) {    int idx = rand.nextInt(n);    if (idx == i) continue;    arr[i] ^= arr[idx];    arr[idx] ^= arr[i];    arr[i] ^= arr[idx];   }   Arrays.sort(arr);   int l = 0;   int r = n - 1;   while (l < r) {    arr[l] ^= arr[r];    arr[r] ^= arr[l];    arr[l] ^= arr[r];    l++;    r--;   }  }  static class InputReader {   private boolean finished = false;   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 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 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 String nextString() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     if (Character.isValidCodePoint(c)) {      res.appendCodePoint(c);     }     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   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;   }   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(nextString());    } catch (NumberFormatException e) {     throw new InputMismatchException();    }   }   public char nextCharacter() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    return (char) c;   }   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 boolean isExhausted() {    int value;    while (isSpaceChar(value = peek()) && value != -1) {     read();    }    return value == -1;   }   public String next() {    return nextString();   }   public SpaceCharFilter getFilter() {    return filter;   }   public void setFilter(SpaceCharFilter filter) {    this.filter = filter;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }   public int[] nextIntArray(int n) {    int[] array = new int[n];    for (int i = 0; i < n; ++i) array[i] = nextInt();    return array;   }   public int[] nextSortedIntArray(int n) {    int array[] = nextIntArray(n);    Arrays.sort(array);    return array;   }   public int[] nextSumIntArray(int n) {    int[] array = new int[n];    array[0] = nextInt();    for (int i = 1; i < n; ++i) array[i] = array[i - 1] + nextInt();    return array;   }   public long[] nextLongArray(int n) {    long[] array = new long[n];    for (int i = 0; i < n; ++i) array[i] = nextLong();    return array;   }   public long[] nextSumLongArray(int n) {    long[] array = new long[n];    array[0] = nextInt();    for (int i = 1; i < n; ++i) array[i] = array[i - 1] + nextInt();    return array;   }   public long[] nextSortedLongArray(int n) {    long array[] = nextLongArray(n);    Arrays.sort(array);    return array;   }  }  }
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); } }
5	public class A {  private class Pair {  public final int prob;  public final int time;   public Pair(int prob, int time) {  this.prob = prob;  this.time = time;  } }  private void solve() throws IOException {  int n = nextInt();  int k = nextInt();   Pair[] p = new Pair[n];  for (int i = 0; i < n; i++) {  p[i] = new Pair(nextInt(), nextInt());  }   Arrays.sort(p, new Comparator<Pair>() {  @Override  public int compare(Pair o1, Pair o2) {   if (o1.prob == o2.prob) {   return o1.time - o2.time;   }   return o2.prob - o1.prob;  }  });   int time = p[k - 1].time;  int prob = p[k - 1].prob;  int res = 0;  for (int i = 0; i < n; i++) {  if (p[i].time == time && p[i].prob == prob) {   res++;  }  }  println(res); }  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);  } } }
4	public class Main{ public static void main(String[] args)throws FileNotFoundException,IOException{  File file = new File("input.txt");  Scanner sc = new Scanner(file);  File outFile = new File("output.txt");  PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(outFile)));  int w = sc.nextInt();  int h = sc.nextInt();  boolean[][] map = new boolean[h+1][w+1];   int x = -1, y = -1;  Queue<Point> open = new LinkedList<Point>();  int k = sc.nextInt();  for(int i=0;i<k;i++){  int tx = sc.nextInt();  int ty = sc.nextInt();  map[ty][tx] = true;  x = tx;  y = ty;  open.add(new Point(x,y));  }  int dx[] = {1,-1,0,0};  int dy[] = {0,0,1,-1};  while(!open.isEmpty()){  Point p = open.poll();   for(int i=0;i<4;i++){   int nx = p.x + dx[i];   int ny = p.y + dy[i];   if(nx>0 && nx<=w && ny>0 && ny<=h && !map[ny][nx]){   map[ny][nx] = true;   x = nx;   y = ny;   open.add(new Point(nx,ny));   }  }  }  pw.println(x + " " + y);  pw.close(); } }
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());   }  } }
5	public class P166A { public static void main(String[] args)  {  Scanner myScanner = new Scanner(System.in);  int n = myScanner.nextInt();  int k = myScanner.nextInt();  Team[] queue = new Team[n];  for (int i = 0; i < n; i++)  {  queue[i] = new Team(myScanner.nextInt(), myScanner.nextInt());  }  Arrays.sort(queue);   int counter = 0;  int i = 0;  int p = -1;  int t = -1;  for (; i < k; i++)  {  if (p == queue[i].problems && t == queue[i].penalty)   counter++;  else  {   p = queue[i].problems;   t = queue[i].penalty;   counter = 1;  }  }  for (; i < n; i++)  {  if (p == queue[i].problems && t == queue[i].penalty)   counter++;  else   break;  }  System.out.println(counter); }  static class Team implements Comparable<Team> {  int problems;  int penalty;   public Team(int problems, int penalty)  {  this.problems = problems;  this.penalty = penalty;  }   public int compareTo(Team t)  {  if (problems > t.problems) return -1;  else if (problems < t.problems) return 1;  else if (penalty > t.penalty) return 1;  else if (penalty < t.penalty) return -1;  else return 0;  } } }
6	public class E1 { static char [] in = new char [1000000]; public static void main (String [] arg) throws Throwable {  int t = nextInt();  C : for (int ii = 0; ii<t; ++ii) {  int n = nextInt();  int m = nextInt();  Pair [] P = new Pair [n*m];  int [][] g = new int [n][m];  for (int i = 0; i<n; ++i) {   for (int j = 0; j<m; ++j) {   g[i][j] = nextInt();   P[j + m*i] = new Pair (i, j, g[i][j]);   }  }  for (int i = 0; i<P.length; ++i) if (P[i] == null) continue C;  Arrays.sort(P);  HashSet<Integer> rotcols =new HashSet<Integer>();  for (int i = 0; i<n; ++i) {     rotcols.add(P[i].j);  }    if (n <= 3 || rotcols.size() >= 3) {     int sum = 0;   for (int i = 0; i<n && i < P.length; ++i) sum += P[i].L;   System.out.println(sum);  } else {     if (P.length > 4) rotcols.add(P[4].j);     int [] rot = new int [rotcols.size()];   int maxmax = 0;   A : while (true) {   for (int i = 0; i<rot.length; ++i) {    rot[i]++;    if (rot[i] == n) {    rot[i] = 0;    if (i == rot.length-1) break A;    } else {    break;    }   }   int [] max = new int [n];   for (int i = 0; i<n; ++i) {    int j = 0;    for (int col : rotcols) {    max[i] = Math.max(max[i], g[(i+rot[j])%n][col]);    j++;    }   }   int sum = 0;   for (int m2 : max) sum+= m2;   maxmax = Math.max(maxmax, sum);   }   System.out.println(maxmax);  }  } }                  static class Pair implements Comparable<Pair> {  int i,j;long L; public Pair(int xx, int yy, long LL){i=xx;j=yy;L=LL;}  public int compareTo(Pair p) { return (this.L > p.L) ? -1 : (this.L == p.L) ? this.i - p.i : 1;} }  public static long nextLong() throws Throwable {  long i = System.in.read();boolean neg = false;while (i < 33) i = System.in.read();if (i == 45) {neg=true;i=48;}i = i - 48;  int j = System.in.read();while (j > 32) {i*=10;i+=j-48;j = System.in.read();}return (neg) ? -i : i; } public static int nextInt() throws Throwable {return (int)nextLong();} public static String next() throws Throwable {  int i = 0; while (i < 33 && i != -1) i = System.in.read(); int cptr = 0; while (i >= 33) { in[cptr++] = (char)i; i = System.in.read();}  return new String(in, 0,cptr); }  public static long gcdL(long a, long b) {while (b != 0) {long tmp = b;b = (a % b);a = tmp;}return a;} public static int gcd(int a, int b) {while (b != 0) {int tmp = b;b = (a % b);a = tmp;}return a;} public static int[] sieve(int LIM) {  int i,count = 0;  boolean [] b = new boolean [LIM];  for (i = 2;i<LIM; ++i) if (!b[i]) {count++; for (int j = i<<1; j<LIM; j+=i) b[j] = true;}  int [] primes = new int[count];  for (i = 2,count=0;i<LIM;++i) if (!b[i]) primes[count++] = i;  return primes; } public static int[] numPrimeFactors(int LIM) {  int i,count = 0;  int [] b = new int [LIM];  for (i = 2;i<LIM; ++i) if (b[i] == 0) {count++; for (int j = i; j<LIM; j+=i) b[j]++;}  return b; } public static StringBuilder stringFromArray(int [] a) {  StringBuilder b = new StringBuilder(9*a.length);  for (int i = 0; i<a.length; ++i) {  if (i != 0) b = b.append(' ');  b = b.append(a[i]);  }  return b; } public static long modPow (long a, long n, long MOD) { long S = 1; for (;n > 0; n>>=1, a=(a*a)%MOD) if ((n & 1) != 0) S = (a*S) % MOD; return S;} }
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);   }  } }
1	public class R364C { public static void main(String[] args) throws NumberFormatException, IOException {  Scanner s = new Scanner(System.in);  BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);   int n = Integer.parseInt(f.readLine());  char[] a = f.readLine().toCharArray();  int difTypes = 0;  TreeSet<Character> types = new TreeSet<Character>();  for(int i = 0; i < n; i++) {  if(!types.contains(a[i])) {   types.add(a[i]);  }  }  int i = 0, j = 0;  difTypes = types.size();  int curTypes = 0;  int min = Integer.MAX_VALUE;  TreeSet<Character> has = new TreeSet<Character>();  HashMap<Character, Integer> freq = new HashMap<Character, Integer>();  while(i < n && j < n) {   has.add(a[j]);  if(!freq.containsKey(a[j])) {   freq.put(a[j], 1);  } else {   freq.put(a[j], freq.get(a[j])+1);  }  j++;  curTypes = has.size();  if(curTypes == difTypes) min = Math.min(min, j-i);    while(i < n && has.size() == difTypes) {   int Freq = freq.get(a[i]);   if(Freq - 1 == 0) {   has.remove(a[i]);   freq.put(a[i], freq.get(a[i])-1);   i++;   break;   }   freq.put(a[i], freq.get(a[i])-1);   i++;   if(curTypes == difTypes) min = Math.min(min, j-i);  }  curTypes = has.size();  }  System.out.println(min); } }
3	public class Task {  public static void solve() throws Exception { int n = nextInt(); int[] S = new int[n]; for(int i=0;i<n;i++) {  S[i] = nextInt();  if(i > 0) {  S[i] += S[i-1];  } } Map<Integer, List<L>> map = new HashMap<>(); for(int j=0;j<n;j++) {  for(int i=j;i>=0;i--) {  int sum = S[j];  if(i > 0) {   sum -= S[i-1];  }  L l = new L();  l.a = i;  l.b = j;  List<L> list = map.get(sum);  if(list == null) {   list = new ArrayList<>();   map.put(sum, list);  }  list.add(l);  } } List<L> longest = null; for(Integer sum: map.keySet()) {  List<L> list = map.get(sum);  Collections.sort(list);  List<L> list2 = new ArrayList<>(list.size());  int from = list.get(0).a;  for(L l: list) {  if(l.a >= from) {   list2.add(l);   from = l.b + 1;  }  }  if(longest == null || longest.size() < list2.size()) {  longest = list2;  } }  println(longest.size()); for(int i=0;i<longest.size();i++) {  L l = longest.get(i);  println((l.a+1) + " " + (l.b+1)); }  }   private static class L implements Comparable<L>{ int a; int b;  @Override public int compareTo(L l2) {  return Integer.valueOf(b).compareTo(l2.b); }  }   public static void main(String[] args) throws Exception { try {  fastReader = new FastReader(System.in);  systemOut = new BufferedOutputStream(System.out);  solve(); } finally {  systemOut.close(); }  }  private static FastReader fastReader = null;  private static BufferedOutputStream systemOut = null;  public static void print(Object obj) { print(obj.toString());  }  public static void print(String str) { try {  systemOut.write(str.getBytes("utf-8")); } catch (Exception ex) {  throw new RuntimeException(ex); }  }  public static void println(Object obj) { println(obj.toString());  }  public static void println(String str) { try {  print(str);  systemOut.write('\n'); } catch (Exception ex) {  throw new RuntimeException(ex); }  }  public static String next() { return fastReader.readNextToken(false);  }  public static String nextLine() { return fastReader.readNextToken(true);  }  public static int nextInt() { return Integer.parseInt(fastReader.readNextToken(false));  }  public static long nextLong() { return Long.parseLong(fastReader.readNextToken(false));  }  public static double nextDouble() { return Double.parseDouble(fastReader.readNextToken(false));  }  static class FastReader { private byte[] buf = new byte[65536]; private int ind = 0; private int maxInd = -1; private InputStream is = null; private boolean eof = false; private boolean lastCharRead = false;  public FastReader(InputStream is) {  this.is = is; }  public String readNextToken(boolean endOfLine) {  try {  StringBuilder sb = new StringBuilder();  boolean found = false;  while (true) {   if (lastCharRead) {  return null;   } else if (ind > maxInd) {  if (eof) {   lastCharRead = true;  } else {   fillBuffer();  }   }   byte b = '\n';   if (!lastCharRead) {  b = buf[ind++];   }   if (b == '\r') {     } else if ((b == '\n' && endOfLine) || (Character.isWhitespace(b) && !endOfLine)) {  if (found) {   break;  }   } else {  sb.append((char) b);  found = true;   }  }  return sb.toString();  } catch (Exception ex) {  throw new RuntimeException(ex);  } }  private void fillBuffer() {  try {  int read = is.read(buf, 0, buf.length);  if (read < buf.length) {   eof = true;  }  ind = 0;  maxInd = read - 1;  } catch (Exception ex) {  throw new RuntimeException(ex);  } }  }  public static class LST { public long[][] set; public int n;  public LST(int n) {  this.n = n;  int d = 1;  for (int m = n; m > 1; m >>>= 6, d++)  ;   set = new long[d][];  for (int i = 0, m = n >>> 6; i < d; i++, m >>>= 6) {  set[i] = new long[m + 1];  } }   public LST setRange(int r) {  for (int i = 0; i < set.length; i++, r = r + 63 >>> 6) {  for (int j = 0; j < r >>> 6; j++) {   set[i][j] = -1L;  }  if ((r & 63) != 0)   set[i][r >>> 6] |= (1L << r) - 1;  }  return this; }   public LST unsetRange(int r) {  if (r >= 0) {  for (int i = 0; i < set.length; i++, r = r + 63 >>> 6) {   for (int j = 0; j < r + 63 >>> 6; j++) {  set[i][j] = 0;   }   if ((r & 63) != 0)  set[i][r >>> 6] &= ~((1L << r) - 1);  }  }  return this; }  public LST set(int pos) {  if (pos >= 0 && pos < n) {  for (int i = 0; i < set.length; i++, pos >>>= 6) {   set[i][pos >>> 6] |= 1L << pos;  }  }  return this; }  public LST unset(int pos) {  if (pos >= 0 && pos < n) {  for (int i = 0; i < set.length && (i == 0 || set[i - 1][pos] == 0L); i++, pos >>>= 6) {   set[i][pos >>> 6] &= ~(1L << pos);  }  }  return this; }  public boolean get(int pos) {  return pos >= 0 && pos < n && set[0][pos >>> 6] << ~pos < 0; }  public LST toggle(int pos) {  return get(pos) ? unset(pos) : set(pos); }  public int prev(int pos) {  for (int i = 0; i < set.length && pos >= 0; i++, pos >>>= 6, pos--) {  int pre = prev(set[i][pos >>> 6], pos & 63);  if (pre != -1) {   pos = pos >>> 6 << 6 | pre;   while (i > 0)  pos = pos << 6 | 63 - Long.numberOfLeadingZeros(set[--i][pos]);   return pos;  }  }  return -1; }  public int next(int pos) {  for (int i = 0; i < set.length && pos >>> 6 < set[i].length; i++, pos >>>= 6, pos++) {  int nex = next(set[i][pos >>> 6], pos & 63);  if (nex != -1) {   pos = pos >>> 6 << 6 | nex;   while (i > 0)  pos = pos << 6 | Long.numberOfTrailingZeros(set[--i][pos]);   return pos;  }  }  return -1; }  private static int prev(long set, int n) {  long h = set << ~n;  if (h == 0L)  return -1;  return -Long.numberOfLeadingZeros(h) + n; }  private static int next(long set, int n) {  long h = set >>> n;  if (h == 0L)  return -1;  return Long.numberOfTrailingZeros(h) + n; }  @Override public String toString() {  List<Integer> list = new ArrayList<Integer>();  for (int pos = next(0); pos != -1; pos = next(pos + 1)) {  list.add(pos);  }  return list.toString(); }  } }
4	public class FireAgain {  static int dx[] = { 0, 0, 1, -1 };  static int dy[] = { 1, -1, 0, 0 };  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(new File("input.txt"));   BufferedWriter write = new BufferedWriter(new FileWriter("output.txt"));   int n = sc.nextInt();   int m = sc.nextInt();   boolean[][] v = new boolean[n][m];   int k = sc.nextInt();   Queue<Integer> q = new LinkedList<Integer>();   for (int i = 0; i < k; i++) {    int x = sc.nextInt() - 1;    int y = sc.nextInt() - 1;    q.add(x);    q.add(y);    v[x][y] = true;   }   int lastx = 0;   int lasty = 0;   while (!q.isEmpty()) {    lastx = q.poll();    lasty = q.poll();    for (int i = 0; i < 4; i++) {     int r = lastx + dx[i];     int c = lasty + dy[i];     if (r >= 0 && c >= 0 && r < n && c < m && !v[r][c]) {      v[r][c] = true;      q.add(r);      q.add(c);     }    }   }   write.write((lastx + 1) + " " + (lasty + 1));   write.close();  } }
5	public class A { static class T {  public int s,p; } public static void main(String args[]) throws Exception {  InputReader sc=new InputReader(System.in);  int n=sc.readInt(),k=sc.readInt(),i,j,z;  T m[]=new T[n];  for(i=0;i<n;i++) {m[i]=new T();m[i].s=sc.readInt();m[i].p=sc.readInt();}  for(i=0;i<n;i++) for(j=i+1;j<n;j++) if(m[i].s<m[j].s){z=m[i].s;m[i].s=m[j].s;m[j].s=z;z=m[i].p;m[i].p=m[j].p;m[j].p=z;}  for(i=0;i<n;i++) for(j=i+1;j<n;j++) if(m[i].s==m[j].s&&m[i].p>m[j].p){z=m[i].s;m[i].s=m[j].s;m[j].s=z;z=m[i].p;m[i].p=m[j].p;m[j].p=z;}  k--;int s=m[k].s,p=m[k].p,res=0;  for(i=0;i<n;i++){if(m[i].s==s&&m[i].p==p)res++;}  System.out.println(res); } } 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 = 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) {  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 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(); } }
1	public class Main implements Runnable { BufferedReader in; PrintStream out;  StringTokenizer st = new StringTokenizer(""); static boolean local = false;  public static void main(String [] args) throws Exception {  if (args.length > 0) local = true;  new Thread(new Main()).start(); }  void printExit(String s) {  out.println(s);  System.exit(0); }  public void run() {  try {  Locale.setDefault(Locale.US);  in = local ? new BufferedReader(new FileReader("input.txt")) : new BufferedReader(new InputStreamReader(System.in));  out = local ? new PrintStream(new File("output.txt")) : new PrintStream(System.out);  int n = nextInt();  char [] c = in.readLine().toCharArray();  int t = 0;  for (int i = 0; i < n; i++)   if (c[i] == 'T') t++;   int ans = n;  for (int i = 0; i < n; i++) {   int cnt = 0;   for (int j = 0; j < t; j++)   if (c[(i + j) % n] == 'H')    cnt++;   ans = min(ans, cnt);  }   out.println(ans);  }  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();  } }
2	public class Main {  static class FastScanner {   private BufferedReader bufferedReader;   private StringTokenizer stringTokenizer;   public FastScanner(InputStream inputStream) {    bufferedReader = new BufferedReader(new InputStreamReader(inputStream));   }   public String next() {    while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {     try {      stringTokenizer = new StringTokenizer(bufferedReader.readLine());     } catch (IOException ignored) {     }    }    return stringTokenizer.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }  }  static class Node implements Comparable {   Node left;   Node right;   private int value;   Node(Node left, Node right, int value) {    this.left = left;    this.right = right;    this.value = value;   }   @Override   public int compareTo(Object o) {    return Integer.compare(this.value, ((Node) o).value);   }  }  private static int fib(int n, int m) {   if (n < 2) return n;   int a = 0;   int b = 1;   for (int i = 0; i < n - 2; i++) {    int c = (a + b) % m;    a = b;    b = c;   }   return (a + b) % m;  }  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 Math.abs(a * b) / gcd(a, b);  }  static class DSU {   private int[] p;   private int[] r;   DSU(int n) {    p = new int[n];    r = new int[n];    Arrays.fill(p, -1);    Arrays.fill(r, 0);   }   int find(int x) {    if (p[x] < 0) {     return x;    }    return p[x] = find(p[x]);   }   void union(int a, int b) {    a = find(a);    b = find(b);    if (a == b) return;    if (r[a] < r[b]) {     p[a] = b;    } else {     p[b] = a;    }    if (r[a] == r[b]) {     r[a]++;    }   }  }  private static boolean isPrime(long n) {   for (int i = 2; i < n; i++) {    if (n % i == 0) return false;   }   return true;  }  private static double med(Integer[] a) {   Arrays.sort(a);   if (a.length % 2 == 0) {    int r = a.length / 2;    int l = r - 1;    double s = a[l] + a[r];    return s / 2.0;   }   int m = a.length / 2;   return a[m];  }  static Map<Integer, ArrayList<Integer>> g;  static Map<Integer, Integer> color;  static void dfs(int v, int c) {   color.put(v, c);   for (int i = 0; i < g.get(v).size(); i++) {    int u = g.get(v).get(i);    if (!color.containsKey(u)) {     dfs(u, c);    }   }  }  static void reverse(Integer[] a) {   Collections.reverse(Arrays.asList(a));  }  static boolean next(Integer[] a) {   int i = a.length - 1;   while (a[i] == 0) i--;   int c = 0;   while (i >= 0 && a[i] == 1) {    c++;    i--;   }   if (i < 0) return false;   a[i] = 1;   for (int j = i + 1; j < a.length; j++) {    a[j] = 0;   }   c--;   for (int j = 0; j < c; j++) {    a[a.length - 1 - j] = 1;   }   return true;  }  private static int bin(Integer[] a, int l, int r, int x) {   if (l >= r) return l;   int m = (l + r) / 2;   if (a[m] > x) {    return bin(a, l, m, x);   } else if (a[m] < x || (m < a.length - 1 && a[m + 1] == x)) {    return bin(a, m + 1, r, x);   }   return m + 1;  }  private static class SegmentTree {   private long[] d;   private long[] a;   SegmentTree(int n) {    a = new long[n];    d = new long[5 * n];   }   void update(int v, int l, int r, int pos, long val) {    if (l == r) {     d[v] += val;     a[l] += val;    } else {     int mid = (l + r) / 2;     if (pos <= mid) {      update(v * 2, l, mid, pos, val);     } else {      update(v * 2 + 1, mid + 1, r, pos, val);     }     d[v] = d[v * 2] + d[v * 2 + 1];    }   }   int find(int v, int l, int r, long w) {    if (v >= d.length) return -1;    int mid = (l + r) / 2;    if (d[v] <= w) return r;    long o = w - d[v * 2];    if (mid + 1 < a.length && o >= a[mid + 1]) {     return find(v * 2 + 1, mid + 1, r, o);    }    if (w >= a[l])     return find(v * 2, l, mid, w);    return -1;   }   int iterFind(long w) {    if (a[0] > w) return -1;    int l = 0, r = a.length - 1;    int v = 1;    while (d[v] > w) {     int mid = (l + r) / 2;     long o = w - d[v * 2];     if (mid + 1 < a.length && o >= a[mid + 1]) {      l = mid + 1;      v = v * 2 + 1;      w = o;     } else {      v = v * 2;      r = mid;     }    }    return r;   }   int get(int v, int vl, int vr, long w) {       if (d[v] < w) return -1;    if (vl > vr) return -1;    if (vl == vr) {     if (d[v] > w) return vl - 1;     else return -1;    }    if (d[v * 2] > w) return get(v * 2, vl, (vl + vr) / 2, w);    else return get(v * 2 + 1, (vl + vr + 2) / 2, vr, w - d[v * 2]);   }  }  private static class FenwickTree {   long[] t;   FenwickTree(int n) {    t = new long[n];   }   long sum(int r) {    long result = 0;    for (; r >= 0; r = (r & (r + 1)) - 1)     result += t[r];    return result;   }   void inc(int i, long delta) {    int n = t.length;    for (; i < n; i = (i | (i + 1)))     t[i] += delta;   }  }  void insert(List<Long> list, Long element) {   int index = Collections.binarySearch(list, element);   if (index < 0) {    index = -index - 1;   }   list.add(index, element);  }  public static void main(String[] args) {   FastScanner scanner = new FastScanner(System.in);   PrintWriter printer = new PrintWriter(System.out);   long n = scanner.nextLong();   long k = scanner.nextLong();   long l = 1;   long r = n;   while(true){    long m = (l + r) / 2;    long x = (m * (m + 1)) / 2;    x -= n - m;    if (x == k) {     printer.println(n - m);     break;    } else if (x < k) {     l = m + 1;    } else {     r = m - 1;    }   }   printer.flush();   printer.close();  } }
5	public class Main {  StreamTokenizer in;  PrintWriter out;  static public 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 n = ni(), t = ni();   if(n == 0) {    out.println(0); out.flush(); return;   }   House[] h = new House[n];   for(int i = 0; i < n; i++) {    h[i] = new House();    h[i].x = ni(); h[i].a = ni();   }   Arrays.sort(h);   int ret = 2;   for(int i = 0; i < n - 1; i++) {    if(2*(h[i + 1].x - h[i].x) - h[i].a - h[i + 1].a > 2*t) ret+=2;    else if(2*(h[i + 1].x - h[i].x) - h[i].a - h[i + 1].a == 2*t) ret++;   }   out.println(ret);   out.flush();  }  void run1() throws IOException {    in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));    out = new PrintWriter(new OutputStreamWriter(System.out));    int t = ni();    long n = ni(), m = ni();    long x1 = ni(), y1 = ni(), x2 = ni(), y2 = ni();   long tx1 = Math.min(x1, x2), tx2 = x1 + x2 - tx1;   long ty1 = Math.min(y1, y2), ty2 = y1 + y2 - ty1;   long dx = tx2 - tx1;   long dy = ty2 - ty1;    }  class House implements Comparable<House> {   int x, a;   public int compareTo(House h) {    return x < h.x ? -1 : 1;   }  } }
4	public class Main{   private static int[] T;   public static void main(String[] args){     Scanner in = new Scanner(System.in);   char[] input = in.nextLine().toCharArray();   int length = input.length;   int max = 0;   for(int i=0; i<length; i++){    char[] subString = Arrays.copyOfRange(input, 1, input.length);    int temp = solve(input, subString);    if(temp > max) max = temp;    input = Arrays.copyOfRange(input, 1, input.length);   }   System.out.println(max);    }  private static int solve(char[] P, char[] S) {     T = new int[P.length+1];     preKmp(P, P.length, T);   int max = 0;   int i = 0, j = 0;   while (j < S.length) {    while (i > -1 && (P[i] != S[j]))     i = T[i];    i++;    j++;    if ( i > max) max = i;    if (i >= P.length) {     i = T[i];    }   }     return max;       }  private static void preKmp(char[] x, int m, int[] kmpNext) {    int i = 0, j = kmpNext[0] = -1;       while (i < m-1) {    while (j > -1 && x[i] != x[j])     j = kmpNext[j];    i++;    j++;    if (x[i] == x[j])     kmpNext[i] = kmpNext[j];    else     kmpNext[i] = j;    }     } }
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();  } }
6	public class SimpleTask {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int m = scan.nextInt();  boolean[][] graph = new boolean[n][n];  for (int i = 0; i < m; i++) {  int u = scan.nextInt() - 1;  int v = scan.nextInt() - 1;  graph[u][v] = true;  graph[v][u] = true;  }  long[][] dp = new long[1 << n][n];  for (int i = 0; i < n; i++)  dp[1 << i][i] = 1;  for (int mask = 1; mask < (1 << n); mask++) {   int first = Integer.numberOfTrailingZeros(mask);   for (int i = 0; i < n; i++) {   if ((mask & (1 << i)) == 0 || first == i)   continue;   for (int j = 0; j < n; j++) {   if (graph[i][j])    dp[mask][i] += dp[mask ^ 1 << i][j];   }   }  }  long answer = 0;  for (int mask = 1; mask < (1 << n); mask++) {  if (Integer.bitCount(mask) < 3)   continue;   int first = Integer.numberOfTrailingZeros(mask);  for (int i = 0; i < n; i++) {   if (graph[first][i])   answer += dp[mask][i];  }  }  System.out.println(answer / 2);  scan.close(); } }
3	public class _909C {  private static final int MOD = 1000000007;  private static void solve(Scanner scan, PrintWriter pw) {   int n = scan.nextInt();   scan.nextLine();      int[][] dp = new int[n][n];   int[][] dpSums = new int[n][n];   dp[0][0] = 1;   for(int i = 0; i < n; i++) {    dpSums[0][i] = 1;   }   boolean lastIsSimple = scan.nextLine().equals("s");   for(int i = 1; i < n; i++) {    if(lastIsSimple) {     dp[i][0] = dpSums[i-1][n-1];     dpSums[i][0] = dp[i][0];     for(int j = 1; j < n; j++) {      dp[i][j] = (dpSums[i-1][n-1] - dpSums[i-1][j-1] + MOD) % MOD;      dpSums[i][j] = (dp[i][j] + dpSums[i][j-1]) % MOD;     }    }    else {     dp[i][0] = 0;     dpSums[i][0] = 0;     for(int j = 1; j < n; j++) {      dp[i][j] = dp[i-1][j-1];      dpSums[i][j] = (dp[i][j] + dpSums[i][j-1]) % MOD;     }    }    lastIsSimple = scan.nextLine().equals("s");   }   System.out.println(dpSums[n-1][n-1]);  }  public static void main(String[] args) {   Scanner scan = new Scanner(new BufferedInputStream(System.in, 1024 * 64));   PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out, 1024 * 64));   solve(scan, pw);   pw.flush();  } }
1	public class CF495A {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   int n = s.nextInt();   long d = s.nextLong();   long[] arr = new long[n];   for (int i = 0; i < n; i++) {    arr[i] = s.nextLong();   }   Arrays.sort(arr);   long ans = 2;   for (int i = 0; i < n - 1; i++) {    if(arr[i + 1] - arr[i] > 2 * d){     ans += 2;    }else if(arr[i + 1] - arr[i] == 2 * d){     ans += 1;    }   }   System.out.println(ans);  } }
3	public class Main {  public static void main(String[] args) throws Exception {   Scanner sc = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int n = sc.nextInt();   Integer[] a = new Integer[n];   for (int i = 0; i < n; i++)    a[i] = sc.nextInt();   int ans = 0;   boolean[] taken = new boolean[n];   Arrays.sort(a);   for (int i = 0; i < n; i++) {    if (taken[i]) continue;    ans++;    for (int j = i; j < n; j++)     if (a[j] % a[i] == 0) taken[j] = true;   }   out.println(ans);   out.flush();   out.close();  }   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);   }  } }
0	public class Solver {  StringTokenizer st;  BufferedReader in;  PrintWriter out;  public static void main(String[] args) throws NumberFormatException, IOException {   Solver solver = new Solver();   solver.open();   solver.solve();   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();   out.println(0+" "+0+" "+n);  }  public void close() {   out.flush();   out.close();  } }
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(); } }
4	public class JavaApplication1 {    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){   String base = in.next();  for (int len=base.length()-1;len>=1;len--)    for (int i=0;i<base.length()-len+1;i++)     for (int j=i+1;j<base.length()-len+1;j++)      if (base.substring(i,i+len).equals(base.substring(j,j+len))){       out.println(len);    return;      }  out.println(0);   }  } 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 long nextLong(){   return Long.parseLong(next());  }  public double nextDouble(){   return Double.parseDouble(next());  } }
0	public class Main{ public static void main(String[]YAHIA_MOSTAFA){  Scanner sc =new Scanner(System.in);  long n=sc.nextLong(),x=sc.nextLong(),y=sc.nextLong();  long xb,xw,yb,yw;  xw=x-1;yw=y-1;xb=n-x;yb=n-y;  if (x==n&&y==n){  System.out.println("Black");return;  }  long c1=0,c2=0;  long f =Math.max(xb,yb);  long h =Math.max(xw,yw);   if (h<=f)  System.out.println("White");  else  System.out.println("Black"); } }
0	public class CodeForcesW8P2 {  public static void main(String [] args){   Scanner sc = new Scanner(System.in);   int tests = Integer.valueOf(sc.nextLine());    while(tests > 0){    int count = 0;    String [] input = sc.nextLine().split(" ");    int x = Integer.valueOf(input[0]);    int y = Integer.valueOf(input[1]);     if (x == y){     count += 1;    }    else {     if (x > y){      int temp = x;      x = y;      y = temp;     }         while (x != 1 && x != 0 && y != 1){      count += (y / x);      int temp = x;      x = (y % x);      y = temp;     }     if (x != 0)      count += y;     }     System.out.println(count);    tests --;   }  } }
4	public class B{ static int[][] hor; static int[][] ver; static int n; static int m; static int k; static long[][][] dp;  static long dist(int row, int col) {  if(k%2==1)return Integer.MAX_VALUE;  return 2*make(row,col,k/2); }  static long make(int row, int col, int moves) {  if(moves == 0)  {  return 0;  }   if(dp[row][col][moves]!=-1)return dp[row][col][moves];   long ans = Long.MAX_VALUE;   if(col-1>=0)  {  ans = Math.min(ans, hor[row][col-1]+make(row,col-1,moves-1));  }  if(col+1<m)  {  ans = Math.min(ans, hor[row][col]+make(row,col+1,moves-1));  }  if(row-1>=0)  {  ans = Math.min(ans, ver[row-1][col]+make(row-1,col,moves-1));  }  if(row+1<n)  {  ans = Math.min(ans, ver[row][col]+make(row+1,col,moves-1));  }  dp[row][col][moves] = ans;  return ans; }  public static void main(String[] args) {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  n = fs.nextInt(); m = fs.nextInt(); k = fs.nextInt();  hor = new int[n][m]; ver = new int[n][m];  dp = new long[505][505][24];  for(int i=0;i<505;i++)for(int j=0;j<505;j++)for(int k=0;k<24;k++)dp[i][j][k] = -1;  for(int i=0;i<n;i++)  {  for(int j=0;j<m-1;j++)  {   int a = fs.nextInt();   hor[i][j] = a;  }  }   for(int row=0;row<n-1;row++)  {  for(int col =0;col<m;col++)  {   int a = fs.nextInt();   ver[row][col] = a;  }  }    for(int row=0;row<n;row++)  {  for(int col=0;col<m;col++)  {   long d = dist(row,col);   if(d<Integer.MAX_VALUE)   {   out.print(d+" ");   }   else out.print("-1 ");  }  out.println();  }  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; } }
1	public class Main {  public static void main(String args[]) {   Scanner scan = new Scanner(System.in);   int n=scan.nextInt();   int m=scan.nextInt();   int[] game=new int[n];   int[] bill=new int[m];   for (int i = 0; i <n ; i++) {    game[i]=scan.nextInt();   }   for (int i = 0; i <m ; i++) {    bill[i]=scan.nextInt();   }   int i=0;   int j=0;   int ans=0;   while (i<m){    boolean f=true;    for (int k = j; k <n ; k++) {     if (bill[i]>=game[k]){      ans++;      i++;      j=k+1;      f=false;      break;     }    }    if (f){     break;    }   }   System.out.println(ans);  } }
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(); } }
1	public class Main {  public static void main(String[] args) {   Scanner reader = new Scanner(System.in);   int n = reader.nextInt();   long d = reader.nextLong();   int[] a = new int[n];   for(int i = 0; i < n; i++)    a[i] = reader.nextInt();   Arrays.sort(a);   int ans = 2;   for(int i = 0; i < n - 1; i++){    if(a[i + 1] - a[i] > 2 * d) {     ans += 2;    }    else if(a[i + 1] - a[i] == 2 * d)     ans++;   }   System.out.println(ans);  } }
1	public class B { static final int[] num = new int[7]; static {  for(int i = 1, c = 1; i <= 6; i++, c *= 26)  num[i] = num[i-1] + c; } public void run() {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  while(n-- > 0) {  String s = sc.next();  System.out.println(s.matches("R[0-9]+C[0-9]+") ? toABdd(s) : toRC(s));  } }  String toRC(String s) {  String ss = s.split("[0-9]+")[0];  String sn = s.split("[A-Z]+")[1];  int r = 0;  for(char c : ss.toCharArray())  r = r * 26 + c - 'A';  r += num[ss.length()];  int c = Integer.parseInt(sn);  return "R" + c + "C" + r; }  String toABdd(String s) {  String[] ss = s.split("[RC]");  int c = Integer.parseInt(ss[1]);  int r = Integer.parseInt(ss[2]);  int a = 0;  while(r > num[++a]);  a--;  r -= num[a];  char[] cs = new char[a];  for(int i = 0; i < a; i++, r /= 26)  cs[a-i-1] = (char) (r % 26 + 'A');  return new String(cs) + c; }  void debug(Object... os) {  System.err.println(Arrays.deepToString(os)); }  public static void main(String...args) {  new B().run(); } }
6	public class Main {  static FastScanner fs=new FastScanner();  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();   }   int Int() {    return Integer.parseInt(next());   }   long Long() {    return Long.parseLong(next());   }   String Str(){    return next();   }  }   public static void main (String[] args) throws java.lang.Exception {   PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   int T=1;   for(int t=0;t<T;t++){    int n=Int();    int k=Int();    int A[][]=new int[n][2];    int a=0,b=0,c=0;    for(int i=0;i<A.length;i++){     A[i][0]=Int();     A[i][1]=Int()-1;     if(A[i][1]==0)a++;     else if(A[i][1]==1)b++;     else c++;    }    Arrays.sort(A,(x,y)->{     return x[0]-y[0];    });     Solution sol=new Solution(out);    sol.solution(A,k,a,b,c);   }   out.close();  }   public static int Int(){   return fs.Int();  }  public static long Long(){   return fs.Long();  }  public static String Str(){   return fs.Str();  } }    class Solution{  PrintWriter out;  public Solution(PrintWriter out){   this.out=out;  }   int mod=1000000007;  long dp3[][][][];  public void solution(int A[][],int T,int x,int y,int z){   long res=0;   int n=A.length;   long dp1[][]=new long[x+2][T+1];   long dp2[][][]=new long[y+2][z+2][T+2];   dp3=new long[x+2][y+2][z+2][3];      long f[]=new long[n+10];   f[0]=f[1]=1;   for(int i=2;i<f.length;i++){    f[i]=f[i-1]*i;    f[i]%=mod;   }   for(int i=0;i<dp3.length;i++){    for(int j=0;j<dp3[0].length;j++){     for(int k=0;k<dp3[0][0].length;k++){      Arrays.fill(dp3[i][j][k],-1);     }    }   }    dp1[0][0]=1;   for(int i=0;i<A.length;i++){    int p=A[i][0],type=A[i][1];    if(type==0){     long newdp[][]=new long[dp1.length][dp1[0].length];     for(int cnt=1;cnt<=x;cnt++){      for(int j=1;j<dp1[0].length;j++){       if(j>=p){        newdp[cnt][j]+=dp1[cnt-1][j-p];        newdp[cnt][j]%=mod;       }      }     }     for(int cnt=0;cnt<=x;cnt++){      for(int j=0;j<dp1[0].length;j++){       newdp[cnt][j]+=dp1[cnt][j];       newdp[cnt][j]%=mod;      }     }     dp1=newdp;    }   }     dp2[0][0][0]=1;   for(int i=0;i<A.length;i++){    int p=A[i][0],type=A[i][1];    if(type!=0){     long newdp[][][]=new long[dp2.length][dp2[0].length][dp2[0][0].length];     for(int a=0;a<dp2.length;a++){      for(int b=0;b<dp2[0].length;b++){       for(int j=0;j<dp2[0][0].length;j++){        if(j>=p){         if(type==1){          if(a-1>=0){           newdp[a][b][j]+=dp2[a-1][b][j-p];          }         }         else{          if(b-1>=0) {           newdp[a][b][j]+=dp2[a][b-1][j-p];          }         }        }        newdp[a][b][j]%=mod;       }      }     }     for(int a=0;a<dp2.length;a++){      for(int b=0;b<dp2[0].length;b++){       for(int j=0;j<dp2[0][0].length;j++){        newdp[a][b][j]+=dp2[a][b][j];        newdp[a][b][j]%=mod;       }      }     }     dp2=newdp;    }   }    dp3[1][0][0][0]=1;   dp3[0][1][0][1]=1;   dp3[0][0][1][2]=1;   for(int i=0;i<dp3.length;i++){    for(int j=0;j<dp3[0].length;j++){     for(int k=0;k<dp3[0][0].length;k++){      for(x=0;x<dp3[0][0][0].length;x++){       if(dp3[i][j][k][x]==-1){        dfs(i,j,k,x);       }      }     }    }   }      for(int i=0;i<dp3.length;i++){    for(int j=0;j<dp3[0].length;j++){     for(int k=0;k<dp3[0][0].length;k++){      for(int cur=0;cur<3;cur++){       for(int t=0;t<=T;t++){        int aprice=t;        int bcprice=T-t;        long cnt1=dp1[i][aprice];        long cnt2=dp2[j][k][bcprice];        long combination=dp3[i][j][k][cur];               long p1=(cnt1*f[i])%mod;        long p2=(((f[j]*f[k])%mod)*cnt2)%mod;        long p3=(p1*p2)%mod;        res+=(p3*combination)%mod;        res%=mod;       }      }     }    }   }                out.println(res);  }  public long dfs(int a,int b,int c,int cur){   if(a<0||b<0||c<0){    return 0;   }   if(a==0&&b==0&&c==0){    return 0;   }   if(dp3[a][b][c][cur]!=-1)return dp3[a][b][c][cur];   long res=0;   if(cur==0){    res+=dfs(a-1,b,c,1);    res%=mod;    res+=dfs(a-1,b,c,2);    res%=mod;   }   else if(cur==1){    res+=dfs(a,b-1,c,0);    res%=mod;    res+=dfs(a,b-1,c,2);    res%=mod;   }   else{    res+=dfs(a,b,c-1,0);    res%=mod;    res+=dfs(a,b,c-1,1);    res%=mod;   }   res%=mod;   dp3[a][b][c][cur]=res;   return res;  } }
6	public class Main {  static int MOD = 1000000007;              void solve() throws IOException {   int[] nT = ril(2);   int n = nT[0];   int T = nT[1];   int[][] tg = new int[n][];   for (int i = 0; i < n; i++) tg[i] = ril(2);           int[][][] dp = new int[T+1][1 << n][3];   for (int ti = 1; ti <= T; ti++) {    for (int mask = 1; mask <= (1 << n); mask++) {              for (int j = 0; j < n; j++) {      if (((1 << j) & mask) == 0) continue;      int time = tg[j][0];      int genre = tg[j][1]-1;      if (ti - time < 0) continue;      long base = dp[ti][mask][genre];      long add = 0;      if (ti - time == 0) {                    add = 1;      } else {       for (int g = 0; g < 3; g++) add += dp[ti-time][mask ^ (1 << j)][g];       add -= dp[ti-time][mask ^ (1 << j)][genre];      }      dp[ti][mask][genre] = (int) ((base + add) % MOD);     }    }   }   long ans = 0;   for (int g = 0; g < 3; g++) ans += dp[T][(1 << n)-1][g];   pw.println(ans % MOD);  }       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);  } }
3	public final class py_indent {  static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static FastScanner sc=new FastScanner(br);  static PrintWriter out=new PrintWriter(System.out); static Random rnd=new Random(); static int maxn=(int)(5e3+5); static long mod=(long)(1e9+7);  static int add(long a,long b) {  long ret=(a+b);   if(ret>=mod)  {  ret%=mod;  }   return (int)ret; }   public static void main(String args[]) throws Exception  {  int n=sc.nextInt();char[] a=new char[n+1];a[0]='s';   for(int i=1;i<=n;i++)  {  a[i]=sc.next().charAt(0);  }   int[][] dp=new int[n+1][maxn],sum=new int[n+1][maxn];dp[0][0]=1;   sum[0][0]=1;   for(int i=1;i<maxn;i++)  {  sum[0][i]=add(sum[0][i],sum[0][i-1]);  }   for(int i=1;i<=n;i++)  {  if(a[i]=='f')  {   continue;  }    int curr=0,idx=0;    for(int j=i-1;j>=0;j--)  {   if(a[j]=='s')   {   idx=j;break;   }     else   {   curr++;   }  }    for(int j=0;j<maxn;j++)  {   int up=Math.max(0,j-curr);      long now=(sum[idx][maxn-1]-(up==0?0:sum[idx][up-1]));       now=add(now,mod);      dp[i][j]=add(dp[i][j],now);  }    sum[i][0]=dp[i][0];    for(int j=1;j<maxn;j++)  {   sum[i][j]=add(dp[i][j],sum[i][j-1]);  }  }      out.println(dp[n][0]);out.close();  } } class FastScanner {  BufferedReader in;  StringTokenizer st;  public FastScanner(BufferedReader in) {   this.in = in;  }   public String nextToken() throws Exception {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  public String next() throws Exception {  return nextToken().toString(); }   public int nextInt() throws Exception {   return Integer.parseInt(nextToken());  }  public long nextLong() throws Exception {   return Long.parseLong(nextToken());  }  public double nextDouble() throws Exception {   return Double.parseDouble(nextToken());  } }
5	public class Solution {  BufferedReader in;  PrintWriter out;  StringTokenizer st;  static class Pair implements Comparable<Pair> {   int x, a;   Pair(int x, int a) {    this.x = x;    this.a = a;   }   @Override   public int compareTo(Pair o) {       return 0;   }  }  boolean isCross(double l1, double r1, double l2, double r2) {   double r = min(r1, r2);   double l = max(l1, l2);   return r > l;  }  boolean check(double xl, double xr, double[] l, double[] r, int n) {   boolean ok = false;   for (int j = 0; j < n; ++j)    ok |= isCross(xl, xr, l[j], r[j]);   return ok;  }  void solve() throws IOException {   int n = ni();   double t = ni();   double[] l = new double[n];   double[] r = new double[n];   for (int i = 0; i < l.length; i++) {    double x = ni();    double len = ni();    l[i] = x - len / 2.0;    r[i] = x + len / 2.0;   }   HashSet<Double> set = new HashSet<Double>();   for (int i = 0; i < n; ++i) {    double xl = l[i] - t;    double xr = l[i];    boolean ok = check(xl, xr, l, r, n);    if (!ok)     set.add(xl);    xl = r[i];    xr = r[i] + t;    ok = check(xl, xr, l, r, n);    if (!ok)     set.add(xl);   }   out.println(set.size());  }  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();  } }
3	public class A { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni();  int[] a = na(n);  Arrays.sort(a);  boolean[] done = new boolean[n];  int ans = 0;  for(int i = 0;i < n;i++){  if(!done[i]){   ans++;   for(int j = i+1;j < n;j++){   if(a[j] % a[i] == 0){    done[j] = true;   }   }  }  }  out.println(ans); }  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]; 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 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));   }     }  }   } }
6	public class s11_d {  public static void main(String[] args) throws IOException {   new s11_d().run();  }  int nextInt() throws IOException {   in.nextToken();   return (int) in.nval;  }  String nextString() throws IOException {   in.nextToken();   return (String) in.sval;  }  StreamTokenizer in;  Writer writer;  Reader reader;  void run() throws IOException {   boolean oj = System.getProperty("ONLINE_JUDGE") != null;   reader = oj ? new InputStreamReader(System.in, "ISO-8859-1") : new FileReader("input/is11_d.txt");   writer = new OutputStreamWriter(System.out, "ISO-8859-1");   in = new StreamTokenizer(new BufferedReader(reader));   PrintWriter out = new PrintWriter(writer);   int n = nextInt();   int e = nextInt();   boolean[][] is = new boolean[n + 1][n + 1];   for (int i = 0; i < e;i++) {    int a = nextInt() - 1;    int b = nextInt() - 1;    is[a][b] = true;    is[b][a] = true;   }     long[] am = new long[n + 1];     long[][] ways = new long[1 << (n - 1)][n];     for (int start = 0; start < n; ++start) {      for (int mask = 0; mask < (1 << (n - start - 1)); ++mask)       for (int last = start; last < n; ++last) {        ways[mask][last - start] = 0;       }      ways[1 >> 1][0] = 1;      for (int mask = 1; mask < (1 << (n - start)); mask += 2) {       int cnt = 0;       int tmp = mask;       while (tmp > 0) {        ++cnt;        tmp = tmp & (tmp - 1);       }       for (int last = start; last < n; ++last)        if (ways[mask >> 1][last - start] > 0) {         long amm = ways[mask >> 1][last - start];         for (int i = start; i < n; ++i)          if ((mask & (1 << (i - start))) == 0 && is[last][i]) {           ways[(mask | (1 << (i - start))) >> 1][i - start] += amm;          }         if (is[last][start])          am[cnt] += ways[mask >> 1][last - start];        }      }     }     long res = 0;     for (int cnt = 3; cnt <= n; ++cnt) {      if (am[cnt] % (2) != 0)       throw new RuntimeException();      res += am[cnt] / (2);     }   out.println(res);   out.flush();   out.close();  } }
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();   }  } }
3	public class Loader {  private final static Scanner in = new Scanner(System.in);  public static void main(String[] args) {   int n = in.nextInt();   ArrayList<Integer> l = new ArrayList<>();   for (int i = 0; i < n; i++) {    l.add(in.nextInt());   }   Collections.sort(l);    int k = 0;   for (int i = 0; i < l.size(); i++) {    if (l.get(i) == 0) continue;    for (int j = i + 1; j < l.size(); j++) {     if (l.get(j) == 0) continue;     if (l.get(j) % l.get(i) == 0) {      l.set(j, 0);     }    }    l.set(i, 0);    k++;   }   System.out.println(k);  } }
4	public class P23A { public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  String input = scan.nextLine();  System.out.println(F(input)); }   static int F(String string){  int ans =0;  for (int i = 0; i < string.length(); i++) {  for (int j = 1; j < string.length()-i; j++) {   String s = string.substring(i, i+j);   int a=string.indexOf(s);   int b=string.lastIndexOf(s);   if ( a >= 0 && b >=0 && a !=b) ans =Math.max(ans, s.length());  }  }  return ans; } }
6	public class realfast implements Runnable {  private static final int INF = (int) 1e9;  int time[]= new int[15];  int g[]= new int [15];  public void solve() throws IOException  {  int n = readInt();  int t = readInt();    for(int i=0;i<n;i++)  {   time[i]=readInt();   g[i]=readInt();  }  long dp[][]= new long [(int)Math.pow(2,n)][4];  for(int i =0;i<(int)Math.pow(2,n);i++)  {  for(int j=0;j<=3;j++)   dp[i][j]=-1;   }  long val = cal(dp,0,0,0,t);  out.println(val);  }  public long cal(long dp[][], int mask , int genre , int t ,int T )  {  int val = dp.length;    if(t>T)   {   return 0;   }  if(t==T)  {   return 1;  }     if(dp[mask][genre]!=-1)   return dp[mask][genre];   dp[mask][genre]=0;   int i=1;   int count=0;   while(i<val)   {     if((i&mask)==0&&g[count]!=genre)   {    dp[mask][genre] = ((dp[mask][genre]%1000000007)+ cal(dp,mask|i,g[count],t+time[count],T)%1000000007)%1000000007;   }   i=2*i;   count++;   }   return dp[mask][genre];  }       public static void main(String[] args) {   new Thread(null, new realfast(), "", 128 * (1L << 20)).start();  }   private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  private BufferedReader reader;  private StringTokenizer tokenizer;  private PrintWriter out;   @Override  public void run() {   try {    if (ONLINE_JUDGE || !new File("input.txt").exists()) {     reader = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);    } else {     reader = new BufferedReader(new FileReader("input.txt"));     out = new PrintWriter("output.txt");    }    solve();   } catch (IOException e) {    throw new RuntimeException(e);   } finally {    try {     reader.close();    } catch (IOException e) {        }    out.close();   }  }   private String readString() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }   @SuppressWarnings("unused")  private int readInt() throws IOException {   return Integer.parseInt(readString());  }   @SuppressWarnings("unused")  private long readLong() throws IOException {   return Long.parseLong(readString());  }   @SuppressWarnings("unused")  private double readDouble() throws IOException {   return Double.parseDouble(readString());  } } class edge implements Comparable<edge>{  int u ;  int v ;  int val;  edge(int u1, int v1 , int val1)  {   this.u=u1;   this.v=v1;   this.val=val1;  }  public int compareTo(edge e)  {   return this.val-e.val;  } }
3	public class wef { public static class FastReader { BufferedReader br; StringTokenizer st;    public FastReader() {  br = new BufferedReader(new InputStreamReader(System.in)); }  String next() {  while (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(br.readLine());  } catch (Exception r) {   r.printStackTrace();  }  }  return st.nextToken(); }  int nextInt() {  return Integer.parseInt(next()); }  double nextDouble() {  return Double.parseDouble(next()); }  long nextLong() {  return Long.parseLong(next()); }  String nextLine() {  String str = "";  try {  str = br.readLine();  } catch (Exception r) {  r.printStackTrace();  }  return str; } } static ArrayList<String>list1=new ArrayList<String>(); static void combine(String instr, StringBuffer outstr, int index,int k) { if(outstr.length()==k) {  list1.add(outstr.toString());return; } if(outstr.toString().length()==0) outstr.append(instr.charAt(index));  for (int i = 0; i < instr.length(); i++)  {   outstr.append(instr.charAt(i));     combine(instr, outstr, i + 1,k);   outstr.deleteCharAt(outstr.length() - 1);  }  index++; } static ArrayList<ArrayList<Integer>>l=new ArrayList<>(); static void comb(int n,int k,int ind,ArrayList<Integer>list) { if(k==0) {  l.add(new ArrayList<>(list));  return; }   for(int i=ind;i<=n;i++) {  list.add(i);  comb(n,k-1,ind+1,list);   list.remove(list.size()-1);   }      } static long sum(long n) { long sum=0; while(n!=0) {  sum+=n%10;  n/=10; } return sum; }  static boolean check(HashMap<Integer,Integer>map) { for(int h:map.values())  if(h>1)  return false; return true; } static class Pair implements Comparable<Pair>{  int x;int y;  Pair(int x,int y){   this.x=x;   this.y=y;    } @Override public int compareTo(Pair o) {   return x-o.x;   } } 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 long gcd(long a, long b) {  if (b == 0)  return a;  return gcd(b, a % b); }  public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));  public static void main(String[] args) {   FastReader in=new FastReader(); HashMap<Integer,Integer>map=new HashMap<Integer,Integer>(); ArrayList<Integer>list=new ArrayList<Integer>(); TreeSet<Integer>set=new TreeSet<Integer>();  int n=in.nextInt(); for(int i=0;i<n;i++)  set.add(in.nextInt());  int ans=0;  while(!set.isEmpty()) {  int f=set.first();  int s=f;  while(!set.isEmpty()&&s<=set.last())  {  if(set.contains(s))  set.remove(new Integer(s));  s+=f;  }  ans++;   } out.println(ans);  out.close();     } }
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);   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();    long[] a = in.nextLongArray(n);    HashMap<Integer, Integer> count = new HashMap<>();    BigInteger res = BigInteger.ZERO;    long prev = 0;    count.put((int) a[0], 1);    long temp;    long nextRes;    for (int i = 1; i < n; i++) {     temp = ((a[i] - a[i - 1]) * i + prev);     nextRes = temp - count.getOrDefault((int) a[i] - 1, 0) + count.getOrDefault((int) a[i] + 1, 0);     res = res.add(new BigInteger(String.valueOf(nextRes)));     count.put((int) a[i], count.getOrDefault((int) a[i], 0) + 1);     prev = temp;    }    out.print(res);   }  }  static class InputReader {   private final BufferedReader reader;   private StringTokenizer tokenizer;   public InputReader(InputStream in) {    reader = new BufferedReader(new InputStreamReader(in));   }   public long[] nextLongArray(int size) {    long[] array = new long[size];    for (int i = 0; i < size; ++i) {     array[i] = nextLong();    }    return array;   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(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;   }  } }
0	public class A_Lucky_Division { public static void main(String[] args){  Scanner input=new Scanner(System.in);  int number=input.nextInt();  int flag=0;  if(number%4==0)flag=1;  else if(number%7==0)flag=1;  else if(number%47==0)flag=1;  else if(number%74==0)flag=1;  else if(number%444==0)flag=1;  else if(number%447==0)flag=1;  else if(number%474==0)flag=1;  else if(number%477==0)flag=1;  else if(number%744==0)flag=1;  else if(number%747==0)flag=1;  else if(number%774==0)flag=1;  else if(number%777==0)flag=1;  if(flag==1)System.out.println("YES");  else System.out.println("NO");   } }
6	public class f {  static int n, m; static int start; static int[][] memo; static int[][] arr; static int[][] costs; static int[][] wrapCosts;  public static void main(String[] args) throws IOException {  FastScanner in = new FastScanner(System.in);  PrintWriter out = new PrintWriter(System.out);   n = in.nextInt();  m = in.nextInt();  arr = new int[n][m];  costs = new int[n][n];  wrapCosts = new int[n][n];  for (int r = 0; r < n; r++) {  for (int c = 0; c < m; c++) {   arr[r][c] = in.nextInt();  }  }  for (int i = 0; i < n; i++) {  for (int j = i + 1; j < n; j++) {   costs[i][j] = Integer.MAX_VALUE;   for (int c = 0; c < m; c++) {   costs[i][j] = Math.min(costs[i][j], Math.abs(arr[i][c] - arr[j][c]));   }   costs[j][i] = costs[i][j];  }  }  for (int i = 0; i < n; i++) {  for (int j = 0; j < n; j++) {   wrapCosts[i][j] = Integer.MAX_VALUE;   for (int c = 0; c < m - 1; c++) {   wrapCosts[i][j] = Math.min(wrapCosts[i][j], Math.abs(arr[i][c + 1] - arr[j][c]));   }  }  }  memo = new int[n][1 << n];  long best = 0;  for (start = 0; start < n; start++) {  for (int[] a : memo) Arrays.fill(a, -1);  best = Math.max(best, go(start, (1 << n) - 1 - (1 << start)));  }  out.println(best);  out.close(); } static int go(int cur, int mask) {  if (mask == 0) {  return wrapCosts[start][cur];  }  if (memo[cur][mask] != -1) return memo[cur][mask];  int ans = 0;  for (int next = 0; next < n; next++) {  int bit = 1 << next;  if ((mask & bit) == 0) continue;  ans = Math.max(ans, Math.min(costs[cur][next], go(next, mask ^ bit)));  }  return memo[cur][mask] = ans; }   static class FastScanner {  BufferedReader br;  StringTokenizer st;    public FastScanner(InputStream i) {   br = new BufferedReader(new InputStreamReader(i));   st = new StringTokenizer("");  }     public String next() throws IOException {   if(st.hasMoreTokens())    return st.nextToken();   else    st = new StringTokenizer(br.readLine());   return next();  }   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 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");    } }
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();  arr=new String[n];  for(int i=0;i<n;i++)  arr[i]=ns();  dp=new long[n+1][n+1];  dp[0][0]=1;  for(int i=0;i<n;i++)  {  long next[]=new long[n+1];  for(int j=0;j<=i;j++)  {   if(arr[i].charAt(0)=='s')   {   next[0]+=dp[i][j];   next[j+1]-=dp[i][j];   }else {   next[j+1]+=dp[i][j];   next[j+2]-=dp[i][j];   }  }  long count=0;  for(int j=0;j<n;j++)  {   count+=next[j];   count=(count+mod)%mod;   dp[i+1][j]=count;  }  }  long ans=0;  for(int i=0;i<n;i++)  {  ans+=dp[n-1][i];  ans%=mod;  }  out.print(ans); } long rec(int index,int level) {  if(index>=arr.length-1)  return 1;  if(dp[index][level]!=-1)  return dp[index][level];  dp[index][level]=0;  if(arr[index].charAt(0)=='s')  {  dp[index][level]+=rec(index+1,level);  dp[index][level]%=mod;  if(level>0)  {   dp[index][level]+=rec(index+1,0);   dp[index][level]%=mod;  }  }  else {  dp[index][level]+=rec(index+1,level+1);  dp[index][level]%=mod;  }  return dp[index][level]; } double a[],b[],p; 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();  }  }  }
3	public class Solution {  static final int INF = (int) 1e9;  static final int mod = (int) (1e9 + 7);  static final short UNCALC = -1;   public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int n = sc.nextInt();   int[] a = sc.nextIntArray(n);   long[] cum = new long[n];   cum[0] = a[0];   for (int i = 1; i < n; i++)    cum[i] = a[i] + cum[i - 1];   HashMap<Long, ArrayList<Pair>> hm = new HashMap<>();   for (int i = 0; i < n; i++) {    for (int j = i; j < n; j++) {     long cur = get(cum, i, j);     if (!hm.containsKey(cur)) hm.put(cur, new ArrayList<>());     hm.get(cur).add(new Pair(i, j));    }   }   int max = 0;   StringBuilder ans = new StringBuilder();   for (long sum : hm.keySet()) {    ArrayList<Pair> cur = hm.get(sum);    Collections.sort(cur);    int poss = 0;    int r = -1;    StringBuilder sb = new StringBuilder();    for (int i = 0; i < cur.size(); i++) {     if (cur.get(i).left > r) {      poss++;      r = cur.get(i).right;      sb.append(cur.get(i));     }    }    if (poss> max){     max = poss;     ans = sb;    }   }   out.println(max);   out.println(ans);   out.flush();   out.close();  }  static long get(long[] a, int i, int j) {   return a[j] - (i > 0 ? a[i - 1] : 0);  }  static class Pair implements Comparable<Pair> {   int left, right;   public Pair(int left, int right) {    this.left = left;    this.right = right;   }   @Override   public int compareTo(Pair o) {    return right - o.right;   }   @Override   public String toString() {    return (left + 1) + " " + (right + 1) + "\n";   }  }  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);   }   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 double[] nextDoubleArray(int n) throws IOException {    double[] ans = new double[n];    for (int i = 0; i < n; i++)     ans[i] = nextDouble();    return ans;   }   public short nextShort() throws IOException {    return Short.parseShort(next());   }  } }
2	public class B {  final int INF = 1_000_000_000;  void solve() {   int n = readInt();   int k = readInt();   long l = 0;   long r = INF;   while(r - l > 1){    long m = (r + l) >> 1;    if(m * (m + 1) / 2 + m >= k + n) r = m;    else l = m;   }   out.print(n - r);  }  public static void main(String[] args) {   new B().run();  }  private void run() {   try {    init();    solve();    out.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(-1);   }  }  private BufferedReader in;  private StringTokenizer tok = new StringTokenizer("");  private PrintWriter out;  private void init() {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);     }  private String readLine() {   try {    return in.readLine();   } catch (IOException e) {    throw new RuntimeException(e);   }  }  private String readString() {   while (!tok.hasMoreTokens()) {    String nextLine = readLine();    if (nextLine == null) return null;    tok = new StringTokenizer(nextLine);   }   return tok.nextToken();  }  private int readInt() {   return Integer.parseInt(readString());  }  private long readLong() {   return Long.parseLong(readString());  }  int[] readIntArray(int n){   int[] res = new int[n];   for(int i = 0;i<n;i++){    res[i] = readInt();   }   return res;  }  long[] readLongArray(int n){   long[] res = new long[n];   for(int i = 0;i<n;i++){    res[i] = readLong();   }   return res;  }  int[] castInt(List<Integer> list){   int[] res = new int[list.size()];   for(int i = 0;i<list.size();i++){    res[i] = list.get(i);   }   return res;  } }
2	public class Main {  public static void main(String[] args) throws FileNotFoundException {   ConsoleIO io = new ConsoleIO(new InputStreamReader(System.in), new PrintWriter(System.out));     new Main(io).solve();    io.close();  }  ConsoleIO io;  Main(ConsoleIO io) {   this.io = io;  }  ConsoleIO opt;  Main(ConsoleIO io, ConsoleIO opt) {   this.io = io;   this.opt = opt;  }  List<List<Integer>> gr = new ArrayList<>();  long MOD = 1_000_000_007;  public void solve() {   long x = io.readLong(), k = io.readLong();   if(x==0){    io.writeLine("0");    return;   }   long res = ((pow(2, k+1, MOD) * (x % MOD)) % MOD - pow(2, k, MOD) % MOD + 1 + MOD) % MOD;   io.writeLine(res+"");  }  long pow(long a, long p, long mod) {   long res = 1;   while (p > 0) {    if (p % 2 == 1) res = (res * a) % mod;    a = (a * a) % mod;    p /= 2;   }   return res;  } }  class ConsoleIO {  BufferedReader br;  PrintWriter out;  public ConsoleIO(Reader reader, PrintWriter writer){br = new BufferedReader(reader);out = writer;}  public void flush(){this.out.flush();}  public void close(){this.out.close();}  public void writeLine(String s) {this.out.println(s);}  public void writeInt(int a) {this.out.print(a);this.out.print(' ');}  public void writeWord(String s){   this.out.print(s);  }  public void writeIntArray(int[] a, int k, String separator) {   StringBuilder sb = new StringBuilder();   for (int i = 0; i < k; i++) {    if (i > 0) sb.append(separator);    sb.append(a[i]);   }   this.writeLine(sb.toString());  }  public int read(char[] buf, int len){try {return br.read(buf,0,len);}catch (Exception ex){ return -1; }}  public String readLine() {try {return br.readLine();}catch (Exception ex){ return "";}}  public long[] readLongArray() {   String[]n=this.readLine().trim().split("\\s+");long[]r=new long[n.length];   for(int i=0;i<n.length;i++)r[i]=Long.parseLong(n[i]);   return r;  }  public int[] readIntArray() {   String[]n=this.readLine().trim().split("\\s+");int[]r=new int[n.length];   for(int i=0;i<n.length;i++)r[i]=Integer.parseInt(n[i]);   return r;  }  public int[] readIntArray(int n) {   int[] res = new int[n];   char[] all = this.readLine().toCharArray();   int cur = 0;boolean have = false;   int k = 0;   boolean neg = false;   for(int i = 0;i<all.length;i++){    if(all[i]>='0' && all[i]<='9'){     cur = cur*10+all[i]-'0';     have = true;    }else if(all[i]=='-') {     neg = true;    }    else if(have){     res[k++] = neg?-cur:cur;     cur = 0;     have = false;     neg = false;    }   }   if(have)res[k++] = neg?-cur:cur;   return res;  }  public int ri() {   try {    int r = 0;    boolean start = false;    boolean neg = false;    while (true) {     int c = br.read();     if (c >= '0' && c <= '9') {      r = r * 10 + c - '0';      start = true;     } else if (!start && c == '-') {      start = true;      neg = true;     } else if (start || c == -1) return neg ? -r : r;    }   } catch (Exception ex) {    return -1;   }  }  public long readLong() {   try {    long r = 0;    boolean start = false;    boolean neg = false;    while (true) {     int c = br.read();     if (c >= '0' && c <= '9') {      r = r * 10 + c - '0';      start = true;     } else if (!start && c == '-') {      start = true;      neg = true;     } else if (start || c == -1) return neg ? -r : r;    }   } catch (Exception ex) {    return -1;   }  }  public String readWord() {   try {    boolean start = false;    StringBuilder sb = new StringBuilder();    while (true) {     int c = br.read();     if (c!= ' ' && c!= '\r' && c!='\n' && c!='\t') {      sb.append((char)c);      start = true;     } else if (start || c == -1) return sb.toString();    }   } catch (Exception ex) {    return "";   }  }  public char readSymbol() {   try {    while (true) {     int c = br.read();     if (c != ' ' && c != '\r' && c != '\n' && c != '\t') {      return (char) c;     }    }   } catch (Exception ex) {    return 0;   }  } } class Pair {  public Pair(int a, int b) {this.a = a;this.b = b;}  public int a;  public int b; } class PairLL {  public PairLL(long a, long b) {this.a = a;this.b = b;}  public long a;  public long b; } class Triple {  public Triple(int a, int b, int c) {this.a = a;this.b = b;this.c = c;}  public int a;  public int b;  public int c; }
5	public class Main { public static void main(String args[]) throws IOException  {  Scanner c=new Scanner(System.in);  int n=c.nextInt();  int a=c.nextInt();   int b=c.nextInt();   int C[]=new int[n];  for(int i=0;i<n;i++)   C[i]=c.nextInt();  Arrays.sort(C);   int petya=C[n-a];  System.out.println((C[n-a]-C[n-a-1]));  } }
2	public class ProblemB {  BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));  long[] readInts() throws IOException {   String[] strings = reader.readLine().split(" ");   long[] ints = new long[strings.length];   for(int i = 0; i < ints.length; i++) {    ints[i] = Long.parseLong(strings[i]);   }   return ints;  }  long foo(long a) {   return a > 0 ? a * a : 0;  }  long boo(long a) {   return a <= 0 ? 0 : a * (a + 1) / 2;  }  void solve() throws IOException {   long[] tt = readInts();   long n = tt[0];   long x = tt[1];   long y = tt[2];   long c = tt[3];   long lo = -1, hi = 2 * 1000 * 1000 * 1000 + 2;   while(hi - lo > 1) {    long m = (lo + hi) / 2;    long s = 2 * m * m + 2 * m + 1;    s -= foo(m - x + 1) + foo(m - y + 1) + foo(x + m - n) + foo(y + m - n);    s += boo(m + 1 - (n + 1 + n + 1 - x - y)) + boo(m + 1 - (n + 1 - x + y)) + boo(m + 1 - (n + 1 - y + x))      + boo(m + 1 - (x + y));    if(s < c) lo = m;    else hi = m;   }   writer.println(hi);   writer.flush();  }  public static void main(String[] args) throws IOException{   new ProblemB().solve();  } }
0	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   Parser in = new Parser(inputStream);   OutputWriter out = new OutputWriter(outputStream);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  } } class TaskA {  public void solve(int testNumber, Parser in, OutputWriter out) {   long a = in.nextLong();   long b = in.nextLong();   long cnt = 0;   while (a != 0 && b != 0) {    if (a > b) {     cnt += a / b;     a %= b;    }    else {     cnt += b / a;     b = b % a;    }   }   out.println(cnt);  } } class Parser {  private BufferedReader din;  private StringTokenizer tokenizer;  public Parser(InputStream in)  {   din = new BufferedReader(new InputStreamReader(in));   tokenizer = null;  }  public String next() {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    try {     tokenizer = new StringTokenizer(din.readLine());    } catch (Exception e) {     throw new UnknownError();    }   }   return tokenizer.nextToken();  }  public long nextLong()  {   return Long.parseLong(next());  }  } class OutputWriter extends PrintWriter {  public OutputWriter(Writer out) {   super(out);  }  public OutputWriter(OutputStream out) {   super(out);  }  }
1	public class C { public static void main(String[] args) throws IOException {  File inputFile = new File("entradaC");  if (inputFile.exists())  System.setIn(new FileInputStream(inputFile));  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringBuilder out = new StringBuilder();  String line = "";  while ((line = in.readLine()) != null) {  int n = Integer.parseInt(line);  char[] p = in.readLine().toCharArray();  HashMap<Character, Integer> dif = new HashMap<>();  for (int i = 0; i < p.length; i++)   dif.put(p[i], 0);  int ndif = dif.size();  int head = 0, tail = 0, cnt = 0, ans = Integer.MAX_VALUE, cur;  while (head < n) {   cur = dif.get(p[head]);   if (cur == 0)   cnt++;   dif.put(p[head], cur + 1);   head++;   if (cnt == ndif)   ans = Math.min(ans, head - tail);   while (tail < head && cnt == ndif) {   cur = dif.get(p[tail]);   if (cur == 1)    cnt--;   dif.put(p[tail], cur - 1);   tail++;   if (cnt == ndif)    ans = Math.min(ans, head - tail);   }  }  if (ndif == 1)   ans = 1;  out.append(ans + "\n");  }  System.out.print(out); }  static int[] readInts(String line) {  StringTokenizer st = new StringTokenizer(line.trim());  int a[] = new int[st.countTokens()], index = 0;  while (st.hasMoreTokens())  a[index++] = Integer.parseInt(st.nextToken());  return a; }  static long[] readLongs(String line) {  StringTokenizer st = new StringTokenizer(line.trim());  long a[] = new long[st.countTokens()];  int index = 0;  while (st.hasMoreTokens())  a[index++] = Long.parseLong(st.nextToken());  return a; }  static double[] readDoubles(String line) {  StringTokenizer st = new StringTokenizer(line.trim());  double a[] = new double[st.countTokens()];  int index = 0;  while (st.hasMoreTokens())  a[index++] = Double.parseDouble(st.nextToken());  return a; } }
4	public class Main { static PrintWriter out; static Reader in; public static void main(String[] args) throws IOException {  input_output();  Main solver = new Main();  solver.solve();  out.close();  out.flush(); }  static int INF = (int)1e9; static int MAXN = (int)4e5 + 5; static int MOD = (int)1e9+7; static int q, t, n, m, k; static double pi = Math.PI;  void solve() throws IOException {  n = in.nextInt();  m = in.nextInt();  k = in.nextInt();  int[][] right = new int[n][m],   left = new int[n][m],   up = new int[n][m],   down = new int[n][m];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m-1; j++) {   right[i][j] = in.nextInt();   left[i][j+1] = right[i][j];  }  }  for (int i = 0; i < n-1; i++) {  for (int j = 0; j < m; j++) {   down[i][j] = in.nextInt();   up[i+1][j] = down[i][j];  }  }  if (k%2 == 1) {  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   out.print("-1 ");   }   out.println();  }  return;  }  int[][][] dp = new int[n][m][k+1];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   for (int kk = 1; kk <= k; kk++) {   dp[i][j][kk] = INF;   }  }  }  for (int step = 2; step <= k; step+=2) {  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   if (i != 0) {    dp[i][j][step] = Math.min(dp[i][j][step], dp[i-1][j][step-2]+up[i][j]*2);   }   if (i != n-1) {    dp[i][j][step] = Math.min(dp[i][j][step], dp[i+1][j][step-2]+down[i][j]*2);    }   if (j != 0) {    dp[i][j][step] = Math.min(dp[i][j][step], dp[i][j-1][step-2]+left[i][j]*2);   }   if (j != m-1) {    dp[i][j][step] = Math.min(dp[i][j][step], dp[i][j+1][step-2]+right[i][j]*2);   }   }  }  }  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   out.print(dp[i][j][k]+" ");  }  out.println();  } }  static class Reader {  private InputStream mIs;  private byte[] buf = new byte[1024];  private int curChar;  private int 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 next() {  int c = read();  while (isSpaceChar(c)) {   c = read();  }  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  double nextDouble() {  return Double.parseDouble(next());  }  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 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;  }  } static void input_output() throws IOException {  File f = new File("in.txt");  if (f.exists() && !f.isDirectory()) {  in = new Reader(new FileInputStream("in.txt"));  } else in = new Reader();  f = new File("out.txt");  if (f.exists() && !f.isDirectory()) {  out = new PrintWriter(new File("out.txt"));  } else out = new PrintWriter(System.out); } }
2	public class Main {  public static void main(String[] args) {   new Thread(null, new Runnable() {    public void run() {     new Main().solve();    }   }, "1", 1 << 26).start();  }  void solve() {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   BSportMafia solver = new BSportMafia();   solver.solve(1, in, out);   out.close();  }  static class BSportMafia {   public long findsqrt(long a) {    long b = (long) Math.sqrt(a);    for (long tt = Math.max(0, b - 10); tt <= b + 10; tt++) if (tt * tt == a) return tt;    return -1;   }   public void solve(int testNumber, ScanReader in, PrintWriter out) {    long n = in.scanInt();    long k = in.scanInt();    out.println(n - (-3 + findsqrt(9 + 8 * (k + n))) / 2);   }  }  static class ScanReader {   private byte[] buf = new byte[4 * 1024];   private int index;   private BufferedInputStream in;   private int total;   public ScanReader(InputStream inputStream) {    in = new BufferedInputStream(inputStream);   }   private int scan() {    if (index >= total) {     index = 0;     try {      total = in.read(buf);     } catch (Exception e) {      e.printStackTrace();     }     if (total <= 0) return -1;    }    return buf[index++];   }   public int scanInt() {    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();     }    }    return neg * integer;   }   private boolean isWhiteSpace(int n) {    if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;    else return false;   }  } }
2	public class Solution {  static long n, x, y, c;  static boolean can (long len)  {   BigInteger blen = BigInteger.valueOf(len);        BigInteger sum = BigInteger.ONE;   sum = sum.add(blen.multiply(blen.add(BigInteger.ONE)).shiftLeft(1));     long a1 = Math.max(0, len - x);   sum = sum.subtract(BigInteger.valueOf(a1).multiply(BigInteger.valueOf(a1)));     long a2 = Math.max(0, len - y);   sum = sum.subtract(BigInteger.valueOf(a2).multiply(BigInteger.valueOf(a2)));   long a3 = Math.max(0, len - (n - 1 - x));   sum = sum.subtract(BigInteger.valueOf(a3).multiply(BigInteger.valueOf(a3)));     long a4 = Math.max(0, len - (n - 1 - y));   sum = sum.subtract(BigInteger.valueOf(a4).multiply(BigInteger.valueOf(a4)));     if (y - a1 + 1 < 0)   {    long b1 = Math.abs(y - a1 + 1);    sum = sum.add(BigInteger.valueOf(b1).multiply(BigInteger.valueOf(b1 + 1)).shiftRight(1));   }     if (y - a3 + 1 < 0)   {    long b1 = Math.abs(y - a3 + 1);    sum = sum.add(BigInteger.valueOf(b1).multiply(BigInteger.valueOf(b1 + 1)).shiftRight(1));   }     if (y + a1 - 1 >= n)   {    long b1 = y + a1 - n;    sum = sum.add(BigInteger.valueOf(b1).multiply(BigInteger.valueOf(b1 + 1)).shiftRight(1));   }     if (y + a3 - 1 >= n)   {    long b1 = y + a3 - n;    sum = sum.add(BigInteger.valueOf(b1).multiply(BigInteger.valueOf(b1 + 1)).shiftRight(1));   }     return sum.compareTo(BigInteger.valueOf(c)) >= 0;  }  public static void main (String argv[])  {   Scanner in = new Scanner(System.in);     n = in.nextLong();   x = in.nextLong();   y = in.nextLong();   c = in.nextLong();   x--; y--;     long lf = 0, rg = 2 * 1000 * 1000 * 1000 + 3;     while (lf != rg)   {    long mid = (lf + rg) >> 1;       if (can(mid))     rg = mid;    else     lf = mid + 1;   }     System.out.println(lf);  } }
2	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   C489 solver = new C489();   solver.solve(1, in, out);   out.close();  }  static class C489 {   int mod = 1000000007;   public void solve(int testNumber, ScanReader in, PrintWriter out) {    long x = in.scanLong();    long k = in.scanLong();    if (x == 0) {     out.println(0);     return;    }    long p = CodeX.power(2, k, mod);    long ans = (2 * p * (x % mod)) % mod;    ans = (ans + 1) % mod;    ans = (ans - p + mod) % mod;    out.println(ans);   }  }  static class CodeX {   public static long power(long x, long y, long p) {    long res = 1;    x = x % p;    while (y > 0) {     if ((y & 1) != 0)      res = (res * x) % p;     y = y >> 1;     x = (x * x) % p;    }    return res;   }  }  static class ScanReader {   private byte[] buf = new byte[4 * 1024];   private int INDEX;   private BufferedInputStream in;   private int TOTAL;   public ScanReader(InputStream inputStream) {    in = new BufferedInputStream(inputStream);   }   private int scan() {    if (INDEX >= TOTAL) {     INDEX = 0;     try {      TOTAL = in.read(buf);     } catch (Exception e) {      e.printStackTrace();     }     if (TOTAL <= 0) return -1;    }    return buf[INDEX++];   }   private boolean isWhiteSpace(int n) {    if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;    else return false;   }   public long scanLong() {    long I = 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') {      I *= 10;      I += n - '0';      n = scan();     }    }    return neg * I;   }  } }
1	public class Test {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   String s = in.readLine();   String[] p = in.readLine().split(" ");   List<Integer> a = new ArrayList<Integer>();   for (String k : p) {    a.add(Integer.parseInt(k));   }   int n = a.size();   int c1 = 0;   int c2 = 0;   int c1p = 0;   int c2p = 0;   for (int i = 0; i < n; i++) {    if (a.get(i) % 2 == 0) {     c1++;     c1p = i;    } else {     c2++;     c2p = i;    }   }   if (c1 < c2) {    System.out.println(c1p + 1);   } else {    System.out.println(c2p + 1);   }  }  }
4	public class D_Rnd718_Explorer { static int row, col; static int INF = 1_000_000_000; static int[] dx = {0, 0, 1, -1}; static int[] dy = {1, -1, 0, 0}; public static void main(String[] args) throws NumberFormatException, IOException  {  BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  String[] in = scan.readLine().split(" ");  row = parse(in[0]);  col = parse(in[1]);  int k = parse(in[2]);   int[][] xMove = new int[row][col-1];  for(int i = 0; i < row; i++)  {  in = scan.readLine().split(" ");  for(int j = 0; j < col - 1; j++)   xMove[i][j] = parse(in[j]);  }   int[][] yMove = new int[row - 1][col];  for(int i = 0; i < row - 1; i++)  {  in = scan.readLine().split(" ");  for(int j = 0; j < col; j++)   yMove[i][j] = parse(in[j]);  }     int[][] output = new int[row][col];   if(k % 2 != 0)  fill(-1, output);   else  {  Point[][] grid = new Point[row][col];  for(int i = 0; i < row; i++)   for(int j = 0; j < col; j++)   grid[i][j] = new Point(i, j);    parseMoves(grid, xMove, yMove);    solve(grid, k, output);  }   print(output, out);   out.flush(); }  private static void solve(Point[][] grid, int k, int[][] output)  {     int target = k / 2;  int[][][] dist = new int[row][col][k/2];  fill(dist, grid);   for(int steps = 1; steps < target; steps++ )  {  for(int i = 0; i < row; i++)  {   for(int j = 0; j < col;j ++)   {   dist[i][j][steps] = getDist(i, j, steps, dist, grid);   }  }  }   for(int i = 0; i < row; i++)  for(int j = 0; j < col;j ++)   output[i][j] = (dist[i][j][target - 1] << 1);   }   private static int getDist(int y, int x, int steps, int[][][] dist, Point[][] grid)  {  for(int d = 0; d < 4; d++)  {  int i = y + dy[d];  int j = x + dx[d];    if(valid(i, j))  {   dist[y][x][steps] = Math.min(dist[y][x][steps], dist[i][j][steps - 1] + grid[y][x].weight[d]);  }  }   return dist[y][x][steps]; }   private static void fill(int[][][] dist, Point[][] grid)  {  for(int i = 0; i < row; i++)  for(int j = 0; j < col;j ++)   for(int s = 0; s < dist[0][0].length; s++)   dist[i][j][s] = INF;   for(int i = 0; i < row; i++)  for(int j = 0; j < col; j++)   for(int d = 0; d < 4; d++)   dist[i][j][0] = Math.min(dist[i][j][0], grid[i][j].weight[d]);   }  private static boolean valid(int y, int x)  {  return y >= 0 && x >= 0 && y < row && x < col; }   private static void parseMoves(Point[][] grid, int[][] xMove, int[][] yMove)  {  for(int i = 0; i < xMove.length; i++)  {  for(int j = 0; j < xMove[i].length; j++)  {   grid[i][j].weight[2] = xMove[i][j];   grid[i][j + 1].weight[3] = xMove[i][j];   }  }   for(int i = 0; i < yMove.length; i++)  {  for(int j = 0; j < yMove[i].length; j++)  {   grid[i][j].weight[0] = yMove[i][j];   grid[i + 1][j].weight[1] = yMove[i][j];   }  } }  private static void fill(int val, int[][] output)  {  for(int i = 0; i < output.length; i++)  Arrays.fill(output[i], val); }  private static void print(int[][] ray, PrintWriter out)  {  for(int i = 0; i < ray.length; i++)  {  out.print(ray[i][0]);  for(int j = 1; j < ray[i].length; j++)   out.print(" " + ray[i][j]);  out.println();  }   }  public static int parse(String num) {  return Integer.parseInt(num); }  static class Point {  int[] weight = new int[4];   int x, y;   public Point(int i, int j)  {  y = i;  x = j;  Arrays.fill(weight, INF);  } }  static class Step implements Comparable<Step> {  int length, numSteps;  Point current;   public Step(Point p, int weight, int s)  {  current = p;  length = weight;  numSteps = s;  }  @Override  public int compareTo(Step s)  {  if(length == s.length) return numSteps - s.numSteps;  return length - s.length;  } } }
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");   }  } }
4	public class SolutionC{ public static void main(String[] args) throws Exception{  Scanner sc = new Scanner(new File("input.txt"));  PrintWriter output = new PrintWriter("output.txt");  int N = sc.nextInt();  int M = sc.nextInt();  int K = sc.nextInt();  int[] x = new int[K];  int[] y = new int[K];  for(int i = 0 ; i < K ; i++){  x[i] = sc.nextInt();  y[i] = sc.nextInt();  }  int max = -1, max_x = -1, max_y = -1;  for(int i = 1 ; i <= N ; i++){  for(int j = 1 ; j <= M ; j++){   int min = Integer.MAX_VALUE;   for(int k = 0 ; k < K ; k++){   min = Math.min(min, Math.abs(x[k] - i) + Math.abs(y[k] - j));   }   if(min > max){   max = min;   max_x = i;   max_y = j;   }  }  }  output.println(max_x + " " + max_y);  output.flush(); } }
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++);} }  }
5	public class Task15a {  public static class House implements Comparable<House>{  int x, s;  public House(int x, int s) {  super();  this.x = x;  this.s = s;  }  public int compareTo(House o) {  return x - o.x;  }   } public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int t = sc.nextInt() * 2;  House[] hs = new House[n];  for (int i = 0; i < n; i++){  hs[i] = new House(sc.nextInt()*2, sc.nextInt());  }  Arrays.sort(hs);  int res = 2;  for (int i = 0; i < n - 1; i++) {  int curr = hs[i+1].x - hs[i].x - hs[i+1].s - hs[i].s;  if (curr > t) res += 2;  if (curr == t) res += 1;  }  System.out.println(res); } }
6	public class D11 { static HashMap<State, Integer> map; static long[][] ans; static boolean[][] connect; 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());  map = new HashMap<State, Integer>();  connect = new boolean[n][n];  ans = new long[n][1<<n];  for(int i = 0; i < n; i++)  Arrays.fill(ans[i], -1);  int m = Integer.parseInt(st.nextToken());  while(m-- > 0) {  st = new StringTokenizer(br.readLine());  int a = Integer.parseInt(st.nextToken());  int b = Integer.parseInt(st.nextToken());  a--;  b--;  connect[a][b] = connect[b][a] = true;  }  long ret = 0;  int mask = 1 << n;  mask--;  for(int i = 0; i < n; i++) {  for(int out = i+1; out < n; out++) {   if(connect[i][out]) {   ret += solve(mask - (1<<out), out, true);   }  }  mask -= (1<<i);  }  System.out.println(ret/2); } public static long solve(int mask, int start, boolean a) {  if(ans[start][mask] != -1)  return ans[start][mask];  int end = 0;  while((mask & (1<<end)) == 0)  end++;  long ret = 0;  for(int out = 0; out < connect.length; out++) {  if(connect[start][out] && (mask & (1 << out)) != 0) {   if(out == end) {   if(!a)    ret++;   }   else   ret += solve(mask - (1<<out), out, false);  }  }  ans[start][mask] = ret;  return ret; } static class State {  public byte start, go;  public int mask;  public State(byte a, byte b, int c) {  start = a;  go = b;  mask = c;  }  public int hashCode() {  return 10007*mask + 43 * start + go;  }  public boolean equals(Object o) {  State s = (State)o;  return start == s.start && go == s.go && mask == s.mask;  } } }
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();          }      }
2	public class zz{ static int mod=(int)1e9+7;  public static void main(String[] args) throws Exception{     MScanner sc = new MScanner(System.in);   PrintWriter pw=new PrintWriter(System.out);   int n=sc.nextInt();     int k=sc.nextInt();   int x=(-3+(int)Math.sqrt(9+4*1.0*(2*k*1.0+2*n*1.0)))/2;   pw.println(n-x);   pw.flush();  }  static class pair implements Comparable<pair>{  String t;int d;int idx;  pair(String x,int y,int i){   t=x;d=y;idx=i;  }  @Override  public int compareTo(pair o) {   if(t.compareTo(o.t)!=0) {   return t.compareTo(o.t);   }   return o.d-d;  }     public boolean equals(pair o) {   if(this.compareTo(o)==0)return true;   return false;  }  public String toString() {   return "("+t+" "+d+")";  }  }  static class MScanner {  StringTokenizer st;  BufferedReader br;   public MScanner(InputStream system) {  br = new BufferedReader(new InputStreamReader(system));  }   public MScanner(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);  } } }
5	public class A implements Runnable {  private MyScanner in;  private PrintWriter out;  private void solve() {   int n = in.nextInt();   int[] a = new int[n];   int all = 0;   for (int i = 0; i < n; ++i) {    a[i] = in.nextInt();    all += a[i];   }   Arrays.sort(a);   int sum = 0, ans = 0;   for (int i = n - 1; i >= 0; --i) {    sum += a[i];    ++ans;    if (sum > all - sum) {     break;    }   }   out.println(ans);  }  @Override  public void run() {   in = new MyScanner();   out = new PrintWriter(System.out);   solve();   in.close();   out.close();  }  public static void main(String[] args) {   new A().run();  }  static class MyScanner {   private BufferedReader br;   private StringTokenizer st;   public MyScanner() {    br = new BufferedReader(new InputStreamReader(System.in));   }   public void close() {    try {     br.close();    } catch (IOException e) {     e.printStackTrace();    }   }   public String next() {    while (st == null || !st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();      return null;     }    }    return st.nextToken();   }   public String nextLine() {    try {     st = null;     return br.readLine();    } catch (IOException e) {     e.printStackTrace();     return null;    }   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public boolean hasNext() {    if (st != null && st.hasMoreTokens()) {     return true;    }    try {     while (br.ready()) {      st = new StringTokenizer(br.readLine());      if (st != null && st.hasMoreTokens()) {       return true;      }     }    } catch (IOException e) {     e.printStackTrace();    }    return false;   }  } }
5	public class A {  public static void main(String args[])  {   Scanner scan = new Scanner(System.in);     int n = scan.nextInt();     int[] a = new int[n];     for(int i=0;i < n;i++)    a[i] = scan.nextInt();      Arrays.sort(a);     int min = a[0];     for(int i=1;i < n;i++)   {    if(a[i] > min)    {     System.out.println(a[i]);     return;    }   }     System.out.println("NO");  } }
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; }
1	public class Main{  final long mod = (int)1e9+7, IINF = (long)1e19;  final int MAX = (int)5e5+1, MX = (int)1e7+1, INF = (int)1e9, root = 3;  DecimalFormat df = new DecimalFormat("0.0000000000000");  double eps = 1e-9, PI = 3.141592653589793238462643383279502884197169399375105820974944;  static boolean multipleTC = false, memory = false;  FastReader in;PrintWriter out;  public static void main(String[] args) throws Exception{   if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();   else new Main().run();  }  void run() throws Exception{   in = new FastReader();   out = new PrintWriter(System.out);   for(int i = 1, T= (multipleTC)?ni():1; i<= T; i++)solve(i);   out.flush();   out.close();  }   void solve(int TC) throws Exception{   int n = ni();   long d = nl();   long ans = 2;   long[] p = new long[n];   for(int i = 0; i< n; i++)p[i] = nl();   for(int i = 1; i< n; i++){    if(p[i]-p[i-1] == 2*d)ans++;    else if(p[i]-p[i-1]>2*d)ans+=2;   }   pn(ans);  }    int[] reverse(int[] a){   int[] o = new int[a.length];   for(int i = 0; i< a.length; i++)o[i] = a[a.length-i-1];   return o;   }  int[] sort(int[] a){   if(a.length==1)return a;   int mid = a.length/2;   int[] b = sort(Arrays.copyOfRange(a,0,mid)), c = sort(Arrays.copyOfRange(a,mid,a.length));   for(int i = 0, j = 0, k = 0; i< a.length; i++){    if(j<b.length && k<c.length){     if(b[j]<c[k])a[i] = b[j++];     else a[i] = c[k++];    }else if(j<b.length)a[i] = b[j++];    else a[i] = c[k++];   }   return a;  }  long[] sort(long[] a){   if(a.length==1)return a;   int mid = a.length/2;   long[] b = sort(Arrays.copyOfRange(a,0,mid)), c = sort(Arrays.copyOfRange(a,mid,a.length));   for(int i = 0, j = 0, k = 0; i< a.length; i++){    if(j<b.length && k<c.length){     if(b[j]<c[k])a[i] = b[j++];     else a[i] = c[k++];    }else if(j<b.length)a[i] = b[j++];    else a[i] = c[k++];   }   return a;  }  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 bitcount(long n){return (n==0)?0:(1+bitcount(n&(n-1)));}  void p(Object o){out.print(o);}  void pn(Object o){out.println(o);}  void pni(Object o){out.println(o);out.flush();}  String n(){return in.next();}  String nln(){return in.nextLine();}  int ni(){return Integer.parseInt(in.next());}  long nl(){return Long.parseLong(in.next());}  double nd(){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(){    while (st == null || !st.hasMoreElements()){     try{      st = new StringTokenizer(br.readLine());     }catch (IOException e){      e.printStackTrace();     }    }    return st.nextToken();   }   String nextLine(){    String str = "";    try{     str = br.readLine();    }catch (IOException e){     e.printStackTrace();    }     return str;   }  } }
0	public class Contest1_1{   public static void main(String ar[]) throws Exception {      BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));   int input = Integer.parseInt(buff.readLine());   if(input==0){    System.out.println("0 0 0");   }else if(input==1){    System.out.println("0 0 1");   }else if(input==2){    System.out.println("0 1 1");   }else if(input==3){    System.out.println("1 1 1");   }else {    int output[] = checkFibo(input);    int get[] = checkFibo(output[1]);    output[0] = get[1];    output[1] = get[2];    System.out.print(output[0]);    System.out.print(" " + output[1]);    System.out.println(" " + output[2]);    }  }   public static int[] checkFibo(int input){   int output[] = new int[3];   int fibo_1 = 0;   int fibo_2 = 1;   int temp = 0;   while(fibo_2!=input){    temp = fibo_2;    output[1] = fibo_1;    output[2] = fibo_2;    fibo_2 += fibo_1;    fibo_1 = temp;   }   return output;  }  }
5	public class Solution {  public static void main(String[] args) throws IOException  {   new Solution().run();  }  StreamTokenizer in;  Scanner ins;  PrintWriter out;   int nextInt() throws IOException  {   in.nextToken();    return (int)in.nval;  }    void run() throws IOException  {   if(System.getProperty("ONLINE_JUDGE")!=null)   {    in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));    ins = new Scanner(System.in);    out = new PrintWriter(System.out);   }   else   {       in = new StreamTokenizer(new BufferedReader(new FileReader("input.txt")));       ins = new Scanner(new FileReader("input.txt"));    out = new PrintWriter(new FileWriter("output.txt"));   }   int n = nextInt(),k = nextInt();   Team[] A = new Team[n];   for(int i = 0; i < n; i++)   {    A[i] = new Team();    A[i].p = nextInt(); A[i].t = nextInt();   }   Arrays.sort(A);        k--;   int sum = 0;   for(int i = 0; i < n; i++)    if(A[k].compareTo(A[i])==0)     sum++;     out.print(sum);   out.close();  }     class Team implements Comparable  {   public int p,t;   public int compareTo(Object obj)   {    Team a = (Team) obj;    if(p>a.p || p==a.p && t<a.t)           return -1;    else         if(p==a.p && t==a.t)      return 0;     else      return 1;   }    } }
1	public class B {  public static void main(String[] args) {   Scanner input = new Scanner (System.in);   Pattern rc_style = Pattern.compile("R[0-9]+C[0-9]+");   int n = input.nextInt();   while(n-- > 0) {    String str = input.next();    Matcher m = rc_style.matcher(str);    if (m.matches()) {     String nums[] = str.split("[RC]");     String row = nums[1];     String col = nums[2];     String buffer = "";     int col_num = Integer.valueOf(col);     while(col_num > 0) {      if (col_num % 26 > 0) {       buffer += (char)(col_num % 26 + 'A' - 1);       col_num /= 26;      } else {       buffer += 'Z';       col_num /= 26;       col_num--;      }     }     for (int i = buffer.length() - 1; i >= 0; --i) {      System.out.print(buffer.charAt(i));     }     System.out.println(row);    } else {     String col = str.split("[0-9]+")[0];     String row = str.split("[A-Z]+")[1];     int col_num = 0;     int shift = 1;     for (int i = col.length() - 1; i >= 0; --i){      col_num += (int)(col.charAt(i) - 'A' + 1) * shift;      shift *= 26;     }     System.out.println("R" + row + "C" + col_num);    }   }  } }
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();  } }
1	public class phoenixandpuzzle { public static void main(String[] args) throws IOException {  BufferedReader fin = new BufferedReader(new InputStreamReader(System.in));  int t = Integer.parseInt(fin.readLine());  StringBuilder fout = new StringBuilder();  HashSet<Integer> dict = new HashSet<Integer>();  int pointer = 1;  int area = 0;  while(area >= 0) {  area = (pointer * pointer) * 2;  dict.add(area);  pointer ++;  }  pointer = 1;  area = 0;  while(area >= 0) {  area = (pointer * pointer) * 4;  dict.add(area);  pointer ++;  }  while(t-- > 0) {  int n = Integer.parseInt(fin.readLine());  if(dict.contains(n)) {   fout.append("YES\n");  }  else {   fout.append("NO\n");  }  }  System.out.print(fout); } }
5	public class r114 {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int a = sc.nextInt();   int b = sc.nextInt();     ArrayList<Integer> l = new ArrayList<Integer>();   for (int i = 0 ; i < n; i++) {    l.add(sc.nextInt());   }   Collections.sort(l);     int pet = l.get(n - a);   int vas = l.get(b - 1);     if (pet <= vas) {    System.out.println(0);   }   else System.out.println(pet - vas);       sc.close();  } }
5	public class R113_D2_A {  public static void main(String[] args) throws NumberFormatException,    IOException {        InputReader4 in = new InputReader4(System.in);   int n = in.readInt();   int k = in.readInt();   p[] inp = new p[n];   for (int i = 0; i < inp.length; i++) {    inp[i] = new p(in.readInt(), in.readInt());   }   Arrays.sort(inp);   for (int i = 0; i < inp.length;) {    int j = i + 1;    while (j < inp.length && inp[i].x == inp[j].x      && inp[i].y == inp[j].y) {     j++;    }    int num = j - i;    if (k <= num) {     System.out.println(num);     return;    } else     k -= num;    i = j;   }  }  static class p implements Comparable<p> {   int x;   int y;   public p(int a, int b) {    x = a;    y = b;   }   public int compareTo(p o) {    if (x > o.x)     return -1;    if (x < o.x)     return 1;    return y - o.y;   }  }  static class InputReader4 {   private InputStream stream;   private byte[] buf = new byte[1000];   private int curChar, numChars;   public InputReader4(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 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;   }  } }
2	public class Main {   public static void main(String[] args) throws Exception{   FastReader sc=new FastReader();   OutputStream outputStream = System.out;   PrintWriter out = new PrintWriter(outputStream);   Main mm=new Main();   long n=sc.nextLong();   long k=sc.nextLong();   long l=0;   long r=1000000000;   long ans=-1;   while(l<=r) {    long mid=(l+r)/2;    if(n-mid<=0) {     r=mid-1;    }    else {     long temp=(n-mid)*(n-mid+1)-(2*mid);     if(temp==2*k) {      ans=mid;      break;     }     else if(temp<2*k) {      r=mid-1;     }     else if(temp>2*k) {      l=mid+1;     }    }   }   System.out.println(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;  } }
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;   }  } }
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);  }  }
3	public class Main {  BufferedReader br;  PrintWriter pw;  StringTokenizer st;  long mod = (long) (1e9 + 7);  public static void main(String[] args) {   (new Main()).run();  }  void solve() throws IOException {   int n = nextInt();   boolean p[] = new boolean[n];   for (int i = 0; i < n; i++) {    String s = nextToken();    if (s.charAt(0) == 'f') p[i] = true;   }   long d[][] = new long[n][n];   d[0][0] = 1;   for (int i = 1; i < n; i++) {    if (p[i - 1]) {     d[i][0] = 0;     for (int j = 1; j < n; j++) {      d[i][j] = d[i - 1][j - 1];     }    } else {     long sum = 0;     for (int j = n - 1; j >= 0; j--) {      sum += d[i - 1][j];      sum %= mod;      d[i][j] = sum;     }    }   }   long sum = 0;   for (int i = 0; i < n; i++) {    sum += d[n - 1][i];    sum %= mod;   }   pw.print(sum);  }  void run() {   try {      br = new BufferedReader(new InputStreamReader(System.in));    pw = new PrintWriter(new OutputStreamWriter(System.out));    solve();    pw.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }  String nextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return st.nextToken();  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  class h {   int ans;   int last;   public h() {    last = -1;    ans = 0;   }  } }
1	public class Ideone { public static void main (String[] args) throws java.lang.Exception {  Scanner sc=new Scanner(System.in);  int n=sc.nextInt();  ArrayList<String> s1=new ArrayList<String> ();  ArrayList<String> s2=new ArrayList<String> ();  ArrayList<String> s3=new ArrayList<String> ();  int i;  for(i=0;i<n;i++)  s1.add(sc.next());   for(i=0;i<n;i++)  s2.add(sc.next());  s3.addAll(s2);  for(i=0;i<n;i++)  {  if(s2.contains(s1.get(i)))  s3.remove(s1.get(i));      } System.out.println(s3.size());   } }
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);   BSportMafia solver = new BSportMafia();   solver.solve(1, in, out);   out.close();  }  static class BSportMafia {   public void solve(int testNumber, InputReader in, PrintWriter out) {    long n = in.nextLong();    long k = in.nextLong();    long b = 2 * n + 3;    long c = n * n - 2 * k + n;    long d = b * b - 4 * c;    long val = (b - (long) Math.sqrt(d)) / 2;    out.println(val);   }  }  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());   }  } }
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()); } }
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);   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();    Map<String, Integer> map = new HashMap<>();    for (int i = 0; i < n; i++) {     String x = in.next();     map.put(x, map.getOrDefault(x, 0) + 1);    }    int ans = 0;    for (int i = 0; i < n; i++) {     String x = in.next();     if (map.containsKey(x)) {      map.put(x, map.get(x) - 1);      if (map.get(x) == 0) {       map.remove(x);      }     } else {      ans++;     }    }    out.print(ans);   }  }  static 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());   }  } }
1	public class q1 {  public static MyScanner in = new MyScanner();  public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out), true);  public static MyViewer view = new MyViewer();  public static BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));  public static Random rand = new Random(System.currentTimeMillis());  public static class Pair<A, B> {   private final A first;   private final B second;   public Pair(A first, B second) {    super();    this.first = first;    this.second = second;   }   public int hashCode() {    int hashFirst = first != null ? first.hashCode() : 0;    int hashSecond = second != null ? second.hashCode() : 0;    return (hashFirst + hashSecond) * hashSecond + hashFirst;   }   public boolean equals(Object other) {    if (other instanceof Pair) {     Pair otherPair = (Pair) other;     return       ((this.first == otherPair.first ||         (this.first != null && otherPair.first != null &&           this.first.equals(otherPair.first))) &&         (this.second == otherPair.second ||           (this.second != null && otherPair.second != null &&             this.second.equals(otherPair.second))));    }    return false;   }   public String toString() {    return "(" + first + ", " + second + ")";   }   public A getFirst() {    return first;   }   public B getSecond() {    return second;   }  }  public static class MyScanner {   BufferedReader br;   StringTokenizer st;   private boolean randomInput = false;   private Random rand;   void randomInput(boolean r) {    randomInput = r;    rand = new Random(System.currentTimeMillis());      }   public MyScanner() {    br = new BufferedReader(new InputStreamReader(System.in));   }   public MyScanner(InputStream is) {    br = new BufferedReader(new InputStreamReader(is));   }   public String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }   public int nextInt(int val) {    return randomInput ? val : Integer.parseInt(next());   }   public int nextInt(int low, int high) {    if (randomInput) {     return rand.nextInt(high - low + 1) + low;    } else {     return Integer.parseInt(next());    }   }   long nextLong() {    return Long.parseLong(next());   }   long nextLong(long val) {    return randomInput ? val : Long.parseLong(next());   }   long nextLong(long low, long high) {    if (randomInput) {     return low + ((long) (rand.nextDouble() * (high - low + 1)));    } else {     return Long.parseLong(next());    }   }   double nextDouble() {    return Double.parseDouble(next());   }   int[] arrayInt(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = nextInt();    }    return a;   }   int[] arrayInt(int n, int low, int high) {    int[] a = new int[n];    if (randomInput) {     for (int i = 0; i < n; i++) {      a[i] = rand.nextInt(high - low + 1) + low;     }    } else {     for (int i = 0; i < n; i++) {      a[i] = nextInt();     }    }    return a;   }   ArrayList<Integer> list(int n) {    ArrayList<Integer> a = new ArrayList<Integer>(n);    for (int i = 0; i < n; i++) {     a.add(nextInt());    }    return a;   }   ArrayList<Integer> list(int n, int low, int high) {    ArrayList<Integer> a = new ArrayList<Integer>(n);    if (randomInput) {     for (int i = 0; i < n; i++) {      a.add(rand.nextInt(high - low + 1) + low);     }    } else {     for (int i = 0; i < n; i++) {      a.add(nextInt());     }    }    return a;   }   long[] arrayLong(int n) {    long[] a = new long[n];    for (int i = 0; i < n; i++) {     a[i] = nextLong();    }    return a;   }   long[] arrayLong(int n, long low, long high) {    long[] a = new long[n];    if (randomInput) {     for (int i = 0; i < n; i++) {      double r = rand.nextDouble();      a[i] = (long) (r * (double) (high - low + 1)) + low;      if (a[i] == 0) {       out.println("Ouch : " + r);      }     }    } else {     for (int i = 0; i < n; i++) {      a[i] = nextLong();     }    }    return a;   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   void close() {    try {     br.close();    } catch (IOException e) {     e.printStackTrace();    }   }   ArrayList<ArrayList<Integer>> randomTree(int n) {    ArrayList<ArrayList<Integer>> edges = new ArrayList<>();    for (int i = 0; i < n; i++) {     edges.add(new ArrayList<>());    }    for (int i = 1; i < n; i++) {     int par = rand.nextInt(i);     edges.get(par).add(i);    }    return edges;   }  }  static class MyViewer {   private static boolean print = true;   public void on() {    print = true;   }   public void off() {    print = false;   }   public <T extends List> void list(T a) {    if (!print) return;    if (a == null) {     out.println("List: NULL");     return;    }    if (a.size() == 0) {     out.println("List: []");     return;    }    out.print("List: [" + a.get(0));    for (int i = 1; i < a.size(); i++) {     out.print(", " + a.get(i));    }    out.println("] Len: " + a.size());   }   public <T> void array(T[] a) {    if (!print) return;    if (a == null) {     out.println("Array: NULL");     return;    }    if (a.length == 0) {     out.println("Array: []");     return;    }    out.print("Array: [" + a[0]);    for (int i = 1; i < a.length; i++) {     out.print(", " + a[i]);    }    out.println("] Len: " + a.length);   }   public void array(boolean[] a) {    if (!print) return;    if (a == null) {     out.println("boolean[]: NULL");     return;    }    if (a.length == 0) {     out.println("boolean[]: Len: 0");     return;    }    out.print("boolean[] Len: " + a.length + " [");    for (boolean x : a) {     out.print(x + ", ");    }    out.println("\b\b]");   }   public void array(int[] a) {    if (!print) return;    if (a == null) {     out.println("Array: NULL");     return;    }    if (a.length == 0) {     out.println("Array: []");     return;    }    out.print("int[] Len: " + a.length + " [");    for (int x : a) {     out.print(x + ", ");    }    out.println("\b\b]");   }   public void array(long[] a) {    if (!print) return;    if (a == null) {     out.println("Array: NULL");     return;    }    if (a.length == 0) {     out.println("Array: []");     return;    }    out.print("long Array: [");    for (long x : a) {     out.print(x + ", ");    }    out.println("\b\b] Len: " + a.length);   }   public void matrix(int[][] a, int cutoff) {    if (cutoff == 0)     cutoff = Integer.MAX_VALUE;    if (a == null) {     out.println("Matrix: NULL");     return;    }    for (int i = 0; i < a.length; i++) {     if (i < cutoff) {      printMatrixRow(a[i], cutoff);     } else {      out.println("  ...");      printMatrixRow(a[a.length - 1], cutoff);      break;     }    }   }   public void matrix(long[][] a, long cutoff) {    if (cutoff == 0)     cutoff = Long.MAX_VALUE;    if (a == null) {     out.println("Matrix: NULL");     return;    }    for (int i = 0; i < a.length; i++) {     if (i < cutoff) {      printMatrixRow(a[i], cutoff);     } else {      out.println("  ...");      printMatrixRow(a[a.length - 1], cutoff);      break;     }    }   }   public void matrix(boolean[][] a, int cutoff) {    if (cutoff == 0)     cutoff = Integer.MAX_VALUE;    if (a == null) {     out.println("Matrix: NULL");     return;    }    for (int i = 0; i < a.length; i++) {     if (i < cutoff) {      printMatrixRow(a[i], cutoff);     } else {      out.println("  ...");      printMatrixRow(a[a.length - 1], cutoff);      break;     }    }   }   private void printMatrixRow(int[] a, int cutoff) {    for (int j = 0; j < a.length; j++) {     if (j < cutoff) {      out.printf("%6d ", a[j]);     } else {      out.printf(" ... %6d", a[a.length - 1]);      break;     }    }    out.println();   }   private void printMatrixRow(long[] a, long cutoff) {    for (int j = 0; j < a.length; j++) {     if (j < cutoff) {      out.printf("%6d ", a[j]);     } else {      out.printf(" ... %6d", a[a.length - 1]);      break;     }    }    out.println();   }   private void printMatrixRow(boolean[] a, int cutoff) {    for (int j = 0; j < a.length; j++) {     if (j < cutoff) {      out.print(a[j] ? "T " : "F ");     } else {      out.print(" ... " + (a[a.length - 1] ? "T" : "F"));      break;     }    }    out.println();   }  }  public static void main(String[] args) throws IOException {   int n = in.nextInt();   int d = in.nextInt();   int[] a = in.arrayInt(n);   int count = 2;   for(int i = 0 ;i < n-1; i++) {    if( a[i+1] - a[i] == 2 * d )     count += 1;    if( a[i+1] - a[i] > 2 * d)     count += 2;   }   out.println(count);    log.flush();   in.close();  } }
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());  } }
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);   G1PlaylistForPolycarpEasyVersion solver = new G1PlaylistForPolycarpEasyVersion();   solver.solve(1, in, out);   out.close();  }  static class G1PlaylistForPolycarpEasyVersion {   long mod = (long) 1e9 + 7;   public void solve(int testNumber, InputReader s, PrintWriter w) {    int n = s.nextInt(), T = s.nextInt();    int[] t = new int[n + 1];    int[] g = new int[n + 1];    int[] f = new int[4];    for (int i = 1; i <= n; i++) {     t[i] = s.nextInt();     g[i] = s.nextInt();     f[g[i]]++;    }    long[] fact = new long[n + 1];    fact[0] = 1;    for (int i = 1; i <= n; i++)     fact[i] = fact[i - 1] * i % mod;    long[][][][] perm = new long[f[1] + 1][f[2] + 1][f[3] + 1][3 + 1];    long[][][] sumPerm = new long[f[1] + 1][f[2] + 1][f[3] + 1];    perm[0][0][0][0] = 1;    for (int a = 0; a <= f[1]; a++) {     for (int b = 0; b <= f[2]; b++) {      for (int c = 0; c <= f[3]; c++) {       if (a - 1 >= 0)        perm[a][b][c][1] = (sumPerm[a - 1][b][c] - perm[a - 1][b][c][1] + mod) % mod;       if (b - 1 >= 0)        perm[a][b][c][2] = (sumPerm[a][b - 1][c] - perm[a][b - 1][c][2] + mod) % mod;       if (c - 1 >= 0)        perm[a][b][c][3] = (sumPerm[a][b][c - 1] - perm[a][b][c - 1][3] + mod) % mod;       for (int i = 0; i <= 3; i++)        sumPerm[a][b][c] = (sumPerm[a][b][c] + perm[a][b][c][i]) % mod;      }     }    }    long[][][][][] dp = new long[n + 1][f[1] + 1][f[2] + 1][f[3] + 1][T + 1];    dp[0][0][0][0][0] = 1;    for (int i = 1; i <= n; i++) {     for (int a = 0; a <= f[1]; a++) {      for (int b = 0; b <= f[2]; b++) {       for (int c = 0; c <= f[3]; c++) {        for (int j = 0; j <= T; j++) {         dp[i][a][b][c][j] = dp[i - 1][a][b][c][j];         if (j - t[i] >= 0) {          if (g[i] == 1 && a > 0) {           dp[i][a][b][c][j] = (dp[i][a][b][c][j] + dp[i - 1][a - 1][b][c][j - t[i]]) % mod;          } else if (g[i] == 2 && b > 0) {           dp[i][a][b][c][j] = (dp[i][a][b][c][j] + dp[i - 1][a][b - 1][c][j - t[i]]) % mod;          } else if (g[i] == 3 && c > 0) {           dp[i][a][b][c][j] = (dp[i][a][b][c][j] + dp[i - 1][a][b][c - 1][j - t[i]]) % mod;          }         }        }       }      }     }    }    long res = 0;    for (int a = 0; a <= f[1]; a++)     for (int b = 0; b <= f[2]; b++)      for (int c = 0; c <= f[3]; c++)       res = (res + dp[n][a][b][c][T] * sumPerm[a][b][c] % mod * fact[a] % mod * fact[b] % mod * fact[c] % mod) % mod;    w.println(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 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);   }  } }
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(); } }
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); } }
5	public class Main {  private static Node[] node;  public static void main(String[] args) {  Scanner cin = new Scanner(System.in);  int ret = 2, del;  int n = cin.nextInt();  int t = cin.nextInt() * 2;  node = new Node[n];  for (int i = 0; i < n; i++) {   int x = cin.nextInt();   int a = cin.nextInt();   node[i] = new Node(x * 2 - a, x * 2 + a);  }  Arrays.sort(node);  for (int i = 1; i < n; i++) {   del = node[i].l - node[i - 1].r;   if (del > t) {   ret += 2;   } else if (del == t) {   ret++;   }  }  System.out.println(ret);  }  private static class Node implements Comparable<Node> {  public int l;  public int r;  public Node(int l, int r) {     this.l = l;   this.r = r;  }  @Override  public int compareTo(Node arg0) {     return l - arg0.l;  }  } }
2	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   String s = sc.nextLine();   String[] info = s.split(" ");   long n = Long.parseLong(info[0]);   long k = Long.parseLong(info[1]);   sc.close();   long maximum = k * (k - 1) / 2 + 1;   if (n == 1)    System.out.println(0);   else if (n > maximum)    System.out.println(-1);   else {    long left = 0, right = k - 1;    while (left + 1 < right) {     long mid = (right + left) / 2;     if (mid * (k - 1 + k - mid) / 2 + 1 >= n)      right = mid;     else      left = mid;    }    System.out.println(right);   }  } }
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;   }    } }
1	public class evenness {  public static void main(String[] args){   try{   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  int i, n, temp=1;  String str = "";  int[] arr;  int r;    while (temp!= '\n'){  temp = System.in.read();     str = str.concat(Character.toString((char)temp));  }  str = str.replaceAll("[^0-9]", "");  n = Integer.parseInt(str);  temp=1;  str="";    arr = new int[n];    for (i=0;i<n;i++){  while (temp!=' ' && temp!=-1){  temp = System.in.read();       str = str.concat(Character.toString((char)temp));  }  str = str.replaceAll("[^0-9]", "");  arr[i] = Integer.parseInt(str);  str="";  temp=1;  }    r=(arr[2]%2);  if ((arr[0]%2)==(arr[1]%2)){  r=(arr[0]%2);  }    for (i=0;i<n;i++){  if ((arr[i]%2)!=r){  System.out.println(i+1);  break;  }  }   }catch (Exception e){  System.out.println("OH NOES " + e); } } }
2	public class B {  public static void main(String[] args) {  InputReader in = new InputReader();  int n = in.nextInt();  int k = in.nextInt();   long numCandies = 1;  int turns = 1, add = 2;  while (numCandies < k) {  ++turns;  numCandies += add++;  }  int res = 0;  if (numCandies > k) {  turns += (numCandies-k);  res += (numCandies-k);  numCandies = k;  }   if (turns == n) {  System.out.println(res);  }  else {  while (turns != n) {   res += add;   turns += add++ + 1;  }  System.out.println(res);  }   }  static class InputReader {  public BufferedReader br;  public StringTokenizer st;   public InputReader() {  br = new BufferedReader(new InputStreamReader(System.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());  } } }
4	public class StringRepeat { static Scanner in = new Scanner( new BufferedReader( new InputStreamReader( System.in ) ) );  public static void main( String[] args ) {  String s = in.next();  int n = s.length(), ans = 0;  for( int i = 0; i < n; i++ ) for( int j = i+1; j < n; j++ )  {  int l = 0;  while( j+l<n && s.charAt(i+l)==s.charAt(j+l) ) l++;  ans = Math.max( ans, l );  }  System.out.println( ans ); } }
5	public class A { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni();  int[] a = new int[n];  for(int i = 0;i < n;i++){  a[i] = ni();  }  Arrays.sort(a);  if(a[n-1] > 1){  a[n-1] = 1;  Arrays.sort(a);  }else{  a[n-1] = 2;  }  for(int i = 0;i < n;i++){  if(i > 0)out.print(" ");  out.print(a[i]);  }  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 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)); } }
5	public class Blah {  public static void main(String args[])  { Scanner c = new Scanner(System.in); String number = c.nextLine(); int i = Integer.parseInt(number); if (i == 1)  {  System.out.println("NO");  return;  } String line = c.nextLine(); String[] arr = line.split(" "); int[] array = new int[i]; for (int j = 0; j < i; j++)  {  array[j] = Integer.parseInt(arr[j]);  }   int min = array[0]; int second = 0; boolean thing = false; for (int j = 0; j < i; j++)  {  if (!thing && array[j] > min)   {  second = array[j];  thing = true;   }  if (array[j] < min)   {  second = min;  min = array[j];  thing = true;   }  else if (thing && array[j] > min && array[j] < second)   second = array[j];  } if (!thing)  System.out.println("NO"); else  System.out.println(second); return;    } }
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);   } }
1	public class Spreadsheets implements Runnable { private Scanner in = new Scanner(System.in); private PrintWriter out = new PrintWriter(System.out); private String s, ans;  public static void main(String[] args) {  new Thread(new Spreadsheets()).start(); }  private void read() {  s = in.next(); }  private void solve() {  if (s.matches("R\\d+C\\d+")) {  s = s.replace('R', ' ').replace('C', ' ');  Scanner ss = new Scanner(s);  int r = ss.nextInt();  int c = ss.nextInt();  c--;  StringBuffer b = new StringBuffer();  int c26 = 26;  int cc = 0;  while (cc + c26 <= c) {   cc += c26;   c26 *= 26;  }  c -= cc;  while (c26 > 1) {   c26 /= 26;   b.append((char) (c / c26 + 'A'));   c %= c26;  }  ans = b.toString() + r;  } else {  int p = 0;  while (!Character.isDigit(s.charAt(p))) {   p++;  }  int c26 = 1;  int cc = 0;  for (int i = 0; i < p; i++) {   cc += c26;   c26 *= 26;  }  for (int i = 0; i < p; i++) {   c26 /= 26;   cc += c26 * (s.charAt(i) - 'A');  }  ans = "R" + s.substring(p) + "C" + cc;  } }  private void write() {  out.println(ans); }  public void run() {  int n = in.nextInt();  for (int i = 0; i < n; i++) {  read();  solve();  write();  }  out.close(); } }
0	public class z3 { public static boolean divch(int i,int a) { if (a>1000) return false; if ((a>0)&&(i%a==0)) return true; return (divch(i,a*10+4)||divch(i,a*10+7)); } public static void main(String[] args) throws IOException {  Scanner in = new Scanner(System.in);  System.out.println(divch(in.nextInt(),0)?"YES":"NO"); } }
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();}  } }
5	public class a { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  double w = in.nextDouble();  int tot = 2;  Interval[] houses = new Interval[n];  for(int i=0; i<n; i++) {  double center = in.nextDouble();  double wid = in.nextDouble();  houses[i] = new Interval(center-wid/2,center+wid/2);  }  Arrays.sort(houses);  for(int i=1; i<n; i++) {  double dist = houses[i].s - houses[i-1].e;  if(dist+1e-6 >= w) {   tot+=2;   if(Math.abs(w-dist) < 1e-6)   tot--;  }  }  System.out.println(tot); } } class Interval implements Comparable<Interval> { double s, e; Interval(double a, double b) {  s=a;  e=b; } public int compareTo(Interval i) {  return (int)Math.signum(s-i.s); } }
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" ); } }
5	public class d { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int N = in.nextInt();  int[] arr = new int[N];  for(int n=0;n<N;n++){  arr[n] = in.nextInt();  }   Wavelet waveyMcWaveFace = new Wavelet(arr);   BigInteger bigSum = BigInteger.ZERO;  for(int n=0;n<N;n++){            long amtPlus = arr[n] * (long)(waveyMcWaveFace.numValsBtwn(1, arr[n] - 2, 0, n)      + waveyMcWaveFace.numValsBtwn(arr[n] + 2, 2147483647, 0, n));        long amtMinus = waveyMcWaveFace.sumOfValsBtwn(1, arr[n] - 2, 0, n)    + waveyMcWaveFace.sumOfValsBtwn(arr[n] + 2, 2147483647, 0, n);     bigSum = bigSum.add(new BigInteger(""+(amtPlus - amtMinus)));  }   System.out.println(bigSum); } static class Wavelet{  int l = 2147483647, h = -2147483648;  int[] arr, ldex, hdex;  long[] sum;  Wavelet low = null, high = null;  Wavelet(int[] arr){  this.arr = arr;  for(int i : arr){   l = Math.min(l, i);   h = Math.max(h, i);  }  ldex = new int[arr.length + 1];  hdex = new int[arr.length + 1];  sum = new long[arr.length + 1];  int mid = l + (h - l) / 2;  for(int n = 0; n < arr.length; n++){   sum[n+1] = sum[n] + arr[n];   if(arr[n] > mid){   ldex[n+1] = ldex[n];   hdex[n+1] = hdex[n] + 1;   }   else{   ldex[n+1] = ldex[n] + 1;   hdex[n+1] = hdex[n];   }  }  if(l == h) return;  int[] larr = new int[ldex[arr.length]];  int[] harr = new int[hdex[arr.length]];  for(int n=0;n<arr.length;n++){   if(hdex[n] == hdex[n+1]){   larr[ldex[n]] = arr[n];   }   else{   harr[hdex[n]] = arr[n];   }  }  low = new Wavelet(larr);  high = new Wavelet(harr);  }   int kthLowest(int k, int ll, int rr){  if(l == h){   return arr[ll + k-1];  }  if(ldex[rr] - ldex[ll] >= k){   return low.kthLowest(k, ldex[ll], ldex[rr]);  }  return high.kthLowest(k - ldex[rr] + ldex[ll], hdex[ll], hdex[rr]);  }   int numValsBtwn(int lo, int hi, int ll, int rr){  if(hi < lo) return 0;  if(lo <= l && h <= hi){   return rr - ll;  }  if(l == h) return 0;  if(hi < high.l){   return low.numValsBtwn(lo, hi, ldex[ll], ldex[rr]);  }  if(low.h < lo){   return high.numValsBtwn(lo, hi, hdex[ll], hdex[rr]);  }  return low.numValsBtwn(lo, hi, ldex[ll], ldex[rr])   + high.numValsBtwn(lo, hi, hdex[ll], hdex[rr]);  }   long sumOfValsBtwn(int lo, int hi, int ll, int rr){  if(lo <= l && h <= hi){   return sum[rr] - sum[ll];  }  if(l == h) return 0;  if(hi < high.l){   return low.sumOfValsBtwn(lo, hi, ldex[ll], ldex[rr]);  }  if(low.h < lo){   return high.sumOfValsBtwn(lo, hi, hdex[ll], hdex[rr]);  }  return low.sumOfValsBtwn(lo, hi, ldex[ll], ldex[rr])   + high.sumOfValsBtwn(lo, hi, hdex[ll], hdex[rr]);  } } }
6	public class ElongatedMatrix2 {  public static void main(String[] args) {   FastScanner scanner = new FastScanner();   int N = scanner.nextInt();   int M = scanner.nextInt();   int[][] arr = new int[N][M];   for(int i = 0; i < N; i++) {    for(int j = 0; j < M; j++) {     arr[i][j] = scanner.nextInt();    }   }   int[][] distRow = new int[N][N];   int[][] distTop = new int[N][N];       for(int i = 0; i < N; i++) {    for(int j = i+1; j < N; j++) {     int curMin = Integer.MAX_VALUE;     for(int k = 0; k < M; k++) {      curMin = Math.min(curMin, Math.abs(arr[i][k] - arr[j][k]));     }     distRow[i][j] = distRow[j][i] = curMin;    }   }     for(int i = 0; i < N; i++) {    for(int j = 0; j < N; j++) {     int curMin = Integer.MAX_VALUE;     for(int k = 0; k+1 < M; k++) {      curMin = Math.min(curMin, Math.abs(arr[i][k] - arr[j][k+1]));     }     distTop[i][j] = curMin;    }   }   int maxMask = 1 << N;   int[][][] dp = new int[maxMask][N][N];   for(int i = 0; i < maxMask; i++) {    for(int j = 0; j < N; j++) {     Arrays.fill(dp[i][j], Integer.MAX_VALUE);    }   }   for(int mask = 1; mask < maxMask; mask++) {    for (int j = 0; j < N; j++) {     if ((mask & ( 1 << j)) == 0) continue;     for(int k = 0; k < N; k++) {      if ((mask &(1 << k)) == 0) continue;      if (j == k && mask - (1 << k) != 0) continue;      for (int i = 0; i < N; i++) {       if ((mask & (1 << i)) > 0) continue;       int curMask = mask | (1 << i);       if (dp[curMask][i][k] != Integer.MAX_VALUE)        dp[curMask][i][k] = Math.max(dp[curMask][i][k], Math.min(dp[mask][j][k], distRow[i][j]));       else        dp[curMask][i][k] = Math.min(dp[mask][j][k], distRow[i][j]);      }     }    }   }   maxMask--;   int max = 0;   for(int i= 0; i < N; i++) {    for(int j = 0; j < N; j++) {     if (i==j && N != 1) continue;     max = Math.max(max, Math.min(dp[maxMask][i][j], distTop[i][j]));    }   }   System.out.println(max);  }  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;   }  } }
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); } }
5	public class Replacement { public static void main(String[] args) throws IOException {   BufferedReader r=new BufferedReader(new InputStreamReader(System.in));  String s=r.readLine();  int n=new Integer(s);  int[]arr=new int[n];  String[]sp=r.readLine().split("[ ]+");  for (int i = 0; i < sp.length; i++) {  arr[i]=new Integer(sp[i]);  }  Arrays.sort(arr);  if(arr[arr.length-1]==1){  arr[arr.length-1]=2;  Arrays.sort(arr);  for (int i = 0; i < n; i++) {   if(i==n-1){   System.out.println(arr[i]);   }else   System.out.print(arr[i]+" ");  }  return;  }  arr[arr.length-1]=1;  Arrays.sort(arr);  for (int i = 0; i < n; i++) {  if(i==n-1){   System.out.println(arr[i]);  }else  System.out.print(arr[i]+" ");  } } }
4	public class A { String line; StringTokenizer inputParser; BufferedReader is; FileInputStream fstream; DataInputStream in;  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);  }   }  int NextInt() {  String n = inputParser.nextToken();  int val = Integer.parseInt(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];  A a = new A(filePath); }  public A(String inputFile) {  openInput(inputFile);   readNextLine();  String s=line;  int ret=0;  for(int i=0; i<s.length(); i++)  {  for(int j=i+1; j<s.length()+1; j++)  {   String a=s.substring(i, j);   if(s.indexOf(a, i+1)>-1)ret=Math.max(ret, a.length());     }  }  System.out.println(ret); }  }
4	public class Main {  static PrintWriter pw;  static _Scanner sc;  public static void main(String[] args) throws Exception {   sc = new _Scanner(System.in);   pw = new PrintWriter(System.out);        int t = 1;   while (t-- > 0) {    solve();   }   pw.flush();    }  private static void solve() throws Exception {   int n = sc.nextInt(), m = sc.nextInt(), k = sc.nextInt();   int[][] h = new int[n][m - 1];   int[][] v = new int[n - 1][m];   for (int i = 0; i < n; ++i) {    for (int j = 0; j < m - 1; ++j) {     h[i][j] = sc.nextInt();    }   }   for (int i = 0; i < n - 1; ++i) {    for (int j = 0; j < m; ++j) {     v[i][j] = sc.nextInt();    }   }   if (k % 2 == 1) {    for (int i = 0; i < n; ++i) {     for (int j = 0; j < m; ++j) {      if (j > 0) {       pw.print(" ");      }      pw.print(-1);     }     pw.println();    }    return;   }   k = k / 2;   long[][] d = new long[n][m];   for (int ki = 0; ki < k; ++ki) {    long[][] dk = new long[n][m];    for (int i = 0; i < n; ++i) {     for (int j = 0; j < m; ++j) {      long val = Integer.MAX_VALUE;      if (j < m - 1) {       val = Math.min(val, d[i][j + 1] + h[i][j]);      }      if (i < n - 1) {       val = Math.min(val, d[i + 1][j] + v[i][j]);      }      if (j > 0) {       val = Math.min(val, d[i][j - 1] + h[i][j - 1]);      }      if (i > 0) {       val = Math.min(val, d[i - 1][j] + v[i - 1][j]);      }      dk[i][j] = val;     }    }    d = dk;   }   for (int i = 0; i < n; ++i) {    for (int j = 0; j < m; ++j) {     if (j > 0) {      pw.print(" ");     }     pw.print(d[i][j] * 2);    }    pw.println();   }  }  static class Shuffle {   static void run(int[] in) {    for (int i = 0; i < in.length; i++) {     int idx = (int) (Math.random() * in.length);     int tmp = in[i];     in[i] = in[idx];     in[idx] = tmp;    }   }   static void run(long[] in) {    for (int i = 0; i < in.length; i++) {     int idx = (int) (Math.random() * in.length);     long tmp = in[i];     in[i] = in[idx];     in[idx] = tmp;    }   }   static <T> void run(List<T> in) {    for (int i = 0; i < in.size(); i++) {     int idx = (int) (Math.random() * in.size());     T tmp = in.get(i);     in.set(i, in.get(idx));     in.set(idx, tmp);    }   }  }  static class _Scanner {   StringTokenizer st;   BufferedReader br;   _Scanner(InputStream system) {    br = new BufferedReader(new InputStreamReader(system));   }   _Scanner(String file) throws Exception {    br = new BufferedReader(new FileReader(file));   }   String nextToken() throws IOException {    while (st == null || !st.hasMoreTokens())     st = new StringTokenizer(br.readLine());    return st.nextToken();   }   int[] intArr(int n) throws IOException {    int[] in = new int[n];    for (int i = 0; i < n; i++) in[i] = nextInt();    return in;   }   long[] longArr(int n) throws IOException {    long[] in = new long[n];    for (int i = 0; i < n; i++) in[i] = nextLong();    return in;   }   int[] intArrSorted(int n) throws IOException {    int[] in = new int[n];    for (int i = 0; i < n; i++) in[i] = nextInt();    Shuffle.run(in);    Arrays.sort(in);    return in;   }   long[] longArrSorted(int n) throws IOException {    long[] in = new long[n];    for (int i = 0; i < n; i++) in[i] = nextLong();    Shuffle.run(in);    Arrays.sort(in);    return in;   }   Integer[] IntegerArr(int n) throws IOException {    Integer[] in = new Integer[n];    for (int i = 0; i < n; i++) in[i] = nextInt();    return in;   }   Long[] LongArr(int n) throws IOException {    Long[] in = new Long[n];    for (int i = 0; i < n; i++) in[i] = nextLong();    return in;   }   String nextLine() throws IOException {    return br.readLine();   }   int nextInt() throws IOException {    return Integer.parseInt(nextToken());   }   double nextDouble() throws IOException {    return Double.parseDouble(nextToken());   }   char nextChar() throws IOException {    return nextToken().charAt(0);   }   long nextLong() throws IOException {    return Long.parseLong(nextToken());   }   boolean ready() throws IOException {    return br.ready();   }  } }
4	public class Main {  static BufferedReader reader   = new BufferedReader(new InputStreamReader(System.in));    static StringBuilder out = new StringBuilder();  public static void main(String[] args){   solve();   return;  }    static int nextInt(){   return Integer.parseInt(nextLine());  }  static long nextLong(){   return Long.parseLong(nextLine());  }  static int[] nextIntArray(){   String[] inp = nextLine().split("\\s+");   int[] ary = new int[inp.length];   for (int i = 0; i < ary.length; i++){    ary[i] = Integer.parseInt(inp[i]);   }   return ary;  }  static int[] nextIntArrayFrom1(){   String[] inp = nextLine().split("\\s+");   int[] ary = new int[inp.length + 1];   for (int i = 0; i < inp.length; i++){    ary[i+1] = Integer.parseInt(inp[i]);   }   return ary;  }  static long[] nextLongArray(){   String[] inp = nextLine().split("\\s+");   long[] ary = new long[inp.length];   for (int i = 0; i < inp.length; i++){    ary[i] = Long.parseLong(inp[i]);   }   return ary;  }  static long[] nextLongArrayFrom1(){   String[] inp = nextLine().split("\\s+");   long[] ary = new long[inp.length + 1];   for (int i = 0; i < inp.length; i++){    ary[i+1] = Long.parseLong(inp[i]);   }   return ary;  }  static String nextLine(){   try {    return reader.readLine().trim();   } catch (Exception e){}   return null;  }  static void solve(){   String str = nextLine();   int max=0;   int index=0;   for(int i=0;i<str.length();i++){    for(int j=i+1;j<str.length();j++){     if(str.charAt(i)==str.charAt(j)){      int count=1;      while(true){       if(str.length()<=i+count || str.length()<=j+count || str.charAt(i+count)!=str.charAt(j+count) )        break;       count++;      }      if(max<count){       max=count;       index=i;      }     }    }   }   System.out.println(max);   return;  } }
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; } }
6	public class Main { public static void main(String[]args) throws Exception {  int n=ni();  double ke=ni();  boolean[][]a=new boolean[n][n];  for(int i=0; i<n; i++)   for(int j=0; j<n; j++)   a[i][j]=ni()==0;  int left=n/2;  int[]ldp=new int[1<<left];  int[]rdp=new int[1<<(n-left)];  int[]pow=new int[25];  pow[0]=1;  for(int i=1; i<25; i++)   pow[i]=pow[i-1]<<1;  for(int i=0; i<pow[left]; i++)   ou:for(int j=0; j<left; j++)   if((i>>j)%2==0)   {    int te=i;    for(int k=0; te>0; k++,te>>=1)    if(a[j][k]&&(te&1)!=0)    {     ldp[i+pow[j]]=max(ldp[i+pow[j]],ldp[i]);     continue ou;    }    ldp[i+pow[j]]=max(ldp[i+pow[j]],ldp[i]+1);   }  int right=n-left;  for(int i=0; i<pow[right]; i++)   ou:for(int j=0; j<right; j++)   if((i>>j)%2==0)   {    int lul=j+left;    int te=i;    for(int k=left; te>0; k++,te>>=1)    if(a[lul][k]&&(te&1)!=0)    {     rdp[i+pow[j]]=max(rdp[i+pow[j]],rdp[i]);     continue ou;    }    rdp[i+pow[j]]=max(rdp[i+pow[j]],rdp[i]+1);   }  int maxi=0;  for(int i=0; i<pow[left]; i++)  {   int lol=0;   int te=i;   for(int j=0; te>0; j++,te>>=1)   if((te&1)!=0)    for(int k=0; k<right; k++)    if(a[j][k+left])     lol|=pow[k];   maxi=max(maxi,ldp[i]+rdp[pow[right]-1-lol]);  }  pr((ke*ke*(maxi-1))/(2*maxi));  System.out.println(output); }     static final int mod=1000_000_007; static final double eps=1e-7; static final long inf=1000_000_000_000_000_000L; static class pair {  int a,b;  pair(){}  pair(int c,int d){a=c;b=d;}  @Override  public int hashCode()  {  return (a+" "+b).hashCode();  }  public boolean equals(Object c)  {  return (a==(((pair)c).a)&&b==(((pair)c).b));  } } public static void sort(int[][]a) {  Arrays.sort(a, new Comparator<int[]>()   {  public int compare(int[]a,int[]b)  {   if(a[0]>b[0])   return 1;   if(a[0]<b[0])   return -1;   return 0;  }   }); } static interface combiner {  public int combine(int a, int b); } static void pr(Object a){output.append(a+"\n");} static void pr(){output.append("\n");} static void p(Object a){output.append(a);} static void pra(int[]a){for(int i:a)output.append(i+" ");output.append("\n");} static void pra(long[]a){for(long i:a)output.append(i+" ");output.append("\n");} static void pra(String[]a){for(String i:a)output.append(i+" ");output.append("\n");} static void pra(double[]a){for(double i:a)output.append(i+" ");output.append("\n");} static void sop(Object a){System.out.println(a);} static void flush(){System.out.print(output);output=new StringBuilder();} static int ni(){return Integer.parseInt(in.next());} static long nl(){return Long.parseLong(in.next());} static String ns(){return in.next();} static double nd(){return Double.parseDouble(in.next());} static int[] nia(int n){int a[]=new int[n];for(int i=0; i<n; i++)a[i]=ni();return a;} static int[] pnia(int n){int a[]=new int[n+1];for(int i=1; i<=n; i++)a[i]=ni();return a;} static long[] nla(int n){long a[]=new long[n];for(int i=0; i<n; i++)a[i]=nl();return a;} static String[] nsa(int n){String a[]=new String[n];for(int i=0; i<n; i++)a[i]=ns();return a;} static double[] nda(int n){double a[]=new double[n];for(int i=0; i<n; i++)a[i]=nd();return a;} static Reader in=new Reader(); static StringBuilder output=new StringBuilder(); static Random rn=new Random(); static void reverse(int[]a){for(int i=0; i<a.length/2; i++){a[i]^=a[a.length-i-1];a[a.length-i-1]^=a[i];a[i]^=a[a.length-i-1];}} static int log2n(long a) {  int te=0;  while(a>0)  {  a>>=1;  ++te;  }  return te; } static class vectorl implements Iterable<Long> {  long a[];  int size;  vectorl(){a=new long[10];size=0;}  vectorl(int n){a=new long[n];size=0;}  public void add(long b){if(++size==a.length)a=Arrays.copyOf(a, 2*size);a[size-1]=b;}  public void sort(){Arrays.sort(a, 0, size);}  public void sort(int l, int r){Arrays.sort(a, l, r);}  @Override  public Iterator<Long> iterator() {  Iterator<Long> hola=new Iterator<Long>()   {   int cur=0;    @Override    public boolean hasNext() {    return cur<size;    }    @Override    public Long next() {    return a[cur++];    }     };  return hola;  } } static class vector implements Iterable<Integer> {  int a[],size;  vector(){a=new int[10];}  vector(int n){a=new int[n];}  public void add(int b){if(++size==a.length)a=Arrays.copyOf(a, 2*size);a[size-1]=b;}  public void sort(){Arrays.sort(a, 0, size);}  public void sort(int l, int r){Arrays.sort(a, l, r);}  @Override  public Iterator<Integer> iterator() {  Iterator<Integer> hola=new Iterator<Integer>()   {   int cur=0;    @Override    public boolean hasNext() {    return cur<size;    }    @Override    public Integer next() {    return a[cur++];    }     };  return hola;  } } static void exit(){System.out.print(output);System.exit(0);} static int min(int... a){int min=a[0];for(int i:a)min=Math.min(min, i);return min;} static int max(int... a){int max=a[0];for(int i:a)max=Math.max(max, i);return max;}  static int gcd(int... a){int gcd=a[0];for(int i:a)gcd=gcd(gcd, i);return gcd;}  static long min(long... a){long min=a[0];for(long i:a)min=Math.min(min, i);return min;} static long max(long... a){long max=a[0];for(long i:a)max=Math.max(max, i);return max;}  static long gcd(long... a){long gcd=a[0];for(long i:a)gcd=gcd(gcd, i);return gcd;}  static String pr(String a, long b){String c="";while(b>0){if(b%2==1)c=c.concat(a);a=a.concat(a);b>>=1;}return c;} static long powm(long a, long b, long mod2){long an=1;long c=a%mod2;while(b>0){if(b%2==1)an=(an*c)%mod2;c=(c*c)%mod2;b>>=1;}return an;} static long pow(long a, long b){long an=1;long c=a;while(b>0){if(b%2==1)an*=c;c*=c;b>>=1;}return an;} 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 class Reader{   public BufferedReader reader;   public StringTokenizer tokenizer;   public Reader() {    reader = new BufferedReader(new InputStreamReader(System.in));    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();   }  } }
1	public class A { public static int sol(String n,String p) {  int sol=0;  for(int i=0;i<n.length();i++)  {  if(n.charAt(i)!=p.charAt(i))   sol++;  }  return sol; } public static void main(String[] args) throws IOException  {  Scanner sc = new Scanner();  PrintWriter pw = new PrintWriter(System.out);  int n=sc.nextInt();  ArrayList<String>p=new ArrayList<>();  ArrayList<String>ne=new ArrayList<>();  for(int i=0;i<n;i++)  p.add(sc.nextLine());  for(int i=0;i<n;i++)  {   String t=sc.nextLine();  if(p.contains(t))   p.remove(t);  else   ne.add(t);  }  Collections.sort(p);  Collections.sort(ne);  int ans=0;  for(int i=0;i<ne.size();i++)  {  ans+=sol(ne.get(i),p.get(i));  }  System.out.println(ans);  pw.close();  } static class Scanner {  BufferedReader br;  StringTokenizer st;   Scanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }   String next() throws IOException {  while (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());  }   String nextLine() throws IOException {  return br.readLine();  }  boolean hasnext() throws IOException{  return br.ready();  }   } }
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");   }  } }
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));  } } }
0	public class A {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   long A = in.nextLong();   long B = in.nextLong();   System.out.println(f(A,B));  }  static long f(long A, long B) {   if(A==0) return 0;   if(A < B) return f(B,A);   else {    long k = A/B;    return k+f(A-B*k, B);   }  } }
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(); }  }
4	public class P35C {  int n, m;  int [][]fire;  public P35C() throws FileNotFoundException {   Scanner in = new Scanner(new FileReader("input.txt"));   n = in.nextInt();   m = in.nextInt();   int k = in.nextInt();   fire = new int[k][2];   for (int i = 0; i < k; i++){    fire[i][0] = in.nextInt();    fire[i][1] = in.nextInt();   }   in.close();     int []last = new int[2];   int lastBurn = -1;   for (int i = 1; i <= n; i++){    for (int j = 1; j <= m; j++){     int burn = Integer.MAX_VALUE;     for (int l = 0; l < k; l++){      int burnAux = dist(i, j, fire[l][0], fire[l][1]);      burn = Math.min(burn, burnAux);     }     if(burn >= lastBurn){      lastBurn = burn;      last[0] = i;      last[1] = j;         }    }   }      PrintStream out = new java.io.PrintStream( "output.txt" );   out.print(last[0] + " " + last[1]);   out.close();  }    int dist(int x1, int y1, int x2, int y2){   return Math.abs(x2 - x1) + Math.abs(y2 - y1);  }   public static void main (String []args) throws FileNotFoundException{   new P35C();  } }
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"); } }
5	public class A111_div2 {   static boolean test = false; static String testDataFile = "testdata.txt"; static String feedFile = "feed.txt"; CompetitionType type = CompetitionType.CF; private static String ENDL = "\n";   private void solve() throws Throwable {  int n = iread();   int[] vals = new int[n];  double tot = 0;  for (int i = 0; i < n; i++) {  int value = iread();  vals[i] = value;  tot += value;  }   Arrays.sort(vals);  int pick = 0;  int worth = 0;  for (int i = vals.length - 1; i >= 0; i--) {  worth += vals[i];  pick ++;  if(worth > tot/2.0d){   break;  }  }   out.write(pick + ENDL);  out.flush(); }  public int iread() throws Exception {  return Integer.parseInt(wread()); }  public double dread() throws Exception {  return Double.parseDouble(wread()); }  public long lread() throws Exception {  return Long.parseLong(wread()); }  public String wread() 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) throws Throwable {  if (test) {   BufferedReader testdataReader = new BufferedReader(new FileReader(testDataFile));  String readLine = testdataReader.readLine();  int casenr = 0;  out: while (true) {   BufferedWriter w = new BufferedWriter(new FileWriter(feedFile));   if (!readLine.equals("input")) {   break;   }   while (true) {   readLine = testdataReader.readLine();   if (readLine.equals("output")) {    break;   }   w.write(readLine + "\n");   }   w.close();   System.out.println("Answer on case " + (++casenr) + ": ");   new A111_div2().solve();   System.out.println("Expected answer: ");   while (true) {   readLine = testdataReader.readLine();    if (readLine == null) {    break out;   }   if (readLine.equals("input")) {    break;   }   System.out.println(readLine);   }   System.out.println("----------------");  }  testdataReader.close();  } else {   new A111_div2().solve();  }  out.close(); }  public A111_div2() throws Throwable {  if (test) {  in = new BufferedReader(new FileReader(new File(feedFile)));  } }  InputStreamReader inp = new InputStreamReader(System.in); BufferedReader in = new BufferedReader(inp); static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));  enum CompetitionType {  CF, OTHER }; }
2	public class CFContest {  public static void main(String[] args) throws Exception {   boolean local = System.getProperty("ONLINE_JUDGE") == null;   boolean async = false;   Charset charset = Charset.forName("ascii");   FastIO io = local ? new FastIO(new FileInputStream("D:\\DATABASE\\TESTCASE\\Code.in"), System.out, charset) : new FastIO(System.in, System.out, charset);   Task task = new Task(io, new Debug(local));   if (async) {    Thread t = new Thread(null, task, "dalt", 1 << 27);    t.setPriority(Thread.MAX_PRIORITY);    t.start();    t.join();   } else {    task.run();   }   if (local) {    io.cache.append("\n\n--memory -- \n" + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20) + "M");   }   io.flush();  }  public static class Task implements Runnable {   final FastIO io;   final Debug debug;   int inf = (int) 1e8;   public Task(FastIO io, Debug debug) {    this.io = io;    this.debug = debug;   }   @Override   public void run() {    solve();   }   public void solve() {    int n = io.readInt();    int k = io.readInt();    int l = 0;    int r = n;    while (l < r) {     int m = (l + r + 1) >> 1;     if (when(n, m) < k) {      r = m - 1;     } else {      l = m;     }    }    io.cache.append(l);   }   public long when(int n, int t) {    long put = n - t;    return (put + 1) * put / 2 - t;   }  }  public static class FastIO {   public final StringBuilder cache = new StringBuilder();   private final InputStream is;   private final OutputStream os;   private final Charset charset;   private StringBuilder defaultStringBuf = new StringBuilder(1 << 8);   private byte[] buf = new byte[1 << 13];   private int bufLen;   private int bufOffset;   private int next;   public FastIO(InputStream is, OutputStream os, Charset charset) {    this.is = is;    this.os = os;    this.charset = charset;   }   public FastIO(InputStream is, OutputStream os) {    this(is, os, Charset.forName("ascii"));   }   private int read() {    while (bufLen == bufOffset) {     bufOffset = 0;     try {      bufLen = is.read(buf);     } catch (IOException e) {      throw new RuntimeException(e);     }     if (bufLen == -1) {      return -1;     }    }    return buf[bufOffset++];   }   public void skipBlank() {    while (next >= 0 && next <= 32) {     next = read();    }   }   public int readInt() {    int sign = 1;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+' ? 1 : -1;     next = read();    }    int val = 0;    if (sign == 1) {     while (next >= '0' && next <= '9') {      val = val * 10 + next - '0';      next = read();     }    } else {     while (next >= '0' && next <= '9') {      val = val * 10 - next + '0';      next = read();     }    }    return val;   }   public long readLong() {    int sign = 1;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+' ? 1 : -1;     next = read();    }    long val = 0;    if (sign == 1) {     while (next >= '0' && next <= '9') {      val = val * 10 + next - '0';      next = read();     }    } else {     while (next >= '0' && next <= '9') {      val = val * 10 - next + '0';      next = read();     }    }    return val;   }   public double readDouble() {    boolean sign = true;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+';     next = read();    }    long val = 0;    while (next >= '0' && next <= '9') {     val = val * 10 + next - '0';     next = read();    }    if (next != '.') {     return sign ? val : -val;    }    next = read();    long radix = 1;    long point = 0;    while (next >= '0' && next <= '9') {     point = point * 10 + next - '0';     radix = radix * 10;     next = read();    }    double result = val + (double) point / radix;    return sign ? result : -result;   }   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);   }   public int readLine(char[] data, int offset) {    int originalOffset = offset;    while (next != -1 && next != '\n') {     data[offset++] = (char) next;     next = read();    }    return offset - originalOffset;   }   public int readString(char[] data, int offset) {    skipBlank();    int originalOffset = offset;    while (next > 32) {     data[offset++] = (char) next;     next = read();    }    return offset - originalOffset;   }   public int readString(byte[] data, int offset) {    skipBlank();    int originalOffset = offset;    while (next > 32) {     data[offset++] = (byte) next;     next = read();    }    return offset - originalOffset;   }   public char readChar() {    skipBlank();    char c = (char) next;    next = read();    return c;   }   public void flush() {    try {     os.write(cache.toString().getBytes(charset));     os.flush();     cache.setLength(0);    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public boolean hasMore() {    skipBlank();    return next != -1;   }  }  public static class Debug {   private boolean allowDebug;   public Debug(boolean allowDebug) {    this.allowDebug = allowDebug;   }   public void assertTrue(boolean flag) {    if (!allowDebug) {     return;    }    if (!flag) {     fail();    }   }   public void fail() {    throw new RuntimeException();   }   public void assertFalse(boolean flag) {    if (!allowDebug) {     return;    }    if (flag) {     fail();    }   }   private void outputName(String name) {    System.out.print(name + " = ");   }   public void debug(String name, int x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, long x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, double x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, int[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, long[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, double[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, Object x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, Object... x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.deepToString(x));   }  } }
1	public class Main {  Scanner in; PrintWriter out;  boolean isFirst(String line){  int pos = 0;  while( pos<line.length() && Character.isLetter(line.charAt(pos))){  pos++;  }  while( pos<line.length() && Character.isDigit(line.charAt(pos))){  pos++;  }  return pos!=line.length();   }  void solve() {  int n = in.nextInt();  in.nextLine();  for (int i = 1; i<=n; i++){  String line = in.nextLine();  line = line.toUpperCase();  if (isFirst(line)){   int pos = 1;   long row = 0;   while(Character.isDigit(line.charAt(pos))){   row*=10;   row+=line.charAt(pos)-'0';   pos++;   }   pos++;   long col = 0;   while(pos<line.length() && Character.isDigit(line.charAt(pos))){   col*=10;   col+=line.charAt(pos)-'0';   pos++;   }   StringBuilder sb = new StringBuilder();   while(col>0){   sb.append((char)('A'+((col-1)%26)));   col--;   col/=26;   }   sb = sb.reverse();   out.print(sb);   out.println(row);     }else{     int pos = 0;   long col = 0;   while( pos<line.length() && Character.isLetter(line.charAt(pos))){   col*=26;   col+=line.charAt(pos)-'A'+1;   pos++;   }   long row = 0;   while(pos<line.length() && Character.isDigit(line.charAt(pos))){   row*=10;   row+=line.charAt(pos)-'0';   pos++;   }   out.println("R"+row+"C"+col);  }  }  }  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();  } }
4	public class Main{ public static void main(String[] args) throws Exception {  new Main().doWork(); } void doWork() throws Exception{  BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));   String text = reader.readLine().trim();  int out = 0;  for(int i=0;i<text.length();i++){  for(int j=i+1;j<text.length();j++){   for(int len = out+1;len+j<=text.length();len++){   if(text.substring(i,i+len).compareTo(text.substring(j,j+len))==0){    out = len;   }   }  }  }  String buf = ""+out;  writer.write(buf,0,buf.length());  writer.newLine();  writer.flush();  writer.close();  reader.close(); } String process(){  return "1"; } int[] toIntArray(String line){  String[] p = line.split("[ ]+");  int[] out = new int[p.length];  for(int i=0;i<p.length;i++) out[i] = Integer.valueOf(p[i]);  return out; } }
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();  } }
4	public class Main {    public static void main(String[] args) {   Scanner scr = new Scanner(System.in);     String str = scr.nextLine();   int len =0;     for(int i=0;i<(str.length()-1);i++)   {    for(int j=i+1;j<str.length();j++)    {     String sub = str.substring(i, j);         int ind = str.indexOf(sub, i+1);     if(ind!=-1 && sub.length()>len )     {      len = sub.length();     }    }   }   System.out.println(len);    } }
3	public class Main {  static long[][] c ;  static long[] arr;  static long n , m , k;  static long dp[][][];  public static void main(String[] args) throws IOException {   Reader.init(System.in);   int n = Reader.nextInt();   int[] arr = new int[n];   int[] mark = new int[n];   for (int i = 0 ; i < n ; i++){    arr[i] = Reader.nextInt();   }   Arrays.sort(arr);   int[] v = new int[n];   int ans = 0;   for (int i = 0 ; i < n ; i++){    if (v[i]==0){     for (int j = i ; j < n ; j++){      if (arr[j]%arr[i]==0){       v[j] = arr[i];      }     }    }   }   TreeSet<Integer> s = new TreeSet<>();   for (int i = 0 ; i < n ;i++){    s.add(v[i]);   }   System.out.println(s.size());       }   public static void sortbyColumn_asc(int arr[][], int col)  {     Arrays.sort(arr, new Comparator<int[]>() {    @Override       public int compare(final int[] entry1,         final int[] entry2) {              if (entry1[col] > entry2[col])      return 1;     else      return -1;    }   });  }  public static void sortbyColumn_dsc(int arr[][], int col)  {     Arrays.sort(arr, new Comparator<int[]>() {    @Override       public int compare(final int[] entry1,         final int[] entry2) {              if (entry1[col] > entry2[col])      return -1;     else      return 1;    }   });  }  static void swap(char[] arr , int i , int j){   char tmp = arr[i];   arr[i] = arr[j];   arr[j] = tmp;  }  static void swap(int[] arr , int i , int j){   int tmp = arr[i];   arr[i] = arr[j];   arr[j] = tmp;  }   } class Node implements Comparable<Node>{  int a , b;  Node(int a , int b){   this.a = a;   this.b = b;  }  public int compareTo(Node o) {   if (this.a == o.a){    return this.b - o.b;   }   return this.a - o.a;  } } class Edge implements Comparable<Edge>{  int x , y , w;  public Edge(int x, int y, int w) {   this.x = x;   this.y = y;   this.w = w;  }  @Override  public int compareTo(Edge o) {   return this.w - o.w;  } } 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() );  } } class MergeSort {      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++;   }  }     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 printArray(int arr[])  {   int n = arr.length;   for (int i=0; i<n; ++i)    System.out.print(arr[i] + " ");   System.out.println();  }   }
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 N = Integer.parseInt(input[0]), M = Integer.parseInt(input[1]);  boolean[][] connected = new boolean[N + 1][N];  long[][] walks = new long[1 << N][N];  long res = 0;   for(int i = 0; i < M; i++){  input = kek.readLine().split(" ");  int A = Integer.parseInt(input[0]) - 1, B = Integer.parseInt(input[1]) - 1;  connected[A][B] = connected[B][A] = true;  }   for(int i = 0; i < N; i++){  walks[1 << i][i] = 1;  }   for(int i = 1; i < 1 << N; i++){  int temp = (int) (Math.log(i & -(i)) / 0.6931471805599453);  for(int j = 0; j < N; j++){   if(((1 << j) & i) > 0 && j != temp){   for(int k = 0; k < N; k++){    if(connected[k][j]){    walks[i][j] += walks[i ^ (1 << j)][k];    }   }      int count = 0, track = i;   while(track > 0){    if(track % 2 == 1){    count++;    }    track /= 2;   }         if(count >= 3 && connected[temp][j]){    res += walks[i][j];   }   }  }  }   outkek.println(res / 2);  kek.close();  outkek.close(); }  }
0	public class c { public static void main(String[] args) {  Scanner input = new Scanner(System.in);  long a = input.nextLong(), b = input.nextLong();  System.out.println(gcd(a, b)); } static long gcd(long a, long b) {  if(b==1) return a;  if(a==1) return b;  if(a>b) return a/b + gcd(b, a%b);  return b/a + gcd(a, b%a); } }
0	public class A {  static void solve() throws IOException {  long a = nextLong(), b = nextLong();  long answer = get(a, b);  out.println(answer); }  private static long get(long p, long q) {  if (p == 0) {  return 0;  }  if (q == 1) {  return p;  }  if (p == 1) {  return q;  }  if (p >= q) {  return p / q + get(p % q, q);  }  return q / p + get(p, q % p); }  static BufferedReader br; static StringTokenizer st; static PrintWriter out;  public static void main(String[] args) throws IOException {  InputStream input = System.in;  PrintStream output = System.out;  File file = new File("a.in");  if (file.exists() && file.canRead()) {  input = new FileInputStream(file);  }  br = new BufferedReader(new InputStreamReader(input));  out = new PrintWriter(output);  solve();  out.close(); }  static long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  static double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  static int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  static String nextToken() throws IOException {  while (st == null || !st.hasMoreTokens()) {  String line = br.readLine();  if (line == null) {   return null;  }  st = new StringTokenizer(line);  }  return st.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);  }   } }
2	public class Main {  static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));  static StringTokenizer tok;  static boolean hasNext()  {   while(tok==null||!tok.hasMoreTokens())    try{     tok=new StringTokenizer(in.readLine());    }    catch(Exception e){     return false;    }   return true;  }  static String next()  {   hasNext();   return tok.nextToken();  }  static long nextLong()  {   return Long.parseLong(next());  }  static int nextInt()  {   return Integer.parseInt(next());  }  static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));  public static void main(String args []){   long x = nextLong();   long a = 2, b = nextLong(), c = 1000000000+7;   long res = 1;   a %= c;   if (x==0){    out.println(0);    out.flush();    return;   }   for (; b != 0; b /= 2) {    if (b % 2 == 1)     res = (res * a) % c;    a = (a * a) % c;   }   BigInteger r = new BigInteger(String.valueOf(res));   BigInteger y = new BigInteger(String.valueOf(x));   BigInteger ans = y.multiply(new BigInteger("2")).subtract(new BigInteger("1")).multiply(r).add(new BigInteger("1")).mod(new BigInteger(String.valueOf(c)));   out.println(ans);   out.flush();  } }
2	public class B2 {    public static void main(String[] args) {     Scanner scan = new Scanner(System.in);   BigInteger n = new BigInteger(scan.next());   BigInteger k = new BigInteger(scan.next());   BigInteger a = k.subtract(bi(1));   BigInteger lim = k.multiply(a).divide(bi(2));   lim = lim.add(bi(1));     if (n.compareTo(lim)>0){    System.out.println(-1);   }   else {    if (n.equals(1)){     System.out.println(0);    }    else {     BigInteger remain2 = lim.subtract(n).add(bi(1));     remain2 = remain2.multiply(bi(2));         double temp = remain2.doubleValue();         long flr = (long)Math.sqrt(temp);         BigInteger flr2 = bi(flr);     BigInteger rnd2 = remain2.subtract(flr2.multiply(flr2));     long rnd = remain2.longValue()-flr*flr;              if (rnd2.compareTo(flr2)<=0){      System.out.println(k.subtract(flr2) );     }     else {      System.out.println(k.subtract(flr2.add(bi(1) ) ) );     }    }   }  }  public static BigInteger bi(int n1){   return new BigInteger(""+n1);  }  public static BigInteger bi(long n1){   return new BigInteger(""+n1);  } }
6	public class x1185G1b  {  static long MOD = 1000000007L;  public static void main(String args[]) throws Exception  {   BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));    StringTokenizer st = new StringTokenizer(infile.readLine());   int N = Integer.parseInt(st.nextToken());   int T = Integer.parseInt(st.nextToken());   Song[] arr = new Song[N];   for(int i=0; i < N; i++)   {    st = new StringTokenizer(infile.readLine());    int a = Integer.parseInt(st.nextToken());    int b = Integer.parseInt(st.nextToken())-1;    arr[i] = new Song(a, b);   }      long[][] dp = new long[1 << N][3];   Arrays.fill(dp[0], 1L);   for(int mask=0; mask < dp.length; mask++)   {    for(int i=0; i < N; i++)     if((mask & (1 << i)) == 0)     {     Song c = arr[i];          if(mask == 0 && c.t <= T)     {      dp[mask|(1 << i)][c.g]++;      dp[mask|(1 << i)][c.g] %= MOD;     }          else     {      for(int gen=0; gen < 3; gen++)       if(gen != c.g)       {        dp[mask|(1 << i)][c.g] += dp[mask][gen];        dp[mask|(1 << i)][c.g] %= MOD;       }            }     }   }   long res = 0L;   for(int mask=1; mask < dp.length; mask++)    for(int i=0; i < 3; i++)    {     int sum = 0;     for(int b=0; b < N; b++)     if((mask & (1 << b)) > 0)      sum += arr[b].t;     if(sum == T)     res = (res+dp[mask][i])%MOD;    }   System.out.println(res);  }  }  class Song  {  public int t;  public int g;    public Song(int a, int b)  {   t = a;   g = b;  }  }
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");  } }
4	public class ExplorerSpace {  private 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;  }  }    public static long[][][] dp;   public static boolean valid(int i, int j, int n, int m) {  return i>=0 && i<n &&j>=0 && j<m; }  public static void solution(int n, int m, int k, int[][] h, int[][] v)   {  if(k%2==1)  {  for(int i = 0; i<n; i++)  {   for(int j = 0; j<m; j++)    out.print(-1+" ");     out.println();     }    return;  }   dp = new long[n][m][k/2+1];   for(int t = 1; t<=k/2; t++)  {  for(int i = 0; i<n; i++)  {   for(int j = 0; j<m; j++)   {   dp[i][j][t] = Long.MAX_VALUE;      }  }  }   for(int i = 0; i<n; i++)  {  for(int j = 0; j<m; j++)  {   dp[i][j][0] = 0;     }  }     for(int t = 1; t<=k/2; t++)  {  for(int i = 0; i<n; i++)  {   for(int j = 0; j<m; j++)   {   if(valid(i,j+1,n,m))    dp[i][j][t] = Math.min(dp[i][j][t], h[i][j] + dp[i][j+1][t-1]);      if(valid(i,j-1,n,m))    dp[i][j][t] = Math.min(dp[i][j][t], h[i][j-1] + dp[i][j-1][t-1]);      if(valid(i+1,j,n,m))    dp[i][j][t] = Math.min(dp[i][j][t], v[i][j] + dp[i+1][j][t-1]);      if(valid(i-1,j,n,m))    dp[i][j][t] = Math.min(dp[i][j][t], v[i-1][j] + dp[i-1][j][t-1]);     }  }  }     for(int i = 0; i<n; i++)  {  for(int j = 0; j<m; j++)   out.print((dp[i][j][k/2]*2)+" ");    out.println();  }   }   private static PrintWriter out = new PrintWriter(System.out); public static void main (String[] args) { MyScanner s = new MyScanner();    int n = s.nextInt();  int m = s.nextInt();  int k = s.nextInt();   int[][] h = new int[n][m-1];   for(int i = 0; i<n; i++)  {  for(int j = 0; j<m-1; j++)  {   h[i][j] = s.nextInt();  }  }   int[][] v = new int[n-1][m];   for(int i = 0; i<n-1; i++)  {  for(int j = 0; j<m; j++)  {   v[i][j] = s.nextInt();  }  }     solution(n,m,k,h,v);   out.flush();  out.close();  } }
5	public class VtoraiaStat implements Runnable {  boolean isLocalMode = false;   private void doJob() throws Exception {   int n = nextInt();   int[] r = new int[n];   for(int i =0;i<n;i++){    r[i]=nextInt();   }   Arrays.sort(r);   int m = r[0];   for(int i=0;i<n;i++){    if(r[i]!=m){     writer.write(""+r[i]);     return;    }   }   writer.write("NO");  }   public static void main(String[] args) {   new VtoraiaStat().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);   }  }   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);   }  } }
4	public class A23 { public static void main(String[]args){  Scanner sc = new Scanner(System.in);  String W = sc.next();  ArrayList<String>Q = new ArrayList<String>();  for (int i = 0; i < W.length(); i++){    String O = "";  for (int k = i; k < W.length(); k++){   O = O + W.charAt(k);   Q.add(O);  }   }  Collections.sort(Q);  String tmp = Q.get(0);  int y = 0;  for (int i = 1; i < Q.size(); i++){  if (Q.get(i).equals(tmp)){   if (Q.get(i).length() > y){   y = Q.get(i).length();   }   }  else {   tmp = Q.get(i);    }  }  System.out.println(y); } }
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);  } }
5	public class Main { public static void main (String[]args) {  Scanner read = new Scanner (new BufferedInputStream (System.in));  int n = read.nextInt();  int[]arr = new int[n];  int sum=0;  int sum2=0;  int coin=0;  for(int i=0;i<n;i++)  {  arr[i] = read.nextInt();  sum+=arr[i];  }  Arrays.sort(arr);  for(int i=n-1;i>=0;i--)  {  sum2+=arr[i];  sum-=arr[i];  coin++;  if(sum2>sum)   break;  }  System.out.println(coin); } }
1	public class Abra { void solve() throws IOException {  int n = nextInt();  br.readLine();  int h = 0, t = 0;  String s = br.readLine();  for (int i = 0; i < n; i++) {  if ((char)s.charAt(i) == 'H') h++; else t++;  }  int m = 10001;  for (int j = 0; j < n; j++) {  int z = 0;  for (int i = 0; i < n; i++) {   if (i + 1 <= h) {   if (s.charAt((i + j) % n) != 'H') z++;   } else {   if (s.charAt((i + j) % n) != 'T') z++;   }  }  if (z < m) m = z;  }  out.println(m / 2); }  public static void main(String[] args) throws IOException {  new Abra().run(); }   static class myLib {  long fact(long x) {  long a = 1;  for (long i = 2; i <= x; i++) {   a *= i;  }  return a;  }  long digitSum(String x) {  long a = 0;  for (int i = 0; i < x.length(); i++) {   a += x.charAt(i) - '0';  }  return a;  }  long digitSum(long x) {  long a = 0;  while (x > 0) {   a += x % 10;   x /= 10;  }  return a;  }  long digitMul(long x) {  long a = 1;  while (x > 0) {   a *= x % 10;   x /= 10;  }  return a;  }  int digitCubesSum(int x) {  int a = 0;  while (x > 0) {   a += (x % 10) * (x % 10) * (x % 10);   x /= 10;  }  return a;  }  double pif(double ax, double ay, double bx, double by) {  return Math.sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));  }  double pif3D(double ax, double ay, double az, double bx, double by, double bz) {  return Math.sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by) + (az - bz) * (az - bz));  }  double pif3D(double[] a, double[] b) {  return Math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]) + (a[2] - b[2]) * (a[2] - b[2]));  }  long gcd(long a, long b) {  if (a == 0 || b == 0) return 1;  if (a < b) {   long c = b;   b = a;   a = c;  }  while (a % b != 0) {   a = a % b;   if (a < b) {   long c = b;   b = a;   a = c;   }  }  return b;  }  int gcd(int a, int b) {  if (a == 0 || b == 0) return 1;  if (a < b) {   int c = b;   b = a;   a = c;  }  while (a % b != 0) {   a = a % b;   if (a < b) {   int c = b;   b = a;   a = c;   }  }  return b;  }  long lcm(long a, long b) throws IOException {  return a * b / gcd(a, b);  }  int lcm(int a, int b) throws IOException {  return a * b / gcd(a, b);  }  int countOccurences(String x, String y) {  int a = 0, i = 0;  while (true) {   i = y.indexOf(x);   if (i == -1) break;   a++;   y = y.substring(i + 1);  }  return a;  }  int[] findPrimes(int x) {  boolean[] forErato = new boolean[x - 1];  List<Integer> t = new Vector<Integer>();  int l = 0, j = 0;  for (int i = 2; i < x; i++) {   if (forErato[i - 2]) continue;   t.add(i);   l++;   j = i * 2;   while (j < x) {   forErato[j - 2] = true;   j += i;   }  }  int[] primes = new int[l];  Iterator<Integer> iterator = t.iterator();  for (int i = 0; iterator.hasNext(); i++) {   primes[i] = iterator.next().intValue();  }  return primes;  }  int rev(int x) {  int a = 0;  while (x > 0) {   a = a * 10 + x % 10;   x /= 10;  }  return a;  }  class myDate {  int d, m, y;   int[] ml = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };   public myDate(int da, int ma, int ya) {   d = da;   m = ma;   y = ya;   if ((ma > 12 || ma < 1 || da > ml[ma - 1] || da < 1) && !(d == 29 && m == 2 && y % 4 == 0)) {   d = 1;   m = 1;   y = 9999999;   }  }   void incYear(int x) {   for (int i = 0; i < x; i++) {   y++;   if (m == 2 && d == 29) {    m = 3;    d = 1;    return;   }   if (m == 3 && d == 1) {    if (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)) {    m = 2;    d = 29;    }    return;   }   }  }   boolean less(myDate x) {   if (y < x.y) return true;   if (y > x.y) return false;   if (m < x.m) return true;   if (m > x.m) return false;   if (d < x.d) return true;   if (d > x.d) return false;   return true;  }   void inc() {   if ((d == 31) && (m == 12)) {   y++;   d = 1;   m = 1;   } else {   if (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)) {    ml[1] = 29;   }   if (d == ml[m - 1]) {    m++;    d = 1;   } else    d++;   }  }  }  int partition(int n, int l, int m) {          if (n < l) return 0;  if (n < l + 2) return 1;  if (l == 1) return 1;  int c = 0;  for (int i = Math.min(n - l + 1, m); i >= (n + l - 1) / l; i--) {   c += partition(n - i, l - 1, i);  }  return c;  }  int rifmQuality(String a, String b) {  if (a.length() > b.length()) {   String c = a;   a = b;   b = c;  }  int c = 0, d = b.length() - a.length();  for (int i = a.length() - 1; i >= 0; i--) {   if (a.charAt(i) == b.charAt(i + d)) c++;   else   break;  }  return c;  }  String numSym = "0123456789ABCDEF";  String ZFromXToYNotation(int x, int y, String z) {  if (z.equals("0")) return "0";  String a = "";    BigInteger q = BigInteger.ZERO, t = BigInteger.ONE;  for (int i = z.length() - 1; i >= 0; i--) {   q = q.add(t.multiply(BigInteger.valueOf(z.charAt(i) - 48)));   t = t.multiply(BigInteger.valueOf(x));  }  while (q.compareTo(BigInteger.ZERO) == 1) {   a = numSym.charAt((int) (q.mod(BigInteger.valueOf(y)).intValue())) + a;   q = q.divide(BigInteger.valueOf(y));  }  return a;  }  double angleFromXY(int x, int y) {  if ((x == 0) && (y > 0)) return Math.PI / 2;  if ((x == 0) && (y < 0)) return -Math.PI / 2;  if ((y == 0) && (x > 0)) return 0;  if ((y == 0) && (x < 0)) return Math.PI;  if (x > 0) return Math.atan((double) y / x);  else {   if (y > 0) return Math.atan((double) y / x) + Math.PI;   else   return Math.atan((double) y / x) - Math.PI;  }  }  static boolean isNumber(String x) {  try {   Integer.parseInt(x);  } catch (NumberFormatException ex) {   return false;  }  return true;  }  static boolean stringContainsOf(String x, String c) {  for (int i = 0; i < x.length(); i++) {   if (c.indexOf(x.charAt(i)) == -1) return false;  }  return true;  }  long pow(long a, long n) {   if (n == 0) return 1;  long k = n, b = 1, c = a;  while (k != 0) {   if (k % 2 == 0) {   k /= 2;   c *= c;   } else {   k--;   b *= c;   }  }  return b;  }  int pow(int a, int n) {   if (n == 0) return 1;  int k = n, b = 1, c = a;  while (k != 0) {   if (k % 2 == 0) {   k /= 2;   c *= c;   } else {   k--;   b *= c;   }  }  return b;  }  double pow(double a, int n) {   if (n == 0) return 1;  double k = n, b = 1, c = a;  while (k != 0) {   if (k % 2 == 0) {   k /= 2;   c *= c;   } else {   k--;   b *= c;   }  }  return b;  }  double log2(double x) {  return Math.log(x) / Math.log(2);  }  int lpd(int[] primes, int x) {  int i;  for (i = 0; primes[i] <= x / 2; i++) {   if (x % primes[i] == 0) {   return primes[i];   }  }  ;  return x;  }  int np(int[] primes, int x) {  for (int i = 0; true; i++) {   if (primes[i] == x) return i;  }  }  int[] dijkstra(int[][] map, int n, int s) {  int[] p = new int[n];  boolean[] b = new boolean[n];  Arrays.fill(p, Integer.MAX_VALUE);  p[s] = 0;  b[s] = true;  for (int i = 0; i < n; i++) {   if (i != s) p[i] = map[s][i];  }  while (true) {   int m = Integer.MAX_VALUE, mi = -1;   for (int i = 0; i < n; i++) {   if (!b[i] && (p[i] < m)) {    mi = i;    m = p[i];   }   }   if (mi == -1) break;   b[mi] = true;   for (int i = 0; i < n; i++)   if (p[mi] + map[mi][i] < p[i]) p[i] = p[mi] + map[mi][i];  }  return p;  }  boolean isLatinChar(char x) {  if (((x >= 'a') && (x <= 'z')) || ((x >= 'A') && (x <= 'Z'))) return true;  else   return false;  }  boolean isBigLatinChar(char x) {  if (x >= 'A' && x <= 'Z') return true;  else   return false;  }  boolean isSmallLatinChar(char x) {  if (x >= 'a' && x <= 'z') return true;  else   return false;  }  boolean isDigitChar(char x) {  if (x >= '0' && x <= '9') return true;  else   return false;  }  class NotANumberException extends Exception {  private static final long serialVersionUID = 1L;  String mistake;   NotANumberException() {   mistake = "Unknown.";  }   NotANumberException(String message) {   mistake = message;  }  }  class Real {  String num = "0";  long exp = 0;  boolean pos = true;   long length() {   return num.length();  }   void check(String x) throws NotANumberException {   if (!stringContainsOf(x, "0123456789+-.eE")) throw new NotANumberException("Illegal character.");   long j = 0;   for (long i = 0; i < x.length(); i++) {   if ((x.charAt((int) i) == '-') || (x.charAt((int) i) == '+')) {    if (j == 0) j = 1;    else    if (j == 5) j = 6;    else     throw new NotANumberException("Unexpected sign.");   } else    if ("0123456789".indexOf(x.charAt((int) i)) != -1) {    if (j == 0) j = 2;    else     if (j == 1) j = 2;     else     if (j == 2)     ;     else      if (j == 3) j = 4;      else      if (j == 4)      ;      else       if (j == 5) j = 6;       else       if (j == 6)       ;       else        throw new NotANumberException("Unexpected digit.");    } else    if (x.charAt((int) i) == '.') {     if (j == 0) j = 3;     else     if (j == 1) j = 3;     else      if (j == 2) j = 3;      else      throw new NotANumberException("Unexpected dot.");    } else     if ((x.charAt((int) i) == 'e') || (x.charAt((int) i) == 'E')) {     if (j == 2) j = 5;     else      if (j == 4) j = 5;      else      throw new NotANumberException("Unexpected exponent.");     } else     throw new NotANumberException("O_o.");   }   if ((j == 0) || (j == 1) || (j == 3) || (j == 5)) throw new NotANumberException("Unexpected end.");  }   public Real(String x) throws NotANumberException {   check(x);   if (x.charAt(0) == '-') pos = false;   long j = 0;   String e = "";   boolean epos = true;   for (long i = 0; i < x.length(); i++) {   if ("0123456789".indexOf(x.charAt((int) i)) != -1) {    if (j == 0) num += x.charAt((int) i);    if (j == 1) {    num += x.charAt((int) i);    exp--;    }    if (j == 2) e += x.charAt((int) i);   }   if (x.charAt((int) i) == '.') {    if (j == 0) j = 1;   }   if ((x.charAt((int) i) == 'e') || (x.charAt((int) i) == 'E')) {    j = 2;    if (x.charAt((int) (i + 1)) == '-') epos = false;   }   }   while ((num.length() > 1) && (num.charAt(0) == '0'))   num = num.substring(1);   while ((num.length() > 1) && (num.charAt(num.length() - 1) == '0')) {   num = num.substring(0, num.length() - 1);   exp++;   }   if (num.equals("0")) {   exp = 0;   pos = true;   return;   }   while ((e.length() > 1) && (e.charAt(0) == '0'))   e = e.substring(1);   try {   if (e != "") if (epos) exp += Long.parseLong(e);   else    exp -= Long.parseLong(e);   } catch (NumberFormatException exc) {   if (!epos) {    num = "0";    exp = 0;    pos = true;   } else {    throw new NotANumberException("Too long exponent");   }   }  }   public Real() {  }   String toString(long mantissa) {   String a = "", b = "";   if (exp >= 0) {   a = num;   if (!pos) a = '-' + a;   for (long i = 0; i < exp; i++)    a += '0';   for (long i = 0; i < mantissa; i++)    b += '0';   if (mantissa == 0) return a;   else    return a + "." + b;   } else {   if (exp + length() <= 0) {    a = "0";    if (mantissa == 0) {    return a;    }    if (mantissa < -(exp + length() - 1)) {    for (long i = 0; i < mantissa; i++)     b += '0';    return a + "." + b;    } else {    if (!pos) a = '-' + a;    for (long i = 0; i < mantissa; i++)     if (i < -(exp + length())) b += '0';     else     if (i + exp >= 0) b += '0';     else      b += num.charAt((int) (i + exp + length()));    return a + "." + b;    }   } else {    if (!pos) a = "-";    for (long i = 0; i < exp + length(); i++)    a += num.charAt((int) i);    if (mantissa == 0) return a;    for (long i = exp + length(); i < exp + length() + mantissa; i++)    if (i < length()) b += num.charAt((int) i);    else     b += '0';    return a + "." + b;   }   }  }  }  boolean containsRepeats(int... num) {  Set<Integer> s = new TreeSet<Integer>();  for (int d : num)   if (!s.contains(d)) s.add(d);   else   return true;  return false;  }  int[] rotateDice(int[] a, int n) {  int[] c = new int[6];  if (n == 0) {   c[0] = a[1];   c[1] = a[5];   c[2] = a[2];   c[3] = a[0];   c[4] = a[4];   c[5] = a[3];  }  if (n == 1) {   c[0] = a[2];   c[1] = a[1];   c[2] = a[5];   c[3] = a[3];   c[4] = a[0];   c[5] = a[4];  }  if (n == 2) {   c[0] = a[3];   c[1] = a[0];   c[2] = a[2];   c[3] = a[5];   c[4] = a[4];   c[5] = a[1];  }  if (n == 3) {   c[0] = a[4];   c[1] = a[1];   c[2] = a[0];   c[3] = a[3];   c[4] = a[5];   c[5] = a[2];  }  if (n == 4) {   c[0] = a[0];   c[1] = a[2];   c[2] = a[3];   c[3] = a[4];   c[4] = a[1];   c[5] = a[5];  }  if (n == 5) {   c[0] = a[0];   c[1] = a[4];   c[2] = a[1];   c[3] = a[2];   c[4] = a[3];   c[5] = a[5];  }  return c;  }  int min(int... a) {  int c = Integer.MAX_VALUE;  for (int d : a)   if (d < c) c = d;  return c;  }  int max(int... a) {  int c = Integer.MIN_VALUE;  for (int d : a)   if (d > c) c = d;  return c;  }  double maxD(double... a) {  double c = Double.MIN_VALUE;  for (double d : a)   if (d > c) c = d;  return c;  }  double minD(double... a) {  double c = Double.MAX_VALUE;  for (double d : a)   if (d < c) c = d;  return c;  }  int[] normalizeDice(int[] a) {  int[] c = a.clone();  if (c[0] != 0) if (c[1] == 0) c = rotateDice(c, 0);  else   if (c[2] == 0) c = rotateDice(c, 1);   else   if (c[3] == 0) c = rotateDice(c, 2);   else    if (c[4] == 0) c = rotateDice(c, 3);    else    if (c[5] == 0) c = rotateDice(rotateDice(c, 0), 0);  while (c[1] != min(c[1], c[2], c[3], c[4]))   c = rotateDice(c, 4);  return c;  }  boolean sameDice(int[] a, int[] b) {  for (int i = 0; i < 6; i++)   if (a[i] != b[i]) return false;  return true;  }  final double goldenRatio = (1 + Math.sqrt(5)) / 2;  final double aGoldenRatio = (1 - Math.sqrt(5)) / 2;  long Fib(int n) {  if (n < 0) if (n % 2 == 0) return -Math.round((pow(goldenRatio, -n) - pow(aGoldenRatio, -n)) / Math.sqrt(5));  else   return -Math.round((pow(goldenRatio, -n) - pow(aGoldenRatio, -n)) / Math.sqrt(5));  return Math.round((pow(goldenRatio, n) - pow(aGoldenRatio, n)) / Math.sqrt(5));  }  class japaneeseComparator implements Comparator<String> {  @Override  public int compare(String a, String b) {   int ai = 0, bi = 0;   boolean m = false, ns = false;   if (a.charAt(ai) <= '9' && a.charAt(ai) >= '0') {   if (b.charAt(bi) <= '9' && b.charAt(bi) >= '0') m = true;   else    return -1;   }   if (b.charAt(bi) <= '9' && b.charAt(bi) >= '0') {   if (a.charAt(ai) <= '9' && a.charAt(ai) >= '0') m = true;   else    return 1;   }   a += "!";   b += "!";   int na = 0, nb = 0;   while (true) {   if (a.charAt(ai) == '!') {    if (b.charAt(bi) == '!') break;    return -1;   }   if (b.charAt(bi) == '!') {    return 1;   }   if (m) {    int ab = -1, bb = -1;    while (a.charAt(ai) <= '9' && a.charAt(ai) >= '0') {    if (ab == -1) ab = ai;    ai++;    }    while (b.charAt(bi) <= '9' && b.charAt(bi) >= '0') {    if (bb == -1) bb = bi;    bi++;    }    m = !m;    if (ab == -1) {    if (bb == -1) continue;    else     return 1;    }    if (bb == -1) return -1;    while (a.charAt(ab) == '0' && ab + 1 != ai) {    ab++;    if (!ns) na++;    }    while (b.charAt(bb) == '0' && bb + 1 != bi) {    bb++;    if (!ns) nb++;    }    if (na != nb) ns = true;    if (ai - ab < bi - bb) return -1;    if (ai - ab > bi - bb) return 1;    for (int i = 0; i < ai - ab; i++) {    if (a.charAt(ab + i) < b.charAt(bb + i)) return -1;    if (a.charAt(ab + i) > b.charAt(bb + i)) return 1;    }   } else {    m = !m;    while (true) {    if (a.charAt(ai) <= 'z' && a.charAt(ai) >= 'a' && b.charAt(bi) <= 'z' && b.charAt(bi) >= 'a') {     if (a.charAt(ai) < b.charAt(bi)) return -1;     if (a.charAt(ai) > b.charAt(bi)) return 1;     ai++;     bi++;    } else     if (a.charAt(ai) <= 'z' && a.charAt(ai) >= 'a') return 1;     else     if (b.charAt(bi) <= 'z' && b.charAt(bi) >= 'a') return -1;     else      break;    }   }   }   if (na < nb) return 1;   if (na > nb) return -1;   return 0;  }  }  Random random = new Random(); }  void readIntArray(int[] a) throws IOException {  for (int i = 0; i < a.length; i++)  a[i] = nextInt(); }  String readChars(int l) throws IOException {  String r = "";  for (int i = 0; i < l; i++)  r += (char) br.read();  return r; }  StreamTokenizer in; PrintWriter out; boolean oj; BufferedReader br;  void init() throws IOException {  oj = System.getProperty("ONLINE_JUDGE") != null;  Reader reader = oj ? new InputStreamReader(System.in) : new FileReader("input.txt");  Writer writer = oj ? new OutputStreamWriter(System.out) : new FileWriter("output.txt");  br = new BufferedReader(reader);  in = new StreamTokenizer(br);  out = new PrintWriter(writer); }  long selectionTime = 0;  void startSelection() {  selectionTime -= System.currentTimeMillis(); }  void stopSelection() {  selectionTime += System.currentTimeMillis(); }  void run() throws IOException {  long beginTime = System.currentTimeMillis();  long beginMem = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();  init();  solve();  long endMem = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();  long endTime = System.currentTimeMillis();  if (!oj) {  System.out.println("Memory used = " + (endMem - beginMem));  System.out.println("Total memory = " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));  System.out.println("Running time = " + (endTime - beginTime));  }  out.flush(); }  int nextInt() throws IOException {  in.nextToken();  return (int) in.nval; }  long nextLong() throws IOException {  in.nextToken();  return (long) in.nval; }  String nextString() throws IOException {  in.nextToken();  return in.sval; }  double nextDouble() throws IOException {  in.nextToken();  return in.nval; }  myLib lib = new myLib();   }
3	public class Main {  static FastScanner fs=new FastScanner();  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();   }   int Int() {    return Integer.parseInt(next());   }   long Long() {    return Long.parseLong(next());   }   String Str(){    return next();   }  }   public static void main (String[] args) throws java.lang.Exception {   PrintWriter out = new PrintWriter(System.out);    int T=1;   for(int t=0;t<T;t++){    int n=Int();    int A[]=new int[n];    for(int i=0;i<n;i++){     A[i]=Int();    }    Solution sol=new Solution();    sol.solution(out,A);   }   out.flush();  }  public static int Int(){   return fs.Int();  }  public static long Long(){   return fs.Long();  }  public static String Str(){   return fs.Str();  } }    class Solution{  public void solution(PrintWriter out,int A[]){   Map<Integer,List<int[]>>f=new HashMap<>();   List<int[]>res=new ArrayList<>();   for(int i=0;i<A.length;i++){    int sum=0;    for(int j=i;j<A.length;j++){     sum+=A[j];     if(!f.containsKey(sum))f.put(sum,new ArrayList<>());     List<int[]>list=f.get(sum);     list.add(new int[]{i,j});    }   }    for(Integer key:f.keySet()){    List<int[]>list=f.get(key);    Collections.sort(list,(a,b)->{     return a[1]-b[1];    });    int pre[]=new int[list.size()];    Arrays.fill(pre,-1);     int dp[][]=new int[list.size()][2];    dp[0][0]=1;    dp[0][1]=0;    for(int i=1;i<list.size();i++){     int pair[]=list.get(i);     int l=0,r=i-1;     int pos=-1;     while(l<=r){      int mid=l+(r-l)/2;      if(list.get(mid)[1]<pair[0]){       pos=mid;       l=mid+1;      }      else{       r=mid-1;      }     }     if(pos!=-1){      int mx=1+dp[pos][0];      if(mx>=dp[i-1][0]){       dp[i][0]=mx;       dp[i][1]=i;       pre[i]=dp[pos][1];      }      else{       dp[i][0]=dp[i-1][0];       dp[i][1]=dp[i-1][1];      }     }     else{      dp[i][0]=dp[i-1][0];      dp[i][1]=dp[i-1][1];     }    }    int n=list.size();    if(dp[n-1][0]>res.size()){     res=new ArrayList<>();     int j=dp[n-1][1];     while(j!=-1){      res.add(list.get(j));      j=pre[j];     }    }       }     out.println(res.size());   for(int p[]:res){    out.println((p[0]+1)+" "+(p[1]+1));   }  }   }
5	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   Hashtable<Integer, Integer> hi = new Hashtable<Integer, Integer>();   for (int i = 0; i < n; i++) {    int m = sc.nextInt();    hi.put(m, 1);   }   Set<Integer> set = hi.keySet();   Integer[] key = set.toArray(new Integer[set.size()]);   Arrays.sort(key);   try {    System.out.println(key[1]);   } catch (Exception e) {    System.out.println("NO");   }  } }
5	public class Task{  static final boolean readFromFile = false; static final String fileInputName = "input.txt",    fileOutputName = "output.txt";  public static void main(String args[]){  FileInputStream fileInputStream;  FileOutputStream fileOutputStream;  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  if (readFromFile){  try{   fileInputStream = new FileInputStream(new File(fileInputName));   fileOutputStream = new FileOutputStream(new File(fileOutputName));  }catch (FileNotFoundException e){   throw new RuntimeException(e);  }  }  PrintWriter out = new PrintWriter((readFromFile)?fileOutputStream:outputStream);  InputReader in = new InputReader((readFromFile)?fileInputStream:inputStream);   Solver s = new Solver(in, out);  s.solve();   out.close(); } } class Solver{ private PrintWriter out; private InputReader in;  public void solve(){  int n = in.nextInt();  double t = in.nextDouble(),  a[] = new double[n],  x[] = new double[n];  for (int i=0;i<n;i++){  x[i] = in.nextDouble();  a[i] = in.nextDouble();  }  int ans = 2;  for (int i=0;i<n-1;i++)  for (int j=i+1;j<n;j++)   if (x[j]<x[i]){   double buf = x[i];x[i]=x[j];x[j]=buf;   buf = a[i]; a[i]=a[j];a[j]=buf;   }   for (int i=0;i<n-1;i++){  if (x[i]+a[i]/2+t<x[i+1]-a[i+1]/2)   ans += 2;  if (x[i]+a[i]/2+t==x[i+1]-a[i+1]/2)   ans++;  }  out.println(ans); }  Solver(InputReader in, PrintWriter out){  this.in = in;  this.out = out; } } class InputReader{ StringTokenizer tok; BufferedReader buf;  InputReader(InputStream in){  tok = null;  buf = new BufferedReader(new InputStreamReader(in)); }  InputReader(FileInputStream in){  tok = null;  buf = new BufferedReader(new InputStreamReader(in)); }  public String next(){  while (tok==null || !tok.hasMoreTokens()){  try{   tok = new StringTokenizer(buf.readLine());  }catch (IOException e){   throw new RuntimeException(e);  }  }  return tok.nextToken(); }  public int nextInt(){  return Integer.parseInt(next()); } public long nextLong(){  return Long.parseLong(next()); } public double nextDouble(){  return Double.parseDouble(next()); } public float nextFloat(){  return Float.parseFloat(next()); } public String nextLine(){  try{  return buf.readLine();  }catch (IOException e){  return null;  } } }
0	public class Main {  public static void main (String[] args) {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   try {    String parameterStringList[] = reader.readLine().split(" ");    int x = Integer.parseInt(parameterStringList[0]);    int y = Integer.parseInt(parameterStringList[1]);    int z = Integer.parseInt(parameterStringList[2]);    int t1 = Integer.parseInt(parameterStringList[3]);    int t2 = Integer.parseInt(parameterStringList[4]);    int t3 = Integer.parseInt(parameterStringList[5]);    int T1 = Math.abs(x-y) * t1;    int T2 = Math.abs(x-z) * t2 + 3*t3 + Math.abs(x-y) * t2;    if(T2 <= T1) System.out.println("YES");    else System.out.println("NO");   } catch (IOException e) {    e.printStackTrace();   }  } }
2	public class templ implements Runnable{  static class pair implements Comparable  {   int f;   int s;   pair(int fi,int se)   {    f=fi;    s=se;   }   public int compareTo(Object o)   {    pair pr=(pair)o;    if(s>pr.s)     return 1;    if(s==pr.s)    {     if(f>pr.f)      return 1;     else      return -1;    }    else     return -1;   }   public boolean equals(Object o)   {    pair ob=(pair)o;    int ff;    int ss;    if(o!=null)    {     ff=ob.f;     ss=ob.s;     if((ff==this.f)&&(ss==this.s))      return true;    }    return false;   }   public int hashCode()   {    return (this.f+" "+this.s).hashCode();   }  }  public class triplet implements Comparable  {   int f,t;   int s;   triplet(int f,int s,int t)   {    this.f=f;    this.s=s;    this.t=t;   }   public boolean equals(Object o)   {    triplet ob=(triplet)o;    int ff;    int ss;    int tt;    if(o!=null)    {     ff=ob.f;     ss=ob.s;     tt=ob.t;     if((ff==this.f)&&(ss==this.s)&&(tt==this.t))      return true;    }    return false;   }   public int hashCode()   {    return (this.f+" "+this.s+" "+this.t).hashCode();   }   public int compareTo(Object o)   {    triplet tr=(triplet)o;    if(t>tr.t)     return 1;    else     return -1;   }  }  void merge1(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++;   }  }  void sort1(int arr[], int l, int r)  {   if (l < r)   {    int m = (l+r)/2;    sort1(arr, l, m);    sort1(arr , m+1, r);    merge1(arr, l, m, r);   }  }  public static void main(String args[])throws Exception  {   new Thread(null,new templ(),"templ",1<<27).start();  }  public void run()  {   try   {    InputReader in = new InputReader(System.in);    PrintWriter out = new PrintWriter(System.out);    int n=in.ni();    int x=in.ni();    long l=1,r=n;    while(l<=r)    {     long mid=(l+r)/2;     long k=(mid*(mid+1))/2-(n-mid);     if(k==x)     {      out.println((n-mid));      break;     }     else if(k<x)      l=mid+1;     else      r=mid-1;    }    out.close();   }   catch(Exception e){    return;   }  }  static class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar, snumChars;   public InputReader(InputStream stream) {    this.stream = stream;   }   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 ni() {    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 nl() {    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] = ni();    }    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;   }  } }
1	public class Main {   public static void main(String[] args) throws Exception {   int i,j,k;   int counter[] = new int[2];   int a[] = new int[200];   int needed;     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));     int N = Integer.parseInt(br.readLine());   StringTokenizer st = new StringTokenizer(br.readLine());     for (i=1;i<=N;i++) {    a[i] = Integer.parseInt(st.nextToken());    counter[a[i]%2]++;   }     if (counter[0] == 1) {    needed = 0;   } else {    needed = 1;   }     for (i=1;i<=N;i++) {    if (a[i]%2 == needed) {     System.out.println(i);     return;    }   }    } }
5	public class A {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  void solve() throws IOException {   int n = nextInt();   int[] a = new int[n];   boolean onlyOnes = true;   for (int i = 0; i < n; i++) {    a[i] = nextInt();    if (a[i] != 1)     onlyOnes = false;   }   Arrays.sort(a);   if (onlyOnes) {    for (int i = 0; i < n - 1; i++)     out.print("1 ");    out.print(2);   } else {    out.print("1 ");    for (int i = 0; i < n - 1; i++)     out.print(a[i] + " ");   }  }  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 A().inp();  }  String nextToken() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return "0";    }   }   return st.nextToken();  }  String nextString() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return "0";    }   }   return st.nextToken("\n");  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
2	public class Solution1 {  private void solve() throws IOException {   long MOD = 1_000_000_007;   long x = in.nextLong();   long k = in.nextLong();   if (x == 0) {    System.out.println(0);    return;   }   long val = binpow(2, k + 1, MOD) % MOD;   long kek = (binpow(2, k, MOD) - 1 + MOD) % MOD;   x = (val % MOD) * (x % MOD) % MOD;   long ans = (x % MOD - kek % MOD + MOD) % MOD;   System.out.println(ans % MOD);  }  private long binpow(long a, long n, long mod) {   long res = 1;   while (n > 0) {    if (n % 2 == 1)     res = (res % mod) * (a % mod) % mod;    a = (a % mod) * (a % mod) % mod;    n >>= 1;   }   return res % mod;  }   private PrintWriter out;  private MyScanner in;  private void run() throws IOException {   in = new MyScanner();   out = new PrintWriter(System.out);   solve();   in.close();   out.close();  }  private class MyScanner {   private BufferedReader br;   private StringTokenizer st;   public MyScanner() throws IOException {    this.br = new BufferedReader(new InputStreamReader(System.in));   }   public MyScanner(String fileTitle) throws IOException {    this.br = new BufferedReader(new FileReader(fileTitle));   }   public String nextLine() throws IOException {    String s = br.readLine();    return s == null ? "-1" : s;   }   public String next() throws IOException {    while (st == null || !st.hasMoreTokens()) {     String s = br.readLine();     if (s == null) {      return "-1";     }     st = new StringTokenizer(s);    }    return st.nextToken();   }   public Integer nextInt() throws IOException {    return Integer.parseInt(this.next());   }   public Long nextLong() throws IOException {    return Long.parseLong(this.next());   }   public Double nextDouble() throws IOException {    return Double.parseDouble(this.next());   }   public void close() throws IOException {    this.br.close();   }  }  public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);   new Solution1().run();  } }
3	public class PTM {  public static void main(String[] args) throws Exception {   BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));   PrintWriter printWriter = new PrintWriter(System.out);   int N = Integer.parseInt(bufferedReader.readLine());   String[] strings = bufferedReader.readLine().split(" ");   int[] arr = new int[strings.length];   HashSet<Integer> set = new HashSet<>();   for (int i = 0; i < N; i++) {    arr[i] = Integer.parseInt(strings[i]);    set.add(arr[i]);   }   Arrays.sort(arr);   int c = 0;   for (int i = 0; i < N; i++) {    int value = arr[i];    if (!set.contains(value)) {     continue;    }    for (int j = 1; j <= 100; j++) {     if (set.contains(value * j)) {      set.remove(value * j);     }    }    c++;   }   printWriter.println(c);   printWriter.flush();  } }
3	public class CodeforcesProblems {   static class Pair {   public Pair(int key, int val) {    this.key = key;    this.val = val;   }   int key;   int val;  }   public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));      int n = Integer.parseInt(br.readLine());   String[] strings = br.readLine().split(" ");   int[] arr = new int[n];   for(int i = 0; i<n; i++) {    arr[i] = Integer.parseInt(strings[i]);   }    HashMap<Integer, ArrayList<Pair>> segments = new HashMap<>();   for(int r = 0; r<arr.length; r++) {    int sum = 0;    for(int l = r; l>=0; l--) {     sum += arr[l];     ArrayList<Pair> pairs = segments.get(sum);     if(pairs == null) {      pairs = new ArrayList<>();      segments.put(sum, pairs);     }     pairs.add(new Pair(l, r));    }   }   int res = 0;   ArrayList<Pair> result = new ArrayList<>();   for(ArrayList<Pair> pairs: segments.values()) {    ArrayList<Pair> temp = new ArrayList<>();    int count = 0;    int r = -1;    for(Pair p : pairs) {     if(p.key>r) {      count++;      temp.add(p);      r = p.val;     }    }    if(count>res) {     res = count;     result = temp;    }   }   System.out.println(res);   StringBuilder sb = new StringBuilder();   for(Pair p : result){    sb.append(p.key+1).append(' ').append(p.val+1).append('\n');   }   System.out.print(sb);  } }
4	public class R035C {  public void debug(Object... objects) { System.err.println(Arrays.deepToString(objects)); }  public static final int INF = 987654321;  public static final long LINF = 987654321987654321L;  public static final double EPS = 1e-9;   Scanner scanner;  PrintWriter out;  int[][] iss;   public R035C() {   try {    this.scanner = new Scanner(new File("input.txt"));    this.out = new PrintWriter("output.txt");   } catch(FileNotFoundException ex) { ex.printStackTrace(); }  }   class Point implements Comparable<Point> {   int x, y, count;   Point(int x, int y) { this.x = x; this.y = y; }   public int hashCode() { return x * 17 + y; }   public boolean equals(Object o) {    if(!(o instanceof Point)) return false;    Point that = (Point)o;    return this.x == that.x && this.y == that.y;   }   public int compareTo(Point that) { return this.count - that.count; }   public String toString() { return "(" + x + ", " + y + ":" + count + ")"; }  }    int[] dx = new int[] { 0, 0, -1, 1 };  int[] dy= new int[] { -1, 1, 0, 0 };  int n, m;   Queue<Point> q;   Point bfs() {   int max = -INF;   Point p = null;   while(!q.isEmpty()) {    Point cur = q.remove();    if(max < cur.count) { max = cur.count; p = cur; }    for(int i=0; i<dx.length; i++) {     int nx = cur.x + dx[i];     int ny = cur.y + dy[i];     if(nx < 0 || nx >= n) { continue; }     if(ny < 0 || ny >= m) { continue; }     Point np = new Point(nx, ny);     if(iss[nx][ny] != 0) { continue; }     np.count = cur.count+1;     iss[nx][ny] = np.count;     q.add(np);    }   }   return p;  }   private void solve() {   this.n = scanner.nextInt();   this.m = scanner.nextInt();   this.iss = new int[n][m];   int k = scanner.nextInt();   q = new PriorityQueue<Point>();   for(int i=0; i<k; i++) {    int x = scanner.nextInt() - 1;    int y = scanner.nextInt() - 1;    Point init = new Point(x, y);    init.count = 1;    q.add(init);    iss[x][y] = 1;   }   Point p = bfs();   out.println((p.x+1) + " " + (p.y+1));  }   private void finish() { this.out.close(); }   public static void main(String[] args) {   R035C obj = new R035C();   obj.solve();   obj.finish();  } }
5	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);  public static void main(String[] args) throws IOException{  int n = nextInt(),  t = nextInt(),  x[] = new int[n],  a[] = new int[n];   for (int i=0; i<n; i++){  x[i] = nextInt();  a[i] = nextInt();  }   for (int i=0; i<n-1; i++)  for (int j=i+1; j<n; j++)   if (x[i] > x[j]){   int p = x[i]; x[i] = x[j]; x[j] = p;    p = a[i]; a[i] = a[j]; a[j] = p;   }   double l[] = new double[n];  double r[] = new double[n];  for (int i=0; i<n; i++){  l[i] = x[i]-a[i]/2.0;  r[i] = x[i]+a[i]/2.0;  }   int res = 2;  for (int i=1; i<n; i++){  if (Math.abs(l[i]-r[i-1]-t) < 0.000001) res++;  else if (l[i]-r[i-1] > t) res += 2;  }   out.println(res);  out.flush(); } }
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());  } }
0	public class A {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  String ns = sc.next();  sc.close();   int n1 = Integer.parseInt(ns);  int n2 = Integer.parseInt(ns.substring(0, ns.length() - 1));  int n3 = Integer.parseInt(ns.substring(0, ns.length() - 2) + ns.substring(ns.length() - 1));   int max = n1;  max = (n2 > max) ? (n2) : (max);  max = (n3 > max) ? (n3) : (max);   System.out.println(max);  } }
2	public class C992 {  static class Scanner  {   BufferedReader br;   StringTokenizer tk=new StringTokenizer("");   public Scanner(InputStream is)   {    br=new BufferedReader(new InputStreamReader(is));   }   public int nextInt() throws IOException   {    if(tk.hasMoreTokens())     return Integer.parseInt(tk.nextToken());    tk=new StringTokenizer(br.readLine());    return nextInt();   }   public long nextLong() throws IOException   {    if(tk.hasMoreTokens())     return Long.parseLong(tk.nextToken());    tk=new StringTokenizer(br.readLine());    return nextLong();   }   public String next() throws IOException   {    if(tk.hasMoreTokens())     return (tk.nextToken());    tk=new StringTokenizer(br.readLine());    return next();   }   public String nextLine() throws IOException   {    tk=new StringTokenizer("");    return br.readLine();   }   public double nextDouble() throws IOException   {    if(tk.hasMoreTokens())     return Double.parseDouble(tk.nextToken());    tk=new StringTokenizer(br.readLine());    return nextDouble();   }   public char nextChar() throws IOException   {    if(tk.hasMoreTokens())     return (tk.nextToken().charAt(0));    tk=new StringTokenizer(br.readLine());    return nextChar();   }   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 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[] nextIntArrayOneBased(int n) throws IOException   {    int a[]=new int[n+1];    for(int i=1;i<=n;i++)     a[i]=nextInt();    return a;   }   public long[] nextLongArrayOneBased(int n) throws IOException   {    long a[]=new long[n+1];    for(int i=1;i<=n;i++)     a[i]=nextLong();    return a;   }     }  static long mod=1000000007;  static long mod_exp(long base,long exp)  {   long ans=1;   base%=mod;   while(exp>0)   {    if(exp%2==1)    {     ans*=base;     ans%=mod;    }    exp/=2;    base*=base;    base%=mod;   }   return ans;  }  public static void main(String args[]) throws IOException  {   Scanner in=new Scanner(System.in);   PrintWriter out=new PrintWriter(System.out);   long x=in.nextLong();   long k=in.nextLong();     long ans=mod_exp(2,k+1);   ans*=(x%mod);   ans%=mod;   ans-=mod_exp(2,k);   ans%=mod;   ans++;   ans%=mod;   if(ans<0)    ans+=mod;   if(x==0)    ans=0;   out.println(ans);   out.close();  } }
2	public class Main {  static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  static StringTokenizer st = new StringTokenizer("");  static PrintWriter pw = new PrintWriter(System.out);  public static String next() throws IOException {   while (!st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return st.nextToken();  }  public static int nextInt() throws IOException {   return Integer.parseInt(next());  }  public static long nextLong() throws IOException {   return Long.parseLong(next());  }  public static void main(String[] args) throws IOException {   new Main().run();  }  void run() throws IOException {   long n = nextInt();   long k = nextInt();   long d = 9 + 8 * (n + k);   pw.print(n - (-3 + (int)Math.sqrt(d)) / 2);   pw.close();  } }
0	public class Main{  public static void main(String args[]){   Scanner in = new Scanner(System.in);   int T = in.nextInt();   while(T!=0){    T--;    int a = in.nextInt();    int b = in.nextInt();    int ans=0;    while(a>0&&b>0){     if(a>b){      int c = a;      a = b;      b = c;     }     ans += (b-(b%a))/a;     b = b%a;    }    System.out.println(ans);   }  }  }
5	public class Main { public static void main(String args[]) throws IOException {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt(), t = sc.nextInt(), x, a, kol = 2;  ArrayList<Double> al = new ArrayList<Double>();  for(int i=0;i<n;i++)  {  x = sc.nextInt();  a = sc.nextInt();  al.add(x - a/2.);  al.add(x + a/2.);  }  Collections.sort(al);  double d0 = 0; int k = 0, kn = al.size();  for(Double d: al)  {  if (k == 2)  {   if (d-d0>t) kol+=2; else   if (d-d0==t) kol++;   d0 = d;   k = 1;   } else   {   k++;   d0 = d;  }   }  System.out.print(kol); } }
2	public class C {  private static Solver solver = new Solver();  private static long m = 1000000000L + 7L;  public static void main(String[] args) throws IOException {   solver.withProcedure(() -> {    String[] input = solver.readString().split(" ");    BigInteger x = new BigInteger(input[0]);    BigInteger k = new BigInteger(input[1]);    if (x.compareTo(BigInteger.ZERO) == 0) {     solver.println("" + 0);     return;    }    BigInteger two = BigInteger.valueOf(2);    BigInteger mm = BigInteger.valueOf(m);    BigInteger binpowedK = two.modPow(k, mm);    BigInteger binpowedKPlusOne = two.modPow(k.add(BigInteger.ONE), mm);    BigInteger res = binpowedKPlusOne.multiply(x).subtract(binpowedK.subtract(BigInteger.ONE)).mod(mm);    if (res.compareTo(BigInteger.ZERO) < 0) {     res = BigInteger.ZERO;    }    solver.println("" + res);   }).solve();  }  private static long binpow(long a, long n) {   a = a % m;   long res = 1L;   while (n > 0) {    if ((n & 1L) != 0)     res = (res * a) % m;    a = (a * a) % m;    n >>= 1L;   }   return res;  }   @FunctionalInterface  private interface Procedure {   void run() throws IOException;  }  private static class Solver {   private Procedure procedure;   private StreamTokenizer in;   private PrintWriter out;   private BufferedReader bufferedReader;   Solver() {    try {     boolean oj = System.getProperty("ONLINE_JUDGE") != null;     Reader reader = oj ? new InputStreamReader(System.in) : new FileReader("input.txt");     Writer writer = oj ? new OutputStreamWriter(System.out) : new FileWriter("output.txt");     bufferedReader = new BufferedReader(reader);     in = new StreamTokenizer(bufferedReader);     out = new PrintWriter(writer);    } catch (Exception e) {     throw new RuntimeException("Initialization has failed");    }   }   void solve() throws IOException {    procedure.run();   }   int readInt() throws IOException {    in.nextToken();    return (int) in.nval;   }   long readLong() throws IOException {    in.nextToken();    return (long) in.nval;   }   String readString() throws IOException {    return bufferedReader.readLine();   }   char readChar() throws IOException {    in.nextToken();    return in.sval.charAt(0);   }   void println(String str) {    out.println(str);    out.flush();   }   void print(String str) {    out.print(str);    out.flush();   }   Solver withProcedure(Procedure procedure) {    this.procedure = procedure;    return this;   }  } }
0	public class Task267A {  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++]);  }  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);   int n = sc.nextInt();   while (n-- > 0) {   int ai = sc.nextInt();   int bi = sc.nextInt();   int retVal = 0;   while (ai > 0 && bi > 0) {   if (ai > bi) {    retVal += ai / bi;    ai = ai % bi;   } else {    retVal += bi / ai;    bi = bi % ai;   }   }   pw.println(retVal);  }   pw.flush();  sc.close();  } } }
5	public class A {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;   class Team implements Comparable<Team>{   int ac;   int penalty;     public Team(int ac, int penalty) {    this.ac = ac;    this.penalty = penalty;   }   @Override   public int compareTo(Team o) {    if (ac != o.ac)     return ac > o.ac ? -1 : 1;    return (penalty == o.penalty) ? 0 : (penalty < o.penalty ? -1 : 1);   }    }  void solve() throws IOException {   int n = nextInt();   int k = nextInt() - 1;     Team[] a = new Team[n];   for (int i = 0; i < n; i++)    a[i] = new Team(nextInt(), nextInt());     Arrays.sort(a);   for (int i = 0; i < n;) {    int j = i;    while (j < n && a[j].compareTo(a[i]) == 0)     j++;    if (i <= k && k < j) {     out.println(j - i);     return;    }    i = j;   }  }  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 A().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 task1 {  static void print(Object... a) {   for (Object aa : a) {    System.out.println(aa.toString());   }  }  static Map<Character, Integer> stringToCharsMap(String str) {   Map<Character, Integer> charcount = new HashMap<Character, Integer>();   for (Character c : str.toCharArray()) {    if (charcount.containsKey(c)) {     charcount.put(c, charcount.get(c) + 1);    } else {     charcount.put(c, 1);    }   }   return charcount;  }  static Set<Character> stringToCharsSet(String str) {   Set<Character> chars = new HashSet<>();   for (Character c : str.toCharArray()) {    chars.add(c);   }   return chars;  }  static int[] readArrayOfInt() {   Scanner sc = new Scanner(System.in);   int a = sc.nextInt();   int array[] = new int[a];   for (int i = 0; i < a; i++) {    array[i] = sc.nextInt();   }   return array;  }  static class Point {   double x;   double y;   Point(double x, double y) {    this.x = x;    this.y = y;   }   double distance(Point p) {    return Math.sqrt((this.x - p.x) * (this.x - p.x) + (this.y - p.y) * (this.y - p.y));   }   double distance(Line l) {    return Math.abs(l.a * this.x + l.b * this.y + l.c) / Math.sqrt(l.a * l.a + l.b * l.b);   }  }  static class Line {   double a;   double b;   double c;   double EPS = 1e-6;   Line(int a, int b, int c) {    this.a = a;    this.b = b;    this.c = c;   }   Line(Point f, Point s) {    this.a = f.y - s.y;    this.b = s.x - f.x;    this.c = -this.a * f.x - this.b * f.y;   }   double distance(Point p) {    return Math.abs(this.a * p.x + this.b * p.y + this.c) / Math.sqrt(this.a * this.a + this.b * this.b);   }   boolean isPointOnLine(Point p) {    return p.x * this.a + p.y * this.b + this.c < EPS;   }   Point linesIntersection(Line a) {    double x = -(this.c * a.b - a.c * this.b) / (this.a * a.b - a.a * this.b);    double y = -(this.a * a.c - a.a * this.c) / (this.a * a.b - a.a * this.b);    return new Point(x, y);   }  }  static HashMap<Integer, Integer> getDels(int a) {   HashMap<Integer, Integer> h = new HashMap<>();   int i = 2;   while (a != 1) {    if (a % i == 0) {     if (h.containsKey(i)) {      h.put(i, h.get(i) + 1);     } else {      h.put(i, 1);     }     a = a / i;    } else {     i++;    }   }   return h;  }  static class Rect {   Point fcorner;   Point scorner;   Rect(Point f, Point s) {    fcorner = f;    scorner = s;   }   double volume() {    return Math.abs((fcorner.x - scorner.x) * (fcorner.y - scorner.y));   }  }  public static void main(String args[]) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int arr[] = new int[n];   int c[] = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = sc.nextInt();   }   Arrays.sort(arr);   int count = 1;   c[0] = 1;   for (int i = 1; i < arr.length; i++) {    for (int j = 0; j < i; j++) {     if (arr[i] % arr[j] == 0) {      c[i] = c[j];      break;     }    }    if (c[i] == 0) {     c[i] = count + 1;     count++;    }   }   System.out.println(count);  } }
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 Round111ProbA {    public static void main(String[] args) {   Scanner in = new Scanner(System.in);     int n = in.nextInt();   int[]a = new int[n];   int s =0;   for(int i =0 ; i < n;i++)   {    a[i] = in.nextInt();    s += a[i];   }   Arrays.sort(a);   int x =0;   int c =0;   for(int i =n-1 ; i >-1;i-- )   {    x +=a[i];    s -= a[i];    c++;    if(x > s)break;   }   System.out.println(c);  }  }
5	public class Main {  private static Parser in;  private static PrintWriter out;   public static void main(String[] args) {   in = new Parser(System.in);   out = new PrintWriter(System.out);     int n= in.nextInt();   int min = 101;   boolean b = false;   int pmin = 101;   int t= 0 ;   for(int i=0; i<n; i++){    t = in.nextInt();       if (t<min){if(min != pmin)b=true; if(b) pmin = min; min = t; continue;}    if (t>min && t<pmin){b=true; pmin = t; continue;}    if (t>min && !b){b=true; pmin = t; continue;}             }   if (b) System.out.println(pmin); else System.out.println("NO");    } }  class Parser {  final private int BUFFER_SIZE = 1 << 16;  private DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;   public Parser(InputStream in) {    din = new DataInputStream(in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;  }  public String nextString(int size) {   byte[] ch = new byte[size];   int point = 0;   try {    byte c = read();    while (c == ' ' || c == '\n' || c=='\r')     c = read();    while (c != ' ' && c != '\n' && c!='\r') {     ch[point++] = c;     c = read();    }   } catch (Exception e) {}   return new String(ch,0,point);   }  public int nextInt() {  int ret = 0;  boolean neg;  try {   byte c = read();   while (c <= ' ')    c = read();   neg = c == '-';   if (neg)    c = read();   do {    ret = ret * 10 + c - '0';    c = read();   } while (c > ' ');   if (neg) return -ret;  } catch (Exception e) {}  return ret;  }  public long nextLong() {   long ret = 0;   boolean neg;   try {    byte c = read();    while (c <= ' ')     c = read();    neg = c == '-';    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';     c = read();    } while (c > ' ');     if (neg) return -ret;   } catch (Exception e) {}   return ret;   }  private void fillBuffer() {   try {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);   } catch (Exception e) {}   if (bytesRead == -1) buffer[0] = -1;  }   private byte read() {   if (bufferPointer == bytesRead) fillBuffer();   return buffer[bufferPointer++];  } }
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());   }  } }
0	public class A {  public static void main(String[] args) throws Exception {  new A().doit(); }  private void doit() throws Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  long a = Long.parseLong(st.nextToken());  long b = Long.parseLong(st.nextToken());  long ans = 0;  while(a > 0 && b > 0) {  if (a > b) {   ans += a / b;   a %= b;  } else {   ans += b / a;   b %= a;  }  }   System.out.println(ans); }   }
5	public class Solution implements Runnable {        class Pair implements Comparable<Pair> {   int col;   int time;   int place;     public Pair() {      }     public Pair(int col, int time) {    this.col = col;    this.time = time;   }     @Override   public int compareTo(Pair arg0) {    if (col == arg0.col) {     return time - arg0.time;    }    return arg0.col - col;   }       }   public void solve() throws Exception {   int n = sc.nextInt();   int k = sc.nextInt();     ArrayList<Pair> a = new ArrayList<Pair>();     for (int i = 0;i < n; ++ i) {    a.add(new Pair(sc.nextInt(), sc.nextInt()));   }   Collections.sort(a);     int place = 1;   int placex = 0;   int ans2 = 0;   int ans1 = 0;     for (int i = 0;i < n; ++ i) {    if (i > 0 && a.get(i).compareTo(a.get(i - 1)) != 0) {     ++ place;     ++ placex;    } else {     ++ placex;    }    a.get(i).place = place;    if (placex == k) {     ans1 = place;    }   }     for (int i = 0;i < n; ++ i) {    if (a.get(i).place == ans1) {     ++ ans2;    }   }     out.println(ans2);   }           static String filename = "";  static boolean fromFile = false;   BufferedReader in;  PrintWriter out;  FastScanner sc;   public static void main(String[] args) {   new Thread(null, new Solution(), "", 1 << 25).start();  }   public void run() {   try {    init();    solve();   } catch (Exception e) {    throw new RuntimeException(e);   } finally {    out.close();   }  }   void init() throws Exception {   if (fromFile) {    in = new BufferedReader(new FileReader(filename+".in"));    out = new PrintWriter(new FileWriter(filename+".out"));   } else {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);   }   sc = new FastScanner(in);  } } 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());  }   public BigInteger nextBigInteger() throws IOException {   return new BigInteger(nextToken());  }   public BigDecimal nextBigDecimal() throws IOException {   return new BigDecimal(nextToken());  } }
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);  } } }
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(); } }
5	public class Main { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tokenizer=null;  public static void main(String[] args) throws IOException {  new Main().execute(); }  void debug(Object...os) {  System.out.println(Arrays.deepToString(os)); }  int ni() throws IOException {  return Integer.parseInt(ns()); }  long nl() throws IOException  {  return Long.parseLong(ns()); }  double nd() throws IOException  {  return Double.parseDouble(ns()); }   String ns() throws IOException  {  while (tokenizer == null || !tokenizer.hasMoreTokens())   tokenizer = new StringTokenizer(br.readLine());  return tokenizer.nextToken(); }  String nline() throws IOException {  tokenizer=null;  return br.readLine(); }     int totalCases, testNum;  int k,n;  void execute() throws IOException {  totalCases = 1;  for(testNum = 1; testNum <= totalCases; testNum++)  {  input();  solve();  } }  void solve() {  int a = arr[k-1].a;  int b = arr[k-1].b;   int count = 0;  for(int i = 0;i<n;i++)  {  if(arr[i].a == a && arr[i].b == b)   count++;  }  System.out.println(count); }  void printarr(int [] a,int b) {  for(int i = 0;i<=b;i++)  {  if(i==0)   System.out.print(a[i]);  else   System.out.print(" "+a[i]);  }  System.out.println(); }  class Pair implements Comparable<Pair> {  int a,b; Pair(int _a,int _b) {  a=_a;  b=_b; }  public int compareTo(Pair x) {  if(a == x.a) return b-x.b;  return -(a-x.a); }   public boolean equals(Pair x) {  return a==x.a && b==x.b; } }  Pair[] arr; boolean input() throws IOException {  n = ni();  k = ni();  arr = new Pair[n];  for(int i = 0 ;i<n;i++)  {  Pair p =new Pair(ni(),ni());  arr[i] = p;  }  Arrays.sort(arr);   return true; } }
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);  F1SameSumBlocksEasy solver = new F1SameSumBlocksEasy();  solver.solve(1, in, out);  out.close(); }  static class F1SameSumBlocksEasy {  Map<Long, List<IntPair>> sums = new HashMap<>();  public void solve(int testNumber, InputReader in, PrintWriter out) {  int n = in.nextInt();  long[] arr = in.nextLongArray(n);  long[] pref = ArrayUtils.prefixSum(arr);  for (int i = 0; i < n; ++i) {   for (int j = i; j >= 0; --j) {   long sum = pref[i + 1] - pref[j];   if (sums.containsKey(sum)) {    sums.get(sum).add(Factories.makeIntPair(j, i));   } else {    List<IntPair> pairs = new ArrayList<>();    pairs.add(Factories.makeIntPair(j, i));    sums.put(sum, pairs);   }   }  }   int best = 0;  List<IntPair> res = new ArrayList<>();  for (long sum : sums.keySet()) {   List<IntPair> pairs = sums.get(sum);   List<IntPair> temp = new ArrayList<>();   int last = -1;   for (IntPair cur : pairs) {   if (cur.first > last) {    last = cur.second;    temp.add(cur);   }   }   if (temp.size() > best) {   best = temp.size();   res = temp;   }  }  out.println(best);  for (IntPair pair : res) {   out.println((pair.first + 1) + " " + (pair.second + 1));  }  }  }  static class ArrayUtils {  public static long[] prefixSum(long[] arr) {  long[] acc = new long[arr.length + 1];  for (int i = 1; i <= arr.length; ++i) {   acc[i] = acc[i - 1] + arr[i - 1];  }  return acc;  }  }  static interface FastIO {  }  static final class Factories {  private Factories() {  }  public static IntPair makeIntPair(int first, int second) {  return new IntPair(first, second);  }  }  static class IntPair implements Comparable<IntPair> {  public int first;  public int second;  public IntPair() {  first = second = 0;  }  public IntPair(int first, int second) {  this.first = first;  this.second = second;  }  public int compareTo(IntPair a) {  if (first == a.first) {   return Integer.compare(second, a.second);  }  return Integer.compare(first, a.first);  }  public String toString() {  return "<" + first + ", " + second + ">";  }  public boolean equals(Object o) {  if (this == o) {   return true;  }  if (o == null || getClass() != o.getClass()) {   return false;  }   IntPair a = (IntPair) o;   if (first != a.first) {   return false;  }  return second == a.second;  }  public int hashCode() {  int result = first;  result = 31 * result + second;  return result;  }  }  static class InputReader implements FastIO {  private InputStream stream;  private static final int DEFAULT_BUFFER_SIZE = 1 << 16;  private static final int EOF = -1;  private byte[] buf = new byte[DEFAULT_BUFFER_SIZE];  private int curChar;  private int numChars;  public InputReader(InputStream stream) {  this.stream = stream;  }  public int read() {  if (this.numChars == EOF) {   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 EOF;   }   }   return this.buf[this.curChar++];  }  }  public 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 long nextLong() {  int c;  for (c = this.read(); isSpaceChar(c); c = this.read()) {  }   byte sgn = 1;  if (c == 45) {   sgn = -1;   c = this.read();  }   long res = 0;   while (c >= 48 && c <= 57) {   res *= 10L;   res += c - 48;   c = this.read();   if (isSpaceChar(c)) {   return res * sgn;   }  }  throw new InputMismatchException();  }  public static boolean isSpaceChar(int c) {  return c == 32 || c == 10 || c == 13 || c == 9 || c == EOF;  }  public long[] nextLongArray(int n) {  long[] arr = new long[n];  for (int i = 0; i < n; i++) {   arr[i] = nextLong();  }  return arr;  }  } }
1	public class B {  static class InputReader {   BufferedReader buffreader;   StringTokenizer strtokenizer;   public InputReader(InputStream inputstr) {    buffreader = new BufferedReader(new InputStreamReader(inputstr), 1000000);strtokenizer = null; }     String next() {    while (strtokenizer == null || !strtokenizer.hasMoreTokens()) {     try { strtokenizer = new StringTokenizer(buffreader.readLine()); }     catch (IOException e) { throw new RuntimeException(e); }    }    return strtokenizer.nextToken(); }     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]=nextInt();}    return arr;}   public long[] nextLongArr(int n){    long[] arr=new long[n];    for (int i=0;i<n;i++){arr[i]=nextLong();}    return arr;}   public String[] nextStringArr(int n){    String[] arr=new String[n];    for (int i=0;i<n;i++){arr[i]=next();}    return arr;}  }  static InputReader r = new InputReader(System.in);  static PrintWriter pw = new PrintWriter(System.out);  public static void main(String[] args){   int t=r.nextInt();   for (int v=0;v<t;v++){    int n=r.nextInt();    if (n%2==1){     pw.println("NO");    }    else{     int x=n/2;     boolean check=false;     for (int i=1;i<=(int)Math.sqrt(x)+1;i++){      if (i*i*2==x||i*i==x){       pw.println("YES");check=true;break;      }     }     if (!check){      pw.println("NO");     }    }    }   pw.close();   } }
2	public class Main {  static Scanner cin = new Scanner(System.in); static int n, x, y; static long c;  private static long f(int mid) {  long block = 1 + 4 * (long)(mid + 1) * mid / 2;  int l = y - mid;  int r = y + mid;  int u = x - mid;  int d = x + mid;  if(l <= 0)  block -= (long)(1 - l) * (1 - l);  if(r > n)  block -= (long)(r - n) * (r - n);  if(u <= 0)  block -= (long)(1 - u) * (1 - u);  if(d > n)  block -= (long)(d - n) * (d - n);  if(u <= 0 && 1 - u > n - y + 1) {  int t = (1 - u) - (n - y + 1);  block += (long)t * (1 + t) / 2;  }  if(u <= 0 && (1 - u) > y) {  int t = (1 - u) - y;  block += (long)t * (1 + t) / 2;  }  if(d > n && d - n > n - y + 1) {  int t = (d - n) - (n - y + 1);  block += (long)t * (1 + t) / 2;  }  if(d > n && d - n > y) {  int t = (d - n) - y;  block += (long)t * (1 + t) / 2;  }  return block; }  public static void main(String args[]) {   n = cin.nextInt();  x = cin.nextInt();  y = cin.nextInt();  c = cin.nextLong();   int low = 0, high = 1000000000;  int ans = -1;  while(low <= high) {   int mid = (low + high) / 2;   if(f(mid) >= c) {   ans = mid;   high = mid - 1;  } else {   low = mid + 1;  }  }  System.out.println(ans); } }
2	public class F {  public static void main(String[] args) throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   PrintWriter writer = new PrintWriter(System.out);   StringTokenizer st = new StringTokenizer(reader.readLine());   long n = Integer.parseInt(st.nextToken());   long k = Integer.parseInt(st.nextToken());   long l = 0;   long r = n;   while(l <= r){    long min = (l + r) / 2;    if((min * (min + 1) / 2 - (n - min) == k)){     System.out.println(n - min);     return;    }    else if((min * (min + 1) / 2 - (n - min) > k)){     r = min - 1;    }    else{     l = min + 1;    }   }  } }
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 CodeForces {  public void solve() throws IOException {  int n = nextInt();  int arr[]=new int[1000];  arr[0]=0;  arr[1]=1;  arr[2]=1;  if(n==0){  out.print("0 0 0");  }  else if(n==1){  out.print("0 0 1");  } else {  int c=2;  while(arr[c]!=n){   c++;   arr[c]=arr[c-1]+arr[c-2];  }  out.print(arr[c-2]+" "+arr[c-2]+" "+arr[c-3]);  }    }  public static void main(String[] args) {  new CodeForces().run(); }    int NOD(int a, int b) {  while (a != 0 && b != 0) {  if (a >= b)   a = a % b;  else   b = b % a;  }  return a + b; }  BufferedReader reader; StringTokenizer tokenizer; PrintWriter out; boolean isOuterFile = false;  public void run() {  try {  if (isOuterFile) {   reader = new BufferedReader(new FileReader("input.txt"));   out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));   out = new PrintWriter(System.out);  } else {   reader = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);  }   tokenizer = null;     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(); } }
0	public class Main {  long solve(long a, long b) {   return b == 0 ? 0 : a / b + solve(b, a % b);  }  public void run() {   try {    long a = reader.nextLong();    long b = reader.nextLong();    writer.println(solve(a, b));   } catch (IOException ex) {   }   writer.close();  }  InputReader reader;  PrintWriter writer;  Main() {   reader = new InputReader();   writer = new PrintWriter(System.out);  }  public static void main(String[] args) {   new Main().run();  } } class InputReader {  BufferedReader reader;  StringTokenizer tokenizer;  InputReader() {   reader = new BufferedReader(new InputStreamReader(System.in));   tokenizer = new StringTokenizer("");  }  String next() throws IOException {   while (!tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }  Integer nextInt() throws IOException {   return Integer.parseInt(next());  }  Long nextLong() throws IOException {   return Long.parseLong(next());  } }
2	public class Main {  public static void main(String[] args) throws Exception {   new Solver().run(1);  } } class Solver {  private BufferedReader reader = null;  private StringTokenizer st = null;  private static final long MOD = (long)1e9 + 7;  private long x, k;  public void run(int inputType) throws Exception {   if (inputType == 0)    reader = new BufferedReader(new FileReader("input.txt"));   else    reader = new BufferedReader(new InputStreamReader(System.in));   st = new StringTokenizer(reader.readLine());   x = Long.parseLong(st.nextToken());   k = Long.parseLong(st.nextToken());   if (x == 0) {    System.out.println(0);    return;   }   long pow = binpow(2, k);   long m = (2 * x) % MOD;   m = (m - 1 < 0) ? MOD - 1 : m - 1;   m = (m * pow) % MOD;   m = (m + 1) % MOD;   System.out.println(m);   reader.close();  }  long binpow(long v, long p) {   long res = 1L;   while(p > 0) {    if ((p & 1) > 0)     res = (res * v) % MOD;    v = (v * v) % MOD;    p /= 2;   }   return res;  } }
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 Main { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  long n = in.nextLong();  long k = in.nextLong();  long res = solve(n, k);  System.out.println(res); }  private static long solve(long n, long k) {  return solveEq(1, -3 - 2 * n, n * n + n - 2 * k); }  private static long solveEq(long a, long b, long c) {  long delta = b * b - 4 * a * c;  return (-b - (long)Math.sqrt(delta)) / (2 * a); } }
5	public class Main {  public static void main(String [] args){   Scanner in= new Scanner(System.in);   int n=in.nextInt();   int a=in.nextInt();   int b=in.nextInt();   int []deals=new int[n];   for(int i=0; i<n; i++){    deals[i]=in.nextInt();   }   Arrays.sort(deals);   System.out.println(deals[b]-deals[b-1]);  } }
5	public class Success {   public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int a = scan.nextInt();  int b=scan.nextInt();  int[] t=new int[n];  for(int i=0;i<n;i++)  {  t[i]=scan.nextInt();  }  Arrays.sort(t);  System.out.println(t[b]-t[b-1]);  }   }
0	public class palin { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(System.out);  Scanner scan = new Scanner(System.in);  TaskC solver = new TaskC();  solver.solve(1, in, out);  out.close(); } } class TaskC { public void solve(int testNumber, InputReader in, PrintWriter out) {  int n = in.nextInt();  if (n >= 0) {  out.print(n);  return;  }  if (n / 10 >= (n / 100) * 10 + n % 10) {  out.print(n / 10);  return;  }  out.print((n / 100) * 10 + n % 10); } } 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()); }  public long nextLong() {  return Long.parseLong(next()); }  public double nextDouble() {  return Double.parseDouble(next()); } }
5	public class Main {  public static void main(String[] args) throws Exception {     in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   solve();   in.close();   out.close();  }  private static void solve() throws Exception {   int n = nextInt();   boolean[] use = new boolean[500];   ArrayList<Integer> a = new ArrayList<Integer>();   for (int i = 0; i < n; i++) {    int v = nextInt();    if (!use[250 + v]) {     use[250 + v] = true;     a.add(v);    }   }   Collections.sort(a);   if (a.size() < 2) {    out.println("NO");   } else {    out.println(a.get(1));   }  }  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 IOException {   return Integer.parseInt(nextString());  }  static double nextDouble() throws IOException {   return Double.parseDouble(nextString());  } }
4	public class Problem implements Runnable {  private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  private BufferedReader in;  private PrintWriter out;  private StringTokenizer tok = new StringTokenizer("");  private void init() throws FileNotFoundException {   Locale.setDefault(Locale.US);   String fileName = "";       in = new BufferedReader(new FileReader("input.txt"));     out = new PrintWriter("output.txt");     }   String readString() {   while (!tok.hasMoreTokens()) {    try {     tok = new StringTokenizer(in.readLine());    } catch (Exception e) {     return null;    }   }   return tok.nextToken();  }  int readInt() {   return Integer.parseInt(readString());  }  long readLong() {   return Long.parseLong(readString());  }  double readDouble() {   return Double.parseDouble(readString());  }  int[] readIntArray(int size) {   int[] a = new int[size];   for (int i = 0; i < size; i++) {    a[i] = readInt();   }   return a;  }  public static void main(String[] args) {     new Problem().run();  }  long timeBegin, timeEnd;  void time() {   timeEnd = System.currentTimeMillis();   System.err.println("Time = " + (timeEnd - timeBegin));  }  @Override  public void run() {   try {    timeBegin = System.currentTimeMillis();    init();    solve();    out.close();    time();   } catch (Exception e) {    e.printStackTrace();    System.exit(-1);   }  }  int[][] dist;  int n, m;  private void solve() throws IOException {   n = readInt();   m = readInt();   int k=readInt();   dist = new int[n][m];   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     dist[i][j] = -1;   for (int i = 0; i < k; i++) {    dist[readInt()-1][readInt()-1]=0;   }   for (int i=0;i<n;i++)    for (int j=0;j<m;j++)     if (dist[i][j]==0)      bfs(i, j);   int max=0,X=0,Y=0;   for (int i=0;i<n;i++)    for (int j=0;j<m;j++)     if (dist[i][j]>=max){      max=dist[i][j];      X=i+1; Y=j+1;     }   out.println(X+" "+Y);  }  public void bfs(int x, int y) {   int[] dx = {0, 1, 0, -1};   int[] dy = {1, 0, -1, 0};   dist[x][y] = 0;   ArrayDeque<P> q = new ArrayDeque<>();   q.add(new P(x, y));   while (!q.isEmpty()) {    P v = q.poll();    for (int i = 0; i < 4; i++) {     int nx = v.x + dx[i];     int ny = v.y + dy[i];     if (inside(nx, ny) && (dist[nx][ny] == -1 || (dist[nx][ny] > dist[v.x][v.y] + 1&&dist[nx][ny]!=0))) {      q.add(new P(nx, ny));      dist[nx][ny] = dist[v.x][v.y] + 1;     }    }   }  }  public boolean inside(int x, int y) {   if (x < n && y < m && x >= 0 && y >= 0) {    return true;   }   return false;  } }  class P {  int x, y;  public P(int x, int y) {   this.x = x;   this.y = y;  } }
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)); } }
4	public class Solution {  BufferedReader in;  StringTokenizer st;  PrintWriter out;  int n, m, k;  int[] x, y;  char[] qx = new char[4000000], qy = new char[4000000];  int b, e;  char[][] d;  int[] dx = { -1, 0, 1, 0 }, dy = { 0, -1, 0, 1 };  void bfs() {   b = e = 0;   for (int i = 0; i < d.length; i++) {    Arrays.fill(d[i], (char)(1 << 14));   }   for (int i = 0; i < k; ++i) {    qx[e] = (char) x[i];    qy[e++] = (char) y[i];    d[x[i]][y[i]] = 0;   }   for (; b < e; ++b) {    int x = qx[b];    int y = qy[b];    for (int i = 0; i < 4; ++i) {     int nx = x + dx[i];     int ny = y + dy[i];     if (nx >= 0 && nx < n && ny >= 0 && ny < m)      if (d[nx][ny] > d[x][y] + 1) {       d[nx][ny] = (char) (d[x][y] + 1);       qx[e] = (char) nx;       qy[e++] = (char) ny;      }    }   }  }  void solve() throws IOException {   n = ni();   m = ni();   k = ni();   x = new int[k];   y = new int[k];   for (int i = 0; i < k; ++i) {    x[i] = ni() - 1;    y[i] = ni() - 1;   }   d = new char[n][m];   bfs();   int x = -1, y = -1, last = -1;   for (int i = 0; i < n; ++i)    for (int j = 0; j < m; ++j)     if (d[i][j] > last) {      last = d[i][j];      x = i;      y = j;     }   ++x;   ++y;   out.println(x + " " + y);  }  public Solution() throws IOException {   Locale.setDefault(Locale.US);   in = new BufferedReader(new FileReader("input.txt"));   out = new PrintWriter("output.txt");   solve();   in.close();   out.close();  }  String nline() throws IOException {   return in.readLine();  }  String ns() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(nline());   }   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 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());   }  } }
2	public class A {  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();  for(int x=0;;x++) {  if(2*1L*x+x*1L*(x+1)==2L*(k+n)) {   out.println(n-x);   break;  }  }  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();  }  } }
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());   }  } }
4	public class D { static byte[] buf = new byte[1<<26];  static int bp = -1;   public static void main(String[] args) throws IOException {    DataInputStream in = new DataInputStream(System.in);     in.read(buf, 0, 1<<26);   int n = nni();  int m = nni();  int k = nni();   if (k%2==1) {  for (int i = 0; i < n; ++i) {   StringBuilder ans = new StringBuilder();   String sp = "";   for (int j = 0; j < m; ++j) {   ans.append(sp+"-1");   sp = " ";   }   System.out.println(ans);  }  return;  }   int[][] lr = new int[n][m-1];  int[][] ud = new int[n-1][m];  for (int i = 0; i < n; ++i) {  for (int j = 0; j < m-1; ++j) {   lr[i][j] = nni();  }  }  for (int i = 0; i < n-1; ++i) {  for (int j = 0; j < m; ++j) {   ud[i][j] = nni();  }  }   int[][][] ans = new int[k/2+1][n][m];   for (int i = 0; i < n; ++i) {  for (int j = 0; j < m; ++j) {   for (int q = 1; q <= k/2; ++q) {   ans[q][i][j] = 123456789;   }  }  }   for (int uq = 0; uq < k/2; ++uq) {  for (int ui = 0; ui < n; ++ui) {   for (int uj = 0; uj < m; ++uj) {   int w = ans[uq][ui][uj];   if (ui>0 && w+ud[ui-1][uj]<ans[uq+1][ui-1][uj]) {    ans[uq+1][ui-1][uj] = w+ud[ui-1][uj];   }   if (ui<n-1 && w+ud[ui][uj]<ans[uq+1][ui+1][uj]) {    ans[uq+1][ui+1][uj] = w+ud[ui][uj];   }   if (uj>0 && w+lr[ui][uj-1]<ans[uq+1][ui][uj-1]) {    ans[uq+1][ui][uj-1] = w+lr[ui][uj-1];   }   if (uj<m-1 && w+lr[ui][uj]<ans[uq+1][ui][uj+1]) {    ans[uq+1][ui][uj+1] = w+lr[ui][uj];   }   }  }  }   for (int i = 0; i < n; ++i) {  StringBuilder as = new StringBuilder();  String sp = "";  for (int j = 0; j < m; ++j) {   as.append(sp+ans[k/2][i][j]*2);   sp = " ";  }  System.out.println(as);  } }  public static int nni() {   int ret = 0;   byte b = buf[++bp];   while (true) {    ret = ret*10+b-'0';    b = buf[++bp];    if (b<'0'||b>'9') {    while (buf[bp+1]=='\r'||buf[bp+1]=='\n'||buf[bp+1]==' ') {++bp;}    break;    }   }   return ret;  } }
2	public class B {  public static void main(String[] args) throws Exception {   new B().solve(System.in, System.out);       }  void solve(InputStream _in, PrintStream out) throws IOException {        Scanner sc = new Scanner(_in);   long n = sc.nextLong();   long x = sc.nextLong() - 1;   long y = sc.nextLong() - 1;   long c = sc.nextLong();   long ub = 2 * n;   long lb = -1;   while (lb + 1 < ub) {    long k = (lb + ub) / 2;    long l, u, r, d;    l = Math.max(0, x - k);    u = Math.max(0, y - k);    r = Math.min(n - 1, x + k);    d = Math.min(n - 1, y + k);    long ss = 0;       long lu = x - (k - (y - u));    if (l < lu) {     long a = lu - l;     ss += a * (a + 1) / 2;    }       long ld = x - (k - (d - y));    if (l < ld) {     long a = ld - l;     ss += a * (a + 1) / 2;    }       long ru = x + (k - (y - u));    if (ru < r) {     long a = r - ru;     ss += a * (a + 1) / 2;    }       long rd = x + (k - (d - y));    if (rd < r) {     long a = r - rd;     ss += a * (a + 1) / 2;    }    long cc = (r + 1 - l) * (d + 1 - u) - ss;    if (c <= cc) {         ub = k;    } else {         lb = k;    }   }   out.println(ub);  } }
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(); } }
3	public class Round584_a {   public static void main(String[] args) throws Exception {     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));     StringTokenizer st;     int n = Integer.parseInt(br.readLine());     st = new StringTokenizer(br.readLine());     int a[] = new int[n];     for(int i=0 ; i<n ; i++) {       a[i] = Integer.parseInt(st.nextToken());     }     Arrays.sort(a);     boolean vis[] = new boolean[n];     int count = 0;     for(int i=0 ; i<n ; i++) {       if(!vis[i]) {         for(int j=i ; j<n ; j++) {           if(!vis[j]) {             if(a[j]%a[i] == 0) {               vis[j] = true;             }           }         }         count++;       }     }     System.out.println(count);   } }
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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    int d = in.nextInt();    int[] x = new int[n + 1];    int ans = 2;    for (int i = 1; i <= n; i++) x[i] = in.nextInt();    for (int i = 1; i < n; i++) {     ans += (x[i + 1] - x[i] >= 2 * d) ? (x[i + 1] - x[i] == 2 * d ? 1 : 2) : 0;    }    out.print(ans);   }  }  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 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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public interface SpaceCharFilter {    boolean isSpaceChar(int ch);   }  } }
2	public class submitting { public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  StringTokenizer st = new StringTokenizer(sc.nextLine());  long n = Integer.parseInt(st.nextToken());  long k = Integer.parseInt(st.nextToken());  long put = n / 2;  long lower = 0;  long upper = n;  while (put * (put + 1) / 2 - (n - put) != k) {  if (put * (put + 1) / 2 - (n - put) > k) {   upper = put - 1;   put = (lower + upper) / 2;  } else {   lower = put + 1;   put = (lower + upper) / 2;  }  }  System.out.println(n - put);  sc.close(); } }
4	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   String line = in.readLine();   int n = line.length();   int maxlenght = 0;   for (int i = 0; i < n; i++) {    int j = line.indexOf(line.charAt(i), i + 1);    while (j != -1) {     int k = i;     int l = j;     while (k < n && l < n && line.charAt(k) == line.charAt(l)) {      k++;      l++;     }     if (k - i > maxlenght) {      maxlenght = k - i;     }     j = line.indexOf(line.charAt(i), j + 1);    }   }   System.out.println(maxlenght);  } }
4	public class D {  private static long INF = 2000000000000000000L, M = 1000000007, MM = 998244353; private static int N = 0; private static long[][][] dp; private static long[][] ff; private static long[][] ss;  public static void process() throws IOException {  int n = sc.nextInt(),m = sc.nextInt(),k = sc.nextInt();   ff = new long[n][m];  ss = new long[n][m];  for(int i = 0; i<n; i++) {  for(int j = 0; j<m-1; j++) {   ff[i][j] = sc.nextLong();  }  }  for(int i = 0; i<n-1; i++) {  for(int j = 0; j<m; j++) {   ss[i][j] = sc.nextLong();  }  }   if(k%2 == 1) {  for(int i = 0; i<n; i++) {   for(int j = 0; j<m; j++)System.out.print(-1+" ");   System.out.println();  }  return;  }   dp = new long[n+1][m+1][11];  for(int i = 0; i<=n; i++) {  for(int j = 0; j<=m; j++)Arrays.fill(dp[i][j], -1);  }  for(int i = 0; i<=n; i++) {  for(int j = 0; j<=m; j++) {   dp[i][j][0] = 0;  }  }   k/=2;  long ans[][] = new long[n][m];  for(int i = 0; i<n; i++) {  for(int j = 0; j<m; j++) {   ans[i][j] = solve(i,j,k,n,m)*2L;  }  }  for(int i = 0; i<n; i++) {  for(int j = 0; j<m; j++)print(ans[i][j]+" ");  println();  } }  private static long solve(int i, int j, int k, int n, int m) {  if(dp[i][j][k] != -1)return dp[i][j][k];  long ans = Long.MAX_VALUE;  if(i+1<n) {  ans = min(ans,ss[i][j] + solve(i+1, j, k-1, n, m));  }  if(i-1>=0) {  ans = min(ans,ss[i-1][j] + solve(i-1, j, k-1, n, m));  }  if(j+1<m) {  ans = min(ans,ff[i][j] + solve(i, j+1, k-1, n, m));  }  if(j-1>=0) {  ans = min(ans,ff[i][j-1] + solve(i, j-1, k-1, n, m));  }   return dp[i][j][k] = ans; }     static FastScanner sc; static PrintWriter out;  public static void main(String[] args) throws IOException {  boolean oj = true;  if (oj) {  sc = new FastScanner();  out = new PrintWriter(System.out);  } else {  sc = new FastScanner(100);  out = new PrintWriter("output.txt");  }  int t = 1;  while (t-- > 0) {  process();  }  out.flush();  out.close(); }  static class Pair implements Comparable<Pair> {  int x, y;  Pair(int x, int y) {  this.x = x;  this.y = y;  }  @Override  public int compareTo(Pair o) {  return Integer.compare(this.x, o.x);  }                       }   static void println(Object o) {  out.println(o); }  static void println() {  out.println(); }  static void print(Object o) {  out.print(o); }  static void pflush(Object o) {  out.println(o);  out.flush(); }  static int ceil(int x, int y) {  return (x % y == 0 ? x / y : (x / y + 1)); }  static long ceil(long x, long y) {  return (x % y == 0 ? x / y : (x / y + 1)); }  static int max(int x, int y) {  return Math.max(x, y); }  static int min(int x, int y) {  return Math.min(x, y); }  static int abs(int x) {  return Math.abs(x); }  static long abs(long x) {  return Math.abs(x); }  static long sqrt(long z) {  long sqz = (long) Math.sqrt(z);  while (sqz * 1L * sqz < z) {  sqz++;  }  while (sqz * 1L * sqz > z) {  sqz--;  }  return sqz; }  static int log2(int N) {  int result = (int) (Math.log(N) / Math.log(2));  return result; }  static long max(long x, long y) {  return Math.max(x, y); }  static long min(long x, long y) {  return Math.min(x, y); }  public static int gcd(int a, int b) {  BigInteger b1 = BigInteger.valueOf(a);  BigInteger b2 = BigInteger.valueOf(b);  BigInteger gcd = b1.gcd(b2);  return gcd.intValue(); }  public static long gcd(long a, long b) {  BigInteger b1 = BigInteger.valueOf(a);  BigInteger b2 = BigInteger.valueOf(b);  BigInteger gcd = b1.gcd(b2);  return gcd.longValue(); }  public static long lcm(long a, long b) {  return (a * b) / gcd(a, b); }  public static int lcm(int a, int b) {  return (a * b) / gcd(a, b); }  public static int lower_bound(int[] arr, int x) {  int low = 0, high = arr.length, mid = -1;  while (low < high) {  mid = (low + high) / 2;   if (arr[mid] >= x)   high = mid;  else   low = mid + 1;  }  return low; }  public static int upper_bound(int[] arr, int x) {  int low = 0, high = arr.length, mid = -1;  while (low < high) {  mid = (low + high) / 2;   if (arr[mid] > x)   high = mid;  else   low = mid + 1;  }  return low; }   static class FastScanner {  BufferedReader br;  StringTokenizer st;  FastScanner() throws FileNotFoundException {  br = new BufferedReader(new InputStreamReader(System.in));  }  FastScanner(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;  }  int[] readArray(int n) throws IOException {  int[] A = new int[n];  for (int i = 0; i != n; i++) {   A[i] = sc.nextInt();  }  return A;  }  long[] readArrayLong(int n) throws IOException {  long[] A = new long[n];  for (int i = 0; i != n; i++) {   A[i] = sc.nextLong();  }  return A;  } }  static void ruffleSort(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;  }  Arrays.sort(a); }  static void ruffleSort(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;  }  Arrays.sort(a); } }
5	public class A {  static final Scanner sc = new Scanner(System.in);   void run() {   int n = sc.nextInt();   int[] xs = new int[n];   for(int i = 0; i < n; i++) {    xs[i] = sc.nextInt();   }   Arrays.sort(xs);   xs[n-1] = xs[n-1] == 1 ? 2 : 1;   Arrays.sort(xs);   for(int i = 0; i < n; i++)    System.out.print(xs[i] + " ");  }   public static void main(String[] args) {   new A().run();  } }
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;   }  } }
3	public class Main {  private FastScanner in;  private PrintWriter out;  private void solve() throws IOException {   solveC();  }  private void solveA() throws IOException {   char[] n = in.next().toCharArray(), s = in.next().toCharArray();   out.print(n[0]);   for (int i = 1; i < n.length && n[i] < s[0]; i++)    out.print(n[i]);   out.print(s[0]);  }  private void solveB() throws IOException {   int n = in.nextInt();   long dp[] = new long[n + 1];   for (int i = 1; i <= n; i++) {    dp[i] = i + (i < 3 ? 0 : dp[i - 2]);   }   out.print(dp[n]);  }  private void solveC() throws IOException {   int n = in.nextInt(), prev = -1;   long sum, mod = (long) 1e9 + 7, p;   long[] deep = new long[n + 10];   deep[0] = 1;   char c;   for (int cur = 0; cur < n; cur++) {    c = in.nextLine().charAt(0);    if (prev + 1 != cur) {     sum = 0;     if (c == 'f') {      for (int i = deep.length - 1; i > 0; i--) {       sum += deep[i - 1];       sum %= mod;       deep[i] = sum;      }      deep[0] = 0;     } else {      for (int i = deep.length - 1; i >= 0; i--) {       sum += deep[i];       sum %= mod;       deep[i] = sum;      }     }    }    if (c != 's') {     if (cur == prev + 1) {      for (int i = deep.length - 1; i > 0; i--) {       deep[i] = deep[i - 1];      }      deep[0] = 0;     }     prev = cur;    }       }   long ans = 0;   for (int i = 0; i < deep.length; i++) {    ans += deep[i];    ans %= mod;   }   out.println(ans);  }  private void solveD() throws IOException {  }  private void solveE() throws IOException {  }  class FastScanner {   StringTokenizer st;   BufferedReader br;   FastScanner(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }   String next() throws IOException {    while (st == null || !st.hasMoreTokens())     st = new StringTokenizer(br.readLine());    return st.nextToken();   }   boolean hasNext() throws IOException {    return br.ready() || (st != null && st.hasMoreTokens());   }   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 {    return br.readLine();   }   boolean hasNextLine() throws IOException {    return br.ready();   }  }  private void run() throws IOException {   in = new FastScanner(System.in);   out = new PrintWriter(System.out);    solve();   out.flush();   out.close();  }  public static void main(String[] args) throws IOException {   new Main().run();  } }
6	public class E {  PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer tok;  public void go() throws IOException  {   StringTokenizer tok = new StringTokenizer(in.readLine());   int zzz = Integer.parseInt(tok.nextToken());   for (int zz = 0; zz < zzz; zz++)   {    ntok();    int n = ipar();    int m = ipar();    int[][] mat = new int[n][m];    for (int i = 0; i < n; i++)    {     ntok();     mat[i] = iapar(m);    }    long[][] dp = new long[1 << n][m+1];    for (int i = 0; i < 1 << n; i++)    {     dp[i][m] = -1000000000;    }    dp[(1 << n) - 1][m] = 0;    for (int i = m-1; i >= 0; i--)    {     for (int e = 0; e < 1 << n; e++)     {      dp[e][i] = dp[e][i+1];      for (int w = 0; w < 1 << n; w++)      {       if ((e & w) == 0)       {        dp[e][i] = Math.max(dp[e][i], best(w, mat, i) + dp[e|w][i+1]);       }      }     }    }                  out.println(dp[0][0]);   }   out.flush();   in.close();  }  public long best(int mask, int[][] mat, int col)  {   long max = 0;   for (int t = 0; t < mat.length; t++)   {    long sum = 0;    int mk = mask;    for (int i = 0; i < mat.length; i++)    {     if (mk % 2 == 1)     {      sum += mat[i][col];     }     mk /= 2;    }    max = Math.max(max, sum);    cycle(mat, col);   }   return max;  }  public void cycle(int[][] mat, int col)  {   int temp = mat[0][col];   for (int i = 0; i < mat.length-1; i++)   {    mat[i][col] = mat[i+1][col];   }   mat[mat.length-1][col] = temp;  }  public void ntok() throws IOException  {   tok = new StringTokenizer(in.readLine());  }  public int ipar()  {   return Integer.parseInt(tok.nextToken());  }  public int[] iapar(int n)  {   int[] arr = new int[n];   for (int i = 0; i < n; i++)   {    arr[i] = ipar();   }   return arr;  }  public long lpar()  {   return Long.parseLong(tok.nextToken());  }  public long[] lapar(int n)  {   long[] arr = new long[n];   for (int i = 0; i < n; i++)   {    arr[i] = lpar();   }   return arr;  }  public double dpar()  {   return Double.parseDouble(tok.nextToken());  }  public String spar()  {   return tok.nextToken();  }  public static void main(String[] args) throws IOException  {   new E().go();  } }
5	public class BetaRound15_A implements Runnable {  final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer("");  void init() 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");  } }  String readString() throws IOException {  while (!tok.hasMoreTokens()) {  tok = new StringTokenizer(in.readLine());  }  return tok.nextToken(); }  int readInt() throws IOException {  return Integer.parseInt(readString()); }  @Override 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);  } }  public static void main(String[] args) {  new Thread(new BetaRound15_A()).start(); }  class House implements Comparable<House> {  int left, right;  House(int left, int right) {  this.left = left;  this.right = right;  }  @Override  public int compareTo(House h) {  return this.left - h.left;  } }  int getAns(House h1, House h2, int t) {  int d = h2.left - h1.right;  if (d < t) return 0;  if (d == t) return 1;  return 2; }  void solve() throws IOException {  int n = readInt();  int t = readInt() * 2;  House[] h = new House[n];  for (int i = 0; i < n; i++) {  int c = readInt() * 2;  int b = readInt();  h[i] = new House(c - b, c + b);  }  Arrays.sort(h);  int ans = 2;  for (int i = 1; i < n; i++) {  ans += getAns(h[i - 1], h[i], t);  }  out.print(ans); } }
4	public class CF_35C {  public static void main(String[] args) throws IOException{   BufferedReader f = new BufferedReader(new FileReader("input.txt"));   PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));   StringTokenizer st1 = new StringTokenizer(f.readLine());   int n = Integer.parseInt(st1.nextToken());   int m = Integer.parseInt(st1.nextToken());   boolean[][] visited = new boolean[n][m];   int k = Integer.parseInt(f.readLine());   LinkedList<state1> ll = new LinkedList<state1>();   StringTokenizer st = new StringTokenizer(f.readLine());   for(int i = 0; i < k; i++) {    int x = Integer.parseInt(st.nextToken());    int y = Integer.parseInt(st.nextToken());    ll.add(new state1(x - 1, y - 1));    visited[x - 1][y - 1] = true;   }   int lastx = 1;   int lasty = 1;   while(!ll.isEmpty()) {    state1 focus = ll.remove();    lastx = focus.x+1;    lasty = focus.y+1;        visited[focus.x][focus.y] = true;    if(focus.x+1 < n && !visited[focus.x+1][focus.y]) {     ll.add(new state1(focus.x+1, focus.y));     visited[focus.x+1][focus.y] = true;    }    if(focus.x-1 >= 0 && !visited[focus.x-1][focus.y]) {     ll.add(new state1(focus.x-1, focus.y));     visited[focus.x-1][focus.y] = true;    }    if(focus.y+1 < m && !visited[focus.x][focus.y+1]) {     ll.add(new state1(focus.x, focus.y+1));     visited[focus.x][focus.y+1] = true;    }    if(focus.y-1 >= 0 && !visited[focus.x][focus.y-1]) {     ll.add(new state1(focus.x, focus.y-1));     visited[focus.x][focus.y-1] = true;    }   }   out.println(lastx + " " + lasty);   out.close();  } } class state1 {  int x, y;  state1(int x, int y) {   this.x = x; this.y = y;  } }
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 P23A {  public P23A() {   Scanner sc = new Scanner(System.in);   String str = sc.next();   sc.close();     String maxStr = "";   for (int i = 0; i < str.length() - 1; i++){    for (int j = i + 1; j < str.length(); j++){     String pattern = str.substring(i, j);     if (str.substring(i+1).contains(pattern) && pattern.length() > maxStr.length()){      maxStr = pattern;     }    }   }   System.out.println(maxStr.length());  }   public static void main (String []args){   new P23A();  } }
1	public class AA{  public static void main(String[] args) {  Scanner sc=new Scanner(System.in);   int t=0;   if(sc.hasNextInt()) {   t=sc.nextInt();   }   while(t>0) {   t--;   int n=sc.nextInt();   String ans="NO";   if(n%2==0) {    int p=n/2;    if(Math.ceil(Math.sqrt((double)p)) == Math.floor(Math.sqrt((double)p))){    ans="YES";    }    else {    if(n%4==0) {     p=n/4;     if(Math.ceil(Math.sqrt((double)p)) == Math.floor(Math.sqrt((double)p))){     ans="YES";     }    }    }   }   System.out.println(ans);   }  } }
3	public class Main3 implements Runnable {  public static void main(String[] args) {   new Thread(null, new Main3(), "", 128 * 1024 * 1024).start();  }  private static Scanner in = new Scanner(System.in);  public void run() {   int n = in.nextInt();   int m = 1_000_000_007;   boolean[] state = new boolean[n];   for (int i = 0; i < n; i++) {    state[i] = in.next().equals("f");   }     long[][] dp = new long[n][n + 1];   dp[0][0] = 1;     for (int i = 0; i < n - 1; i++) {    if (state[i]) {         for (int j = 0; j < n - 1; j++) {      dp[i + 1][j + 1] = dp[i][j];     }    } else {         for (int j = n - 1; j >= 0; j--) {           dp[i + 1][j] = (dp[i][j] + dp[i + 1][j + 1]) % m;     }    }   }   long sum = 0;   for (int i = 0; i < n; i++) {    sum += dp[n - 1][i] % m;   }   System.out.println(sum % m);  } }
2	public class Main {  private static void solve() {  long x = nl();  long k = nl();  long mod = 1000000000 + 7;   if (x == 0) {  System.out.println(0);  } else if (k == 0) {  System.out.println(x * 2 % mod);    } else {    x %= mod;   long a;  a = (x - 1 + mod) * pow(2, k, mod) + 1;  a %= mod;   long b = x * pow(2, k, mod);  b %= mod;    System.out.println((a + b) % mod);  } }  public static long pow(long a, long n, long mod) {   long ret = 1;   int x = 63-Long.numberOfLeadingZeros(n);  for(;x >= 0;x--){   ret = ret * ret % mod;   if(n<<~x<0)ret = ret * a % mod;  }  return ret; }  public static void main(String[] args) {  new Thread(null, new Runnable() {  @Override  public void run() {   long start = System.currentTimeMillis();   String debug = args.length > 0 ? args[0] : null;   if (debug != null) {   try {    is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));   } catch (Exception e) {    throw new RuntimeException(e);   }   }   reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);   solve();   out.flush();   tr((System.currentTimeMillis() - start) + "ms");  }  }, "", 64000000).start(); }  private static java.io.InputStream is = System.in; private static java.io.PrintWriter out = new java.io.PrintWriter(System.out); private static java.util.StringTokenizer tokenizer = null; private static java.io.BufferedReader reader;  public static String next() {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  try {   tokenizer = new java.util.StringTokenizer(reader.readLine());  } catch (Exception e) {   throw new RuntimeException(e);  }  }  return tokenizer.nextToken(); }  private static double nd() {  return Double.parseDouble(next()); }  private static long nl() {  return Long.parseLong(next()); }  private static int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = ni();  return a; }  private static char[] ns() {  return next().toCharArray(); }  private static long[] nal(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)  a[i] = nl();  return a; }  private static int[][] ntable(int n, int m) {  int[][] table = new int[n][m];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   table[i][j] = ni();  }  }  return table; }  private static int[][] nlist(int n, int m) {  int[][] table = new int[m][n];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   table[j][i] = ni();  }  }  return table; }  private static int ni() {  return Integer.parseInt(next()); }  private static void tr(Object... o) {  if (is != System.in)  System.out.println(java.util.Arrays.deepToString(o)); } }
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());   }  } }
0	public class Contest200C {  public static void main(String[] args) throws Exception {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(in.readLine());  long a = Long.parseLong(st.nextToken());  long b = Long.parseLong(st.nextToken());   System.out.println(min(a,b)); }  static long min(long a, long b) {  if (a <= 0 || b <= 0) return 0;  return a/b+min(b,a%b); } }
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");  } }
6	public class task { public static void main(String args[]) {  Scanner a = new Scanner(System.in);   while(a.hasNext())  {  int n = a.nextInt();  int m = a.nextInt();  if(n == 0 && m == 0) break;     boolean[][] adj = new boolean[n][n];  long res = 0;    for (int i = 0; i < m; ++i) {   int x = a.nextInt();   int y = a.nextInt();   adj[x - 1][y - 1] = true;   adj[y - 1][x - 1] = true;  }    for (int i = 0; i < n; ++i)   for (int j = i + 1; j < n; ++j)    if (adj[i][j])    --res;      for (int i = 0; i < n; ++i)   {   long[][] dp = new long[n - i][1 << (n - i)];   dp[0][0] = 1;   for (int mask = 0; mask < (1 << (n - i)); ++mask)   {   for (int j = 0; j < n - i; ++j)    {    if (dp[j][mask] != 0)    {    for (int k = 0; k < n - i; ++k)     {     if (((mask >> k) & 1) == 0 && adj[j + i][k + i])      dp[k][mask | (1 << k)] += dp[j][mask];         }    }   }   if (((mask >> 0) & 1) != 0) {    res += dp[0][mask];   }   }  }  System.out.println(res/2);  } } }
5	public class A {  private void solve() throws IOException {   int n = nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = nextInt();   }   Arrays.sort(a);   int sum = 0;   for (int i = a.length - 1; i >= 0; i--) {    sum += a[i];    int k = 0;    for (int j = 0; j < i; j++)     k += a[j];    if (sum > k) {     pl(a.length - i);     return;    }   }  }  public static void main(String[] args) {   new A().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();  } }
5	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()); }  class Dom implements Comparable<Dom>{  int x, a;  public int compareTo(Dom o) {  return x - o.x;  } }  void solve() throws Exception {  int n = nextInt();  int t = nextInt() * 2;  Dom[] a = new Dom[n];  for (int i = 0; i < n; i++) {  a[i] = new Dom();  a[i].x = nextInt() * 2;  a[i].a = nextInt();  }  Arrays.sort(a);  int ans = 2;  for (int i = 0; i < n - 1; i++) {  if (t < a[i + 1].x - a[i + 1].a - a[i].x - a[i].a) ans += 2;  if (t == a[i + 1].x - a[i + 1].a - a[i].x - a[i].a) ans += 1;  }  out.print(ans); }  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(); } }
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;  } } }
2	public class P255D {  @SuppressWarnings("unchecked") public void run() throws Exception {  long n = nextLong();  long x = nextLong();  long y = nextLong();  long c = nextLong();  if ((n == 1) || (c == 1)) {  println(0);  return;  }  x = Math.min(x, n - x + 1);  y = Math.min(y, n - y + 1);  long t = 0;  long s = 1;  while (s < c) {  t++;   s += (t * 4) + ((t >= x + y) ? (t - x - y + 1) : 0)    - ((t >= x) ? (t - x) * 2 + 1 : 0)    - ((t >= y) ? (t - y) * 2 + 1 : 0)    + ((t >= x + n - y + 1) ? (t - x - n + y) : 0)    + ((t >= n - x + 1 + y) ? (t - n + x - y) : 0)    - ((t >= n - x + 1) ? (t - n + x - 1) * 2 + 1 : 0)    - ((t >= n - y + 1) ? (t - n + y - 1) * 2 + 1 : 0);  }  println(t); }  public static void main(String... args) throws Exception {  br = new BufferedReader(new InputStreamReader(System.in));  pw = new PrintWriter(new BufferedOutputStream(System.out));  new P255D().run();  br.close();  pw.close(); }  static BufferedReader br; static PrintWriter pw; StringTokenizer stok;  String nextToken() throws IOException {  while (stok == null || !stok.hasMoreTokens()) {  String s = br.readLine();  if (s == null) { return null; }  stok = new StringTokenizer(s);  }  return stok.nextToken(); }  void print(byte b) { print("" + b); } void print(int i) { print("" + i); } void print(long l) { print("" + l); } void print(double d) { print("" + d); } void print(char c) { print("" + c); } void print(Object o) {  if (o instanceof int[]) { print(Arrays.toString((int [])o));  } else if (o instanceof long[]) { print(Arrays.toString((long [])o));  } else if (o instanceof char[]) { print(Arrays.toString((char [])o));  } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));  } else if (o instanceof short[]) { print(Arrays.toString((short [])o));  } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));  } else if (o instanceof float[]) { print(Arrays.toString((float [])o));  } else if (o instanceof double[]) { print(Arrays.toString((double [])o));  } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));  } else { print("" + o); } } void print(String s) { pw.print(s); } void println() { println(""); } void println(byte b) { println("" + b); } void println(int i) { println("" + i); } void println(long l) { println("" + l); } void println(double d) { println("" + d); } void println(char c) { println("" + c); } void println(Object o) { print(o); println(""); } void println(String s) { pw.println(s); } int nextInt() throws IOException { return Integer.parseInt(nextToken()); } long nextLong() throws IOException { return Long.parseLong(nextToken()); } double nextDouble() throws IOException { return Double.parseDouble(nextToken()); } char nextChar() throws IOException { return (char) (br.read()); } String next() throws IOException { return nextToken(); } String nextLine() throws IOException { return br.readLine(); } int [] readInt(int size) throws IOException {  int [] array = new int [size];  for (int i = 0; i < size; i++) { array[i] = nextInt(); }  return array; } long [] readLong(int size) throws IOException {  long [] array = new long [size];  for (int i = 0; i < size; i++) { array[i] = nextLong(); }  return array; } double [] readDouble(int size) throws IOException {  double [] array = new double [size];  for (int i = 0; i < size; i++) { array[i] = nextDouble(); }  return array; } String [] readLines(int size) throws IOException {  String [] array = new String [size];  for (int i = 0; i < size; i++) { array[i] = nextLine(); }  return array; } }
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));      }       } }
0	public class E {  static Scanner in; static int next() throws Exception {return in.nextInt();};   static PrintWriter out;  public static void main(String[] args) throws Exception {   in = new Scanner(System.in);    out = new PrintWriter(System.out);   int n = next();   if (n%4 == 0||n%7 == 0||n%44 == 0||n%47 == 0||n%74 == 0||n%77 == 0||n%444 == 0||n%447 == 0||n%474 == 0||n%744 == 0||n%774 == 0||n%747 == 0||n%477 == 0||n%777==0) out.println("YES");   else out.println("NO");   out.println();   out.close();  } }
1	public class cf1 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(), m = s.nextInt();    int[] a = new int[n + 1];    for(int i = 1; i <= n; i++)   a[i] = s.nextInt();    int[] b = new int[n + 1];    for(int i = 1; i <= n; i++)   b[i] = s.nextInt();    ArrayList<Integer> list = new ArrayList<Integer>();    list.add(a[1]);    for(int i = 2; i <= n; i++) {   list.add(b[i]); list.add(a[i]);  }    list.add(b[1]);    double wt = m;  boolean check = true;    for(int i = list.size() - 1; i >= 0; i--) {     if(list.get(i) <= 1) {   check = false; break;   }     double x = wt / (list.get(i) - 1);      wt += x;  }    if(check)   w.println(wt - m);  else   w.println(-1);  }   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 cf1(),"cf1",1<<26).start(); } }
3	public class CC { public static void main(String[] args)throws Throwable {  MyScanner sc=new MyScanner();  PrintWriter pw=new PrintWriter(System.out);   n=sc.nextInt();  s=new char [n];  for(int i=0;i<n;i++)  s[i]=sc.next().charAt(0);  mem=new int [2*n+1][n+1];  for(int [] x : mem)  Arrays.fill(x, -1);  pw.println(dp(0, 0));   pw.flush();  pw.close(); } static int n; static char [] s; static int [][] mem;  static int dp(int i,int j){  if(i==n)  return j==0? 1 : 0;  if(mem[i][j]!=-1)  return mem[i][j];  int ans=0;  if(s[i]=='f'){  ans+=dp(i+1, j+1);  ans%=mod;  }else{  ans+=dp(i+1, j);  ans%=mod;  if(j>0){   ans+=dp(i, j-1);   ans%=mod;  }  }   return mem[i][j]=ans; }  static int mod=(int)(1e9+7);  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 first { static int max = 1000000000; public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int[] tab = new int[n];  for(int i=0;i<n;i++) {  tab[i] = sc.nextInt();  }  for(int i=0;i<n;i++) {  for(int j=0;j<n;j++) {   if(i!=j)   if(tab[i]>=tab[j] && tab[i]%tab[j]==0) {   tab[i] = max;   }  }  }  int res = 0;  for(int i=0;i<n;i++) {  if(tab[i]!=max) res++;  }  System.out.println(res);   } }
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}; }
0	public class A { public static void main(String [] args) throws IOException {  Scanner in = new Scanner(System.in);  System.out.println(rec(in.nextLong(), in.nextLong()));  }  private static long rec(long a, long b) {  return b == 0 ? 0 : a/b + rec(b, a%b); } }
5	public class Solution {  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);    int n = sc.nextInt();   int t = sc.nextInt();   TreeMap<Integer, Integer> h = new TreeMap<Integer, Integer>();   for (int i=0; i < n; i++) {    int key = sc.nextInt();    h.put(key, sc.nextInt());   }   int ans = 2;   Integer lastKey = h.firstKey();   Integer last = h.get(lastKey);   h.remove(lastKey);   for (int i=1; i < n; i++) {    int key = h.firstKey();    int val = h.get(key);       if (Math.abs(key-val*1.0/2 - (lastKey + last*1.0/2)) == t) {     ans++;    } else if (Math.abs(key-val*1.0/2 - (lastKey + last*1.0/2)) > t) {     ans += 2;    }    lastKey = key;    last = val;    h.remove(lastKey);   }   System.out.println(ans);     sc.close();  }  }
5	public class prob1 { public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int n = input.nextInt();  if(n == 1)  {   int m = input.nextInt();  System.out.println("NO");   return;  }  int[] num = new int[n];  boolean flag = false;  for(int i = 0; i < n; i++)  {  num[i] = input.nextInt();  if(num[i] != num[0])   flag = true;  }  if(!flag)  {  System.out.println("NO");  return;  }  int min = Integer.MAX_VALUE;  for(int i = 0; i < n; i++)  if(num[i] < min)   min = num[i];  int min2 = Integer.MAX_VALUE;  for(int i = 0; i < n; i++)  if(num[i] <= min2 && num[i] > min)   min2 = num[i];  System.out.println(min2);   } }
5	public class A implements Runnable {  final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  BufferedReader in; PrintWriter out; StringTokenizer tok;  @Override public void run() {  try {  long startTime = System.currentTimeMillis();  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");  }  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) {  if (!ONLINE_JUDGE) {  System.err.println(Arrays.deepToString(o));  } }  public static void main(String[] args) {  new Thread(null, new A(), "", 256 * 1024 * 1024).start(); }  static class Utils {  private Utils() {}  public static void mergeSort(int[] a) {  mergeSort(a, 0, a.length - 1);  }  private static void mergeSort(int[] a, int leftIndex, int rightIndex) {  final int MAGIC_VALUE = 50;  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 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;  }  }  }    void solve() throws IOException {  int n = readInt();  int[] a = new int[n];  int sum = 0;  for (int i = 0; i < n; i++) {  a[i] = readInt();  sum += a[i];  }  Utils.mergeSort(a);  int s = 0, c = 0;  for (int i = n-1; i >= 0; i--) {  s += a[i];  c++;  if (2 * s > sum) {   break;  }  }  out.println(c);   }  }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, InputReader in, PrintWriter out) {    long x = in.nextLong();    long k = in.nextLong();    long max2 = (((x % 1_000_000_007) * (pb(k))) % 1_000_000_007) % 1_000_000_007;    long min2 = ((((x - 1) % 1_000_000_007) * pb(k)) % 1_000_000_007 + 1) % 1_000_000_007;    if (x == 0) min2 = 0;    out.println((max2 + min2) % 1_000_000_007);   }   long pb(long a) {    if (a == 0) return 1;    if (a == 1) return 2;    long tmp = pb(a / 2);    if (a % 2 == 0) return (tmp * tmp) % 1_000_000_007;    return (((tmp * tmp) % 1_000_000_007) * 2) % 1_000_000_007;   }  }  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 long nextLong() {    return Long.parseLong(next());   }  } }
4	public class Main {   BufferedReader in;  PrintWriter out;  public static void main(String[] args) throws IOException {   new Main().run();  }  void run() throws IOException {     in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(new OutputStreamWriter(System.out));   String s = in.readLine();   int n = s.length();   for(int len = n; len > 0; len--) {    for(int i = 0; i + len <= n; i++) {     for(int j = 0; j + len <= n; j++)      if(i != j) {       boolean f = true;       for(int k = 0; k < len; k++)        if(s.charAt(i + k) != s.charAt(j + k)) {         f = false;         break;        }       if(f) {        out.println(len);        out.flush();        return;       }      }    }   }   out.println(0);   out.flush();  }  void solve() throws IOException {    }    }
1	public class Main{  static long MOD = 1_000_000_007L;     static long inv2 = (MOD + 1) / 2;  static int[][] dir = new int[][]{{1, 0}, {0, 1}, {-1, 0}, {0, -1}};  static long lMax = 0x3f3f3f3f3f3f3f3fL;  static int iMax = 0x3f3f3f3f;  static HashMap <Long, Long> memo = new HashMap();  static MyScanner sc = new MyScanner();    static int nn = 300000;  static long[] pow2;  static long [] fac;  static long [] pow;  static long [] inv;  static long [] facInv;  static int[] base;  static int[] numOfDiffDiv;  static int[] numOfDiv;  static ArrayList <Integer> primes;   static int ptr = 0;  static boolean[] isPrime;    public static PrintWriter out;  public static void main(String[] args) {   out = new PrintWriter(new BufferedOutputStream(System.out));                                 int t = 1, tt = 0;   t = sc.ni();   for(int i = 1; i <40000; i++) squares.add(i * i);   while(tt++ < t) {    boolean res = solve();       out.println(res ? "YES" : "NO");   }   out.close();  }  static HashSet <Integer> squares = new HashSet();  static boolean solve() {             long res = 0;   int n = sc.ni();   if(n % 2 == 0 && squares.contains(n / 2)) return true;   if(n % 4 == 0 && squares.contains(n / 4)) return true;   return false;  }    public static int[][] packU(int n, int[] from, int[] to) {   return packU(n, from, to, from.length);  }  public static int[][] packU(int n, int[] from, int[] to, int sup) {   int[][] g = new int[n][];   int[] p = new int[n];   for (int i = 0; i < sup; i++) p[from[i]]++;   for (int i = 0; i < sup; i++) p[to[i]]++;   for (int i = 0; i < n; i++) g[i] = new int[p[i]];   for (int i = 0; i < sup; i++) {    g[from[i]][--p[from[i]]] = to[i];    g[to[i]][--p[to[i]]] = from[i];   }   return g;  }    public static int[] diameter(int[][] g) {   int n = g.length;   int f0 = -1, f1 = -1, d01 = -1;   int[] q = new int[n];   boolean[] ved = new boolean[n];   {    int qp = 0;    q[qp++] = 0; ved[0] = true;    for(int i = 0;i < qp;i++){     int cur = q[i];     for(int e : g[cur]){      if(!ved[e]){       ved[e] = true;       q[qp++] = e;       continue;      }     }    }    f0 = q[n-1];   }   {    int[] d = new int[n];    int qp = 0;    Arrays.fill(ved, false);    q[qp++] = f0; ved[f0] = true;    for(int i = 0;i < qp;i++){     int cur = q[i];     for(int e : g[cur]){      if(!ved[e]){       ved[e] = true;       q[qp++] = e;       d[e] = d[cur] + 1;       continue;      }     }    }    f1 = q[n-1];    d01 = d[f1];   }   return new int[]{d01, f0, f1};  }  public static long c(int n, int k) {   return (fac[n] * facInv[k] % MOD) * facInv[n - k] % MOD;  }    public static class SegmentTreeRMQ {   public int M, H, N;   public int[] st;   public SegmentTreeRMQ(int n)   {    N = n;    M = Integer.highestOneBit(Math.max(N-1, 1))<<2;    H = M>>>1;    st = new int[M];    Arrays.fill(st, 0, M, Integer.MAX_VALUE);   }   public SegmentTreeRMQ(int[] a)   {    N = a.length;    M = Integer.highestOneBit(Math.max(N-1, 1))<<2;    H = M>>>1;    st = new int[M];    for(int i = 0;i < N;i++){     st[H+i] = a[i];    }    Arrays.fill(st, H+N, M, Integer.MAX_VALUE);    for(int i = H-1;i >= 1;i--)propagate(i);   }   public void update(int pos, int x)   {    st[H+pos] = x;    for(int i = (H+pos)>>>1;i >= 1;i >>>= 1)propagate(i);   }   private void propagate(int i)   {    st[i] = Math.min(st[2*i], st[2*i+1]);   }   public int minx(int l, int r){    int min = Integer.MAX_VALUE;    if(l >= r)return min;    while(l != 0){     int f = l&-l;     if(l+f > r)break;     int v = st[(H+l)/f];     if(v < min)min = v;     l += f;    }    while(l < r){     int f = r&-r;     int v = st[(H+r)/f-1];     if(v < min)min = v;     r -= f;    }    return min;   }   public int min(int l, int r){ return l >= r ? 0 : min(l, r, 0, H, 1);}   private int min(int l, int r, int cl, int cr, int cur)   {    if(l <= cl && cr <= r){     return st[cur];    }else{     int mid = cl+cr>>>1;     int ret = Integer.MAX_VALUE;     if(cl < r && l < mid){      ret = Math.min(ret, min(l, r, cl, mid, 2*cur));     }     if(mid < r && l < cr){      ret = Math.min(ret, min(l, r, mid, cr, 2*cur+1));     }     return ret;    }   }  }  public static char[] rev(char[] a){char[] b = new char[a.length];for(int i = 0;i < a.length;i++)b[a.length-1-i] = a[i];return b;}  public static double dist(double a, double b){   return Math.sqrt(a * a + b * b);  }  public static long inv(long a){   return quickPOW(a, MOD - 2);  }  public class Interval {   int start;   int end;   public Interval(int start, int end) {    this.start = start;    this.end = end;   }  }  public static ArrayList<Integer> sieveOfEratosthenes(int n) {   boolean prime[] = new boolean[n + 1];   Arrays.fill(prime, true);   for (int p = 2; p * p <= n; p++) {    if (prime[p]) {     for (int i = p * 2; i <= n; i += p) {      prime[i] = false;     }    }   }   ArrayList<Integer> primeNumbers = new ArrayList<>();   for (int i = 2; i <= n; i++) {    if (prime[i]) {     primeNumbers.add(i);    }   }   return primeNumbers;  }   public static int lowerBound(int[] a, int v){ return lowerBound(a, 0, a.length, v); }  public static int lowerBound(int[] a, int l, int r, int v)  {   if(l > r || l < 0 || r > a.length)throw new IllegalArgumentException();   int low = l-1, high = r;   while(high-low > 1){    int h = high+low>>>1;    if(a[h] >= v){     high = h;    }else{     low = h;    }   }   return high;  }  public static int rlowerBound(int[] a, int v){ return lowerBound(a, 0, a.length, v); }  public static int rlowerBound(int[] a, int l, int r, int v)  {   if(l > r || l < 0 || r > a.length)throw new IllegalArgumentException();   int low = l-1, high = r;   while(high-low > 1){    int h = high+low>>>1;    if(a[h] <= v){     high = h;    }else{     low = h;    }   }   return high;  }  public static long C(int n, int m)  {   if(m == 0 || m == n) return 1l;   if(m > n || m < 0) return 0l;   long res = fac[n] * quickPOW((fac[m] * fac[n - m]) % MOD, MOD - 2) % MOD;   return res;  }  public static long quickPOW(long n, long m)  {   long ans = 1l;   while(m > 0)   {    if(m % 2 == 1)     ans = (ans * n) % MOD;    n = (n * n) % MOD;    m >>= 1;   }   return ans;  }  public static long quickPOW(long n, long m, long mod)  {   long ans = 1l;   while(m > 0)   {    if(m % 2 == 1)     ans = (ans * n) % mod;    n = (n * n) % mod;    m >>= 1;   }   return ans;  }  public static int gcd(int a, int b)  {   if(a % b == 0) return b;   return gcd(b, a % b);  }  public static long gcd(long a, long b)  {   if(a % b == 0) return b;   return gcd(b, a % b);  }  static class Randomized {   public static void shuffle(int[] data) {    shuffle(data, 0, data.length - 1);   }   public static void shuffle(int[] data, int from, int to) {    to--;    for (int i = from; i <= to; i++) {     int s = nextInt(i, to);     int tmp = data[i];     data[i] = data[s];     data[s] = tmp;    }   }   public static void shuffle(long[] data) {    shuffle(data, 0, data.length - 1);   }   public static void shuffle(long[] data, int from, int to) {    to--;    for (int i = from; i <= to; i++) {     int s = nextInt(i, to);     long tmp = data[i];     data[i] = data[s];     data[s] = tmp;    }   }   public static int nextInt(int l, int r) {    return RandomWrapper.INSTANCE.nextInt(l, r);   }  }  static class RandomWrapper {   private Random random;   public static final RandomWrapper INSTANCE = new RandomWrapper(new Random());   public RandomWrapper() {    this(new Random());   }   public RandomWrapper(Random random) {    this.random = random;   }   public int nextInt(int l, int r) {    return random.nextInt(r - l + 1) + l;   }  }    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 ni() {    return Integer.parseInt(next());   }   long nl() {    return Long.parseLong(next());   }   double nd() {    return Double.parseDouble(next());   }   String nextLine(){    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  }  }
1	public class HamstersAndTigers {  public static void main(String[] args) {  Scanner sc = new Scanner(new BufferedInputStream(System.in));  int numAnimals = sc.nextInt();  String positions = sc.next();  int numTigers = 0;  int numHamsters = 0;  for(int i = 0; i < positions.length(); i++) {  if(positions.charAt(i) == 'T') {   numTigers++;  } else {   numHamsters++;  }  }  int minDifference = Integer.MAX_VALUE;  StringBuilder tigerChars = new StringBuilder(1000);  StringBuilder hamsterChars = new StringBuilder(1000);  for(int i = 0; i < numHamsters; i++) {  hamsterChars.append('H');  }  StringBuilder remainingTigerChars = new StringBuilder(1000);  for(int i = 0; i < numTigers; i++) {  remainingTigerChars.append('T');  }  for(int i = 0; i <= numTigers; i++) {  StringBuilder generated = new StringBuilder();  generated.append(tigerChars);  generated.append(hamsterChars);  generated.append(remainingTigerChars);       if(remainingTigerChars.length() >= 1) {   remainingTigerChars.deleteCharAt(remainingTigerChars.length() - 1);  }  tigerChars.append('T');   int diffCount = stringDiffCount(positions, generated.toString());  if(diffCount < minDifference) {   minDifference = diffCount;  }  }    hamsterChars = new StringBuilder(1000);  tigerChars = new StringBuilder(1000);  for(int i = 0; i < numTigers; i++) {  tigerChars.append('T');  }  StringBuilder remainingHamsterChars = new StringBuilder(1000);  for(int i = 0; i < numHamsters; i++) {  remainingHamsterChars.append('H');  }  for(int i = 0; i <= numHamsters; i++) {  StringBuilder generated = new StringBuilder();  generated.append(hamsterChars);  generated.append(tigerChars);  generated.append(remainingHamsterChars);     if(remainingHamsterChars.length() >= 1) {   remainingHamsterChars.deleteCharAt(remainingHamsterChars.length() - 1);  }  hamsterChars.append('H');   int diffCount = stringDiffCount(positions, generated.toString());  if(diffCount < minDifference) {   minDifference = diffCount;  }  }  System.out.println(minDifference / 2); }  private static int stringDiffCount(String strOne, String strTwo) {  int diffCount = 0;  for(int i = 0; i < strOne.length(); i++) {  if(strOne.charAt(i) != strTwo.charAt(i)) {   diffCount++;  }  }  return diffCount; } }
2	public class Problem {   public static void main(String[] args) throws Exception {   Scanner input = new Scanner(System.in);   int side = input.nextInt()-1;   int x = input.nextInt()-1;   int y = input.nextInt()-1;   long target = input.nextLong();        int[] to_sides = {y, side - x, side - y, x};   int[] to_corners = {(y+1)+(side-x+1),(side-x+1)+(side-y+1),(side-y+1)+(x+1),    (x+1)+(y+1)};   int min = Math.min(Math.min(y, x), Math.min(side - x, side - y));   int[] after_pass = {1, 1, 1, 1};   int[] corner_share = {1,1,1,1};   int steps = 0 , i;   long init = 1 ;   int grown = 4;   while (init < target) {    init += grown;    steps++;    if (steps >= min) {     for (i = 0; i < 4; i++) {      if (steps > to_sides[i]) {       init -= after_pass[i];       after_pass[i] += 2;      }      if (steps >= to_corners[i]){       init += corner_share[i]++;            }     }    }    grown += 4;   }   System.out.println(steps);  } }
5	public class CottageVillage {   public static void main(String... args) {   Scanner sc = new Scanner(System.in);     int n = sc.nextInt();   int k = sc.nextInt();     TreeMap<Integer, Integer> tm = new TreeMap<Integer, Integer>();   while (n-->0) {    tm.put(sc.nextInt(), sc.nextInt());   }     int cnt=2, x=0, a=0;   double diff=0;   for(Map.Entry<Integer, Integer> e : tm.entrySet()) {    if (x!=0 || a!=0) {     diff = Math.abs(e.getKey()-x-e.getValue()*0.5-a*0.5);     if (diff-k>0) cnt+=2;     else if (diff-k==0) cnt++;    }    x=e.getKey();    a=e.getValue();   }   System.out.println(cnt);  } }
0	public class Main{ public static void main(String[] args){  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  if (n % 4 == 0 || n % 7 == 0 || n % 47 == 0 || n % 77 == 0 || n % 74 == 0 || n % 447 == 0 || n % 474 == 0 || n % 477 == 0 || n % 747 == 0 || n % 774 == 0 || n % 777 == 0)  System.out.println("YES");  else  System.out.println("NO"); } }
5	public class D { public static void main(String[] args) {  init();  int n = in.nextInt();  long total = 0L;   int arr[] = new int[n+5];  Map<Integer, Integer> freq = new HashMap<>();  Map<Integer, Integer> kiri = new HashMap<>();  for (int i = 1; i <= n; ++i){  arr[i] = in.nextInt();  if (freq.containsKey(arr[i])) {   freq.put(arr[i], freq.get(arr[i])+1);  } else {   freq.put(arr[i], 1);   kiri.put(arr[i], 0);  }  total += (long)arr[i];  }  BigInteger ans = BigInteger.valueOf(0L);  for (int i = 1; i <= n - 1; ++i) {  kiri.put(arr[i], kiri.get(arr[i])+1);  total -= arr[i];   int cnt_kanan = n - i;  long temp = total;  int cnt_sama = freq.get(arr[i]) - kiri.get(arr[i]);  temp -= (cnt_sama)*(long)arr[i];  cnt_kanan -= (cnt_sama);  if (freq.containsKey(arr[i]-1)) {   int cnt_kurang = freq.get(arr[i]-1) - kiri.get(arr[i]-1);   cnt_kanan -= cnt_kurang;   temp -= (long) cnt_kurang * (long)(arr[i]-1);  }  if (freq.containsKey(arr[i]+1)) {   int cnt_lebih = freq.get(arr[i]+1) - kiri.get(arr[i]+1);   cnt_kanan -= cnt_lebih;   temp -= (long)(cnt_lebih) * (long)(arr[i]+1);  }  temp -= (long)cnt_kanan * (long)arr[i];  ans = ans.add(BigInteger.valueOf(temp));  }  out.println(ans.toString());  out.close(); }   public static MyScanner in; public static PrintWriter out;  public static void init() {  in = new MyScanner();  out = new PrintWriter(new BufferedOutputStream(System.out)); }  public static class MyScanner {  BufferedReader br;  StringTokenizer st;  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 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);      }       }
3	public class F{  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 class Pair {  int l;  int r;  Pair(int l,int r)  {  this.l = l;  this.r = r;  } } public static void main(String[] args)  {  OutputStream outputStream = System.out;   FastReader sc = new FastReader();   PrintWriter out = new PrintWriter(outputStream);   int n = sc.nextInt();   int a[] = new int[n];   Pair pr;   HashMap<Long,ArrayList> hm = new HashMap<>();   ArrayList<Pair> ar;   for(int i = 0; i < n; i++)   {   a[i] = sc.nextInt();   }   long sum = 0;   for(int r = 0; r < n; r++)   {    sum = 0;   for(int l = r; l >= 0; l--)   {    sum += a[l];    if(!hm.containsKey(sum))    {    ar = new ArrayList<>();    ar.add(new Pair(l,r));    hm.put(sum,ar);    }    else    {    ar = hm.get(sum);    ar.add(new Pair(l,r));    hm.put(sum,ar);    }   }   }     int count = 0;   int maxCount = 0;   long maxSum = 0;   for(Map.Entry<Long,ArrayList> entry:hm.entrySet())   {   sum = entry.getKey();   ar = entry.getValue();   count = 0;   int r = -1;   for(int i = 0; i < ar.size(); i++)   {    if(ar.get(i).l > r)    {    count++;    r = ar.get(i).r;    }   }   if(count > maxCount)   {    maxCount = count;    maxSum = sum;   }      }   ar = hm.get(maxSum);   out.println(maxCount);        int r = -1;   for(int i = 0; i < ar.size(); i++)  {   if(ar.get(i).l > r)   {   out.println((ar.get(i).l+1) +" "+(ar.get(i).r+1));   r = ar.get(i).r;   }  }   out.close(); } }
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;      public Lol (int x , int y){     this.x = x;     this.y = y;    }    @Override    public int compareTo(Lol arg0) {     if (arg0.x == x) {      return y-arg0.y;     }     return arg0.x-x;    }    }  public void solve() throws IOException {     int n = readInt();   int k = readInt();   k--;   Lol [] a = new Lol [n];       for (int i = 0 ; i <n; i++){    int x = readInt();    int y = readInt();    a[i] = new Lol(x, y);   }   Arrays.sort(a);   int ans = 1;   for (int i =k+1; i>-1; i++){    if (i==n) break;    if (a[i].x==a[k].x && a[i].y == a[k].y){     ans++;    }    else break;   }   if (k!=0){    for (int i =k-1; i>=0; i--){     if (a[i].x==a[k].x && a[i].y == a[k].y){      ans++;     }     else break;    }   }   out.print(ans);         } }
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();  } }
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;     }    }   } }
5	public class Main { private static StreamTokenizer in; private static PrintWriter out;  private static int nextInt() throws Exception {  in.nextToken();  return (int)in.nval; }  private static String nextString() throws Exception {  in.nextToken();  return in.sval; }  public static void main(String[] args) throws Exception {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(System.out);   int n = nextInt();  int[] a = new int[n];  for (int i=0; i<n; i++)  a[i] = nextInt();  Arrays.sort(a);  int u = a[0];  for (int i=0; i<n; i++)  if (a[i]>u) {   out.println(a[i]);   out.flush();   return;  }  out.println("NO");  out.flush(); } }
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());  } }
2	public class test {  static boolean DEBUG_FLAG = false;  int INF = (int)1e9;  long MOD = 1000000007;   static void debug(String s) {   if(DEBUG_FLAG) {    System.out.print(s);   }  }   long pow(long a, long n, long mod) {   if (n == 0) {    return 1;   }   long rs = 1;   while (n != 0) {    if (n % 2 == 1) {     rs *= a;    }    rs %= mod;    n >>= 1;    a *= a;    a %= mod;   }   return rs;  }   void solve(InputReader in, PrintWriter out) throws IOException {   long x = in.nextLong();   long k = in.nextLong();   if(x==0) {    out.println(0);    return;   }   long a = (2 * x - 1) % MOD;   long b = pow(2, k, MOD);   a = (a * b) % MOD;   a += 1;   a %= MOD;   out.println(a);  }     public static void main(String[] args) throws IOException {   if(args.length>0 && args[0].equalsIgnoreCase("d")) {    DEBUG_FLAG = true;   }   InputReader in = new InputReader();   PrintWriter out = new PrintWriter(System.out);   int t = 1;   long start = System.nanoTime();   while(t-- >0) {    new test().solve(in, out);   }   long end = System.nanoTime();   debug("\nTime: " + (end-start)/1e6 + " \n\n");   out.close();  }   static class InputReader {   static BufferedReader br;   static StringTokenizer st;    public InputReader() {    br = new BufferedReader(new InputStreamReader(System.in));   }     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());   }  } }
1	public class A25 {  static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); static PrintWriter out = new PrintWriter(System.out);  static int nextInt() throws Exception {  in.nextToken();  return (int)in.nval; }  static String nextString() throws Exception {  in.nextToken();  return in.sval; }  public static void main(String[] args) throws Exception {  int n = nextInt();  int[] c = new int[2];  int[] f = new int[2];  for (int i = 0; i < n; i++) {  int x = nextInt(), p = x%2;  if (c[p]++ == 0) f[p] = i+1;  }  out.println(c[0] == 1 ? f[0] : f[1]);   out.flush(); } }
1	public class Round1B {  public static void main(String[] args) throws Exception {  new Round1B().run(); }  private void run() throws Exception {  Scanner sc = new Scanner(System.in);  int tc = Integer.parseInt(sc.nextLine().trim());  while (tc > 0) {  String s = sc.nextLine().trim();  if (s.matches("R[0-9]+C[0-9]+")) {   Pattern p = Pattern.compile("R([0-9]+)C([0-9]+)");   Matcher m = p.matcher(s);   if (m.matches()) {   int rows = Integer.parseInt(m.group(1));   int cols = Integer.parseInt(m.group(2));   String col = "";   while (cols > 0) {    int mod = (cols - 1) % 26;    col = (char)('A' + mod) + col;    cols = (cols - 1) / 26;   }   System.out.println(col + rows);   } else {   throw new Exception();   }  } else {   Pattern p = Pattern.compile("([A-Z]+)([0-9]+)");   Matcher m = p.matcher(s);   if (m.matches()) {      int rows = Integer.parseInt(m.group(2));   int cols = 0;   int mul = 1;   for (int i = m.group(1).length() - 1; i >= 0; i--) {    cols += mul * (m.group(1).charAt(i) - 'A' + 1);    mul *= 26;   }   System.out.printf("R%dC%d\n", rows, cols);   }   else {   throw new Exception();   }  }   tc--;  }  sc.close(); } }
2	public class Tester {   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 long mod = 1000000007;  public static void main(String[] args) {    solveQ3();   }  private static void solveQ3() {     FastReader sc = new FastReader();   long x = sc.nextLong();  long k = sc.nextLong();   if(x == 0) {  System.out.println(0);  return;  }  long ans = modExp(2, k);  x = (2*x)%mod;  x = (x - 1 + mod)%mod;  ans = (ans*x)%mod;  ans = (ans + 1)%mod;   System.out.println(ans);   }  private static long modExp(long a, long n) {   if(n == 0)  return 1;  if(n%2 == 0)  return modExp((a*a)%mod, n/2);  else  return (a*modExp((a*a)%mod, n/2))%mod;   }  private static void solveQ2() {     FastReader sc = new FastReader();  long l = sc.nextLong();  long r = sc.nextLong();   long x = sc.nextLong();  long y = sc.nextLong();   long n = x*y;  long count = 0;   for(long i=l; (i<=Math.sqrt(n)) && (n/i<=r); i++) {    if((n%i == 0) && (gcd(i, n/i)==x)) {     if(i*i != n)   count += 2;   else   count += 1;     }    }   System.out.println(count);    }  public static long gcd(long a, long b) {   if(b==0)  return a;  else  return gcd(b, a%b);   }  private static void solveQ1() {     FastReader sc = new FastReader();  int n = sc.nextInt();   HashSet<Integer> hs = new HashSet<Integer>();  for(int i=0; i<n; i++) {  int x = sc.nextInt();  if(x != 0) {   hs.add(x);  }  }   System.out.println(hs.size());     } }
2	public class C {  static final int MOD = (int)1e9 + 7;  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   long x = sc.nextLong(), k = sc.nextLong();   if(x == 0)    out.println(0);   else    out.println(((x % MOD * 2 - 1 + MOD) % MOD * modPow(2, k) % MOD + 1) % MOD);   out.close();  }  static long modPow(long b, long e) {   long res = 1;   while(e > 0) {    if((e & 1) == 1)     res = res * b % MOD;    b = b * b % MOD;    e >>= 1;   }   return res;  }  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 double nextDouble() throws IOException { return Double.parseDouble(next()); }   public String nextLine() throws IOException {return br.readLine();}   public boolean ready() throws IOException { return br.ready(); }  } }
2	public class B { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  long n = sc.nextLong();  long k = sc.nextLong();  if ((k - 1) * k / 2 + 1 < n) {  System.out.println(-1);  return;  }  long left = 0;  long right = k;  while (left < right) {  long m = (left + right) / 2;  if (k * (k - 1)/2 - (k - m) * (k - m - 1) / 2 +1 < n)   left = m + 1;  else   right = m;  }  System.out.println(left); } }
5	public class R2_D2_A {  public static void main(String[] args) {        InputReader in = new InputReader(System.in);   int n = in.readInt();   int a = in.readInt();   int b = in.readInt();   Integer[] inp = new Integer[n];   for (int i = 0; i < inp.length; i++) {    inp[i] = in.readInt();   }   Arrays.sort(inp);   int petya = inp[inp.length-a];   int next = inp[inp.length-a-1];   int diff = petya - next;   System.out.println(diff);  }  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 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;   }  } }
6	public class Main {  public static void main(String[] args) throws IOException { InputStream fin = System.in;  Scanner cin = new Scanner(fin);  int n = cin.nextInt(); int m = cin.nextInt(); int bound = 1 << n; boolean[][] mp = new boolean[n][n]; long[][] dp = new long[bound][n]; int used = 0; long ret = 0; for (int i = 0; i < n; i++) {  Arrays.fill(mp[i], false); }  for (int i = 0; i < m; i++) {  int u = cin.nextInt() - 1;  int v = cin.nextInt() - 1;  mp[u][v] = mp[v][u] = true; }  for (int k = 0; k < n; k++) {  for (int i = k; i < bound; i++) {  Arrays.fill(dp[i], 0);  }  dp[1 << k][k] = 1;  for (int mask = 1 << k; mask < bound; mask++) {  if ((mask & used) != 0)   continue;  for (int i = k; i < n; i++) {   if (dp[mask][i] != 0) {  if (mp[k][i] && bitcount(mask) > 2)   ret += dp[mask][i];  for (int j = k; j < n; j++) {   if ((mask & (1 << j)) == 0 && mp[i][j]) {   dp[mask ^ (1 << j)][j] += dp[mask][i];   }  }   }  }  }  used |= 1 << k; }  System.out.println(ret / 2);  fin.close(); cin.close();  }  private static int bitcount(int mask) {  int ret = 0; while (mask > 0) {  ret += mask & 1;  mask >>= 1; } return ret;  } }
1	public class A { public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  StringTokenizer st = new StringTokenizer(br.readLine());  int[] list = new int[n];  for(int i = 0; i < list.length; i++)  list[i] = Integer.parseInt(st.nextToken());  int odd = 0;  int even = 0;  for(int x: list)  if(x%2==1) {   odd++;  }  else {   even++;  }  for(int i = 1; i <= list.length; i++) {  if(list[i-1]%2==1 && odd == 1) {   System.out.println(i);   return;  }  else if(list[i-1]%2 == 0 && even == 1){   System.out.println(i);   return;  }  } } }
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(); } }
3	public class cf1141f2_2 {  public static void main(String[] args) throws IOException {   int n = ri(), a[] = ria(n), pre[] = new int[n + 1];   for (int i = 0; i < n; ++i) {    pre[i + 1] = pre[i] + a[i];   }   Map<Integer, List<p>> sums = new HashMap<>();   for (int i = 0; i < n; ++i) {    for (int j = 0; j <= i; ++j) {     sums.computeIfAbsent(pre[i + 1] - pre[j], k -> new ArrayList<>()).add(new p(j, i));    }   }   int k = 0;   List<p> ans = new ArrayList<>();   for (int key : sums.keySet()) {    List<p> segs = sums.get(key);    segs.sort((x, y) -> x.b == y.b ? x.a - y.a : x.b - y.b);    int last = -1, cnt = 0;    for (int i = 0, end = segs.size(); i < end; ++i) {     if (segs.get(i).a > last) {      ++cnt;      last = segs.get(i).b;     }    }    if (cnt > k) {     k = cnt;     ans = segs;    }   }   prln(k);   int last = -1;   for (int i = 0, end = ans.size(); i < end; ++i) {    if (ans.get(i).a > last) {     prln(ans.get(i).a + 1, ans.get(i).b + 1);     last = ans.get(i).b;    }   }   close();  }  static class p {   int a, b;   p(int a_, int b_) {    a = a_;    b = b_;   }   @Override   public String toString() {    return "Pair{" + "a = " + a + ", b = " + b + '}';   }    public boolean asymmetricEquals(Object o) {    p p = (p) o;    return a == p.a && b == p.b;   }   public boolean symmetricEquals(Object o) {    p p = (p) o;    return a == p.a && b == p.b || a == p.b && b == p.a;   }   @Override   public boolean equals(Object o) {    return asymmetricEquals(o);   }   public int asymmetricHashCode() {    return Objects.hash(a, b);   }   public int symmetricHashCode() {    return Objects.hash(a, b) + Objects.hash(b, a);   }   @Override   public int hashCode() {    return asymmetricHashCode();   }  }  static BufferedReader __in = new BufferedReader(new InputStreamReader(System.in));  static PrintWriter __out = new PrintWriter(new OutputStreamWriter(System.out));  static StringTokenizer input;  static Random __rand = new Random();          static final int IBIG = 1000000007;  static final int IMAX = 2147483647;  static final int IMIN = -2147483648;  static final long LMAX = 9223372036854775807L;  static final long LMIN = -9223372036854775808L;   static int minof(int a, int b, int c) {return min(a, min(b, c));}  static int minof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); int min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static long minof(long a, long b, long c) {return min(a, min(b, c));}  static long minof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); long min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static int maxof(int a, int b, int c) {return max(a, max(b, c));}  static int maxof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); int max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static long maxof(long a, long b, long c) {return max(a, max(b, c));}  static long maxof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); long max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static int powi(int a, int b) {if (a == 0) return 0; int ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static long powl(long a, int b) {if (a == 0) return 0; long ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static int fli(double d) {return (int) d;}  static int cei(double d) {return (int) ceil(d);}  static long fll(double d) {return (long) d;}  static long cel(double d) {return (long) ceil(d);}  static int gcf(int a, int b) {return b == 0 ? a : gcf(b, a % b);}  static long gcf(long a, long b) {return b == 0 ? a : gcf(b, a % b);}  static int lcm(int a, int b) {return a * b / gcf(a, b);}  static long lcm(long a, long b) {return a * b / gcf(a, b);}  static int randInt(int min, int max) {return __rand.nextInt(max - min + 1) + min;}  static long mix(long x) {x += 0x9e3779b97f4a7c15L; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9L; x = (x ^ (x >> 27)) * 0x94d049bb133111ebL; return x ^ (x >> 31);}   static void reverse(int[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {int swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(long[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {long swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(double[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {double swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(char[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {char swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void shuffle(int[] a) {int n = a.length - 1; for (int i = 0; i < n; ++i) {int ind = randInt(i, n); int swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}  static void shuffle(long[] a) {int n = a.length - 1; for (int i = 0; i < n; ++i) {int ind = randInt(i, n); long swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}  static void shuffle(double[] a) {int n = a.length - 1; for (int i = 0; i < n; ++i) {int ind = randInt(i, n); double swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}  static void rsort(int[] a) {shuffle(a); sort(a);}  static void rsort(long[] a) {shuffle(a); sort(a);}  static void rsort(double[] a) {shuffle(a); sort(a);}  static int[] copy(int[] a) {int[] ans = new int[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static long[] copy(long[] a) {long[] ans = new long[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static double[] copy(double[] a) {double[] ans = new double[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static char[] copy(char[] a) {char[] ans = new char[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}   static List<List<Integer>> g(int n) {List<List<Integer>> g = new ArrayList<>(); for (int i = 0; i < n; ++i) g.add(new ArrayList<>()); return g;}  static List<Set<Integer>> sg(int n) {List<Set<Integer>> g = new ArrayList<>(); for (int i = 0; i < n; ++i) g.add(new HashSet<>()); return g;}  static void c(List<? extends Collection<Integer>> g, int u, int v) {g.get(u).add(v); g.get(v).add(u);}  static void cto(List<? extends Collection<Integer>> g, int u, int v) {g.get(u).add(v);}  static void dc(List<? extends Collection<Integer>> g, int u, int v) {g.get(u).remove(v); g.get(v).remove(u);}  static void dcto(List<? extends Collection<Integer>> g, int u, int v) {g.get(u).remove(v);}   static void r() throws IOException {input = new StringTokenizer(rline());}  static int ri() throws IOException {return Integer.parseInt(rline());}  static long rl() throws IOException {return Long.parseLong(rline());}  static double rd() throws IOException {return Double.parseDouble(rline());}  static int[] ria(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni(); return a;}  static int[] riam1(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni() - 1; return a;}  static long[] rla(int n) throws IOException {long[] a = new long[n]; r(); for (int i = 0; i < n; ++i) a[i] = nl(); return a;}  static double[] rda(int n) throws IOException {double[] a = new double[n]; r(); for (int i = 0; i < n; ++i) a[i] = nd(); return a;}  static char[] rcha() throws IOException {return rline().toCharArray();}  static String rline() throws IOException {return __in.readLine();}  static String n() {return input.nextToken();}  static int rni() throws IOException {r(); return ni();}  static int ni() {return Integer.parseInt(n());}  static long rnl() throws IOException {r(); return nl();}  static long nl() {return Long.parseLong(n());}  static double rnd() throws IOException {r(); return nd();}  static double nd() {return Double.parseDouble(n());}  static List<List<Integer>> rg(int n, int m) throws IOException {List<List<Integer>> g = g(n); for (int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1); return g;}  static void rg(List<List<Integer>> g, int m) throws IOException {for (int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1);}  static List<List<Integer>> rdg(int n, int m) throws IOException {List<List<Integer>> g = g(n); for (int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1); return g;}  static void rdg(List<List<Integer>> g, int m) throws IOException {for (int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1);}  static List<Set<Integer>> rsg(int n, int m) throws IOException {List<Set<Integer>> g = sg(n); for (int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1); return g;}  static void rsg(List<Set<Integer>> g, int m) throws IOException {for (int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1);}  static List<Set<Integer>> rdsg(int n, int m) throws IOException {List<Set<Integer>> g = sg(n); for (int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1); return g;}  static void rdsg(List<Set<Integer>> g, int m) throws IOException {for (int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1);}   static void pr(int i) {__out.print(i);}  static void prln(int i) {__out.println(i);}  static void pr(long l) {__out.print(l);}  static void prln(long l) {__out.println(l);}  static void pr(double d) {__out.print(d);}  static void prln(double d) {__out.println(d);}  static void pr(char c) {__out.print(c);}  static void prln(char c) {__out.println(c);}  static void pr(char[] s) {__out.print(new String(s));}  static void prln(char[] s) {__out.println(new String(s));}  static void pr(String s) {__out.print(s);}  static void prln(String s) {__out.println(s);}  static void pr(Object o) {__out.print(o);}  static void prln(Object o) {__out.println(o);}  static void prln() {__out.println();}  static void pryes() {prln("yes");}  static void pry() {prln("Yes");}  static void prY() {prln("YES");}  static void prno() {prln("no");}  static void prn() {prln("No");}  static void prN() {prln("NO");}  static void pryesno(boolean b) {prln(b ? "yes" : "no");};  static void pryn(boolean b) {prln(b ? "Yes" : "No");}  static void prYN(boolean b) {prln(b ? "YES" : "NO");}  static void prln(int... a) {for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i); if (a.length > 0) prln(a[a.length - 1]); else prln();}  static void prln(long... a) {for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i); if (a.length > 0) prln(a[a.length - 1]); else prln();}  static void prln(double... a) {for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i); if (a.length > 0) prln(a[a.length - 1]); else prln();}  static <T> void prln(Collection<T> c) {int n = c.size() - 1; Iterator<T> iter = c.iterator(); for (int i = 0; i < n; pr(iter.next()), pr(' '), ++i); if (n >= 0) prln(iter.next()); else prln();}  static void h() {prln("hlfd"); flush();}  static void flush() {__out.flush();}  static void close() {__out.close();}}
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);  } }
3	public class Main {  static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out);  static int oo = (int)1e9; static int mod = 1000000007;  public static void main(String[] args) throws IOException {   int n = in.nextInt();  int[] a = in.nextIntArray(n);  Arrays.sort(a);  boolean[] color = new boolean[n];  int cnt = 0;  for(int i = 0; i < n; ++i) {  if(!color[i]) {   cnt++;   for(int j = i; j < n; j++) {   if(a[j] % a[i] == 0)    color[j] = true;   }  }  }  System.out.println(cnt);   out.close(); }   static class SegmentTree {  int n;  long[] a, seg;  int DEFAULT_VALUE = 0;   public SegmentTree(long[] a, int n) {  super();  this.a = a;  this.n = n;  seg = new long[n * 4 + 1];  build(1, 0, n-1);  }   private long build(int node, int i, int j) {  if(i == j)   return seg[node] = a[i];  long first = build(node * 2, i, (i+j) / 2);  long second = build(node * 2 + 1, (i+j) / 2 + 1, j);  return seg[node] = combine(first, second);  }   long update(int k, long value) {  return update(1, 0, n-1, k, value);  }   private long update(int node, int i, int j, int k, long value) {  if(k < i || k > j)   return seg[node];  if(i == j && j == k) {   a[k] = value;   seg[node] = value;   return value;  }    int m = (i + j) / 2;  long first = update(node * 2, i, m, k, value);  long second = update(node * 2 + 1, m + 1, j, k, value);  return seg[node] = combine(first, second);  }   long query(int l, int r) {  return query(1, 0, n-1, l, r);  }   private long query(int node, int i, int j, int l, int r) {  if(l <= i && j <= r)   return seg[node];  if(j < l || i > r)   return DEFAULT_VALUE;  int m = (i + j) / 2;  long first = query(node * 2, i, m, l, r);  long second = query(node * 2 + 1, m+1, j, l, r);  return combine(first, second);  }   private long combine(long a, long b) {  return a + b;  } }  static class DisjointSet {  int n;  int[] g;  int[] h;  public DisjointSet(int n) {  super();  this.n = n;  g = new int[n];  h = new int[n];  for(int i = 0; i < n; ++i) {   g[i] = i;   h[i] = 1;  }  }  int find(int x) {  if(g[x] == x)   return x;  return g[x] = find(g[x]);  }  void union(int x, int y) {  x = find(x); y = find(y);  if(x == y)   return;  if(h[x] >= h[y]) {   g[y] = x;   if(h[x] == h[y])   h[x]++;  }  else {   g[x] = y;  }  } }   static int[] getPi(char[] a) {  int m = a.length;  int j = 0;  int[] pi = new int[m];  for(int i = 1; i < m; ++i) {  while(j > 0 && a[i] != a[j])   j = pi[j-1];  if(a[i] == a[j]) {   pi[i] = j + 1;   j++;  }  }  return pi; }  static long lcm(long a, long b) {  return a * b / gcd(a, b); }  static boolean nextPermutation(int[] a) {  for(int i = a.length - 2; i >= 0; --i) {  if(a[i] < a[i+1]) {   for(int j = a.length - 1; ; --j) {   if(a[i] < a[j]) {    int t = a[i];    a[i] = a[j];    a[j] = t;    for(i++, j = a.length - 1; i < j; ++i, --j) {    t = a[i];    a[i] = a[j];    a[j] = t;    }    return true;   }   }  }  }  return false; }   static void shuffle(int[] a) {  Random r = new Random();  for(int i = a.length - 1; i > 0; --i) {  int si = r.nextInt(i);  int t = a[si];  a[si] = a[i];  a[i] = t;  } }  static void shuffle(long[] a) {  Random r = new Random();  for(int i = a.length - 1; i > 0; --i) {  int si = r.nextInt(i);  long t = a[si];  a[si] = a[i];  a[i] = t;  } }  static int lower_bound(int[] a, int n, int k) {  int s = 0;  int e = n;  int m;  while (e - s > 0) {  m = (s + e) / 2;  if (a[m] < k)   s = m + 1;  else   e = m;  }  return e; } static int lower_bound(long[] a, int n, long k) {  int s = 0;  int e = n;  int m;  while (e - s > 0) {  m = (s + e) / 2;  if (a[m] < k)   s = m + 1;  else   e = m;  }  return e; }  static int gcd(int a, int b) {  return b == 0 ? a : gcd(b, a % b); } static long gcd(long a, long b) {  return b == 0 ? a : gcd(b, a % b); }  static class Pair implements Comparable<Pair> {  int first, second;   public Pair(int first, int second) {  super();  this.first = first;  this.second = second;  }   @Override  public int compareTo(Pair o) {  return this.first != o.first ? this.first - o.first : this.second - o.second;  }   @Override  public int hashCode() {  final int prime = 31;  int result = 1;  result = prime * result + first;  result = prime * result + second;  return result;  }   @Override  public boolean equals(Object obj) {  if (this == obj)   return true;  if (obj == null)   return false;  if (getClass() != obj.getClass())   return false;  Pair other = (Pair) obj;  if (first != other.first)   return false;  if (second != other.second)   return false;  return true;  } } }    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; }  }
2	public class B {  private static long MOD=1000000007;  private static BigInteger m=new BigInteger(1000000007+"");   private static long pow(long x, long a)  {   if(a==0)   return 1;     long ans=pow(x,a/2);     ans=(ans*ans)%MOD;     if(a%2==1)   ans=(ans*x)%MOD;     return ans%MOD;  }  public static void main(String args[]) throws IOException  {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));     long N,K,ans;        String s[]=br.readLine().trim().split(" ");     N=Long.parseLong(s[0]);   K=Long.parseLong(s[1]);     BigInteger bi=new BigInteger(N+"");   BigInteger a=new BigInteger(N+"");   BigInteger two=new BigInteger(2+"");     if(N==0)   {    System.out.println(0);    System.exit(0);   }   if(K==0)   {    a=a.multiply(two);    a=a.mod(m);       System.out.println(a);    System.exit(0);   }     long p=pow(2,K);     BigInteger p2=new BigInteger(p+"");   BigInteger tmp=p2.subtract(BigInteger.ONE);   tmp=tmp.mod(m);     p2=p2.multiply(two);   p2=p2.mod(m);     a=a.multiply(p2);   a=a.mod(m);     a=a.subtract(tmp);   a=a.mod(m);     if(!(a.signum()==1)&&!(a.signum()==0))   a.add(m);     System.out.println(a);  } }
3	public class SameSumBlocks {  public static void main(String[] args) {   BufferedReader input = new BufferedReader(new InputStreamReader(System.in));   String[] numbersAsString = input.lines()           .skip(1)           .findFirst()           .get()           .split(" ");   int[] numbers = Arrays.stream(numbersAsString).mapToInt(Integer::parseInt).toArray();   List<PairOfInt> sameSumBlocks = findSameSumBlocks(numbers);   System.out.println(sameSumBlocks.size());   sameSumBlocks.forEach(System.out::println);  }  static List<PairOfInt> findSameSumBlocks(int[] numbers) {   List<List<PairOfInt>> potentials = buildPotentialsSum(numbers);   List<List<PairOfInt>> sortedPairList = potentials.stream()               .filter(p -> p.size() > 0)               .sorted((l1, l2) -> compare(l2.size(), l1.size()))               .collect(Collectors.toList());   List<PairOfInt> max = new ArrayList<>();   max.add(PairOfInt.of(1, 1));   for (int i = 0; i < sortedPairList.size(); i++) {    List<PairOfInt> result = sortedPairList.get(i);    result.sort(comparingInt(p -> p.b));    List<PairOfInt> maxDisjoint = maxDisjointPair(result);    if (maxDisjoint.size() > max.size()) {     max = maxDisjoint;     if (i + 1 < sortedPairList.size() && maxDisjoint.size() >= sortedPairList.get(i + 1).size()) {      return maxDisjoint;     }    }   }   return max;  }  public static List<PairOfInt> maxDisjointPair(List<PairOfInt> result) {   if (result.size() == 0)    return result;   boolean over = false;   while (!over) {    int i;    for (i = 1; i < result.size(); i++) {     if (result.get(i).a <= result.get(i - 1).b) {      result.remove(result.get(i));      break;     }    }    if (i == result.size()) {     over = true;    }   }   return result;  }  private static List<List<PairOfInt>> buildPotentialsSum(int[] numbers) {   Map<Integer, List<PairOfInt>> result = new HashMap<>();   for (int i = 0; i < numbers.length; i++) {    int blockSum = 0;    for (int j = i; j < numbers.length; j++) {     blockSum += numbers[j];     final int tmpi = i, tmpj = j;     result.compute(blockSum, (k, l) -> {      if (l == null) {       l = new ArrayList<>();      }      l.add(PairOfInt.of(tmpi + 1, tmpj + 1));      return l;     });     if(blockSum == 0) {      break;     }    }   }   return new ArrayList<>(result.values());  }  public static class PairOfInt {   final int a, b;   public static PairOfInt of(int a, int b) {    return new PairOfInt(a, b);   }   private PairOfInt(int a, int b) {    this.a = a;    this.b = b;   }   @Override   public String toString() {    return a + " " + b;   }   @Override   public boolean equals(Object o) {    if (this == o) return true;    if (o == null || getClass() != o.getClass()) return false;    PairOfInt pairOfInt = (PairOfInt) o;    return a == pairOfInt.a &&      b == pairOfInt.b;   }   @Override   public int hashCode() {    return Objects.hash(a, b);   }  } }
2	public class B {  static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));  static MyScanner sc;  static {   try {    sc = new MyScanner();   } catch (FileNotFoundException e) {    e.printStackTrace();   }  }  public static void main(String[] args) {   doTask();   out.flush();  }  public static void doTask(){   long n = sc.nextInt();   long k = sc.nextInt();   long c = -2*(n+k);   long d = 9 - 4*c;   double result = n - (-3 + Math.sqrt(1.0*d))/2;   out.println(Math.round(result));  }  public static class MyScanner {   BufferedReader br;   StringTokenizer st;   public MyScanner() throws FileNotFoundException {    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 Arbuz {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   String s = sc.next();   int i, j, current, longest = 0;   for (i = 0; i < s.length(); i++) {    for (j = 0; j < s.length(); j++) {     if (i != j) {      int ti = i, tj = j;      current = 0;      while (ti < s.length() && tj < s.length() && s.charAt(ti) == s.charAt(tj)) {       current++;       ti++;       tj++;      }      if (current > longest) {       longest = current;      }     }    }   }   System.out.println(longest);  } }
1	public class Solution implements Runnable {  private BufferedReader br = null;  private PrintWriter pw = null;  private StringTokenizer stk = new StringTokenizer("");  public static void main(String[] args) {   new Thread(new Solution()).run();  }  public void run() {     br = new BufferedReader(new InputStreamReader(System.in));   pw = new PrintWriter(new OutputStreamWriter(System.out));   solver();   pw.close();  }  private void nline() {   try {    if (!stk.hasMoreTokens())     stk = new StringTokenizer(br.readLine());   } catch (IOException e) {    throw new RuntimeException("KaVaBUnGO!!!", e);   }  }  private String nstr() {   while (!stk.hasMoreTokens())    nline();   return stk.nextToken();  }  private int ni() {   return Integer.valueOf(nstr());  }  private double nd() {   return Double.valueOf(nstr());  }  String nextLine() {   try {    return br.readLine();   } catch (IOException e) {   }   return null;  }  private void solver() {   int n = ni();   ArrayList<Integer> ar = new ArrayList<Integer>();   int sum = 0;   for (int i = 0; i < n; i++) {    ar.add(ni() % 2);    sum += ar.get(i);   }   int flag = 0;   if(sum==1)flag = 1;    for(int i =0;i<n;i++)if(ar.get(i)==flag)System.out.println(i+1);     }  void exit() {   System.exit(0);  } }
2	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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   int MOD = 1000000007;   public void solve(int testNumber, FastScanner in, PrintWriter out) {    long x = in.nextLong();    long k = in.nextLong();    if (x == 0) {     out.print(0);     return;    }    long b = fast_expo(2, k);    long a = (b * 2) % MOD;    long u = ((x % MOD) * a) % MOD;    long v = (b - 1 + MOD) % MOD;    out.print((u - v + MOD) % MOD);   }   private long fast_expo(long a, long b) {    long res = 1L;    a = a % MOD;    while (b > 0) {     if ((b & 1) != 0) {      res = (res * a) % MOD;     }     b = b >> 1;     a = (a * a) % MOD;    }    return res % MOD;   }  }  static class FastScanner {   private BufferedReader bufferedReader;   private StringTokenizer stringTokenizer;   public FastScanner(InputStream inputStream) {    bufferedReader = new BufferedReader(new InputStreamReader(inputStream));   }   public String next() {    while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {     try {      stringTokenizer = new StringTokenizer(bufferedReader.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return stringTokenizer.nextToken();   }   public long nextLong() {    return Long.parseLong(next());   }  } }
2	public class JavaApplication4 {    static long k, n, ans;  static private long binsearch(long l, long r)  {   if(l==r) return l;   long m=(l+r)/2;   long res=(m*(k+k-m+1)/2);   if(res>=n)    return binsearch(l, m);   else    return binsearch(m+1, r);  }  public static void main(String[] args) {   Scanner in=new Scanner(System.in);   n=in.nextLong();   k=in.nextLong();   n--;   k--;   if(k*(k+1)/2<n)    ans=-1;   else    ans=binsearch(0, k);   System.out.println(ans);     } }
4	public class C{ public static void main(String args[]) throws Exception{  Scanner in = new Scanner(new FileReader("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  int N = in.nextInt();  int M = in.nextInt();  int K = in.nextInt();  int[] X = new int[K], Y = new int[K];  for (int i = 0; i < K; i++){  X[i] = in.nextInt();  Y[i] = in.nextInt();  }  int d = -1;  int a = -1; int b = -1;  for (int i = 1; i <= N; i++)  for (int j = 1; j <= M; j++){   int h = Integer.MAX_VALUE;   for (int p = 0; p < K; p++)   h = Math.min(h,Math.abs(i-X[p]) + Math.abs(j-Y[p]));   if (h > d){   d = h; a = i; b = j;   }  }   out.print(a + " " + b);  out.close(); } }
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;   }  } }
4	public class CF1517D extends PrintWriter { CF1517D() { super(System.out); } Scanner sc = new Scanner(System.in); public static void main(String[] $) {  CF1517D o = new CF1517D(); o.main(); o.flush(); }  static final int INF = 0x3f3f3f3f; void main() {  int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  if (k % 2 == 1) {  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++)   print("-1 ");   println();  }  return;  }  k /= 2;  int[][] hh = new int[n][m - 1];  for (int i = 0; i < n; i++)  for (int j = 0; j < m - 1; j++)   hh[i][j] = sc.nextInt();  int[][] vv = new int[n - 1][m];  for (int i = 0; i < n - 1; i++)  for (int j = 0; j < m; j++)   vv[i][j] = sc.nextInt();  int[][] dp = new int[n][m];  int[][] dq = new int[n][m];  while (k-- > 0) {  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++) {   int x = INF;   if (i > 0)    x = Math.min(x, dp[i - 1][j] + vv[i - 1][j]);   if (j > 0)    x = Math.min(x, dp[i][j - 1] + hh[i][j - 1]);   if (i + 1 < n)    x = Math.min(x, dp[i + 1][j] + vv[i][j]);   if (j + 1 < m)    x = Math.min(x, dp[i][j + 1] + hh[i][j]);   dq[i][j] = x;   }  int[][] tmp = dp; dp = dq; dq = tmp;  }  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++)   print(dp[i][j] * 2 + " ");  println();  } } }
5	public class CF_111_A {  public static void main(String[] args){   Scanner in = new Scanner(System.in);   int n = in.nextInt(), sum = 0, sum2 = 0;   int[] a = new int[n];   for (int i = 0; i < n; i++){    a[i] = in.nextInt();    sum += a[i];   }     Arrays.sort(a);     for (int i = n - 1; i >=0; i--){    sum2 +=a[i];    if (sum2 * 2 > sum){     System.out.println(n - 1 - i + 1);     System.exit(0);       }   }  } }
4	public class C implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer st; Random rnd;  short[] qx, qy; boolean[][] used; final int[] dx = {1, -1, 0, 0}; final int[] dy = {0, 0, 1, -1};  void solve() throws IOException {  int n = nextInt(), m = nextInt();   qx = new short[n * m];  qy = new short[n * m];  used = new boolean[n][m];   int k = nextInt(), qs = 0, qt = 0;   for(int i = 0; i < k; i++) {  int x = nextInt() - 1, y = nextInt() - 1;  used[x][y] = true;  qx[qt] = (short) x;  qy[qt] = (short) y;  ++qt;  }   int rx = 0, ry = 0;   while(qs < qt) {  int cx = qx[qs], cy = qy[qs];  ++qs;    rx = cx;  ry = cy;    for(int z = 0; z < 4; z++) {   int nx = cx + dx[z], ny = cy + dy[z];     if(nx >= 0 && ny >= 0 && nx < n && ny < m && !used[nx][ny]) {   used[nx][ny] = true;   qx[qt] = (short) nx;   qy[qt] = (short) ny;   ++qt;   }  }  }   out.println((rx + 1) + " " + (ry + 1)); }  public static void main(String[] args) {  final boolean oldChecker = false;   if(oldChecker) {  new Thread(null, new C(), "yarrr", 1 << 24).start();  } else {  new C().run();  } }  public void run() {  try {  try {   in = new BufferedReader(new FileReader("input.txt"));   out = new PrintWriter(new FileWriter("output.txt"));  } catch (FileNotFoundException e) {   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()); } }
4	public class Main {  public static void main(String[] args) throws IOException {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(new FileReader("input.txt"));   PrintWriter out = new PrintWriter("output.txt");   TaskB solver = new TaskB();   solver.solve(in, out);   out.close();  }  private static class TaskB {   static final long max = 1000000000000000000L;   static final double eps = 0.0000001;   static final long mod = 1000000007;   static int N, M, K;   static long X, Y;   static boolean F[][][];   static int D[][];   void solve(InputReader in, PrintWriter out) throws IOException {    N = in.nextInt();    M = in.nextInt();    K = in.nextInt();    F = new boolean[K][N][M];    D = new int[N][M];    for (int i = 0; i < N; i++)     for (int j = 0; j < M; j++)      D[i][j] = Integer.MAX_VALUE;    List<Pair> list = new ArrayList<>();    for (int i = 0; i < K; i++) {     list.add(new Pair(in.nextInt() - 1, in.nextInt() - 1));    }     for (int i = 0; i < N; i++)     for (int j = 0; j < M; j++)      for (int k = 0; k < K; k++)       D[i][j] = Math.min(D[i][j], Math.abs(list.get(k).X - i) + Math.abs(list.get(k).Y - j));     int res = Integer.MIN_VALUE;    for (int j = 0; j < N; j++)     for (int k = 0; k < M; k++)      if (D[j][k] > res) {       X = j + 1;       Y = k + 1;       res = D[j][k];      }    out.println(X + " " + Y);   }   void bfs(int K, Pair P) {    Queue<Pair> Q = new LinkedList<>();    F[K][P.X][P.Y] = true;    D[P.X][P.Y] = 0;    Q.add(P);     while (!Q.isEmpty()) {     P = Q.poll();     int X = P.X;     int Y = P.Y;     if (check(X - 1, Y) && !F[K][X - 1][Y]) {      F[K][X - 1][Y] = true;      if (D[X - 1][Y] > D[X][Y] + 1) {       D[X - 1][Y] = D[X][Y] + 1;       Q.add(new Pair(X - 1, Y));      }     }     if (check(X + 1, Y) && !F[K][X + 1][Y]) {      F[K][X + 1][Y] = true;      if (D[X + 1][Y] > D[X][Y] + 1) {       D[X + 1][Y] = D[X][Y] + 1;       Q.add(new Pair(X + 1, Y));      }     }     if (check(X, Y - 1) && !F[K][X][Y - 1]) {      F[K][X][Y - 1] = true;      if (D[X][Y - 1] > D[X][Y] + 1) {       D[X][Y - 1] = D[X][Y] + 1;       Q.add(new Pair(X, Y - 1));      }     }     if (check(X, Y + 1) && !F[K][X][Y + 1]) {      F[K][X][Y + 1] = true;      if (D[X][Y + 1] > D[X][Y] + 1) {       D[X][Y + 1] = D[X][Y] + 1;       Q.add(new Pair(X, Y + 1));      }     }    }   }   boolean check(int X, int Y) {    return !(X < 0 || X >= N || Y < 0 || Y >= M);   }   class Pair {    int X, Y;    Pair(int X, int Y) {     this.X = X;     this.Y = Y;    }   }   long gcd(long A, long B) {    if (B == 0) return A;    return gcd(B, A % B);   }   boolean isPrime(long n) {    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))     return false;    for (long i = 5, j = 2; i * i <= n; i += j, j = 6 - j)     if (n % i == 0)      return false;    return true;   }   boolean isEqual(double A, double B) {    return Math.abs(A - B) < eps;   }   double dist(double X1, double Y1, double X2, double Y2) {    return Math.sqrt((X1 - X2) * (X1 - X2) + (Y1 - Y2) * (Y1 - Y2));   }   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;   }   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;    }   }  }  private static class InputReader {   StringTokenizer st;   BufferedReader br;   public InputReader(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }   public InputReader(FileReader s) throws FileNotFoundException {    br = new BufferedReader(s);   }   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());   }   public long nextLong() {    return Long.parseLong(next());   }   public String nextLine() {    try {     return br.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public double nextDouble() {    return Double.parseDouble(next());   }   public boolean ready() {    try {     return br.ready();    } catch (IOException e) {     throw new RuntimeException(e);    }   }  } }
5	public class A {  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[] ar = new int[n];   for (int i = 0; i < n; i++) {    ar[i] = sc.nextInt();   }   Arrays.sort(ar);   if (ar[b-1] == ar[b ]) {    System.out.println(0);   } else {    System.out.println(ar[b ] - ar[b-1]);   }  } }
5	public class A {  void run()throws IOException{   Scanner sc = new Scanner(new InputStreamReader(System.in));   int n = sc.nextInt();   int i;   int[] ar = new int[n];   for(i=0; i<n; i++){    ar[i] = sc.nextInt();   }   Arrays.sort(ar);   int min = ar[0];   for(i=1;i<n;i++){    if(ar[i]>min) break;   }   if(i<n) System.out.println(ar[i]);   else System.out.println("NO");  }   public static void main(String[] args)throws IOException {   new A().run();  } }
5	public class Main {  public static void main(String[] args) throws IOException {   PrintWriter out = new PrintWriter(System.out);     Reader in = new Reader();   Main solver = new Main();   solver.solve(out, in);   out.flush();   out.close();   }   static int INF = (int)1e5*4*4+5;  static int maxn = (int)1e5*2+1;  static int mod=(int)1e9+7 ;  static int n,m,k,t,q,x,a,b,y;   static ArrayList<Integer> adj[];  static int[] dist,parent,back;  static boolean[] vis,vist;  static int root=0,ans=1;     void solve(PrintWriter out, Reader in) throws IOException{   n = in.nextInt();    if(n==1) {out.println(1);return;}   adj = new ArrayList[n+1];   for(int i=1;i<=n;i++)    adj[i] = new ArrayList<Integer>();     int u,v;   for(int i=0;i<n-1;i++){    u = in.nextInt();    v = in.nextInt();        adj[u].add(v);    adj[v].add(u);   }     vist = new boolean[n+1];   vis = new boolean[n+1];   vist[1] =true;   makeroot(1);     parent = new int[n+1];   dist = new int[n+1];   back = new int[n+1];     dfs(root,0);   calcdist(root);     vist = new boolean[n+1];   vis = new boolean[n+1];   vist[root] =true;        PriorityQueue<Node> pq = new PriorityQueue<Node>();   for(int i=1;i<=n;i++){    if(i!=root) pq.add(new Node(i,dist[i]));   }     Node elm;   int rt = root;   out.print(1);     makeroot(root);   removeNodes(root,rt);   ans+=dist[rt];   out.print(" "+ans);   int itr=2;   for(int i=2;i<=n;i++){       elm = pq.remove();    if(vis[elm.idx]) continue;    removeNodes(back[elm.idx],elm.idx);    ans += elm.dist+1;    out.print(" "+ans);    itr++;   }   for(int i=itr;i<n;i++)    out.print(" "+ans);   out.println();  }      static class Node implements Comparable<Node>{   int dist,idx;     Node(int idx,int dist){    this.idx = idx;    this.dist = dist;   }     public int compareTo(Node o) {    return o.dist-this.dist;   }  }   static void removeNodes(int s,int e){   vis[s]=true;   while(s!=e){    vis[s] = true;    s = parent[s];   }   vis[s]=true;   return;  }   static int calcdist(int s){   int res=0;   int tmp=0;   for(int e:adj[s]){    if(e!=parent[s]){     tmp= calcdist(e);     if(1+tmp>res){      res = 1+tmp;      back[s] = back[e];     }    }   }     if(res==0) back[s]=s;   return dist[s] = res;  }   static void dfs(int s,int p){   for(int e:adj[s]){    if(e!=p){     parent[e]=s;     dfs(e,s);    }   }   return;  }   static void makeroot(int s){   Queue<Integer> q = new LinkedList<>();   q.add(s);     int elm=0;   while(q.size()!=0){    elm = q.remove();    for(int e:adj[elm]){     if(!vist[e]){      vist[e]=true;      q.add(e);      root = e;     }    }   }   return;  }     static class Reader {  private InputStream mIs;  private byte[] buf = new byte[1024];  private int curChar;  private int 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 next() {   int c = read();   while (isSpaceChar(c)) {    c = read();   }   StringBuilder res = new StringBuilder();   do {    res.appendCodePoint(c);    c = read();   } while (!isSpaceChar(c));   return res.toString();  }  double nextDouble()  {   return Double.parseDouble(next());  }  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 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;  }  } }
4	public class Main {   void run() throws IOException {   String s = token();   HashSet <String> h;   int n = s.length();   int r = 0;   loop: for (int i = 1; i <= n; i++) {    h = new HashSet();    for (int j = 0; j < n - i + 1; j++) {     String t = s.substring(j, j + i);     if (h.contains(t)) {      r = i;      continue loop;     } else {      h.add(t);     }    }   }   System.out.println(r);  }  public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);          in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);   st = new StringTokenizer(" ");   new Main().run();   out.close();  }  static BufferedReader in;   static PrintWriter out;  static StringTokenizer st;  String token() throws IOException {   while (!st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int nint() throws IOException {   return Integer.parseInt(token());  }  long nlong() throws IOException {   return Long.parseLong(token());  }  double ndouble() throws IOException {   return Double.parseDouble(token());  } }
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 a = in.nextLong();   long b = in.nextLong();   long res = 0;   while(a > 1 && b > 1) {    if(a < b) {     res += b / a;     b %= a;    }    else {     res += a / b;     a %= b;    }   }   if(a == 1)    res += b;   else    res += a;   out.println(res);  } } 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 long nextLong() {   return Long.parseLong(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;  }  }
4	public class A23 {  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  String s = in.nextLine();  int i=0,j=0,n=0,t=0,count=0;  n=s.length();  String s1="y",s2="yu6j";  for(t=1;t<n;t++)   {   for(i=0;i<t;i++)    {    s1=s.substring(i,i+n-t);    for(j=i+1;j<=t;j++)     {     s2=s.substring(j,j+n-t);     if(s1.equalsIgnoreCase(s2))      {      count++;break;      }     if(count==1) break;     }    if(count==1) break;    }   if(count==1) break;   } if(n==0)  {  System.out.println("0");  } else {  if(count==1)  {  System.out.println(s1.length());  }  else System.out.println("0");  } } }
4	public class Main {  boolean test = false; PrintWriter pw = new PrintWriter(System.out); InputStreamReader inp = new InputStreamReader(System.in); BufferedReader in = new BufferedReader(inp);  private String[] inData = {"zzz"  };   static int id = -1;  public String readLine() {  id++;  if (test)  return inData[id];  else  try{   return in.readLine();   } catch( Exception e){   e.printStackTrace();  }  return ""; }  private void solve() {   String readLine = readLine();   int best = 0;   for (int i = 0; i < readLine.length(); i++) {  for (int j = i; j < readLine.length(); j++) {   String substring = readLine.substring(i,j+1);   String remainString = readLine.substring(i+1);   if(remainString.contains(substring)){   if(substring.length() > best){    best = substring.length();    }      }  }  }  System.out.println(best); }  public static void main(String args[]) throws Exception {  new Main().solve();  }  }
0	public class sub { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int num = in.nextInt();  while(num-->0) {  int a = in.nextInt();  int b = in.nextInt();   int res = 0;   while(a!=0 && b!=0) {   if(a>=b) {   res += a/b;   a %= b;   } else {   res += b/a;   b %= a;   }  }  System.out.println(res);  } } }
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(); } }
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());  } }
5	public class A {  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = null;  private void solve() throws IOException  {   int n = nextInt();   int k = nextInt();   int p[] = new int[n];   int t[] = new int[n];   for(int i = 0; i < n; i++)   {    p[i] = nextInt();    t[i] = nextInt();   }     for(int i = 0; i < n; i++)   {    for(int j = i + 1; j < n; j++)    {     if(p[i] < p[j] || (p[i] == p[j] && t[i] > t[j]))     {      int tmp = p[i];      p[i] = p[j];      p[j] = tmp;      tmp = t[i];      t[i] = t[j];      t[j] = tmp;     }    }      }     int pN = p[k - 1];   int tN = t[k - 1];   int counter = 0;   for(int i = 0; i < n; i++)   {    if(p[i] == pN && t[i] == tN)    {     counter++;    }      }     System.out.println(counter);  }  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 static void main(String args[]) throws IOException  {   new A().solve();  }  }
3	public class Main {  void solve() {   int n=ni();   int a[]=new int[n+1];   for(int i=1;i<=n;i++) a[i]=ni();   int vis[]=new int[101];   int ans=0;   Arrays.sort(a,1,n+1);   for(int i=1;i<=n;i++){    if(vis[a[i]]==1) continue;    ans++;    for(int j=a[i];j<=100;j+=a[i]) vis[j]=1;   }   pw.println(ans);  }  long M = (long)1e9+7;   PrintWriter pw;  StringTokenizer st;  BufferedReader br;  void run() throws Exception {   br = new BufferedReader(new InputStreamReader(System.in));   pw = new PrintWriter(System.out);   long s = System.currentTimeMillis();   solve();   pw.flush();  }  public static void main(String[] args) throws Exception {   new Main().run();  }  String ns() {   while (st == null || !st.hasMoreElements()) {    try {     st = new StringTokenizer(br.readLine());    } catch (IOException e) {     e.printStackTrace();    }   }   return st.nextToken();  }  String nextLine() throws Exception {   String str = "";   try {    str = br.readLine();   } catch (IOException e) {    throw new Exception(e.toString());   }   return str;  }  int ni() {   return Integer.parseInt(ns());  }  long nl() {   return Long.parseLong(ns());  }  double nd() {   return Double.parseDouble(ns());  } }
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");  }   } }
2	public class B {  public static void main(String[] args) throws Exception {  new B().run(); }  public void run() throws Exception {  FastIO file = new FastIO();  long n = file.nextLong();  long k = file.nextLong();  long lo = 1;  long hi = n;  long ans = 0;  while (lo <= hi) {  long mi = lo + (hi - lo) / 2;  long q = mi * (mi + 1) / 2 - (n - mi);  if (q == k) {   ans = (n - mi);   break;  }  else if (q < k) {   lo = mi + 1;  }  else {   hi = mi - 1;  }  }  System.out.println(ans); }  public static class FastIO {  BufferedReader br;  StringTokenizer st;  public FastIO() {  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 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 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; } }
5	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);   D903 solver = new D903();   solver.solve(1, in, out);   out.close();  }  static class D903 {   int N;   long ripple;   BigInteger tot;   long[] nums;   BigInteger[] cs;   public void solve(int testNumber, FastScanner s, PrintWriter out) {    N = s.nextInt();    nums = s.nextLongArray(N);    tot = new BigInteger("0");    cs = new BigInteger[N + 1];    cs[0] = new BigInteger("0");    ripple = 0;    for (int i = 1; i <= N; i++)     cs[i] = cs[i - 1].add(new BigInteger("" + nums[i - 1]));    for (int i = 1; i <= N; i++) {     long cur = nums[i - 1];     tot = tot.add(cs[N].subtract(cs[i])).subtract(new BigInteger("" + (cur * (N - i))));    }    HashMap<Long, Integer> seen = new HashMap<>();    for (long i : nums) {     Integer lo = seen.get(i - 1);     Integer hi = seen.get(i + 1);     if (lo != null)      tot = tot.subtract(new BigInteger("" + lo));     if (hi != null)      tot = tot.add(new BigInteger("" + hi));     if (!seen.containsKey(i))      seen.put(i, 0);     seen.put(i, seen.get(i) + 1);    }    out.println(tot);   }  }  static class FastScanner {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   public FastScanner(InputStream stream) {    this.stream = stream;   }   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++];   }   boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public String next() {    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[] nextLongArray(int N) {    long[] ret = new long[N];    for (int i = 0; i < N; i++)     ret[i] = this.nextLong();    return ret;   }  } }
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() );   }  } }
0	public class Solution {  public static void main(String[] args){   Scanner cin=new Scanner(System.in);   int n=cin.nextInt();   if(n%4==0 || n%7==0 || n%44==0 || n%47==0 || n%74==0 || n%77==0 || n%444==0 || n%447==0 || n%474==0 ||     n%477==0 || n%744==0 || n%747==0 || n%774==0 ||n%777==0) System.out.print("YES");   else System.out.print("NO");  } }
1	public class C701 {  public static int f(char c) {   if (c >= 'a' && c <= 'z') {    return c - 'a';   } else {    return 26 + c - 'A';   }  }  public static void main(String[] args) throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(reader.readLine());   char[] ch = reader.readLine().toCharArray();   LinkedList<Integer>[] p = new LinkedList[52];   for (int i = 0; i < 52; i++) {    p[i] = new LinkedList<>();   }   int[] fc = new int[n];   for (int i = 0; i < n; i++) {    int cc = f(ch[i]);    p[cc].add(i);    fc[i] = cc;   }   int en = 0;   for (int i = 0; i < 52; i++) {    if (p[i].size() > 0) en = Math.max(en, p[i].poll());   }   int mx = en + 1;   for (int i = 0; i < n; i++) {    if (p[fc[i]].size() == 0) break;    en = Math.max(en, p[fc[i]].poll());    mx = Math.min(mx, en - i);   }   System.out.println(mx);  } }
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();  } }
6	public class ACMIND {  static FastReader scan;  static PrintWriter pw;  static long MOD = 1_000_000_007;  static long INF = 1_000_000_000_000_000_000L;  static long inf = 2_000_000_000;  public static void main(String[] args) {   new Thread(null,null,"BaZ",1<<25)   {    public void run()    {     try     {      solve();     }     catch(Exception e)     {      e.printStackTrace();      System.exit(1);     }    }   }.start();  }  static int n, g[], t[], T;  static int dp[][];  static void solve() throws IOException  {   scan = new FastReader();   pw = new PrintWriter(System.out,true);   StringBuilder fast = new StringBuilder();   n = ni();   T = ni();   g = new int[n];   t = new int[n];   for(int i=0;i<n;++i) {    t[i] = ni();    g[i] = ni();   }   int MAX = (1<<n);   dp = new int[MAX][4];   for(int i=0;i<MAX;++i) {    for(int j=0;j<4;++j) {     dp[i][j] = -1;    }   }   pl(f((1<<n)-1,0));   pw.flush();   pw.close();  }  static int f(int mask, int prev) {   if(dp[mask][prev]!=-1) {    return dp[mask][prev];   }   int left = T;   for(int i=0;i<n;++i) {    if((mask&(1<<i))==0) {     left-=t[i];    }   }   if(left==0) {    return 1;   }   int cnt = 0;   for(int i=0;i<n;++i) {    if((mask&(1<<i))!=0) {     if(g[i]!=prev && left>=t[i]) {      cnt+=f(mask^(1<<i), g[i]);      if(cnt>=MOD) {       cnt-=MOD;      }     }    }   }   return dp[mask][prev] = cnt;  }  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()  {   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 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 class FastReader {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;   public FastReader() {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public FastReader(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[1000000];    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 problemA {  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[] hs = new int[n];   for(int i = 0; i < n; i++){    hs[i] = sc.nextInt();   }   Arrays.sort(hs);   System.out.println(hs[b]-hs[b-1]);  } }
0	public class Subtractions {     public static void main(String[]args){  Scanner sc=new Scanner(System.in);  int test=sc.nextInt();  while(test-->0){  long a=sc.nextLong();  long b=sc.nextLong();  long count=0;  long cnt=0;  while(a>0&&b>0){   count=0;     if(a>b){  count+=(a-b)/b;  if(count!=0){  cnt+=count;  a-=b*count;}  else {   cnt++;   a-=b;  }  }  else{   count+=(b-a)/a;   if(count!=0){   cnt+=count;  b-=a*count;}   else {   cnt++;   b-=a;   }  }  }  System.out.println(cnt);  }      } }
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 codeforces2 {  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++) {    long n = sc.nl();    if (n % 2 == 1) {     pw.println("NO");    }    else {     n/= 2;     if (perfectSquare(n)) {      pw.println("YES");     }     else if (n % 2 == 0 && perfectSquare(n/2)) {      pw.println("YES");     }     else {      pw.println("NO");     }    }   }   pw.close();  }   public static boolean solve(int n,int m, int k) {   return false;  }  public static boolean perfectSquare(long n) {   long lo = 0;   long hi = n;   while (lo < hi) {    long k = (lo + hi) / 2;    if (k * k < n)     lo = k + 1;    else     hi = k;   }   return (lo * lo == n);  }  static Set<Integer> divisors(int n) {   Set<Integer> set = new HashSet();   for (int i=1; i<=Math.sqrt(n); i++)   {    if (n%i==0)    {         if (n/i == i)      set.add(i);       else {      set.add(i);      set.add(n / i);     }    }   }   return set;  }  static Map<Integer, Integer> primeFactorization(int x) {     Map<Integer, Integer> map = new HashMap();   if (x == 0) return map;   int count = 0;   while (x % 2 == 0) {    x /=2;    count++;   }     if (count > 0) map.put(2, count);   for (int divisor = 3; divisor * divisor <= x; divisor += 2) {    int cnt = 0;    while (x % divisor == 0) {     x /= divisor;     cnt++;    }    if (cnt > 0) map.put(divisor, cnt);   }   if (x > 1) {    map.put(x, 1);   }   return map;  }  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 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);  }         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");   }   sb.setLength(sb.length() - 1);   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 UnionFind {  int size;  private int[] id;  public UnionFind(int size) {   this.size = size;   id = new int[size];   for (int i = 0; i < id.length; i++) {    id[i] = i;   }  }  public int find(int a) {   if (id[a] != a) {    id[a] = find(id[a]);   }   return id[a];  }  public void union(int a, int b) {   int r1 = find(a);   int r2 = find(b);   if (r1 == r2) return;   size--;   id[r1] = r2;  }  @Override  public String toString() {   return Arrays.toString(id);  } }
3	public class java2 {  public static void main(String[] args) {   Scanner r = new Scanner(System.in);   int n=r.nextInt();   int []l=new int[1005];   int []ri=new int[1005];   int []candy=new int[1005];   for(int i=1;i<=n;++i)   {    l[i]=r.nextInt();   }   for(int i=1;i<=n;++i)   {    ri[i]=r.nextInt();   }   for(int i=1;i<=n;++i)   {    if(l[i]>i-1||ri[i]>n-i)    {     System.out.println("NO");     System.exit(0);    }    candy[i]=n-l[i]-ri[i];   }   for(int i=1;i<=n;++i)   {    int left=0,right=0;    for(int j=1;j<=i-1;++j)    {     if(candy[j]>candy[i])     {      ++left;     }    }    for(int j=i+1;j<=n;++j)    {     if(candy[j]>candy[i])     {      ++right;     }    }    if(left!=l[i]||right!=ri[i])    {     System.out.println("NO");     System.exit(0);    }   }   System.out.println("YES");   for(int i=1;i<=n;++i)   {    System.out.print(candy[i]+" ");   }  } }
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(),a=in.nextInt(),b=in.nextInt(),i,c=0;   int ar[]=new int[n];   for(i=0;i<n;i++)    ar[i]=in.nextInt();   Arrays.sort(ar);   out.println(ar[b]-ar[b-1]); } }
1	public class ProbB implements Runnable { private boolean _ReadFromFile = false; private boolean _WriteToFile = false; static final String TASK_ID = "in"; static final String IN_FILE = TASK_ID + ".in"; static final String OUT_FILE = TASK_ID + ".out"; static BufferedReader reader; static StringTokenizer tokenizer; static PrintWriter writer; private static String alphabet;  private static void core() throws Exception {  int n = nextInt();  alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";  for (int test = 0; test < n; test++) {  String input = reader.readLine();  StringTokenizer st = new StringTokenizer(input, alphabet);    ArrayList<Integer> have = new ArrayList<Integer>();  while (st.hasMoreElements()) {   String kString = st.nextToken();   have.add(Integer.parseInt(kString));  }  if (have.size() == 2)   writer.println(twoInts(have.get(0), have.get(1)));  else {   String row = "";   int col = 0;   for (int i = 0; i < input.length(); i++) {   if (Character.isDigit(input.charAt(i))) {    row = input.substring(0, i);    col = Integer.parseInt(input.substring(i));    break;   }   }   writer.println(oneInt(row, col));  }  } } private static String oneInt(String row, int col) {  return "R" + col + "C" + toNum(row); } private static int toNum(String row) {  int res = 0;  for (int i = 0; i < row.length(); i++) {  res = res * 26 + row.charAt(i) - 'A' + 1;  }  return res; } private static String twoInts(Integer row, Integer col) {  return toAlpha(col) + row; } private static String toAlpha(Integer col) {  String res = "";  while (col > 0) {  if (col % 26 > 0) {   res = alphabet.charAt(col % 26 - 1) + res;   col /= 26;  }  else {   res = "Z" + res;   col -= 26;   col /= 26;  }  }  return res; } void debug(Object...os) {  System.out.println(Arrays.deepToString(os)); }   public static void main(String[] args) throws InterruptedException {   Thread thread = new Thread(new ProbB());   thread.start();   thread.join();  } public void run() {   try {   reader = _ReadFromFile ? new BufferedReader(new FileReader(IN_FILE)) : new BufferedReader(new InputStreamReader(System.in));   writer = _WriteToFile ? new PrintWriter(OUT_FILE) : new PrintWriter(new BufferedOutputStream(System.out));    tokenizer = null;    core();    reader.close();    writer.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  } static int nextInt() throws Exception {   return Integer.parseInt(nextToken());  } static long nextLong() throws Exception {   return Long.parseLong(nextToken());  } static double nextDouble() throws Exception {   return Double.parseDouble(nextToken());  } static String nextToken() throws Exception {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  } }
1	public class Main {  static class FastReader  {   private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public FastReader() { this(System.in); }public FastReader(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 next(){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(next()) ;}   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 void scanIntArr(int [] arr){ for(int li=0;li<arr.length;++li){ arr[li]=i();}}   public void scanLongArr(long [] arr){for (int i=0;i<arr.length;++i){arr[i]=l();}}   public void shuffle(int [] arr){ for(int i=arr.length;i>0;--i) { int r=(int)(Math.random()*i); int temp=arr[i-1]; arr[i-1]=arr[r]; arr[r]=temp; } }  }  public static void main(String[] args)throws IOException {     PrintWriter pw = new PrintWriter(System.out);   FastReader fr = new FastReader();   int n=fr.i();   int [] arr=new int[n];   fr.scanIntArr(arr);   int min=Integer.MAX_VALUE;   int max=Integer.MIN_VALUE;   long sum=0;   if(n==1)   {    pw.println(arr[0]);    pw.flush();    pw.close();    return;   }   for(int i=0;i<n;++i)   {    if(arr[i]<min)     min=arr[i];    if(arr[i]>max)     max=arr[i];    sum+=Math.abs(arr[i]);   }   if(min>0)   {    sum-=2*min;   }   if(max<0)   {    sum+=2*max;   }   pw.println(sum);   pw.flush();   pw.close();  } }
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 subtractionn {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);  int t;  t=in.nextInt();  while(t!=0)  {  int a=in.nextInt();  int b=in.nextInt();  int total=0,neww=0;  if(a%b==0)  {   System.out.println(a/b);  }  else if(b%a==0)  {   System.out.println(b/a);  }  else  {  while(a!=0 && b!=0)  {   if(a>b)   {   total=total+(a/b);   a=a%b;   if(a==0)   {    break;   }   }   else if(b>a)   {   total=total+(b/a);   b=b%a;   if(b==0)   {    break;   }   }   else   {   System.exit(0);   }  }  System.out.println(total);  }  t--;  } } }
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);   }  } }
4	public class C23A {  public static void main(String args[]){   Scanner sc=new Scanner(System.in);   String str=sc.next();   for(int k=str.length()-1;k>=1;k--){    for(int i=0;i<=str.length()-k;i++){     for(int j=i+1;j<=str.length()-k;j++){      if(str.substring(i,i+k).equals(str.substring(j,j+k))){        System.out.println(k);        return;      }     }    }   }   System.out.println(0);  } }
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");  } }
6	public class D{  static int bot; static int n,m; static int [][]a; static int [][]Min; static int [][]memo; static int K; static int dp(int msk,int ones,int last) {  if(ones==n) {  return Min[last][bot]>=K?1:0;  }  if(memo[last][msk]!=-1)  return memo[last][msk];  int ans=0;  for(int nxt=0;nxt<n;nxt++)  if((msk & (1<<nxt)) ==0 && Min[last][nxt]>=K)  {   ans|=dp(msk|1<<nxt,ones+1,nxt);  }  return memo[last][msk]= ans; } static boolean check(int top,int bottom) {  for(int j=0;j+1<m;j++)  {  int diff=Math.abs(a[bottom][j]-a[top][j+1]);  if(diff<K)   return false;  }  return true; } public static void main(String[] args) throws IOException {  Scanner sc=new Scanner();  PrintWriter out=new PrintWriter(System.out);  n=sc.nextInt();  m=sc.nextInt();  a=new int [n][m];  for(int i=0;i<n;i++)  for(int j=0;j<m;j++)   a[i][j]=sc.nextInt();  Min=new int [n][n];  if(n==1) {  int lo=0,hi=(int)1e9;  int ans=0;  while(lo<=hi) {   K=lo+hi>>1;     if(check(0, 0))   {   ans=K;   lo=K+1;   }   else   hi=K-1;  }  System.out.println(ans);  return;  }  for(int i1=0;i1<n;i1++)  for(int i2=0;i2<n;i2++)  {   if(i1==i2)   continue;   int min=(int) 1e9;   for(int j=0;j<m;j++)   min=Math.min(Math.abs(a[i1][j]-a[i2][j]), min);   Min[i1][i2]=min;  }  memo=new int [n][1<<n];  int ans=0;  int lo=0,hi=(int)1e9;  while(lo<=hi) {  K=lo+hi>>1;  for(int []x:memo)  Arrays.fill(x, -1);  int ok=0;  for(int top=0;top<n && ok==0;top++)  for(int bottom=0;bottom<n && ok==0 ;bottom++) {   bot=bottom;   if(top==bottom || !check(top, bottom))   continue;        int dp=dp(1<<top | 1<<bottom, 2, top);   ok|=dp;     }  if(ok==1)  {  ans=K;  lo=K+1;    }  else  hi=K-1;  }  out.println(ans);   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());  } } }
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 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());  } }
6	public class Main { public static void main(String[] args) {  new Main().run(); }  boolean[][] graph; public void run() {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int m = sc.nextInt();  graph = new boolean[n][n];  for (int i = 0; i < m; i++) {  int a = sc.nextInt() - 1;  int b = sc.nextInt() - 1;  graph[a][b] = true;  graph[b][a] = true;  }   long res = 0;  for (int i = 3; i <= n; i++) {  res += solve(i);  }  System.out.println(res);  }  long solve(int n) {   long[][] dp = new long[1 << n][n];  dp[1 << (n-1)][n-1] = 1;  for (int i = 0; i < (1 << n); ++i) {  for (int l = 0; l < n; ++l) if (dp[i][l] > 0) {   for (int x = 0; x < n - 1; ++x) if (graph[l][x] && (i >> x & 1) == 0) {   dp[i | (1 << x)][x] += dp[i][l];   }  }  }  long res = 0;  for (int i = 0; i < (1 << n); ++i) if (Integer.bitCount(i) >= 3) {  for (int l = 0; l < n; ++l) {   if (graph[l][n-1]) res += dp[i][l];  }  }  return res / 2;  } }
2	public class Pipeline {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   long n = in.nextLong();   long k = in.nextLong();   if (n == 1) {    System.out.println(0);    return;   }   if (k >= n) {    System.out.println(1);    return;   }   long total = (k + 2) * (k - 1) / 2 - (k - 2);   if (total < n) {    System.out.println(-1);    return;   }   int i = 2, j = (int) k;   while (i <= j) {    int m = (i + j) / 2;    total = (k + m) * (k - m + 1) / 2 - (k - m);    if (total == n) {     System.out.println(k - m + 1);     return;    }    if (total < n)     j = m - 1;    else     i = m + 1;   }   System.out.println(k-i+2);  } }
5	public class Contest169ProblemA implements Runnable {  void solve() throws NumberFormatException, IOException {   int n = nextInt(), a = nextInt(), b = nextInt();   ArrayList<Integer> tasks= new ArrayList<Integer>();     for (int i = 0; i < n; ++i){    tasks.add(nextInt());   }   Collections.sort(tasks);   int l1 = tasks.get(b-1);   int l2 = tasks.get(b);   if (l2 - l1 >= 0){    out.print(l2-l1);   } else {    out.print(l2-l1);   }  }   StringTokenizer st;  BufferedReader in;  PrintWriter out;   public static void main(String[] args) {   new Thread(new Contest169ProblemA()).start();  }   public void run() {   try {    if (System.getProperty("ONLINE_JUDGE") != null) {     in = new BufferedReader(new InputStreamReader(System.in));    } else {     in = new BufferedReader(new FileReader("input.txt"));    }    out = new PrintWriter(System.out);     solve();    } catch (Exception e) {    e.printStackTrace();    System.out.print(e);    System.exit(9000);    } 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 Main { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter; private PrintWriter pw; private long mod = 1000000000 + 7;  private StringBuilder ans_sb; private int size = 1000005; private long[] fact; private void soln() {  int n = nextInt();  HashMap<String, Integer>[] s1 = new HashMap[4];  for(int i=0;i<=3;i++) {  s1[i] = new HashMap<>();  }  int cnt = 0;  for(int i=0;i<n;i++) {  String s = nextLine();  if(s1[s.length()-1].containsKey(s)) {   s1[s.length()-1].put(s, s1[s.length()-1].get(s)+1);  }else   s1[s.length()-1].put(s, 1);  }  for(int i=0;i<n;i++) {  String s = nextLine();  if(s1[s.length()-1].containsKey(s)) {   s1[s.length()-1].put(s, s1[s.length()-1].get(s)-1);   if(s1[s.length()-1].get(s) == 0)   s1[s.length()-1].remove(s);  }else {   cnt++;  }  }  pw.println(cnt); } private class Pair implements Comparable<Pair>{  long x, y;  int i;  public Pair(long a,long b,int c) {  x = a;  y = b;  i = c;  }  @Override  public int compareTo(   Pair o)  {  return Long.compare(this.x, o.x);  }  public String toString() {  return ""+i;  } } private void debug(Object... o) {  System.out.println(Arrays.deepToString(o)); } private long pow(long a, long b, long c) {  if (b == 0)  return 1;  long p = pow(a, b / 2, c);  p = (p * p) % c;  return (b % 2 == 0) ? p : (a * p) % c; }  private long gcd(long n, long l) {  if (l == 0)  return n;  return gcd(l, n % l); }  public static void main(String[] args) throws Exception {  new Thread(null, new Runnable() {  @Override  public void run() {   new Main().solve();  }  }, "1", 1 << 26).start();   }  public StringBuilder solve() {  InputReader(System.in);   pw = new PrintWriter(System.out);   soln();  pw.close();   return ans_sb; }  public void InputReader(InputStream stream1) {  stream = stream1; }  private boolean isWhitespace(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  private boolean isEndOfLine(int c) {  return c == '\n' || c == '\r' || c == -1; }  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++]; }  private 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 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 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 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 int[] nextIntArray(int n) {  int[] arr = new int[n];  for (int i = 0; i < n; i++) {  arr[i] = nextInt();  }  return arr; }  private long[] nextLongArray(int n) {  long[] arr = new long[n];  for (int i = 0; i < n; i++) {  arr[i] = nextLong();  }  return arr; }  private void pArray(int[] arr) {  for (int i = 0; i < arr.length; i++) {  System.out.print(arr[i] + " ");  }  System.out.println();  return; }  private void pArray(long[] arr) {  for (int i = 0; i < arr.length; i++) {  System.out.print(arr[i] + " ");  }  System.out.println();  return; }  private boolean isSpaceChar(int c) {  if (filter != null)  return filter.isSpaceChar(c);  return isWhitespace(c); }  private char nextChar() {  int c = read();  while (isSpaceChar(c))  c = read();  char c1 = (char) c;  while (!isSpaceChar(c))  c = read();  return c1; }  private interface SpaceCharFilter {  public boolean isSpaceChar(int ch); } }
2	public class Main {  static boolean visited[] ;  static boolean ends[] ; static long mod = 1000000007 ; static int lens[] ;  static int seeds[] ;  static int a[] ; static double total ;  public static ArrayList adj[] ;  public static long x,y ; public static ArrayList<Long> xx ;  public static void main(String[] args) throws IOException, InterruptedException {  Scanner sc = new Scanner(System.in) ;  long x = sc.nextLong() ;  long k = sc.nextLong() ;  if(x==0)  {System.out.println(0); return ;}  if(k==0)  {System.out.println((2l*x)%mod);return ;}   long m=pow(2,k);   long a = 2l*(x%mod)*(m%mod);   a = a-m+1 ;  a=a%mod ;  if(a<0)a=(a%mod + mod) % mod;  System.out.println(a);    }   static ArrayList<Long> divisors(long n) {  ArrayList<Long> arr = new ArrayList<Long>() ;    for (int i=1; i<=Math.sqrt(n); i++)  {  if (n%i==0)      if (n/i == i)   {arr.add(1l*i);arr.add(1l*i);}   else   {arr.add(1l*i); arr.add(1l*n/i);}  }   return arr ;  }  public static void generate(long current) {  if(current>10000000000l)  return ;   xx.add(current) ;  generate((10*current) +4);  generate((10*current) +7);  }  public static int neededFromLeft(String x) {  Stack<Character> st = new Stack<Character>() ;  int c=0;  for (int i = 0; i < x.length(); i++)  {  char cur = x.charAt(i);   if(cur==')' && st.isEmpty())   c ++;   else if(cur==')' && !st.isEmpty())   st.pop();  else if(cur=='(')   st.push(cur);  }  return c; }  public static int neededFromRight(String x) {  Stack<Character> st = new Stack<Character>() ;  int c=0;  boolean f=true;  for (int i = 0; i < x.length(); i++)  {  char cur = x.charAt(i);   if(cur==')' && st.isEmpty())   f=false;   else if(cur==')' && !st.isEmpty())   st.pop();  else if(cur=='(')   st.push(cur);  }  return st.size();  }  public static boolean fromBoth(String x) {  Stack<Character> st = new Stack<Character>() ;  boolean f1=true ,f2=true ;   for (int i = 0; i < x.length(); i++)  {  char cur = x.charAt(i);   if(cur==')' && st.isEmpty())   f1 =false ;   else if(cur==')' && !st.isEmpty())   st.pop();  else if(cur=='(')   st.push(cur);  }  if(st.size()>0)f2 = false ;  if(f1==false && f2==false)  return true ;  else   return false; }  public static boolean isRegular(String x) {  Stack<Character> st = new Stack<Character>() ;  for (int i = 0; i < x.length(); i++)  {  char cur = x.charAt(i);   if(cur==')' && st.isEmpty())   return false ;   else if(cur==')' && !st.isEmpty())   st.pop();  else if(cur=='(')   st.push(cur);  }  if(st.size()>0)return false ; else return true ; }  public static int gcdExtended(int a, int b) {   if (a == 0)  {  x = 0;  y = 1;  return b;  }    int gcd = gcdExtended(b%a, a);     long x1 = y - (b/a) * x;  long y1 = x;  x = x1 ;  y = y1 ;  return gcd; }      static int even(String x , int b ) {  for (int j = b; j>=0; j--)  {  int current = x.charAt(j)-48 ;   if(current%2==0)   return current ;  }  return -1; } static int odd(String x , int b ) {  for (int j = b; j>=0; j--)  {  int current = x.charAt(j)-48 ;   if(current%2!=0)   return current ;  }  return -1; } static long pow(long base, long k) {  long res = 1;  while(k > 0) {  if(k % 2 == 1) {   res = (res * base) % mod;  }   base = (base * base) % mod;  k /= 2;  }  return res; } public static long solve(int k1, long k2) {  long x = 1l*k2*(pow(2, k1)-1) ;  return x%(1000000007) ;  }  public static long getN(long x) {  long n = (long) Math.sqrt(x*2) ;  long y = n*(n+1)/2;  if(y==x)  return n ;  else if(y>x)  return n ;  else  for (long i = n; ; i++)  {   y = i*(i+1)/2 ;   if(y>=x)   return i ;    } }     public static void dfss(int root , int len) {  visited[root]=true ;  if(ends[root] && root!=0) lens[root] = len ;   for (int i = 0; i < adj[root].size(); i++)  {  int c= (int) adj[root].get(i) ;   if(visited[c]==false)   dfss(c, len+1);  } }  public static void pr(int root , int seed){  visited[root] = true ;  int dv = adj[root].size()-1 ;  if(root==0) dv++ ;  for (int i = 0; i < adj[root].size(); i++)  {  int c = (int)adj[root].get(i) ;   seeds[c]=dv*seed ;  }  for (int i = 0; i < adj[root].size() ; i++)  {  int c = (int)adj[root].get(i) ;   if(visited[c]==false)   pr(c , seeds[c]);  }  }  public static String concatinate(String s ,int n) {  if(s.length()==n)  return s ;  else return concatinate("0"+s, n) ; } 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();  } }  public static long getGCD(long n1, long n2) {  if (n2 == 0) {  return n1;  }  return getGCD(n2, n1 % n2); }  public static int cnt1(int mat[][])  {  int m = mat.length ;  int c=0 ;  for (int i = 0; i < mat.length; i++)  {  for (int j = 0; j < mat.length; j++)  {   int x = (i*m) +j ;   if(x%2==0 && mat[i][j]==0)   c++;   if(x%2!=0 && mat[i][j]==1)   c++;   }  }  return c; } public static int cnt0(int mat[][]) {  int m = mat.length ;  int c=0 ;  for (int i = 0; i < mat.length; i++)  {  for (int j = 0; j < mat.length; j++)  {   int x = (i*m) +j ;   if(x%2!=0 && mat[i][j]==0)   c++;   if(x%2==0 && mat[i][j]==1)   c++;   }  }  return c; }  public static boolean canFit2(int x1, int y1 , int x2 , int y2 , int x3 , int y3){  if(x1==x2)  if(x1==x3)   return true ;   else   return false ;  else  if(x1==x3)   return false ;   else  {   long a = 1l*(y2-y1)*(x3-x2) ;   long b = 1l*(y3-y2)*(x2-x1) ;    if(a==b)   return true;   else    return false ;   }  } public static void shuffle(pair[] ss){  if(ss.length==1)  return ;  for (int i = 0; i < ss.length; i++)  {  Random rand = new Random();   int n = rand.nextInt(ss.length-1) + 0;   pair temp = ss[i] ;   ss[i] = ss[n] ;   ss[n] = temp ;  } } public static int binary(ArrayList<pair> arr, int l, int r, long x)  {  if (r>=l)  {  int mid = l + (r - l)/2;  if (arr.get(mid).x== x)   return mid;  if (arr.get(mid).x> x)   return binary(arr, l, mid-1, x);  return binary(arr, mid+1, r, x);  }  return -1; }   public static int binary1(int[]arr , int x) {  int low = 0, high = arr.length;  while (low != high) {  int mid = (low + high) / 2;   if (arr[mid] <= x) {     low = mid + 1;  }  else {     high = mid;  }  }  return low ;  }   public static int binary2(pair[]arr , int x) {  int low = 0, high = arr.length;  while (low != high) {  int mid = (low + high) / 2;   if (arr[mid].x >= x) {     high=mid;  }  else {     low = mid+1 ;   }  }  return low ;  }  private static boolean triangle(int a, int b , int c){  if(a+b>c && a+c>b && b+c>a)  return true ;  else   return false ; } private static boolean segment(int a, int b , int c){  if(a+b==c || a+c==b && b+c==a)  return true ;  else   return false ; } private static int gcdThing(long a, long b) {  BigInteger b1 = BigInteger.valueOf(a);  BigInteger b2 = BigInteger.valueOf(b);  BigInteger gcd = b1.gcd(b2);  return gcd.intValue(); }  public static boolean is(int i){  if(Math.log(i)/ Math.log(2) ==(int) (Math.log(i)/ Math.log(2)))  return true ;  if(Math.log(i)/ Math.log(3) ==(int) (Math.log(i)/ Math.log(3)) )  return true ;  if(Math.log(i)/ Math.log(6) ==(int) (Math.log(i)/ Math.log(6)) )  return true ;   return false;  } public static boolean contains(int b[] , int x) {  for (int i = 0; i < b.length; i++)  {  if(b[i]==x)   return true ;  }  return false ; } public static int binary(long []arr , long target , int low , long shift) {  int high = arr.length;  while (low != high) {  int mid = (low + high) / 2;   if (arr[mid]-shift <= target) {   low = mid + 1;  }  else {   high = mid;  }  }  return low ;  } public static boolean isLetter(char x){  if(x+0 <=122 && x+0 >=97 )  return true ;  else if (x+0 <=90 && x+0 >=65 )  return true ;  else return false;  } public static long getPrimes(long x ){  if(x==2 || x==3 || x==1)  return 2 ;  if(isPrime(x))  return 5 ;  for (int i = 2; i*i<=x; i++)  {  if(x%i==0 && isPrime(i))   return getPrimes(x/i) ;  }  return -1; } public static String solve11(String x){  int n = x.length() ;  String y = "" ;  for (int i = 0; i < n-2; i+=2)  {  if(ifPalindrome(x.substring(i, i+2)))   y+= x.substring(i, i+2) ;  else   break ;  }  return y+ solve11(x.substring(y.length(),x.length())) ;  } public static String solve1(String x){  String y = x.substring(0 , x.length()/2) ;  return "" ;  } public static String reverse(String x){  String y ="" ;  for (int i = 0; i < x.length(); i++)  {  y = x.charAt(i) + y ;  }  return y ; }  public static boolean ifPalindrome(String x){  int numbers[] = new int[10] ;  for (int i = 0; i < x.length(); i++)  {  int z = Integer.parseInt(x.charAt(i)+"") ;   numbers[z] ++ ;  }  for (int i = 0; i < numbers.length; i++)  {  if(numbers[i]%2!=0)   return false;  }  return true ;  }  public static int get(int n){  return n*(n+1)/2 ;  }              public static int lis( int[]a , int n){  int lis[] = new int[n] ;  Arrays.fill(lis,1) ;   for(int i=1;i<n;i++)  for(int j=0 ; j<i; j++)   if (a[i]>a[j] && lis[i] < lis[j]+1)    lis[i] = lis[j] + 1;     int max = lis[0];  for(int i=1; i<n ; i++)  if (max < lis[i])   max = lis[i] ;  return (max);                        } public static int calcDepth(Vertix node){  if(node.depth>0) return node.depth;    if(node.parent != null)  return 1+ calcDepth(node.parent);  else  return -1; }  public static boolean isPrime (long num){  if (num < 2) return false;  if (num == 2) return true;  if (num % 2 == 0) return false;  for (int i = 3; i * i <= num; i += 2)  if (num % i == 0) return false;  return true; }  public static ArrayList<Long> getDiv(Long n) {  ArrayList<Long> f = new ArrayList<Long>() ;   while (n%2==0)  {  if(!f.contains(2))f.add((long) 2) ;  n /= 2;  }     for (long i = 3; i <= Math.sqrt(n); i+= 2)  {    while (n%i == 0)  {   if(!f.contains(i))f.add(i);   n /= i;  }  }     if (n > 2)  if(!f.contains(n))f.add(n);   return f ;   }                             public static class Vertix{  long i ;  int depth ;  ArrayList<Vertix> neighbours ;  Vertix parent ;  Vertix child ;   public Vertix(long i){  this.i = i ;  this.neighbours = new ArrayList<Vertix> () ;  this.parent = null ;  depth =-1;  this.child = null ;  } }  public static class pair implements Comparable<pair> {  int x ;  int y ;  int i;    public pair(int x, int y, int i ){   this.x=x ;   this.y =y ;  this.i =i ;   }   @Override  public int compareTo(pair p) {  if(this.x > p.x)   return 1 ;   else if (this.x == p.x)   return 0 ;   else   return -1 ;  }   }  public static class pair2 implements Comparable<pair2>{  int i ;  int j ;  int plus ;  public pair2(int i , int j , int plus){  this.i =i ;  this.j = j ;   this.plus = plus ;  }  @Override  public int compareTo(pair2 p) {  if(this.j > p.j)   return 1 ;   else if (this.j == p.j) return 0 ;  else   return -1 ;  }  } public static class point implements Comparable<point> {  int x, y ;  public point(int x,int y){  this.x=x ; this.y=y;  }  @Override  public boolean equals(Object o) {     if (o == this) {   return true;  }     if (!(o instanceof point)) {   return false;  }     point c = (point) o;     return Integer.compare(x, c.x) == 0   && Integer.compare(y, c.y) == 0;  }  @Override  public int compareTo(point p) {  if(this.x == p.x && this.y ==p.y)   return 0 ;   else   return -1 ;  }  @Override  public int hashCode()  {  return 15+x+(y%2) ;  }   }  }
3	public class SameSumBlocks {    public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   int t = 1;   for (int i = 0; i < t; i++) {    solve(sc, pw);   }   pw.close();  }  static void solve(Scanner in, PrintWriter out){   int n = in.nextInt();   int[] arr = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = in.nextInt();   }   Map<Long, List<int[]>> mp = new HashMap<>();   long[] pre = new long[n + 1];   for (int i = 1; i <= n; i++) {    pre[i] = pre[i - 1] + arr[i - 1];   }   for (int i = 0; i < n; i++) {    for (int j = i; j < n; j++) {     long sz = pre[j + 1] - pre[i];     if (!mp.containsKey(sz)) mp.put(sz, new ArrayList<>());     mp.get(sz).add(new int[]{i, j});    }   }   int max = 0;   List<int[]> ans = new ArrayList<>();   for(List<int[]> ls : mp.values()){    Collections.sort(ls, (a, b) -> {     if (a[1] == b[1]) return b[0] - a[0];     return a[1] - b[1];    });    List<int[]> tt = new ArrayList<>();    int cnt = 0;    int pr = -1;    for (int i = 0; i < ls.size(); i++) {     int[] get = ls.get(i);     if (get[0] <= pr) continue;     cnt++;     tt.add(get);     pr = get[1];    }    if (max < cnt){     ans = tt;     max = cnt;    }   }   out.println(max);   for(int[] v : ans){    out.println((v[0] + 1) + " " + (v[1] + 1));   }  } }
0	public class MAIN {  public static void main(String args[])  {   Scanner sn=new Scanner(System.in);   int n,n1,n2,n3;   int arr[]={0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811,514229,832040,1346269,2178309,3524578,5702887,9227465,14930352,24157817,39088169,63245986,102334155,165580141,267914296,433494437,701408733,1134903170};   n=sn.nextInt();    if(n==2)   {    n1=n2=1;    n3=0;   }   else if(n==1)   {    n3=n2=0;    n1=1;   }   else if(n==0)   {    n1=n2=n3=0;   }   else if(n==3)   {    n1=n2=n3=1;   }   else   {    int index=bsearch(arr,0,arr.length-1,n);    n1=arr[index-1];    n2=arr[index-3];    n3=arr[index-4];   }   System.out.println(n3+" "+n2+" "+n1);  }  static int bsearch(int arr[],int l,int h,int n)  {   if(l>h)   return -1;   int mid=(l+h)/2;   if(n==arr[mid])   return mid;   else if(n>arr[mid])   return(bsearch(arr,mid+1,h,n));   else   return(bsearch(arr,l,mid-1,n));  } }
3	public class A extends PrintWriter {  void run() {   int n = nextInt();   int m = 101;   boolean[] c = new boolean[m];   for (int i = 0; i < n; i++) {    int v = nextInt();    c[v] = true;   }   int ans = 0;   for (int v = 1; v < m; v++) {    if (c[v]) {     ++ans;     for (int u = v; u < m; u += v) {      c[u] = false;     }    }   }   println(ans);  }  boolean skip() {   while (hasNext()) {    next();   }   return true;  }  int[][] nextMatrix(int n, int m) {   int[][] matrix = new int[n][m];   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     matrix[i][j] = nextInt();   return matrix;  }  String next() {   while (!tokenizer.hasMoreTokens())    tokenizer = new StringTokenizer(nextLine());   return tokenizer.nextToken();  }  boolean hasNext() {   while (!tokenizer.hasMoreTokens()) {    String line = nextLine();    if (line == null) {     return false;    }    tokenizer = new StringTokenizer(line);   }   return true;  }  int[] nextArray(int n) {   int[] array = new int[n];   for (int i = 0; i < n; i++) {    array[i] = nextInt();   }   return array;  }  int nextInt() {   return Integer.parseInt(next());  }  long nextLong() {   return Long.parseLong(next());  }  double nextDouble() {   return Double.parseDouble(next());  }  String nextLine() {   try {    return reader.readLine();   } catch (IOException err) {    return null;   }  }  public A(OutputStream outputStream) {   super(outputStream);  }  static BufferedReader reader;  static StringTokenizer tokenizer = new StringTokenizer("");  static Random rnd = new Random();  static boolean OJ;  public static void main(String[] args) throws IOException {   OJ = System.getProperty("ONLINE_JUDGE") != null;   A solution = new A(System.out);   if (OJ) {    reader = new BufferedReader(new InputStreamReader(System.in));    solution.run();   } else {    reader = new BufferedReader(new FileReader(new File(A.class.getName() + ".txt")));    long timeout = System.currentTimeMillis();    while (solution.hasNext()) {     solution.run();     solution.println();     solution.println("----------------------------------");    }    solution.println("time: " + (System.currentTimeMillis() - timeout));   }   solution.close();   reader.close();  } }
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); } }
1	public class Solution extends Thread {  final static int MAXNUM = 1 << 20;  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  st = new StringTokenizer("");  int tests = nextInt();  int num = 1;  for (int test = 0; test < tests; test++) {   String s = next();   if (s.charAt(0) == 'R' && s.charAt(1) >= '0' && s.charAt(1) <= '9' && s.indexOf('C') != -1) {   String[] sp = s.split("[RC]");   int r = Integer.parseInt(sp[1]);   int c = Integer.parseInt(sp[2]);   s = "";   while (c > 0) {    if (c % 26 == 0) {    s = 'Z' + s;    c /= 26;    c --;    } else {    s = (char)('A' + c % 26 - 1) + s;    c /= 26;    }   }   s = s + r;   } else {   int pos = 0;   while (s.charAt(pos) < '0' || s.charAt(pos) > '9') {    pos ++;   }   int r = Integer.parseInt(s.substring(pos));   int c = 0;   s = s.substring(0, pos);   for (int i = 0; i < s.length(); i++) {    if (s.charAt(i) < 'Z') {    c = c * 26 + (s.charAt(i) - 'A' + 1);    } else {    c = c * 26 + 26;    }   }   s = "R" + r + "C" + c;   }   System.out.println(s);  }  } catch (Exception ex) {  ex.printStackTrace();  System.exit(-1);  } }  String next() throws IOException {  while (!st.hasMoreTokens())  st = new StringTokenizer(in.readLine());  return st.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(next()); }  double nextDouble() throws IOException {  return Double.parseDouble(next()); }  BufferedReader in; StringTokenizer st;  public static void main(String[] args) {  Locale.setDefault(Locale.US);  new Thread(new Solution()).start(); } }
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 A15 {  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(), t = nextInt();   int[] x = new int[n];  int[] a = new int[n];  for (int i = 0; i < n; i++) {  x[i] = nextInt();  a[i] = nextInt();  }   int ans = 0;  for (int i = 0; i < n; i++) {  boolean left = true, right = true;  for (int j = 0; j < n; j++)   if (x[j] < x[i] && a[i] + 2*t + a[j] >= 2*Math.abs(x[i] - x[j])) left = false;   else if (x[j] > x[i] && a[i] + 2*t + a[j] > 2*Math.abs(x[i] - x[j])) right = false;  if (left) ans++;  if (right) ans++;  }   out.println(ans);   out.flush(); } }
0	public class Subtractions {     static long modifiedEuclidGCD(int a , int b) {  return b == 0 ? 0 : (a / b) + modifiedEuclidGCD(b, a % b); }  private static void solve(FastScanner s1, PrintWriter out){   int T = s1.nextInt();  while(T-->0)  out.println(modifiedEuclidGCD(s1.nextInt(), s1.nextInt()));   }            public static void main(String []args) throws IOException {  FastScanner in = new FastScanner(System.in);  PrintWriter out =   new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);  solve(in, out);  in.close();  out.close(); }   static class FastScanner{  BufferedReader reader;  StringTokenizer st;  FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}  String next()  {while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}    st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}  String nextLine() {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}     int nextInt() {return Integer.parseInt(next());}  long nextLong() {return Long.parseLong(next());}   double nextDouble(){return Double.parseDouble(next());}  char nextChar() {return next().charAt(0);}  int[] nextIntArray(int n)   {int[] a= new int[n]; int i=0;while(i<n){a[i++]=nextInt();} return a;}  long[] nextLongArray(int n)  {long[]a= new long[n]; int i=0;while(i<n){a[i++]=nextLong();} return a;}  int[] nextIntArrayOneBased(int n) {int[] a= new int[n+1]; int i=1;while(i<=n){a[i++]=nextInt();} return a;}    long[] nextLongArrayOneBased(int n){long[]a= new long[n+1];int i=1;while(i<=n){a[i++]=nextLong();}return a;}    void close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}   }   }
1	public class B {  static FastScanner fs;  public static void main(String[] args) {   fs=new FastScanner();   int t = fs.nextInt();   while (t-->0)    solve();  }  public static void solve() {   int n = fs.nextInt()*2;   int sq = (int)Math.sqrt(n);   int sq2 = (int)Math.sqrt(n/2);   if (sq*sq==n) System.out.println("YES");   else if (sq2*sq2==n/2.0 && sq2%2==0) System.out.println("YES");   else System.out.println("NO");  }  static int gcd(int a, int b) {   if (a==0) return b;   return gcd(b%a, a);  }  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 final Random random =new Random();  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());   }  }  static int[] reverse(int[] a) {   int n=a.length;   int[] res=new int[n];   for (int i=0; i<n; i++) res[i]=a[n-1-i];   return res;  } }
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());  } }
5	public class A {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  void solve() throws IOException {   int n = nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = nextInt();     Arrays.sort(a);     int sum = 0;   for (int i = 0; i < n; i++)    sum += a[i];     int cur = 0;   for (int i = n - 1; i >= 0; i--) {    cur += a[i];    if (cur > sum - cur) {     out.println(n - i);     return;    }   }  }  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 A().inp();  }  String nextToken() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return "0";    }   }   return st.nextToken();  }  String nextString() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return "0";    }   }   return st.nextToken("\n");  }  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 Test { static BufferedReader reader; static StringTokenizer tokenizer; static PrintWriter writer;  static int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  static long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  static double nextDouble() throws 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));  tokenizer = null;  writer = new PrintWriter(System.out);  solve();  reader.close();  writer.close(); }  private static void solve() throws IOException {  int n = nextInt();  int[] mas = new int[n];  int sum=0;  for(int i=0;i<n;i++)  {  mas[i]=nextInt();  sum+=mas[i];  }  Arrays.sort(mas);  int cs=0;  int res=0;  for(int i=n-1;i>=0;i--)  {  cs+=mas[i];  sum-=mas[i];  res++;  if(cs>sum)   break;  }  writer.println(res);  } }
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);   TaskG1 solver = new TaskG1();   solver.solve(1, in, out);   out.close();  }  static class TaskG1 {   final int mod = (int) 1e9 + 7;   int[][][] dp;   int rec(int mask, int time, int T, int genre, int[] ts, int[] gs) {    if (time > T)     return 0;    if (time == T)     return 1;    if (mask == (1 << ts.length) - 1)     return 0;    int res = dp[genre][time][mask];    if (res != -1)     return res;    res = 0;    for (int i = 0; i < ts.length; i++) {     if ((mask & (1 << i)) == 0 && (mask == 0 || gs[i] != genre)) {      res += rec(mask | (1 << i), time + ts[i], T, gs[i], ts, gs);      if (res >= mod)       res -= mod;     }    }    return dp[genre][time][mask] = res;   }   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int[] ts = new int[n];    int[] gs = new int[n];    int T = in.nextInt();    for (int i = 0; i < n; i++) {     ts[i] = in.nextInt();     gs[i] = in.nextInt() - 1;    }    dp = new int[3][T][1 << n];    for (int[][] aux : dp) {     for (int[] aux2 : aux)      Arrays.fill(aux2, -1);    }    int ans = rec(0, 0, T, 0, ts, gs);    out.println(ans);   }  }  static class InputReader {   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private InputStream stream;   public InputReader(InputStream stream) {    this.stream = stream;   }   private boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   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 nextInt() {    int c = read();    while (isWhitespace(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 (!isWhitespace(c));    return res * sgn;   }  } }
4	public class Solution {  public static void main(String[] args) {   FastScanner sc = new FastScanner();   PrintWriter pw = new PrintWriter(System.out);        int tc = 1;   for (int rep = 0; rep < tc; rep++) {    solve(sc,pw);          }        pw.close();  }       public static void solve(FastScanner sc, PrintWriter pw) {   int n = sc.ni();   int m = sc.ni();   int k = sc.ni();   int[][] arr = sc.to2di(n,m-1);   int[][] arr2 = sc.to2di(n-1,m);      if(k%2==1){    String s ="";    for(int j = 0;j<m;j++){     s+="-1";     if(j!=m-1){      s+=" ";     }    }    for(int i = 0;i<n;i++){     pw.println(s);    }    return;   }      Integer[][][] dp = new Integer[n][m][k+1];                                                                              for(int i= 0;i<n;i++){    for(int j = 0;j<m;j++){         fill(dp,i,j,k,n,m,arr,arr2);        }   }   for(int i= 0;i<n;i++){    String s = "";    for(int j = 0;j<m;j++){         s+=dp[i][j][k];     if(j!=m-1){      s+=" ";     }        }    pw.println(s);   }      }  public static int fill(Integer[][][] dp, int x, int y, int k, int n,int m,int[][] arr, int[][] arr2){        if(dp[x][y][k]!=null){    return dp[x][y][k];   }   if(k==0){    dp[x][y][k]= 0;    return 0;   }   int min = Integer.MAX_VALUE;      if(x>0){        int curVal = 2*arr2[x-1][y]+fill(dp,x-1,y,k-2,n,m,arr,arr2);    min = Math.min(min,curVal);   }   if(y>0){       int curVal = 2*arr[x][y-1]+fill(dp,x,y-1,k-2,n,m,arr,arr2);    min = Math.min(min,curVal);   }   if(x<n-1){       int curVal = 2*arr2[x][y]+fill(dp,x+1,y,k-2,n,m,arr,arr2);    min = Math.min(min,curVal);   }   if(y<m-1){       int curVal = 2*arr[x][y]+fill(dp,x,y+1,k-2,n,m,arr,arr2);    min = Math.min(min,curVal);   }   dp[x][y][k]=min;   return min;   }                                     public static void printArr(PrintWriter pw,int[] a){   for(int i = 0;i<a.length;i++){    pw.print(a[i]);    if(i!=a.length-1){     pw.print(" ");    }   }   pw.println();  }  public static void print2d(PrintWriter pw,int[][] a){   for(int j=0;j<a.length;j++){    for(int i = 0;i<a[j].length;i++){     pw.print(a[j][i]);     if(i!=a[j].length-1){      pw.print(" ");     }    }    pw.println(" ");   }   pw.println();  }  public static int stoi(String s){   return Integer.parseInt(s);  } } 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;  }  int[][] to2di(int m, int n){   int[][] ans = new int[m][n];   for(int i = 0;i<m;i++){    String[] r = nextLine().split("[ ]");    for(int j = 0;j<n;j++){     ans[i][j] = Integer.parseInt(r[j]);    }   }   return ans;  }  long[][] to2dl(int m, int n){   long[][] ans = new long[m][n];   for(int i = 0;i<m;i++){    String[] r = nextLine().split("[ ]");    for(int j = 0;j<n;j++){     ans[i][j] = Long.parseLong(r[j]);    }   }   return ans;  }   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;  } }
6	public class B {  static int first(int n)  { int res = 0; while(n > 0 && (n & 1) == 0){  n >>= 1;  res++; } return res;  }  public static void main(String[] args) throws Exception  { Scanner bf = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = bf.nextInt(), m = bf.nextInt(); ArrayList<Integer> [] adjList = new ArrayList[n]; for (int i = 0; i < adjList.length; i++) {  adjList[i] = new ArrayList<Integer>(); } for (int i = 0; i < m; i++) {  int u = bf.nextInt()-1, v = bf.nextInt()-1;  adjList[u].add(v);  adjList[v].add(u); } long [][] memo = new long[(1<<n)][n]; for (int i = 0; i < n; i++) {  memo[1<<i][i] = 1; } long ans = 0; for (int i = 1; i < 1<<n; i++) {  if(Integer.bitCount(i) == 1) continue;  for (int j = 0; j < n; j++)  {  if((i & (1<<j)) == 0 || j == first(i)) continue;  for(int v:adjList[j])   memo[i][j] += memo[i^(1<<j)][v];  } } for (int i = 1; i < 1<<n; i++) {  if(Integer.bitCount(i) < 3) continue;  int t = first(i);  for (int j = 0; j < n; j++)  {  if(adjList[j].contains(t))   ans += memo[i][j];  } } out.println(ans/2); out.flush(); out.close();  }  static class Scanner { StringTokenizer st; BufferedReader br;  public Scanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s)); }  public Scanner(FileReader fileReader) {  br = new BufferedReader(fileReader); }  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 boolean ready() throws IOException {  return br.ready(); }  } }
5	public class AA { static class O implements Comparable<O> {  int problems;  int penalty;  public O(int p, int pp) {  problems = p;  penalty = pp;  }  public int compareTo(O arg0) {  if (problems == arg0.problems) {   return penalty - arg0.penalty;  }  return -(problems - arg0.problems);  }  }  public static void main(String[] args) throws IOException {  BufferedReader r = new BufferedReader(new InputStreamReader(System.in));  String s = r.readLine();  String[] sp = s.split("[ ]+");  int n = new Integer(sp[0]), k = new Integer(sp[1]) - 1;  O[] arr = new O[n];  for (int i = 0; i < arr.length; i++) {  s = r.readLine();  sp = s.split("[ ]+");  arr[i] = new O(new Integer(sp[0]), new Integer(sp[1]));  }  Arrays.sort(arr);  int res = 1;  int i = k + 1;  while (i < arr.length && arr[i].problems == arr[k].problems   && arr[i].penalty == arr[k].penalty) {  i++;  res++;  }  i = k - 1;  while (i >= 0 && arr[i].problems == arr[k].problems   && arr[i].penalty == arr[k].penalty) {  i--;  res++;  }  System.out.println(res);  } }
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]);    }   }
4	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);   String s = in.next();  int n = s.length();  int max = 0;  for (int i = 1; i < n; i++) {  String[] subs = new String[n - i + 1];  for (int j = 0; j + i <= n; j++) subs[j] = s.substring(j, j + i);  Arrays.sort(subs);  boolean flag = false;  for (int j = 0; j < n - i; j++)   if (subs[j].equals(subs[j + 1])) flag = true;  if (flag) max = Math.max(max, i);  }  out.println(max);  out.close(); } }
2	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();  }  long fast_pow(long a, long b) {   if(b == 0)    return 1L;   long val = fast_pow(a, b / 2);   if(b % 2 == 0)    return val * val % mod;   else    return val * val % mod * a % mod;  }  long mod = (long)1e9 + 7;  public void run() {   InputReader sc = new InputReader(System.in);   PrintWriter w = new PrintWriter(System.out);   long x = sc.nextLong();   long k = sc.nextLong();   if(x == 0) {    w.print("0");    w.close();    return;   }   x = x % mod;   long pkp1 = fast_pow(2, k + 1L);   long pk = fast_pow(2, k);   long sub = (pk - 1 + mod) % mod * pk % mod;   long add = x * pkp1 % mod * pk % mod;   long num = (add - sub + mod) % mod;   long deninv = fast_pow(pk, mod - 2);   long ans = num * deninv % mod;   w.print(ans);   w.close();   } }
6	public class Cycles { public static FastInputStream fis;  public static void main(String[] args) throws IOException {  fis = new FastInputStream(System.in);   System.out.println(solve(fis.nextInt(), fis.nextInt()));   fis.close(); }  public static long solve(int n, int m) throws IOException {  boolean[][] graph = new boolean[n][];  long[][] state = new long[1 << n][n];   for (int i = 0; i < n; i++)  graph[i] = new boolean[n - i];   for (int i = 0; i < m; i++)  {  int a = fis.nextInt() - 1;  int b = fis.nextInt() - 1;  setConnected(graph, a, b);  state[(1 << a) | (1 << b)][a > b ? a : b] = 1;  }   long res = 0;   for (int i = 2; i < n; i++)  {  int baseCombination = (2 << i) - 1;    while (baseCombination < (1 << n))  {   int min = getFirstOne(baseCombination);   int bits = baseCombination;   while (bits != 0)   {   int firstBit = bits & (-bits);   int firstBitPos = getFirstOne(firstBit);      bits &= bits - 1;      if (firstBitPos == min)    continue;      int leftOverBits = baseCombination - firstBit;   int nextBits = leftOverBits;      while (nextBits != 0)   {    int nextBit = nextBits & (-nextBits);    int nextBitPos = getFirstOne(nextBit);       nextBits &= nextBits - 1;       if (nextBitPos == min)    continue;       if (!isConnected(graph, firstBitPos, nextBitPos))    continue;              state[baseCombination][firstBitPos] += state[leftOverBits][nextBitPos];   }      if (isConnected(graph, firstBitPos, min))    res += state[baseCombination][firstBitPos];   }     baseCombination = nextCombination(baseCombination);  }  }      return res >> 1; }  public static boolean isConnected(boolean[][] graph, int a, int b) {  if (b < a || graph[a].length <= (b - a))  return graph[b][a - b];  return graph[a][b - a]; }  public static void setConnected(boolean[][] graph, int a, int b) {  if (b < a || graph[a].length <= (b - a))  graph[b][a - b] = true;  else  graph[a][b - a] = true; }  public static int nextCombination(int x) {  int smallest = x & -x;  int ripple = x + smallest;  int ones = ((x ^ ripple) >> 2) / smallest;  return ripple | ones; }  public static boolean on(int bitmask, int pos) {  return ((bitmask >> pos) & 1) == 1; }  public static int setOn(int bitmask, int pos) {  return bitmask | (1 << pos); }  public static int setOff(int bitmask, int pos) {  return bitmask & ~(1 << pos); }  public static int getOns(int bitmask) {  int amt = 0;  while (bitmask != 0)  {  bitmask &= bitmask - 1;  amt++;  }   return amt; }  public static int getFirstOne(int bitmask) {  if (bitmask == 0)  return -1;   int first = 0;  while ((bitmask & 1) != 1)  {  first++;  bitmask = bitmask >> 1;  }   return first; }  public static class FastInputStream extends InputStream {  private InputStream in;   private byte[] buffer = new byte[512];  private int loaded = 0;  private int pointer = 0;   public FastInputStream(InputStream in)  {  this.in = in;  }  @Override  public int read() throws IOException  {  if (hasNext())   return buffer[pointer++];  else   return -1;  }  public void skipWhitespace() throws IOException  {  while (hasNext())  {   char c = (char) buffer[pointer];   if (c == ' ' || c == '\t' || c == '\n' || c == '\r') pointer++;   else return;  }  }  public Integer nextInt() throws IOException  {  skipWhitespace();   if (!hasNext()) return null;   byte multiplier = 1;  int number = 0;   if (buffer[pointer] == '-')  {   multiplier = -1;   pointer++;  }   while (hasNext())  {   char c = (char) buffer[pointer];   if (c >= '0' && c <= '9')   {   number = (number << 3) + (number << 1) + c - '0';   pointer++;   } else break;  }   return number * multiplier;  }   public void close() throws IOException  {  in.close();  }   public boolean hasNext() throws IOException  {  while (pointer == loaded)  {   loaded = in.read(buffer);   pointer = 0;     if (loaded == -1) return false;  }  return loaded != -1;  } } }
1	public class TaskB {   public static int strIndex;  public static void main(String[] args) throws IOException {   Scanner scanner = new Scanner(System.in);   int n = scanner.nextInt();   char[] s = scanner.next().toCharArray();   int[][] r = new int[n][54];   Set<Character> chars = new HashSet<>();   for (int i= 0 ;i < n; ++ i)chars.add(s[i]);   List<Character> all = new ArrayList<>();   for (Character c: chars)all.add(c);   for (int i = n - 1; i >= 0; -- i){    for (int j = 0;j < 54; ++ j){     if (i == n - 1){      r[i][j] = -1;     }else {      r[i][j] = r[i + 1][j];     }    }    r[i][getCode(s[i])] = i;   }   int res = n;    for (int i =0; i < n; ++ i){    int mx = 1;    boolean fl = false;    for (Character c: all){     if (r[i][getCode(c)] == -1){      fl = true;      break;     }     mx = Math.max(mx, r[i][getCode(c)] - i + 1);    }    if (fl){     System.out.println(res);     return;    }    res = Math.min(res, mx);   }   System.out.println(res);   scanner.close();    }  public static int getCode(char a){   if (Character.isUpperCase(a))return a - 'A';   return (a - 'a') + 26;  }  public static int getLetter(int n){   if (n > 25)return (char)((n - 26) + 'a');   return (char)((n) + 'A');  }   static class IO{    BufferedReader reader;   StringTokenizer tokenizer;   PrintWriter writer;   public void init() {    try {     reader = new BufferedReader(new InputStreamReader(System.in),8*1024);     writer = new PrintWriter(System.out);    } catch (Exception e) {     e.printStackTrace();     System.exit(261);    }   }   void destroy() {    writer.close();    System.exit(0);   }   void print(Object... objects) {    for (int i = 0; i < objects.length; i++) {     if (i != 0)      writer.print(' ');     writer.print(objects[i]);    }   }   void println(Object... objects) {    print(objects);    writer.println();   }   String nextLine() throws IOException {    return reader.readLine();   }   String nextToken() throws IOException {    while (tokenizer == null || !tokenizer.hasMoreTokens())     tokenizer = new StringTokenizer(nextLine());    return tokenizer.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());   }  }  }
2	public class SolutionB {  BufferedReader in;  StringTokenizer str;  PrintWriter out;  String SK;  String next() throws IOException {  while ((str == null) || (!str.hasMoreTokens())) {   SK = in.readLine();   if (SK == null)    return null;   str = new StringTokenizer(SK);  }  return str.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());  }  char[] charArray() throws IOException{  return next().toCharArray();  }  public static void main(String[] args) throws IOException {  new SolutionB().run();  }  void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);      solve();  out.close();  }  void solve() throws IOException {    long n = nextLong();  long k = nextLong();  long m=num1(k);  if(m<n){   out.println(-1);   return;  }  if(m==n){   out.println(k-1);   return;  }  long ans=binS(n,k);  out.println(k-ans);  }  long num1(long k){  long r=k*(k+1)/2-1;  r=r-(k-2);  return r;  }  long num2(long k){  return num1(k)-1;  }  long binS(long n, long k) {  long start, end, mid;  start = 2;  end = k;  long ret=-1;  while (start <= end) {   mid = (start + end) / 2;   if (num1(k)-num2(mid) == n) {    return mid;   } else if (num1(k)-num2(mid) < n) {    end = mid - 1;   } else {    ret=mid;    start = mid + 1;   }  }  return ret;  } }
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));   }  }  } } }
4	public class Main implements Runnable {  public void _main() throws IOException {  int height = nextInt();  int width = nextInt();   int k = nextInt();  int[] r = new int[k];  int[] c = new int[k];  for (int i = 0; i < k; i++) {  r[i] = nextInt() - 1;  c[i] = nextInt() - 1;   }  int res = 0, R = r[0], C = c[0];  for (int i = 0; i < height; i++)  for (int j = 0; j < width; j++) {   int cur = Integer.MAX_VALUE;   for (int z = 0; z < k; z++)   cur = Math.min(cur, Math.abs(i - r[z]) + Math.abs(j - c[z]));   if (res < cur) {   res = cur;   R = i;   C = j;   }  }  out.print((R + 1) + " " + (C + 1)); }  private BufferedReader in; private PrintWriter out; private StringTokenizer st;  private String next() throws IOException {  while (st == null || !st.hasMoreTokens())  st = new StringTokenizer(in.readLine());  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);  in = new BufferedReader(new FileReader("input.txt"));  out = new PrintWriter(new FileWriter("output.txt"));   _main();   out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(202);  } } }
2	public class B {  public static void main (String[] argv) {   Scanner in = new Scanner(System.in);   long n = in.nextLong();   long k = in.nextLong();   long max = ((k*(k-1))/2L)+1L;   long ans = -1;   if (n == 1) {    System.out.println(0);    return;   }   if (max < n) {    ans = -1;   } else if (max == n) {    ans = k-1;   } else {    if (k >= n) {     ans = 1;    } else {     long low = 1;     long high = k-1;     while (high > low+1) {      long mid = (low+high)/2;      long sum = (((mid+(k-1)) * (k-mid)) / 2) + 1;      if (sum >= n) {       low = mid;      } else {       high = mid;      }     }     ans = (k - low);    }   }   System.out.println(ans);   return;  } }
2	public class acm {  public static BigInteger n;  public static BigInteger TWO = new BigInteger("2");  public static BigInteger solve(BigInteger x, BigInteger y, BigInteger c)  {   BigInteger res = (c.add(BigInteger.ONE)).multiply(c.add(BigInteger.ONE));   res = res.add(c.multiply(c));   BigInteger k;        k = c.subtract(x.subtract(BigInteger.ONE));   if(k.compareTo(BigInteger.ZERO) > 0)    res = res.subtract(k.multiply(k));      k = c.subtract(y.subtract(BigInteger.ONE));   if(k.compareTo(BigInteger.ZERO) > 0)    res = res.subtract(k.multiply(k));      k = c.subtract(n.subtract(x));   if(k.compareTo(BigInteger.ZERO) > 0)    res = res.subtract(k.multiply(k));      k = c.subtract(n.subtract(y));   if(k.compareTo(BigInteger.ZERO) > 0)    res = res.subtract(k.multiply(k));      k = c.subtract(x.add(y).subtract(BigInteger.ONE));   if(k.compareTo(BigInteger.ZERO) > 0)    res = res.add(k.multiply(k.add(BigInteger.ONE)).divide(TWO));      k = c.subtract(x.add(n).subtract(y));   if(k.compareTo(BigInteger.ZERO) > 0)    res = res.add(k.multiply(k.add(BigInteger.ONE)).divide(TWO));      k = c.subtract(y.add(n).subtract(x));   if(k.compareTo(BigInteger.ZERO) > 0)    res = res.add(k.multiply(k.add(BigInteger.ONE)).divide(TWO));      k = c.subtract(n.subtract(x).add(n.subtract(y)).add(BigInteger.ONE));   if(k.compareTo(BigInteger.ZERO) > 0)    res = res.add(k.multiply(k.add(BigInteger.ONE)).divide(TWO));    return res;  }   public static void main(String[] args)  {TWO = new BigInteger("2");   Scanner in = new Scanner(System.in);   n = new BigInteger(in.next());   BigInteger x = new BigInteger(in.next());   BigInteger y = new BigInteger(in.next());   BigInteger c = new BigInteger(in.next());      BigInteger left = new BigInteger("0");   BigInteger right = new BigInteger("1000000000000");   while(left.compareTo(right) < 0)   {    BigInteger val = left.add(right).divide(TWO);    if(solve(x, y, val).compareTo(c) >= 0)     right = val;    else     left = val.add(BigInteger.ONE);   }   System.out.println(left);  } }
1	public class Codeshefcode { final static long r = 1000000007 ; static FasterScanner ip = new FasterScanner() ; static PrintWriter op = new PrintWriter(System.out) ; public static void main(String[] args) throws IOException{  int n = ip.i() ;  TreeMap<Character,Integer> map = new TreeMap<Character,Integer>() ;  TreeSet<Character> set = new TreeSet<Character>() ;  char c[] = ip.S().toCharArray() ;  for(char t : c)   set.add(t) ;  int size = set.size() ;  for(int i=0 ; i<size ; i++)   map.put(set.pollFirst(),i) ;  int a[] = new int[n] ;  for(int i=0 ; i<n ; i++)   a[i]=map.get(c[i]) ;  int erl[][] = new int[size][n] ;  for(int i=0 ; i<size ; i++)   for(int j=n-1 ; j>=0 ; j--)   erl[i][j]=(a[j]==i) ? j : (j==n-1 ? -1 : erl[i][j+1]) ;  long min = Long.MAX_VALUE ;  for(int i=0 ; i<n ; i++){   long maxt = Long.MIN_VALUE ;   for(int j=0 ; j<size ; j++)    if(erl[j][i]!=-1)    maxt = Long.max(maxt,(erl[j][i]-i+1)) ;   else{    maxt = Long.MAX_VALUE ;    break ;   }   min = Long.min(min,maxt) ;    }  op.print(min) ;  Finish() ; } static void Finish(){  op.flush();   op.close();  } } @SuppressWarnings("serial") class MyList extends ArrayList<Long>{  } class pair { private int x ; private int y ; pair(int a,int b){  x=a ;  y=b ;  } public int x(){  return x ; } public int y(){  return y ; } } class FasterScanner {  private InputStream mIs;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  public FasterScanner() {   this(System.in);  }  public FasterScanner(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 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;  } }
5	public class Test {  public static void main(String[] args) throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   String[] line = reader.readLine().split(" ");   int w = Integer.valueOf(line[0]);   int h = Integer.valueOf(line[1]);   int n = Integer.valueOf(line[2]);   Request[] requests = new Request[n];   for (int i = 0; i < n; i++) {    line = reader.readLine().split(" ");    requests[i] = new Request(line[0], Integer.valueOf(line[1]));   }   for (long e : solve(h, w, requests))    System.out.println(e);      }  private static Request[] generate(int w, int h, int n) {   Request[] requests = new Request[n];   Random rnd = new Random();   for (int i = 0; i < n; i++) {    requests[i] = rnd.nextBoolean() ? new Request("V", rnd.nextInt(w)) : new Request("H", rnd.nextInt(h));   }   return requests;  }  private static long[] solve(int h, int w, Request[] requests) {   TreeSet<Integer> hTree = new TreeSet<>();   TreeSet<Integer> wTree = new TreeSet<>();   Queue<CoordinateWithSize> hHeap = new PriorityQueue<>();   Queue<CoordinateWithSize> wHeap = new PriorityQueue<>();   hTree.add(0);   hTree.add(h);   wTree.add(0);   wTree.add(w);   hHeap.add(new CoordinateWithSize(0, h));   wHeap.add(new CoordinateWithSize(0, w));   long[] res = new long[requests.length];   for (int i = 0; i < requests.length; i++) {    Request request = requests[i];    switch (request.type) {     case "H": {      if (!hTree.contains(request.coordinate)) {       int higher = hTree.higher(request.coordinate);       int lower = hTree.lower(request.coordinate);       hHeap.add(new CoordinateWithSize(lower, request.coordinate - lower));       hHeap.add(new CoordinateWithSize(request.coordinate, higher - request.coordinate));       hTree.add(request.coordinate);      }      break;     }     case "V": {      if (!wTree.contains(request.coordinate)) {       int higher = wTree.higher(request.coordinate);       int lower = wTree.lower(request.coordinate);       wHeap.add(new CoordinateWithSize(lower, request.coordinate - lower));       wHeap.add(new CoordinateWithSize(request.coordinate, higher - request.coordinate));       wTree.add(request.coordinate);      }      break;     }     default:      throw new IllegalStateException("Unknown type [type=" + request.type + "]");    }    while (true) {     CoordinateWithSize c = hHeap.peek();     if (hTree.higher(c.coordinate) - c.coordinate == c.size)      break;     hHeap.remove();    }    while (true) {     CoordinateWithSize c = wHeap.peek();     if (wTree.higher(c.coordinate) - c.coordinate == c.size)      break;     wHeap.remove();    }    res[i] = 1L * hHeap.peek().size * wHeap.peek().size;   }   return res;  }  private static class CoordinateWithSize implements Comparable<CoordinateWithSize> {   private final int coordinate;   private final int size;   public CoordinateWithSize(int coordinate, int size) {    this.coordinate = coordinate;    this.size = size;   }   @Override public int compareTo(CoordinateWithSize o) {    return Integer.compare(o.size, size);   }  }  private static class Request {   private final String type;   private final int coordinate;   public Request(String type, int coordinate) {    this.type = type;    this.coordinate = coordinate;   }  } }
6	public class E implements Runnable { FastReader scn; PrintWriter out; String INPUT = "";  void solve() {  int t = scn.nextInt();  while(t-- > 0) {  int n = scn.nextInt(), m = scn.nextInt();  int[][] arr = scn.next2DInt(n, m);    int[][] col = new int[m][2];  for(int j = 0; j < m; j++) {   int max = 0;   for(int i = 0; i < n; i++) {   max = Math.max(max, arr[i][j]);   }   col[j][0] = max;   col[j][1] = j;  }  Arrays.parallelSort(col, (o1, o2) -> o2[0] - o1[0]);    int take = Math.min(n, m);    int[][] lol = new int[n][take];  for(int j = 0; j < take; j++) {   for(int i = 0; i < n; i++) {   lol[i][j] = arr[i][col[j][1]];   }  }    ans = 0;  func(lol, 0);  out.println(ans);  } }  int ans = 0;  void func(int[][] arr, int col) {  int n = arr.length, m = arr[0].length;  if(col == m) {  int rv = 0;  for(int i = 0; i < n; i++) {   int mx = 0;   for(int j = 0; j < m; j++) {   mx = Math.max(mx, arr[i][j]);   }   rv += mx;   }  ans = Math.max(ans, rv);  return;  }   for(int rot = 0; rot < n; rot++) {  int f = arr[0][col];  for(int j = 1; j < n; j++) {   arr[j - 1][col] = arr[j][col];  }  arr[n - 1][col] = f;  func(arr, col + 1);  } }  public void run() {  long time = System.currentTimeMillis();  boolean oj = System.getProperty("ONLINE_JUDGE") != null;  out = new PrintWriter(System.out);  scn = new FastReader(oj);  solve();  out.flush();  if (!oj) {  System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));  } }  public static void main(String[] args) {  new Thread(null, new E(), "Main", 1 << 26).start(); }  class FastReader {  InputStream is;  public FastReader(boolean onlineJudge) {  is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());  }  byte[] inbuf = new byte[1024];  public int lenbuf = 0, ptrbuf = 0;  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++];  }  boolean isSpaceChar(int c) {  return !(c >= 33 && c <= 126);  }  int skip() {  int b;  while ((b = readByte()) != -1 && isSpaceChar(b))   ;  return b;  }  double nextDouble() {  return Double.parseDouble(next());  }  char nextChar() {  return (char) skip();  }  String next() {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(isSpaceChar(b))) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }  String nextLine() {  int b = skip();  StringBuilder sb = new StringBuilder();  while ((!isSpaceChar(b) || b == ' ')) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }  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);  }  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 * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }  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 * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }  char[][] nextMatrix(int n, int m) {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)   map[i] = next(m);  return map;  }  int[] nextIntArray(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = nextInt();  return a;  }  long[] nextLongArray(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  int[][] next2DInt(int n, int m) {  int[][] arr = new int[n][];  for (int i = 0; i < n; i++) {   arr[i] = nextIntArray(m);  }  return arr;  }  long[][] next2DLong(int n, int m) {  long[][] arr = new long[n][];  for (int i = 0; i < n; i++) {   arr[i] = nextLongArray(m);  }  return arr;  }  int[] shuffle(int[] arr) {  Random r = new Random();  for (int i = 1, j; i < arr.length; i++) {   j = r.nextInt(i);   int c = arr[i];   arr[i] = arr[j];   arr[j] = c;  }  return arr;  }  long[] shuffle(long[] arr) {  Random r = new Random();  for (int i = 1, j; i < arr.length; i++) {   j = r.nextInt(i);   long c = arr[i];   arr[i] = arr[j];   arr[j] = c;  }  return arr;  }  int[] uniq(int[] arr) {  arr = scn.shuffle(arr);  Arrays.sort(arr);  int[] rv = new int[arr.length];  int pos = 0;  rv[pos++] = arr[0];  for (int i = 1; i < arr.length; i++) {   if (arr[i] != arr[i - 1]) {   rv[pos++] = arr[i];   }  }  return Arrays.copyOf(rv, pos);  }  long[] uniq(long[] arr) {  arr = scn.shuffle(arr);  Arrays.sort(arr);  long[] rv = new long[arr.length];  int pos = 0;  rv[pos++] = arr[0];  for (int i = 1; i < arr.length; i++) {   if (arr[i] != arr[i - 1]) {   rv[pos++] = arr[i];   }  }  return Arrays.copyOf(rv, pos);  }  int[] reverse(int[] arr) {  int l = 0, r = arr.length - 1;  while (l < r) {   arr[l] = arr[l] ^ arr[r];   arr[r] = arr[l] ^ arr[r];   arr[l] = arr[l] ^ arr[r];   l++;   r--;  }  return arr;  }  long[] reverse(long[] arr) {  int l = 0, r = arr.length - 1;  while (l < r) {   arr[l] = arr[l] ^ arr[r];   arr[r] = arr[l] ^ arr[r];   arr[l] = arr[l] ^ arr[r];   l++;   r--;  }  return arr;  }  int[] compress(int[] arr) {  int n = arr.length;  int[] rv = Arrays.copyOf(arr, n);  rv = uniq(rv);  for (int i = 0; i < n; i++) {   arr[i] = Arrays.binarySearch(rv, arr[i]);  }  return arr;  }  long[] compress(long[] arr) {  int n = arr.length;  long[] rv = Arrays.copyOf(arr, n);  rv = uniq(rv);  for (int i = 0; i < n; i++) {   arr[i] = Arrays.binarySearch(rv, arr[i]);  }  return arr;  } } }
0	public class Subtract { public static void main(String[] args){  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int a,b;  String answer = "";  while(n!=0){  a = sc.nextInt();  b = sc.nextInt();  answer += solve(a,b) + "\n";  n--;  }  System.out.println(answer); }  public static int solve(int a, int b){  int count = 0;  int div;  int mod;  while(true){  if(a >= b){   div = a/b;   mod = a%b;   count += div;   if(mod==0){   return count;   }   else{   a = mod;   }  }  else{   div = b/a;   mod = b%a;   count += div;   if(mod==0){   return count;   }   else{   b = mod;   }  }  } } }
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; }  }
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();  } }
2	public class Example {  BufferedReader in;  PrintWriter out;  StringTokenizer st;  String next() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(in.readLine());    } catch (Exception e) {    }   }   return st.nextToken();  }  int nextInt() {   return Integer.parseInt(next());  }  long nextLong() {   return Long.parseLong(next());  }  double nextDouble() {   return Double.parseDouble(next());  }  public void run() throws Exception {        in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   solve();   out.flush();   out.close();   in.close();  }  long n, x, y, c;  boolean check(long z) {   long res = 1 + 2 * z * (z + 1);   long bx1 = z - x + 1;   long by1 = z - y + 1;   long bxn = z - n + x;   long byn = z - n + y;   if (bx1 > 0) {    res -= bx1 * bx1;   }   if (bxn > 0) {    res -= bxn * bxn;   }   if (by1 > 0) {    res -= by1 * by1;   }   if (byn > 0) {    res -= byn * byn;   }   if (z > x + y - 1) {    long m = z - x - y + 1;    res += m * (m + 1) / 2;   }   if (z > x + n - y) {    long m = z - x - n + y;    res += m * (m + 1) / 2;   }   if (z > n - x + y) {    long m = z - n - y + x;    res += m * (m + 1) / 2;   }   if (z > n - x + n - y + 1) {    long m = z - 2 * n + x + y - 1;    res += m * (m + 1) / 2;   }     return res >= c;  }  public void solve() throws Exception {   n = nextLong();   x = nextLong();   y = nextLong();   c = nextLong();   long l = 0;   long r = 2 * n;   while (r > l) {    long mid = (r + l) / 2;    if (check(mid)) {     r = mid;    } else {     l = mid + 1;    }   }   out.println(r);  }  public static void main(String[] args) throws Exception {   new Example().run();  } }
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();  }     }
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);   TaskF solver = new TaskF();   solver.solve(1, in, out);   out.close();  }  static class TaskF {   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(); }    Map<Integer, List<Range>> rgs = new HashMap<Integer, List<Range>>();    for (int i = 0; i < n; i++) {     int s = 0;     for (int j = i; j < n; j++) {      s += a[j];      if (rgs.get(s) == null) { rgs.put(s, new ArrayList<Range>()); }      rgs.get(s).add(new Range(i, j));     }    }    Iterator it = rgs.entrySet().iterator();    List<Range> ans = new ArrayList<Range>();    while (it.hasNext()) {     Map.Entry pair = (Map.Entry) it.next();     int sum = (int) pair.getKey();     List<Range> ranges = rgs.get(sum);     List<Range> cand = new ArrayList<Range>();     for (Range r : ranges) {      if (cand.size() == 0) {       cand.add(r);       continue;      }      if (cand.get(cand.size() - 1).j < r.i) {       cand.add(r);      } else {       if (cand.get(cand.size() - 1).j > r.j) {        cand.remove(cand.size() - 1);        cand.add(r);       }      }     }     if (cand.size() > ans.size()) {      ans = cand;     }    }    out.println(ans.size());    for (Range r : ans) {     out.println((r.i + 1) + " " + (r.j + 1));    }   }   public class Range implements Comparable {    public int i;    public int j;    public Range(int i, int j) {     this.i = i;     this.j = j;    }    public int compareTo(Object o) {     Range t = (Range) o;     if (this.i == t.i) {      if (this.j < t.j) return 1;      else return 0;     }     if (this.i < t.i) return 1;     return 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 int nextInt() {    return Integer.parseInt(next());   }  } }
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);    }   }  } }
6	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);   E2VrashayaStolbciUslozhnennayaVersiya solver = new E2VrashayaStolbciUslozhnennayaVersiya();   solver.solve(1, in, out);   out.close();  }  static class E2VrashayaStolbciUslozhnennayaVersiya {   public void solve(int testNumber, Scanner in, PrintWriter out) {    int tn = in.nextInt();    for (int t = 0; t < tn; t++) {     int n = in.nextInt();     int m = in.nextInt();     Col[] a = new Col[m];     for (int i = 0; i < m; i++) {      a[i] = new Col(n);     }     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       a[j].a[i] = in.nextInt();       if (a[j].a[i] > a[j].max) {        a[j].max = a[j].a[i];       }      }     }     Arrays.sort(a, (o1, o2) -> o2.max - o1.max);     if (m > n) {      m = n;     }     for (int i = 0; i < m; i++) {      a[i].calcMask();     }     int[][] dp = new int[m + 1][1 << n];     Arrays.fill(dp[0], -1);     dp[0][0] = 0;     for (int i = 0; i < m; i++) {      for (int msk = 0; msk < (1 << n); msk++) {       dp[i + 1][msk] = dp[i][msk];       for (int sub = msk; sub > 0; sub = (sub - 1) & msk) {        int v = dp[i][msk ^ sub] + a[i].mask[sub];        if (v > dp[i + 1][msk]) {         dp[i + 1][msk] = v;        }       }      }     }     out.println(dp[m][(1 << n) - 1]);    }   }   class Col {    int n;    int[] a;    int[] mask;    int max;    public Col(int n) {     this.n = n;     a = new int[n];    }    void calcMask() {     mask = new int[1 << n];     for (int i = 0; i < (1 << n); i++) {      for (int j = 0; j < n; j++) {       int sum = 0;       for (int k = 0; k < n; k++) {        if (((1 << k) & i) != 0) {         sum += a[(j + k) % n];        }       }       if (sum > mask[i]) {        mask[i] = sum;       }      }     }    }   }  } }
2	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader sc = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   Task solver = new Task();   solver.solve(1, sc, out);   out.close();  }  static class Task {   public void solve(int testNumber, InputReader sc, PrintWriter out) {    double n=sc.nextInt();    double k=sc.nextInt();       double ans=n-(-1.5+Math.sqrt(9.0/4+2*(n+k)));    out.printf("%.0f\n",ans);   }  }  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());   }  } }
4	public class C {  public static void main(String[] args) throws FileNotFoundException {   Scanner in = new Scanner(new FileReader(new File("input.txt")));   PrintWriter out = new PrintWriter(new File("output.txt"));   int n = in.nextInt();   int m = in.nextInt();   int[][] T = new int[n][m];   int k = in.nextInt();   int[] X = new int[k];   int[] Y = new int[k];   for (int i = 0; i < k; i++) {    X[i] = in.nextInt() - 1;    Y[i] = in.nextInt() - 1;   }   int max = 0;   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++) {     int min = Integer.MAX_VALUE;     for (int ii = 0; ii < k; ii++)      min = Math.min(min,        Math.abs(i - X[ii]) + Math.abs(j - Y[ii]));     max = Math.max(max, T[i][j] = min);    }   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     if (T[i][j] == max) {      out.println((i + 1) + " " + (j + 1));      out.flush();      return;     }  } }
5	public class Median_Segments_general {  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  int n = s.nextInt();  int m = s.nextInt();  int[] arr = new int[n];  for (int i = 0; i < n; i++) {  arr[i] = s.nextInt();  }  System.out.println(func(n, m, arr)-func(n, m+1, arr)); } public static long func(int n,int m,int[] arr) {  HashMap<Long, Integer> map = new HashMap<>();  map.put((long) 0, 1);  long sum = 0;  long res = 0;  long add=0;  for(int i=0;i<n;i++) {  if(arr[i]<m) {   sum--;   if(map.containsKey(sum)) {   add-=map.get(sum);   }  }  else {   if(map.containsKey(sum)) {   add+=map.get(sum);   }   sum++;  }  res+=add;  if(map.containsKey(sum)) {   map.put(sum, map.get(sum)+1);  }  else {   map.put(sum,1);  }  }  return res; } }
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(); } }
5	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();   long[] arr = new long[n];   for (int i = 0; i < n; i++) {           arr[i] = in.nextLong();   }   long sum = 0;   long count = 0;     TreeSet<Long> ts = new TreeSet<>();   ts.add(1L);   long oo = 1000000000 + 100;   ts.add(oo);   for (long a : arr) {    a += 10;    ts.add(a);    ts.add(a - 2);    ts.add(a + 2);   }     long[] inds = new long[ts.size()];   int idx = 0;   for (long a : ts) {    inds[idx++] = a;   }     SuperBIT bit1 = new SuperBIT(inds);   SuperBIT bit2 = new SuperBIT(inds);   BigInteger ans = BigInteger.valueOf(0);     for (long a : arr) {    a += 10;       long countLess = bit1.queryCompr(1, a - 2);    long sumLess = bit2.queryCompr(1, a - 2);       long countMore = bit1.queryCompr(a + 2, oo);    long sumMore = bit2.queryCompr(a + 2, oo);           bit1.updateCompr(a, 1);    bit2.updateCompr(a, a);       long tmp = 0;    tmp += countLess * a - sumLess;    tmp -= sumMore - countMore * a;    ans = ans.add(BigInteger.valueOf(tmp));   }     out.println(ans);        out.close();  } static class SuperBIT { long[] dataMul, dataAdd; SuperBIT(int n) {  dataMul = new long[n];  dataAdd = new long[n]; } void update(int left, int right, long val) {  internalUpdate(left, val, -val * (left-1));  internalUpdate(right, -val, val * right); } void internalUpdate(int at, long mul, long add) {  while (at < dataMul.length) {  dataMul[at] += mul;  dataAdd[at] += add;  at |= (at + 1);  } } long query(int at) {  long mul = 0;  long add = 0;  int start = at;  while(at >= 0) {  mul += dataMul[at];  add += dataAdd[at];  at = (at & (at + 1)) -1;  }  return mul * start + add; } long query(int left, int right) {  if (left > right) {  int temp = left;  left = right;  right = temp;  }  return query(right) - (left > 0 ? query(left-1) : 0); } long[] indices;      public SuperBIT(long[] indices) {  this.indices = indices;  dataMul = new long[indices.length];  dataAdd = new long[indices.length]; }    int binSearch(long ind) {  int low = 0;  int high = dataMul.length-1;  while(low < high) {  int mid = (low + high+1)/2;  if(indices[mid] == ind)   return mid;  else if(indices[mid] < ind)   low = mid;  else if(indices[mid] > ind)   high = mid-1;  }  if(indices[low] > ind)  --low;  return low; }   long queryCompr(long index) {  return query(binSearch(index)); } long queryCompr(long left, long right) {  return query(binSearch(left), binSearch(right)); }   void updateCompr(long index, long val) {  int ind = binSearch(index);  update(ind, ind, val); } void updateCompr(long left, long right, long val) {  update(binSearch(left), binSearch(right), val); } }  static Random rand = new Random();  static void sort(int[] a) {   int n = a.length;   for (int i = a.length - 1; i > 0; i--) {    int j = rand.nextInt(i + 1);    int tmp = a[i];    a[i] = a[j];    a[j] = tmp;   }   Arrays.sort(a);  }  static void sort(long[] a) {   int n = a.length;   for (int i = a.length - 1; i > 0; i--) {    int j = rand.nextInt(i + 1);    long tmp = a[i];    a[i] = a[j];    a[j] = tmp;   }   Arrays.sort(a);  }  static void sort(double[] a) {   int n = a.length;   for (int i = a.length - 1; i > 0; i--) {    int j = rand.nextInt(i + 1);    double tmp = a[i];    a[i] = a[j];    a[j] = tmp;   }   Arrays.sort(a);  }  static long gcd(long a, long b) { return b == 0 ? a : gcd(b, a % b); }  static long lcm(long a, long b) { return a / gcd(a, b) * b; }  static long[] eEuclid(long a, long b) {   if (b == 0) return new long[] { a, 1, 0 };   long[] ans = eEuclid(b, a % b);   long temp = ans[1] - ans[2] * (a / b);   ans[1] = ans[2]; ans[2] = temp;   return ans;  }  static long modInverse(long a, long m) {   return ((eEuclid(a, m)[1] % m) + m) % m;  }  static class IntList {   static int[] EMPTY = {};   int[] a = EMPTY;   int n = 0;   void add(int v) {    if (n >= a.length)     a = Arrays.copyOf(a, (n << 2) + 8);    a[n++] = v;   }   int get(int idx) {    return a[idx];   }   int size() {    return n;   }  }  static class DisjointSet {   int[] s, r;  public DisjointSet(int n) {    s = new int[n]; r = new int[n];    for (int i = 0; i < n; i++) s[i] = i;   }   public int find(int i) { return s[i] == i ? i : (s[i] = find(s[i])); } public void union(int a, int b) {    if(r[a = find(a)] == r[b = find(b)]) r[a]++;    if(r[a] >= r[b]) s[b] = a; else s[a] = b;   }  }  static class FastScanner {   BufferedReader br;   StringTokenizer st;   public FastScanner(InputStream i) {    br = new BufferedReader(new InputStreamReader(i));    st = new StringTokenizer("");   }   public String next() throws IOException {    if(st.hasMoreTokens())     return st.nextToken();    else     st = new StringTokenizer(br.readLine());    return next();   }   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[] nextOffsetIntArray(int n) throws IOException {    int[] arr = new int[n];    for (int i = 0; i < n; i++)     arr[i] = nextInt() - 1;    return arr;   }   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 int[][] nextIntArray(int n, int m) throws IOException {    int[][] arr = new int[n][m];    for (int i = 0; i < n; i++)     for (int j = 0; j < m; j++)      arr[i][j] = 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 long[][] nextLongArray(int n, int m) throws IOException {    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;   }   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 double[][] nextDoubleArray(int n, int m) throws IOException {    double[][] arr = new double[n][m];    for (int i = 0; i < n; i++)     for (int j = 0; j < m; j++)      arr[i][j] = nextDouble();    return arr;   }   public char[][] nextCharArray(int n, int m) throws IOException {    char[][] arr = new char[n][];    for (int i = 0; i < n; i++)     arr[i] = next().toCharArray();    return arr;   }  } }
4	public class D_CF {  public static void main(String[] args) {   FastScanner58 fs = new FastScanner58();   PrintWriter pw = new PrintWriter(System.out);     int t = 1;     for (int tc = 0; tc < t; tc++) {    int n = fs.ni();    int m = fs.ni();    int k = fs.ni();    int[][] a = new int[n][m - 1];    int[][] b = new int[n - 1][m];    for (int i = 0; i < n; i++) {     a[i] = fs.intArray(m - 1);    }    for (int i = 0; i < n - 1; i++) {     b[i] = fs.intArray(m);    }    int[][] res = new int[n][m];    Integer[][][] dp = new Integer[n][m][k / 2 + 1];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      res[i][j] = recur(i, j, k / 2, dp, a, b) * 2;     }    }    StringBuilder sb = new StringBuilder();    for (int i = 0; i < res.length; i++) {     for (int j = 0; j < m; j++) {           if (k%2==1) {       sb.append(-1 + " ");      } else {       sb.append(res[i][j] + " ");      }     }     sb.append("\n");    }    pw.println(sb);   }   pw.close();  }  public static int recur(int i, int j, int k, Integer[][][] dp, int[][] a, int[][] b) {   if (k == 0) {    return 0;   }   int n = (int) (1e9);   if (dp[i][j][k] != null) {    return dp[i][j][k];   }   if (i != 0) {    n = Math.min(n, recur(i - 1, j, k - 1, dp, a, b) + b[i - 1][j]);   }   if (j != 0) {    n = Math.min(n, recur(i, j - 1, k - 1, dp, a, b) + a[i][j - 1]);   }   if (i != a.length - 1) {    n = Math.min(n, recur(i + 1, j, k - 1, dp, a, b) + b[i][j]);   }   if (j != b[0].length - 1) {    n = Math.min(n, recur(i, j + 1, k - 1, dp, a, b) + a[i][j]);   }   return dp[i][j][k] = n;  } } class FastScanner58 {  BufferedReader br;  StringTokenizer st;  public FastScanner58() {   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 UnionFind17 {  int[] id;  public UnionFind17(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;  } }
2	public class Main {    public static void main(String[] args) throws IOException {   InputStreamReader r = new InputStreamReader(System.in);   BufferedReader f = new BufferedReader(r);   Scanner sc = new Scanner(System.in);   long n=sc.nextLong();   long m=sc.nextLong();   long sum=0;   if(n==1){   }else {    for (long i = 1; i <= n; i++) {     sum += i;     if (sum - (n - i) == m) {      sum = n - i;      break;     }    }   }   System.out.println(sum);   } }
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));  } }
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 A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   System.out.println("0 0 " + n);  } }
4	public class prob1 { public static void main(String[] args) {  Scanner input = new Scanner(System.in);  String s = input.next();  int n = s.length();  int i = n-1;  CharSequence temp;  for(i = n-1; i > 0; i--)  for(int j = 0 ; j <= n-i; j++)  {   temp = s.subSequence(j, i+j);   if( s.substring(j+1, n).contains(temp) || s.substring(0, j+i-1).contains(temp))   {   System.out.println(i);   return;   }  }  System.out.println(0); } }
0	public class Fibonacci { public static void main(String[] args) {  Scanner input = new Scanner(System.in);  long num =0;  num = input.nextLong();  while (num<0 || num>Math.pow(10,9))  {  System.out.println("Invalid");  num = input.nextLong();  }  System.out.println("0 0 "+num); } }
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");   }  }    } }
4	public class Main {   public static void main(String[] args) throws IOException {  StreamTokenizer in = new StreamTokenizer(new BufferedReader(   new InputStreamReader(System.in)));   in.nextToken();  String s = in.sval;  int l = s.length();  int n = l - 1;  String st, sub;  while (n > 0) {  for (int i = 0; i < l - n; ++i) {   st = s.substring(i, n + i);   sub = s.substring(i + 1);   if (sub.indexOf(st) != -1) {   System.out.println(n);   System.exit(0);   }  }  n--;  }  System.out.println(0); } }
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");  } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.readInt();    char[] str = IOUtils.readCharArray(in, n);    for (int i = 0; i < n; i++) {     if (str[i] <= 'Z') {      str[i] = (char) (str[i] - 'A');     } else {      str[i] = (char) (str[i] - 'a' + 26);     }    }    IntHashSet set = new IntHashSet();    for (char c : str) {     set.add(c);    }    int max = 26 + 26;    int[][] next = new int[max][n];    ArrayUtils.fill(next, -1);    for (int i = n - 2; i >= 0; i--) {     for (int ch = 0; ch < max; ch++) {      next[ch][i] = next[ch][i + 1];     }     next[str[i + 1]][i] = i + 1;    }    int ans = (int) 1e9;    final int tagetCnt = set.size();    for (int s = 0; s < n; s++) {     boolean[] used = new boolean[max];     used[str[s]] = true;     int cnt = 1;     int pos = s;     while (cnt < tagetCnt) {      int nextPos = n;      for (int ch = 0; ch < max; ch++) {       if (!used[ch]) {        if (next[ch][pos] == -1) {         continue;        }        nextPos = Math.min(nextPos, next[ch][pos]);       }      }      pos = nextPos;      if (nextPos == n) {       break;      }      ++cnt;      used[str[nextPos]] = true;     }     if (pos == n) {      break;     }     ans = Math.min(ans, pos - s + 1);    }    out.printLine(ans);   }  }  static interface IntCollection extends IntStream {   public int size();   default public void add(int value) {    throw new UnsupportedOperationException();   }   default public IntCollection addAll(IntStream values) {    for (IntIterator it = values.intIterator(); it.isValid(); it.advance()) {     add(it.value());    }    return this;   }  }  static interface IntStream extends Iterable<Integer>, Comparable<IntStream> {   public IntIterator intIterator();   default public Iterator<Integer> iterator() {    return new Iterator<Integer>() {     private IntIterator it = intIterator();     public boolean hasNext() {      return it.isValid();     }     public Integer next() {      int result = it.value();      it.advance();      return result;     }    };   }   default public int compareTo(IntStream c) {    IntIterator it = intIterator();    IntIterator jt = c.intIterator();    while (it.isValid() && jt.isValid()) {     int i = it.value();     int j = jt.value();     if (i < j) {      return -1;     } else if (i > j) {      return 1;     }     it.advance();     jt.advance();    }    if (it.isValid()) {     return 1;    }    if (jt.isValid()) {     return -1;    }    return 0;   }  }  static class IntHashSet extends IntAbstractStream implements IntSet {   private static final Random RND = new Random();   private static final int[] SHIFTS = new int[4];   private static final byte PRESENT_MASK = 1;   private static final byte REMOVED_MASK = 2;   private int size;   private int realSize;   private int[] values;   private byte[] present;   private int step;   private int ratio;   static {    for (int i = 0; i < 4; i++) {     SHIFTS[i] = RND.nextInt(31) + 1;    }   }   public IntHashSet() {    this(3);   }   public IntHashSet(int capacity) {    capacity = Math.max(capacity, 3);    values = new int[capacity];    present = new byte[capacity];    ratio = 2;    initStep(capacity);   }   public IntHashSet(IntCollection c) {    this(c.size());    addAll(c);   }   public IntHashSet(int[] arr) {    this(new IntArray(arr));   }   private void initStep(int capacity) {    step = RND.nextInt(capacity - 2) + 1;    while (IntegerUtils.gcd(step, capacity) != 1) {     step++;    }   }    public IntIterator intIterator() {    return new IntIterator() {     private int position = size == 0 ? values.length : -1;     public int value() throws NoSuchElementException {      if (position == -1) {       advance();      }      if (position >= values.length) {       throw new NoSuchElementException();      }      if ((present[position] & PRESENT_MASK) == 0) {       throw new IllegalStateException();      }      return values[position];     }     public boolean advance() throws NoSuchElementException {      if (position >= values.length) {       throw new NoSuchElementException();      }      position++;      while (position < values.length && (present[position] & PRESENT_MASK) == 0) {       position++;      }      return isValid();     }     public boolean isValid() {      return position < values.length;     }     public void remove() {      if ((present[position] & PRESENT_MASK) == 0) {       throw new IllegalStateException();      }      present[position] = REMOVED_MASK;     }    };   }    public int size() {    return size;   }    public void add(int value) {    ensureCapacity((realSize + 1) * ratio + 2);    int current = getHash(value);    while (present[current] != 0) {     if ((present[current] & PRESENT_MASK) != 0 && values[current] == value) {      return;     }     current += step;     if (current >= values.length) {      current -= values.length;     }    }    while ((present[current] & PRESENT_MASK) != 0) {     current += step;     if (current >= values.length) {      current -= values.length;     }    }    if (present[current] == 0) {     realSize++;    }    present[current] = PRESENT_MASK;    values[current] = value;    size++;   }   private int getHash(int value) {    int hash = IntHash.hash(value);    int result = hash;    for (int i : SHIFTS) {     result ^= hash >> i;    }    result %= values.length;    if (result < 0) {     result += values.length;    }    return result;   }   private void ensureCapacity(int capacity) {    if (values.length < capacity) {     capacity = Math.max(capacity * 2, values.length);     rebuild(capacity);    }   }   private void rebuild(int capacity) {    initStep(capacity);    int[] oldValues = values;    byte[] oldPresent = present;    values = new int[capacity];    present = new byte[capacity];    size = 0;    realSize = 0;    for (int i = 0; i < oldValues.length; i++) {     if ((oldPresent[i] & PRESENT_MASK) == PRESENT_MASK) {      add(oldValues[i]);     }    }   }  }  static interface IntList extends IntReversableCollection {   public abstract int get(int index);   public abstract void addAt(int index, int value);   public abstract void removeAt(int index);   default public IntIterator intIterator() {    return new IntIterator() {     private int at;     private boolean removed;     public int value() {      if (removed) {       throw new IllegalStateException();      }      return get(at);     }     public boolean advance() {      at++;      removed = false;      return isValid();     }     public boolean isValid() {      return !removed && at < size();     }     public void remove() {      removeAt(at);      at--;      removed = true;     }    };   }    default public void add(int value) {    addAt(size(), value);   }  }  static class IntegerUtils {   public static int gcd(int a, int b) {    a = Math.abs(a);    b = Math.abs(b);    while (b != 0) {     int temp = a % b;     a = b;     b = temp;    }    return a;   }  }  static abstract class IntAbstractStream implements IntStream {   public String toString() {    StringBuilder builder = new StringBuilder();    boolean first = true;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     if (first) {      first = false;     } else {      builder.append(' ');     }     builder.append(it.value());    }    return builder.toString();   }    public boolean equals(Object o) {    if (!(o instanceof IntStream)) {     return false;    }    IntStream c = (IntStream) o;    IntIterator it = intIterator();    IntIterator jt = c.intIterator();    while (it.isValid() && jt.isValid()) {     if (it.value() != jt.value()) {      return false;     }     it.advance();     jt.advance();    }    return !it.isValid() && !jt.isValid();   }    public int hashCode() {    int result = 0;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     result *= 31;     result += it.value();    }    return result;   }  }  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 char readCharacter() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    return (char) c;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  static class IntHash {   private IntHash() {   }   public static int hash(int c) {    return c;   }  }  static interface IntReversableCollection extends IntCollection {  }  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 close() {    writer.close();   }   public void printLine(int i) {    writer.println(i);   }  }  static class IntArray extends IntAbstractStream implements IntList {   private int[] data;   public IntArray(int[] arr) {    data = arr;   }   public int size() {    return data.length;   }   public int get(int at) {    return data[at];   }   public void addAt(int index, int value) {    throw new UnsupportedOperationException();   }   public void removeAt(int index) {    throw new UnsupportedOperationException();   }  }  static interface IntSet extends IntCollection {  }  static class IOUtils {   public static char[] readCharArray(InputReader in, int size) {    char[] array = new char[size];    for (int i = 0; i < size; i++) {     array[i] = in.readCharacter();    }    return array;   }  }  static interface IntIterator {   public int value() throws NoSuchElementException;   public boolean advance();   public boolean isValid();  }  static class ArrayUtils {   public static void fill(int[][] array, int value) {    for (int[] row : array) {     Arrays.fill(row, value);    }   }  } }
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));    }   }      }  }
4	public class Prob023A {  public static void main( String[] Args )  {   Scanner scan = new Scanner( System.in );   String s = scan.next();   all: for ( int x = s.length() - 1; x >= 0; x-- )    for ( int y = 0; x + y <= s.length(); y++ )    {     String sub = s.substring( y, y + x );     if ( s.indexOf( sub, y + 1 ) >= 0 )     {      System.out.println( x );      break all;     }    }  } }
4	public class Solution implements Runnable {  Scanner input; PrintWriter output;  private void solve() throws Exception {  int n = nextInt();  int m = nextInt();  int k = nextInt();  int[] r = new int[k];  int[] c = new int[k];  for (int i = 0; i < k; i++)  {  r[i] = nextInt();  c[i] = nextInt();  }  int best = -1;  int bestr = -1;  int bestc = -1;  for (int i = 1; i <= n; i++)  {  for (int j = 1; j <= m; j++)  {   int d = n + m;   for (int q = 0; q < k; q++)   {   d = Math.min(d, Math.abs(i - r[q]) + Math.abs(j - c[q]));   }   if (d < best) continue;   best = d;   bestr = i;   bestc = j;  }  }  out(bestr + " " + bestc); }  private int nextInt() throws Exception {  return input.nextInt(); }  private void out(String s) {  output.println(s); }  public void run() {  try {  solve();  } catch (Exception ex) {  throw new RuntimeException(ex);  } finally {  output.close();  } }  public Solution() throws IOException {  input = new Scanner(new FileReader("input.txt"));  output = new PrintWriter("output.txt"); }  public static void main(String[] args) throws IOException {  Locale.setDefault(Locale.US);  new Thread(new Solution()).start(); } }
3	public class codeforces implements Runnable {   final static long mod = (long)1e9 + 7;  public void run() {   InputReader s = new InputReader(System.in);  PrintWriter w = new PrintWriter(System.out);   int n = s.nextInt();   char[] c = new char[n];   for(int i = 0; i < n; i++)  c[i] = s.next().charAt(0);     long[][] dp = new long[n][n];  dp[0][0] = 1;   for(int i = 0; i < n - 1; i++) {      if(c[i] == 'f') {     for(int j = 1; j < n; j++)   dp[i + 1][j] = dp[i][j - 1];  }      else {     dp[i + 1][n - 1] = dp[i][n - 1];      for(int j = n - 2; j >= 0; j--)   dp[i + 1][j] = (dp[i + 1][j + 1] + dp[i][j]) % mod;  }  }   long res = 0;   for(int i = 0; i < n; i++)  res = (res + dp[n - 1][i]) % mod;   w.println(res);   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 codeforces(),"codeforces",1<<26).start(); }   }
4	public class A {  static final int[] dx = {0, 0, -1, 1}; static final int[] dy = {-1, 1, 0, 0};  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner("input.txt");  PrintWriter out = new PrintWriter(new FileWriter("output.txt"));   int N = sc.nextInt(), M = sc.nextInt();  int[][] dist = new int[N][M];  Queue<Integer> q = new LinkedList<>();  int K = sc.nextInt();  while(K-->0)  {  int x = sc.nextInt() - 1, y = sc.nextInt() - 1;  q.add(x * M + y);  dist[x][y] = 1;  }   int max = 0, ansX = -1, ansY = -1;  while(!q.isEmpty())  {  int u = q.remove(), x = u / M, y = u % M;  if(dist[x][y] > max)   max = dist[ansX = x][ansY = y];  for(int k = 0; k < 4; ++k)  {   int nx = x + dx[k], ny = y + dy[k];   if(nx >= 0 && ny >= 0 && nx < N && ny < M && dist[nx][ny] == 0)   {   dist[nx][ny] = dist[x][y] + 1;   q.add(nx * M + ny);   }     }  }  out.printf("%d %d\n", ansX + 1, ansY + 1);  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();}  } }
1	public class A {  int n;  int[] arr;   void run(){   Scanner s = new Scanner(System.in);   n = s.nextInt();   arr = new int[n];   int even, odd;   even = 0;   odd = 0;   for (int i = 0; i < n; i++) {    arr[i] = s.nextInt();    if(arr[i]%2==0)even++;    else odd++;   }   if(even>odd){          for (int i = 0; i < n; i++) {     if(arr[i]%2==1){      System.out.println(i+1);      System.exit(0);     }    }   }     else{    for (int i = 0; i < n; i++) {     if(arr[i]%2==0){      System.out.println(i+1);      System.exit(0);     }    }   }       }  public static void main(String[] args) {   new A().run();  } }
3	public class B implements Runnable { FastReader scn; PrintWriter out; String INPUT = "";  void solve() {  int n = scn.nextInt();  int[] arr = scn.nextIntArray(n);  int[][] a = new int[n * (n + 1) / 2][];  int[] need = new int[a.length];  int pos = 0;  for (int l = 0; l < n; l++) {  int sum = 0;  for (int r = l; r < n; r++) {   sum += arr[r];   a[pos] = new int[] { l, r, sum };   need[pos++] = sum;  }  }  need = scn.uniq(need);  int[][][] list = new int[need.length][][];  int[] size = new int[list.length];  for (int i = 0; i < pos; i++) {  size[Arrays.binarySearch(need, a[i][2])]++;  }  for (int i = 0; i < list.length; i++) {  list[i] = new int[size[i]][];  }  for (int i = 0; i < pos; i++) {  int ind = Arrays.binarySearch(need, a[i][2]);  list[ind][--size[ind]] = new int[] { a[i][0], a[i][1] };  }  int ind = -1, max = 0;  for (int i = 0; i < list.length; i++) {  if(list[i].length == 0) {   continue;  }  Arrays.sort(list[i], (o1, o2) -> o1[1] - o2[1]);   int count = 1, last = list[i][0][1];  for(int j = 1; j < list[i].length; j++) {   if(list[i][j][0] > last) {   count++;   last = list[i][j][1];   }  }    if (count > max) {   max = count;   ind = i;  }  }   out.println(max);  int last = list[ind][0][1];  out.println((list[ind][0][0] + 1) + " " + (list[ind][0][1] + 1));   for(int i = 1; i < list[ind].length; i++) {  if(list[ind][i][0] > last) {   out.println((list[ind][i][0] + 1) + " " + (list[ind][i][1] + 1));   last = list[ind][i][1];  }  } }  public void run() {  long time = System.currentTimeMillis();  boolean oj = System.getProperty("ONLINE_JUDGE") != null;  out = new PrintWriter(System.out);  scn = new FastReader(oj);  solve();  out.flush();  if (!oj) {  System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));  } }  public static void main(String[] args) {  new Thread(null, new B(), "Main", 1 << 26).start(); }  class FastReader {  InputStream is;  public FastReader(boolean onlineJudge) {  is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());  }  byte[] inbuf = new byte[1024];  public int lenbuf = 0, ptrbuf = 0;  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++];  }  boolean isSpaceChar(int c) {  return !(c >= 33 && c <= 126);  }  int skip() {  int b;  while ((b = readByte()) != -1 && isSpaceChar(b))   ;  return b;  }  double nextDouble() {  return Double.parseDouble(next());  }  char nextChar() {  return (char) skip();  }  String next() {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(isSpaceChar(b))) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }  String nextLine() {  int b = skip();  StringBuilder sb = new StringBuilder();  while ((!isSpaceChar(b) || b == ' ')) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }  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);  }  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 * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }  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 * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }  char[][] nextMatrix(int n, int m) {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)   map[i] = next(m);  return map;  }  int[] nextIntArray(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = nextInt();  return a;  }  long[] nextLongArray(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  int[][] next2DInt(int n, int m) {  int[][] arr = new int[n][];  for (int i = 0; i < n; i++) {   arr[i] = nextIntArray(m);  }  return arr;  }  long[][] next2DLong(int n, int m) {  long[][] arr = new long[n][];  for (int i = 0; i < n; i++) {   arr[i] = nextLongArray(m);  }  return arr;  }  int[] shuffle(int[] arr) {  Random r = new Random();  for (int i = 1, j; i < arr.length; i++) {   j = r.nextInt(i);   arr[i] = arr[i] ^ arr[j];   arr[j] = arr[i] ^ arr[j];   arr[i] = arr[i] ^ arr[j];  }  return arr;  }  int[] uniq(int[] arr) {  Arrays.sort(arr);  int[] rv = new int[arr.length];  int pos = 0;  rv[pos++] = arr[0];  for (int i = 1; i < arr.length; i++) {   if (arr[i] != arr[i - 1]) {   rv[pos++] = arr[i];   }  }  return Arrays.copyOf(rv, pos);  }  int[] reverse(int[] arr) {  int l = 0, r = arr.length - 1;  while (l < r) {   arr[l] = arr[l] ^ arr[r];   arr[r] = arr[l] ^ arr[r];   arr[l] = arr[l] ^ arr[r];   l++;   r--;  }  return arr;  }  } }
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 C {  static int[] arr ; static int L ;  public static void rotate()  {   int tmp = arr[0] ;   for (int i = 1 ; i < L ; i ++)    arr[i-1] = arr[i] ;   arr[L-1] = tmp ;  }  public static void main(String[] args)  {   Scanner input = new Scanner(System.in) ;   L = input.nextInt() ; String s = input.next() ;   arr = new int[L]; for (int i = 0 ; i < L ; i ++) {arr[i] = s.charAt(i) == 'H' ? 1 : 0 ;}        int count = 99999 ;   for (int A = 0; A < L ; A ++)   {    int[] tmp = new int[L] ; System.arraycopy(arr, 0, tmp, 0, arr.length);    int ans = 0 ;    for (int i = 0 ; i < L ; i ++)    {     if (tmp[i] == 1) continue ;     for (int j = L-1 ; j > i ; j --)     {      if (tmp[j] == 0) continue ;      ans ++ ;      tmp[i] = 1 ; tmp[j] = 0 ;                            break;     }    }    count = Math.min(count,ans) ;    rotate() ;   }     System.out.println(count);  } }
4	public class ProblemA {    public static void main(String[] args) throws IOException {  BufferedReader s = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  String line = s.readLine();  int len = line.length();  int max = 0;  for (int i = 0 ; i < len ; i++) {  for (int j = i+1 ; j <= len ; j++) {   String sch = line.substring(i, j);   for (int k = i+1 ; k + (j - i) <= len ; k++) {   String tch = line.substring(k, k+(j-i));   if (sch.equals(tch)) {    max = Math.max(max, (j-i));   }   }  }  }  out.println(max);  out.flush(); }  public static void debug(Object... os){  System.err.println(Arrays.deepToString(os)); } }
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 a = in.nextInt();   int b = in.nextInt();   int[] input = IOUtils.readIntArray(in, n);   Arrays.sort(input);   int x = input[b-1];   int y = input[b];   out.println(y - x);  } } 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 indent {    static int N, M, K;  static String s;  static StringTokenizer st;  static int[] d;  static long MOD = (int)1e9 + 7;  public static void main(String[] args) throws Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int N = Integer.parseInt(br.readLine());   char[] d = new char[N];   for (int i = 0; i < N; i++) {    d[i] = br.readLine().charAt(0);   }   long[][] dp = new long[N][N];   boolean det = d[0] == 'f';     dp[0][0] = 1;     for (int i = 1; i < N; i++) {       long sum = 0;    for (int j = 0; j < N; j++) {     sum = (dp[i - 1][j]%MOD + sum%MOD + MOD) % MOD;    }           if (d[i] == 'f') {     if(det){      for (int j = 1; j < N; j++) {       dp[i][j] = dp[i-1][j-1]%MOD;      }      continue;     }         for (int j = 0; j < N; j++) {      dp[i][j] = sum%MOD;      sum -= dp[i - 1][j]%MOD;     }     det = true;             } else if (d[i] == 's') {              if(det){           det = false;      for (int j = 1; j < N; j++) {       dp[i][j] = dp[i-1][j-1]%MOD;      }           continue;     }              for (int j = 0; j < N; j++) {      dp[i][j] = sum%MOD;      sum = ((sum - dp[i - 1][j])%MOD + MOD)%MOD;     }        }      }        long ans = 0;   for (long e: dp[dp.length-1]) {    ans = (ans + e + MOD) % MOD;   }   System.out.println(ans);              } }
3	public class Codeforce { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int[] arr = new int[n];  for(int i=0; i<n; i++) {  arr[i] = sc.nextInt();  }  int color = 0;  Arrays.sort(arr);  for(int i=0; i<n; i++) {  if(arr[i]!=0) {   int col = arr[i];   color++;   for(int j=i; j<n; j++) {   if(arr[j]%col==0) arr[j]=0;   }  }  }  System.out.println(color);  sc.close(); } }
4	public class D7182 {  public static void main(String[] args) throws IOException {   init_io();   int N = nint(), M = nint(), K = nint();   if (K % 2 == 0) {    int[][][] grid = new int[K+1][N][M];    int[][][] edges = new int[4][N][M];    for (int i = 0; i < N; i++) {     for (int j = 0; j < M-1; j++) {      edges[0][i][j] = edges[2][i][j+1] = nint();     }    }    for (int i = 0; i < N-1; i++) {     for (int j = 0; j < M; j++) {      edges[1][i][j] = edges[3][i+1][j] = nint();     }    }    for (int k = 1; k <= K/2; k++) {     for (int i = 0; i < N; i++) {      for (int j = 0; j < M; j++) {       int min = Integer.MAX_VALUE;       if (i != N-1) {        min = Math.min(min, grid[k-1][i+1][j] + edges[1][i][j]);       }       if (j != M-1) {        min = Math.min(min, grid[k-1][i][j+1] + edges[0][i][j]);       }       if (i != 0) {        min = Math.min(min, grid[k-1][i-1][j] + edges[3][i][j]);       }       if (j != 0) {        min = Math.min(min, grid[k-1][i][j-1] + edges[2][i][j]);       }       grid[k][i][j] = min;      }     }    }    for (int i = 0; i < N; i++) {     for (int j = 0; j < M; j++) {      out.print(grid[K/2][i][j]*2 + " ");     }     out.println();    }   }   else {    for (int i = 0; i < N; i++) {     for (int j = 0; j < M; j++) {      out.print(-1 + " ");     }     out.println();    }   }   out.close();  }  static StreamTokenizer in;  static PrintWriter out;  static BufferedReader br;  static int nint() throws IOException {   in.nextToken();   return (int) in.nval;  }  static void init_io() throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));   in = new StreamTokenizer(br);   out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  } }
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; } }
4	public class Solution23A {     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 Solution23A().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{   char[] t = readString().toCharArray();   int max = 0;   for(int i = 0; i < t.length; i++){    for(int j = i + 1; j < t.length; j++){    for(int k = 0; k < t.length - j; k++){     if(t[i+k] == t[j+k]) max = max(max, k+1);     else break;    }    }   }   out.println(max);   }     int ModExp(int a, int n, int mod){   int res = 1;   while (n!=0)    if ((n & 1) != 0) {    res = (res*a)%mod;    --n;    }    else {    a = (a*a)%mod;    n >>= 1;    }   return res;   }        static class Utils {      private Utils() {}      public static void mergeSort(int[] a) {       mergeSort(a, 0, a.length - 1);     }      private static void mergeSort(int[] a, int leftIndex, int rightIndex) {       final int MAGIC_VALUE = 50;       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 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;       }     }   }          boolean isPrime(int a){   for(int i = 2; i <= sqrt(a); i++)    if(a % i == 0) return false;   return true;   }     static double distance(long x1, long y1, long x2, long y2){   return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));   }     static long gcd(long a, long b){   if(min(a,b) == 0) return max(a,b);   return gcd(max(a, b) % min(a,b), min(a,b));   }     static long lcm(long a, long b){   return a * b /gcd(a, b);   } }
3	public class A1209 {  public static void main(String[] args) throws IOException {   try (Input input = new StandardInput(); PrintWriter writer = new PrintWriter(System.out)) {    int n = input.nextInt();    int[] arr = input.readIntArray(n);    Arrays.sort(arr);    int ans =0;    boolean[] vis = new boolean[n];    for(int i=0;i<n;i++){     if(!vis[i]){      vis[i]=true;      for(int j=i+1;j<n;j++){       if(!vis[j] && arr[j]%arr[i]==0){        vis[j]=true;     }      }      ans++;     }    }    System.out.println(ans);   }  }  interface Input extends Closeable {   String next() throws IOException;   default int nextInt() throws IOException {    return Integer.parseInt(next());   }   default long nextLong() throws IOException {    return Long.parseLong(next());   }   default double nextDouble() throws IOException {    return Double.parseDouble(next());   }   default int[] readIntArray() throws IOException {    return readIntArray(nextInt());   }   default int[] readIntArray(int size) throws IOException {    int[] array = new int[size];    for (int i = 0; i < array.length; i++) {     array[i] = nextInt();    }    return array;   }   default long[] readLongArray(int size) throws IOException {    long[] array = new long[size];    for (int i = 0; i < array.length; i++) {     array[i] = nextLong();    }    return array;   }  }  private static class StandardInput implements Input {   private final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   private StringTokenizer stringTokenizer;   @Override   public void close() throws IOException {    reader.close();   }   @Override   public String next() throws IOException {    if (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {     stringTokenizer = new StringTokenizer(reader.readLine());    }    return stringTokenizer.nextToken();   }  } }
6	public class F {  public static void main(String[] args) {   FastScanner scanner = new FastScanner();   int N = scanner.nextInt();   int M = scanner.nextInt();   int[][] matrix = new int[N][M];   for(int i = 0; i < N; i++) {    for(int j = 0; j < M; j++) {     matrix[i][j] = scanner.nextInt();    }   }   int[][] maxDist = new int[N][N];   for(int i = 0; i < N; i++) {    Arrays.fill(maxDist[i], Integer.MAX_VALUE);   }   for(int i = 0; i < M; i++) {    for(int j = 0; j < N; j++) {     for(int k = j+1; k < N; k++) {      maxDist[j][k] = Math.min(maxDist[j][k], Math.abs(matrix[k][i] - matrix[j][i]));      maxDist[k][j] = maxDist[j][k];     }    }   }   int[][] distTop = new int[N][N];   for(int i = 0; i < N; i++) {    Arrays.fill(distTop[i], Integer.MAX_VALUE);   }   for(int i = 0; i < M-1; i++) {    for(int j = 0; j < N; j++) {     for(int k = 0; k < N; k++) {      distTop[j][k] = Math.min(distTop[j][k], Math.abs(matrix[j][i] - matrix[k][i+1]));     }    }   }   if (N == 1) {    System.out.println(distTop[0][0]);    System.exit(0);   }   int[] bitLoc = new int[1<<N];   for(int i = 0; i < N; i++) {    bitLoc[1 << i] = i;   }   int[][][] dp = new int[1<<N][N][N];     for(int mask = 1; mask < (1 << N); mask++) {    for(int smask = mask; smask > 0; smask &= (smask-1)) {     int i = bitLoc[Integer.lowestOneBit(smask)];     for (int ss = mask ^ 1 << i; ss > 0; ss &= ss - 1) {      int j = bitLoc[Integer.lowestOneBit(ss)];      if (mask == (1 << i ^ 1 << j))       dp[mask][i][j] = maxDist[i][j];      else {       int x = 0;       for (int sss = mask ^ 1 << i ^ 1 << j; sss > 0; sss &= sss - 1) {        int k = bitLoc[sss & -sss];        x = Math.max(x, Math.min(dp[mask ^ 1 << j][i][k], maxDist[k][j]));       }       dp[mask][i][j] = x;      }     }    }   }   int mxMsk = (1 << N) -1;   int max = 0;   for(int i = 0; i < N; i++) {    for(int j = 0; j < N; j++) {     if (i==j) continue;     max = Math.max(max, Math.min(dp[mxMsk][i][j], distTop[i][j]));    }   }   System.out.println(max);  }  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;   }  } }
5	public class A {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[] A = new int[n];   int sum = 0;   for (int i = 0; i < n; i++) {    A[i] = in.nextInt();    sum += A[i];   }   Arrays.sort(A);   int cnt = 0;   int temp = 0;   for (int i = n - 1; i >= 0; i--) {    temp += A[i];    sum -= A[i];    cnt++;    if (temp > sum)     break;   }   System.out.println(cnt);  } }
5	public class ProblemA {  public static void main(String[] args) throws IOException {   BufferedReader s = new BufferedReader(new InputStreamReader(System.in));   String[] data = s.readLine().split(" ");   int n = Integer.valueOf(data[0]);   int a = Integer.valueOf(data[1]);   int b = Integer.valueOf(data[2]);   long[] h = new long[n];   String[] line = s.readLine().split(" ");   for (int i = 0 ; i < n ; i++) {    h[i] = Integer.valueOf(line[i]);   }   Arrays.sort(h);     System.out.println(h[b] - h[b-1]);  } }
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) {    int n = in.readInt();    boolean[] isF = new boolean[n];    for (int i = 0; i < n; i++) {     isF[i] = in.readCharacter() == 'f';    }    FenwickTree[] fenwickTrees = new FenwickTree[n + 1];    for (int i = 0; i < fenwickTrees.length; i++) {     fenwickTrees[i] = new FenwickTree(n + 1);    }    fenwickTrees[n].add(0, 1);    for (int idx = n - 1; idx >= 0; idx--) {     for (int indentLevel = 0; indentLevel < n; indentLevel++) {      long fenwickRes;      if (isF[idx]) {       fenwickRes = fenwickTrees[idx + 1].get(indentLevel + 1, indentLevel + 1);      } else {       fenwickRes = fenwickTrees[idx + 1].get(0, indentLevel);      }      fenwickTrees[idx].add(indentLevel, fenwickRes % MiscUtils.MOD7);     }    }    out.printLine(fenwickTrees[0].get(0, 0));   }  }  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 char readCharacter() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    return (char) c;   }   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 close() {    writer.close();   }   public void printLine(long i) {    writer.println(i);   }  }  static class MiscUtils {   public static final int MOD7 = (int) (1e9 + 7);  }  static class FenwickTree {   private final long[] value;   public FenwickTree(int size) {    value = new long[size];   }   public long get(int from, int to) {    return get(to) - get(from - 1);   }   private long get(int to) {    to = Math.min(to, value.length - 1);    long result = 0;    while (to >= 0) {     result += value[to];     to = (to & (to + 1)) - 1;    }    return result;   }   public void add(int at, long value) {    while (at < this.value.length) {     this.value[at] += value;     at = at | (at + 1);    }   }  } }
4	@SuppressWarnings("unchecked") public class P35C {  final static int SHIFT = 11; final static int MASK = (1 << SHIFT) - 1; final static int [] DX = {-1, 1, 0, 0}; final static int [] DY = { 0, 0, -1, 1};  public void run() throws Exception {  int m = nextInt();  int n = nextInt();  boolean [][] burned = new boolean [n][m];  List<Integer> burn = new ArrayList();  for (int k = nextInt(); k > 0; k--) {  int x = nextInt() - 1;  int y = nextInt() - 1;  burned[y][x] = true;  burn.add((x << SHIFT) | y);  }  int lastXY = 0;  List<Integer> newBurn = null;  do {  lastXY = burn.get(0);  newBurn = new ArrayList();   for (int xy : burn) {   int x = xy >> SHIFT;   int y = xy & MASK;   for (int i = 0; i < 4; i++) {   int nx = x + DX[i];   int ny = y + DY[i];    if ((ny >= 0) && (ny < n) && (nx >= 0) && (nx < m) && (!burned[ny][nx])) {    burned[ny][nx] = true;    newBurn.add((nx << SHIFT) | ny);   }   }  }   burn = newBurn;  } while (newBurn.size() > 0);  println(((lastXY >> SHIFT) + 1) + " " + ((lastXY & MASK) + 1)); }  public static void main(String... args) throws Exception {  br = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));  pw = new PrintWriter(new BufferedOutputStream(new FileOutputStream("output.txt")));  new P35C().run();  br.close();  pw.close();  System.err.println("\n[Time : " + (System.currentTimeMillis() - startTime) + " ms]"); }  static long startTime = System.currentTimeMillis(); static BufferedReader br; static PrintWriter pw; StringTokenizer stok;  String nextToken() throws IOException {  while (stok == null || !stok.hasMoreTokens()) {  String s = br.readLine();  if (s == null) { return null; }  stok = new StringTokenizer(s);  }  return stok.nextToken(); }  void print(byte b) { print("" + b); } void print(int i) { print("" + i); } void print(long l) { print("" + l); } void print(double d) { print("" + d); } void print(char c) { print("" + c); } void print(Object o) {  if (o instanceof int[]) { print(Arrays.toString((int [])o));  } else if (o instanceof long[]) { print(Arrays.toString((long [])o));  } else if (o instanceof char[]) { print(Arrays.toString((char [])o));  } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));  } else if (o instanceof short[]) { print(Arrays.toString((short [])o));  } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));  } else if (o instanceof float[]) { print(Arrays.toString((float [])o));  } else if (o instanceof double[]) { print(Arrays.toString((double [])o));  } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));  } else { print("" + o); } } void print(String s) { pw.print(s); } void println() { println(""); } void println(byte b) { println("" + b); } void println(int i) { println("" + i); } void println(long l) { println("" + l); } void println(double d) { println("" + d); } void println(char c) { println("" + c); } void println(Object o) { print(o); println(); } void println(String s) { pw.println(s); } int nextInt() throws IOException { return Integer.parseInt(nextToken()); } long nextLong() throws IOException { return Long.parseLong(nextToken()); } double nextDouble() throws IOException { return Double.parseDouble(nextToken()); } char nextChar() throws IOException { return (char) (br.read()); } String next() throws IOException { return nextToken(); } String nextLine() throws IOException { return br.readLine(); } int [] readInt(int size) throws IOException {  int [] array = new int [size];  for (int i = 0; i < size; i++) { array[i] = nextInt(); }  return array; } long [] readLong(int size) throws IOException {  long [] array = new long [size];  for (int i = 0; i < size; i++) { array[i] = nextLong(); }  return array; } double [] readDouble(int size) throws IOException {  double [] array = new double [size];  for (int i = 0; i < size; i++) { array[i] = nextDouble(); }  return array; } String [] readLines(int size) throws IOException {  String [] array = new String [size];  for (int i = 0; i < size; i++) { array[i] = nextLine(); }  return array; } }
1	public class CommentaryBoxes {  public static void main(String[] args) {     FastReader in = new FastReader();     long n = in.nextLong();   long m = in.nextLong();   long a = in.nextLong();   long b = in.nextLong();   long total = 0;     long val =(n%m);   if (n%m != 0){       long x = (val)*b;    long y = (m-val)*a;       total = Math.min(x, y);   }   System.out.println(Math.abs(total));    }  public 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 string = "";    try {     string = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return string;   }  } }
3	public class Main {   public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));     int n = Integer.parseInt(br.readLine());   StringTokenizer tokenizer = new StringTokenizer(br.readLine());   boolean[] arr = new boolean[101];   int[] nums = new int[n+1];   int colors = 0;   for(int i = 1; i <= n; i++) {    nums[i] = Integer.parseInt(tokenizer.nextToken());    arr[nums[i]] = true;   }   Arrays.parallelSort(nums);   for(int i = 1; i <= n; i++) {    boolean newColor = false;    if(!arr[nums[i]]) {     continue;    }    for(int j = nums[i]; j <= 100; j += nums[i]) {     if(arr[j]) {      arr[j] = false;      newColor = true;     }    }    if(newColor) {     colors++;    }   }     bw.write(String.valueOf(colors));   br.close();   bw.close();  } }
4	public class Main implements Runnable {   public void solve() throws IOException {  int N = nextInt();     int M = nextInt();         int B = nextInt();     int[][] burn = new int[B][2];     for(int i = 0; i < B; i++){       burn[i][0] = nextInt();       burn[i][1] = nextInt();     }         int ansx = -1;     int ansy = -1;     int ans = -1;         for(int i = 1; i <= N; i++){       for(int j = 1; j <= M; j++){         int burnAt = Integer.MAX_VALUE;         for(int k = 0; k < B; k++){           int now = distance(i, j, burn[k][0], burn[k][1]);           burnAt = Math.min(burnAt, now);         }                 if(burnAt >= ans){                     ans = burnAt;           ansx = i;           ansy = j;                   }       }     }              out.println(ansx + " " + ansy); }     private int distance(int x, int y, int xx, int yy){         return Math.abs(xx - x) + Math.abs(yy - y);   }                     public static void main(String[] args) {  new Main().run(); }  public void run() {  try {    in = new BufferedReader(new FileReader(new File("input.txt")));       out = new PrintWriter(new FileWriter(new File("output.txt")));       tok = null;  solve();  in.close();       out.close();  } catch (IOException e) {  System.exit(0);  } }  public String nextToken() throws IOException {  while (tok == null || !tok.hasMoreTokens()) {  tok = new StringTokenizer(in.readLine());  }  return tok.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()); }   PrintWriter out; BufferedReader in; StringTokenizer tok; }
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);   G1PlaylistForPolycarpEasyVersion solver = new G1PlaylistForPolycarpEasyVersion();   solver.solve(1, in, out);   out.close();  }  static class G1PlaylistForPolycarpEasyVersion {   final long mod = 1000000007;   PrintWriter out;   InputReader in;   int n;   int time;   int[][] arr;   long[][][] dp;   long go(int last, int t, int mask) {    if (t > time)     return 0;    if (t == time) {     return 1l;    }    if (mask == (1 << n) - 1)     return 0;    if (dp[last][t][mask] != -1)     return dp[last][t][mask];    long cnt = 0;    int i = 0, j = 0;    for (i = 0; i < n; i++) {     if ((mask & (1 << i)) == 0 && arr[i][1] != last) {      cnt += go(arr[i][1], t + arr[i][0], mask | (1 << i));      cnt %= mod;     }    }    dp[last][t][mask] = cnt;    return cnt;   }   public void solve(int testNumber, InputReader in, PrintWriter out) {    this.out = out;    this.in = in;    n = ni();    time = ni();    arr = new int[n][2];    int i = 0;    for (i = 0; i < n; i++) {     arr[i][0] = ni();     arr[i][1] = ni() - 1;    }    dp = new long[3][time + 1][1 << n];    for (i = 0; i < 3; i++) {     for (int j = 0; j <= time; j++)      Arrays.fill(dp[i][j], -1);    }    long ans = (((go(0, 0, 0) + go(1, 0, 0)) % mod + go(2, 0, 0)) % mod);    ans *= modPow(2, mod - 2);    ans %= mod;    pn(ans);   }   int ni() {    return in.nextInt();   }   void pn(Object o) {    out.println(o);   }   long modPow(long a, long p) {    long o = 1;    while (p > 0) {     if ((p & 1) == 1) o = mul(o, a);     a = mul(a, a);     p >>= 1;    }    return o;   }   long mul(long a, long b) {    if (a >= mod) a %= mod;    if (b >= mod) b %= mod;    a *= b;    if (a >= mod) a %= mod;    return a;   }  }  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 nextInt() {    return Integer.parseInt(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();   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
1	public class Main implements Runnable {  public void _main() throws IOException {  int n = nextInt();  int even = 0, odd = 0, atEven = -1, atOdd = -1;  for (int i = 0; i < n; i++) {  if (nextInt() % 2 == 0) {   atEven = i;   ++even;  }  else {   atOdd = i;   ++odd;  }  }  if (odd == 1)  out.print(atOdd + 1);  else  out.print(atEven + 1); }  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);  } } }
2	public class Main { PrintWriter out = new PrintWriter(System.out); BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer tok = new StringTokenizer("");  String next() throws IOException {   if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }   return tok.nextToken();  }  int ni() throws IOException { return Integer.parseInt(next()); }  long nl() throws IOException { return Long.parseLong(next()); }   void solve() throws IOException {   int n=ni(),k=ni();   int puts=(int)Math.sqrt(2*k);   int t=(puts*(puts+1))/2;   puts++;   while (t<k) { t+=puts; puts++; }     int turns=puts-1;   while (t-k!=n-turns) {    t+=puts;    puts++;    turns++;   }   System.out.println(t-k);  }   public static void main(String[] args) throws IOException {   new Main().solve();  } }
5	public class ProblemA {  private final BufferedReader in;  private final PrintStream out;  private StringTokenizer tok = new StringTokenizer("");  private String nextLine = null;  public static void main(String[] args) throws Exception {   new ProblemA();  }  private ProblemA() throws Exception {   in = new BufferedReader(new InputStreamReader(System.in));   out = System.out;   start();   end();  }  private int nextInt() {   return Integer.parseInt(nextWord());  }  private String nextWord() {   if (tok.hasMoreTokens()) {    return tok.nextToken();   } else {    while (!tok.hasMoreTokens()) {     try {      nextLine = in.readLine();      if (nextLine == null) {       return null;      } else {       tok = new StringTokenizer(nextLine);      }     } catch (IOException ex) {      Logger.getLogger(ProblemA.class.getName()).log(Level.SEVERE, null, ex);     }    }    return tok.nextToken();   }  }  private void start() {   int n = nextInt();   int k = nextInt();   T[] ts = new T[n];   for (int i = 0; i < n; i++) {    ts[i] = new T(nextInt(), nextInt());   }   Arrays.sort(ts, new Comparator<T>() {    @Override    public int compare(T o1, T o2) {     if (o1.p > o2.p) {      return -1;     }     if (o1.p < o2.p) {      return 1;     }     if (o1.t < o2.t) {      return -1;     }     if (o1.t > o2.t) {      return 1;     }     return 0;    }   });   int t = ts[k - 1].t;   int p = ts[k - 1].p;   int res = 0;   for (int i = 0; i < n; i++) {    if (ts[i].p == p && ts[i].t == t) {     res++;    }   }   out.println(res);  }  class T {   int p;   int t;   public T(int p, int t) {    this.p = p;    this.t = t;   }  }  private void end() {   out.close();  } }
4	public final class Solution {   static PrintWriter out = new PrintWriter(System.out);  static FastReader in = new FastReader();  static long mod = (long) 1e9 + 7;  static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(1, 0), new Pair(0, -1), new Pair(0, 1)};          public static void main(String[] args) {   int n = i();   int m = i();   int k = i();   int[][] a = new int[n][m - 1];   for (int i = 0; i < n; i++) {    a[i] = input(m - 1);   }   int[][] b = new int[n - 1][m];   for (int i = 0; i < n - 1; i++) {    b[i] = input(m);   }   if (k % 2 > 0) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      out.print(-1 + " ");     }     out.println();    }    out.flush();    return;   }   int[][][] f = new int[n][m][k / 2 + 1];   for (int s = 1; s <= k / 2; s++) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      int ans = -1;      if (j > 0) {       ans = f[i][j - 1][s - 1] + a[i][j - 1];      }      if (i > 0) {       int t = f[i - 1][j][s - 1] + b[i - 1][j];       ans = ans == -1 ? t : Math.min(ans, t);      }      if (i < n - 1) {       int t = f[i + 1][j][s - 1] + b[i][j];       ans = ans == -1 ? t : Math.min(ans, t);      }      if (j < m - 1) {       int t = f[i][j + 1][s - 1] + a[i][j];       ans = ans == -1 ? t : Math.min(ans, t);      }      f[i][j][s] = ans;     }    }   }   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     out.print(f[i][j][k / 2] * 2 + " ");    }    out.println();   }   out.flush();  }  static int sd(long i) {   int d = 0;   while (i > 0) {    d += i % 10;    i = i / 10;   }   return d;  }  static Set<Integer> getFactors(int x) {   Set<Integer> res = new HashSet<>();   if (x <= 3) {    res.add(x);   } else {    int t = x;    for (int f = 2; f <= x / 2; f++) {     if (t == 1) {      break;     }     if (t % f == 0) {      res.add(f);      while (t % f == 0) {       t = t / f;      }     }    }    if (t > 1) {     res.add(t);    }   }   return res;  }   static int lower(long A[], long x) {   int l = -1, r = A.length;   while (r - l > 1) {    int m = (l + r) / 2;    if (A[m] >= x) {     r = m;    } else {     l = m;    }   }   return r;  }  static int upper(long A[], long x) {   int l = -1, r = A.length;   while (r - l > 1) {    int m = (l + r) / 2;    if (A[m] <= x) {     l = m;    } else {     r = m;    }   }   return l;  }  static void swap(int A[], int a, int b) {   int t = A[a];   A[a] = A[b];   A[b] = t;  }  static int lowerBound(int A[], int low, int high, int x) {   if (low > high) {    if (x >= A[high]) {     return A[high];    }   }   int mid = (low + high) / 2;   if (A[mid] == x) {    return A[mid];   }   if (mid > 0 && A[mid - 1] <= x && x < A[mid]) {    return A[mid - 1];   }   if (x < A[mid]) {    return lowerBound(A, low, mid - 1, x);   }   return lowerBound(A, mid + 1, high, x);  }   static long pow(long a, long b) {   long pow = 1;   long x = a;   while (b != 0) {    if ((b & 1) != 0) {     pow = (pow * x) % mod;    }    x = (x * x) % mod;    b /= 2;   }   return pow;  }  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 void print(char A[]) {   for (char c : A) {    out.print(c);   }   out.println();  }  static void print(boolean A[]) {   for (boolean c : A) {    out.print(c + " ");   }   out.println();  }  static void print(int A[]) {   for (int c : A) {    out.print(c + " ");   }   out.println();  }  static void print(long A[]) {   for (long i : A) {    out.print(i + " ");   }   out.println();  }  static void print(List<Integer> A) {   for (int a : A) {    out.print(a + " ");   }  }  static int i() {   return in.nextInt();  }  static long l() {   return in.nextLong();  }  static String s() {   return in.nextLine();  }  static int[] input(int N) {   int A[] = new int[N];   for (int i = 0; i < N; i++) {    A[i] = in.nextInt();   }   return A;  }  static long[] inputLong(int N) {   long A[] = new long[N];   for (int i = 0; i < A.length; i++) {    A[i] = in.nextLong();   }   return A;  }  static int GCD(int a, int b) {   if (b == 0) {    return a;   } else {    return GCD(b, a % b);   }  }  static long GCD(long a, long b) {   if (b == 0) {    return a;   } else {    return GCD(b, a % b);   }  } } class SegmentTree {  long[] t;  public SegmentTree(int n) {   t = new long[n + n];   Arrays.fill(t, Long.MIN_VALUE);  }  public long get(int i) {   return t[i + t.length / 2];  }  public void add(int i, long value) {   i += t.length / 2;   t[i] = value;   for (; i > 1; i >>= 1) {    t[i >> 1] = Math.max(t[i], t[i ^ 1]);   }  }    public long max(int a, int b) {   long res = Long.MIN_VALUE;   for (a += t.length / 2, b += t.length / 2; a <= b; a = (a + 1) >> 1, b = (b - 1) >> 1) {    if ((a & 1) != 0) {     res = Math.max(res, t[a]);    }    if ((b & 1) == 0) {     res = Math.max(res, t[b]);    }   }   return res;  } } class Pair {  int i, j;  Pair(int i, int j) {   this.i = i;   this.j = j;  } } 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;  }  }
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("");  int MAXDEG = 5;  void gen() throws FileNotFoundException {  PrintWriter out = new PrintWriter("input.txt");  int n = 100000;  Random rnd = new Random();  out.println(n);  for (int i = 0; i < n; i++) {  out.println("R" + (rnd.nextInt(1000000) + 1) + "C" + (rnd.nextInt(1000000) + 1));  }  out.close(); }  void gen2() throws FileNotFoundException {  PrintWriter out = new PrintWriter("input.txt");  int n = 100000;  Random rnd = new Random();  out.println(n);  for (int i = 0; i < n; i++) {  int len = rnd.nextInt(MAXDEG) + 1;  String pref = "";  for (int j = 0; j < len; j++)   pref += (char) (rnd.nextInt(26) + 'A');  out.println(pref + (rnd.nextInt(1000000) + 1));  }  out.close(); }  private void run() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  int n = nextInt();  int[] sumDegs = new int[MAXDEG + 1];  sumDegs[0] = 1;  int deg = 1;  for (int i = 1; i <= MAXDEG; i++) {  deg *= 26;  sumDegs[i] = sumDegs[i - 1] + deg;  }  for (int i = 0; i < n; i++) {  String s = nextLine();  String pref = "";  int endPos = -1;  for (int j = 0; j < s.length(); j++) {   if (!isLet(s.charAt(j))) {   endPos = j;   break;   }   pref += s.charAt(j);  }  int num = -1;  try {   num = Integer.parseInt(s.substring(endPos));  } catch (Exception e) {  }  if (num != -1) {   int col = sumDegs[pref.length() - 1];   int val = 0;   for (int j = 0; j < pref.length(); j++) {   val = val * 26 + (pref.charAt(j) - 'A');   }   col += val;   out.println("R" + num + "C" + col);  } else {   int row = Integer.parseInt(s.substring(1, s.indexOf('C')));   int col = Integer.parseInt(s.substring(s.indexOf('C') + 1));   int len = MAXDEG;   while (col < sumDegs[len])   len--;   len++;   col -= sumDegs[len - 1];   String res = "";   while (col > 0) {   res = (char) (col % 26 + 'A') + res;   col /= 26;   }   while (res.length() < len)   res = "A" + res;   out.println(res + row);  }  }  in.close();  out.close(); }  private boolean isLet(char c) {  return c >= 'A' && c <= 'Z'; }  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; } }
3	public class problemA {  public static void main(String[] args) {   Scanner scan = new Scanner(System.in);   int n = scan.nextInt();   int[] numbs = new int[n];   int[] smallest_color = new int[n];   for(int i = 0; i < n;i++){    numbs[i] = scan.nextInt();   }   Arrays.sort(numbs);   int count = 0;   for(int i =0; i < n; i++){    for(int j=0; j <n;j++ ){     if(smallest_color[j] == 0){      count++;      smallest_color[j] = numbs[i];      break;     }     if(numbs[i] % smallest_color[j] == 0){      break;     }    }   }   System.out.println(count);  } }
4	public class Main {  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 FileReader("input.txt"));    out = new PrintWriter("output.txt");   } 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 Main().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;    public LOL(int x, int y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(LOL o) {    return (x - o.x);       }  }  class LOL2 implements Comparable<LOL2> {   int x;   int y;   int z;    public LOL2(int x, int y, int z) {    this.x = x;    this.y = y;    this.z = z;   }   @Override   public int compareTo(LOL2 o) {    return (z - o.z);       }  }  class test implements Comparable<test> {   long x;   long y;    public test(long x, long y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(test o) {                   int compareResult = Long.compare(x, o.x);    if (compareResult != 0) {     return compareResult;    }    return Long.compare(y, o.y);       }  }  class data {   String name;   String city;   data(String name, String city) {    this.city = city;    this.name = name;   }  }  class Point {   double x;   double y;    Point(double x, double y) {    this.x = x;    this.y = y;   }   double distance(Point temp) {    return Math.sqrt((x - temp.x) * (x - temp.x) + (y - temp.y) * (y - temp.y));   }   double sqrDist(Point temp) {    return ((x - temp.x) * (x - temp.x) + (y - temp.y) * (y - temp.y));   }   Point rotate(double alpha) {    return new Point(x * cos(alpha) - y * sin(alpha), x * sin(alpha) + y * cos(alpha));   }   void sum(Point o) {    x += o.x;    y += o.y;   }   void scalarProduct(int alpha) {    x *= alpha;    y *= alpha;   }  }  class Line {   double a;   double b;   double c;   Line(Point A, Point B) {    a = B.y - A.y;    b = A.x - B.x;    c = -A.x * a - A.y * b;   }   Line(double a, double b, double c) {    this.a = a;    this.b = b;    this.c = c;   }   Point intersection(Line o) {    double det = a * o.b - b * o.a;    double det1 = -c * o.b + b * o.c;    double det2 = -a * o.c + c * o.a;    return new Point(det1 / det, det2 / det);   }  }    class record implements Comparable<record> {   String city;   Long score;   public record(String name, Long score) {    this.city = name;    this.score = score;   }   @Override   public int compareTo(record o) {    if (o.city.equals(city)) {     return 0;    }    if (score.equals(o.score)) {     return 1;    }    if (score > o.score) {     return 666;    } else {     return -666;    }       }  }  public long gcd(long a, long b) {   if (a == 0 || b == 0) return max(a, b);   if (a % b == 0)    return b;   else    return gcd(b, a % b);  }  boolean prime(long n) {   if (n == 1) return false;   for (int i = 2; i <= sqrt(n); i++)    if (n % i == 0)     return false;   return true;  }  public int sum(long n) {   int s = 0;   while (n > 0) {    s += (n % 10);    n /= 10;   }   return s;  }     ArrayList<Integer> primes;  boolean[] isPrime;  public void getPrimes (int n) {   isPrime[0] = false;   isPrime[1] = false;   for (int i = 2; i <= n; i++) {    if (isPrime[i]) {     primes.add(i);     if (1l * i * i <= n) {      for (int j = i * i; j <= n; j += i) {       isPrime[j] = false;      }     }    }   }  }    public long binPowMod(long a, long b, long mod) {   if (b == 0) {    return 1 % mod;   }   if (b % 2 != 0) {    return ((a % mod) * (binPowMod(a, b - 1, mod) % mod)) % mod;   } else {    long temp = binPowMod(a, b / 2, mod) % mod;    long ans = (temp * temp) % mod;    return ans;   }  }   int type[];  boolean vis[];  HashMap<Integer, HashSet<Integer>> g;  int componentNum[];    int p[];  int find(int x) {   if (x == p[x]) {    return x;   }   return p[x] = find(p[x]);  }  boolean merge(int x, int y) {   x = find(x);   y = find(y);   if (p[x] == p[y]) {    return false;   }   p[y] = x;   return true;  }  class Trajectory {   double x0;   double y0;   double vx;   double vy;    Trajectory(double vx, double vy, double x0, double y0) {    this.vx = vx;    this.vy = vy;    this.x0 = x0;    this.y0 = y0;   }   double y (double x) {    return y0 + (x - x0) * (vy / vx) - 5 * (x - x0) * (x - x0) / (vx * vx);   }   double der(double x) {    return (vy / vx) - 10 * (x - x0) / (vx * vx);   }   }  int s;  int n;  int m;  boolean isVisited[][];  char[][] maze;  int[] dx = {0, 0, -1, 1};  int[] dy = {1, -1, 0, 0};  void dfs(int x, int y) {   isVisited[x][y] = true;   for (int i = 0; i < 4; i++) {    int currX = x + dx[i];    int currY = y + dy[i];    if (maze[currX][currY] == '.' && !isVisited[currX][currY]) {     dfs(currX, currY);    }   }   }    public void solve() throws IOException {   n = readInt();   m = readInt();   maze = new char[n + 2][m + 2];   for (int i = 0; i < n + 2; i++) {    maze[i][0] = '#';    maze[i][m + 1] = '#';   }   for (int j = 0; j < m + 2; j++) {    maze[0][j] = '#';    maze[n + 1][j] = '#';   }   for (int i = 1; i <= n; i++) {    for (int j = 1; j <= m; j++) {     maze[i][j] = '.';    }   }   int[][] dist = new int[n + 2][m + 2];   for (int i = 0; i < n + 2; i++) {    for (int j = 0; j < m + 2; j++) {     dist[i][j] = Integer.MAX_VALUE;    }   }   ArrayDeque<Integer> xValues = new ArrayDeque<Integer>();   ArrayDeque<Integer> yValues = new ArrayDeque<Integer>();   int k = readInt();   for (int i = 0; i < k; i++) {    int currX = readInt();    int currY = readInt();    xValues.add(currX);    yValues.add(currY);    dist[currX][currY] = 0;   }    while(!xValues.isEmpty()) {    int x = xValues.poll();    int y = yValues.poll();    for (int i = 0; i < 4; i++) {     int currX = x + dx[i];     int currY = y + dy[i];     if (maze[currX][currY] == '.' && dist[currX][currY] > dist[x][y] + 1) {      dist[currX][currY] = dist[x][y] + 1;      xValues.add(currX);      yValues.add(currY);     }    }   }   int maxDist = 0;   int indexX = 0;   int indexY = 0;   for (int i = 1; i <= n; i++) {    for (int j = 1; j <= m; j++) {     if (dist[i][j] >= maxDist) {      maxDist = dist[i][j];      indexX = i;      indexY = j;     }    }   }   out.print(indexX + " " + indexY);    }  }
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));  } }
3	public class SolutionArch2 {  public static void main(String[] args) {   Scanner scanner = new Scanner(System.in);   int n = Integer.valueOf(scanner.nextLine());   String s = scanner.nextLine();   int[] arr = Arrays.stream(s.split(" "))     .mapToInt(Integer::valueOf)     .toArray();   int[] prefixSum = new int[n + 1];   for (int i = 0; i < n; i++) {    prefixSum[i + 1] = prefixSum[i] + arr[i];   }   Map<Integer, List<int[]>> map = new HashMap<>();   for (int i = 0; i < n; i++) {    for (int j = i; j < n; j++) {     int subarraySum = prefixSum[j + 1] - prefixSum[i];     map.putIfAbsent(subarraySum, new ArrayList<>());     int l = i + 1, r = j + 1;     map.get(subarraySum).add(new int[]{l, r});    }   }   List<int[]> resultPairs = new ArrayList<>();   for (Map.Entry<Integer, List<int[]>> e : map.entrySet()) {    List<int[]> result = new ArrayList<>();    int[] curr = new int[2];    List<int[]> pairs = e.getValue();    Collections.sort(pairs, Comparator.<int[]>comparingInt(a -> a[1]));    for (int[] next : pairs) {     if (next[0] > curr[1]) {      result.add(next);      curr = next;     }    }    if (resultPairs.size() < result.size()) {     resultPairs = result;    }   }   printResult(resultPairs);  }  private static void printResult(List<int[]> list) {   StringBuilder sb = new StringBuilder();   sb.append(list.size()).append("\n");   for (int[] pair : list) {    sb.append(pair[0]).append(" ").append(pair[1]).append("\n");   }   System.out.print(sb);  } }
3	public class TaskA implements Runnable {  long m = (int) 1e9 + 7;  PrintWriter w;  InputReader c;    public void run() {   c = new InputReader(System.in);   w = new PrintWriter(System.out);   int n = c.nextInt();   int a[] = scanArrayI(n);   boolean vis[] = new boolean[n];   Arrays.sort(a);   int ans=0;   for(int i=0;i<n;i++){    if(vis[i]) continue;    vis[i] = true;    for(int j=i+1;j<n;j++){     if(a[j]%a[i] == 0){      vis[j] = true;     }    }    ans++;    boolean check = false;    for(int j=0;j<n;j++){     if(!vis[j]) check = true;    }    if(!check) break;   }   w.println(ans);   w.close();  }  class pair{   int x,y,step;   @Override   public String toString() {    return "pair{" +      "x=" + x +      ", y=" + y +      ", step=" + step +      '}';   }   public pair(int x, int y, int s) {    this.x = x;    this.y = y;    step = s;   }  }   class HashMapUtil<T, U> {   void addHash(HashMap<T, Integer> hm, T a) {    if (hm.containsKey(a)) hm.put(a, hm.get(a) + 1);    else hm.put(a, 1);   }   void iterateHashMap(HashMap<T, U> hm) {    for (Map.Entry<T, U> e : hm.entrySet()) {     T key = e.getKey();     U value = e.getValue();    }   }  }  public int search(int input[], int search) {   int low = 0;   int high = input.length - 1;   int mid;   while (low <= high) {    mid = low + ((high - low) / 2);    if (input[mid] == search) {     return mid;    } else if (input[mid] < search) {     low = mid + 1;    } else {     high = mid - 1;    }   }   return -1;  }  public void sort(int arr[]) {   int n = arr.length, mid, h, s, l, i, j, k;   int[] res = new int[n];   for (s = 1; s < n; s <<= 1) {    for (l = 0; l < n - 1; l += (s << 1)) {     h = min(l + (s << 1) - 1, n - 1);     mid = min(l + s - 1, n - 1);     i = l;     j = mid + 1;     k = l;     while (i <= mid && j <= h) res[k++] = (arr[i] <= arr[j] ? arr[i++] : arr[j++]);     while (i <= mid) res[k++] = arr[i++];     while (j <= h) res[k++] = arr[j++];     for (k = l; k <= h; k++) arr[k] = res[k];    }   }  }  public int nextPowerOf2(int num) {   if (num == 0) {    return 1;   }   if (num > 0 && (num & (num - 1)) == 0) {    return num;   }   while ((num & (num - 1)) > 0) {    num = num & (num - 1);   }   return num << 1;  }  static long gcd(long a, long b) {   if (b == 0)    return a;   return gcd(b, a % b);  }  public static void sortbyColumn(int arr[][], int col) {   Arrays.sort(arr, new Comparator<int[]>() {    public int compare(int[] o1, int[] o2) {     return (Integer.valueOf(o1[col]).compareTo(o2[col]));    }   });  }  public void printArray(int[] a) {   for (int i = 0; i < a.length; i++)    w.print(a[i] + " ");   w.println();  }  public int[] scanArrayI(int n) {   int a[] = new int[n];   for (int i = 0; i < n; i++)    a[i] = c.nextInt();   return a;  }  public long[] scanArrayL(int n) {   long a[] = new long[n];   for (int i = 0; i < n; i++)    a[i] = c.nextLong();   return a;  }  public void printArray(long[] a) {   for (int i = 0; i < a.length; i++)    w.print(a[i] + " ");   w.println();  }  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 TaskA(), "TaskA", 1 << 26).start();  } }
6	public class E {  public static void main(String[] args) throws Exception {   new Thread(null ,new Runnable(){    public void run(){     try{solveIt();} catch(Exception e){e.printStackTrace(); System.exit(1);}    }   },"Main",1<<28).start();  }  static int dp[][], a[][], rows, cols;  public static void solveIt() throws Exception {   FastReader in = new FastReader(System.in);   PrintWriter pw = new PrintWriter(System.out);   int test = in.nextInt();   for (int t = 1; t <= test; t++) {    rows = in.nextInt();    cols = in.nextInt();    dp = new int[cols][1 << rows];    for (int x[] : dp) Arrays.fill(x, -1);    a = new int[cols][rows];    for (int i = 0; i < rows; i++) {     for (int j = 0; j < cols; j++) {      a[j][i] = in.nextInt();     }    }    debug(a);    pw.println(solve(0, 0));   }   pw.close();  }  static int solve(int pos, int mask) {   if (pos >= cols) return 0;   if (dp[pos][mask] != -1) return dp[pos][mask];   int res = 0;   for (int i = 0; i < rows; i++) {    for (int k = 0; k < (1 << rows); k++) {     if ((mask & k) != 0) continue;     int sum = 0;     for (int bit = 0; bit < rows; bit++) {      if (check(k, bit)) sum += a[pos][bit];     }     res = max(res, sum + solve(pos + 1, mask | k));    }    cyclicShift(pos);   }   return dp[pos][mask] = res;  }  static boolean check(int N, int pos) {   return (N & (1 << pos)) != 0;  }  static void cyclicShift(int col) {   int m = a[col].length;   int last = a[col][m - 1];   for (int i = m - 1; i >= 1; i--) {    a[col][i] = a[col][i - 1];   }   a[col][0] = last;  }  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;   public FastReader(InputStream is) {    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);   }   private boolean isEndOfLine(int c) {    return c == '\n' || c == '\r' || c == -1;   }   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 String nextLine() {    int c = skip();    StringBuilder sb = new StringBuilder();    while (!isEndOfLine(c)) {     sb.appendCodePoint(c);     c = 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) + (b - '0');     } 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) + (b - '0');     } 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);   }   public char readChar() {    return (char) skip();   }  } }
4	public class _P023A{  Scanner sc=new Scanner(System.in);  int INF=1<<28;  double EPS=1e-9;  String s;  void run(){   s=sc.nextLine();   solve();  }  void solve(){   int n=s.length();   int max=0;   for(int i=0; i<n; i++){    for(int j=i+1; j<n; j++){     for(int k=0; j+k<n; k++){      if(s.charAt(i+k)!=s.charAt(j+k)){       break;      }else{       max=max(max, k+1);      }     }    }   }   println(max+"");  }  void println(String s){   System.out.println(s);  }  void print(String s){   System.out.print(s);  }  void debug(Object... os){   System.err.println(Arrays.deepToString(os));  }  public static void main(String[] args){   Locale.setDefault(Locale.US);   new _P023A().run();  } }
3	public class Main { PrintWriter out = new PrintWriter(System.out); BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer tok = new StringTokenizer("");  String next() throws IOException {   if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }   return tok.nextToken();  }  int ni() throws IOException { return Integer.parseInt(next()); }  long nl() throws IOException { return Long.parseLong(next()); }   void solve() throws IOException {   int n=ni();   int[]A=new int[n];   for (int x=0;x<n;x++) A[x]=ni();   Arrays.sort(A);   ArrayList<Integer>B=new ArrayList();   B.add(A[0]);   int ans=1;     Outer:   for (int x=1;x<n;x++) {    for (int y=0;y<B.size();y++) {     if (A[x]%B.get(y)==0) continue Outer;    }    ans++;    B.add(A[x]);   }   System.out.println(ans);     }   public static void main(String[] args) throws IOException {   new Main().solve();  } }
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)); } }
1	public class b implements Runnable{ PrintWriter out = null; public int toint(String s){  int res = 0;  for (int i = 0; i < s.length(); i++){  res *= 10;  res += s.charAt(i)-'0';  }  return res; }  public void tostr(int k){  if (k == 0) return;  tostr((k-1)/26);  out.print((char)(('A'+((k-1)%26)))); }  public int fromstr(String s){  if (s.length() == 0) return 0;  int r = s.charAt(s.length()-1)-'A'+1;  r += 26*(fromstr(s.substring(0,s.length()-1)));  return r; }   public void run(){     try{       Scanner in = new Scanner(System.in);       out = new PrintWriter(System.out);       int n = in.nextInt();    for (int t = 0; t < n; t++){    int rp = -1;    int cp = -1;    String s = in.next();    for (int i = 0; i < s.length(); i++)     if (s.charAt(i) == 'R') rp = i;     else if (s.charAt(i) == 'C') cp = i;    boolean good = true;    if (rp == 0 && cp > 1){     for (int i = 0; i <= cp; i++)     if (s.charAt(i) >= '0' && s.charAt(i) <= '9')      good = false;    }    if (good){     int k = 0;     for (;s.charAt(k) < '0' || s.charAt(k) > '9'; k++);     int r = toint(s.substring(k,s.length()));     int c = fromstr(s.substring(0,k));     out.print('R');     out.print(r);     out.print('C');     out.println(c);    } else {     int r = toint(s.substring(1,cp));     int c = toint(s.substring(cp+1,s.length()));     tostr(c);     out.println(r);    }    }       in.close();       out.close();     } catch(Exception e){       e.printStackTrace();     }   }   public static void main(String[] args){     new Thread(new b()).start();   } }
5	public class Main {  public static void main(String[] args) {   Scanner input = new Scanner(System.in);   int n = input.nextInt();   int a = input.nextInt();   int b = input.nextInt();   int x[] = new int[n];   for (int i=0; i<n; i++) x[i]=input.nextInt();   Arrays.sort(x);   int y[] = new int[n];   for (int i=0; i<n; i++) y[i]=x[n-i-1];   System.out.println(y[a-1]-y[a]);  } }
4	public class Main{ public static void main( String[] args ){  Scanner cin = new Scanner( System.in );  String s = cin.next();  int n = s.length();  char[] ss = new char[ n ];  ss = s.toCharArray();   int ans = 0;   for (int i=0; i<n; i++)  for (int j=i+1; j<n; j++){   int k = 0;   while ( i+k<n && j+k<n && ss[i+k] == ss[j+k] ) k++;     ans = Math.max( ans, k );  }   System.out.println( ans ); } }
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); }
2	public class cf256b { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  long n = in.nextLong();  long x = in.nextLong()-1;  long y = in.nextLong()-1;  long c = in.nextLong();   long lo = 0, hi = 2*n+10;  while(hi - lo > 2) {  long mid = (hi+lo)/2;  if(calc(n,x,y,mid) >= c)   hi = mid;  else   lo = mid;  }  while(calc(n,x,y,lo) < c) lo++;  System.out.println(lo); } static long calc(long n, long x, long y, long t) {  long ans = (2*t)*(t+1)+1;   long top = Math.max(0,t-x);  long bottom = Math.max(0,t-(n-1-x));  long left = Math.max(0,t-y);  long right = Math.max(0,t-(n-1-y));  ans -= top*top + bottom*bottom + left*left + right*right;   long tl = Math.max(0, t - (x+y+1));  long tr = Math.max(0, t - (x+(n-1-y)+1));  long bl = Math.max(0, t - ((n-1-x)+y+1));  long br = Math.max(0, t - ((n-1-x) + (n-1-y) + 1));   ans += (tl*tl+tl)/2 + (tr*tr+tr)/2 + (bl*bl+bl)/2 + (br*br+br)/2;  return ans; } }
0	public class S { public static void main (String[] args) {  Scanner in=new Scanner(System.in);  int t=in.nextInt();  while(t--!=0)  {   int a=in.nextInt();   int b=in.nextInt();   int min=Math.min(a,b);   int max=Math.max(a,b);   int res=0;   while(min!=0)   {    res=res+max/min;    int temp=min;    min=max%min;    max=temp;   }   System.out.println(res);  } }  }
3	public class Main1 {  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();  }  }  public static void main(String[] args) throws IOException  {  Reader s=new Reader();  int n = s.nextInt(), i, j, ans=0;  int[] a = new int[101];  for(i=0;i<n;i++){  a[s.nextInt()]++;  }  for(i=1;i<=100;i++){  if(a[i]>0){   ans++;   for(j=i;j<=100;j++){   if(j%i==0){    a[j]=0;   }   }  }  }  System.out.println(ans); } }
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);  } } }
3	public class first {  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 < a.length; i++) {  a[i]=s.nextInt();  }  Arrays.sort(a);  int count=0;  for (int i = 0; i < a.length; i++) {  if(a[i]!=0) {   int x=a[i];   count++;   for (int j = i; j < a.length; j++) {   if(a[j]%x==0) {    a[j]=0;   }   }  }  }  System.out.println(count); } }
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);   TaskF2 solver = new TaskF2();   solver.solve(1, in, out);   out.close();  }  static class TaskF2 {   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();    }    HashMap<Integer, ArrayList<Interval>> map = new HashMap<>();    for (int i = 0; i < n; i++) {     int sum = 0;     for (int j = i; j < n; j++) {      sum += a[j];      if (map.containsKey(sum) == false) {       map.put(sum, new ArrayList<>());      }      ArrayList<Interval> arr = map.get(sum);      if (arr.isEmpty() || arr.get(arr.size() - 1).r < i) {       arr.add(new Interval(i, j));      } else if (arr.get(arr.size() - 1).r >= j) {       arr.set(arr.size() - 1, new Interval(i, j));      }     }    }    ArrayList<Interval> best = new ArrayList<>();    for (ArrayList<Interval> arr : map.values()) {     if (best.size() < arr.size()) {      best = arr;     }    }    out.println(best.size());    for (Interval i : best) {     out.println((i.l + 1) + " " + (i.r + 1));    }   }   class Interval {    int l;    int r;    Interval(int l, int r) {     this.l = l;     this.r = r;    }   }  }  static class InputReader {   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private InputStream stream;   public InputReader(InputStream stream) {    this.stream = stream;   }   private boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   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 nextInt() {    int c = read();    while (isWhitespace(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 (!isWhitespace(c));    return res * sgn;   }  } }
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");  } } }
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); } }
5	public class P113A {   public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   PrintStream out = System.out;      int n = sc.nextInt();   int k = sc.nextInt();   List<Team> l = new ArrayList<Team>();   for (int i = 0; i < n; i++) {    l.add(new Team(sc.nextInt(), sc.nextInt()));   }   Collections.sort(l, new Comparator<Team>() {     public int compare(Team a, Team b) {      if (a.s == b.s)       return a.t - b.t;      return b.s - a.s;     }     });   int f = k - 1;   int la = k - 1;   Team p = l.get(k - 1);   while (la < n && l.get(la).s == p.s && l.get(la).t == p.t) la++;   while ( f >= 0 && l.get(f).s == p.s && l.get(f).t == p.t) f--;   out.println(la - f - 1);  }  static class Team {   int s;   int t;   public Team(int a, int b) { s = a; t = b; }  }  }
4	public class FireAgain {  Point coordinate; Queue<Point> q = new LinkedList<Point>(); int m, n; boolean[][] arr; PrintStream out ;  void bfs(Point start) {  while (!q.isEmpty()) {  Point front = q.poll();  Point p = new Point();   p.x = front.x - 1;  p.y = front.y;  if (p.x >= 1 && p.x <= n && p.y <= m && p.y >= 1) {   if (!arr[p.x][p.y]) {   arr[p.x][p.y] = true;   q.add(p);   }  }    p = new Point();  p.x = front.x + 1;  p.y = front.y;  if (p.x >= 1 && p.x <= n && p.y <= m && p.y >= 1)   if (!arr[p.x][p.y]) {   arr[p.x][p.y] = true;   q.add(p);   }   p = new Point() ;  p.x = front.x;  p.y = front.y + 1;  if (p.x >= 1 && p.x <= n && p.y <= m && p.y >= 1)   if (!arr[p.x][p.y]) {   arr[p.x][p.y] = true;   q.add(p);   }   p = new Point() ;  p.x = front.x;  p.y = front.y - 1;  if (p.x >= 1 && p.x <= n && p.y <= m && p.y >= 1)   if (!arr[p.x][p.y]) {   arr[p.x][p.y] = true;   q.add(p);   }   if (q.size() == 0)   out.print(front.x + " " + front.y);  } }   public static void main(String[] args) throws FileNotFoundException {   FireAgain fa = new FireAgain();  Scanner Scan = new Scanner(new FileInputStream("input.txt"));  fa.out = new PrintStream(new File("output.txt"));  fa.n = Scan.nextInt();  fa.m = Scan.nextInt();  int k = Scan.nextInt();  fa.arr = new boolean[2001][2001];  for (int i = 0; i < k; i++) {  fa.coordinate = new Point();  fa.coordinate.x = Scan.nextInt();  fa.coordinate.y = Scan.nextInt();  fa.q.add(fa.coordinate);  fa.arr[fa.coordinate.x][fa.coordinate.y] = true;  }  fa.bfs(fa.q.peek());  } }
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();  }  } }
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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();     String[] a = new String[n];    Map<String, Integer> map = new HashMap<>();    for (int i = 0; i < n; i++) {     a[i] = in.next();     map.merge(a[i], 1, Integer::sum);    }    String[] b = new String[n];    for (int i = 0; i < n; i++) {     b[i] = in.next();     if (map.containsKey(b[i])) {      map.put(b[i], map.get(b[i]) - 1);      if (map.get(b[i]) <= 0)       map.remove(b[i]);     }    }    int ans = 0;    for (String s : map.keySet()) {     ans += map.get(s);    }    out.println(ans);    }  }  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 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 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 String nextString() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     if (Character.isValidCodePoint(c)) {      res.appendCodePoint(c);     }     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   public boolean isSpaceChar(int c) {    if (filter != null) {     return filter.isSpaceChar(c);    }    return isWhitespace(c);   }   public String next() {    return nextString();   }   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 close() {    writer.close();   }   public void println(int i) {    writer.println(i);   }  } }
4	public class Main {  public static void main(String[] args) throws IOException {        InputReader in = new InputReader(new FileReader(new File("input.txt")));   PrintWriter out = new PrintWriter(new FileWriter(new File("output.txt")));        Solution s = new Solution();   s.solve(1, in, out);   out.close();  }  static class Solution {      double EPS = 0.0000001;   public void solve(int cs, InputReader in, PrintWriter out) {    int n = in.nextInt(), m = in.nextInt();    Graph g = new Graph(n, m);    int k = in.nextInt();    for (int[] v : g.vis)     Arrays.fill(v, -1);    while (k-- > 0) {     Pair start = new Pair(in.nextInt()-1, in.nextInt()-1);     g.bfs(start);    }    int idx1 = 0, idx2 = 0, max = 0;    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; ++j) {      if (g.vis[i][j] > max) {       idx1 = i;       idx2 = j;       max = g.vis[i][j];      }     }    }    out.println((idx1+1) + " " + (idx2+1));   }   static class Pair {    int x, y;    public Pair(int x, int y) {     this.x = x ;     this.y = y;    }   }   static class Graph {    LinkedList<Integer> adj[];    int n, e;    int[][] vis;    @SuppressWarnings("unchecked")    public Graph(int n, int e) {     this.n = n;     this.e = e;     adj = new LinkedList[n];     for (int i = 0; i < n; ++i)      adj[i] = new LinkedList<>();     vis = new int[n][e];    }       int[] dx = {0, 0, 1, -1};    int[] dy = {1, -1, 0, 0};    void bfs(Pair src) {     Queue<Pair> q = new LinkedList<>();     vis[src.x][src.y] = 0;     q.add(src);     while (!q.isEmpty()) {      Pair p = q.poll();      for (int k = 0; k < 4; k++) {       int ni = p.x+dx[k];       int nj = p.y+dy[k];       if (isValid(ni, nj) && (vis[ni][nj] == -1 || vis[p.x][p.y]+1 < vis[ni][nj])) {        vis[ni][nj] = vis[p.x][p.y]+1;        q.add(new Pair(ni, nj));       }      }          }    }    boolean isValid(int i, int j) {     return i >= 0 && i < n && j >= 0 && j < e;    }   }  }  static class InputReader {   BufferedReader br;   StringTokenizer st;     public InputReader(InputStream i) {    br = new BufferedReader(new InputStreamReader(i), 32768);    st = null;   }   public InputReader(FileReader s) {    br = new BufferedReader(s);    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());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    try {     return br.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }  }  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();   }  } }
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 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(); }  }
5	public class A {   public static void main(String[] args) {  Scanner s = new Scanner(new InputStreamReader(System.in));  int n = s.nextInt();  int [] ar = new int[n];  for (int i = 0; i < n ; i++) {  ar[i] = s.nextInt();  }  if(ar.length == 1){  System.out.println("NO");  }else{  Arrays.sort(ar);  int num = ar[0];  boolean flag = false;  for (int i = 1; i < ar.length; i++) {   if(ar[i]!= num){   System.out.println(ar[i]);   flag = true;   break;   }  }  if(!flag)   System.out.println("NO");  }  } }
0	public class Main2 {   public static void main(String args[]){   Scanner input = new Scanner(System.in);   String st = input.nextLine();   System.out.println(bank(st));   }     public static int bank(String st){   StringBuilder sb = new StringBuilder(st);   int st1 = Integer.parseInt(sb.substring(0,st.length()-2)+sb.substring(st.length()-1,st.length()));   int st2 = Integer.parseInt(sb.substring(0,st.length()-1));   int st3 = Integer.parseInt(st);   return Math.max(st3,Math.max(st1, st2));   }  }
1	public class B {  public static void main(String[] args) throws IOException {   new B().solve();  }  void solve() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   int n = Integer.parseInt(in.readLine());   while (n-- > 0) {    String s = in.readLine();    int pr = s.indexOf('R');    int pc = s.indexOf('C');    if (pr == 0 && pc > 1 && Character.isDigit(s.charAt(1))) {     int r = Integer.parseInt(s.substring(1, pc));     int c = Integer.parseInt(s.substring(pc + 1, s.length()));     out.println(i2s(c) + r);    } else {     int i = 0;     while (!Character.isDigit(s.charAt(i))) ++i;     out.println("R" + Integer.parseInt(s.substring(i, s.length())) + "C" + s2i(s.substring(0, i)));    }   }   out.close();  }  int s2i(String s) {   int r = 0;   for (int i = 0; i < s.length(); ++i) {    r = r * 26 + (s.charAt(i) - 'A' + 1);   }   return r;  }  String i2s(int i) {   StringBuffer s = new StringBuffer();   while (i > 0) {    i -= 1;    s.append((char)('A' + (i % 26)));    i /= 26;   }   return s.reverse().toString();  }  BufferedReader in;  PrintWriter out; }
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);  }  }
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 testCases = 1;   Task solver = new Task();   for (int i = 1; i <= testCases; ++i)    solver.solve(in, out);   out.close();  } } class Task {  public void solve(Scanner in, PrintWriter out) {   int n = in.nextInt();   int a = in.nextInt();   int b = in.nextInt();   int[] complexity = new int[n];   for (int i = 0; i < n; ++i)    complexity[i] = in.nextInt();   Arrays.sort(complexity);   out.println(complexity[b] - complexity[b - 1]);  } }
1	public class B {  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 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 boolean isPrime(int n) {     if(n==1)   {    return false;   }   if(n==2)   {    return true;   }   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 boolean[] sieveOfEratosthenes(int n)  {          boolean prime[] = new boolean[n+1];   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*p; i <= n; i += p)      prime[i] = false;    }   }   return prime;  }   public static void main(String[] args) {   StringBuilder ans = new StringBuilder();   int t = ri();   while (t-- > 0)   {    long n=rl();    if(n%2==1)    {     ans.append("NO\n");     continue;    }    if(n%4==0)    {     long val = n/4;     long sq = (long) Math.sqrt(val);     if(sq*sq == val)     {      ans.append("YES\n");      continue;     }    }    if(n%2==0)    {     long val = n/2;     long sq = (long) Math.sqrt(val);     if(sq*sq == val)     {      ans.append("YES\n");      continue;     }    }    ans.append("NO\n");   }   out.print(ans.toString());   out.flush();  }  }
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[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = in.readInt();  boolean odd = a[0] % 2 + a[1] % 2 + a[2] % 2 >= 2;  for (int i = 0; i < n; i++) {  if (a[i] % 2 == 1 && !odd)   out.println(i + 1);  if (a[i] % 2 == 0 && odd)   out.println(i + 1);  }  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') {   if (c == 'e' || c == 'E') {    int e = readInt();    return res * Math.pow(10, e);   }   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') {    int e = readInt();    return res * Math.pow(10, e);   }   if (c < '0' || c > '9')    throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();   }  }  return res * sgn;  } } }
0	public class A { 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()); } public static void main(String[] args) throws Exception{  long a = readLong();  long b = readLong();   System.out.println(rec(a,b));  }  private static long rec(long a, long b) {  if(a == 1){  return b;  }  if(a >= b){  return a/b + rec(a%b, b);  }  return rec(b, a); } }
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);   BObtainingTheString solver = new BObtainingTheString();   solver.solve(1, in, out);   out.close();  }  static class BObtainingTheString {   public void solve(int testNumber, FastScanner br, PrintWriter pw) {    int n = br.nextInt();    String s = br.nextString();    String t = br.nextString();    char[] sarr = new char[n];    char[] tarr = new char[n];    int[] sAppear = new int[26];    int[] tAppear = new int[26];    for (int i = 0; i < s.length(); i++) {     sarr[i] = s.charAt(i);     tarr[i] = t.charAt(i);     sAppear[s.charAt(i) - 'a']++;     tAppear[t.charAt(i) - 'a']++;    }    for (int i = 0; i < 26; i++) {     if (sAppear[i] != tAppear[i]) {      pw.println(-1);      pw.close();     }    }    ArrayList<Integer> ans = new ArrayList<Integer>();    for (int i = 0; i < n; i++) {     char curr = tarr[i];     for (int j = i + 1; j < n; j++) {      if (sarr[j] == curr) {       for (int k = j; k > i; k--) {        ans.add(k);        char temp = sarr[k - 1];        sarr[k - 1] = sarr[k];        sarr[k] = temp;       }       break;      }     }    }    pw.println(ans.size());    for (int e : ans) {     pw.print(e + " ");    }    pw.close();   }  }  static class FastScanner {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private FastScanner.SpaceCharFilter filter;   public FastScanner(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 String nextString() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     if (Character.isValidCodePoint(c)) {      res.appendCodePoint(c);     }     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   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);   }  } }
1	public class A implements Runnable{ public static void main (String[] args) {new Thread(null, new A(), "_cf", 1 << 28).start();}  public void run() {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  System.err.println("Go!");  int n = fs.nextInt();  int d = fs.nextInt();  int[] a = fs.nextIntArray(n);  sort(a);  long res = 0;  if(n == 1) {  System.out.println(2);  return;  }  HashSet<Integer> set = new HashSet<>();  for(int i = 0; i < n; i++) {  int one = a[i] - d;  int min = Integer.MAX_VALUE;  for(int j = 0; j < n; j++) {   int dist = Math.abs(a[j] - one);   min = Math.min(min, dist);  }  if(min == d) set.add(one);  one = a[i] + d;  min = Integer.MAX_VALUE;  for(int j = 0; j < n; j++) {   int dist = Math.abs(a[j] - one);   min = Math.min(min, dist);  }  if(min == d) set.add(one);  }  System.out.println(set.size());  out.close(); }  void sort (int[] a) {  int n = a.length;  for(int i = 0; i < 50; i++) {  Random r = new Random();  int x = r.nextInt(n), y = r.nextInt(n);  int temp = a[x];  a[x] = a[y];  a[y] = temp;  }  Arrays.sort(a); }  class FastScanner {  public int BS = 1<<16;  public char NC = (char)0;  byte[] buf = new byte[BS];  int bId = 0, size = 0;  char c = NC;  double num = 1;  BufferedInputStream in;  public FastScanner() {  in = new BufferedInputStream(System.in, BS);  }  public FastScanner(String s) throws FileNotFoundException {  in = new BufferedInputStream(new FileInputStream(new File(s)), BS);  }  public char nextChar(){  while(bId==size) {   try {   size = in.read(buf);   }catch(Exception e) {   return NC;   }       if(size==-1)return NC;   bId=0;  }  return (char)buf[bId++];  }  public int nextInt() {  return (int)nextLong();  }  public long nextLong() {  num=1;  boolean neg = false;  if(c==NC)c=nextChar();  for(;(c<'0' || c>'9'); c = nextChar()) {   if(c=='-')neg=true;  }  long res = 0;  for(; c>='0' && c <='9'; c=nextChar()) {   res = (res<<3)+(res<<1)+c-'0';   num*=10;  }  return neg?-res:res;  }  public double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }  public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }  public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  }   public int[] nextIntArray(int n) {  int[] res = new int[n];  for(int i = 0; i < n; i++) res[i] = nextInt();  return res;  }   } }
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 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();  }  }
4	public class Main { public static void main(String[] args)throws Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringBuilder sb = new StringBuilder();      StringTokenizer st = new StringTokenizer(br.readLine(), " ");  n = pint(st.nextToken());  m = pint(st.nextToken());  k = pint(st.nextToken());      map = new int[n][m][4];  for (int i = 0; i < n; i++) {  st = new StringTokenizer(br.readLine(), " ");  for (int j = 0; j < m-1; j++) {   int temp = pint(st.nextToken());   map[i][j][3]=temp;   map[i][j+1][2]=temp;  }  }  for (int i = 0; i < n-1; i++) {  st = new StringTokenizer(br.readLine(), " ");  for (int j = 0; j < m; j++) {   int temp = pint(st.nextToken());   map[i][j][1]=temp;   map[i+1][j][0]=temp;  }  }   ans = new int[n][m][k/2+1];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   if(k%2==1) {   sb.append("-1 ");   continue;   }     int min=rec(i,j,0,k/2);     sb.append(min*2).append(" ");     }sb.append("\n");  }   System.out.println(sb);   } static int n,m,k;  static int[]dx = {-1,1, 0, 0}; static int[]dy = {0, 0, -1,1}; static int[][][]map; static int[][][]ans;  static int rec(int x, int y, int cost, int cnt) {  if(cnt==0) {  return 0;  }  if(ans[x][y][cnt]!=0)return ans[x][y][cnt];   int temp=Integer.MAX_VALUE;  for (int i = 0; i < 4; i++) {  int tx=x+dx[i], ty=y+dy[i];    if(tx<0||tx>=n||ty<0||ty>=m)continue;    if(map[x][y][i]!=0) {   temp=Math.min(temp, rec(tx, ty, cost, cnt-1)+map[x][y][i]);  }  }  ans[x][y][cnt]=temp;   return ans[x][y][cnt]; }  static int pint(String s) {  return Integer.parseInt(s); } }
4	public class Main {  void solve() {  int R = sc.nextInt();  int C = sc.nextInt();  int K = sc.nextInt();  int[] x = new int[K];  int[] y = new int[K];  for (int i = 0; i < K; i++) {  x[i] = sc.nextInt();  y[i] = sc.nextInt();  }  int best = -1;  int bestX = 0;  int bestY = 0;  for (int r = 1; r <= R; r++) for (int c = 1; c <= C; c++) {  int here = R + C;  for (int i = 0; i < K; i++) {   int t = abs(r - x[i]) + abs(c - y[i]);   here = min(here, t);  }  if (best < here){   best = here;   bestX = r;   bestY = c;  }  }  out.println(bestX + " " + bestY); }  void print(int[] a) {  out.print(a[0]);  for (int i = 1; i < a.length; i++) out.print(" " + a[i]);  out.println(); }  static void tr(Object... os) {  System.err.println(deepToString(os)); }  public static void main(String[] args) throws Exception {  new Main().run(); }  MyScanner sc = null; PrintWriter out = null; public void run() throws Exception {   sc = new MyScanner(new FileInputStream(new File("input.txt")));  out = new PrintWriter(new File("output.txt"));  for (;sc.hasNext();) {  solve();  out.flush();  }  out.close(); }  class MyScanner {  String line;  BufferedReader reader;  StringTokenizer tokenizer;  public MyScanner(InputStream stream) {  reader = new BufferedReader(new InputStreamReader(stream));  tokenizer = null;  }  public void eat() {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {   try {   line = reader.readLine();   if (line == null) {    tokenizer = null;    return;   }   tokenizer = new StringTokenizer(line);   } catch (IOException e) {   throw new RuntimeException(e);   }  }  }  public String next() {  eat();  return tokenizer.nextToken();  }  public String nextLine() {  try {   return reader.readLine();  } catch (IOException e) {   throw new RuntimeException(e);  }  }  public boolean hasNext() {  eat();  return (tokenizer != null && tokenizer.hasMoreElements());  }  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[] a = new int[n];  for (int i = 0; i < n; i++) a[i] = nextInt();  return a;  } } }
1	public class F {  static void solve() throws Exception {  int n = scanInt();  long l[] = new long[n];  for (int i = 0; i < n; i++) {  l[i] = scanLong();  }  long e1 = 0, e2 = 0, ans = 0;  boolean water = false;  String types = scanString();  for (int i = 0; i < n; i++) {  long li = l[i], cur;  switch (types.charAt(i)) {  case 'G':   cur = min(e1, li);   e1 -= cur;   li -= cur;   e2 += 2 * cur;   ans += 2 * cur;   e2 += li;   ans += 3 * li;   break;  case 'W':   water = true;   e1 += li;   ans += 2 * li;   break;  case 'L':   cur = min(e1, li);   e1 -= cur;   li -= cur;   ans += 2 * cur;   cur = min(e2, li);   e2 -= cur;   li -= cur;   ans += 3 * cur;   ans += (water ? 4 : 6) * li;   break;  default:   throw new AssertionError();  }  }  out.print(ans); }  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);  } } }
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()); } }
1	public class Main {  public static void main(String[] args) {   new Thread(null, new Runnable() {    public void run() {     new Main().solve();    }   }, "1", 1 << 26).start();  }  void solve() {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   ACodehorsesTShirts solver = new ACodehorsesTShirts();   solver.solve(1, in, out);   out.close();  }  static class ACodehorsesTShirts {   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    ArrayList<String>[] arrayLists = new ArrayList[5];    ArrayList<String>[] arrayLists1 = new ArrayList[5];    for (int i = 0; i < 5; i++) {     arrayLists[i] = new ArrayList<>();     arrayLists1[i] = new ArrayList<>();    }    for (int i = 0; i < n; i++) {     String s = in.scanString();     arrayLists[s.length()].add(s);    }    for (int i = 0; i < n; i++) {     String s = in.scanString();     arrayLists1[s.length()].add(s);    }    long ans = 0;    for (int i = 0; i < 5; i++) {     for (int diff = 0; diff < 5; diff++) {      for (int j = 0; j < arrayLists[i].size(); j++) {       int min = Integer.MAX_VALUE;       int index = -1;       for (int k = 0; k < arrayLists1[i].size(); k++) {        int tt = 0;        for (int l = 0; l < i; l++)         if (arrayLists[i].get(j).charAt(l) != arrayLists1[i].get(k).charAt(l)) tt++;        if (tt < min) {         min = tt;         index = k;        }       }       if (min == diff) {        arrayLists1[i].remove(index);        ans += min;       }      }     }    }    out.println(ans);    }  }  static class ScanReader {   private byte[] buf = new byte[4 * 1024];   private int index;   private BufferedInputStream in;   private int total;   public ScanReader(InputStream inputStream) {    in = new BufferedInputStream(inputStream);   }   private int scan() {    if (index >= total) {     index = 0;     try {      total = in.read(buf);     } catch (Exception e) {      e.printStackTrace();     }     if (total <= 0) return -1;    }    return buf[index++];   }   public int scanInt() {    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();     }    }    return neg * integer;   }   public String scanString() {    int c = scan();    if (c == -1) return null;    while (isWhiteSpace(c)) c = scan();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = scan();    } while (!isWhiteSpace(c));    return res.toString();   }   private boolean isWhiteSpace(int n) {    if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;    else return false;   }  } }
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();  } }
1	public class Main {  static class Scanner {   StringTokenizer st;   BufferedReader br;   public Scanner(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }   public Scanner(FileReader fileReader) {    br = new BufferedReader(fileReader);   }   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 boolean ready() throws IOException {    return br.ready();   }  }  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);PrintWriter pw = new PrintWriter(System.out);   int n=sc.nextInt(),d=sc.nextInt();int[] a = new int[n];int ans=2;a[0]=sc.nextInt();   for (int i=1;i<n;i++){    a[i]=sc.nextInt();    if (a[i]-a[i-1]==2*d)ans++;    else if (a[i]-a[i-1]>2*d)ans+=2;   }   System.out.println(ans);  } }
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)); } }
0	public class TaskA implements Runnable {  @Override public void run() {  InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  int n = in.readInt();  if (n > 0) {  out.println(n);  }  else {  int nn = -n;  int x = nn/10;  int lastDigit = nn%10;  int y = 10*(x/10) + lastDigit;  x = -x;  y = -y;  out.println(x > y ? x : y);  }  out.flush(); }  public static void main(String[] args) {  new TaskA().run(); }  private class InputReader {    public BufferedReader reader;  public 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 readInt() {   return Integer.parseInt(next());  }   } }
1	public class CF1082D { public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  StringTokenizer st = new StringTokenizer(br.readLine());  int[] aa = new int[n];  int[] i1 = new int[n];  int[] i2 = new int[n];  int n1 = 0, n2 = 0, m2 = 0;  for (int i = 0; i < n; i++) {  int a = Integer.parseInt(st.nextToken());  aa[i] = a;  if (a == 1)   i1[n1++] = i;  else {   i2[n2++] = i;   m2 += a;  }  }  if (m2 < (n2 - 1) * 2 + n1) {  System.out.println("NO");  return;  }  int m = n2 - 1 + n1;  int d = n2 - 1 + Math.min(n1, 2);  PrintWriter pw = new PrintWriter(System.out);  pw.println("YES " + d);  pw.println(m);  for (int i = 0; i + 1 < n2; i++) {  pw.println((i2[i] + 1) + " " + (i2[i + 1] + 1));  aa[i2[i]]--; aa[i2[i + 1]]--;  }  if (n1 > 0) {  while (n2 > 0 && aa[i2[n2 - 1]] == 0)   n2--;  pw.println((i2[n2 - 1] + 1) + " " + (i1[n1 - 1] + 1));  aa[i2[n2 - 1]]--;  n1--;  }  for (int i = 0, j = 0; j < n1; j++) {  while (aa[i2[i]] == 0)   i++;  pw.println((i2[i] + 1) + " " + (i1[j] + 1));  aa[i2[i]]--;  }  pw.close(); } }
0	public class Main{ public static void main(String args[]){  Scanner in = new Scanner(System.in);  int a[]={4,7,44,47,74,77,444,447,474,477,744,747,774,777};  int n=in.nextInt();  int i=0;  boolean yes=false;  while((i<14)&&(a[i]<=n)){  if(n%a[i]==0){   System.out.print("YES");   yes=true;   break;  } i++;  }  if(!yes)  System.out.print("NO"); } }
5	public class Solution implements Runnable {        public void solve() throws Exception {   int n = sc.nextInt();   int a[] = new int[n];   int s = 0;   for (int i = 0;i < n; ++ i) {    a[i] = sc.nextInt();    s += a[i];   }   Arrays.sort(a);   int s2 = 0;   for (int i = n - 1;i >= 0; -- i) {    s2 += a[i];    if (s2 > s - s2) {     out.println(n - i);     break;    }   }    }   class Pair implements Comparable<Pair> {     int x;   int y;     public Pair() {      }     public Pair(int x, int y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(Pair arg0) {    if (x == arg0.x)     return y - arg0.y;    return x - arg0.x;   }  }           static String filename = "";  static boolean fromFile = false;   BufferedReader in;  PrintWriter out;  FastScanner sc;   public static void main(String[] args) {   new Thread(null, new Solution(), "", 1 << 25).start();  }   public void run() {   try {    init();    solve();   } catch (Exception e) {    throw new RuntimeException(e);   } finally {    out.close();   }  }   void init() throws Exception {   if (fromFile) {    in = new BufferedReader(new FileReader(filename+".in"));    out = new PrintWriter(new FileWriter(filename+".out"));   } else {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);   }   sc = new FastScanner(in);  } } 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());  }   public BigInteger nextBigInteger() throws IOException {   return new BigInteger(nextToken());  }   public BigDecimal nextBigDecimal() throws IOException {   return new BigDecimal(nextToken());  } }
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); } }
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(); }  int[] A; int N;  public void solve() {  int tc = 1;  for (int cas = 1; cas <= tc; cas++) {  N = in.readInt();  A = new int[N];   for(int i =0;i<A.length;i++){   String str = in.readString();   if(str.equals("f"))   A[i] = 1;  }    long[][] dp = new long[N+1][N+1];    for(int i=0;i<N;i++){   if(i==0){   dp[i][0] = 1;   }   else if(A[i-1]!=1){   dp[i][N] = dp[i-1][N];   for(int j=N-1;j>=0;j--){       dp[i][j] = (dp[i-1][j] + dp[i][j+1])%MOD;   }   }   else{   for(int j=1;j<=N;j++){    dp[i][j] = dp[i-1][j-1]%MOD;   }   }  }    long res = 0;  for(int i=0;i<=N;i++){   res = (res + dp[N-1][i])%MOD;  }  out.println(res);  }  } } 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); } }
6	public class E1 { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  for(int T = ni();T > 0;T--){  int n = ni(), m = ni();  int[][] a = new int[n][];  for(int i = 0;i < n;i++)a[i] = na(m);    int[][] sss = new int[1<<n][m];  for(int i = 1;i < 1<<n;i+=2){   int[] ss = new int[m];   for(int j = 0;j < m;j++){   int cur = i;   int lmax = 0;   for(int sh = 0;sh < n;sh++){    int s = 0;    for(int k = 0;k < n;k++){    if(cur<<~k<0){     s += a[k][j];    }    }    lmax = Math.max(lmax, s);    cur = cur>>>1|(cur&1)<<n-1;   }   ss[j] = lmax;   }   sss[i] = ss;  }  ptns = new HashMap<>();  dfs(new int[n], 0, -1);  int ans = 0;  if(n == 4 && m >= 4){   int[] one = Arrays.copyOf(sss[1], m);   Arrays.sort(one);   ans = one[m-1] + one[m-2] + one[m-3] + one[m-4];  }    for(int[] cs : ptns.values()){   if(cs.length == 4)continue;   int[] u = new int[cs.length];   inner:   do{   for(int i = 0;i < cs.length;i++){    for(int j = i+1;j < cs.length;j++){    if(u[i] == u[j])continue inner;    }   }   int val = 0;   for(int i = 0;i < cs.length;i++){    val += sss[cs[i]][u[i]];   }   ans = Math.max(ans, val);   }while(inc(u, m));  }  out.println(ans);  } }  public static boolean inc(int[] a, int base) {  int n = a.length;  int i;  for (i = n - 1; i >= 0 && a[i] == base - 1; i--)  ;  if (i == -1)  return false;  a[i]++;  Arrays.fill(a, i + 1, n, 0);  return true; }   Map<Long, int[]> ptns = new HashMap<>();   void dfs(int[] a, int pos, int max) {  if(pos == a.length){  int[] ptn = new int[max+1];  int n = a.length;  for(int i = 0;i < n;i++){   ptn[a[i]] |= 1<<i;  }  for(int i = 0;i <= max;i++){   ptn[i] = ptn[i]>>>Integer.numberOfTrailingZeros(ptn[i]);  }       Arrays.sort(ptn);  long h = 0;  for(int v : ptn){   h= h * 1000000009 + v;  }   ptns.put(h, ptn);  return;  }   for(int i = 0;i <= max+1;i++){  a[pos] = i;  dfs(a, pos+1, Math.max(i, max));  } }  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 E1().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)); } }
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 a = in.nextLong();   long b = in.nextLong();   long ans = 0;   while (a > 0 && b > 0){    if (a < b){     long t = a;     a = b;     b = t;    }    ans += a/b;    a %= b;   }   out.print(ans);  } } 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 long nextLong(){   return Long.parseLong(next());  }  }
5	public class Main{  public static void main(String[] args){   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int a = in.nextInt();   int b = in.nextInt();     int[] h = new int[3000];     for(int i = 0; i<n; i++)    h[i] = in.nextInt();     int l = 0, r = 1000000000, m = 0;   int ansl = 0, ansr = 0;     while(l<=r){    m = (l+r)/2;       int ca=0;       for(int i = 0;i<n;i++)     if (h[i]>m) ca++;       if (ca == a) ansl=m;    if (ca <= a) r=m-1; else l=m+1;   }   l = 0; r = 1000000000;   while(l<=r){    m = (l+r)/2;       int ca=0;       for(int i = 0;i<n;i++)     if (h[i]>m) ca++;       if (ca == a) ansr=m;    if (ca < a) r=m-1; else l=m+1;   }   if (ansl == 0 || ansr==0) System.out.print(0); else   System.out.print(ansr-ansl+1);  } }
