codeparrot/codecomplex huggingface dataset:
// Problem: 23_A. You're Given a String...
// Time complexity: cubic


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

public class ProblemA_23 {
    
    final boolean ONLINE_JUDGE=System.getProperty("ONLINE_JUDGE")!=null;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok=new StringTokenizer("");
    
    void init() throws FileNotFoundException{
        if (ONLINE_JUDGE){
            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");
        }
    }
    
    String readString() throws IOException{
        while(!tok.hasMoreTokens()){
            tok=new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }
    
    int readInt() throws IOException{
        return Integer.parseInt(readString());
    }
    
    public static void main(String[] args){
        new ProblemA_23().run();
    }
    
    public void run(){
        try{
            long t1=System.currentTimeMillis();
            init();
            solve();
            out.close();
            long t2=System.currentTimeMillis();
            System.err.println("Time = "+(t2-t1));
        }catch (Exception e){
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }
    
    void solve() throws IOException{
        String s = readString();
        for (int length = s.length() - 1; length > 0; length--){
            for (int i = 0; i < s.length() - length; i++){
                if (s.lastIndexOf(s.substring(i, i + length)) > i){
                    out.print(length);
                    return;
                }
            }
        }
        out.print(0);
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class A {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s = new String(in.readLine());
		int len=s.length();
		int ans=0;
		for (int i=0;i<len-1;i++) {
			for (int j=i+1;j<len;j++) {
				int score=0;
				boolean flag=true;
				for (int k=0;k+j<len && flag;k++) {
					if (s.charAt(i+k)==s.charAt(j+k)) {
						score++;
					} else {
						flag=false;
					}
				}
				if (score>ans) {
					ans=score;
				}
			}
		}
		System.out.println(ans);
	}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.util.*;
public class P023A {
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        String line = in.next();
        
        HashSet<String> hash = new HashSet<String>();
        
        int ans = 0;
        for (int len = line.length()-1; len > 0; --len)
        {
            for (int i = 0; i + len <= line.length(); ++i)
            {
                String sub = line.substring(i, i+len);
                if (hash.contains(sub))
                {
                    ans = Math.max(ans, sub.length());
                }
                
                hash.add(sub);
            }
        }
        
        System.out.println(ans);
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.util.*;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {

	boolean test = false;
	PrintWriter pw = new PrintWriter(System.out);
	InputStreamReader inp = new InputStreamReader(System.in);
	BufferedReader in = new BufferedReader(inp);
	
	private String[] inData = {"zzz"
			};
	
	
	static int id = -1;
	
	public String readLine() {
		id++;
		if (test)
			return inData[id];
		else
			try{
				return in.readLine();	
			} catch( Exception e){
				e.printStackTrace();
			}
		return "";
	}

	private void solve() {
		
		String readLine = readLine();
		
		int best = 0;
		
		for (int i = 0; i < readLine.length(); i++) {
			for (int j = i; j < readLine.length(); j++) {
				String substring = readLine.substring(i,j+1);
				String remainString = readLine.substring(i+1);
				if(remainString.contains(substring)){
					if(substring.length() > best){
						best = substring.length();	
					}
					
				}
			}
		}
		System.out.println(best);
	}
	
	public static void main(String args[]) throws Exception {

		new Main().solve();
    }

	
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.util.Scanner;
public class x23A {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String input = sc.next();
		//input+="3";
		int longest=0;
		if(input.length()==1){
			System.out.println(0);
			System.exit(0);
		}
		if(input.length()==2){
			if(input.charAt(0)==input.charAt(1)){
				System.out.println(1);
				System.exit(0);
			}
			else{
			System.out.println(0);
			System.exit(0);}
		}
		for(int a=0;a<input.length()-1;a++){
			for(int b=a+1;b<input.length();b++){
				for(int c=1;(c+b)<input.length()+1;c++){
				//	System.out.printf("%s %s %d\n", input.substring(a,a+c), input.substring(b,b+c), input.substring(a,a+c).compareTo(input.substring(b,b+c)));
					if(input.substring(a,a+c).compareTo(input.substring(b,b+c))==0)
					if(longest<c)longest=c;
				}
			}
		}
		System.out.println(longest);
		}
	}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import com.sun.org.apache.xalan.internal.xsltc.dom.BitArray;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.BitSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author abdelrahman
 */
public class p1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        new p1().run();

    }

    private void run() {
        try {
            // TODO code application logic here
            Scanner scanner = new Scanner(System.in);
            String in = scanner.next();
            
            Hashtable<String, Boolean> tmp = new Hashtable<String, Boolean>();
            int sol = 0;
            for (int i = 0; i < in.length(); i++) {
                for (int j = i + 1; j <= in.length(); j++) {
                    String str = in.substring(i, j);
                    if (tmp.containsKey(str)) {
                        if (tmp.get(str)) {
                            if(str.length() > sol)  sol=str.length();
                            boolean tmp1 = tmp.remove(str);
                            tmp.put(str, false);
                        }
                    } else {
                        tmp.put(str, Boolean.TRUE);
                    }
                }

            }
            System.out.println(sol);
        } catch (Exception ex) {
        }
    }

    
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.io.BufferedReader;
import static java.lang.Math.*;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class CFC23A implements Runnable {
	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;

	public static void main(String[] args) {
		new Thread(new CFC23A()).start();
	}

	void solve() throws IOException {
		int res = 0;
		String str = nextToken();
		for(int i = 0; i < str.length(); ++i)
			for(int j = i + 1; j <= str.length(); ++j)
				if(isOk(str.substring(i, j), str))
					res = max(res, j - i);
		out.println(res);
	}

	private boolean isOk(String substring, String str) {
		int from = 0, kol = 0;
		while(str.indexOf(substring, from) != -1 && kol < 2) {
			++kol;
			from = str.indexOf(substring, from) + 1;
		}
		return kol >= 2;
	}

	@Override
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			// in = new BufferedReader(new FileReader(new File("input.txt")));
			out = new PrintWriter(System.out);
			//out = new PrintWriter(new File("output.txt"));
			solve();
			out.flush();
			out.close();
			in.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	String nextLine() throws IOException {
		tok = null;
		return in.readLine();
	}

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

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

	String nextToken() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
/**
 * Mx 04:06:52 ص 14/01/2014
 */
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder line = new StringBuilder(reader.readLine());
        int length = 0;
        for (int head = 0; head < line.length(); head++) {
            for (int tail = line.length() - 1; tail > head; tail--) {
                String subString = line.substring(head, tail);
                if(line.indexOf(subString,head+1)>-1){
                    length = Math.max(subString.length(), length);
                }
            }
        }
        System.out.println(length);
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.io.BufferedReader;
import java.io.IOException;
import java.io.*;
import java.util.*;
import java.lang.*;

public class A {

	private BufferedReader in;	
	private StringTokenizer st;
	
	
	void solve() throws IOException{
		
		int len = 0;
		String x = next();
		HashSet<String> h = new HashSet<String>();
		for (int i = 0; i < x.length(); i++) {
			for (int j = i+1; j <= x.length(); j++) {
				String y = x.substring(i,j);
				if(h.contains(y)){
					if(y.length()>len) len = y.length();
				}
				else h.add(y);
			}
		}
		System.out.println(len);
		
	}
	A() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));			
		eat("");
		solve();			
	}
	
	private void eat(String str) {
		st = new StringTokenizer(str);
	}

	String next() throws IOException {
		while (!st.hasMoreTokens()) {
			String line = in.readLine();
			if (line == null) {
				return null;
			}
			eat(line);
		}
		return st.nextToken();
	}

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

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

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


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

}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.util.Arrays;
import java.util.Scanner;

public class Main{
    
    private static int[] T;
    
    public static void main(String[] args){
        
        Scanner in = new Scanner(System.in);
        char[] input =  in.nextLine().toCharArray();
        int length = input.length;
        int max = 0;
        for(int i=0; i<length; i++){
            char[] subString = Arrays.copyOfRange(input, 1, input.length);
            int temp = solve(input, subString);
            if(temp > max) max = temp;
            input = Arrays.copyOfRange(input, 1, input.length);
        }
        System.out.println(max);
        
    }

    private static int solve(char[] P, char[] S) {
        
        T = new int[P.length+1];
        
        preKmp(P, P.length, T);
        int max = 0;

        int i = 0, j = 0;
        while (j < S.length) {
            while (i > -1 && (P[i] != S[j]))
                i = T[i];
            i++;
            j++;
            if ( i > max) max = i;
            if (i >= P.length) {
                i = T[i];
            }
        }
        
        return max;
        
        
    }

    private static void preKmp(char[] x, int m, int[] kmpNext) {
           int i = 0, j = kmpNext[0] = -1;
           
           while (i < m-1) {
              while (j > -1 && x[i] != x[j])
                 j = kmpNext[j];
              i++;
              j++;
              if (x[i] == x[j])
                 kmpNext[i] = kmpNext[j];
              else
                 kmpNext[i] = j;
           }

        
    }
}
// Problem: 1515_E. Phoenix and Computers
// Time complexity: cubic

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

public class CF1515E{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int md = sc.nextInt();
		int k = (n + 1) / 2;
		int[][] dp = new int[k + 1][n + 1]; dp[0][0] = 1;
		for (int h = 1; h <= k; h++)
			for (int l = h; l <= n - h + 1; l++)
				dp[h][l] = (int) ((dp[h][l - 1] * 2L + dp[h - 1][l - 1]) * h % md);
		int ans = 0;
		for (int h = 1; h <= k; h++)
			ans = (ans + dp[h][n - h + 1]) % md;
		System.out.println(ans);
	}
}
// Problem: 1515_E. Phoenix and Computers
// Time complexity: cubic
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), md = sc.nextInt();
        int k = (n + 1) / 2;int ans = 0;
        int[][] dp = new int[k + 1][n + 1];dp[0][0] = 1;
        for (int h = 1; h <= k; h++)
            for (int l = h; l <= n - h + 1; l++)
                dp[h][l] = (int) ((dp[h][l - 1] * 2L + dp[h - 1][l - 1]) * h % md);
        for (int h = 1; h <= k; h++)
            ans = (ans + dp[h][n - h + 1]) % md;
        System.out.println(ans);
    }
}
// Problem: 1515_E. Phoenix and Computers
// Time complexity: cubic
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskE {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();
            int MOD = in.nextInt();

            int[][] C = new int[n + 1][n + 1];
            C[0][0] = 1;
            for (int i = 1; i < C.length; i++) {
                C[i][0] = 1;
                for (int j = 1; j < C.length; j++) {
                    C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
                    if (C[i][j] >= MOD) {
                        C[i][j] -= MOD;
                    }
                }
            }

            int[] p2 = new int[n + 1];
            p2[0] = 1;
            for (int i = 1; i < p2.length; i++) {
                p2[i] = 2 * p2[i - 1] % MOD;
            }

            int[][] d = new int[n + 1][n + 1];
            d[0][0] = 1;
            // Total.
            for (int i = 1; i <= n; i++) {
                // Switched on manually.
                for (int j = 1; j <= i; j++) {
                    // Switched on manually in the first block.
                    for (int t = 1; t <= j; t++) {
                        if (t == i - 1) {
                            continue;
                        }
                        d[i][j] = (int) ((d[i][j] + (long) C[j][t] * p2[t - 1] % MOD * d[i - t - (i == t ? 0 : 1)][j - t]) % MOD);
                    }
                }
            }

            int ans = 0;
            for (int k = 1; k <= n; k++) {
                ans += d[n][k];
                if (ans >= MOD) {
                    ans -= MOD;
                }
            }

            out.println(ans);
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

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

    }
}
// Problem: 1515_E. Phoenix and Computers
// Time complexity: cubic
//https://github.com/EgorKulikov/yaal/tree/master/lib/main/net/egork
        
import java.util.*;
import java.io.*;
public class B{
    static PrintWriter out;
    static InputReader in;
    public static void main(String args[]){
        out = new PrintWriter(System.out);
        in = new InputReader();
        new B();
        out.flush(); out.close();
    }   
    B(){
        solve();
    }
    class pair{
        int F, S;
        pair(int a, int b){
            F = a; S = b;
        }
    }
    void solve(){
        int n = in.nextInt(), mod = in.nextInt();
        long dp[][] = new long[n + 1][n + 1];
        long ncr[][] = new long[810][410];
        ncr[0][0] = 1;
        for(int i = 1; i < 810; i++){
            for(int j = 0; j < 410; j++){
                ncr[i][j] = (ncr[i - 1][j] + (j > 0 ? ncr[i - 1][j - 1] : 0)) % mod;
            }
        }
        for(int i = 1; i <= n; i++)dp[i][i] = 1;
        for(int i = 1; i < n; i++){
            for(int j = 1; j + i <= n; j++){
                int end = i + j;
                dp[j][end] = (dp[j + 1][end] + dp[j][end - 1]) % mod;
            }
        }
        long value[] = new long[n + 1];
        for(int i = 1; i <= n; i++){
            value[i] = dp[1][i];
        }
        long fdp[][] = new long[n + 2][n + 2];
        fdp[0][0] = 1;
        long ans = 0;
        for(int b = 1; b <= (n + 1) / 2; b++){
            for(int i = 1; i <= n; i++){
                for(int k = Math.max(0, b - 2); k < i; k++){
                    fdp[i + 1][b] = (fdp[i + 1][b] + fdp[k][b - 1] * value[i - k] % mod * ncr[k - b + 2 + i - k - 1][i - k] % mod) % mod;
                }
            }
            ans = (ans + fdp[n + 1][b]) % mod;
        }
        out.print(ans);
    }
    public static class InputReader{
        BufferedReader br;
        StringTokenizer st;
        InputReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public long nextLong(){
            return Long.parseLong(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
        public String next(){
            while(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch(IOException e){}
            }
            return st.nextToken();
        }
    }
}
// Problem: 1515_E. Phoenix and Computers
// Time complexity: cubic
import java.util.*;
import java.io.*;

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

    FastReader in = new FastReader();
    PrintWriter out = new PrintWriter(System.out);
    void run(){
        work();
        out.flush();
    }
    long mod=998244353;
    long gcd(long a,long b) {
        return a==0?b:gcd(b%a,a);
    }

    void work() {
        int n=ni();
        mod=nl();
        long[] dp1=new long[401];
        long[][] dp2=new long[n+1][n+1];
        long[][] C=new long[401][401];
        for(int j=0;j<=400;j++){
            for(int i=0;i<=j;i++){
                if(i==0||j==i){
                    C[i][j]=1;
                }else{
                    C[i][j]=(C[i-1][j-1]+C[i][j-1])%mod;
                }
            }
        }
        for(int i=1;i<=400;i++){
            for(int j=0;j<i;j++){
                dp1[i]=(dp1[i]+C[j][i-1])%mod;
            }
        }
        for(int i=1;i<=n;i++){
            dp2[i][i]=dp1[i];
        }
        for(int i=1;i<=n;i++){
            for(int j=1;j<i;j++){
                for(int k=1;k<j;k++){
                    dp2[i][j]=dp2[i][j]+((((dp2[i-k-1][j-k]*dp1[k])%mod)*C[k][j])%mod);
                    dp2[i][j]%=mod;
                }
            }
        }
        long ret=0;
        for(int j=1;j<=n;j++){
            ret=(ret+dp2[n][j])%mod;
        }
        out.println(ret);
    }


    private ArrayList<long[]>[] ngw(int n, int m) {
        ArrayList<long[]>[] graph=(ArrayList<long[]>[])new ArrayList[n];
        for(int i=0;i<n;i++) {
            graph[i]=new ArrayList<>();
        }
        for(int i=1;i<=m;i++) {
            long s=in.nextLong()-1,e=in.nextLong()-1,w=in.nextLong();
            graph[(int)s].add(new long[] {e,w});
            graph[(int)e].add(new long[] {s,w});
        }
        return graph;
    }

    private int ni() {
        return in.nextInt();
    }

    private long nl() {
        return in.nextLong();
    }

    private String ns() {
        return in.next();
    }

    private long[] na(int n) {
        long[] A=new long[n];
        for(int i=0;i<n;i++) {
            A[i]=in.nextLong();
        }
        return A;
    }
    private int[] nia(int n) {
        int[] A=new int[n];
        for(int i=0;i<n;i++) {
            A[i]=in.nextInt();
        }
        return A;
    }
}

class FastReader
{
    BufferedReader br;
    StringTokenizer st;

    public FastReader()
    {
        br=new BufferedReader(new InputStreamReader(System.in));
    }


    public String next()
    {
        while(st==null || !st.hasMoreElements())//回车，空行情况
        {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

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

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