/in/foo.cc:5:1: error: expected ',' or ';' before 'int'
int f[maxn],v[maxn],n,P;
^~~
/in/foo.cc: In function 'int dp(int)':
/in/foo.cc:8:11: error: 'f' was not declared in this scope
int &rec=f[cur];
^
/in/foo.cc:11:17: error: 'n' was not declared in this scope
for(int i=1;i<=n;i++)
^
/in/foo.cc:12:11: error: 'v' was not declared in this scope
if(cur+v[i]<=P)
^
/in/foo.cc:12:17: error: 'P' was not declared in this scope
if(cur+v[i]<=P)
^
/in/foo.cc: In function 'int main()':
/in/foo.cc:17:16: error: 'n' was not declared in this scope
scanf("%d%d",&n,&P);
^
/in/foo.cc:17:19: error: 'P' was not declared in this scope
scanf("%d%d",&n,&P);
^
/in/foo.cc:19:16: error: 'v' was not declared in this scope
scanf("%d",&v[i]);
^
/in/foo.cc:21:25: error: 'f' was not declared in this scope
if(vis[P]) printf("%d",f[0]);
^