codeparrot/codecomplex huggingface dataset:
// Problem: 11_D. A Simple Task
// Time complexity: np
import java.io.*;
import java.text.*;
import java.math.*;
import java.util.*;

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();
    }
}
// Problem: 11_D. A Simple Task
// Time complexity: np
import java.util.Scanner;

import static java.lang.Integer.bitCount;
import static java.lang.Integer.numberOfTrailingZeros;
import static java.lang.System.out;

/**
 * 11D
 *
 * @author artyom
 */
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];

        // SOLUTION BEGINS
        for (int mask = 1; mask < 1 << n; mask++) {
            int start = numberOfTrailingZeros(mask); // the starting vertex of a Hamiltonian walk
            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); // mask without vertex i
                    for (int j = 0; j < n; j++) {
                        if (d[j][i] > 0) {
                            dp[mask][i] += dp[xmask][j];
                        }
                    }
                }
            }
        }
        // SOLUTION ENDS

        long sum = 0;
        for (int mask = 1; mask < 1 << n; mask++) {
            if (bitCount(mask) >= 3) { // We need at least 3 vertices for a cycle
                for (int i = 0; i < n; i++) {
                    if (d[numberOfTrailingZeros(mask)][i] > 0) {
                        sum += dp[mask][i];
                    }
                }
            }
        }
        out.print(sum / 2);
    }
}
// Problem: 11_D. A Simple Task
// Time complexity: np
import java.io.*;
import java.util.*;
public class D11 {
	static HashMap<State, Integer> map;
	static long[][] ans;
	static boolean[][] connect;
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		map = new HashMap<State, Integer>();
		connect = new boolean[n][n];
		ans = new long[n][1<<n];
		for(int i = 0; i < n; i++)
			Arrays.fill(ans[i], -1);
		int m = Integer.parseInt(st.nextToken());
		while(m-- > 0)	{
			st = new StringTokenizer(br.readLine());
			int a = Integer.parseInt(st.nextToken());
			int b = Integer.parseInt(st.nextToken());
			a--;
			b--;
			connect[a][b] = connect[b][a] = true;
		}
		long ret = 0;
		int mask = 1 << n;
		mask--;
		for(int i = 0; i < n; i++)	{
			for(int out = i+1; out < n; out++)	{
				if(connect[i][out])	{
					ret += solve(mask - (1<<out), out, true);
				}
			}
			mask -= (1<<i);
		}
		System.out.println(ret/2);
	}
	public static long solve(int mask, int start, boolean a)	{
		if(ans[start][mask] != -1)
			return ans[start][mask];
		int end = 0;
		while((mask & (1<<end)) == 0)
			end++;
		long ret = 0;
		for(int out = 0; out < connect.length; out++)	{
			if(connect[start][out] && (mask & (1 << out)) != 0)	{
				if(out == end)	{
					if(!a)
						ret++;
				}
				else
					ret += solve(mask - (1<<out), out, false);
			}
		}
		ans[start][mask] = ret;
		return ret;
	}
	static class State	{
		public byte start, go;
		public int mask;
		public State(byte a, byte b, int c)	{
			start = a;
			go = b;
			mask = c;
		}
		public int hashCode()	{
			return 10007*mask + 43 * start + go;
		}
		public boolean equals(Object o)	{
			State s = (State)o;
			return start == s.start && go == s.go && mask == s.mask;
		}
	}
}
// Problem: 1102_F. Elongated Matrix
// Time complexity: np
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class ElongatedMatrix {
	static int[][][] memo;
	static int mn1[][];
	static int mn2[][];
	static int r, c;

	static int dp(int mask, int first, int lastvisited) {
		if (memo[first][lastvisited][mask] != -1)
			return memo[first][lastvisited][mask];
		int ans = 0;
		for (int i = 0; i < r; i++) {
			if ((mask & (1 << i)) == 0) {
				if (Integer.bitCount(mask) != r - 1) {
					ans = Math.max(ans, Math.min(mn1[lastvisited][i], dp(((mask) | (1 << i)), first, i)));
				} else
					ans = Math.max(ans, Math.min(mn2[first][i], mn1[lastvisited][i]));
			}
		}
		//System.out.println(ans);
		return memo[first][lastvisited][mask] = ans;
	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		PrintWriter out = new PrintWriter(System.out);
		r = Integer.parseInt(st.nextToken());
		
		c = Integer.parseInt(st.nextToken());
		int[][] arr = new int[r][c];
		memo = new int[r][r][1 << r];
		mn1 = new int[r][r];
		mn2 = new int[r][r];
		for(int i=0;i<r;i++) {
			st=new StringTokenizer(br.readLine());
			for(int j=0;j<c;j++) {
				arr[i][j]=Integer.parseInt(st.nextToken());
			}
		}
		for (int i = 0; i < r; i++) {
			Arrays.fill(mn1[i], (int)1e9);
			Arrays.fill(mn2[i], (int)1e9);
		}
		
		for (int i = 0; i < r; i++) {
			for (int j = 0; j < r; j++) {
				Arrays.fill(memo[i][j], -1);
			}
		}
		for (int i = 0; i < r; i++) {
			for (int j = 0; j < r; j++) {
				for (int k = 0; k < c; k++) {
					
					mn1[i][j] = Math.min(mn1[i][j], Math.abs(arr[i][k] - arr[j][k]));
					
				}
			}
		}
		for (int i = 0; i < r; i++) {
			for (int j = 0; j < r; j++) {
				for (int k = 0; k < c-1; k++) {
					
					mn2[i][j] = Math.min(mn2[i][j], Math.abs(arr[j][k] - arr[i][k + 1]));
					
				}
			}
		}
		
		int ans = 0;
		for (int i = 0; i < r; i++) {
			ans=Math.max(ans, dp(1<<i,i,i));
		}
		if(r==1)
			ans=mn2[0][0];
		out.println(ans);
		out.flush();
	}

}
// Problem: 1102_F. Elongated Matrix
// Time complexity: np
//package ;
import java.io.*;
import java.util.*;

public class D {
	static int dp(int i,int start,int msk)
	{
		if(Integer.bitCount(msk)==n)
			return s_e[i][start];

		if(dp[i][start][msk]!=-1)
			return dp[i][start][msk];
		
		int max=0;
		for(int k=0;k<n;k++)
		{	
			int min=Integer.MAX_VALUE;
			if((msk & (1<<k)) == 0 )
			{
				min=diff[i][k];
				min=Math.min(min, dp(k,start,msk | (1<<k)));
				max=Math.max(max, min);
			}
		}
		return dp[i][start][msk]=max;
	}
	static int n,m,a[][],dp[][][],diff[][],s_e[][];
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter pw = new PrintWriter(System.out);
		n=sc.nextInt();
		m=sc.nextInt();
		a=new int[n][m];
		diff=new int[n][n];
		s_e=new int[n][n];
		for(int i=0;i<n;i++)
			for(int j=0;j<m;j++)
				a[i][j]=sc.nextInt();
		
		dp=new int[n][n][70000];
		int ans=0;
		for(int i=0;i<n;i++)
			for(int j=0;j<n;j++)
			{	
				Arrays.fill(dp[i][j], -1);
				diff[i][j]=Integer.MAX_VALUE;
				s_e[i][j]=Integer.MAX_VALUE;
				for(int k=0;k<m-1;k++)
				{	
					diff[i][j]=Math.min(Math.abs(a[i][k]-a[j][k]), diff[i][j]);
					s_e[i][j]=Math.min(Math.abs(a[i][k]-a[j][k+1]), s_e[i][j]);
				}
				diff[i][j]=Math.min(Math.abs(a[i][m-1]-a[j][m-1]), diff[i][j]);
			}
		
		for(int i=0;i<n;i++)
			ans=Math.max(ans, dp(i,i,1<<i));
		
		pw.print(ans);
		pw.close();
	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}

		int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

		boolean hasnext() throws IOException {
			return br.ready();
		}

	}
}
// Problem: 1102_F. Elongated Matrix
// Time complexity: np
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskF solver = new TaskF();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskF {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int[][] graph = new int[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++)
                    graph[i][j] = in.nextInt();
            }
            int[][] mn1 = new int[n][n];
            int[][] mn2 = new int[n][n];
            for (int i = 0; i < n; i++)
                for (int j = 0; j < n; j++) {
                    int min_val = Integer.MAX_VALUE;
                    for (int k = 0; k < m; k++)
                        min_val = Math.min(min_val, Math.abs(graph[i][k] - graph[j][k]));
                    mn1[i][j] = min_val;
                    min_val = Integer.MAX_VALUE;
                    for (int k = 0; k < m - 1; k++) {
                        min_val = Math.min(min_val, Math.abs(graph[i][k] - graph[j][k + 1]));
                    }
                    mn2[i][j] = min_val;
                }
            int[][] dp = new int[(1 << (n + 2))][n];
            int ans = 0;
            for (int i = 0; i < n; i++) {
                for (int[] temp : dp)
                    Arrays.fill(temp, -1);
                for (int j = 0; j < n; j++) {
                    dp[1 << j][j] = (j == i ? Integer.MAX_VALUE : 0);
//                dp[1 << j][j] = (j == i ? 0: Integer.MAX_VALUE );
                }
                for (int j = 0; j < n; j++) {
                    ans = Math.max(ans, Math.min(mn2[j][i], calc((1 << n) - 1, j, dp, mn1, n)));
                }
            }
            out.println(ans);
        }

        public int calc(int mask, int v, int[][] dp, int[][] mn1, int n) {
//        System.out.println(mask+","+v);
            if (dp[mask][v] != -1)
                return dp[mask][v];
            dp[mask][v] = 0;
            for (int u = 0; u < n; u++) {
                if (u != v && (((mask >> u) & 1) == 1))
                    dp[mask][v] = Math.max(dp[mask][v], Math.min(mn1[u][v], calc(mask ^ (1 << v), u, dp, mn1, n)));
            }
            return dp[mask][v];
        }

    }
}
// Problem: 1102_F. Elongated Matrix
// Time complexity: np
import java.io.*;
import java.util.*;

public class F 
{
	static Scanner in = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);
	
	static int n,m,res=0;
	static int[][] a=new int[20][10005],Min=new int[20][20],Min1=new int[20][20];
	static int[][][] f=new int[1<<16][20][20];
	
	static int GetBit(int x,int k)
	{
		return (x>>k)&1;
	}
	
	static int TurnBit(int x,int k)
	{
		return x^(1<<k);
	}

	public static void main(String[] args) 
	{
		n=in.nextInt();
		m=in.nextInt();
		for(int i=0;i<n;i++)
			for(int j=1;j<=m;j++)
				a[i][j]=in.nextInt();
		if(n==1)
		{
			res=(int)1e9;
			for(int i=1;i<m;i++)
				res=Math.min(res,Math.abs(a[0][i]-a[0][i+1]));
			out.print(res);
			out.close();
			return;
		}
		for(int i=0;i<n;i++)
			for(int j=0;j<n;j++)
			{
				Min[i][j]=Min1[i][j]=(int)1e9;
				for(int t=1;t<=m;t++)
					Min[i][j]=Math.min(Min[i][j],Math.abs(a[i][t]-a[j][t]));
				for(int t=1;t<m;t++)
					Min1[i][j]=Math.min(Min1[i][j],Math.abs(a[i][t]-a[j][t+1]));
			}
		for(int i=0;i<n;i++)
			f[1<<i][i][i]=(int)1e9;
		for(int mask=0;mask<(1<<n);mask++)
			if(Integer.bitCount(mask)>1)
				for(int i=0;i<n;i++)
					if(GetBit(mask,i)==1)
						for(int j=0;j<n;j++)
							if(i!=j&&GetBit(mask,j)==1)
							{
								for(int t=0;t<n;t++)
									if(j!=t&&GetBit(mask,t)==1)
										f[mask][i][j]=Math.max(f[mask][i][j],Math.min(f[TurnBit(mask,j)][i][t],Min[j][t]));
								if(mask==(1<<n)-1)									
									res=Math.max(res,Math.min(f[mask][i][j],Min1[j][i]));
							}
		out.print(res);
		out.close();
	}
}
// Problem: 1102_F. Elongated Matrix
// Time complexity: np
import java.io.*;
import java.util.*;

public class CF1102F {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());
		int[][] aa = new int[n][m];
		for (int i = 0; i < n; i++) {
			st = new StringTokenizer(br.readLine());
			for (int j = 0; j < m; j++)
				aa[i][j] = Integer.parseInt(st.nextToken());
		}
		int[][] dd = new int[n][n];
		for (int i = 0; i < n; i++)
			for (int j = i + 1; j < n; j++) {
				int d = Integer.MAX_VALUE;
				for (int h = 0; h < m; h++)
					d = Math.min(d, Math.abs(aa[i][h] - aa[j][h]));
				dd[i][j] = dd[j][i] = d;
			}
		int[][] dd_ = new int[n][n];
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++) {
				int d = Integer.MAX_VALUE;
				for (int h = 0; h < m - 1; h++)
					d = Math.min(d, Math.abs(aa[i][h] - aa[j][h + 1]));
				dd_[i][j] = d;
			}
		if (n == 1) {
			System.out.println(dd_[0][0]);
			return;
		}
		int[] ii = new int[1 << n];
		for (int i = 0; i < n; i++)
			ii[1 << i] = i;
		int[][][] dp = new int[1 << n][n][n];
		for (int b = 0; b < 1 << n; b++)
			for (int u = b; u > 0; u &= u - 1) {
				int i = ii[u & -u];
				for (int v = b ^ 1 << i; v > 0; v &= v - 1) {
					int j = ii[v & -v];
					if (b == (1 << i ^ 1 << j))
						dp[b][i][j] = dd[i][j];
					else {
						int x = 0;
						for (int w = b ^ 1 << i ^ 1 << j; w > 0; w &= w - 1) {
							int k = ii[w & -w];
							x = Math.max(x, Math.min(dp[b ^ 1 << j][i][k], dd[k][j]));
						}
						dp[b][i][j] = x;
					}
				}
			}
		int b = (1 << n) - 1;
		int x = 0;
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				if (i != j)
					x = Math.max(x, Math.min(dp[b][i][j], dd_[i][j]));
		System.out.println(x);
	}
}
// Problem: 1102_F. Elongated Matrix
// Time complexity: np
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class f {
	
	static int n, m;
	static int start;
	static int[][] memo;
	static int[][] arr;
	static int[][] costs;
	static int[][] wrapCosts;

	public static void main(String[] args) throws IOException {
		FastScanner in = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		n = in.nextInt();
		m = in.nextInt();
		arr = new int[n][m];
		costs = new int[n][n];
		wrapCosts = new int[n][n];
		for (int r = 0; r < n; r++) {
			for (int c = 0; c < m; c++) {
				arr[r][c] = in.nextInt();
			}
		}
		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				costs[i][j] = Integer.MAX_VALUE;
				for (int c = 0; c < m; c++) {
					costs[i][j] = Math.min(costs[i][j], Math.abs(arr[i][c] - arr[j][c]));
				}
				costs[j][i] = costs[i][j];
			}
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				wrapCosts[i][j] = Integer.MAX_VALUE;
				for (int c = 0; c < m - 1; c++) {
					wrapCosts[i][j] = Math.min(wrapCosts[i][j], Math.abs(arr[i][c + 1] - arr[j][c]));
				}
			}
		}
		memo = new int[n][1 << n];
		long best = 0;
		for (start = 0; start < n; start++) {
			for (int[] a : memo) Arrays.fill(a, -1);
			best = Math.max(best, go(start, (1 << n) - 1 - (1 << start)));
		}
		out.println(best);
		out.close();
	}
	static int go(int cur, int mask) {
		if (mask == 0) {
			return wrapCosts[start][cur];
		}
		if (memo[cur][mask] != -1) return memo[cur][mask];
		int ans = 0;
		for (int next = 0; next < n; next++) {
			int bit = 1 << next;
			if ((mask & bit) == 0) continue;
			ans = Math.max(ans, Math.min(costs[cur][next], go(next, mask ^ bit)));
		}
		return memo[cur][mask] = ans;
	}
	
	//@
	static class FastScanner {
	    BufferedReader br;
	    StringTokenizer st;
		
	    public FastScanner(InputStream i) {
	        br = new BufferedReader(new InputStreamReader(i));
	        st = new StringTokenizer("");
	    }
				
	    public String next() throws IOException {
	        if(st.hasMoreTokens())
	            return st.nextToken();
	        else
	            st = new StringTokenizer(br.readLine());
	        return next();
	    }

	    public int nextInt() throws IOException {
	        return Integer.parseInt(next());
	    }
	    //#
	    public long nextLong() throws IOException {
	        return Long.parseLong(next());
	    }
	    public double nextDouble() throws IOException {
	        return Double.parseDouble(next());
	    }
	    //$
	}
}
// Problem: 1102_F. Elongated Matrix
// Time complexity: np
import java.util.*;
import java.io.*;

public class main{

	static int max = 5000+1;
	static FastReader in = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);
	static int N = 18;
	static int[][] mn1 = new int[N][N]; 
	static int[][] mn2 = new int[N][N];
	static int[][] dp = new int[1<<N][N];
	static int n,m;
	
	static void solve(){
		n = in.nextInt(); m = in.nextInt();
		int[][] a = new int[n][m];
		for(int i=0;i<n;i++)for(int j=0;j<m;j++)a[i][j] = in.nextInt();
		for(int i=0;i<n;i++){
			Arrays.fill(mn1[i],Integer.MAX_VALUE);
			Arrays.fill(mn2[i],Integer.MAX_VALUE);
		}
		
		for(int i=0;i<n;i++)
			for(int j=0;j<n;j++)
				for(int k=0;k<m;k++){
					mn1[i][j] = Math.min(mn1[i][j],Math.abs(a[i][k]-a[j][k]));
					if(k<=m-2)
						mn2[i][j] = Math.min(mn2[i][j],Math.abs(a[i][k]-a[j][k+1]));
				}
		int ans = 0;
		for(int i=0;i<n;i++){
			for(int x=0;x<1<<n;x++)Arrays.fill(dp[x],-1);
			for(int j=0;j<n;j++)dp[1<<j][j] = 0;
			dp[1<<i][i] = Integer.MAX_VALUE;
			for(int j=0;j<n;j++)
				ans = Math.max(ans,Math.min(mn2[j][i],calc((1 << n) - 1, j)));
		}
		out.println(ans);
	}

	static int calc(int mask, int v){
		if (dp[mask][v] != -1)
			return dp[mask][v];
		dp[mask][v] = 0;
		for(int u=0;u<n;u++) if (v != u && (((mask >> u) & 1)>0))
			dp[mask][v] = Math.max(dp[mask][v], Math.min(mn1[u][v], calc(mask ^ (1 << v), u)));
		return dp[mask][v];
	}


	public static void main(String[] args){
		solve();
		out.close();
	}	

	static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next(){
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine(){
            String str = "";
            try{   
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }  
            return str;
        }
        int nextInt(){return Integer.parseInt(in.next());}
    	long nextLong(){return Long.parseLong(in.next());}
    	double nextDouble(){return Double.parseDouble(in.next());}
    }
}




// |xvcxv|vcv[cvcvc|cxv||]vcvx:v|c|vxc|[|cvx:cxvx||||]