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 ; static private 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());} String nextToken()throws IOException { while(((tokenizer == null) || !tokenizer.hasMoreTokens())){tokenizer = new StringTokenizer(reader.readLine()); }return tokenizer.nextToken();} }
4	public class D{ static private ArrayDeque<Integer>[][] edge ; static private long[][] dp[] ,w1 ,w2 ; static private int N ,M ,K ; static private 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); } static private 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());} } }
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{ public static int gcd( int a, int b){ if ( (a == 0)) return b; return gcd((b % a),a);} static int[] dis ; static int mod = 1000000007; static ArrayList<ArrayList<Integer>> graph ; 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;} public static 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 void pln( String value){ System.out.println(value); } public static int i(){ return in.Int();} } 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 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 close(){ writer.close(); } public void flush(){ writer.flush(); } }
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());} } 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());} } }
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; } }
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());} long nextLong(){ return Long.parseLong(next());} } static class FastOutput implements AutoCloseable,Closeable,Appendable{ static private 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; } 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();} long nextLong(){ return Long.parseLong(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());} }
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)))); }}} static private 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;} static private 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++; }} static private 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());} } }
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; }} }
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)])); } static private StreamTokenizer in ; static private PrintWriter out ; static private BufferedReader inB ; static private boolean FILE = false; static private int nextInt()throws Exception { in.nextToken(); return (int)in.nval;} {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); }static private void println( Object o)throws Exception { out.println(o); out.flush(); } static private void exit( Object o)throws Exception { println(o); exit(); } static private void exit(){ System.exit(0); } static private final int INF = Integer.MAX_VALUE; static private 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 class result implements Comparable{ public int t = 0; public int p = 0; public result( int p, int t){ this.t = t; this.p = p; } } 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());} } }
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 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());} 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());} } }
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(); } 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());} static long gcd( long a, long b){ if ( (b == 0)) return a; return gcd(b,(a % b));} 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);} }
1	class Parser{ private final 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 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;} 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{ private final 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(){}).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)); } Long nextLong(){ return Long.parseLong(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 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 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{ static private 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;} static private 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;} static private 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();} } 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{ static private 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)])); } @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 flush(){ out.flush(); } public int nI()throws IOException { in.nextToken(); return (int)in.nval;} } }
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 int nextInt()throws IOException { return Integer.parseInt(next());} } }
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); } 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(); } 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());} } 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){ } } } interface Solver{ public void solve( int testNumber, InputReader in, PrintWriter out); } 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;} } 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;} } 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>(); 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 exit( boolean b){ if ( !b) System.exit(0); } 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 find( int[] set, int u){ return set[u] = ((set[u] == u)?u:find(set,set[u]));} 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 pn( Object... o){ for ( int i = 0;(i < o.length);i++) out.print((o[i] + (((i + 1) < o.length)?" ":"\n"))); } 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;} } }
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 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 int MAX = 1500; static int prime[] ,countdiv[] ; 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;} 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 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 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 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{ static private InputReader in ; static private 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));} }
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)); } 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 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(); } 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();} long nextLong(){ return Long.parseLong(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 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());} } 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());} } }
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)); } 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 int nextInt(){ return Integer.parseInt(next());} public long nextLong(){ return Long.parseLong(next());} public double nextDouble(){ return Double.parseDouble(next());} public int[] nextIntArray( int n){ int[] a = new int[n]; for ( int i = 0;(i < n);i++) a[i] = nextInt(); return a;} }
3	public class q1{ static int MOD = 1000000007; 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());} }
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());} 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{ private final 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 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;} 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;} }
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());} 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 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());} }
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());} } 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(); } static private long numDigit( long ans){ long sum = 0; while((ans > 0)){sum++; ans /= 10; }return sum;} static private 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);} static private 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 private boolean isSorted( long[] arr){ for ( int i = 1;(i < arr.length);i++) {if ( (arr[i] < arr[(i - 1)])) {return false;} }return true;} 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;} static private 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 private int highestOneBit( long n){ long x = Long.highestOneBit(n);  int c = 0; while((x > 0)){x = (x / 2); c++; }return (c - 1);} static int par ; static private 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;} 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 private 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;} }
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(); } }
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)))))); }} static private PrintWriter out = new PrintWriter(System.out); static private BufferedReader inB = new BufferedReader(new InputStreamReader(System.in)); static private StreamTokenizer in = new StreamTokenizer(inB); static private void exit( Object o)throws Exception { out.println(o); out.flush(); System.exit(0); } static private void println( Object o)throws Exception { out.println(o); out.flush(); } static private void print( Object o)throws Exception { out.print(o); out.flush(); } static private int nextInt()throws Exception { in.nextToken(); return (int)in.nval;} }
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 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(); } static private 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{ static private 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)));}}} static private 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());} }
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;} }
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 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;} public static 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>(){}); 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());} 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 ; }
3	public class Main6{ public static int gcd( int a, int b){ if ( (a == 0)) return b; return gcd((b % a),a);} 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 ; 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;} public static 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 void pln( String value){ System.out.println(value); } public static int i(){ return in.Int();} } 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 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 close(){ writer.close(); } public void flush(){ writer.flush(); } }
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 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());} public static void main( String[] args){ new Start().run(); } public static void mergeSort( int[] a){ mergeSort(a,0,(a.length - 1)); } static private 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); }} } static private 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++]); }}} static private 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); } } 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 int pi( String str){ return Integer.parseInt(str);} 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; } } }
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());} 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();} } InputReader in ; PrintWriter out ; 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(); } 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); } static private 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(); } static private 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{ static private 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 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)); } 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();} int nextInt()throws IOException { return Integer.parseInt(next());} long nextLong()throws IOException { return Long.parseLong(next());} } 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; } } 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>(){}); 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{ static private boolean[][] matrix ; static private 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 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";} 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);} } 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());} long nl(){ return Long.parseLong(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());} long readLong()throws IOException { return Long.parseLong(readString());} 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 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());} } static private final FastReader scanner = new FastReader(); static private final PrintWriter out = new PrintWriter(System.out); public static void main( String[] args){ solve(); out.close(); } static private 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); } static private long nextLong()throws IOException { return Long.parseLong(next());} static private 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(); } } public static void main( String[] args)throws Exception { new Main().run(); } int nextInt(){ return Integer.parseInt(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{ static private BufferedReader in ; static private StringTokenizer st ; static private 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());} }
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;} }
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 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>(){}); 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 static private 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());} } class Num implements Comparable<Num>{ int num ; int freq ; Num( int n){ num = n; freq = 1; } }
6	public class Main implements Runnable{ private void solution()throws IOException { int n = in.nextInt();  int m = in.nextInt();  boolean[][] adj = new boolean[n][n];  long res = 0; for ( int i = 0;(i < m);++i) { int x = in.nextInt();  int y = in.nextInt(); adj[(x - 1)][(y - 1)] = true; adj[(y - 1)][(x - 1)] = true; }for ( int i = 0;(i < n);++i) {for ( int j = (i + 1);(j < n);++j) {if ( adj[i][j]) {--res; } }}for ( int i = 0;(i < n);++i) { long[][] dp = new long[(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)); } 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 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;} 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());} } }
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 int[] nextIntArray( int n){ int[] a = new int[n]; for ( int i = 0;(i < n);i++) a[i] = nextInt(); return a;} } }
1	public class B_14{ @SuppressWarnings 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 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;} } class Pai implements Comparable<Pai>{ int first ; int second ; public Pai( int f, int s){ first = f; second = s; } }
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 ; static private 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());} } }
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;} }
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); } } static private long gcd( long a, long b){ if ( (a == 0)) {return b;} return gcd((b % a),a);} 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());} 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 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 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 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]));} 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 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 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 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 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));} } } }
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());} 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); } } 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); } }
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 long nextLong(){ return Long.parseLong(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());} }
6	public class Main{ 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 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 long[] nla( int n)throws IOException { long[] a = new long[n]; for ( int i = 0;(i < n);i++) a[i] = nl(); return a;} 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); static long gcd( long a, long b){ if ( (b == 0)) return a; return gcd(b,(a % b));} 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 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 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)); } static private 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 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); } static private 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();} long nextLong(){ return Long.parseLong(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 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; 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;} static private 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();} } 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(); } } }
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());} } 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;} } 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());} 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());} } }
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 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 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 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 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 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 Reader{ private final 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 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;} 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 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 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(); }} }
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?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());} } }
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[]>(){}); } 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[]>(){}); } 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());} long nl(){ return Long.parseLong(next());} } }
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());} } }
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(); } }
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[] 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 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); } 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);} 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); } 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());} } 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);} }
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);} static private 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; long timer = System.currentTimeMillis(); 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++];} } 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);} 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;} 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 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 halt( Object... o)throws IOException { if ( (o.length != 0)) println(o); outputWriter.flush(); outputWriter.close(); System.exit(0); } 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 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 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 void flush(){ try{os.write(cache.toString().getBytes(charset)); os.flush(); cache.setLength(0); }catch (IOException e){ throw (new RuntimeException(e));} } } public static class Debug{ private boolean allowDebug ; public Debug( boolean allowDebug){ this.allowDebug = allowDebug; } public void fail(){ throw (new RuntimeException());} private void outputName( String name){ System.out.print((name + " = ")); } } }
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());} 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();} long nextLong()throws NumberFormatException,IOException { return Long.parseLong(nextToken());} }
3	public class Main{ public static void main( String[] args){ new Thread(null,new Runnable(){},"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());} } }
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());} long nextLong(){ return Long.parseLong(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 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 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 private 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 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 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());} }
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 long lpar(){ return Long.parseLong(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 int nextInt(){ return Integer.parseInt(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)])); } static private PrintWriter out ; static private BufferedReader inB ; static private boolean FILE = false; {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(); } }static private StreamTokenizer in = new StreamTokenizer(inB); static private void exit( Object o)throws Exception { out.println(o); out.flush(); System.exit(0); } static private void println( Object o)throws Exception { out.println(o); out.flush(); } static private void print( Object o)throws Exception { out.print(o); out.flush(); } static private int nextInt()throws Exception { in.nextToken(); return (int)in.nval;} }
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); static private 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 boolean space( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
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());} 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)); } 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 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;} 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 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;} private Main getOuterType(){ return this;} } } 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());} 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; } } }
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());} 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 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());} } }
2	public class Solution{ 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 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 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);} 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());} } }
4	public class E{ FastScanner in ; PrintWriter out ; boolean systemIO = true; Random random = new Random(); public void sort( int[][] a){ for ( int i = 0;(i < a.length);i++) {Arrays.sort(a[i]); }} 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 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);} @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 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;} double sq2 = Math.sqrt(2); 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 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 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 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; } @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)));} } int[] fact = new int[1000001]; int[] factInv = new int[1000001]; public class Pair implements Comparable<Pair>{ int x ; int y ; public Pair( int x, int y){ this.x = x; this.y = y; } public Pair clone(){ return new Pair(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;} } HashMap<Integer,Integer> even = new HashMap<>(); HashMap<Integer,Integer> odd = new HashMap<>(); 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 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 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 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();} long nextLong(){ return Long.parseLong(next());} } 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(); }} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); StringTokenizer in = new StringTokenizer(""); String nextToken()throws IOException { while(!in.hasMoreTokens()){in = new StringTokenizer(br.readLine()); }return in.nextToken();} int nextInt()throws IOException { return Integer.parseInt(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 int nextInt()throws IOException { return Integer.parseInt(next());} public boolean ready()throws IOException { return br.ready();} } }
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); 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));} 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 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 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 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); } static private 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());} } }
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();} long nextLong(){ return Long.parseLong(next());} } }
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 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 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(); } 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 pn( Object o){ out.println(o); } int ni()throws Exception { return Integer.parseInt(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)); }}} static private 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); } 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();} }
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());} 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)); }}} }
6	public class Main implements Runnable{ public static void main( String[] args){ new Thread(new Main()).start(); } int nextInt( StreamTokenizer st)throws IOException { st.nextToken(); return (int)st.nval;} 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());} }
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());} public static void main( String[] args){ new Testt().run(); } public static void mergeSort( int[] a){ mergeSort(a,0,(a.length - 1)); } static private 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); }} } static private 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++]); }}} static private 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());} 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);} } }
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 interface IntStream extends Iterable<Integer>,Comparable<IntStream>{ public IntIterator intIterator(); } 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 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(); public default void add( int value){ throw (new UnsupportedOperationException());} public default 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); } 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 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); public default void swap( int first, int second){ if ( (first == second)) {return ;} int temp = get(first); set(first,get(second)); set(second,temp); } public default 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 default void add( int value){ addAt(size(),value); } public default IntList sort( IntComparator comparator){ Sorter.sort(this,comparator); return this;} public default 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 > 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 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())));} this.set((at + shift),value); } };} } 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){ } } } 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 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 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 long[] nextLongArray( int n){ long[] array = new long[n]; for ( int i = 0;(i < n);++i) array[i] = nextLong(); 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());} 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>(){}); 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 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; } } }
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 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();} }
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 long nextLong(){ return Long.parseLong(next());} } static long gcd( long a, long b){ if ( (b == 0)) return a; return gcd(b,(a % b));} 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;} static private 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);} 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 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 Reader{ private final 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 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;} private void fillBuffer()throws IOException { bytesRead = din.read(buffer,bufferPointer = 0,BUFFER_SIZE); if ( (bytesRead == -1)) buffer[0] = -1; } private byte read()throws IOException { if ( (bufferPointer == bytesRead)) fillBuffer(); return buffer[bufferPointer++];} public void close()throws IOException { if ( (din == null)) return ; din.close(); } }
5	public class 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 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 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();} int nextInt(){ return Integer.parseInt(nextToken());} 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 int nextInt()throws IOException { return Integer.parseInt(next());} public boolean ready()throws IOException { return br.ready();} } }
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 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 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 long[] nextLongArray( int n){ long[] array = new long[n]; for ( int i = 0;(i < n);++i) array[i] = nextLong(); 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());} } 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 ; } 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{ static private 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 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]; {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);} 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>(){}); 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;} 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 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 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 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());} }
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;}} static private 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();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} 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());} } }
3	public class Mainm{ static int mod1 = (int)(1e9 + 7); static class Reader{ private final 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; } 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;} 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));} 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 print( String s)throws IOException { writer.write((s + "")); } public void print( char[] c)throws IOException { writer.write(c); } public void close()throws IOException { writer.flush(); writer.close(); } }
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());} String nwrd(){ while(((st == null) || !st.hasMoreTokens()))nline(); return st.nextToken();} 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 ;} }} }
3	public class Loader{ static private final 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{ static private StringTokenizer st ; static private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); static private int nextInt(){ return Integer.parseInt(st.nextToken());} static private 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 long[] nextLongArray( int n){ long[] array = new long[n]; for ( int i = 0;(i < n);++i) array[i] = nextLong(); 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());} } }
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());} } 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 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());} } }
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();} int nextInt(){ return Integer.parseInt(next());} } static final Random random = new Random(); }
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());} }
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))); }}} static private String toRC( int[] a){ return ((("R" + a[0]) + "C") + a[1]);} static private 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]);} static private 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;} static private 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 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 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 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); }
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 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);} } } 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 long nextLong()throws Exception { return Long.parseLong(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 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 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(); } static private 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 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(""); }}} static private 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 int ni()throws IOException { return sc.nextInt();} static long nl()throws IOException { return sc.nextLong();} 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 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 void ol( String x){ out.println(x); } static void ol( int x){ out.println(x); } static class Scanner{ StringTokenizer st ; BufferedReader br ; public Scanner( InputStream s){ br = new BufferedReader(new InputStreamReader(s)); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(next());} public double nextDouble()throws IOException { return Double.parseDouble(next());} public long nextLong()throws IOException { return Long.parseLong(next());} public boolean ready()throws IOException { return br.ready();} } }
2	public class Main{ public static void main( String[] args){ new Thread(null,new Runnable(){},"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 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());} } }
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());} } }
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(); } static private 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); } static private 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];} static private 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]); } static private boolean valid( int y, int x){ return ((((y >= 0) && (x >= 0)) && (y < row)) && (x < col));} static private 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]; }}} static private void fill( int val, int[][] output){ for ( int i = 0;(i < output.length);i++) Arrays.fill(output[i],val); } static private 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); } } }
5	public class Test{ static BufferedReader reader ; static StringTokenizer tokenizer ; static PrintWriter writer ; static int nextInt()throws IOException { return Integer.parseInt(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(); } static private 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)); } 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 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;} }
2	public class Main2{ static class Reader{ private final 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 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;} 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());} 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 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 nextInt()throws IOException { return Integer.parseInt(next());} public boolean ready()throws IOException { return br.ready();} } }
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 int nextInt(){ return Integer.parseInt(next());} } }
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 int nextInt()throws IOException { return Integer.parseInt(next());} public long nextLong()throws IOException { return Long.parseLong(next());} public boolean ready()throws IOException { return br.ready();} } 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; } 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 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)));} }
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;} 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 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(); } BufferedReader br ; StringTokenizer str = new StringTokenizer(""); PrintWriter pw ; public Integer ni(){ return Integer.parseInt(nextToken());} 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 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());} } }
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; } } 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);} 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();} } }
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();} long nextLong(){ return Long.parseLong(next());} }
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 void clear(){ for ( int i = 0;(i < dt.size());i++) dt.get(i).clear(); } public void clear( int v){ dt.get(v).clear(); } 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(); }} } 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>{ } static private final int INF = (int)3e8; static private final long INFL = (long)1e17; static private final int INTMAX = Integer.MAX_VALUE; static private final long LONGMAX = Long.MAX_VALUE; static private final long e97 = 1000000007L; static private final long e99 = 998244353L; static private final double PI = Math.PI; static private int abs( int a){ return ((a >= 0)?a:-a);} static private long abs( long a){ return ((a >= 0L)?a:-a);} static private double abs( double a){ return ((a >= 0.0)?a:-a);} static private int min( int a, int b){ return ((a < b)?a:b);} static private long min( long a, long b){ return ((a < b)?a:b);} static private double min( double a, double b){ return ((a < b)?a:b);} static private int pow2( int num2pow){ if ( (num2pow > 4e4)) throw (new IllegalArgumentException("Input is to Large. Use Long.")); return (num2pow * num2pow);} static private long pow2( long num2pow){ if ( (num2pow > 1e8)) throw (new IllegalArgumentException("Input is to Large. Use PowP.")); return (num2pow * num2pow);} static private int getDigit2( long num2know){ long compare4 = 1L;  int digit = 0; while((num2know >= compare4)){digit++; compare4 = (1L << (long)digit); }return digit;} static private 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;} static private boolean isFlaged( int bit, int pos){ if ( (pos >= 32)) throw (new IllegalArgumentException("Input is to Large.")); return ((bit & (1 << pos)) != 0);} static private boolean isFlaged( long bit, int pos){ if ( (pos >= 64)) throw (new IllegalArgumentException("Input is to Large.")); return ((bit & (1L << (long)pos)) != 0L);} static private int[] Xdir4 = {1,0,0,-1}; static private int[] Ydir4 = {0,1,-1,0}; static private int[] Xdir8 = {1,1,1,0,0,-1,-1,-1}; static private int[] Ydir8 = {1,0,-1,1,-1,1,0,-1}; static private void fill( boolean[] target, boolean reset){ for ( int i = 0;(i < target.length);i++) target[i] = reset; } static private void fill( int[] target, int reset){ for ( int i = 0;(i < target.length);i++) target[i] = reset; } static private void fill( long[] target, long reset){ for ( int i = 0;(i < target.length);i++) target[i] = reset; } static private void fill( char[] target, char reset){ for ( int i = 0;(i < target.length);i++) target[i] = reset; } static private void fill( double[] target, double reset){ for ( int i = 0;(i < target.length);i++) target[i] = reset; } static private 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; }}} static private 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; }}} static private 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; }}} static private 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; }}} static private 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; }}} static private 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; }}}} static private 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; }}}} 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"); } static private 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(); } static private 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(); } static private 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(); } static private 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 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;} static private 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());} } }
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());} }
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 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 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 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 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 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 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 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());} } }
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 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)); } static private 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 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 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);} } }
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();} 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(); } 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)))); } }} } 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 long nextLong(){ return Long.parseLong(next());} public int nextInt(){ return Integer.parseInt(next());} }
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); } }
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());} 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 ; }
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{ } 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{ static private 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[]>(){}); } 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[]>(){}); } 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[] 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());} } }
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());} } 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(); } static private 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 _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 nextInt()throws IOException { return Integer.parseInt(nextToken());} 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);} 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); } 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());} int[] readIntArray( int n){ int[] a = new int[n]; for ( int idx = 0;(idx < n);idx++) {a[idx] = nextInt(); }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 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 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; static private 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 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;} 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 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 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 void flush(){ try{os.write(cache.toString().getBytes(charset)); os.flush(); cache.setLength(0); }catch (IOException e){ throw (new RuntimeException(e));} } } public static class Debug{ private boolean allowDebug ; public Debug( boolean allowDebug){ this.allowDebug = allowDebug; } public void fail(){ throw (new RuntimeException());} private void outputName( String name){ System.out.print((name + " = ")); } } }
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)); } static private 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()); } }
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); } static private 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 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 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());} } }
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{ static private 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());} } 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(); }} static private 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(); } 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());} }
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());} } }
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); } 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());} }
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();} long nextLong(){ return Long.parseLong(next());} } 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 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);} }
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;} }
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)); } 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 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{ 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(); } 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 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>(){}); 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); } } }
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); } } 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 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());} } }
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); } 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();} int nextInt(){ return Integer.parseInt(nextToken());} long nextLong(){ return Long.parseLong(nextToken());} int[] nextIntArray( int n){ int[] res = new int[n]; for ( int i = 0;(i < n);i++) res[i] = nextInt(); return res;} } static class PrefixSums{ long[] sums ; public PrefixSums( long[] sums){ this.sums = sums; } } }
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 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;} 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());} } }
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 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)); } }
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();} int nextInt()throws IOException { return Integer.parseInt(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 class Point{ double x ; double y ; Point( double x, double y){ this.x = x; this.y = 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 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(); } static private 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(); } 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());} }
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;} public static void main( String[] args)throws InterruptedException { Thread thread = new Thread(new Main()); thread.start(); thread.join(); } int nextInt()throws Exception { return Integer.parseInt(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());} } }
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 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 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; } } 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;} } 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;} } 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(); } int ni()throws IOException { return Integer.parseInt(ns());} String ns()throws IOException { while(((tokenizer == null) || !tokenizer.hasMoreTokens()))tokenizer = new StringTokenizer(br.readLine()); return tokenizer.nextToken();} 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); } class Pair implements Comparable<Pair>{ int a ,b ; Pair( int _a, int _b){ a = _a; b = _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 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 int nextInt(){ return Integer.parseInt(next());} } }
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());} } 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{ public static 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)); } static private int lowestBit( int mask){ for ( int i = 0;;++i) {if ( ((mask & (1 << i)) > 0)) {return i;} }} }
3	public class CFA{ static private final String INPUT = ("8\n" + "7 6 5 4 3 2 2 3\n"); static private 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); } 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;} static private int gcd( int a, int b){ BigInteger b1 = BigInteger.valueOf(a);  BigInteger b2 = BigInteger.valueOf(b);  BigInteger gcd = b1.gcd(b2); return gcd.intValue();} static private long gcd( long a, long b){ BigInteger b1 = BigInteger.valueOf(a);  BigInteger b2 = BigInteger.valueOf(b);  BigInteger gcd = b1.gcd(b2); return gcd.longValue();} @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 String next(){ int c = read(); while(isSpaceChar(c))c = read(); StringBuilder res = new StringBuilder(); do {res.appendCodePoint(c); c = read(); }while(!isSpaceChar(c));return res.toString();} } private boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
1	public class p2{ static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static private String ss()throws IOException { return br.readLine();} static private int stoi( String x){ return Integer.parseInt(x);} static private int si()throws IOException { return stoi(ss());} 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 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();} 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); } static private long solve( long n, long k){ return solveEq(1,(-3 - (2 * n)),(((n * n) + n) - (2 * k)));} static private 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());} }
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());} }
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; 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 int ni()throws IOException { return sc.nextInt();} static long nl()throws IOException { return sc.nextLong();} 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(); } }
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();} int nextInt()throws IOException { return Integer.parseInt(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'));} String nextToken()throws IOException { while(!st.hasMoreTokens())st = new StringTokenizer(in.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} String nextLine()throws IOException { st = new StringTokenizer(""); return in.readLine();} }
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());} } }
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 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 int i(){ int c = read(); while(isSpaceChar(c))c = read(); int sgn = 1; if ( (c == '-')) {sgn = -1; c = read(); } int res = 0; do {if ( ((c < '0') || (c > '9'))) throw (new InputMismatchException()); res *= 10; res += (c - '0'); c = read(); }while(!isSpaceChar(c));return (res * sgn);} public boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public boolean isEndOfLine( int c){ return (((c == '\n') || (c == '\r')) || (c == -1));} } 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 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 boolean ready()throws IOException { return br.ready();} } }
4	public class D{ static private long INF = 2000000000000000000L,M = 1000000007,MM = 998244353; static private int N = 0; static private long[][][] dp ; static private long[][] ff ; static private 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(); }} static private 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 void println( Object o){ out.println(o); } static void println(){ out.println(); } static void print( Object o){ out.print(o); } 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 long max( long x, long y){ return Math.max(x,y);} static long min( long x, long y){ return Math.min(x,y);} public static int gcd( int a, int b){ BigInteger b1 = BigInteger.valueOf(a);  BigInteger b2 = BigInteger.valueOf(b);  BigInteger gcd = b1.gcd(b2); return gcd.intValue();} public static long gcd( long a, long b){ BigInteger b1 = BigInteger.valueOf(a);  BigInteger b2 = BigInteger.valueOf(b);  BigInteger gcd = b1.gcd(b2); return gcd.longValue();} static class FastScanner{ BufferedReader br ; StringTokenizer st ; FastScanner()throws FileNotFoundException{ br = new BufferedReader(new InputStreamReader(System.in)); } FastScanner( int a)throws FileNotFoundException{ br = new BufferedReader(new FileReader("input.txt")); } String next()throws IOException { while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} long nextLong()throws IOException { return Long.parseLong(next());} } }
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(); } static private class SimpleScanner{ static private 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()); } 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());} } }
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[]>(){}); 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 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;} 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(); } }
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;} }
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());} static Throwable sError ; public static void main( String[] args)throws Throwable { Thread t = new Thread(new Main()); t.start(); t.join(); if ( (sError != null)) {throw (sError);} } }
5	public class 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)); } static private 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();} 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)); } 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 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(); } }
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());} 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 ; }
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 pn( Object o){ out.println(o); } int ni()throws Exception { return Integer.parseInt(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 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 Reader{ private final 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 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;} 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(); } }
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(){},"1",(1 << 26)).start(); } 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 min( int a, int b){ if ( (a > b)) {return b;} else {return a;}} static long min( long a, long b){ if ( (a > b)) {return b;} else {return a;}} 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 long[] nextLongArray( int n){ long a[] = new long[n]; for ( int i = 0;(i < n);i++) {a[i] = nextLong(); }return a;} public boolean isSpaceChar( int c){ if ( (filter != null)) return filter.isSpaceChar(c); return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} 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 long nextLong()throws IOException { return Long.parseLong(next());} public static void main( String[] args){ Locale.setDefault(Locale.UK); new Thread(new Main()).start(); } }
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;} 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 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; } } }
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 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)));} 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())); } static private 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(); } }
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 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());} } }
5	public class A implements Runnable{ final boolean ONLINE_JUDGE = (System.getProperty("ONLINE_JUDGE") != null); BufferedReader in ; PrintWriter out ; StringTokenizer tok ; String readString()throws IOException { while(!tok.hasMoreTokens()){tok = new StringTokenizer(in.readLine()); }return tok.nextToken();} int readInt()throws IOException { return Integer.parseInt(readString());} public static void main( String[] args){ new Thread(null,new A(),"",((256 * 1024) * 1024)).start(); } 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 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 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 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());} } }
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); } static private 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 int nextInt()throws IOException { return Integer.parseInt(next());} 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());} public static void main( String[] args){ new Start().run(); } public static void mergeSort( int[] a){ mergeSort(a,0,(a.length - 1)); } static private 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); }} } static private 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++]); }}} static private 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; } } 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>(){}); 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))); }}} static private String toBase26( int n){ String res = ""; do {n -= 1; res = ((char)('A' + (n % 26)) + res); n /= 26; }while((n > 0));return res;} static private 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());} }
6	public class TaskD implements Runnable{ private InputReader in ; private PrintWriter out ; private int n ; private int m ; private boolean[][] e ; private long[][] qp ; static private 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 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 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 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);} 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();} } }
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(); } static private 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());} 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;}} static private 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); } 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();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} 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());} } }
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 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)));} } 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 int[] nextIntArray( int n){ int a[] = new int[n]; for ( int i = 0;(i < n);i++) {a[i] = nextInt(); }return a;} public boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} 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 ; {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());} } }
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 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 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;} 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 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); } 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 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(); } }
0	public class A{ static private 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 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;} static long b2mb( long b){ return (b >> 20);} String nextToken()throws IOException { while(!st.hasMoreTokens())st = new StringTokenizer(in.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} }
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; } } 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 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 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();} 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());} 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();} int ni(){ return Integer.parseInt(ns());} }
6	public class D11{ static StreamTokenizer in ; static PrintWriter out ; static int nextInt()throws IOException { in.nextToken(); return (int)in.nval;} 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();} long nextLong(){ return Long.parseLong(next());} } 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);} }
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());} 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();} 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 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 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 int gcd( int a, int b){ if ( (a == 0)) return b; return gcd((b % a),a);} 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); } } 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());} long nl(){ return Long.parseLong(next());} }
6	public class ASimpleTask{ static private 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();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} 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 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; } } } 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 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 ; static private String alphabet ; static 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)); }}} static private String oneInt( String row, int col){ return ((("R" + col) + "C") + toNum(row));} static 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;} static private String twoInts( Integer row, Integer col){ return (toAlpha(col) + row);} static 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;} public static void main( String[] args)throws InterruptedException { Thread thread = new Thread(new ProbB()); thread.start(); thread.join(); } static int nextInt()throws Exception { return Integer.parseInt(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 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; } long nextLong()throws IOException { if ( (cacheIndex >= cache.length)) {cache = br.readLine().split(" "); cacheIndex = 0; } return Long.parseLong(cache[cacheIndex++]);} void close()throws IOException { br.close(); } } static class Solution{ static private 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());} } }
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);} 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);} 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();} } }
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{ static private 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")); } 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(); } static private 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());} void close(){ try{br.close(); }catch (IOException e){ e.printStackTrace(); } } } static private 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(); } 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());} }
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 int ni()throws IOException { return sc.nextInt();} static long nl()throws IOException { return sc.nextLong();} 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); } 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 nextInt(){ return Integer.parseInt(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(); } }
0	public class Main{ static private BufferedReader reader ; static private BufferedWriter out ; static private StringTokenizer tokenizer ; static private void init( InputStream input, OutputStream output){ reader = new BufferedReader(new InputStreamReader(input)); out = new BufferedWriter(new OutputStreamWriter(output)); tokenizer = new StringTokenizer(""); } static private String nextLine()throws IOException { return reader.readLine();} static private String next()throws IOException { while(!tokenizer.hasMoreTokens()){tokenizer = new StringTokenizer(nextLine()); }return tokenizer.nextToken();} static private int nextInt()throws IOException { return Integer.parseInt(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{ static final int MAXNUM = (1 << 20); String next()throws IOException { while(!st.hasMoreTokens())st = new StringTokenizer(in.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(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 long gcd( long a, long b){ if ( (a == 0)) return b; return gcd((b % a),a);} }
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 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 void println( String s)throws IOException { bw.write(s); bw.newLine(); } public void println( int s)throws IOException { bw.write((s + "")); bw.newLine(); } public void println( long s)throws IOException { bw.write((s + "")); bw.newLine(); } 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; } 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());} }
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 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());} } }
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 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());} } }
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 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 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{ static private 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;} static private 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;} static private 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();} } 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 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());} } }
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); } static private 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 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 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(); } public Integer[] sort( Integer[] a){ Arrays.sort(a); return a;} public Long[] sort( Long[] a){ Arrays.sort(a); return a;} 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 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);} 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 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();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} }
5	public class Test{ static BufferedReader reader ; static StringTokenizer tokenizer ; static PrintWriter writer ; static int nextInt()throws IOException { return Integer.parseInt(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(); } static private 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(); } int ni()throws IOException { return Integer.parseInt(ns());} long nl()throws IOException { return Long.parseLong(ns());} String ns()throws IOException { while(((tokenizer == null) || !tokenizer.hasMoreTokens()))tokenizer = new StringTokenizer(br.readLine()); return tokenizer.nextToken();} 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;} } 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[][] 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 nl(){ return Long.parseLong(next());} String nextLine(){ String str = ""; try{str = br.readLine(); }catch (IOException e){ e.printStackTrace(); } return str;} }
4	public class P1517D{ static private int n ,m ,k ; static private int[][] hor ,ver ,a ,b ; static private long ans ; static private int[][] id ; static private Integer[][][] dp ; static private int idf ; static private String s ,t ; static private HashMap<Integer,ArrayList<Integer>> g ; static private 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(); } static private 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;} static private 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]; }} static private 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]; }} static private int[] ina( int n){ int[] temp = new int[n]; for ( int i = 0;(i < n);i++) {temp[i] = in.nextInt(); }return temp;} static private int ini(){ return in.nextInt();} static private String ins(){ return in.readString();} static private void println( Object... o){ for ( Object x :o) {out.write((x + "")); }out.write("\n"); } static private void print( Object... o){ for ( Object x :o) {out.write((x + "")); }} static private 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 compareTo( Edge edge){ return Long.compare(w,edge.w);} } static private int gcd( int a, int b){ if ( (b == 0)) return a; return gcd(b,(a % b));} static private 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);}} static private 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;} static private InputReader in = new InputReader(System.in); static private PrintWriter out = new PrintWriter(System.out); static private 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 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(); } String readString()throws IOException { while(!tok.hasMoreTokens()){tok = new StringTokenizer(in.readLine()); }return tok.nextToken();} int readInt()throws IOException { return Integer.parseInt(readString());} class Team implements Comparable<Team>{ int cnt ,time ; public Team( int cnt, int time){ this.cnt = cnt; this.time = time; } @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 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());} } }
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));} static private 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{ } static private 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 (FileNotFoundException e){ e.printStackTrace(); } this.stream = stream; } 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();} 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 int read(){ if ( (numChars == -1)) throw (new InputMismatchException()); if ( (curChar >= numChars)) {curChar = 0; try{numChars = stream.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (numChars <= 0)) return -1; } return buf[curChar++];} private 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{ static private 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());} } 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(); }} static private 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 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;} }
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 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{ static private StringTokenizer tokenizer ; static private BufferedReader bf ; static private PrintWriter out ; static private int nextInt()throws IOException { return Integer.parseInt(nextToken());} static private 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 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)) {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(); static final 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 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());} } }
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());} } static long MOD = ((long)1e9 + 7); static FastReader sc = new FastReader(); static PrintWriter out = new PrintWriter(System.out); 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);} 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();} int nextInt(){ return Integer.parseInt(nextToken());} long nextLong(){ return Long.parseLong(nextToken());} } 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]);} } }
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());} } }
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 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());} }
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));} public static long mul( long a, long b){ return (((a % MOD) * (b % MOD)) % MOD);} static final Random random = new Random(); 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);} 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());} } }
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{ private final int BUFFER_SIZE = (1 << 18); private final DataInputStream din ; private final 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 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);} 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 long[] nextLongArray( int n)throws IOException { long[] arr = new long[n]; for ( int i = 0;(i < n);i++) {arr[i] = nextLong(); }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());} } }
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; } } 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[]>(){}); 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());} } }
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());} } }
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 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 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());} } }
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 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 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 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 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 r()throws IOException { input = new StringTokenizer(rline()); } 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 nl(){ return Long.parseLong(n());} 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 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 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(); } static private int nextInt()throws IOException { return Integer.parseInt(next());} static private 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)); } }
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 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;} } static private 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; } } }
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 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();} long L(){ return Long.parseLong(next());} } 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);}} }
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{ static private final long mod = 1000000007; static private final int MAXN = 100001; static private 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);} static private long power( long x, long y){ return power(x,y,mod);} static private long gcd( long a, long b){ if ( (b == 0)) return a; return gcd(b,(a % b));} static int nextLog2( int a){ return ((a == 0)?0:(32 - Integer.numberOfLeadingZeros((a - 1))));} static private 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;} static private int log[] = getLogArr(MAXN); static int find( Subset[] Subsets, int i){ if ( (Subsets[i].parent != i)) Subsets[i].parent = find(Subsets,Subsets[i].parent); return Subsets[i].parent;} 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());} int[] nextIntArr( int n){ int[] arr = new int[n]; for ( int i = 0;(i < n);i++) {arr[i] = nextInt(); }return arr;} long[] nextLongArr( int n){ long[] arr = new long[n]; for ( int i = 0;(i < n);i++) {arr[i] = nextLong(); }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")); } @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>(){}); 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[][][] ; static private 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());} 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>(){}); 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 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 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 int[] input( int N){ int A[] = new int[N]; for ( int i = 0;(i < N);i++) {A[i] = in.nextInt(); }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 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());} 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; 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'));} String nextToken()throws IOException { while(!st.hasMoreTokens())st = new StringTokenizer(in.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} String nextLine()throws IOException { st = new StringTokenizer(""); return in.readLine();} }
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(); } } static private 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();} static private 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();} static private void formatError(){ System.out.println("Unexpected input"); System.exit(1); } }
2	public class codeforcesreturn{ 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 boolean ready()throws IOException { return br.ready();} } }
3	public class TaskA implements Runnable{ long m = ((int)1e9 + 7); PrintWriter w ; InputReader c ; 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]; }}} static long gcd( long a, long b){ if ( (b == 0)) return a; return gcd(b,(a % b));} public int[] scanArrayI( int n){ int a[] = new int[n]; for ( int i = 0;(i < n);i++) a[i] = c.nextInt(); return a;} 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 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 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 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 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 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; }} 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 boolean ready()throws IOException { return br.ready();} } }
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());} 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; 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 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 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);} int root( int a){ while((arr[a] != a)){arr[a] = arr[arr[a]]; a = arr[a]; }return a;} int[] arr ; final int level = 20; }
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 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 private 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)); } static private String[] nss()throws IOException { return in.readLine().split(" ");} }
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{ private final 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 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;} 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); } static class FastScanner{ private final 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;} boolean isEndline( int c){ return (((c == '\n') || (c == '\r')) || (c == -1));} 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;} 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(); } } 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 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());} } }
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());} } }
4	public class D{ static private 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(); } static final long mod = 1000000007; static private Reader in ; static private PrintWriter out ; static private void print_array( int[] array){ for ( int now :array) {out.print(now); out.print(' '); }out.println(); } static private void print_array( long[] array){ for ( long now :array) {out.print(now); out.print(' '); }out.println(); } static class Reader{ static private 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; } static private 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 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;} 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(); } static private 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 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(""); }}} static private 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 int ni()throws IOException { return sc.nextInt();} static long nl()throws IOException { return sc.nextLong();} 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 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 void ol( String x){ out.println(x); } static void ol( int x){ out.println(x); } static class Scanner{ StringTokenizer st ; BufferedReader br ; public Scanner( InputStream s){ br = new BufferedReader(new InputStreamReader(s)); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(next());} public double nextDouble()throws IOException { return Double.parseDouble(next());} public long nextLong()throws IOException { return Long.parseLong(next());} 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;} 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 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>(){}); 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; public static void main( String[] args)throws IOException { new Thread(new Main()).start(); } 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); } } long nextLong()throws IOException { return Long.parseLong(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>(){}); 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));} public static long mul( long a, long b){ return (((a % MOD) * (b % MOD)) % MOD);} static final Random random = new Random(); 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);} 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());} } }
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 > a)) {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());} } 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(); } static private 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 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());} } 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());} } static FastReader s = new FastReader(); static PrintWriter out = new PrintWriter(System.out); static private int ri(){ return s.nextInt();} static private long rl(){ return s.nextLong();} 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));} 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());} 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 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)); } static private 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 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 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();} } }
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)); }} static private 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 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 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 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)); } 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 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 class MyScanner{ String next()throws IOException { newLine(); return line[index++];} int nextInt()throws IOException { return Integer.parseInt(next());} 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); 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;} }} 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(); } 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());} }
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(); } int ni()throws IOException { return Integer.parseInt(ns());} String ns()throws IOException { while(((tokenizer == null) || !tokenizer.hasMoreTokens()))tokenizer = new StringTokenizer(br.readLine()); return tokenizer.nextToken();} 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();} }
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{ static private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); static private BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out)); static private 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(); } }