stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<iostream>

#include<cstring>

#include<string>

using namespace std;

struct node

{

  int data;

  struct node*lchild;

  struct node*rchild;

};

typedef struct node;

typedef node *tree;

tree root;



void in(tree &bt,int n)

{

  if(bt)

  {

    if(n<bt->data)

      in(bt->lchild,n);

    else if(n>bt->data)

      in(bt->rchild,n);

  }

  else

  {

    bt=new node;

    bt->data=n;

    bt->lchild=NULL;

    bt->rchild=NULL;

  }

}

void out1(tree bt)

{

  if(bt)

  {

    out1(bt->lchild);

    cout<<" "<<bt->data;

    out1(bt->rchild);

  }

}

void out2(tree bt)

{

  if(bt)

  {

    cout<<" "<<bt->data;

    out2(bt->lchild);

    out2(bt->rchild);

  }

}

int main()

{

  root=NULL;

  int m;

  cin>>m;

  for(int i=1;i<=m;i++)

  {

    string zl;

    cin>>zl;

    if(zl=="insert")

    {

      int num;

      cin>>num;

      in(root,num);

    }

    else if(zl=="print")

    {

      out1(root);

      cout<<endl;

      out2(root);

      cout<<endl;

    }

  }

  return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<cstdlib>

using namespace std;

#define MAXN 500000

struct node {

	int key;

	node *ch[2];

};

node tree[MAXN+5];

node *Root, *NIL, *ncnt;

void Init(){

	NIL = &tree[0];

	ncnt = &tree[1];

	Root = NIL;

}

inline node *NewNode(int val) {

	node * p = ++ncnt;

	p->key = val;

	p->ch[0] = p->ch[1] = NIL;

	return p;

}

void Insert(node * &rt, int val) {

	if(rt == NIL) {

		rt = NewNode(val);

		return ;

	}

	int d = (val >= rt->key);

	Insert(rt->ch[d], val);

}

void PreOrder(node *rt) {

	if(rt == NIL) return;

	printf(" %d", rt->key);

	PreOrder(rt->ch[0]);

	PreOrder(rt->ch[1]);

}

void InOrder(node *rt) {

	if(rt == NIL) return;

	InOrder(rt->ch[0]);

	printf(" %d", rt->key);	

	InOrder(rt->ch[1]);

}

int main() {

	int n, x;

	char op[100];

	Init();

	scanf("%d", &n);

	for(int i=0; i<n; i++){

		scanf("%s", op);

		if(op[0] == 'i') {

			scanf("%d", &x);

			Insert(Root, x);

		}

		else {

			InOrder(Root);

			puts("");

			PreOrder(Root);

			puts("");			

		}

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstring>

#include<cstdio>

#include<cstdlib>

#include<algorithm>

using namespace std;

struct Node

{

    int key;

    Node *p,*l,*r;

};

Node *root,*NIL;

void insert(int k)

{

    Node *y=NIL;

    Node *x=root;

    Node *z;

    z=(Node*)malloc(sizeof(Node));

    z->key=k;

    z->l=NIL;

    z->r=NIL;

    while(x!=NIL)

    {

        y=x;

        if(z->key<x->key)

            x=x->l;

        else

            x=x->r;

    }

    z->p=y;

    if(y==NIL)

    {

        root=z;

    }

    else

    {

        if(z->key<y->key)

        {

            y->l=z;

        }

        else

        {

            y->r=z;

        }

    }

}

void zx(Node *u)

{

    if(u==NIL)return;

    zx(u->l);

    printf(" %d",u->key);

    zx(u->r);

}

void qx(Node *u)

{

    if(u==NIL)return;

    printf(" %d",u->key);

    qx(u->l);

    qx(u->r);



}

int main()

{

    int n,k;

    scanf("%d",&n);

    string c;

    for(int i=1;i<=n;i++)

    {

        cin>>c;

        if(c=="insert")

        {

            scanf("%d",&k);

            insert(k);

        }

        else if(c=="print")

        {

            zx(root);

            printf("\n");

            qx(root);

            printf("\n");

        }

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<cstdlib>

using namespace std;

#define MAXN 500000

struct node {

	int key;

	node *ch[2];

};

node tree[MAXN+5];

node *Root, *NIL, *ncnt;

void Init(){

	NIL = &tree[0];

	ncnt = &tree[1];

	Root = NIL;

}

inline node *NewNode(int val) {

	node * p = ++ncnt;

	p->key = val;

	p->ch[0] = p->ch[1] = NIL;

	return p;

}

void Insert(node * &rt, int val) {

	if(rt == NIL) {

		rt = NewNode(val);

		return ;

	}

	int d = (val >= rt->key);

	Insert(rt->ch[d], val);

}

void PreOrder(node *rt) {

	if(rt == NIL) return;

	printf(" %d", rt->key);

	PreOrder(rt->ch[0]);

	PreOrder(rt->ch[1]);

}

void InOrder(node *rt) {

	if(rt == NIL) return;

	InOrder(rt->ch[0]);

	printf(" %d", rt->key);	

	InOrder(rt->ch[1]);

}

int main() {

	int n, x;

	char op[100];

	Init();

	scanf("%d", &n);

	for(int i=0; i<n; i++){

		scanf("%s", op);

		if(op[0] == 'i') {

			scanf("%d", &x);

			Insert(Root, x);

		}

		else {

			InOrder(Root);

			puts("");

			PreOrder(Root);

			puts("");			

		}

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<cstdlib>

#include<string>

#include<iostream>

using namespace std;

struct Node

{

    int key;

    Node *right, *left, *parent;

};

Node *root, *NIL;

void insert(int k)

{

    Node *y=NIL;

    Node *x=root;

    Node *z;

    z=(Node*)malloc(sizeof(Node));

    z->key=k;

    z->left=NIL;

    z->right=NIL;

    while(x!=NIL)

    {

        y=x;

        if(z->key<x->key)

        {

            x=x->left;

        }else

        {

            x=x->right;

        }

    }

    z->parent=y;

    if(y==NIL)

    {

        root=z;

    }

    else

    {

        if(z->key<y->key)

        {

            y->left=z;

        }

        else

        {

            y->right=z;

        }

    }

}

void inorder(Node *u)

{

    if(u==NIL) return;

    inorder(u->left);

    printf(" %d",u->key);

    inorder(u->right);

}

void preorder(Node *u)

{

    if(u==NIL) return;

    printf(" %d",u->key);

    preorder(u->left);

    preorder(u->right);

}

int main()

{

    int n,i,x;

    string com;

    scanf("%d",&n);

    for(i=0;i<n;i++)

    {

        cin>>com;

        if(com=="insert")

        {

            scanf("%d",&x);

            insert(x);

        }

        else if(com=="print")

        {

            inorder(root);

            printf("\n");

            preorder(root);

            printf("\n");

        }

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<cstdlib>

using namespace std;

#define MAXN 500000

struct node {

	int key;

	node *ch[2];

};

node tree[MAXN+5];

node *Root, *NIL, *ncnt;

void Init(){

	NIL = &tree[0];

	ncnt = &tree[1];

	Root = NIL;

}

inline node *NewNode(int val) {

	node * p = ++ncnt;

	p->key = val;

	p->ch[0] = p->ch[1] = NIL;

	return p;

}

void Insert(node * &rt, int val) {

	if(rt == NIL) {

		rt = NewNode(val);

		return ;

	}

	int d = (val >= rt->key);

	Insert(rt->ch[d], val);

}

void PreOrder(node *rt) {

	if(rt == NIL) return;

	printf(" %d", rt->key);

	PreOrder(rt->ch[0]);

	PreOrder(rt->ch[1]);

}

void InOrder(node *rt) {

	if(rt == NIL) return;

	InOrder(rt->ch[0]);

	printf(" %d", rt->key);	

	InOrder(rt->ch[1]);

}

int main() {

	int n, x;

	char op[100];

	Init();

	scanf("%d", &n);

	for(int i=0; i<n; i++){

		scanf("%s", op);

		if(op[0] == 'i') {

			scanf("%d", &x);

			Insert(Root, x);

		}

		else {

			InOrder(Root);

			puts("");

			PreOrder(Root);

			puts("");			

		}

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<iostream>

#include<cstdlib>

#include<cstring>

#include<string>

using namespace std;



struct Node{

	int key;

	Node *parent,*left,*right;

};

Node *root,*NIL;



void insert(int k)

{

	Node *y=NIL;

	Node *x=root;

	Node *z;

	z=(Node *)malloc(sizeof(Node));

	z->key=k;

	z->left=NIL;

	z->right=NIL;

	

	while(x!=NIL)

	{

		y=x;

		if(z->key < x->key)

			x=x->left;

		else

			x=x->right;

	}

	

	z->parent=y;

	if(y==NIL)

	{

		root=z;

	}

	else{

		if(z->key < y->key)

		{

			y->left = z;

		}

		else

		{

			y->right = z;

		}

	}

}



void inorder(Node *u)

{

	if(u==NIL) return;

	inorder(u->left);

	printf(" %d",u->key);

	inorder(u->right);

}



void preorder(Node *u)

{

	if(u==NIL) return;

	printf(" %d",u->key);

	preorder(u->left);

	preorder(u->right);

}



int main()

{

	int n,i,x;

	string com;

	scanf("%d",&n);

	for(int i=0;i<n;i++)

	{

		cin>>com;

	/*	if(com[0]=='f')

		{

			scanf("%d",&x);

			find(root,x);

		}*/

		if(com=="insert")

		{

			scanf("%d",&x);

			insert(x);

		}

		else if(com=="print")

		{

			inorder(root);

			printf("\n");

			preorder(root);

			printf("\n");

		}

	} 

	return 0;	

} 

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<cstdlib>

using namespace std;

#define MAXN 500000

struct node {

	int key;

	node *ch[2];

};

node tree[MAXN+5];

node *Root, *NIL, *ncnt;

void Init(){

	NIL = &tree[0];

	ncnt = &tree[1];

	Root = NIL;

}

inline node *NewNode(int val) {

	node * p = ++ncnt;

	p->key = val;

	p->ch[0] = p->ch[1] = NIL;

	return p;

}

void Insert(node * &rt, int val) {

	if(rt == NIL) {

		rt = NewNode(val);

		return ;

	}

	int d = (val >= rt->key);

	Insert(rt->ch[d], val);

}

void PreOrder(node *rt) {

	if(rt == NIL) return;

	printf(" %d", rt->key);

	PreOrder(rt->ch[0]);

	PreOrder(rt->ch[1]);

}

void InOrder(node *rt) {

	if(rt == NIL) return;

	InOrder(rt->ch[0]);

	printf(" %d", rt->key);	

	InOrder(rt->ch[1]);

}

int main() {

	int n, x;

	char op[100];

	Init();

	scanf("%d", &n);

	for(int i=0; i<n; i++){

		scanf("%s", op);

		if(op[0] == 'i') {

			scanf("%d", &x);

			Insert(Root, x);

		}

		else {

			InOrder(Root);

			puts("");

			PreOrder(Root);

			puts("");			

		}

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>  

#include <stdlib.h> 

#include <stdio.h>  

#include <string>

#include <string.h>

#include <math.h>  

#include <time.h>

#include <list>

#include <map>  

#include <queue>  

#include <set>

#include <stack>

#include <vector>  

#include <algorithm>

#define ms(a) memset(a,0,sizeof(a)) 

#define inf 0x3f3f3f3f

#define MAX 100010

#define MX 10010

#define ll long long

using namespace std;

struct node

{

	int data;

	node *lch,*rch,*par;

}*root,*null;

void insert(int k)

{

	node *cur=root,*res=null,*ins=(node*)malloc(sizeof(node));

	ins->data=k;

	ins->lch=null;

	ins->rch=null;

	while (cur!=null)

	{

		res=cur;

		if(ins->data<cur->data)cur=cur->lch;

		else cur=cur->rch;

	}

	ins->par=res;//定?父?点

	if(res==null)root=ins;//第一次插入

	else{//定?左右子

		if(ins->data<res->data)res->lch=ins;

		else res->rch=ins;

	}

}

void inorder(node *cur)

{

	if(cur==null)return;

	inorder(cur->lch);

	printf(" %d",cur->data);

	inorder(cur->rch);

}

void preorder(node *cur)

{

	if(cur==null)return;

	printf(" %d",cur->data);

	preorder(cur->lch);

	preorder(cur->rch);

}

int main()

{

	int n,m;

	char oper[10];

	scanf("%d",&n);

	for (int i = 0; i < n; i++)

	{

		scanf("%s",&oper);

		if(oper[0]=='i'){

			scanf("%d",&m);

			insert(m);

		}

		else if(oper[0]=='p'){

			inorder(root);

			printf("\n");

			preorder(root);

			printf("\n");

		}

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<cstdlib>

using namespace std;

#define MAXN 500000

struct node {

	int key;

	node *ch[2];

};

node tree[MAXN+5];

node *Root, *NIL, *ncnt;

void Init(){

	NIL = &tree[0];

	ncnt = &tree[1];

	Root = NIL;

}

inline node *NewNode(int val) {

	node * p = ++ncnt;

	p->key = val;

	p->ch[0] = p->ch[1] = NIL;

	return p;

}

void Insert(node * &rt, int val) {

	if(rt == NIL) {

		rt = NewNode(val);

		return ;

	}

	int d = (val >= rt->key);

	Insert(rt->ch[d], val);

}

void PreOrder(node *rt) {

	if(rt == NIL) return;

	printf(" %d", rt->key);

	PreOrder(rt->ch[0]);

	PreOrder(rt->ch[1]);

}

void InOrder(node *rt) {

	if(rt == NIL) return;

	InOrder(rt->ch[0]);

	printf(" %d", rt->key);	

	InOrder(rt->ch[1]);

}

int main() {

	int n, x;

	char op[100];

	Init();

	scanf("%d", &n);

	for(int i=0; i<n; i++){

		scanf("%s", op);

		if(op[0] == 'i') {

			scanf("%d", &x);

			Insert(Root, x);

		}

		else {

			InOrder(Root);

			puts("");

			PreOrder(Root);

			puts("");			

		}

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

int a,b,c,d;

cin>>a>>b>>c>>d;

if (a*b>c*d)

{

cout<<a*b<<"\n";

}



else

{

cout<<c*d<<"\n";

}



return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int a,b,c,d;

	int n,m;

	scanf("%d%d%d%d",&a,&b,&c,&d);

	if(a*b>=c*d)

	printf("%d",a*b);

	else

	printf("%d",c*d);

	return 0;

 }

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;



int main() {

	int a, b, c, d, area1, area2;

	scanf("%d %d %d %d", &a, &b, &c, &d);

	

	area1 = a * b;

	area2 = c * d;

	

	if (area2 > area1) area1 = area2;

	

	printf("%d\n", area1);

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int a,b,c,d;

	int n,m;

	scanf("%d%d%d%d",&a,&b,&c,&d);

	if(a*b>=c*d)

	printf("%d",a*b);

	else

	printf("%d",c*d);

	return 0;

 }

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main(){

    int x,y,z,m,w,h;

    cin>>x>>y>>z>>m;

    w=x*y;

    h=z*m;

    if(w>h){

    	cout<<w;

	}if(h>=w){

		cout<<h;

		

	}

	

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int a,b,c,d;

	int n,m;

	scanf("%d%d%d%d",&a,&b,&c,&d);

	if(a*b>=c*d)

	printf("%d",a*b);

	else

	printf("%d",c*d);

	return 0;

 }

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

int main(){

int a,b,x,y;

cin>>a>>b>>x>>y;

if((a*b)<=(x*y)){

    cout<<x*y<<endl;

}

else{

    cout<<a*b<<endl;

}

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int a,b,c,d;

	int n,m;

	scanf("%d%d%d%d",&a,&b,&c,&d);

	if(a*b>=c*d)

	printf("%d",a*b);

	else

	printf("%d",c*d);

	return 0;

 }

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int main(){

	int a=0,b=0,c=0,d=0,area1=0,area2=0;

    scanf("%d%d%d%d",&a,&b,&c,&d);

    area1=a*b;

    area2=c*d;

    if(area1>area2)

      printf("%d",area1);

    else

	printf("%d",area2);  

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int a,b,c,d;

	int n,m;

	scanf("%d%d%d%d",&a,&b,&c,&d);

	if(a*b>=c*d)

	printf("%d",a*b);

	else

	printf("%d",c*d);

	return 0;

 }

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<set>

#include<map>

#include<stack>

#include<queue>

#include<deque>

#include<cmath>

#include<cstdio>

#include<cctype>

#include<string>

#include<vector>

#include<cstdlib>

#include<cstring>

#include<sstream>

#include<iostream>

#include<algorithm>

#define MAXN 100000

#define pii pair<int,int>



using namespace std;

int main()

{

	int a,b,c,d;

	scanf("%d%d%d%d",&a,&b,&c,&d);

	printf("%d",max(a*b,c*d));

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;



int main()

{

	int A,B,C,D;

	scanf("%d %d %d %d",&A,&B,&C,&D);

	int area1,area2;

	area1=A*B;

	area2=C*D;

	printf("%d\n",area1>=area2?area1:area2);

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

#define LL long long



int main()

{

    LL a, b, c, d;

    while(cin >> a >> b >> c >> d){

        LL x = a * b;

        LL y = c * d;

        cout << max(x, y) << '\n';

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;



int main()

{

	int A,B,C,D;

	scanf("%d %d %d %d",&A,&B,&C,&D);

	int area1,area2;

	area1=A*B;

	area2=C*D;

	printf("%d\n",area1>=area2?area1:area2);

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):


#include<bits/stdc++.h>

typedef long long ll;

using namespace std;



int main()

{

    ll a,b,c,d;

    ll r1,r2;



    while(cin>>a>>b>>c>>d)

    {

        r1=a*b;

        r2=c*d;



        if(r1>=r2)

            cout<<r1<<endl;

        else

            cout<<r2<<endl;

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;



int main()

{

	int A,B,C,D;

	scanf("%d %d %d %d",&A,&B,&C,&D);

	int area1,area2;

	area1=A*B;

	area2=C*D;

	printf("%d\n",area1>=area2?area1:area2);

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>



using namespace std ;



#define i64 long long int



int main()

{

    ios_base::sync_with_stdio(false);

    i64 a,b,c,d;

    cin>>a>>b>>c>>d;

    if(a*b>c*d)

    {

        cout<<a*b<<endl;

    }

    else

    {

        cout<<c*d<<endl;

    }

    return 0;



}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;



int main()

{

	int A,B,C,D;

	scanf("%d %d %d %d",&A,&B,&C,&D);

	int area1,area2;

	area1=A*B;

	area2=C*D;

	printf("%d\n",area1>=area2?area1:area2);

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;



int main() {

	

	int A,B,C,D;

	

	cin >> A;

	cin >> B;

	cin >> C;

	cin >> D;

	

	if(A*B >= C*D){

	    printf("%d",A*B);

	}

	else{

	    printf("%d",C*D);

	}

	

	return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;



int main()

{

	int A,B,C,D;

	scanf("%d %d %d %d",&A,&B,&C,&D);

	int area1,area2;

	area1=A*B;

	area2=C*D;

	printf("%d\n",area1>=area2?area1:area2);

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



int main(){

	int a,b,c,d;cin>>a>>b>>c>>d;

	cout<<max(a*b,c*d)<<endl;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

int a,b,c,d;scanf("%d%d%d%d",&a,&b,&c,&d);

int e=a*b,f=c*d;

printf("%d\n",e<f?f:e);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



int main()

{

    int a,b,c,d;

    cin>>a>>b>>c>>d;

    if((a*b)==(c*d))

    {

        cout<<a*b<<endl;

    }

    else if((a*b)>(c*d))

    {

       cout<<a*b<<endl;

    }

    else

    {

         cout<<c*d<<endl;

    }

    return 0;

}






// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<cmath>

int main(){

	int A,B,C,D;

	scanf("%d%d%d%d",&A,&B,&C,&D);

	int are1,are2;

	are1=A*B;

	are2=C*D;

	if(are1>=are2){

		printf("%d\n",are1);}

		else{

			printf("%d\n",are2);}

			return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define rep(i,l,r) for (int i=l;i<=r;i++)

using namespace std;

typedef long long ll;

const int maxn=305;

ll f[maxn][maxn],g[maxn][maxn],c[maxn][maxn],fac[maxn],inv[maxn];

int n,k;

ll mm;

ll dfs(int i,int j);

ll getsum(int i,int j){

	if (~g[i][j]) return g[i][j];

	g[i][j]=0;

	rep(p,j,k) (g[i][j]+=dfs(i,p))%=mm;

	return g[i][j];

}

ll dfs(int i,int j){

	if (~f[i][j]) return f[i][j];

	if (i==1) return f[i][j]=1;

	f[i][j]=0;

	rep(len,1,i-1) {

		(f[i][j]+=getsum(len,j+1)*dfs(i-len,j)%mm*c[i-2][len-1]%mm)%=mm;

	}

	return f[i][j];

}

int main(){

	scanf("%d%d%lld",&n,&k,&mm);

	c[0][0]=1;

	rep(i,1,n) {

		c[i][0]=1; c[i][i]=1;

		rep(j,1,i-1) c[i][j]=(c[i-1][j]+c[i-1][j-1])%mm;

	}

	memset(f,-1,sizeof(f));

	memset(g,-1,sizeof(g));

	dfs(n+1,0);

	printf("%lld\n",f[n+1][0]);

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define N 305

int n,m,p,dp[N][N],su[N][N],c[N][N];

int main()

{

	scanf("%d%d%d",&n,&m,&p);n++;m++;

	for(int i=1;i<=m;i++)dp[1][i]=1,su[1][i]=i;

	for(int i=0;i<=n;i++)c[i][i]=c[i][0]=1;

	for(int i=2;i<=n;i++)for(int j=1;j<i;j++)c[i][j]=(c[i-1][j-1]+c[i-1][j])%p;

	for(int i=2;i<=n;i++)

	{

		for(int k=1;k<=m;k++)

		for(int j=1;j<i;j++)

		dp[i][k]=(dp[i][k]+1ll*dp[i-j][k]*su[j][k-1]%p*c[i-2][j-1])%p;

		for(int k=1;k<=m;k++)su[i][k]=(su[i][k-1]+dp[i][k])%p;

	}

	printf("%d\n",dp[n][m]);

}//

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <algorithm>

#include <cmath>

#include <vector>

#include <queue>

#include <set>

#include <map>

#include <string>

#include <string.h>

#include <stdlib.h>

#include <time.h>

#include <climits>



using namespace std;



const int maxN=307;



long long dp[maxN][maxN],s[maxN][maxN],c[maxN][maxN];



int main(){

	int n,m,k;

	scanf("%d%d%d",&n,&k,&m);



	for (int i=0;i<=n;i++) {

		c[i][0]=c[i][i]=1;

		for (int j=1;j<i;j++) c[i][j]=(c[i-1][j]+c[i-1][j-1])%m;

	}



	for (int i=0;i<=k;i++) dp[1][i]=1,s[1][i]=(k-i+1)%m;

	for (int i=2;i<=n+1;i++) 

		for (int j=k;j>=0;j--){

			for (int t=1;t<i;t++) dp[i][j]=(dp[i][j]+dp[i-t][j]*c[i-2][t-1]%m*s[t][j+1]%m)%m;

			s[i][j]=(s[i][j+1]+dp[i][j])%m;

		}



	printf("%lld\n",dp[n+1][0]);

	return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define N 305

int n,m,p,dp[N][N],su[N][N],c[N][N];

int main()

{

	scanf("%d%d%d",&n,&m,&p);n++;m++;

	for(int i=1;i<=m;i++)dp[1][i]=1,su[1][i]=i;

	for(int i=0;i<=n;i++)c[i][i]=c[i][0]=1;

	for(int i=2;i<=n;i++)for(int j=1;j<i;j++)c[i][j]=(c[i-1][j-1]+c[i-1][j])%p;

	for(int i=2;i<=n;i++)

	{

		for(int k=1;k<=m;k++)

		for(int j=1;j<i;j++)

		dp[i][k]=(dp[i][k]+1ll*dp[i-j][k]*su[j][k-1]%p*c[i-2][j-1])%p;

		for(int k=1;k<=m;k++)su[i][k]=(su[i][k-1]+dp[i][k])%p;

	}

	printf("%d\n",dp[n][m]);

}//

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



typedef long long LL;



int MOD;



inline int Add(int a, int b) {

    return (a + b >= MOD) ? (a + b - MOD) : (a + b);

}

inline int Mul(int a, int b) {

    return (LL)a * b % MOD;

}





const int N = 305, M = 305;



int n, m;

int c[N][N];

int f[N][M];



void Init() {

    for (int i = 0; i <= n; ++i) {

        c[i][0] = c[i][i] = 1;

        for (int j = 1; j < i; ++j)

            c[i][j] = Add(c[i - 1][j - 1], c[i - 1][j]);

    }

    return;

}



int main() {

    scanf("%d%d%d", &n, &m, &MOD);

    Init();

    for (int i = 1; i <= n; ++i)

        for (int j = 1; j <= m; ++j) {

            if (i == 1) {

                f[i][j] = j % MOD;

                continue;

            }

            if (j == 1) {

                f[i][j] = 1 % MOD;

                continue;

            }

            f[i][j] = f[i][j - 1];

            for (int k = 1; k <= i; ++k)

                f[i][j] = Add(f[i][j], Mul(c[i][k - 1], Mul(k > 1 ? f[k - 1][j - 1] : 1, k < i ? f[i - k][j] : 1)));

        }

    printf("%d\n", f[n][m]);

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

#define N 305

int n,m,p,dp[N][N],su[N][N],c[N][N];

int main()

{

	scanf("%d%d%d",&n,&m,&p);n++;m++;

	for(int i=1;i<=m;i++)dp[1][i]=1,su[1][i]=i;

	for(int i=0;i<=n;i++)c[i][i]=c[i][0]=1;

	for(int i=2;i<=n;i++)for(int j=1;j<i;j++)c[i][j]=(c[i-1][j-1]+c[i-1][j])%p;

	for(int i=2;i<=n;i++)

	{

		for(int k=1;k<=m;k++)

		for(int j=1;j<i;j++)

		dp[i][k]=(dp[i][k]+1ll*dp[i-j][k]*su[j][k-1]%p*c[i-2][j-1])%p;

		for(int k=1;k<=m;k++)su[i][k]=(su[i][k-1]+dp[i][k])%p;

	}

	printf("%d\n",dp[n][m]);

}//

// Fastest known solution for this problem: