codeparrot/codecomplex huggingface dataset:
// Problem: 16_E. Fish
// Time complexity: np

import java.util.*;
import java.text.*;
import java.math.*;

public class Main{
    
    static double EPS=1e-10;
    static double PI=Math.acos(-1.0);
    
    static double p[][]=new double[25][25];
    static double f[]=new double[1<<20];
    static int n;
    
    
    public static void PR(String s){
        System.out.print(s);
    }
    
    public static void PR(double s)
    {
        java.text.DecimalFormat d=new java.text.DecimalFormat("#.0000000");
        System.out.print(d.format(s));
    }
    
    public static void DP()
    {
        int i,j,k,cnt;
        for(i=0;i<(1<<n);i++) f[i]=0;
        f[(1<<n)-1]=1;
        for(k=(1<<n)-1;k>=0;k--)
        {
            cnt=0;
            for(i=0;i<n;i++) if((k&(1<<i))!=0) cnt++;
            for(i=0;i<n;i++) if((k&(1<<i))!=0)
            {
                for(j=0;j<n;j++) if(i!=j&&(k&(1<<j))!=0)
                {
                    f[k^(1<<j)]+=f[k]*p[i][j]/((cnt-1)*cnt/2);
                }
            }
        }
    }
    
    public static void main(String[] args){
  
        Scanner S=new Scanner(System.in);
        while(S.hasNext())
        {
            n=S.nextInt();
            int i,j;
            for(i=0;i<n;i++) for(j=0;j<n;j++) p[i][j]=S.nextDouble();
            DP();
            for(i=0;i<n;i++) 
            {
                if(i!=0) PR(" ");
                PR(f[1<<i]);
            }
            PR("\n");
        }
    }
}
// Problem: 16_E. Fish
// Time complexity: np
import java.util.*;
import java.text.*;
import java.math.*;

public class Main{
    
    static double EPS=1e-10;
    static double PI=Math.acos(-1.0);
    
    static double p[][]=new double[25][25];
    static double f[]=new double[1<<20];
    static int n;
    
    
    public static void PR(String s){
        System.out.print(s);
    }
    
    public static void PR(double s)
    {
        java.text.DecimalFormat d=new java.text.DecimalFormat("#.0000000");
        System.out.print(d.format(s));
    }
    
    public static void DP()
    {
        int i,j,k,cnt;
        for(i=0;i<(1<<n);i++) f[i]=0;
        f[(1<<n)-1]=1;
        for(k=(1<<n)-1;k>=0;k--)
        {
            cnt=0;
            for(i=0;i<n;i++) if((k&(1<<i))!=0) cnt++;
            for(i=0;i<n;i++) if((k&(1<<i))!=0)
            {
                for(j=0;j<n;j++) if(i!=j&&(k&(1<<j))!=0)
                {
                    f[k^(1<<j)]+=f[k]*p[i][j]/((cnt-1)*cnt/2);
                }
            }
        }
    }
    
    public static void main(String[] args){
  
        Scanner S=new Scanner(System.in);
        while(S.hasNext())
        {
            n=S.nextInt();
            int i,j;
            for(i=0;i<n;i++) for(j=0;j<n;j++) p[i][j]=S.nextDouble();
            DP();
            for(i=0;i<n;i++) 
            {
                if(i!=0) PR(" ");
                PR(f[1<<i]);
            }
            PR("\n");
        }
    }
}
// Problem: 16_E. Fish
// Time complexity: np
import java.text.DecimalFormat;
import java.util.Scanner;

/**
 *
 * @author Alvaro
 */
public class Main{
    public static int n;
    public static double [] dp;
    public static double [][] p;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        dp = new double[1<<n];
        p = new double[n][n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                p[i][j]= in.nextDouble();                
            }
        }
        for (int i = 0; i <(1<<n); i++) {
            dp[i] = -1;            
        }
        dp[(1<<n)-1]=1;
        DecimalFormat d = new DecimalFormat("0.000000");
        System.out.print(d.format(f(1<<0)));
        for (int i = 1; i < n; i++) {
            System.out.print(" "+d.format(f(1<<i)));
        }
    }
    
    public static double f(int mask) {
        if(dp[mask]>-0.5) return dp[mask];
        dp[mask] = 0;
        int vivos = 1;
        for (int i = 0; i < n; i++) 
            if((mask>>i)%2==1) vivos++;
        double pares = (vivos*(vivos-1))/2;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if((mask&(1<<i))!=0&&(mask&(1<<j))==0){
                    dp[mask]+=f(mask|(1<<j))*p[i][j]/pares;
                }
            }
            
        }
        return dp[mask];
                
    }
       
}
// 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];
        dm[(1 << n) - 1] = 1;
        for(int mask = (1 << n) - 1; mask >= 1; --mask) {
            int c = Integer.bitCount(mask);
            if (c == 1) continue ;
            double p = 2.0 / (double)(c - 1) / (double) c;
            for(int i = 0; i < n; ++i) {
                for (int j =0 ; j < n; ++j) {
                    if (i != j && (mask & (1 << i)) > 0 && (mask & (1 << j)) > 0) {
                        dm[mask ^ (1 << j)] += a[i][j] * dm[mask] * p;
                    }
                }
            }
        }
        for(int i = 0; i < n; ++i) {
            out.print(dm[1 << i] + " ");
        }
    }

    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.*;


public class E
{
   public static void main(String[] args)
   {
      new E(new Scanner(System.in));
   }


   public E(Scanner in)
   {
      int N = in.nextInt();
      double[][] g = new double[N][N];

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

      double[] memo = new double[1<<N];
      memo[(1<<N)-1] = 1.0;
      
      for (int m=(1<<N)-1; m>0; m--)
      {
         int cnt = 0;
         for (int i=0; i<N; i++)
         {
            int m1 = 1 << i;
            if ((m1&m) > 0)
               cnt++;
         }

         int sum = (cnt*(cnt-1))/2;
         for (int i=0; i<N; i++)
         {
            int m1 = 1 << i;
            if ((m1&m) == 0) continue;

            for (int j=i+1; j<N; j++)
            {
               int m2 = 1 << j;
               if ((m2&m) == 0) continue;
               
               memo[m-m1] += (g[i][j]*memo[m])/sum;
               memo[m-m2] += (g[j][i]*memo[m])/sum;
            }
         }
      }

      StringBuilder sb = new StringBuilder();
      for (int i=0; i<N; i++)
      {
         double res = memo[1<<i];
         sb.append(String.format("%.8f", res));
         sb.append(' ');
      }
      System.out.println(sb.toString().trim());
   }
}
// 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;


        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];
                    }
                }
            }
        }
        ret /= mult;

        memo[mask] = ret;
        return ret;
    }
    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.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
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 == 1)
		{
			double[] ret = new double[N];
			for(int i = 0; i < N; ++i)
				if((alive & (1<<i)) != 0)
				{
					ret[i] = 1;
					break;
				}
			return memo[alive] = ret;
		}
		if(memo[alive] != null)
			return memo[alive];
		
		double[] ret = new double[N];
		for(int j = 0; j < N; ++j)
			if((alive & (1<<j)) != 0)
			{
				double[] nxt = dp(alive & ~(1<<j));
				for(int i = 0; i < N; ++i)
					ret[i] += die[j][alive] * nxt[i];			
			}
		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();
		
		double[] ret = dp((1<<N) - 1);
		for(int i = 0; i < N - 1; ++i)
			out.printf("%.8f ",ret[i]);
		out.printf("%.8f\n", ret[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.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author AlexFetisov
 */
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);
		TaskE solver = new TaskE();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskE {

    private int n;
    private double[] dp;
    private double[][] p;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        n = in.nextInt();
        p = new double[n][n];
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                p[i][j] = in.nextDouble();
            }
        }
        dp = new double[1 << n];
        Arrays.fill(dp, -1);
        for (int i = 0; i < n; ++i) {
            out.printf("%.6f ", rec(1 << i));
        }
        out.println();
    }

    private double rec(int mask) {
        if (mask == (1 << n) - 1) return 1;
        if (dp[mask] > -0.5) return dp[mask];
        double res = 0;
        int nn = Integer.bitCount(mask);
        int total = (nn * (nn + 1)) / 2;
        for (int i = 0; i < n; ++i) if (BitUtils.checkBit(mask, i)) for (int j = 0; j < n; ++j) if (!BitUtils.checkBit(mask, j)) {
            res += rec(BitUtils.setBit(mask, j)) * p[i][j];
        }
        res /= total;
        dp[mask] = res;
        return res;
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer stt;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
    }

    public String nextLine() {
        try {
            return reader.readLine().trim();
        } catch (IOException e) {
            return null;
        }
    }

    public String nextString() {
        while (stt == null || !stt.hasMoreTokens()) {
            stt = new StringTokenizer(nextLine());
        }
        return stt.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(nextString());
    }

    public double nextDouble() {
        return Double.parseDouble(nextString());
    }

}

class BitUtils {
    public static boolean checkBit(int mask, int bit) {
        return (mask & (1 << bit)) > 0;
    }

    public static int setBit(int mask, int bit) {
        return (mask | (1 << bit));
    }

}
// Problem: 16_E. Fish
// Time complexity: np
import java.util.*;
import java.io.*;

public class e{
  int n;
  double f[];
  double a[][];

  public void run(){
    Locale.setDefault(Locale.US);
    Scanner in = new Scanner(System.in);
    n = in.nextInt();
    a = new double[n][n];
    for(int i=0;i<n;i++) for(int j=0;j<n;j++) a[i][j] = in.nextDouble();
    f = new double[1<<n];
    for(int i=0;i<1<<n;i++) f[i] = -1;
    f[(1<<n)-1] = 1.0;
    
    for(int i=0;i<n;i++) System.out.print(doIt(1<<i) + " ");
  }

  private double doIt(int mask){
    if (f[mask] >=0) return f[mask];
    f[mask] = 0;
    double k = getBits(mask);
    k*=(k-1)/2.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)
            f[mask]+=doIt(mask|(1<<j))*a[i][j]/k;
    return f[mask]; 
  }
  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 e().run();
  }
}
// Problem: 16_E. Fish
// Time complexity: np
import java.util.*;
import java.io.*;

public class Fish
{
	static double[][] prob= new double[18][18];
	static double[][] dp= new double[2][1<<18];
	static ArrayList<Integer>[] adj= new ArrayList[1<<18];
	static int n;
	public static void init()
	{
		for(int i=0; i<(1<<18); i++)
			adj[i]= new ArrayList<Integer>();
		for(int i=0; i<(1<<18); i++)
			for(int j=0; j<18; j++)
				if(((i>>j)&1)==1)
					adj[i].add(i^(1<<j));
	}
	public static double value(int cur, int next)
	{
		int i=0;
		int z= cur^next;
		double p=0;
		int alive= Integer.bitCount(cur);
		while((z>>i)!=1)
			i++;
		for(int k=0; k<n; k++)
			if( ((next>>k)&1)==1)
				p+= prob[k][i];
		p/= alive*(alive-1)/2;
		return p;
	}
	public static void main(String[] args)throws Exception
	{
		Scanner scan= new Scanner(System.in);
		init();
		n=scan.nextInt();
		int m= (1<<n)-1;
		for(int i=0; i<n; i++)
			for(int j=0; j<n; j++)
				prob[i][j]= scan.nextDouble();
		dp[0][m]=1;
		
		for(int i=0; i<(n-1); i++)
		{
			for(int j=0; j<=m; j++)
				if(dp[i%2][j]>0)
					for(Integer next: adj[j])
						dp[(i+1)%2][next]+= value(j,next)*dp[i%2][j];
			Arrays.fill(dp[i%2],0);
		}
	
		for(int i=0; i<n; i++)
		{
			if(i!=0)
			System.out.print(" ");
			System.out.printf("%.6f",dp[(n-1)%2][1<<i]);		
		}
		
	}
}
// Problem: 16_E. Fish
// Time complexity: np
import java.util.*;
import java.io.*;

public class e {
	private void main() {
		Scanner stdin = new Scanner(System.in);
		PrintStream stdout = System.out;
		int n = stdin.nextInt();
		double[][] p = new double[n][n];
		double[][] ans = new double[1<<n][n];
		for(int i = 0; i < n; i++)
			for(int j = 0; j < n; j++)
				p[i][j] = stdin.nextDouble();
		double[] dieChance = new double[n];
		ArrayList<Integer> sel = new ArrayList<Integer>();
		for(int i = 0; i < (1<<n); i++) {
			sel.clear();
			for(int k = 0; k < n; k++) {
				if((i & (1<<k)) != 0)
					sel.add(k);
			}
			if(sel.size() == 1) {
				ans[i][sel.get(0)] = 0;
				continue;
			}
			for(int j : sel)
				dieChance[j] = 0;
			for(int j : sel)
				for(int k : sel)
					dieChance[k] += p[j][k];
			for(int j : sel)
				dieChance[j] /= sel.size()*(sel.size()-1)/2;
			for(int j : sel) {
				ans[i][j] = dieChance[j];
				for(int k : sel)
					ans[i][j] += dieChance[k] * ans[i-(1<<k)][j];
			}
		}
		for(double d : ans[(1<<n)-1])
			stdout.format("%f ", 1-d);
		stdout.println();
	}
	public static void main(String[] args) {
		new e().main();
	}
}
// Problem: 16_E. Fish
// Time complexity: np

import java.util.Arrays;
import java.util.Scanner;

public class P16E {
    int n;
    double [][]prob;
    double []dp;
    public P16E() {
        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();
            }
        }
        sc.close();

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

        for (int i = 0; i < n; i++) {
            int a = 1 << i;
            System.out.print(compute(a) + " ");
        }
    }

    double compute (int mask){
        if (mask == (1<<n) - 1){
            return 1;
        }
        if (dp[mask] != -1){
            return dp[mask];
        }
        double result = 0;
        int c = 0;       
        for (int i = 0; i < n; i++) {
            int a = 1 << i;
            if ((a & mask) != 0) {
                c++;
                for (int j = 0; j < n; j++) {
                    int b = 1 << j;
                    if ((b & mask) == 0) {
                        result += (prob[i][j] * compute(mask | b));
                    }
                }
            }
        }

        int nC2 = (c + 1) * c / 2;
        dp[mask] = result / nC2;
        return dp[mask];

    }

    public static void main (String []args){
        new P16E();
    }
}
// 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.StringTokenizer;

public class Main {

    public static void main(String[] args) throws Exception {
        //System.setIn(new FileInputStream("1"));
        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();
            }
        }
        double[] dp = new double[1 << n];
        dp[(1 << n) - 1] = 1.0;
        for (int mask = (1 << n) - 2; mask > 0; mask--) {
            int count = Integer.bitCount(mask);
            double pPair = 2.0 / (count * (count + 1));
            double ans = 0.0;
            for (int i = 0; i < n; i++) {
                if (((1 << i) & mask) == 0) {
                    double p = dp[(1 << i) | mask];
                    double s = 0.0;
                    for (int j = 0; j < n; j++) {
                        if (((1 << j) & mask) != 0)
                            s += a[j][i];
                    }
                    ans += pPair * p * s;
                }
            }
            dp[mask] = ans;
        }

        for (int i = 0; i < n; i++) {
            out.print(dp[1 << i]);
            out.print(' ');
        }
        
        in.close();
        out.close();
    }

    static StringTokenizer st;
    static BufferedReader in;
    static PrintWriter out;

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

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

    static String nextString() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
}
// Problem: 16_E. Fish
// Time complexity: np
import java.util.*;
public class Main {
public static void main(String [] args){
	Scanner in=new Scanner(System.in);
	int n=in.nextInt();
	double value[][]=new double[n][n];
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)value[i][j]=in.nextDouble();
		double ans[]=new double[1<<n];
		int mask=(1<<n);
		ans[(1<<n)-1]=1.0;
		for(int i=mask-1;i>=0;i--){
		int cnt=Integer.bitCount(i);
		int pairs=cnt*(cnt-1)/2;
		for(int j=0;j<n;j++){
		if(((i>>j)&1)==0)continue;
		for(int k=j+1;k<n;k++){
		if(((i>>k)&1)==0)continue;
		ans[i^(1<<k)]+=ans[i]*value[j][k]/pairs;
		ans[i^(1<<j)]+=ans[i]*value[k][j]/pairs;
		}
		}
		}
		for(int i=0;i<n;i++)
			System.out.print(ans[1<<i]+" ");
		
}
}
// Problem: 16_E. Fish
// Time complexity: np
import java.util.*;
import java.lang.*;
import java.io.*;
 
/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
static double p[][];
    static double dp[];
    static int n;
 
    public static int BitCount(int u) {
        int uCount;
 
        uCount = u - ((u >> 1) & 033333333333) - ((u >> 2) & 011111111111);
        return ((uCount + (uCount >> 3)) & 030707070707) % 63;
    }
 
    public static double f(int mask) {
        if (dp[mask] > -0.5)
            return dp[mask];
 
        dp[mask] = 0;
 
        int ones = BitCount(mask);
        double pairs = (((ones * (ones + 1))) >> 1);
        //System.out.println(pairs);
 
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if ((mask & (1 << i)) != 0 && (mask & (1 << j)) == 0)
                    dp[mask] += f(mask | (1 << j)) * p[i][j] / pairs;
            }
        }
 
        return dp[mask];
    }
 
    public static void main(String[] args) throws NumberFormatException,
            IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        n = Integer.parseInt(bf.readLine());
        p = new double[n][n];
        for (int i = 0; i < n; i++) {
            StringTokenizer st = new StringTokenizer(bf.readLine());
            for (int j = 0; j < n; j++) {
                p[i][j] = Double.parseDouble(st.nextToken());
            }
        }
 
        dp = new double[1 << n];
 
        Arrays.fill(dp, -1.0);
 
        dp[(1 << n) - 1] = 1.;
 
        for (int i = 0; i < n - 1; i++) {
            System.out.print(f(1 << i) + " ");
        }
 
        System.out.println(f((1 << (n - 1))));
 
    }
}