codeparrot/codecomplex huggingface dataset:
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.io.*;
import java.util.*;
import java.math.*;

public class Main implements Runnable {
	int[] conf, L, B;
	int n, k, A, sz;
	double[] kill;
	double best = 0;
	
	double solv() {
		double res = 0;
		double[] a = new double[n];
		for (int i=0; i<n; i++) 
			a[i] = Math.min(100, L[i]+10*conf[i])/100.0;
		double[] dp1 = new double[sz];
		double[] dp2 = new double[sz];
		dp1[0] = 1;
		for (int i=0; i<n; i++) {
			for (int msk=0; msk<sz; msk++) { 
				dp2[msk] += dp1[msk]*a[i];
				dp2[msk|(1<<i)] += dp1[msk]*(1-a[i]);
			}
			for (int msk=0; msk<sz; msk++) {
				dp1[msk] = dp2[msk]; dp2[msk] = 0;
			}
		}
		/*for (int msk=0; msk<sz; msk++) {
			double p = 1;
			int cnt = 0;
			for (int i=0; i<n; i++)
				if ((msk&(1<<i))>0) {					
					p *= (100-a[i])/100.0;
				} else {
					p *= a[i]/100.0;
					cnt++;
				}
			if (cnt>n/2) res += p; else res += p*kill[msk];
		}
		res /= sz;*/
		
		for (int msk=0; msk<sz; msk++){
			if (n-Integer.bitCount(msk) > n/2) res += dp1[msk]; else res += dp1[msk]*kill[msk]; 
		}
			
		return res;
		
	}
	void gen(int n, int k) {
		if (n==0) {
			conf[0] = k;
			//conf[0] = 2; conf[1] = 1; conf[2] = 3;
			double x = solv();
			if (x>best) best = x;
			return;
			
		}
		for (int i=0; i<=k; i++) {
			conf[n] = i;
			gen(n-1, k-i);
		}
		conf[n] = 0;
	}
	void solve() throws IOException {
		n = nextInt();
		k = nextInt();
		A = nextInt();
		B = new int[n];
		L = new int[n];
		for (int i=0; i<n; i++) {
			B[i] = nextInt();
			L[i] = nextInt();
		}
		sz = 1<<n;
		conf = new int[n];
		kill = new double[sz];
		for (int msk=0; msk<sz; msk++) {
			int sum = 0;
			for (int i=0; i<n; i++)
				if ((msk&(1<<i))>0) {
					sum += B[i];
				}
			kill[msk] = A*1./(A+sum);
		}
		gen(n-1, k);
		out.printf(Locale.US, "%1.9f", best);
		
		
		
		
		
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;

	public void run() {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			// br = new BufferedReader(new FileReader("input.txt"));
			// out = new PrintWriter("output.txt");
			solve();
			br.close();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(123);
		}
	}

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null)
				return null;
			st = new StringTokenizer(s,", \t");
		}
		return st.nextToken();
	}

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

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

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

	public static void main(String[] args) {
		new Thread(new Main()).start();
	}
}
// Problem: 11_D. A Simple Task
// Time complexity: np
//package contest10D;
import java.math.*;
import java.util.*;
import static java.math.BigInteger.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main {
	static void debug(Object... os) {
		System.err.println(deepToString(os));
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt(),m=sc.nextInt();
		boolean[][] bs=new boolean[n][n];
		for (int i = 0; i < m; i++) {
			int s=sc.nextInt()-1,t=sc.nextInt()-1;
			bs[s][t] = bs[t][s] = true;
		}
		long res = 0;
		for(int i=0;i<n;i++){
			res += calc(bs,n-1-i);
		}
		System.out.println(res/2);
	}
	long calc(boolean[][] bs,int n){//start is n.
		long[][] dp=new long[1<<n][n]; // set,last -> number of path n -> last.
		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]){//add
					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;
	}
	
}
// Problem: 11_D. A Simple Task
// Time complexity: np
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;

/**
 * Created by Tejas on 18-10-2018.
 */
public class Main {

    static HashSet<Integer> adjList[];
    public static void main(String[]args)throws IOException{
        BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder stringBuilder=new StringBuilder();

        String temp[]=bufferedReader.readLine().split(" ");
        int V=Integer.parseInt(temp[0]);
        int E=Integer.parseInt(temp[1]);
        adjList=new HashSet[V];
        for(int i=0;i<V;i++)
            adjList[i]=new HashSet<>();
        for(int i=0;i<E;i++){
            temp=bufferedReader.readLine().split(" ");
            int x=Integer.parseInt(temp[0])-1;
            int y=Integer.parseInt(temp[1])-1;
            adjList[y].add(x);
            adjList[x].add(y);
        }
        stringBuilder.append(solve(V)+"\n");
        System.out.println(stringBuilder);
    }

    private static long solve(int V) {

        long dp[][]=new long[(1<<V)][V];
        long count=0;
        for(int i=0;i<V;i++)
            dp[(1<<i)][i]=1;
        for(int mask=1;mask<(1<<V);mask++){
            // HW starting at pos first and ending at j.
            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];
                //Calculating simple cycles
                if (Integer.bitCount(mask)>=3)
                    if(adjList[first].contains(i))
                        count+=dp[mask][i];
            }
        }
        return count/2;
    }
}
// Problem: 11_D. A Simple Task
// Time complexity: np
import java.util.Scanner;

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) {
		// [0, n)の頂点だけで、n-1 スタートだけ考える
		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; // n-1 を含むサイクルを右回りと左回り数えてしまったので２で割る
	}

}
// Problem: 11_D. A Simple Task
// Time complexity: np


import java.util.Scanner;

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

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++) {
            //System.out.println("st="+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();
    }
}
// Problem: 11_D. A Simple Task
// Time complexity: np


import java.util.Scanner;

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;
        
    }
}
// Problem: 11_D. A Simple Task
// Time complexity: np
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class ProblemD {
	

	
	static int N;
	static boolean[][] graph;
	
	public static void main(String[] args) throws IOException {
		BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		String[] data = s.readLine().split(" ");
		int n = Integer.valueOf(data[0]);
		N = n;
		int m = Integer.valueOf(data[1]);
		graph = new boolean[n][n];
		for (int i = 0 ; i < m ; i++) {
			String[] line = s.readLine().split(" ");
			int a = Integer.valueOf(line[0])-1;
			int b = Integer.valueOf(line[1])-1;
			graph[a][b] = true;
			graph[b][a] = true;
		}
		
		long ans = 0;
		for (int i = 0 ; i < n ; i++) {
			ans += doit(i);
		}
		ans /= 2;
		
		out.println(ans);
		out.flush();
	}

	static long doit(int n) {
		long[][] dp = new long[1<<n][n];
		for (int i = 0 ; i < n ; i++) {
			if (graph[i][n]) {
				dp[1<<i][i] = 1;
			}
		}
		
		for (int i = 0 ; i < (1<<n) ; i++) {
			for (int j = 0 ; j < n ; j++) {
				if (dp[i][j] >= 1) {
					for (int k = 0 ; k < n ; k++) {
						if (graph[j][k] && (i & (1<<k)) == 0) {
							dp[i|1<<k][k] += dp[i][j];
						}
					}
				}
			}
		}
		
		long ret = 0;
		for (int i = 0 ; i < (1<<n) ; i++) {
			if (Integer.bitCount(i) >= 2) {
				for (int j = 0 ; j < n ; j++) {
					if (graph[j][n]) {
						ret += dp[i][j];
					}
				}
			}
		}
		return ret;
	}
	
	
	static void generateLarge() {
		System.out.println("19 171");
		for (int i = 1 ; i <= 19 ; i++) {
			for (int j = i+1 ; j <= 19 ; j++) {
				System.out.println(i + " " + j);
			}
		}
	}


	public static void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}
}
// Problem: 11_D. A Simple Task
// Time complexity: np
/**
 * JUDGE_ID : 104262PN
 * User     : Денис
 * Date     : 09.05.11
 * Time     : 22:48
 * ICQ      : 785625
 * Email    : popokus@gmail.com
 */

import java.io.*;

public class s11_d {
    public static void main(String[] args) throws IOException {
        new s11_d().run();
    }

    int nextInt() throws IOException {
        in.nextToken();
        return (int) in.nval;
    }

    String nextString() throws IOException {
        in.nextToken();
        return (String) in.sval;
    }

    StreamTokenizer in;
    Writer writer;
    Reader reader;

    void run() throws IOException {
        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
        reader = oj ? new InputStreamReader(System.in, "ISO-8859-1") : new FileReader("input/is11_d.txt");
        writer = new OutputStreamWriter(System.out, "ISO-8859-1");
        in = new StreamTokenizer(new BufferedReader(reader));
        PrintWriter out = new PrintWriter(writer);
        int n = nextInt();
        int e = nextInt();
        boolean[][] is = new boolean[n + 1][n + 1];
        for (int i = 0; i < e;i++) {
            int a = nextInt() - 1;
            int b = nextInt() - 1;
            is[a][b] = true;
            is[b][a] = true;
        }
        // calculating dp
        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();
    }
}
// Problem: 11_D. A Simple Task
// Time complexity: np
import java.util.Scanner;

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

public class CF {

	void realSolve() {
		int n = in.nextInt();
		int m = in.nextInt();
		boolean[][] f = new boolean[n][n];
		for (int i = 0; i < m; i++) {
			int fr = in.nextInt() - 1;
			int to = in.nextInt() - 1;
			f[fr][to] = f[to][fr] = true;
		}
		long[][] dp = new long[n][1 << n];
		for (int i = 0; i < n; i++)
			dp[i][1 << i] = 1;
		long res = 0;
		int[] len = new int[n + 1];
		for (int st = 0; st < 1 << n; st++) {
			int from = Integer.lowestOneBit(st);
			for (int i =0; i < n;i++)
				if (((1<<i) & st) != 0) {
					from =i;
					break;
				}
			for (int to = 0; to < n; to++)
				if (dp[to][st] != 0)
					for (int next = from; next < n; next++)
						if (f[to][next]
								&& ((((1 << next) & st) == 0) || next == from))
							if (next == from) {
								if (Integer.bitCount(st) > 2) {
									res += dp[to][st];
									len[Integer.bitCount(st)] += dp[to][st];
								}
							} else {
								dp[next][st | (1 << next)] += dp[to][st];
							}
		}
		out.println(res / 2);
	}

	private class InputReader {
		StringTokenizer st;
		BufferedReader br;

		public InputReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public InputReader(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

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

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

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

		boolean hasMoreElements() {
			while (st == null || !st.hasMoreElements()) {
				String s;
				try {
					s = br.readLine();
				} catch (IOException e) {
					return false;
				}
				st = new StringTokenizer(s);
			}
			return st.hasMoreElements();
		}

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

	InputReader in;
	PrintWriter out;

	void solve() {
		in = new InputReader(new File("object.in"));
		try {
			out = new PrintWriter(new File("object.out"));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}

		realSolve();

		out.close();
	}

	void solveIO() {
		in = new InputReader(System.in);
		out = new PrintWriter(System.out);

		realSolve();

		out.close();

	}

	public static void main(String[] args) {
		new CF().solveIO();
	}
}
// Problem: 11_D. A Simple Task
// Time complexity: np
import java.util.Scanner;

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