criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
 
int main() {
  std::string str1,str2;
  int A[1001][1001];
  std::cin>>str1;
  std::cin>>str2;
  for(int i=0;i<=str1.size();i++){
    A[0][i]=i;
  }
  for(int i=0;i<=str2.size();i++){
    A[i][0]=i;
  }
  for(int i=1;j<=str1.size();j++){
    for(int j=1;k<=str2.size();k++){
      A[i-1][j-1]=min(A[i-1][j-1],min(A[i][j-1],A[i-1][j]))+1;
      if(str1[i-1]==str2[j-1]){
	A[i][j]=min(A[i][j],A[i-1][j-1]);
      }		    
    }
  }
  std::cout<<A[str1.size()][str2.size()]<<"\n";
  return 0;
 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:15: error: 'j' was not declared in this scope
   16 |   for(int i=1;j<=str1.size();j++){
      |               ^
a.cc:17:17: error: 'k' was not declared in this scope
   17 |     for(int j=1;k<=str2.size();k++){
      |                 ^
a.cc:18:35: error: 'min' was not declared in this scope; did you mean 'std::min'?
   18 |       A[i-1][j-1]=min(A[i-1][j-1],min(A[i][j-1],A[i-1][j]))+1;
      |                                   ^~~
      |                                   std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:18:19: error: 'min' was not declared in this scope; did you mean 'std::min'?
   18 |       A[i-1][j-1]=min(A[i-1][j-1],min(A[i][j-1],A[i-1][j]))+1;
      |                   ^~~
      |                   std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

#include <iostream>
#include <string>
//#include <algorithm>
 
int main() {
  std::string str1,str2;
  int A[1001][1001];
  std::cin>>str1;
  std::cin>>str2;
  for(int i=0;i<=str1.size();i++){
    A[0][i]=i;
  }
  for(int i=0;i<=str2.size();i++){
    A[i][0]=i;
  }
  for(int i=1;j<=str1.size();j++){
    for(int j=1;k<=str2.size();k++){
      A[i-1][j-1]=min(A[i-1][j-1],min(A[i][j-1],A[i-1][j]))+1;
      if(str1[i-1]==str2[j-1]){
	A[i][j]=min(A[i][j],A[i-1][j-1]);
      }		    
    }
  }
  std::cout<<A[str1.size()][str2.size()]<<"\n";
  return 0;
 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:15: error: 'j' was not declared in this scope
   16 |   for(int i=1;j<=str1.size();j++){
      |               ^
a.cc:17:17: error: 'k' was not declared in this scope
   17 |     for(int j=1;k<=str2.size();k++){
      |                 ^
a.cc:18:35: error: 'min' was not declared in this scope; did you mean 'std::min'?
   18 |       A[i-1][j-1]=min(A[i-1][j-1],min(A[i][j-1],A[i-1][j]))+1;
      |                                   ^~~
      |                                   std::min
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: 'std::min' declared here
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
a.cc:18:19: error: 'min' was not declared in this scope; did you mean 'std::min'?
   18 |       A[i-1][j-1]=min(A[i-1][j-1],min(A[i][j-1],A[i-1][j]))+1;
      |                   ^~~
      |                   std::min
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: 'std::min' declared here
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
Language: C++

#include <iostream>
#include <string>
 
int main() {
  std::string str1,str2;
  int A[1001][1001];
  std::cin>>str1;
  std::cin>>str2;
  for(int i=0;i<=str1.size();i++){
    A[0][i]=i;
  }
  for(int i=0;i<=str2.size();i++){
    A[i][0]=i;
  }
  for(int i=1;i<=str1.size();i++){
    for(int j=1;j<=str2.size();j++){
      A[i-1][j-1]=min(A[i-1][j-1],min(A[i][j-1],A[i-1][j]))+1;
      if(str1[i-1]==str2[j-1]){
	A[i][j]=min(A[i][j],A[i-1][j-1]);
      }		    
    }
  }
  std::cout<<A[str1.size()][str2.size()]<<"\n";
  return 0;
 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:35: error: 'min' was not declared in this scope; did you mean 'std::min'?
   17 |       A[i-1][j-1]=min(A[i-1][j-1],min(A[i][j-1],A[i-1][j]))+1;
      |                                   ^~~
      |                                   std::min
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: 'std::min' declared here
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
a.cc:17:19: error: 'min' was not declared in this scope; did you mean 'std::min'?
   17 |       A[i-1][j-1]=min(A[i-1][j-1],min(A[i][j-1],A[i-1][j]))+1;
      |                   ^~~
      |                   std::min
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: 'std::min' declared here
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){

    string s, t;
    cin >> s >> t;
    int S = (int)s.size(), T = (int)t.size();
    vector<vector<int> > dp(S + 1, vector<int> (T + 1, 1000000000));
    

    //dp初期化
    for(int i = 0; i < S + 1; i++) do[i][0] = i;
    for(int j = 0; j < T + 1; j++) do[0][j] = j;    
    for(int i = 1; i < S + 1; i++){
        for(int j = 1; j < T + 1; j++){
            dp[i][j] = min(dp[i][j], dp[i - 1][j]);
            dp[i][j] = min(dp[i][j], dp[i][j - 1]);
            if(s[i - 1] == s[j - 1]) dp[i][j] = min(dp[i][j], dp[i - 1][j - 1]);
            else dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + 1);
        }
    }

    cout << dp[S][T] << endl;
    return 0;

}


Compiler output:
a.cc: In lambda function:
a.cc:13:41: error: expected '{' before '[' token
   13 |     for(int i = 0; i < S + 1; i++) do[i][0] = i;
      |                                         ^
a.cc: In function 'int main()':
a.cc:13:41: error: no match for 'operator[]' (operand types are 'main()::<lambda()>' and 'int')
a.cc:14:8: error: expected 'while' before '(' token
   14 |     for(int j = 0; j < T + 1; j++) do[0][j] = j;
      |        ^
a.cc:14:9: error: expected primary-expression before 'int'
   14 |     for(int j = 0; j < T + 1; j++) do[0][j] = j;
      |         ^~~
a.cc:14:9: error: expected ')' before 'int'
   14 |     for(int j = 0; j < T + 1; j++) do[0][j] = j;
      |        ~^~~
      |         )
a.cc:14:9: error: expected ';' before 'int'
   14 |     for(int j = 0; j < T + 1; j++) do[0][j] = j;
      |         ^~~
      |         ;
a.cc:14:34: error: expected ';' before ')' token
   14 |     for(int j = 0; j < T + 1; j++) do[0][j] = j;
      |                                  ^
      |                                  ;
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

//! [Sのi文字目][Tのj文字目]
int dp[1005][1005];

int main()
{
	string S, T;
	cin >> S >> T;
	REP(i, S.length())
	{
		dp[i][0] = i;
	}
	REP(i, T.length())
	{
		dp[0][i] = i;
	}
	FOR(i, S.length() + 1, 1)
	{
		FOR(j, T.length() + 1, 1)
		{
			int cost = 0;
			if (S[i - 1] != T[j - 1])cost = 1;
			dp[i][j] = std::min(dp[i - 1][j] + 1,
				dp[i][j - 1] + 1,
				dp[i - 1][j - 1] + cost);
		}
	}
	cout << dp[S.length()][T.length()] << endl;
	return 0;
}


Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:49:23:   required from here
   49 |                         dp[i][j] = std::min(dp[i - 1][j] + 1,
      |                                    ~~~~~~~~^~~~~~~~~~~~~~~~~~
   50 |                                 dp[i][j - 1] + 1,
      |                                 ~~~~~~~~~~~~~~~~~
   51 |                                 dp[i - 1][j - 1] + cost);
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

signed main(){
	string s1,s2; cin>>s1>>s2;
	
	int n=s1.length(),m=s2.length();
	vector<vector<int> > dp(n+1,vector<int>(m+1,INF));
	for(int i=0; i<=n; i++) dp[i][0]=i;
	for(int i=0; i<=m; i++) dp[0][i]=i;
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			dp[i][j]=min(dp[i][j],dp[i-1][j]+1);
			dp[i][j]=min(dp[i][j],dp[i][j-1]+1);
			dp[i][j]=min(dp[i][j],dp[i-1][j-1]+(s1[i-1]!=s2[j-1]));
		}
	}
	cout<<dp[n][m]<<en;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:2:9: error: 'string' was not declared in this scope
    2 |         string s1,s2; cin>>s1>>s2;
      |         ^~~~~~
a.cc:2:23: error: 'cin' was not declared in this scope
    2 |         string s1,s2; cin>>s1>>s2;
      |                       ^~~
a.cc:2:28: error: 's1' was not declared in this scope
    2 |         string s1,s2; cin>>s1>>s2;
      |                            ^~
a.cc:2:32: error: 's2' was not declared in this scope
    2 |         string s1,s2; cin>>s1>>s2;
      |                                ^~
a.cc:5:9: error: 'vector' was not declared in this scope
    5 |         vector<vector<int> > dp(n+1,vector<int>(m+1,INF));
      |         ^~~~~~
a.cc:5:23: error: expected primary-expression before 'int'
    5 |         vector<vector<int> > dp(n+1,vector<int>(m+1,INF));
      |                       ^~~
a.cc:6:33: error: 'dp' was not declared in this scope
    6 |         for(int i=0; i<=n; i++) dp[i][0]=i;
      |                                 ^~
a.cc:7:25: error: 'm' was not declared in this scope
    7 |         for(int i=0; i<=m; i++) dp[0][i]=i;
      |                         ^
a.cc:7:33: error: 'dp' was not declared in this scope
    7 |         for(int i=0; i<=m; i++) dp[0][i]=i;
      |                                 ^~
a.cc:9:33: error: 'm' was not declared in this scope
    9 |                 for(int j=1; j<=m; j++){
      |                                 ^
a.cc:10:25: error: 'dp' was not declared in this scope
   10 |                         dp[i][j]=min(dp[i][j],dp[i-1][j]+1);
      |                         ^~
a.cc:10:34: error: 'min' was not declared in this scope; did you mean 'main'?
   10 |                         dp[i][j]=min(dp[i][j],dp[i-1][j]+1);
      |                                  ^~~
      |                                  main
a.cc:15:9: error: 'cout' was not declared in this scope
   15 |         cout<<dp[n][m]<<en;
      |         ^~~~
a.cc:15:15: error: 'dp' was not declared in this scope
   15 |         cout<<dp[n][m]<<en;
      |               ^~
a.cc:15:21: error: 'm' was not declared in this scope
   15 |         cout<<dp[n][m]<<en;
      |                     ^
a.cc:15:25: error: 'en' was not declared in this scope; did you mean 'n'?
   15 |         cout<<dp[n][m]<<en;
      |                         ^~
      |                         n
Language: C++

#include <bits/stdc++.h>
using namespace std;


int main() {
  string A, B; cin >> A >> B;
  vector<vector<int>> Dist(A.length()+1, vector<int>(B.length(),0));
  for (int i=0; i<=A.length(); i++) Dist[i][0] = i;
  for (int i=0; i<=B.length(); i++) Dist[0][i] = i;
  for (int i=0; i<A.length(); i++) {
    for (int j=0; j<B.length(); j++) {
      Dist[i+1][j+1]= min({Dist[i+1][j]+1,Dist[i][j+1]+1,Dist[i][j]+A[i]!=B[j]});
    }
  }
  cout << Dist[A.length()][B.length()] << "\n";
}
  



Compiler output:
a.cc: In function 'int main()':
a.cc:12:26: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   12 |       Dist[i+1][j+1]= min({Dist[i+1][j]+1,Dist[i][j+1]+1,Dist[i][j]+A[i]!=B[j]});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
a.cc:12:26: note:   deduced conflicting types for parameter '_Tp' ('int' and 'bool')
   12 |       Dist[i+1][j+1]= min({Dist[i+1][j]+1,Dist[i][j+1]+1,Dist[i][j]+A[i]!=B[j]});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

#include <iostream>
#include <string>
using namespace std;

int DP[1010][1010];

int main() {
  int n;
  cin >> n;
  for (auto t=0; t<n; t++) {
    string A, B;
    cin >> A >> B;
    int LA = (int) A.size();
    int LB = (int) B.size();
    fill(&DP[0][0], &DP[0][0]+1010*1010, 0);
    for (auto i=-1; i<LA; i++) {
      for (auto j=-1; j<LB; j++) {
        if (i == -1) {
          DP[i+1][j+1] = j;
        } else if (j == -1) {
          DP[i+1][j+1] = i;
        } else if (A[i] == B[j]) {
          DP[i+1][j+1] = DP[i][j];
        } else {
          // A[i] と B[j] が異なるならば、
          // B[j]を挿入するか、A[i]を削除するか、A[i]をB[j]に置換するか
          // のどれかは必ず実行しなくてはならない。
          // 残りの編集作業回数は、それぞれDP[i+1][j]、DP[i][j+1]、DP[i][j]
          // となる。それぞれが最善である例をつくることができる。
          DP[i+1][j+1] = min(DP[i+1][j], DP[i][j+1], DP[i][j]) + 1;
        }
      }
    }
    cout << DP[LA][LB] << endl;
  }
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:30:29:   required from here
   30 |           DP[i+1][j+1] = min(DP[i+1][j], DP[i][j+1], DP[i][j]) + 1;
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#define LEN 1000
#define NIL -1
using namespace std;

char s1[LEN+1],s2[LEN+1];
int L1,L2;
int memo[LEN+2][LEN+2];//[s1][s2]

int rec(int n1,int n2){
	if(memo[n1][n2] != NIL)return memo[n1][n2];

	if(n1 == 0){memo[n1][n2] = n2;return memo[n1][n2];}
	if(n2 == 0){memo[n1][n2] = n1;return memo[n1][n2];}
	if(s1[n1] == s2[n2]){memo[n1][n2] = rec(n1-1,n2-1);return memo[n1][n2];}
	if(n1 == n2){memo[n1][n2] = min(rec(n1.n2-1),rec(n1-1,n2)) + 1;return memo[n1][n2];}
	if(n1 > n2){memo[n1][n2] = rec(n1-1,n2) + 1;return memo[n1][n2];}
	if(n1 < n2){memo[n1][n2] = rec(n1,n2-1) + 1;return memo[n1][n2];}
}

void solve(){
	for(int i = 0;i <= L1;i++)
		for(int j = 0;j <= L2;j++)memo[i][j] = NIL;
	int ans;
	ans = rec(L1,L2);
	printf("%d\n",ans);
	return;
}

int main() {
	scanf("%s",&s1);
	scanf("%s",&s2);
	for(int i = 0;s1[i] != NULL;i++)
		if(s1[i+1] == NULL)L1 = i+1;
	for(int i = 0;i < L1;i++)
		s1[L1-i] = s1[L1-1-i];
	for(int i = 0;s2[i] != NULL;i++)
		if(s2[i+1] == NULL)L2 = i+1;
	for(int i = 0;i < L2;i++)
		s2[L2-i] = s2[L2-1-i];
	//cout <<L1 <<" " <<L2 <<endl;

	solve();

    return 0;
}

Compiler output:
a.cc: In function 'int rec(int, int)':
a.cc:20:48: error: request for member 'n2' in 'n1', which is of non-class type 'int'
   20 |         if(n1 == n2){memo[n1][n2] = min(rec(n1.n2-1),rec(n1-1,n2)) + 1;return memo[n1][n2];}
      |                                                ^~
a.cc: In function 'int main()':
a.cc:37:32: warning: NULL used in arithmetic [-Wpointer-arith]
   37 |         for(int i = 0;s1[i] != NULL;i++)
      |                                ^~~~
a.cc:38:31: warning: NULL used in arithmetic [-Wpointer-arith]
   38 |                 if(s1[i+1] == NULL)L1 = i+1;
      |                               ^~~~
a.cc:41:32: warning: NULL used in arithmetic [-Wpointer-arith]
   41 |         for(int i = 0;s2[i] != NULL;i++)
      |                                ^~~~
a.cc:42:31: warning: NULL used in arithmetic [-Wpointer-arith]
   42 |                 if(s2[i+1] == NULL)L2 = i+1;
      |                               ^~~~
a.cc: In function 'int rec(int, int)':
a.cc:23:1: warning: control reaches end of non-void function [-Wreturn-type]
   23 | }
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#define INF (1e12+1)
using namespace std;

int dp[1001][1001];

int main()
{
	memset(dp, INF,sizeof(dp));
	string s1, s2;
	cin >> s1 >> s2;
	int s1size = s1.size(), s2size = s2.size();
	for (int i = 0; i < s1size + 1; ++i) {
		for (int j = 0; j < s2size + 1; ++j) {
			if (j == 0) {
				dp[i][0] = i;
				continue;
			}
			if (i == 0) {
				dp[0][j] = j;
				continue;
			}
			dp[i][j] = min(min(dp[i - 1][j - 1], dp[i][j - 1]), dp[i - 1][j]) +((s1[i] == s2[j])^1);
		}
	}
	cout << dp[s1size][s2size] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'memset' was not declared in this scope
   11 |         memset(dp, INF,sizeof(dp));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<algorithm>
  +++ |+#include <cstring>
    3 | #include<string>
Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#define INF (1ULL<<20)
using namespace std;
 
int dp[1001][1001];
 
int main()
{
    fill(dp[0], dp[1000],INF);
    string s1, s2;
    cin >> s1 >> s2;
    int s1size = s1.size()+1, s2size = s2.size()+1;
    for(int i=0;i<s1size;++i){
        dp[i][0]=i;
    }
    for(int j=0;j<s2size;++i){
        dp[0][j]=j;
    }
    for (int i = 1; i < s1size; ++i) {
        for (int j = 1; j < s2size; ++j) {

            dp[i][j] = min(min(dp[i - 1][j - 1] + (s1[i - 1] != s2[j - 1]), dp[i][j - 1] + 1), dp[i - 1][j] + 1);
        }
    }
    cout << dp[s1size-1][s2size-1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:28: error: 'i' was not declared in this scope
   18 |     for(int j=0;j<s2size;++i){
      |                            ^
Language: C++


#include<iostream>
#include<cstring>
using namespace std;
char s1[1010],s2[1010]; // two words, s1 & s2 
int dis[1010][1010]; // array for the Levenshtein distance

int main(){
  cin>> s1 >> s2;
 
  int m=strlen(s1);
  int n=strlen(s2);

  for(int j=1;j<=m;j++){
    dis[j][0]=j;
  }
  for(int j=1;j<=n;j++){
    dis[0][j]=j;
  }
  for(int j=1;j<=m;j++){
    for(int k=1;k<=n;k++){
      dis[j][k] = min(
		      dis[j-1][k]+1,
		      dis[j][k-1]+1, 
		      (s1[j-1]==s2[k-1] ? dis[j-1][k-1] : dis[j-1][k-1] + 1)); // comparing letters of the two words; +1 if different at respective location
    }
  }
  cout<<dis[m][n]<<endl;
  return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:22:22:   required from here
   22 |       dis[j][k] = min(
      |                   ~~~^
   23 |                       dis[j-1][k]+1,
      |                       ~~~~~~~~~~~~~~
   24 |                       dis[j][k-1]+1,
      |                       ~~~~~~~~~~~~~~
   25 |                       (s1[j-1]==s2[k-1] ? dis[j-1][k-1] : dis[j-1][k-1] + 1)); // comparing letters of the two words; +1 if different at respective location
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

char S[2][2000];
int length[2];//length[a] == b ?????? S[a][b] == *""
int changed = 0;
int dp[1500][1500];

int main()
{
	cin >> S[0];
	cin >> S[1];

	for (int a = 0; a < 1000; a++)
	{
		if (S[0][a] == 0)
		{
			length[0] = a;
			break;
		}
	}

	length[0] = strlen(S[0]);
	length[1] = strlen(S[1]);

	for (int a = 0; a < 1000; a++)
	{
		if (S[1][a] == 0)
		{
			length[1] = a;
			break;
		}
	}

	for (int a = 0; a < length[0]+1; a++)
	{
		dp[0][a] = a;
	}
	for (int a = 0; a < length[1]+1; a++)
	{
		dp[a][0] = a;
	}

	for (int a = 1; a < length[0]+1; a++)
	{
		for (int b = 1; b < length[1]+1; b++)
		{
			if (S[0][a-1] == S[1][b-1])
			{
				dp[b][a] = min(dp[b - 1][a - 1], min(dp[b - 1][a] + 1, dp[b][a - 1] + 1));
			}
			else
			{
				dp[b][a] = min(dp[b - 1][a - 1], min(dp[b - 1][a], dp[b][a - 1])) + 1;
			}
		}
	}

	cout << dp[length[1]][length[0]] << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:21: error: 'strlen' was not declared in this scope
   25 |         length[0] = strlen(S[0]);
      |                     ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<algorithm>
  +++ |+#include <cstring>
    3 |
Language: C++

//distanta levenshtein???#include <iostream> #include <string.h>using namespace std;int main(){char a[100], b[100];int s[100][100];cin.getline(a, 100);cin.getline(b, 100);int n = strlen(a);int m = strlen(b);for(int i=0; i<=n; i++){for(int j=0; j<=m; j++)s[0][j] = j;s[i][0] = i;}for(int i=1; i<=n; i++){for(int j=1; j<=m; j++)if(a[i]==b[j]) s[i][j] = s[i-1][j-1];else s[i][j] = min(min(s[i-1][j], s[i-1][j-1]), s[i][j-1]) + 1;}/* for(int i=0; i<=n; i++){for(int j=0; j<=m; j++)cout<<s[i][j]<<" ";cout<<endl;}*/cout<<s[n][m];return 0;}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
	string s1, s2;
	cin >> s1 >> s2;
	int a[1010][1010] = {};
	int m = s1.size();
	int n = s2.size();
	for (int i = 0; i <= m; i++){
		for (int j = 0; j <= n; j++){
			if (i == 0 && j == 0) a[i][j] = 0;
			else if (i == 0) a[i][j] = a[i][j - 1];
			else if (j == 0) a[i][j] = a[i - 1][j];
			else if (s1[i] == s2[j])a[i][j] = min(a[i - 1][j - 1], a[i][j - 1] + 1, a[i - 1][j] + 1);
			else a[i][j] = min(a[i][j - 1] + 1, a[i - 1][j] + 1);
		}
	}
	cout << a[s1.size()][s2.size()];
	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:19:41:   required from here
   19 |                         else if (s1[i] == s2[j])a[i][j] = min(a[i - 1][j - 1], a[i][j - 1] + 1, a[i - 1][j] + 1);
      |                                                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
	string s1, s2;
	cin >> s1 >> s2;
	int a[1010][1010] = {};
	int m = s1.size();
	int n = s2.size();
	for (int i = 0; i <= m; i++){
		for (int j = 0; j <= n; j++){
			if (i == 0 && j == 0) a[i][j] = 0;
			else if (i == 0) a[i][j] = a[i][j - 1];
			else if (j == 0) a[i][j] = a[i - 1][j];
			else if (s1[i] == s2[j])a[i][j] = min(a[i - 1][j - 1], a[i][j - 1] + 1, a[i - 1][j] + 1);
			else a[i][j] = min(a[i][j - 1] + 1, a[i - 1][j] + 1);
		}
	}
	cout << a[m][n];
	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:19:41:   required from here
   19 |                         else if (s1[i] == s2[j])a[i][j] = min(a[i - 1][j - 1], a[i][j - 1] + 1, a[i - 1][j] + 1);
      |                                                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
	string s, t;
	cin >> s >> t;
	int a[1010][1010] = {};
	int m = s.size();
	int n = t.size();
	for (int i = 0; i < m; i++){
		for (int j = 0; j < n; j++){
			if (i == 0 && j == 0) a[i][j] = 0;
			else if (i == 0) a[i][j] = a[i][j - 1] + 1;
			else if (j == 0) a[i][j] = a[i - 1][j] + 1;
			else if (s1[i] == s2[j])a[i][j] = min(a[i - 1][j - 1], a[i][j - 1] + 1, a[i - 1][j] + 1);
			else a[i][j] = min(a[i][j - 1] + 1, a[i - 1][j] + 1);
		}
	}
	cout << a[m][n];
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:34: error: 's1' was not declared in this scope; did you mean 's'?
   18 |                         else if (s1[i] == s2[j])a[i][j] = min(a[i - 1][j - 1], a[i][j - 1] + 1, a[i - 1][j] + 1);
      |                                  ^~
      |                                  s
a.cc:18:43: error: 's2' was not declared in this scope; did you mean 's'?
   18 |                         else if (s1[i] == s2[j])a[i][j] = min(a[i - 1][j - 1], a[i][j - 1] + 1, a[i - 1][j] + 1);
      |                                           ^~
      |                                           s
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:18:41:   required from here
   18 |                         else if (s1[i] == s2[j])a[i][j] = min(a[i - 1][j - 1], a[i][j - 1] + 1, a[i - 1][j] + 1);
      |                                                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
	string s, t;
	cin >> s >> t;
	int a[1010][1010] = {};
	int m = s.size();
	int n = t.size();
	for (int i = 0; i < m; i++){
		for (int j = 0; j < n; j++){
			if (i == 0 && j == 0) a[i][j] = 0;
			else if (i == 0) a[i][j] = a[i][j - 1] + 1;
			else if (j == 0) a[i][j] = a[i - 1][j] + 1;
			else if (s[i] == t[j])a[i][j] = min(a[i - 1][j - 1], a[i][j - 1] + 1, a[i - 1][j] + 1);
			else a[i][j] = min(a[i][j - 1] + 1, a[i - 1][j] + 1);
		}
	}
	cout << a[m][n];
	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:18:39:   required from here
   18 |                         else if (s[i] == t[j])a[i][j] = min(a[i - 1][j - 1], a[i][j - 1] + 1, a[i - 1][j] + 1);
      |                                                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
	string b, c;
	int m, n;
	cin >> b >> c;
	int a[1010][1010] = {};
	m = b.size();
	n = c.size();
	for (int i = 0; i <= m; i++){
		for (int j = 0; j <= n; j++){
			if (i == 0 && j == 0) a[i][j] = 0;
			else if (i == 0) a[i][j] = a[i][j - 1] + 1;
			else if (j == 0) a[i][j] = a[i - 1][j] + 1;
			else if (b[i] == c[j])a[i][j] = min(a[i - 1][j - 1], a[i][j - 1] + 1, a[i - 1][j] + 1);
			else a[i][j] = min(a[i][j - 1] + 1, a[i - 1][j] + 1);
		}
	}
	cout << a[m][n];
	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:19:39:   required from here
   19 |                         else if (b[i] == c[j])a[i][j] = min(a[i - 1][j - 1], a[i][j - 1] + 1, a[i - 1][j] + 1);
      |                                                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

include<bits/stdc++.h>

using namespace std;

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_E

int LevenshteinDistance(string s1,string s2) {
  int n = (int)s1.size(), m = (int)s2.size();
  vector<vector<int> > dp(n+1,vector<int>(m+1));
  for(int i=0;i<=n;++i) dp[i][0] = i;
  for(int i=0;i<=m;++i) dp[0][i] = i;
  for(int i=1;i<=n;++i) {
    for(int j=1;j<=m;++j) {
      dp[i][j] = min(dp[i-1][j]+1,
                     min(dp[i][j-1]+1,dp[i-1][j-1]+(s1[i-1]!=s2[j-1])));
    }
  }
  return dp[n][m];
}

int main() {
  string s1,s2;
  getline(cin,s1);
  getline(cin,s2);
  cout << LevenshteinDistance(s1,s2) << endl;
  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc:7:25: error: 'string' was not declared in this scope
    7 | int LevenshteinDistance(string s1,string s2) {
      |                         ^~~~~~
a.cc:7:35: error: 'string' was not declared in this scope
    7 | int LevenshteinDistance(string s1,string s2) {
      |                                   ^~~~~~
a.cc:7:44: error: expression list treated as compound expression in initializer [-fpermissive]
    7 | int LevenshteinDistance(string s1,string s2) {
      |                                            ^
a.cc: In function 'int main()':
a.cc:22:3: error: 'string' was not declared in this scope
   22 |   string s1,s2;
      |   ^~~~~~
a.cc:23:11: error: 'cin' was not declared in this scope
   23 |   getline(cin,s1);
      |           ^~~
a.cc:23:15: error: 's1' was not declared in this scope
   23 |   getline(cin,s1);
      |               ^~
a.cc:23:3: error: 'getline' was not declared in this scope
   23 |   getline(cin,s1);
      |   ^~~~~~~
a.cc:24:15: error: 's2' was not declared in this scope
   24 |   getline(cin,s2);
      |               ^~
a.cc:25:3: error: 'cout' was not declared in this scope
   25 |   cout << LevenshteinDistance(s1,s2) << endl;
      |   ^~~~
a.cc:25:30: error: 'LevenshteinDistance' cannot be used as a function
   25 |   cout << LevenshteinDistance(s1,s2) << endl;
      |           ~~~~~~~~~~~~~~~~~~~^~~~~~~
a.cc:25:41: error: 'endl' was not declared in this scope
   25 |   cout << LevenshteinDistance(s1,s2) << endl;
      |                                         ^~~~
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){
    string s1,s2;
    cin >> s1;
    cin >> s2;
    int arr[s1.length()][s2.length()];
    
    
    int q;
    cin >> q;
    for(int k = 0; k < q; k++){
        string s1, s2;
        cin >> s1;
        cin >> s2;
        int arr[s1.length()+1][s2.length()+1];
        for(int i = 0; i <= s1.length(); i++){
            for(int j = 0; j <= s2.length(); j++){
                if(i == 0 || j == 0){
                    arr[i][j] = 0;
                }else{
                    if(s1[i-1] == s2[j-1])
                        arr[i][j] = arr[i-1][j-1] + 1;
                    else
                        arr[i][j] = max(arr[i-1][j],arr[i][j-1]);
                }
            }
        }
        //debug
        /*
         for(int j = 0; j <= s2.length(); j++){
         for(int i = 0; i <= s1.length(); i++){
         cout << arr[i][j];
         }
         cout << endl;
         }
         */
        int ans = max(s1.length(),s2.length())-arr[s1.length()][s2.length()];
        cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:2: error: expected '}' at end of input
   42 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){
/*
    string s1,s2;
    cin >> s1;
    cin >> s2;
    int arr[s1.length()][s2.length()];
   */ 
    
    int q;
    cin >> q;
    for(int k = 0; k < q; k++){
        string s1, s2;
        cin >> s1;
        cin >> s2;
        int arr[s1.length()+1][s2.length()+1];
        for(int i = 0; i <= s1.length(); i++){
            for(int j = 0; j <= s2.length(); j++){
                if(i == 0 || j == 0){
                    arr[i][j] = 0;
                }else{
                    if(s1[i-1] == s2[j-1])
                        arr[i][j] = arr[i-1][j-1] + 1;
                    else
                        arr[i][j] = max(arr[i-1][j],arr[i][j-1]);
                }
            }
        }
        //debug
        /*
         for(int j = 0; j <= s2.length(); j++){
         for(int i = 0; i <= s1.length(); i++){
         cout << arr[i][j];
         }
         cout << endl;
         }
         */
        int ans = max(s1.length(),s2.length()) - arr[s1.length()][s2.length()];
        cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:2: error: expected '}' at end of input
   43 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){

    int q;
    cin >> q;
    for(int k = 0; k < q; k++){
        string s1, s2;
        cin >> s1;
        cin >> s2;
        int arr[s1.length()+1][s2.length()+1];
        for(int i = 0; i <= s1.length(); i++){
            for(int j = 0; j <= s2.length(); j++){
                if(i == 0 || j == 0){
                    arr[i][j] = 0;
                }else{
                    if(s1[i-1] == s2[j-1])
                        arr[i][j] = arr[i-1][j-1] + 1;
                    else
                        arr[i][j] = max(arr[i-1][j],arr[i][j-1]);
                }
            }
        }

        int ans = max(s1.length(),s2.length()) - arr[s1.length()][s2.length()];
        cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:2: error: expected '}' at end of input
   29 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

#define vint(v, n) vector<int> v(n); REP(i,n) cin >> v[i];
#define vvint(v, w, n) vector<int> v(n); vector<int> w(n); REP(i,n) cin >> v[i] >> w[i];
#define vlint(v, n) vector<ll int> v(n); REP(i,n) cin >> v[i];
#define vdouble(v, n) vector<double> v(n); REP(i,n) cin >> v[i];
#define vvdoube(v, n1, n2) vector<vector<double> > v(n1, vector<double>(n2, 0)); REP(i,n1) REP(j,n1) cin >> v[i][j];
#define string(x) string x; cin >> x;
#define vstring(v, n) vector<string> v(n); REP(i,n){string a; std::cin >> a; v.push_back(a); }

#define all(v) (v).begin(), (v).end()
#define rall(v) (v).begin(), (v).end(), std::greater<int>()
#define len(v) (v).length()
#define FIND(s, n) (s.find(n) != s.end())
#define SORT(a) sort(all(a))

static const string abet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
static const long long int MOD = 1000000007;
static const double PI=3.1415926535897932;
static const int INF = 0x3f3f3f3f;
static const int INFTY = (1 << 29);
static const long long LINFTY = (1LL << 32);

static const int dy4[]={0, 0, 1, -1};
static const int dx4[]={1, -1, 0, 0};
static const int dx8[] = {1, 1, 1, 0, 0, -1, -1, -1};
static const int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1};


int levenshtein_distance(string s1, string s2) {

    vector<vector<int> > dp(s1.length() + 1, vector<int>(s2.length() + 1));

    REP(i, s1.length()+1) REP(j, s2.length()+1){
      if(i == 0) dp[i][j] = j;
      else if (j == 0) dp[i][j] = i;
      else p[i][j] = min({dp[i][j - 1] + 1, dp[i - 1][j] + 1, dp[i - 1][j - 1] + (s1[i - 1] != s2[j - 1])});
    }
    return dp[s1.size()][s2.size()];
}

string s, t;
int main() {
    cin >> s >> t;
    cout << levenshtein_distance(s, t) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int levenshtein_distance(std::string, std::string)':
a.cc:50:12: error: 'p' was not declared in this scope
   50 |       else p[i][j] = min({dp[i][j - 1] + 1, dp[i - 1][j] + 1, dp[i - 1][j - 1] + (s1[i - 1] != s2[j - 1])});
      |            ^
Language: C++

#include <iostream>
#include <algorithm>

constexpr int MAX = 1010;

int levenshtein_distance(char* s, char* t,
                         int incost = 1, int rmcost = 1, int recost = 1)
{
    int N = strlen(s), M = strlen(t);
    int dp[N + 1][M + 1];

    for (int i = 0; i <= N; i++) {
        dp[i][0] = i * incost;
    }
    
    for (int i = 0; i <= M; i++) {
        dp[0][i] = i * rmcost;
    }
    
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= M; j++) {
            int rcost = (s[i - 1] == t[j - 1] ? 0 : recost);
            dp[i][j] = std::min(dp[i - 1][j] + incost,
                       std::min(dp[i][j - 1] + rmcost, dp[i - 1][j - 1] + rcost));
        }
    }
    return dp[N][M];
}

int main()
{
    char s[MAX], t[MAX];
    std::cin >> s >> t;
    std::cout << levenshtein_distance(s, t) << std::endl;
    return 0;
}

Compiler output:
a.cc: In function 'int levenshtein_distance(char*, char*, int, int, int)':
a.cc:9:13: error: 'strlen' was not declared in this scope
    9 |     int N = strlen(s), M = strlen(t);
      |             ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <algorithm>
  +++ |+#include <cstring>
    3 | 
a.cc:10:19: error: 'M' was not declared in this scope
   10 |     int dp[N + 1][M + 1];
      |                   ^
a.cc:13:9: error: 'dp' was not declared in this scope
   13 |         dp[i][0] = i * incost;
      |         ^~
a.cc:17:9: error: 'dp' was not declared in this scope
   17 |         dp[0][i] = i * rmcost;
      |         ^~
a.cc:23:13: error: 'dp' was not declared in this scope
   23 |             dp[i][j] = std::min(dp[i - 1][j] + incost,
      |             ^~
a.cc:27:12: error: 'dp' was not declared in this scope
   27 |     return dp[N][M];
      |            ^~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
typedef long long ll;

template <class S> int LevenshteinDistance(const S &A, const S &B) {
   vector< vector<int> > dist(A.size()+1,vector<int>(B.size()+1));
   for (int i = 0; i <= A.size(); i++) dist[i][0] = i;
   for (int i = 0; i <= B.size(); i++) dist[0][i] = i;
   for (int i = 0; i < A.size(); i++) {
      for (int j = 0; j < B.size(); j++) {
         dist[i+1][j+1] = min(dist[i][j+1], dist[i+1][j]) + 1;
         dist[i+1][j+1] = min(dist[i+1][j+1], dist[i][j] + (A[i]!=B[j]));
      }
   }
   return dp[A.size()][B.size()];
}

int main() {

  string A,B; cin >> A >> B;

  cout << LevenshteinDistance(A,B) << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int LevenshteinDistance(const S&, const S&)':
a.cc:29:11: error: 'dp' was not declared in this scope
   29 |    return dp[A.size()][B.size()];
      |           ^~
Language: C++

/**
 * Combinatorial - Edit Distance (Levenshtein Distance)
 */

#include <iostream>

using namespace std;

int main() {

    string s1, s2;
    int len1, len2;

    cin >> s1 >> s2;
    len1 = (int) s1.length();
    len2 = (int) s2.length();

    int dp[len1 + 1][len2 + 1];

    dp[0][0] = 0;
    for (int i = 1; i <= len1; i++) dp[i][0] = i;
    for (int i = 1; i <= len2; i++) dp[0][i] = i;

    for (int i = 1; i <= len1; i++) {
        for (int j = 1; j <= len2; j++) {
            dp[i][j] = min({
                                   dp[i - 1][j] + 1,//??????
                                   dp[i][j - 1] + 1,//??????
                                   dp[i - 1][j - 1] + (s1[i - 1] == s2[j - 1] ? 0 : 1),//??????
                           });
        }
    }

    cout << dp[len1][len2] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:27: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   26 |             dp[i][j] = min({
      |                        ~~~^~
   27 |                                    dp[i - 1][j] + 1,//??????
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~
   28 |                                    dp[i][j - 1] + 1,//??????
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~
   29 |                                    dp[i - 1][j - 1] + (s1[i - 1] == s2[j - 1] ? 0 : 1),//??????
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   30 |                            });
      |                            ~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include<iostream>
#include<algorithm>
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
using namespace std;
int dp[1010][1010];
int main(){
	string a,b;cin>>a>>b;
	REP(i,a.size()+1)dp[i][0]=i;
	REP(i,b.size()+1)dp[0][i]=i;	
	for(int i=1;i<=a.size();i++){
		for(int j=1;j<=b.size();j++){
			int q=1;if(a[i-1]==b[j-1])q = 0;
			dp[i][j]=min(min(dp[i-1][j-1]+q,dp[i][j-1]+1),dp[i-1][j]+1);
		}
	}	
	cout<<(LS(a,b),dp[a.size()][b.size()])<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: 'LS' was not declared in this scope
   16 |         cout<<(LS(a,b),dp[a.size()][b.size()])<<endl;
      |                ^~