codeparrot/codecomplex huggingface dataset:
// 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.StringTokenizer;

public class Main16E {

    private FastScanner in;
    private PrintWriter out;

    public void solve() throws IOException {
        int n = in.nextInt();
        double[][] a = new double[n][n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                a[i][j] = in.nextDouble();
            }
        }
        int k = 1 << n;
        double[] p = new double[k];
        int[][] b = new int[n + 1][];
        for (int i = 0; i <= n; i++) {
            b[i] = new int[comb(i, n)];
        }
        int[] bl = new int[n + 1];
        for(int i = 0; i < k; i++) {
            int c = c2(i);
            b[c][bl[c]] = i;
            bl[c]++;
        }
        p[k - 1] = 1;
        for (int i = n; i >= 2; i--) {
            for (int j = 0; j < b[i].length; j++) {
                int t = b[i][j];
                double pm = 1;
                pm /= (i * (i - 1) / 2);
                for (int x = 0; x < n; x++) {
                    for (int y = x + 1; y < n; y++) {
                        if ((t & (1 << x)) > 0 && (t & (1 << y)) > 0) {
                            p[t & ~(1 << x)] += p[t] * pm * a[y][x];
                            p[t & ~(1 << y)] += p[t] * pm * a[x][y];
                        }
                    }
                }
            }
        }
        for (int i = 0; i < n; i++) {
            out.print(p[1 << i] + " ");
        }
    }

    int comb(int n, int m) {
        int res = 1;
        for (int i = 1; i <= n; i++) {
            res = res * (m - i + 1);
            res /= i;
        }
        return res;
    }

    int c2(int k) {
        int res = 0;
        while (k > 0) {
            if (k % 2 == 1) {
                res ++;
            }
            k /= 2;
        }
        return res;
    }

    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());
        }

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

    public static void main(String[] arg) {
        new Main16E().run();
    }
}
// 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.util.Arrays;
import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;

public class ProblemE {
	
	
	static final int INF = 1000000;
	
	
	
	public static void main(String[] args) throws IOException {
		BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);

		int n = Integer.valueOf(s.readLine());
		double[][] prob = new double[n][n];
		double[] dp = new double[1<<n];
		for (int i = 0 ; i < n ; i++) {
			String[] line = s.readLine().split(" ");
			for (int j = 0 ; j < n ; j++) {
				prob[i][j] = Double.valueOf(line[j]);
			}
		}
		
		dp[(1<<n)-1] = 1.0d;
		for (int p = (1<<n)-1 ; p >= 1 ; p--) {
			if (dp[p] > 0.0d) {
				int left = Integer.bitCount(p);
				if (left == 1) {
					continue;
				}
				double baseProb = 1.0d / (left * (left - 1) / 2);
				for (int i = 0 ; i < n ; i++) {
					if ((p & (1<<i)) == 0) {
						continue;
					}
					for (int j = i+1 ; j < n ; j++) {
						if ((p & (1<<j)) == 0) {
							continue;
						}
						dp[p-(1<<i)] += dp[p] * baseProb * prob[j][i];
						dp[p-(1<<j)] += dp[p] * baseProb * prob[i][j];
					}
				}
			}
		}
		
		
		StringBuffer b = new StringBuffer();
		for (int i = 0 ; i < n ; i++) {
			b.append(" ").append(dp[1<<i]);
		}
		out.println(b.substring(1));
		out.flush();
	}



	public static void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}
}
// Problem: 16_E. Fish
// Time complexity: np
import java.util.*;
import java.io.*;

public class Fish
{
    public static void main(String[] args) throws Exception { new Fish(); }
   
    public Fish() throws Exception
    {
        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[] best = new double[1 << N];
        best[(1 << N)-1] = 1;
        for(int mask = (1 << N)-1; mask > 0; mask--)
        {
            int C = Integer.bitCount(mask);
            if(C == 1) continue;
            for(int i = 0; i < N; i++) if (on(mask, i))
                for(int j = i+1; j < N; j++) if(on(mask, j))
                {
                    int nmask = mask & ~(1 << j);
                    best[nmask] += P[i][j] * best[mask] * 2.0 / (C*(C-1.0));
                    nmask = mask & ~(1 << i);
                    
                    best[nmask] += P[j][i] * best[mask] * 2.0/ (C*(C-1.0));
                }
        }

        for(int i = 0; i < N; i++)
            System.out.printf("%.7f ", best[1 << i] + 1e-9);
        System.out.println();
    }

    boolean on(int mask, int pos) { return (mask & (1 << pos)) > 0; }

}
// Problem: 16_E. Fish
// Time complexity: np
import java.util.Arrays;
import java.util.Scanner;

public class E {
    static double[] dp;
    static int[] oneCount;
    static int end;
    static int n;
    static double[][] prob;
    public static double solve(int mask) {
        if(mask==end) return 1;
        int oneC=0,zeroC=0;
        for(int i=0;i<n;i++) {
            if((mask|(1<<i))==mask) oneC++;
            else zeroC++;
        }
        double res=0;
        for(int i=0;i<n;i++) {
            if((mask|(1<<i))!=mask) continue;
            for(int j=0;j<n;j++) {
                //
                if((mask|(1<<j))==mask) continue;
                //System.out.println(i+" "+j+" "+prob[i][j]+" "+Integer.toBinaryString(mask)+" "+oneC+" "+zeroC);
                res+=(1.0/((oneC*(oneC+1))/2))*prob[i][j]*solve(mask|(1<<j));
            }
        }
        return dp[mask]=res;
    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        n=sc.nextInt();
        prob=new double[n][n];
        for(int i=0;i<n;i++) 
            for(int j=0;j<n;j++)
                prob[i][j]=sc.nextDouble();
        dp=new double[1<<n];
        oneCount=new int[1<<n];
        int c;
        for(int i=0;i<dp.length;i++) {
            c=0;
            for(int j=0;j<n;j++) {
                if((i|(1<<j))==i) c++;
            }
            oneCount[i]=c;
        }
        end=(1<<n)-1;
        double res,rad;
        int count;
        for(int k=end;k>0;k--) {
            if(k==end) dp[k]=1;
            else {
                res=0;
                count=oneCount[k];
                count=count*(count+1);
                count>>=1;
                rad=1.0/count;
                //System.out.println(rad+" "+count);
                for(int i=0;i<n;i++) {
                    if((k|(1<<i))!=k) continue;
                    for(int j=0;j<n;j++) {
                        //
                        if((k|(1<<j))==k) continue;
                        //System.out.println(i+" "+j+" "+prob[i][j]+" "+Integer.toBinaryString(mask)+" "+oneC+" "+zeroC);
                        res+=rad*prob[i][j]*dp[k|(1<<j)];
                    }
                }
                dp[k]=res;
            }
        }
        //Arrays.fill(dp, -1);
        for(int i=0;i<n;i++)
            System.out.print(dp[1<<i]+" ");
            //System.out.print(solve(1<<i)+" ");
//      for(int i=0;i<18;i++){
//          for(int k=0;k<18;k++)
//              System.out.print(Math.random()+" ");
//          System.out.println();
//      }
    }
}
// Problem: 16_E. Fish
// Time complexity: np
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;

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("");
	
	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		
		int N = nextInt();
		double[][] a = new double [N][N];
		
		for (int i = 0; i < N; i++)
			for (int j = 0; j < N; j++)
				a[i][j] = nextDouble();
		
		int NN = 1 << N;
		
		double[] dp = new double [NN];
		dp[NN - 1] = 1.0;
		
		for (int mask = NN - 1; mask > 0; mask--) {
			int b = Integer.bitCount(mask);
			if (b <= 1)
				continue;

			double k = 2.0 / (b * (b - 1));
			
			for (int i = 0; i < N; i++) {
				if ((mask & (1 << i)) == 0)
					continue;
				
				for (int j = i + 1; j < N; j++) {
					if ((mask & (1 << j)) == 0)
						continue;
					
					double p = a[i][j];
					dp[mask & (~(1 << j))] += k * p * dp[mask];
					dp[mask & (~(1 << i))] += k * (1.0 - p) * dp[mask];
				}
			}
		}
		
		out.printf(Locale.US, "%.8f", dp[1]);
		
		for (int i = 1, ind = 2; i < N; ind <<= 1, i++)
			out.printf(Locale.US, " %.8f", dp[ind]);
		out.println();
		out.close();
	}
	
	String nextToken() throws IOException {
		while (!st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		
		return st.nextToken();
	}
	
	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}
	
	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}
	
	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
	
	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}
	
	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}
}
// Problem: 16_E. Fish
// Time complexity: np
import java.io.*;
import java.util.*;

public class Main {
	static Scanner in;
	static PrintWriter out;
//	static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}

	public static void main(String[] args) throws Exception {
		in = new Scanner(System.in);
		out = new PrintWriter(System.out);
//		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

		int n = in.nextInt();

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

		double[] q = new double[1 << n];
		q[(1 << n) - 1] = 1;
		for (int mask = (1 << n) - 1; mask > 0; mask--) {
			int count = 0;

			for (int t = 0; t < n; t++) if (((1 << t) & mask) != 0) count++;
			if (count <= 1) continue;
			count = count*(count - 1)/2;

			for (int t = 0; t < n; t++) if (((1 << t) & mask) != 0)
				for (int s = 0; s < t; s++) if (((1 << s) & mask) != 0) {
					q[mask - (1 << t)] += q[mask] / count * p[s][t];
					q[mask - (1 << s)] += q[mask] / count * p[t][s];
				}
		}

		for (int i = 0; i < n; i++) out.print(q[1 << i] + " ");

		out.close();
	}
}
// Problem: 16_E. Fish
// Time complexity: np
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;

public class BetaRound16_E implements Runnable {

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok = new StringTokenizer("");

	public static void main(String[] args) {
		new Thread(null, new BetaRound16_E(), "", 256 * (1L << 20)).start();
	}

	public void run() {
		try {
			long t1 = System.currentTimeMillis();
			if (System.getProperty("ONLINE_JUDGE") != null) {
				in = new BufferedReader(new InputStreamReader(System.in));
				out = new PrintWriter(System.out);
			} else {
				in = new BufferedReader(new FileReader("input.txt"));
				out = new PrintWriter("output.txt");
			}
			Locale.setDefault(Locale.US);
			solve();
			in.close();
			out.close();
			long t2 = System.currentTimeMillis();
			System.err.println("Time = " + (t2 - t1));
		} catch (Throwable t) {
			t.printStackTrace(System.err);
			System.exit(-1);
		}
	}

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	long readLong() throws IOException {
		return Long.parseLong(readString());
	}

	double readDouble() throws IOException {
		return Double.parseDouble(readString());
	}

	// solution
	
	double[] p;
	int n;
	double[][] a;
	
	void solve() throws IOException {
		n = readInt();
		a = new double[n][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				a[i][j] = readDouble();
			}
		}
		p = new double[1 << n];
		Arrays.fill(p, -1);
		p[(1 << n) - 1] = 1;
		for (int i = 0; i < n; i++) {
			out.printf("%.12f ", p(1 << i));
		}
	}
	
	double p(int mask) {
		if (p[mask] != -1) return p[mask];
		double ans = 0;
		for (int eaten = 0; eaten < n; eaten++) {
			int prev = mask | (1 << eaten);
			if (prev != mask) {
				for (int eats = 0; eats < n; eats++) {
					if ((mask & (1 << eats)) != 0) {
						ans += a[eats][eaten] * p(prev);
					}
				}
			}
		}
		int bc = Integer.bitCount(mask);
		int norm = bc * (bc + 1) / 2;
		return p[mask] = ans / norm;
	}
	
}
// Problem: 16_E. Fish
// Time complexity: np
// by agus.mw
import java.util.*;
import java.io.*;

public class Main{
  public static void main(String[] args) throws Exception {
    new Main().doWork();
  }
  void doWork() throws Exception{
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
    
    int ncase = Integer.valueOf(reader.readLine());
    double[][] p = new double[ncase][];
    for(int icase=0;icase<ncase;icase++){
      p[icase] = toDoubleArray(reader.readLine());
    }
    double[] prob = new double[1<<ncase];
    prob[0] = 1;
    for(int x=0;x<(1<<ncase);x++){
      double cp = prob[x];
      int count = 0;
      for(int i=0;i<ncase;i++){
        if((x&(1<<i))!=0) continue;
        count ++;
      }
      if(count == 1) continue;
      double np = cp*2.0/(count)/(count-1);
      for(int i=0;i<ncase;i++){
        if((x&(1<<i))!=0) continue;
        for(int j=i+1;j<ncase;j++){
          if((x&(1<<j))!=0) continue;
          prob[x^(1<<j)] += np*p[i][j];
          prob[x^(1<<i)] += np*p[j][i];
        }
      }
    }
    String out = "";
    for(int i=0;i<ncase;i++){
      if(i>0) out += " ";
      int index = ((1<<ncase)-1)^(1<<i);
      out += String.format("%.6f",prob[index]);
    }
    out += "\r\n";
    writer.write(out,0,out.length());
    writer.flush();
    writer.close();
    reader.close();
  }
  String process(){
    return "1";
  }
  double[] toDoubleArray(String line){
    String[] p = line.split("[ ]+");
    double[] out = new double[p.length];
    for(int i=0;i<p.length;i++) out[i] = Double.valueOf(p[i]);
    return out;
  }
}
// Problem: 16_E. Fish
// Time complexity: np
import java.io.*;
import java.util.*;
import static java.util.Arrays.*;

public class E implements Runnable
{
    public static void main(String[] args) throws IOException
    {
        new Thread(null, new E(), "", 1 << 20).start();
    }   
    
    BufferedReader input;
    PrintWriter out;
    String file = "input";
    
    public void run()
    {
        try
        {
            //input = new BufferedReader(new FileReader(file + ".in"));
            input = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(new BufferedOutputStream(System.out));
            solve();
            
            out.close();    
        }
        catch(Exception e)
        {
            e.printStackTrace();
            System.exit(1);
        }
    }
    
    void solve() throws IOException
    {
        int n = Integer.parseInt(input.readLine());
        double[][] p = new double[n][n];
        for(int i = 0; i < n; i++)
        {
            StringTokenizer st = new StringTokenizer(input.readLine());
            for(int j = 0; j < n; j++) 
            {
                p[i][j] = Double.parseDouble(st.nextToken());
            }
        }
        double[] dp = new double[1 << n];
        int mask = (1 << n) - 1;
        dp[mask] = 1;
        for(int w = mask; w > 0; w--)
        {
            int count = 0;
            for(int i = 0; i < n; i++)
                for(int j = i + 1; j < n; j++)
                    if((w >> i & 1) != 0 && (w >> j & 1) != 0) count++;
            
            if(count == 0) continue;
            for(int i = 0; i < n; i++)
                for(int j = i + 1; j < n; j++)
                    if((w >> i & 1) != 0 && (w >> j & 1) != 0)
                    {
                        dp[w ^ (1 << i)] += 1.0 / count * p[j][i] * dp[w];
                        dp[w ^ (1 << j)] += 1.0 / count * p[i][j] * dp[w];
                    }
        }
        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 f {
	static int n;
	static double[][] g;
public static void main(String[] args) throws IOException {
	input.init(System.in);
	PrintWriter out = new PrintWriter(System.out);
	n = input.nextInt();
	g = new double[n][n];
	for(int i = 0; i<n; i++)
		for(int j = 0; j<n; j++)
			g[i][j] = input.nextDouble();
	for(int i = 0; i<n; i++)
		for(int j = 0; j<n; j++)
			g[j][i] = 1 - g[i][j];
	for(int i = 0; i<n; i++)
	{
		double[] dp = new double[1<<n];
		for(int mask = 0; mask < (1<<n); mask++)
		{
			if((mask & (1<<i)) == 0)
			{
				dp[mask] = 0;
				continue;
			}
			if(mask == (1<<i))
			{
				dp[mask] = 1;
				continue;
			}
			int count = Integer.bitCount(mask);
			double prob = 1.0 / (count * (count-1)/2);
			for(int a = 0; a<n; a++)
			{
				if((mask & (1<<a)) == 0) continue;
				for(int b = a+1; b<n; b++)
				{
					if((mask & (1<<b)) == 0) continue;
					double p = g[a][b] * dp[mask ^ (1<<b)] + g[b][a] * dp[mask ^ (1<<a)];
					dp[mask] += p;
				}
			}
			dp[mask] *= prob;
		}
		out.print(dp[(1<<n)-1]+" ");
	}
	out.close();
}
public static class input {
	static BufferedReader reader;
	static StringTokenizer tokenizer;

	static void init(InputStream input) {
		reader = new BufferedReader(new InputStreamReader(input));
		tokenizer = new StringTokenizer("");
	}

	static String next() throws IOException {
		while (!tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(reader.readLine());
		return tokenizer.nextToken();
	}

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

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

	static long nextLong() throws IOException {
		return Long.parseLong(next());
	}
}
}
// Problem: 16_E. Fish
// Time complexity: np
/**
 * Created by IntelliJ IDEA.
 * User: aircube
 * Date: 11.01.11
 * Time: 4:14
 * To change this template use File | Settings | File Templates.
 */

import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.Exchanger;


public class Template {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;

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

    void run() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        st = null;
        out = new PrintWriter(System.out);
        solve();
        br.close();
        out.close();
    }
    double dm[];
    double a[][];
    boolean fil[];
    int p[];
    int n;
    // x & (x - 1)
    // 10
    //
    void solve() throws  IOException {
        n = nextInt();
        a = new double[n][n];
        for(int i = 0; i < n; ++i)
            for (int j = 0; j < n; ++j) {
                a[i][j] = nextDouble();
            }
        dm = new double[1 << n];
        fil = new boolean[1 << n];
        for(int i = 0; i < n; ++i) {
            out.print(brute((1 << i)) + " ");
        }
    }

    private double brute(int mask) {
        if (Integer.bitCount(mask) == n) return 1;
        if (fil[mask]) return dm[mask];
        int c = Integer.bitCount(mask);
        double res = 0;
        double p = 2.0 / (double) (c + 1) / (double)(c ) ;
        for(int i = 0; i < n; ++i) {
            for(int j = 0; j < n; ++j) {
                if ((mask & (1 << i)) == 0 && (mask & (1 << j)) > 0) {
                    res += a[j][i] * brute(mask ^ (1 << i));
                }
            }
        }
        res *= p;
        dm[mask] = res;
        fil[mask] = true;
        return dm[mask];
    }


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

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

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

    String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
// Problem: 16_E. Fish
// Time complexity: np
import java.util.*;
import java.io.*;

public class Main{

  public void run(){
    Locale.setDefault(Locale.US);
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    double a[][] = new double[n][n];
    for(int i=0;i<n;i++) for(int j=0;j<n;j++) a[i][j] = in.nextDouble();

    double f[] = new double[1<<n];
    f[(1<<n)-1] = 1;

    for(int mask = (1<<n)-1;mask > 0;mask--){
      int k = Integer.bitCount(mask);
      if (k == 1) continue;

      for(int i=0;i<n;i++){
        if ((mask & (1 << i)) > 0){
          for(int j=0;j<n;j++){
            if ((mask & (1 << j)) > 0){
              f[mask&(~(1<<j))]+=f[mask]*a[i][j]/(k*(k-1)/2); 
            }  
          }
        }
      }
    }
    for(int i=0;i<n;i++)
      System.out.print(f[1<<i]+" ");
  }

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