Language: C++

#include <iostream>
#include <cstring>
#include <map>
using namespace std;
 
map<int,map<long long int, long long int> > dp;int c, n, k, cisim[100][2];
 
long long int recursive(int konum, int agirlik){
	if(konum>=n)return 0;
	if(agirlik>=c)return 0;
	if(dp[konum][agirlik])return dp[konum][agirlik];
 
	if(cisim[konum][0]>c-agirlik){
	dp[konum][agirlik]=recursive(konum+1,agirlik);}
	else {
	dp[konum][agirlik]=max(cisim[konum][1]+recursive(konum+1, agirlik+cisim[konum][0]), recursive(konum+1, agirlik));}
	
	return dp[konum][agirlik];
}
 
int main(void){
	cin>>n>>c;
	for(int i=0;i<n;i++)cin>>cisim[i][0]>> cisim[i][1];
	memset(dp, 0, sizeof(long long int)*(n+1)*100002);
	cout<<recursive(0,0);
	return 0;
}
#include <iostream>
#include <cstring>
using namespace std;

long long int dp[102][100002];int c, n, k, cisim[100][2];

long long int recursive(int konum, int agirlik){
	if(konum>=n)return 0;
	if(agirlik>=c)return 0;
	if(dp[konum][agirlik])return dp[konum][agirlik];

	if(cisim[konum][0]>c-agirlik){
	dp[konum][agirlik]=recursive(konum+1,agirlik);}
	else {
	dp[konum][agirlik]=max(cisim[konum][1]+recursive(konum+1, agirlik+cisim[konum][0]), recursive(konum+1, agirlik));}
	
	return dp[konum][agirlik];
}

int main(void){
	cin>>n>>c;
	for(int i=0;i<n;i++)cin>>cisim[i][0]>> cisim[i][1];
	memset(dp, 0, sizeof(long long int)*(n+1)*100002);
	cout<<recursive(0,0);
	return 0;
}
Submission Info

Compiler output:
a.cc: In function 'int main()':
a.cc:24:16: error: cannot convert 'std::map<int, std::map<long long int, long long int> >' to 'void*'
   24 |         memset(dp, 0, sizeof(long long int)*(n+1)*100002);
      |                ^~
      |                |
      |                std::map<int, std::map<long long int, long long int> >
In file included from /usr/include/c++/14/cstring:43,
                 from a.cc:2:
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
a.cc: At global scope:
a.cc:32:15: error: conflicting declaration 'long long int dp [102][100002]'
   32 | long long int dp[102][100002];int c, n, k, cisim[100][2];
      |               ^~
a.cc:6:45: note: previous declaration as 'std::map<int, std::map<long long int, long long int> > dp'
    6 | map<int,map<long long int, long long int> > dp;int c, n, k, cisim[100][2];
      |                                             ^~
a.cc:32:35: error: redefinition of 'int c'
   32 | long long int dp[102][100002];int c, n, k, cisim[100][2];
      |                                   ^
a.cc:6:52: note: 'int c' previously declared here
    6 | map<int,map<long long int, long long int> > dp;int c, n, k, cisim[100][2];
      |                                                    ^
a.cc:32:38: error: redefinition of 'int n'
   32 | long long int dp[102][100002];int c, n, k, cisim[100][2];
      |                                      ^
a.cc:6:55: note: 'int n' previously declared here
    6 | map<int,map<long long int, long long int> > dp;int c, n, k, cisim[100][2];
      |                                                       ^
a.cc:32:41: error: redefinition of 'int k'
   32 | long long int dp[102][100002];int c, n, k, cisim[100][2];
      |                                         ^
a.cc:6:58: note: 'int k' previously declared here
    6 | map<int,map<long long int, long long int> > dp;int c, n, k, cisim[100][2];
      |                                                          ^
a.cc:32:44: error: redefinition of 'int cisim [100][2]'
   32 | long long int dp[102][100002];int c, n, k, cisim[100][2];
      |                                            ^~~~~
a.cc:6:61: note: 'int cisim [100][2]' previously declared here
    6 | map<int,map<long long int, long long int> > dp;int c, n, k, cisim[100][2];
      |                                                             ^~~~~
a.cc:34:15: error: redefinition of 'long long int recursive(int, int)'
   34 | long long int recursive(int konum, int agirlik){
      |               ^~~~~~~~~
a.cc:8:15: note: 'long long int recursive(int, int)' previously defined here
    8 | long long int recursive(int konum, int agirlik){
      |               ^~~~~~~~~
a.cc:47:5: error: redefinition of 'int main()'
   47 | int main(void){
      |     ^~~~
a.cc:21:5: note: 'int main()' previously defined here
   21 | int main(void){
      |     ^~~~
a.cc: In function 'int main()':
a.cc:50:16: error: cannot convert 'std::map<int, std::map<long long int, long long int> >' to 'void*'
   50 |         memset(dp, 0, sizeof(long long int)*(n+1)*100002);
      |                ^~
      |                |
      |                std::map<int, std::map<long long int, long long int> >
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
a.cc: At global scope:
a.cc:54:1: error: 'Submission' does not name a type
   54 | Submission Info
      | ^~~~~~~~~~