codeparrot/codecomplex huggingface dataset:
// Problem: 16_E. Fish
// Time complexity: np
/**
 * Codeforces Beta Round 16
 * 
 * @author ProjectYoung
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class CF16E {
  private void solve(InputReader in, PrintWriter out) {
    int n = in.nextInt();
    double[][] prob = new double[n][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        prob[i][j] = in.nextDouble();
      }
    }
    int[] fish = new int[n];
    for (int i = 0; i < n; i++) {
      fish[i] = 1 << i;
    }

    double[] res = new double[1 << n];
    res[0] = 1.0;
    for (int mask = 1; mask < (1 << n) - 1; mask++) {
      for (int i = 0; i < n; i++) {
        if ((mask & fish[i]) == 0) {
          continue;
        }
        int lastMask = mask ^ fish[i];
        int live = n;
        for (int j = 0; j < n; j++) {
          if ((lastMask & fish[j]) != 0) {
            live--;
          }
        }
        double p = 0.0;
        for (int j = 0; j < n; j++) {
          if ((lastMask & fish[j]) != 0 || j == i) {
            continue;
          }
          p += prob[j][i];
        }
        res[mask] += res[lastMask] * p * 2 / live / (live - 1);
      }
    }
    for (int i = 0; i < n; i++) {
      out.printf("%.6f ", res[((1 << n) - 1) ^ fish[i]]);
    }
  }

  public static void main(String[] args) {
    InputReader in = new InputReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    new CF16E().solve(in, out);
    out.close();
  }

  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 double nextDouble() {
      return Double.parseDouble(next());
    }
  }
}
// Problem: 16_E. Fish
// Time complexity: np
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
 
 
public class Main {
	static int n, exp;
	static double arr[][],dp[], dies[][];
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		n = new Integer(br.readLine());
		arr = new double[n][n];
		StringTokenizer st;
		for (int i = 0; i < n; i++) {
			st = new StringTokenizer(br.readLine());
			for (int j = 0; j < n; j++) {
				arr[i][j] = Double.parseDouble(st.nextToken());
			}
		}
		exp = 1<<n;
		dp = new double[exp];
		dies = new double[n][exp];
		for (int all = 0; all < exp; all++) {
			dp[all] = -1;
			int countAlive = 0;
			for (int i = 0; i < n; i++) {
				if((all&(1<<i))!=0)
					countAlive++;
			}
			if(countAlive <2)continue;
			double x=1.0/(countAlive*(countAlive-1)/2.0);
			for(int i=0; i<n; i++){
				dies[i][all]=0;
				int mask=1<<i;
				if((mask&all)>0){
					for(int j=0; j<n; j++)
					{
						int mask2=1<<j;
						if((mask2&all)>0)
							dies[i][all]+=arr[j][i];
					}
					dies[i][all]*=x;
				}
			}
		}
		for(int myFish=0; myFish<n; myFish++){
			if(myFish>0)System.out.printf(" ");
			System.out.printf("%.6f",ff(1<<myFish));
		}
		System.out.println();	
 
	}
	static double ff(int state){
		if(state==exp-1)return 1;
		if(dp[state]!=-1)return dp[state];
		double ans=0;
		for(int i=0; i<n; i++)
		{
			int mask=1<<i;
			if((mask &state)==0)
			{
				ans+=dies[i][state+mask]*ff(state+mask);
			}
		}
		return dp[state]=ans;
	}
 
}
// Problem: 16_E. Fish
// Time complexity: np
import java.util.Locale;
import java.util.Scanner;


public class E {

    public static void main(String[] args) {
        Locale.setDefault(Locale.US);
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double[][]p = new double[n][n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                p[i][j] = sc.nextDouble();
            }
        }
        double[]dp = new double[1<<n];
        dp[(1 << n)-1] = 1;
        for (int mask = (1 << n)-1; mask > 0; mask--) {
            int t = Integer.bitCount(mask);
            if (t==1)
                continue;
            double p0 = 1.0/(t*(t-1)/2);
            for (int i = 0; i < n; i++) {
                if ((mask & (1 << i)) != 0) {
                    for (int j = 0; j < n; j++) {
                        if (j != i && (mask & (1 << j)) != 0)
                            dp[(mask ^ (1 << i))] += dp[mask] * p[j][i]*p0;
                    }
                }
            }
        }
        for (int i = 0; i < n; i++) {
            System.out.print(dp[1 << i]+" ");
        }
    }
}
// Problem: 16_E. Fish
// Time complexity: np
import java.io.*;
import java.util.*;
import java.math.*;
import java.util.regex.*;

/**
 *
 * @author jon
 */
public class Fish {
    double memo[] = new double[(1<<18)];
    int N, FULL;
    double prob[][] = new double[18][18];
    Fish() {
        Scanner in = new Scanner(System.in);
        Arrays.fill(memo, -1);

        N = in.nextInt();
        FULL = (1<<N) - 1;

        for(int i = 0; i < N; i++) {
            for(int j = 0; j < N; j++) {
                prob[i][j] = in.nextDouble();
            }
        }

        for(int i = 0; i < N; i++) {
            System.out.printf("%.6f ", go((1<<i)));
        }
        System.out.println();



    }
    public double go(int mask) {
        if(mask == FULL) return 1.0;
        if(memo[mask] >= 0) return memo[mask];
        double ret = 0;
        double mult = Integer.bitCount(mask) + 1;
        mult *= (mult-1)/2.0;
//        double k = getBits(mask);
//        System.out.println(k + " " + mult);
//        k *= (k-1)/2.0;

        for(int i = 0; i < N; i++) {
            if(((1<<i) & mask) != 0) {
                for(int j = 0; j < N; j++) {
                    if(((1<<j) & mask) == 0) {
                        ret += go(mask | (1<<j)) * prob[i][j] / mult;
                    }
                }
            }
        }
        //ret /= (double)mult;

        memo[mask] = ret;
        return ret;
    }
  private int getBits(int x){
    int cnt = 0;
    while(x > 0){
      x&=(x-1);
      cnt++;
    }
    return cnt+1;
  }
    public static void main(String args[]) {
        new Fish();
    }
}
// Problem: 16_E. Fish
// Time complexity: np
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Arrays;
import java.util.Locale;

public class E16 {

	static StreamTokenizer in;
	static PrintWriter out;
	
	static int nextInt() throws IOException {
		in.nextToken();
		return (int)in.nval;
	}
	
	static double nextDouble() throws IOException {
		in.nextToken();
		return in.nval;
	}
	
	static String nextString() throws IOException {
		in.nextToken();
		return in.sval;
	}

	public static void main(String[] args) throws IOException {
		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
		out = new PrintWriter(System.out);
		
		n = nextInt();
		t = 1 << n;
		m = new double[n][n];
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				m[i][j] = nextDouble();
		
		memo = new double[t];
		Arrays.fill(memo, Double.POSITIVE_INFINITY);
		for (int i = 0; i < n; i++) out.print(String.format(Locale.US, "%.6f", solve(1 << i)) + " ");
		out.println();
		
		out.flush();
	}
	
	static int n, t;
	static double[][] m;
	static double[] memo;
	
	static double solve(int mask) {
		if (memo[mask] != Double.POSITIVE_INFINITY) return memo[mask];
		if (mask == t-1) return memo[mask] = 1;
		
		int k = Integer.bitCount(mask);
		k = (k+1)*k/2;
		double res = 0;
		for (int i = 0; i < n; i++) if ((mask&(1 << i)) != 0)
			for (int j = 0; j < n; j++) if ((mask&(1 << j)) == 0)
				res += m[i][j]*solve(mask|(1 << j));
		
		return memo[mask] = res/k;
	}
}
// Problem: 16_E. Fish
// Time complexity: np
import java.util.Arrays;
import java.util.Locale;
import java.util.Scanner;

public class Fish {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        in.useLocale(Locale.US);
        int n = in.nextInt();

        double[] dp = new double[1 << n];
        Arrays.fill(dp, 0);
        dp[(1 << n) - 1] = 1;//?

        double[][] prob = new double[n][n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                prob[i][j] = in.nextDouble();
            }
        }

        
        for (int t = (1 << n) - 1; t >= 0; t--) {
            int k = Integer.bitCount(t);
            for (int i = 0; i < n; i++) {
                if ((t & (1 << i)) > 0) {
                    for (int j = 0; j < n; j++) {
                        if ((t & (1 << j)) > 0) {
                            if (i != j) {
                                dp[t - (1 << j)] += dp[t] * prob[i][j] / (k*(k-1)/2);
                            }
                        }
                    }
                }
            }
        }

        for (int i = 0; i < n; i++) {
            System.out.print(dp[1 << i] + " ");
        }
    }
}
// Problem: 16_E. Fish
// Time complexity: np
import java.io.*;
import java.util.*;

public class CF16E {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		double[][] aa = new double[n][n];
		for (int i = 0; i < n; i++) {
			StringTokenizer st = new StringTokenizer(br.readLine());
			for (int j = 0; j < n; j++)
				aa[i][j] = Double.parseDouble(st.nextToken());
		}
		double[][] pp = new double[1 << n][n];
		for (int k = 0; k < n; k++)
			pp[1 << k][k] = 1;
		for (int b = 1; b < 1 << n; b++) {
			int c = 0;
			for (int i = 0; i < n; i++) {
				if ((b & 1 << i) == 0)
					continue;
				c++;
				for (int j = i + 1; j < n; j++) {
					if ((b & 1 << j) == 0)
						continue;
					for (int k = 0; k < n; k++) {
						if ((b & 1 << k) == 0)
							continue;
						pp[b][k] += aa[i][j] * pp[b ^ 1 << j][k];
					 	pp[b][k] += aa[j][i] * pp[b ^ 1 << i][k];
					}
				}
			}
			if (c > 1) {
				double p = (double) c * (c - 1) / 2;
				for (int k = 0; k < n; k++)
					pp[b][k] /= p;
			}
		}
		StringBuilder sb = new StringBuilder();
		int b = (1 << n) - 1;
		for (int k = 0; k < n; k++)
			sb.append(pp[b][k]).append(k == n - 1 ? '\n' : ' ');
		System.out.print(sb);
	}
}
// Problem: 16_E. Fish
// Time complexity: np
import java.io.*;
import java.util.*;
public class E16 {
	static double[][] grid;
	public static void main(String[] args) throws IOException	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		grid = new double[n][n];
		for(int i = 0; i < n; i++)	{
			StringTokenizer st = new StringTokenizer(br.readLine());
			for(int j = 0; j < n; j++)	{
				grid[i][j] = Double.parseDouble(st.nextToken());
			}
		}
		boolean[] seen = new boolean[1<<n];
		double[] prob = new double[1<<n];
		prob[(1<<n)-1] = 1;
		LinkedList<Integer> q = new LinkedList<Integer>();
		q.add((1<<n)-1);
		while(!q.isEmpty())	{
			int curr = q.removeFirst();
			if(Integer.bitCount(curr) == 1)
				continue;
			for(int i = 0; i < n; i++)	{
				if((curr & (1 << i)) == 0)
					continue;
				for(int j = i+1; j < n; j++)		{
					if((curr & (1<<j)) == 0)
						continue;
					prob[curr-(1<<i)] += prob[curr] * grid[j][i];
					prob[curr-(1<<j)] += prob[curr] * grid[i][j];
					if(!seen[curr-(1<<i)])	{
						q.addLast(curr-(1<<i));
						seen[curr-(1<<i)] = true;
					}
					if(!seen[curr-(1<<j)])	{
						q.addLast(curr-(1<<j));
						seen[curr-(1<<j)] = true;
					}
				}
			}
			prob[curr] = 0;
		}
		double sum = 0;
		for(int i = 0; i < n; i++)		{
			sum += prob[1<<i];
		}
		for(int i = 0; i < n-1; i++)	{
			System.out.print(prob[1<<i]/sum + " ");
		}
		System.out.println(prob[1<<(n-1)]/sum);
	}
}
// Problem: 16_E. Fish
// Time complexity: np

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Problem {

	public static void main(String[] arg){
		FastScanner scan = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = scan.nextInt();
		
		double ncr[][] = new double[n+1][n+1];
		ncr[1][0] = ncr[0][1] = ncr[1][1] = 1.0;
		for(int i = 2; i <= n; i++){
			for(int j = 0; j <= i; j++){
				if(j == 0 || j == i) ncr[i][j] = 1.0;
				else ncr[i][j] = ncr[i-1][j] + ncr[i-1][j-1];
				//System.out.print(ncr[i][j] + "  ");
			}
			//System.out.println();
		}
		
		double a[][] = new double[n+1][n+1];
		for(int i = 0; i < n; i++)
			for(int j = 0; j < n; j++)
				a[i][j] = scan.nextDouble();
		
		double dp[] = new double[1<<19];
		dp[(1<<n) - 1] = 1.0;
		for(int state = (1 << n) - 1; state >= 0; state--){
			int len = 0;
			for(int i = 0; i < n; i++)
				if((state & (1 << i)) > 0) len++;
			
			for(int i = 0; i < n; i++){
				if(((1 << i) & state) == 0) continue;
				for(int j = 0; j < i; j++){
					if(((1 << j) & state) == 0) continue;
					dp[state & (~(1<<i))] += (dp[state] * a[j][i] / ncr[len][2]);
					dp[state & (~(1<<j))] += (dp[state] * a[i][j] / ncr[len][2]);
					//System.out.println(state + " / " + (state & (~(1<<i))) + " / " + dp[state] + " / " + a[j][i] + " / " + (dp[state] * a[j][i]) + " / "  + dp[state & (~(1<<i))]);
					//System.out.println(state + " / " + (state & (~(1<<j))) + " / " + dp[state] + " / " + a[i][j] + " / " + (dp[state] * a[i][j]) + " / "  + dp[state & (~(1<<j))]);
					//System.out.println();
				}
			}
		}
		for(int i = 0; i < n; i++)
			System.out.print(String.format("%.6f", dp[1<<i]) + " ");
		out.close();
	}
	public static long gcd(long a, long b){
		if(b == 0) return a;
		if(a < b) return gcd(b, a);
		return gcd(b, a % b);
	}
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(InputStream is) {
			try {
				br = new BufferedReader(new InputStreamReader(is));
			} catch (Exception e) {
				e.printStackTrace();
			}
		}

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

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

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

		double nextDouble() {
			return Double.valueOf(next());
		}
	}
}
// Problem: 16_E. Fish
// 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 A {
 
	static double[][] a;
	static int N;
	static double[] memo;
 
	static double dp(int alive)
	{
		int count = Integer.bitCount(alive);
		if(count == N)
			return 1;
		if(memo[alive] > -5)
			return memo[alive];
		
		double ret = 0;
		for(int j = 0; j < N; ++j)
			if((alive & (1<<j)) == 0)
				ret += die[j][alive | 1<<j] * dp(alive | 1<<j);			
	
		return memo[alive] = ret;
	}
 
	static double[][] die;
	static void f()
	{
		die = new double[N][1<<N];
		for(int i = 0; i < N; ++i)
			for(int j = 0; j < 1<<N; ++j)
			{
				int count = Integer.bitCount(j);
				if(count <= 1)
					continue;
				double prop = 1.0 / (count * (count - 1) >> 1);
				for(int k = 0; k < N; ++k)
					if((j & (1<<k)) != 0)
						die[i][j] += prop * a[k][i]; 
			}
 
	}
 
	public static void main(String[] args) throws IOException {
 
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
 
		N = sc.nextInt();
		
		a = new double[N][N];
		for(int i = 0; i < N; ++i)
			for(int j = 0; j < N; ++j)
				a[i][j] = sc.nextDouble();
		memo = new double[1<<N];
		f();

		Arrays.fill(memo, -10);		
		for(int i = 0; i < N - 1; ++i)
			out.printf("%.8f ", dp(1 << i));
		out.printf("%.8f\n", dp(1 << N - 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 double nextDouble() throws NumberFormatException, IOException
		{
			return Double.parseDouble(next());
		}

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

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

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

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


	}
}
// Problem: 16_E. Fish
// Time complexity: np
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Arrays;
import java.util.Locale;

public class E16 {

    static StreamTokenizer in;
    static PrintWriter out;
    
    static int nextInt() throws IOException {
        in.nextToken();
        return (int)in.nval;
    }
    
    static double nextDouble() throws IOException {
        in.nextToken();
        return in.nval;
    }
    
    static String nextString() throws IOException {
        in.nextToken();
        return in.sval;
    }

    public static void main(String[] args) throws IOException {
        in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(System.out);
        
        n = nextInt();
        t = 1 << n;
        m = new double[n][n];
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                m[i][j] = nextDouble();
        
        memo = new double[t];
        Arrays.fill(memo, Double.POSITIVE_INFINITY);
        for (int i = 0; i < n; i++) out.print(String.format(Locale.US, "%.6f", solve(1 << i)) + " ");
        out.println();
        
        out.flush();
    }
    
    static int n, t;
    static double[][] m;
    static double[] memo;
    
    static double solve(int mask) {
        if (memo[mask] != Double.POSITIVE_INFINITY) return memo[mask];
        if (mask == t-1) return memo[mask] = 1;
        
        int k = Integer.bitCount(mask);
        k = (k+1)*k/2;
        double res = 0;
        for (int i = 0; i < n; i++) if ((mask&(1 << i)) != 0)
            for (int j = 0; j < n; j++) if ((mask&(1 << j)) == 0)
                res += m[i][j]*solve(mask|(1 << j));
        
        return memo[mask] = res/k;
    }
}
// Problem: 16_E. Fish
// Time complexity: np
import java.util.Arrays;
import java.util.Scanner;


public class Main {
    static double[] dp;
    static double[][] P;
    public static void main(String[] args) {
        Scanner r = new Scanner(System.in);
        
        int n = r.nextInt();
        
        double[][] g = new double[n][n];
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++)
                g[i][j] = r.nextDouble();
        
        dp = new double[1 << n];
        P = new double[1 << n][n];
        for(int mask = 0; mask < 1 << n; mask++){
            for(int d = 0; d < n; d++)if((mask & (1 << d)) == 0)
                for(int i = 0; i < n; i++)if((mask & (1 << i)) == 0){
                    if(i == d)continue;
                    
                    P[mask][d] += g[i][d];
                }
        }
        
        for(int i = 0; i < n; i++){
            Arrays.fill(dp, -1);
            
            double res = go(i, 0, g, n, n);
            System.out.println(res);
        }
    }

    private static double go(int a, int v, double[][] g, int cnt, int n) {
        if(dp[v] != -1)return dp[v];
        
        if(cnt == 1){
            return 1;
        }else{
            double ret = 0;
            for(int d = 0; d < n; d++)if((v & (1 << d)) == 0 && d != a){
                double current =  P[v][d] * go(a, v | 1 << d, g, cnt-1, n);
                ret += current;
            }
            
            return dp[v] = ret/(cnt * (cnt-1) /2);
        }  
    }
}
// Problem: 16_E. Fish
// Time complexity: np
import java.util.Scanner;

public class A {

    public static int n;
    public static double[] masks;
    public static double[][] matrix;

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        n = scan.nextInt();

        matrix = new double[n][n];
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                matrix[i][j] = scan.nextDouble();

        masks = new double[1 << n];
        masks[(1 << n) - 1] = 1;
        for (int i = 0; (1 << i) < (1 << n); i++)
            fillDP(1 << i);

        for (int i = 0; (1 << i) < (1 << n); i++)
            System.out.printf("%.6f ", masks[1 << i]);


    }

    public static double fillDP(int mask) {
        int bitCount = Integer.bitCount(mask);

        if (masks[mask] != 0)
            return masks[mask];

        double matchProba = 2.0 / (((double) (bitCount)) * ((double) (bitCount + 1)));

        double totalProba = 0;
        for (int i = 0; i < n; i++) {
            int iPower = 1 << i;

            if ((mask & iPower) != iPower)
                continue;

            for (int j = 0; j < n; j++) {
                int jPower = 1 << j;

                if ((mask & jPower) == jPower || i == j)
                    continue;

                // still alive
                totalProba += (matchProba * matrix[i][j] * fillDP(mask | jPower));
            }
        }

        return masks[mask] = totalProba;

    }
}