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); } }
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();  } }
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();  } }
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();   }  } }
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 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); } }
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);   }  } }
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();  } }
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;   }     }
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();  } }
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() );   }  } }
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 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();  } } }
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;   }  } }
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 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());  } }
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(); }  }
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;   }   } }
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();  }  }
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);   }  } }
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;  } }
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]);      } }
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;  }
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 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 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);   } }
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; } }
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	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());  } } }
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	@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)); } }
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);  } }
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	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();  } }
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;   }  } }
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;  } }
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();  } }
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();     }   }
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)); } }
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 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	@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();  } }
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);  } }
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);  } }
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);   }  } }
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();  } }
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 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 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)); } }
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); } }
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(); } }
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)); }
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());  } } }
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();} }
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); } }
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());   }  } }
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;  } }
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 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());  } }
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 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;    }   }  } }
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();  } }
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;  } }
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 + " ");   }  } }
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 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);    }  }
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();  } }
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());  } }
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); } }
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);  } }
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; } }
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 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 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(); } }
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; } }
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(),"")));  }  } } }
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);  } }
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());  } }
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;  }   }
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);                                          } }
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();  } }
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 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"); } }
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);    }   }    } }
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(); } }
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); }  }
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(); } }
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;   } }
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 + " ");   }  } }
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);   }    } }
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()); } }
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); }  }
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();  } }
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);  } }
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;  }  } } }
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);   }  } }
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);  } }
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();  } }
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;  } }
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();}  } }
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);  } }
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);   }  } }
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 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();  } }
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);   }   }
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); } }
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();  } }
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);  } }
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());  } }
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()); } } }
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();  } }
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();  } }
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);  } }
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; } }
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());  }  } }
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(); } }
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)); } }
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;  } }
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); } }
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);  } }
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();   }  } }
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);  } }
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;   }  } }
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();  } } }
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;    }   }    } }
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 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); } }
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)));  } }
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 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); } }
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 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(); } }
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(); } }
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 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';  } }
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());  }  }
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)));  } }
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");  }    }  } }
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());  } } }
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");  } }
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());  } }
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; }  }
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);   }  } }
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();  } }
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); } }
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());  } }
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 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);  } }
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)));  } }
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();  } }
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(); } }
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);  } } }
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());   }  } }
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();  } }
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(); } }
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();  } }
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));   }  } }
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 + ")");  }  } }
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());   }  } }
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 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;  } } }
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(); } }
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 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");  } } }
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;   }  } }
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[]){  } }
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());   }  } }
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 {     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;   }  } }
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());  } }  }
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() );  } }
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());   }  } }
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; } }
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);   }  } }
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();  } }
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 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(); } }
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()); } }
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;   }  } }
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) 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); } }
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 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(); } }
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());  } }
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();  } }
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());   }  } }
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 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;  }  } }
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();  } }
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);   }  } }
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());  } } }
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(); } }
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());  } } }
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;   } }
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]);  } }
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]); } }
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;  }  }
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;  } } }
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();  } }
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)); }
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();  }  }
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) {   }  } }
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;   }  } }
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 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;   }    } }
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)); } }
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);  } }
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();   }  } }
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);  } } }
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	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 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) ); } }
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()); } }
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());  } }
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(); } }
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);   }  } }
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; }  } }
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());   }  } }
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;  } } }
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();  }  } }
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;   }  } }
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 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(); } }
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) {  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]);  } }
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 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();   }  } }
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);   }  } }
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");    }   }  } }
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;   }  }  }
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;  } }
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);  } } }
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;  } } }
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 { 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;  }     }
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(); } }
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 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(); } }
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();  } }
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));  } }
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; } }
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));  } }
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); } }
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)); } }
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 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);   }  } }
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;   }  } }
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);   }  } }
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()); } }
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; } }
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;  } }
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();  } }
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());   }  } }
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(); } }
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]);  }   } }
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]); } }
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]);  } }
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(); } }
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;  } }
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 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);  } }
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();  } }
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)); } }
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;  }   }
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();}}   }  }
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;  } } }
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 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();  } }
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);  } }
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());  }  } }
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]);  } }
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;   }  } }
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();     } }
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;   }    } }
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);  } }
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(); } }
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());   }  } }
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;  } }
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;  } }
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;                 }    } }
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());   }       } }
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));   }  }
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]));  } }
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()); } }
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);  }  }
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); } }
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(); }   } }
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;   }  } }
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;  } } }
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 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();  } }
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;  }  } }
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 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)); }
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;    }   }  } }
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); } }
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)));         } }
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 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;  } } }
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);  } }
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;   }  } }
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;   }  } }
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();  } }
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);   }  }
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 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);  } }
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(); } }
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 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());   }  } }
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;     }    }   }  } }
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);    }   }  } }
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);  } } }
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 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)));  } } }
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();  } }
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);  }  }
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() );   }  } }
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) 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 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 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);  } }
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();   }   } }
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(); } }
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;   }  } }
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 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());  } } }
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());  } } }
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;  }  } } }
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); } }
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();  } }
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;  } }
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(); } }
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; }
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);  } }
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(); } }
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 {  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 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;   }  } }
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(); }  }
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); } }
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();   }  } }
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);  } }
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;   }  } }
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); } }
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);  } }
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();  } }
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()); } }
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 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 }; }
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);  } }
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 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();  } }
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);  } } }
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());   }  } }
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();  }   }
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;  } }
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(); } }
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(); }  }
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);  }  } } }
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);  } }
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++;   }  } }
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 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();  } }
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);   }  } }
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());  }  }
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 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); } }
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 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);     }  }
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());  } }
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);  }  }
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; }
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 { 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; } }
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)); }
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;   }  } }
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);  } }
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];     }    }   }  } }
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());  } }
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();  } }
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());   }  } }
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;   }  } }
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 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());  } }
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 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);  } }
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));  } }
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();  } }
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;  } }
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());  } }
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);   }  } }
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);  } }
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");  } } }
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 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 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());  } }
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();  } }
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;   }  } }
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;  }  } }
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 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); } }
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; } }
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();    }   }  } }
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 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();   } }
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();   }  } }
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;    }   }  } }
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));  } }
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");  } } }
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 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) {  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()); } }
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());  } }
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 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;}}   }
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;  } }
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);  } }  }
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();  }  } }
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;  } }
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;   }  } }
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);   } }
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(); } }
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());   }  } }
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); } }
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();    }   }  } }
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 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());   }  } }
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)); } }
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);   }  } }
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)); } }
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);   }  } }
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; } }
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 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 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); } }
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());  } }
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 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)); }
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;   }    } }
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(); } }
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();  } }
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); } }
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 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 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 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;     }    }   }
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));  } }
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();  } }
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);       } }
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);  } }
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);  } }
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);   }  } }
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 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 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);  } }
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 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();  } }
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); } }
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));  } }  }
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;  } }  }
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);   }  }
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);  } }
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;   }  }  }
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 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(); }  }  }
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);         } }
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;  } }
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;  } }
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; } }
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]; } }
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(); } }
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); } }
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(); } }
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();   }  } }
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 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(); } }
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;    }   }   } }
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;  } } }
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 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; }  }
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);   }  } }
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;   }  } }
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 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(); } }
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; } }
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();  } } }
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(); } }
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);       }   }  } }
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);  } }
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 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;  }  } }
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;  }  }
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()); } }
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());  } }
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; } }
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; } }
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()) ;  } } }
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); } }
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 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(); } }
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);  } }
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();}}   }  }
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) {  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]); } }
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 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();  } }
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 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++]);   }  } }
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 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();  } } }
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 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;  } }
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 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);  } }
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;    } }
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 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 {  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;}}   }
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));  } }
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);  } }
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);   }  }
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();  } }
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)); } }
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();  } }
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(); } }
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); }  }
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;  } }
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 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));  } }  }
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);  } }
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;  } }
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;   }  } }
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 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());  } }  }
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;  } }
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];   }  }    }
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);  } }
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 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;  } }
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;  }  } }
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);   } }
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;   }  } }
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 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 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 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();   }  }  }
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; } }
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);  }    } } }
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);  } }
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();   }   }  }
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)); } }
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); } }
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;  } } }
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(); } }
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;   }  } }
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);  } }
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();  } }
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;   }  } }
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);   }  } }
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 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());  } }
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());   }  } }
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 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);  } }
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");  } }
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 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(); } }
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;   }  } }
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(); } }
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();   }  } }
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());  } }  }
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));   }    } }
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();  } }
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());   }  } }
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();    }   }  } }
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;  } } }
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);  } }
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(); } }
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();} }
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;   }  } }
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();  } }
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 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;  } }
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;  }  }
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();  } }
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(); } }
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();  } }
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)));  } }
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 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();   }  } }
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;  } }
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);  } }
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();   }  } }
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 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);  } }
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();   } }
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 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;  }  }
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;  }  }
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) 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);  } }
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(); } }
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);  } }
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();  }  } }
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 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 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));   }  } }
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);   } }
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();  } }
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);       }       }     }
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);  } }
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();   } }
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));  } } }
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]);  } }
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()); } }
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); } }
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); } }
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();  } }
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 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 {  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 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 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();   }  } }
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); } }
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(); }   } }
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); } }
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();  } }
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; }  }  }
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(); } }
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);   }    }    } }
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");   }  } }
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();  } }
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(); } }
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));   }  }
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 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 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);  } }
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 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);   } }
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]);       } }
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));   }  }
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;  } }
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();  } }
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();  }  }
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();  } }
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;   }  } }
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);   }  } }
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); } }
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();   }  } }
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());  } } }
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);  }  } }
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; } }
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); } }
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;   }  }  }
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); } }
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)); }
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);  } }
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 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 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());  } }
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());  }   } }
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);  } }
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));    }  }
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());  } }
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; }  }
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());   }  } }
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()); } }
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);  }  }
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); } }
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());  }  }
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();  } }
