codeparrot/codecomplex huggingface dataset:
// Problem: 839_E. Mother of Dragons
// Time complexity: np
import java.util.*;
import java.io.*;
public class E {
    void solve(BufferedReader in) throws Exception {
        int[] xx = toInts(in.readLine());
        int n = xx[0];
        double k = xx[1];
        int[][] board = new int[n][n];
        for(int i = 0; i<n; i++) board[i] = toInts(in.readLine());
        int fst = n/2;
        int snd = n - fst;
        int[] maxc = new int[1<<fst];
        int max = 1;
        for(int i = 0; i<(1<<fst); i++) {
            for(int j = 0; j<fst; j++) {
                if((i&1<<j) != 0) maxc[i] = Math.max(maxc[i], maxc[i^(1<<j)]);
            }
            boolean ok = true;
            for(int a = 0; a<fst; a++) if((i&1<<a) != 0) {
                for(int b = a+1; b<fst; b++) if((i&1<<b) != 0) {
                    if(board[a][b] == 0) ok = false;
                }
            }
            if(ok) {
                maxc[i] = Integer.bitCount(i);
                max = Math.max(max, maxc[i]);
            }
        }
        for(int i = 0; i<(1<<snd); i++) {
            boolean ok = true;
            for(int a = 0; a<snd; a++) if((i&1<<a) != 0) {
                for(int b = a+1; b<snd; b++) if((i&1<<b) != 0) {
                    if(board[a+fst][b+fst] == 0) ok = false;
                }
            }
            if(!ok) continue;
            int mask = 0;
            for(int a = 0; a<fst; a++) {
                ok = true;
                for(int b = 0; b<snd; b++) {
                    if((i&1<<b) != 0) {
                        if(board[a][b+fst] == 0) ok = false;
                    }
                }
                if(ok) mask |= (1<<a);
            }
            max = Math.max(Integer.bitCount(i) + maxc[mask], max);
        }
        System.out.println(k*k*(max-1.0)/(2*max));
    }
    int toInt(String s) {return Integer.parseInt(s);}
    int[] toInts(String s) {
        String[] a = s.split(" ");
        int[] o = new int[a.length];
        for(int i = 0; i<a.length; i++) o[i] = toInt(a[i]);
        return o;
    }
    void e(Object o) {
        System.err.println(o);
    }
    public static void main(String[] args) throws Exception{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        (new E()).solve(in);
    }
}
// Problem: 839_E. Mother of Dragons
// Time complexity: np
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.IOException;
import java.util.StringTokenizer;
/*
 * @author Tnascimento 
 */

public class MaeDosDragoes {
	public static PrintWriter saida = new PrintWriter(System.out, false);
	public static class Escanear {
        BufferedReader reader;
        StringTokenizer tokenizer;
		public Escanear() {
            this(new InputStreamReader(System.in));
        }
		public Escanear(Reader in) {
            reader = new BufferedReader(in);
        }
        String proximo() {
            while (tokenizer == null || !tokenizer.hasMoreElements()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return tokenizer.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(proximo());
        }

    }



    public static void main(String[] args) {
		Escanear fastScanner = new Escanear();
        int proximoInt = fastScanner.nextInt();
        double proximoDouble = fastScanner.nextInt();
        long[] graph = new long[proximoInt];
        for(Integer i = 0; i < proximoInt; i++) {
            for(Integer j =0; j < proximoInt; j++) {
                Integer val = fastScanner.nextInt();
                if (val.equals(1) || i.equals(j)) {
				 graph[i] |= 1L << j;
				}
            }
        }

        int szLeft = proximoInt/2;
        int szRight = proximoInt - szLeft;

        int[] dp = new int[1 << szLeft];
        int maxMask = 1 << szLeft;

        for(int mask = 1; mask <maxMask; mask++) {
            int curMask = mask;

            for(int j = 0; j < szLeft; j++) {
                if (((1 << j) & mask) > 0) {
                    curMask &= graph[j + szRight] >> szRight;
                    dp[mask] = Math.max(dp[mask], dp[mask ^ (1 << j)]);
                }
            }
            if (mask == curMask) {
                dp[mask] = Math.max(dp[mask],Integer.bitCount(mask));
            }
        }
        int ans = 0;
        int rmaxMask = 1 << szRight;
        for(int mask = 0; mask < rmaxMask; mask++) {
            int curMask = mask;
            int oMask = maxMask -1;
            for(int j = 0; j < szRight; j++) {
                if (((1 << j) & mask) > 0) {
                    curMask &= (graph[j] & (rmaxMask-1));
                    oMask &= graph[j] >> szRight;
                }
            }
            if (curMask != mask) continue;
            ans = Math.max(ans, Integer.bitCount(mask) + dp[oMask]);
        }
        proximoDouble/=ans;
        saida.println(proximoDouble * proximoDouble * (ans * (ans-1))/2);
        saida.flush();
    }
}
// Problem: 111_C. Petya and Spiders
// Time complexity: np
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

// Petya and Spiders
// 2012/08/16
public class P111C{
	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	int h, w;

	void run(){
		h=sc.nextInt();
		w=sc.nextInt();
		solve();
	}

	void solve(){
		n=w*h;
		g=new long[n];
		int[] dx={0, 0, -1, 1};
		int[] dy={-1, 1, 0, 0};
		for(int y=0; y<h; y++){
			for(int x=0; x<w; x++){
				for(int k=0; k<4; k++){
					int x2=x+dx[k];
					int y2=y+dy[k];
					if(x2>=0&&x2<w&&y2>=0&&y2<h){
						g[y*w+x]|=1L<<(y2*w+x2);
					}
				}
			}
		}
		mds=(1L<<n)-1;
		mds(0, 0, 0);
		println((n-Long.bitCount(mds))+"");
	}

	int n;
	long[] g;
	long mds;

	void mds(long choosed, long removed, long covered){
		if(Long.bitCount(choosed)>=Long.bitCount(mds))
			return;

		if(covered==((1L<<n)-1)){
			mds=choosed;
			return;
		}

		long s=covered;
		for(long remained=~removed&((1L<<n)-1); remained!=0; remained&=remained-1){
			int i=Long.numberOfTrailingZeros(remained);
			s|=(1L<<i)|g[i];
		}
		if(s!=((1L<<n)-1))
			return;

		int k=-1;
		for(long remained=~removed&((1L<<n)-1); remained!=0; remained&=remained-1){
			int i=Long.numberOfTrailingZeros(remained);
			if((covered>>>i&1)==1){
				if(Long.bitCount(g[i]&~covered)==0){
					mds(choosed, removed|(1L<<i), covered);
					return;
				}else if(Long.bitCount(g[i]&~covered)==1
						&&(g[i]&~covered&~removed)!=0){
					mds(choosed, removed|(1L<<i), covered);
					return;
				}
			}else{
				if(Long.bitCount(g[i]&~removed)==0){
					mds(choosed|(1L<<i), removed|(1L<<i), covered|(1L<<i)|g[i]);
					return;
				}else if(Long.bitCount(g[i]&~removed)==1
						&&((g[i]&~removed)|(g[i]&~covered))==(g[i]&~removed)){
					int j=Long.numberOfTrailingZeros(g[i]&~removed);
					mds(choosed|(1L<<j), removed|(1L<<i)|(1L<<j), covered
							|(1L<<j)|g[j]);
					return;
				}
			}
			if(k==-1||Long.bitCount(g[i]&~covered)>Long.bitCount(g[k]&~covered))
				k=i;
		}
		if(k==-1)
			return;

		mds(choosed|(1L<<k), removed|(1L<<k), covered|(1L<<k)|g[k]);
		mds(choosed, removed|(1L<<k), covered);
	}

	void println(String s){
		System.out.println(s);
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args){
		Locale.setDefault(Locale.US);
		new P111C().run();
	}

}
// Problem: 111_C. Petya and Spiders
// Time complexity: np
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

// Petya and Spiders
// 2011/9/3
public class P111C{
	Scanner sc=new Scanner(System.in);

	int INF=1<<28;

	int n, m;

	void run(){
		n=sc.nextInt();
		m=sc.nextInt();
		solve();
	}

	void solve(){
		if(n<m){
			int t=n;
			n=m;
			m=t;
		}
		int full=(1<<m)-1;
		int[][] dp=new int[1<<m][1<<m];
		int[][] tmp=new int[1<<m][1<<m];
		for(int i=0; i<1<<m; i++){
			fill(dp[i], INF);
		}
		for(int i=0; i<1<<m; i++){
			int b1=(i|(i>>1)|(i<<1))&full;
			int b2=i;
			dp[b1][b2]=Integer.bitCount(i);
		}
		for(int j=0; j<n-1; j++){
			for(int i=0; i<1<<m; i++){
				System.arraycopy(dp[i], 0, tmp[i], 0, 1<<m);
				fill(dp[i], INF);
			}

			for(int b1=0; b1<1<<m; b1++){
				for(int b2=0; b2<1<<m; b2++){
					for(int i=0; i<1<<m; i++){
						if((b1|i)!=full){
							continue;
						}
						int b=(i|(i>>1)|(i<<1))&full;
						dp[b2|b][i]=min(dp[b2|b][i],
								tmp[b1][b2]+Integer.bitCount(i));
					}
				}
			}
		}

		int min=INF;
		for(int i=0; i<1<<m; i++){
			min=min(min, dp[full][i]);
		}
		int ans=m*n-min;
		println(ans+"");
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new P111C().run();
	}
}
// Problem: 111_C. Petya and Spiders
// Time complexity: np
import java.io.*;
import java.util.*;

public class Main
{
	static final boolean _DEBUG = false;

	private static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner(BufferedReader _br) {
			br = _br;
		}

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

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

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

	}

	static MyScanner   scan;
	static PrintWriter out;

	static int debugCount = 0;
	static void debug(String msg) {
		if (_DEBUG && debugCount < 200) {
			out.println(msg);
			out.flush();
			debugCount++;
		}
	}
	
    public static void main (String args[]) throws IOException {
//    	scan = new MyScanner(new BufferedReader(new FileReader("test.in")));
    	scan = new MyScanner(new BufferedReader(new InputStreamReader(System.in)));
    	out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        Main inst = new Main();
        inst.execute();
        out.close();
    }
    
    int N, M, pow;
    int[] counts;
    int[][][] dp;
    
    void execute() {
    	N = scan.nextInt();
    	M = scan.nextInt();
    	if (N < M) {
    		int temp = N;
    		N = M;
    		M = temp;
    	}
    	pow = 1<<M;
    	counts = new int[pow];
    	dp = new int[N][pow][pow];
    	for (int[][] i : dp) {
    		for (int[] j : i) {
    			Arrays.fill(j, -1);
    		}
    	}
    	for (int i = 0; i < pow; i++) {
    		counts[i] = Integer.bitCount(i);
        	dp[0][i][0] = counts[i];
    	}
    	int spiders = Integer.MAX_VALUE;
    	for (int y = 0; y < N-1; y++) {
    		for (int i = 0; i < pow; i++) {
    			for (int j = 0; j < pow; j++) {
    				if (dp[y][i][j] == -1) {
    					continue;
    				}
    				for (int k = 0; k < pow; k++) {
    					if (((i|(i<<1)|(i>>1)|j|k)&(pow-1))==(pow-1)) {
    						int value = dp[y][i][j] + counts[k];
    						if (dp[y+1][k][i] == -1 || dp[y+1][k][i] > value) {
    							dp[y+1][k][i] = value;
    						}
    					}
    				}
    			}
    		}
    	}
//    	for (int i = 0; i < N; i++) {
//        	System.out.println(Arrays.deepToString(dp[i]));
//    	}
    	for (int i = 0; i < pow; i++) {
    		for (int j = 0; j < pow; j++) {
    			if (dp[N-1][i][j] != -1 && ((i|(i<<1)|(i>>1)|j)&(pow-1))==(pow-1)) {
    				spiders = Math.min(spiders, dp[N-1][i][j]);
//    				System.out.println(spiders+" "+i+" "+j);
    			}
    		}
    	}
    	out.println((N*M)-spiders);
    }
}
// Problem: 111_C. Petya and Spiders
// Time complexity: np
import java.util.*;

public class cf112e {
    static int n,m,s;
    static int[][][] memo;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        m = in.nextInt();
        if(n > m) {
            int tmp = n;
            n = m;
            m = tmp;
        }
        s = (1<<n);
        memo = new int[s][s][m];
        for(int i=0; i<s; i++)
            for(int j=0; j<s; j++)
                Arrays.fill(memo[i][j], -1);
        int ret = go(0,0,0);
        System.out.println(n*m - ret);
    }
    static int go(int last, int trans, int r) {
        if(r==m) {
            if(trans == 0) return 0;
            return 100;
        }
        if(memo[last][trans][r] != -1) return memo[last][trans][r];
        int best = 100;
        for(int crnt = 0; crnt < s; crnt++) {
            if((trans & ~crnt) != 0) continue; //certain ones have to be here
            for(int pass = 0; pass < s; pass++) {
                int tmp = ((1<<n)-1) & ~last;   //move back the ones you can
                if((pass & ~tmp) != 0) continue; //certain ones have to move on
                tmp = tmp & ~pass; //find which ones stay
                boolean fail = false;
                for(int k=0; k<n; k++) //make sure that the ones that stay
                    if(isSet(tmp,k) && !(isSet(crnt,k-1) || isSet(crnt,k) || isSet(crnt,k+1)))
                        fail = true;
                if(fail) continue;
                best = Math.min(best, Integer.bitCount(crnt) + go(crnt,pass,r+1));
            }
        }
        return memo[last][trans][r] = best;
    }
    static boolean isSet(int x, int p) {
        if(p < 0 || p >= n) return false;
        return (x & (1<<p)) != 0;
    }
}
// Problem: 111_C. Petya and Spiders
// Time complexity: np
/*************************************************************************
    > File Name: cf111c.java
    > Author: Yuchen Wang
    > Mail: wyc8094@gmail.com 
    > Created Time: Sat Feb 11 16:51:01 2017
 ************************************************************************/

import java.util.*;
import java.io.*;

public class cf111c
{
	public static int n,m,maxm;
	public static int[][][] dp;
	public static int[] s;


	public static int cal(int cur)
	{
		int res = 0;
		while(cur>0){
			res ++;
			cur = cur&(cur-1);
		}
		return res;
	}

	public static boolean check(int a,int b,int c)
	{
		int res = (maxm-1) & (b | (b<<1) | (b>>1) | a | c);
		if(res == maxm-1)return true;
		else return false;
	}

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

		n = in.nextInt();
		m = in.nextInt();
		if(n<m){
			int t = m;
			m = n;
			n = t;
		}

		maxm = 1<<m;
		int i,j,k,l;
		dp = new int[n+1][1<<m][1<<m];
		s = new int[1<<m];

		for(i=0;i<n+1;i++){
			for(j=0;j<maxm;j++){
				Arrays.fill(dp[i][j],100);
			}
		}

		for(i=0;i<maxm;i++){
			s[i] = cal(i);
			dp[0][0][i] = 0;
		}

		for(i=1;i<=n;i++){
			for(j=0;j<maxm;j++){
				for(k=0;k<maxm;k++){
					for(l=0;l<maxm;l++){
						if(dp[i-1][k][l]!=100 && check(k,l,j)){
							dp[i][l][j] = Math.min(dp[i-1][k][l]+s[l],dp[i][l][j]);
						}
					}
				}
			}
		}

		int ans = 100;
		for(i=0;i<maxm;i++)
			ans = Math.min(dp[n][i][0],ans);

		System.out.println(n*m-ans);
		return;
	}
}
// Problem: 111_C. Petya and Spiders
// Time complexity: np
import java.util.Arrays;
import java.util.Scanner;


public class Main {
    static int[][][] dp; 
    public static void main(String[] args) {
        Scanner r = new Scanner(System.in);
        
        int n = r.nextInt();
        int m = r.nextInt();
        
        if(n > m){int t = n; n = m; m = t;}
        
        dp = new int[m+1][1 << 7][1 << 7];
        for(int[][] i : dp)
            for(int[] j : i)
                Arrays.fill(j, -1);
        int min = go(m, 0, (1<<n) -1, n, m);
        
        System.out.println(n * m - min);
    }
    private static int go(int rem, int prev, int need, int n, int m) {
//      for(int i = rem; i < m; i++)
//          System.out.print(" ");
//      System.out.println(rem + ": " + prev +","+need);
        if(rem == 0)return prev == 0?0:1 << 20;
        if(dp[rem][prev][need] != -1)return dp[rem][prev][need];
        
        int min = 1 << 20;
        for(int now = 0; now < 1 << n; now++){
            if((~now & prev) != 0)continue;
            
            int after = need & ~(now) & ~(now << 1) & ~(now >> 1);
            int next = ~(now) & ((1 << n)-1);
            int current = Integer.bitCount(now) + go(rem-1, after ,next, n, m);
            min = Math.min(min, current);
        }
        return dp[rem][prev][need] = min;
    }
}
// Problem: 111_C. Petya and Spiders
// Time complexity: np
//package round85;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class C3 {
	Scanner in;
	PrintWriter out;
	String INPUT = "";
	
	void solve()
	{
		int n = ni();
		int m = ni();
		if(n < m){
			int d = n;n = m;m = d;
		}
		// n>=m
		if(m == 1){
			out.println(n-(n+2)/3);
			return;
		}
		
		int[][] dp = new int[n+1][1<<2*m];
		int[] fill = new int[1<<m];
		int mask = (1<<m)-1;
		for(int i = 0;i < 1<<m;i++){
			fill[i] = (i<<1|i|i>>1)&mask;
		}
		for(int i = 0;i < 1<<2*m;i++){
			int lower = i&mask;
			int upper = i>>m;
			dp[0][i] = (fill[lower]|upper) == mask ? Integer.bitCount(i) : 99999;
		}
		
		for(int i = 1;i <= n-2;i++){
			for(int j = 0;j < 1<<2*m;j++){
				int lower = j&mask;
				int upper = j>>m;
				
				int min = 99999;
				for(int k = 0;k < 1<<m;k++){
					if((upper|fill[lower]|k) == mask){
						min = Math.min(min, dp[i-1][lower<<m|k]);
					}
				}
				dp[i][j] = min + Integer.bitCount(upper);
			}
		}
		
		int gmin = 99999;
		for(int i = 0;i < 1<<2*m;i++){
			int lower = i&mask;
			int upper = i>>m;
			if((fill[upper]|lower) == mask){
				gmin = Math.min(gmin, dp[n-2][i]);
			}
		}
		out.println(n*m-gmin);
	}
	
	void run() throws Exception
	{
		in = oj ? new Scanner(System.in) : new Scanner(INPUT);
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}
	
	public static void main(String[] args) throws Exception
	{
		new C3().run();
	}
	
	int ni() { return Integer.parseInt(in.next()); }
	long nl() { return Long.parseLong(in.next()); }
	double nd() { return Double.parseDouble(in.next()); }
	boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}
// Problem: 111_C. Petya and Spiders
// Time complexity: np

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

public class E {
    static int n;
    static int m;
    static int[][][] DP;
    static int[] dx = { 0, 0, 1, -1 };
    static int[] dy = { 1, -1, 0, 0 };
    static int inf = 1000000;

    public static int get(int x, int current, int last) {
        if (x == n) {
            if (last == 0)
                return 0;
            else
                return -inf;
        }
        if (DP[x][current][last] != -1)
            return DP[x][current][last];
        int max = 0;
        for (int mask = 0; mask < (1 << m); mask++) {
            int tempLast = last;
            int tempCurrent = current;
            int tempNext = (1 << m) - 1;
            for (int i = 0; i < m; i++)
                if ((mask & (1 << i)) != 0) {
                    if (i > 0)
                        tempCurrent &= ~(1 << (i - 1));
                    if (i < m - 1)
                        tempCurrent &= ~(1 << (i + 1));
                    tempNext &= ~(1 << (i));
                    tempLast &= ~(1 << (i));
                }
            if (tempLast != 0)
                continue;
            max = Math.max(
                    max,
                    m - Integer.bitCount(mask)
                            + get(x + 1, tempNext, tempCurrent & ~mask));
        }
        return DP[x][current][last] = max;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int x = in.nextInt();
        int y = in.nextInt();
        n = Math.max(x, y);
        m = Math.min(x, y);
        DP = new int[n][1 << m][1 << m];
        for (int i = 0; i < n; i++)
            for (int j = 0; j < (1 << m); j++)
                Arrays.fill(DP[i][j], -1);
        System.out.println(get(0, (1 << m) - 1, 0));
    }
}
// Problem: 111_C. Petya and Spiders
// Time complexity: np
/**
 * Problem: 
 * Source: 
 * Link: 
 * 
 * @author Alexei Ostrovski
 */

import java.io.*;
import java.util.*;


public class SpidersSolver {

	public static final boolean DEBUG = false;
	
	public static void main(String[] args) {
		//redirect input and output
		if (DEBUG)
		{
			try {
				System.setIn(new FileInputStream("input.txt"));
				//System.setOut(new PrintStream("input.txt"));
			} catch (IOException e) {
				//nothing
			}
		}
		Scanner sc = new Scanner(System.in);

		//read data
		int n = sc.nextInt(), m = sc.nextInt();
			
		//solve
		if (n < m) {
			int tmp = n;
			n = m;
			m = tmp;
		}
		// Now (n >= m) && (m <= 6)
		int pow = 1;
		for (int i = 0; i < m; i++)
			pow *= 2;

		int[] count = new int[pow];
		for (int cur = 0; cur < pow; cur++)
		{
			int x = cur;
			while (x > 0)
			{
				count[cur] += (x % 2);
				x /= 2;
			}
			count[cur] = m - count[cur];
		}
		//System.out.println(Arrays.toString(count));
		
		int[][] C = new int[pow][pow];
		for (int cur = 0; cur < pow; cur++)
		{
			C[0][cur] = 0;//count[cur];
			for (int last = 1; last < pow; last++)
				C[last][cur] = Integer.MIN_VALUE;
		}
		
		for (int i = 0; i < n; i++)
		{
			int[][] newC = new int[pow][pow];
			
			for (int cur = 0; cur < pow; cur++)
				for (int next = 0; next < pow; next++)
				{
					int mask = cur | (cur << 1) | (cur >> 1) | next;
					mask %= pow;
					
					int max = 0;
					for (int last = 0; last < pow; last++)
						if (((last | mask) == pow - 1) && (max < count[cur] + C[last][cur]))
							max = count[cur] + C[last][cur];
					
					newC[cur][next] = max;
				}
			C = newC;
		}
		
		int result = 0;
		for (int cur = 0; cur < pow; cur++)
			result = Math.max(result, C[cur][0]);
			
		//output
		System.out.println(result);
	}
}