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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long ll;
const long long INF = 1e17;

int main() {
  ll H,W;
  cin>>H>>W;
  vector<vector<ll>> a(H,vector<ll>(W));
  vector<vector<ll>> b(H,vector<ll>(W));
  vector<vector<ll>> c(H,vector<ll>(W));
  rep(i,H)rep(j,W) cin>>a[i][j];
  rep(i,H)rep(j,W) cin>>b[i][j];
  rep(i,H)rep(j,W) c[i][j]=a[i][j]+b[i][j];
  vector<vector<vector<bool>>> dp1(H,vector<vector<bool>>(W,vector<bool>(82*(H+W),false)));
  vector<vector<vector<bool>>> dp2(H,vector<vector<bool>>(W,vector<bool>(82*(H+W),false)));
  dp1[0][0][0]=true;
  rep(i,H)rep(j,W)rep(k,82*(H+W)){
    
    if (i<H-1 && dp1[i][j][k]){
      if (k+c[i][j]<0){
        dp2[i+1][j][-(k+c[i][j])]=true;
      }else{
        dp1[i+1][j][k+c[i][j]]=true;
      }
    }
    if (i<H-1 && dp2[i][j][k]){
      if (-k+c[i][j]<0){
        dp2[i+1][j][-(-k+c[i][j])]=true;
      }else{
        dp1[i+1][j][-k+c[i][j]]=true;
      }
    }
    if (j<W-1 && dp1[i][j][k]){
      if (k+c[i][j]<0){
        dp2[i][j+1][-(k+c[i][j])]=true;
      }else{
        dp1[i][j+1][k+c[i][j]]=true;
      }
    }
    if (j<W-1 && dp2[i][j][k]){
      if (-k+c[i][j]<0){
        dp2[i][j+1][-(-k+c[i][j])]=true;
      }else{
        dp2[i][j+1][-k+c[i][j]]=true;
      }
    }
  }
  ll ans=INF;
  rep(i,82*(H+W)){
    if (dp1[H-1][W-1][i]) ans=i<ans ? i < ans;
    if (dp2[H-1][W-1][i]) ans=i<ans ? i < ans;
  }
  cout<<ans<<endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:46: error: expected ':' before ';' token
   52 |     if (dp1[H-1][W-1][i]) ans=i<ans ? i < ans;
      |                                              ^
      |                                              :
a.cc:52:46: error: expected primary-expression before ';' token
a.cc:53:46: error: expected ':' before ';' token
   53 |     if (dp2[H-1][W-1][i]) ans=i<ans ? i < ans;
      |                                              ^
      |                                              :
a.cc:53:46: error: expected primary-expression before ';' token
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long ll;
const long long INF = 1e17;

int main() {
  ll H,W;
  cin>>H>>W;
  vector<vector<ll>> a(H,vector<ll>(W));
  vector<vector<ll>> b(H,vector<ll>(W));
  vector<vector<ll>> c(H,vector<ll>(W));
  rep(i,H)rep(j,W) cin>>a[i][j];
  rep(i,H)rep(j,W) cin>>b[i][j];
  rep(i,H)rep(j,W) c[i][j]=a[i][j]+b[i][j];
  vector<vector<vector<bool>>> dp1(H,vector<vector<bool>>(W,vector<bool>(82*(H+W),false)));
  vector<vector<vector<bool>>> dp2(H,vector<vector<bool>>(W,vector<bool>(82*(H+W),false)));
  dp1[0][0][0]=true;
  rep(i,H)rep(j,W)rep(k,82*(H+W)){
    
    if (i<H-1 && dp1[i][j][k]){
      if (k+c[i][j]<0){
        dp2[i+1][j][-(k+c[i][j])]=true;
      }else{
        dp1[i+1][j][k+c[i][j]]=true;
      }
    }
    if (i<H-1 && dp2[i][j][k]){
      if (-k+c[i][j]<0){
        dp2[i+1][j][-(-k+c[i][j])]=true;
      }else{
        dp1[i+1][j][-k+c[i][j]]=true;
      }
    }
    if (j<W-1 && dp1[i][j][k]){
      if (k+c[i][j]<0){
        dp2[i][j+1][-(k+c[i][j])]=true;
      }else{
        dp1[i][j+1][k+c[i][j]]=true;
      }
    }
    if (j<W-1 && dp2[i][j][k]){
      if (-k+c[i][j]<0){
        dp2[i][j+1][-(-k+c[i][j])]=true;
      }else{
        dp2[i][j+1][-k+c[i][j]]=true;
      }
    }
  }
  ll ans=INF
  rep(i,82*(H+W)){
    if (dp1[H-1][W-1][i]) ans=i<ans ? i < ans;
    if (dp2[H-1][W-1][i]) ans=i<ans ? i < ans;
  }
  cout<<ans<<endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:18: error: expected ',' or ';' before 'for'
    3 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                  ^~~
a.cc:51:3: note: in expansion of macro 'rep'
   51 |   rep(i,82*(H+W)){
      |   ^~~
a.cc:51:7: error: 'i' was not declared in this scope
   51 |   rep(i,82*(H+W)){
      |       ^
a.cc:3:34: note: in definition of macro 'rep'
    3 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                                  ^
Language: C++

#include <iostream>
#include <stdio.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(void){
    int H, W;
    int A[81][81],B[81][81];
    cin >> H >> W;
    rep(i,H){
        rep(j,W){
            cin >> A[i][j];
        }
    }
    rep(i,H){
        rep(j,W){
            cin >> B[i][j];
        }
    }
    
    bool dp[80][80][81];
    memset(dp,false,sizeof(dp));
    dp[0][0][abs(A[0][0]-B[0][0])] = true;
    rep(i,H){
        rep(j,W){
            rep(k,81){
                if(dp[i][j][k]){
                    if(j<W-1){
                        if(k+abs(A[i][j+1]-B[i][j+1]) < 81)
                        dp[i][j+1][k+abs(A[i][j+1]-B[i][j+1])] = true;
                        if(abs(k-abs(A[i][j+1]-B[i][j+1])) < 81)
                        dp[i][j+1][abs(k-abs(A[i][j+1]-B[i][j+1]))] = true;
                    }
                    
                    if(i<H-1){
                        if(k+abs(A[i+1][j]-B[i+1][j]) < 81)
                        dp[i+1][j][k+abs(A[i+1][j]-B[i+1][j])] = true;
                        if(abs(k-abs(A[i+1][j]-B[i+1][j])) < 81)
                        dp[i+1][j][abs(k-abs(A[i+1][j]-B[i+1][j]))] = true;
                    }
                }
            }
        }
    }
    int min = 100;
    rep(i,80){
        if(dp[H-1][W-1][i]) {
            min = i;
            break;
        }
    }
    cout << min << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'memset' was not declared in this scope
   21 |     memset(dp,false,sizeof(dp));
      |     ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | #include <stdio.h>
Language: C++

#include <iostream>
#include <stdio.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(void){
    int H, W;
    int A[81][81],B[81][81];
    cin >> H >> W;
    rep(i,H){
        rep(j,W){
            cin >> A[i][j];
        }
    }
    rep(i,H){
        rep(j,W){
            cin >> B[i][j];
        }
    }
    
    bool dp[80][80][81];
    memset(dp,false,sizeof(dp));
    dp[0][0][abs(A[0][0]-B[0][0])] = true;
    rep(i,H){
        rep(j,W){
            rep(k,81){
                if(dp[i][j][k]){
                    if(j<W-1){
                        if(k+abs(A[i][j+1]-B[i][j+1]) < 81)
                        dp[i][j+1][k+abs(A[i][j+1]-B[i][j+1])] = true;
                        if(abs(k-abs(A[i][j+1]-B[i][j+1])) < 81)
                        dp[i][j+1][abs(k-abs(A[i][j+1]-B[i][j+1]))] = true;
                    }
                    
                    if(i<H-1){
                        if(k+abs(A[i+1][j]-B[i+1][j]) < 81)
                        dp[i+1][j][k+abs(A[i+1][j]-B[i+1][j])] = true;
                        if(abs(k-abs(A[i+1][j]-B[i+1][j])) < 81)
                        dp[i+1][j][abs(k-abs(A[i+1][j]-B[i+1][j]))] = true;
                    }
                }
            }
        }
    }
    int min = 100;
    rep(i,80){
        if(dp[H-1][W-1][i]) {
            min = i;
            break;
        }
    }
    cout << min << endl;
    /*rep(i,5){
        rep(j,H){
            rep(k,W){
                printf("%2d ",dp[j][k][i]);
            }puts("");
        }puts(""); puts("");
    }*/
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'memset' was not declared in this scope
   21 |     memset(dp,false,sizeof(dp));
      |     ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | #include <stdio.h>
Language: C++

//Compete against Yourself.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 80;

int n, m, a[N][N], b[N][N];
gp_hash_table<int, int> dp[N][N];

void add(int x, int y, int red, int blue){
   if(x-1 >= 0){
      for(auto it: dp[x-1][y]){
         dp[x][y][abs(it.F+(red-blue))] = 1;
         dp[x][y][abs(it.F-(red-blue))] = 1;
      }
   }
   if(y-1 >= 0){
      for(auto it: dp[x][y-1]){
         dp[x][y][abs(it.F+(red-blue))] = 1;
         dp[x][y][abs(it.F-(red-blue))] = 1;
      }
   }
   if(x-1 < 0 and y-1 < 0){
      dp[x][y][abs(red-blue)] = 1;
   }
}


int32_t main(){_

   cin>>n>>m;

   for (int i = 0; i < n; ++i)
   {
      for (int j = 0; j < m; ++j)
      {
         cin >> a[i][j];
      }
   }

   for (int i = 0; i < n; ++i)
   {
      for (int j = 0; j < m; ++j)
      {
         cin >> b[i][j];
      }
   }

   for (int i = 0; i < n; ++i)
   {
      for (int j = 0; j < m; ++j)
      {
         add(i, j, a[i][j], b[i][j]);
      }  
   }
   
   int ans = inf;
   for(auto it: dp[n-1][m-1]){
      smin(ans, it.F);
   }

   cout<<ans;

   return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:73:14: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   73 |    int ans = inf;
      |              ^~~
      |              ynf
Language: C++

#include<cstdio>
#include<bitset>
using namespace std;

int h, w, a[80][80], b[80][80], mid = 6480;
bitset<12960> dp[2][80], temp;
 
int main() {
  scanf("%d%d", &h, &w);
  for (int i = 0; i < h; i++) for (ll j = 0; j < w; j++) scanf("%d", &a[i][j]);
  for (int i = 0; i < h; i++) for (ll j = 0; j < w; j++) scanf("%d", &b[i][j]);
  dp[0][0][mid+a[0][0]-b[0][0]] = true;
  dp[0][0][mid-a[0][0]+b[0][0]] = true;
  for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) if (i + j > 0) {
    if (i == 0) temp = dp[i&1][j-1];
    else if (j == 0) temp = dp[!(i&1)][j];
    else temp = dp[!(i&1)][j] | dp[i&1][j-1];
    ll x = abs(a[i][j]-b[i][j]);
    dp[i&1][j] = (temp >> x) | (temp << x);
  }
  for (int i = 0;; i++) if (dp[!(h&1)][w-1][mid-i] || dp[!(h&1)][w-1][mid+i]) {
    printf("%d\n", i);
    return 0;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:36: error: 'll' was not declared in this scope
   10 |   for (int i = 0; i < h; i++) for (ll j = 0; j < w; j++) scanf("%d", &a[i][j]);
      |                                    ^~
a.cc:10:46: error: 'j' was not declared in this scope
   10 |   for (int i = 0; i < h; i++) for (ll j = 0; j < w; j++) scanf("%d", &a[i][j]);
      |                                              ^
a.cc:11:36: error: 'll' was not declared in this scope
   11 |   for (int i = 0; i < h; i++) for (ll j = 0; j < w; j++) scanf("%d", &b[i][j]);
      |                                    ^~
a.cc:11:46: error: 'j' was not declared in this scope
   11 |   for (int i = 0; i < h; i++) for (ll j = 0; j < w; j++) scanf("%d", &b[i][j]);
      |                                              ^
a.cc:18:5: error: 'll' was not declared in this scope
   18 |     ll x = abs(a[i][j]-b[i][j]);
      |     ^~
a.cc:19:27: error: 'x' was not declared in this scope
   19 |     dp[i&1][j] = (temp >> x) | (temp << x);
      |                           ^
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <map>
#include <set>
#include <vector>
#include <time.h>
#include <stdarg.h>
#include <algorithm>
#include <iostream>

#define ll long long

using namespace std;

int v[88][88];
bitset<25600> dp[88][88];

int
main() {

  int h, w;
  cin>>h>>w;

  for (int i=0; i<h; i++)
    for (int j=0; j<w; j++)
      cin>>v[i][j];

  int temp;
  for (int i=0; i<h; i++)
    for (int j=0; j<w; j++) {
      cin>>temp;
      v[i][j] = abs(v[i][j] - temp);
    }

  dp[0][0][12800+v[0][0]] = 1;
  for (int i=0; i<h; i++)
    for (int j=0; j<w; j++) {
      if (i + 1 < h) 
        dp[i+1][j] |= dp[i][j] << v[i+1][j] | dp[i][j] >> v[i+1][j];
      if (j + 1 < w)
        dp[i][j+1] |= dp[i][j] << v[i+1][j] | dp[i][j] >> v[i][j+1];
    }

  int ans = 0;
  while (!dp[h-1][w-1][12800+ans] && !dp[h-1][w-1][12800-ans])
    ans++;
  cout<<ans<<endl;
  return 0;
}



Compiler output:
a.cc:20:1: error: 'bitset' does not name a type
   20 | bitset<25600> dp[88][88];
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:39:3: error: 'dp' was not declared in this scope
   39 |   dp[0][0][12800+v[0][0]] = 1;
      |   ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int dp[81][81][6400 * 2 + 2];
int find_it(int dif_sum , int i , int j , int &n , int &m , vector<vector<pair<int , int>>> & matrix){
    if(i == n - 1 && j == m - 1){
        return min(abs(dif_sum + matrix[i][j].first - matrix[i][j].second) , abs(dif_sum + matrix[i][j].second - matrix[i][j].first));
    }
    if(dp[i][j][dif_sum] != -1){
        return dp[i][j][dif_sum];
    }
    int minvalue = INT_MAX;
    int ff = dif_sum + matrix[i][j].first - matrix[i][j].second
    int ss = dif_sum + matrix[i][j].second - matrix[i][j].first;
    if(i + 1 < n){
        minvalue = min(minvalue , find_it(ff , i + 1 , j , n , m , matrix));
        minvalue = min(minvalue , find_it(ss , i + 1 , j , n , m , matrix));

    }
    if(j + 1 < m){
        minvalue = min(minvalue , find_it(ff , i , j + 1 , n , m , matrix));
        minvalue = min(minvalue , find_it(ss , i , j + 1 , n , m , matrix));
    }
    return dp[i][j][dif_sum] = minvalue;

}
int main(){

	ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n , m;
    cin >> n >> m;
    vector<vector<pair<int , int> > > matrix(n , vector<pair<int , int>> (m));

    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            cin >> matrix[i][j].first;
        }
    }
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            cin >> matrix[i][j].second;
        }
    }
    memset(dp , -1 , sizeof(dp));
    cout << find_it(0 , 0 , 0 , n , m , matrix);


return 0;
}


Compiler output:
a.cc: In function 'int find_it(int, int, int, int&, int&, std::vector<std::vector<std::pair<int, int> > >&)':
a.cc:13:5: error: expected ',' or ';' before 'int'
   13 |     int ss = dif_sum + matrix[i][j].second - matrix[i][j].first;
      |     ^~~
a.cc:16:43: error: 'ss' was not declared in this scope
   16 |         minvalue = min(minvalue , find_it(ss , i + 1 , j , n , m , matrix));
      |                                           ^~
a.cc:21:43: error: 'ss' was not declared in this scope
   21 |         minvalue = min(minvalue , find_it(ss , i , j + 1 , n , m , matrix));
      |                                           ^~
Language: C++

#include <bits/stdc++.h>

#define pii pair<int, int>
#define endl "\n"
// #define int long long
#define F first
#define S second
#define B begin
#define E end
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
const int INF = 1e9 + 1;
const double EPS = 1e-10;
const ll P = 1e9 + 7;
const ll Q = 31;
 
using namespace std;
 
void hello()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}
 
void show(vector<int>& arr)
{
    for (auto i : arr)
        cout << i << " ";
    cout << endl;
}
void show(vector<vector<int>>& arr)
{
    for (auto i : arr)
        show(i);
    cout << endl;
}


 
signed main()
{
    hello();

    int n, m;
    cin >> n >> m;
    int a[n][m];
    int b[n][m];
    bitset <2 * 80 * 80 + 1> dp[n][m]; 

    int sum = 0;

    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
        {
            cin >> a[i][j];
            sum += a[i][j];
        }

    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
        {
            cin >> b[i][j];
            sum += b[i][j];
        }


    dp[0][0][a[0][0] - b[0][0] + DSUM] = 1;
    dp[0][0][b[0][0] - a[0][0] + DSUM] = 1;

    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            if (!i && !j)
                continue;
            bitset <2 * 80 * 80 + 1> pos;
            if (i)
                pos |= dp[i - 1][j];
            if (j)
                pos |= dp[i][j - 1];

            dp[i][j] = (pos << abs(a[i][j] - b[i][j])) | (pos >> abs(a[i][j] - b[i][j]));
        }
    }
    int res = sum;
    for (int i = 0; i < 2 * 80 * 80 + 1; ++i)
    {
        if (dp[n - 1][m - 1][i])
        {
            // cout << i - DSUM << endl;
            res = min(res, abs(i - DSUM));
            // cout << res << endl << endl;
        }
    }

    cout << res << endl;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:75:34: error: 'DSUM' was not declared in this scope
   75 |     dp[0][0][a[0][0] - b[0][0] + DSUM] = 1;
      |                                  ^~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int C = 20000;

int main() {
    int h, w; cin >> h >> w;
    vector<vector<int>> a(h, vector<int>(w));
    for (auto &ai: a) for (auto &aij: ai) cin >> aij;
    for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) {
        int b; cin >> b;
        a[i][j] = abs(a[i][j] - b);
    }
    vector<vector<bitset<C * 2>>> dp(h, vector<bitset<C * 2>>(w));
    dp[0][0].set(C + a[0][0]);
    dp[0][0].set(C - a[0][0]);
    for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) {
        if (i + 1 < h) {
            dp[i + 1][j] |= dp[i][j] << a[i + 1][j];
            dp[i + 1][j] |= dp[i][j] >> a[i + 1][j];
        }
        if (j + 1 < w) {
            dp[i][j + 1] |= dp[i][j] << a[i][j + 1];
            dp[i][j + 1] |= dp[i][j] >> a[i][j + 1];
        }
    }
    for (int k = 0; k < C; k++) if (dp[h - 1][w - 1][C + k]) {
        cout << k << endl;
        break;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: 'bitset' was not declared in this scope
   15 |     vector<vector<bitset<C * 2>>> dp(h, vector<bitset<C * 2>>(w));
      |                   ^~~~~~
a.cc:4:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
    3 | #include <vector>
  +++ |+#include <bitset>
    4 | using namespace std;
a.cc:15:30: error: template argument 1 is invalid
   15 |     vector<vector<bitset<C * 2>>> dp(h, vector<bitset<C * 2>>(w));
      |                              ^
a.cc:15:30: error: template argument 2 is invalid
a.cc:15:31: error: template argument 1 is invalid
   15 |     vector<vector<bitset<C * 2>>> dp(h, vector<bitset<C * 2>>(w));
      |                               ^~
a.cc:15:31: error: template argument 2 is invalid
a.cc:15:33: error: expected unqualified-id before '>' token
   15 |     vector<vector<bitset<C * 2>>> dp(h, vector<bitset<C * 2>>(w));
      |                                 ^
a.cc:16:5: error: 'dp' was not declared in this scope
   16 |     dp[0][0].set(C + a[0][0]);
      |     ^~
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 85;

int dp[N][N][2 * N * N + 5];
int a[N][N], b[N][N];
int n, m;
int ans;

void go(int x, int y, int diff) {
  if(x == n and y == m)  {
    ans = min(ans, diff);
    return;
  }
  if(x > n + 1 or y > m + 1) return;
  if(dp[x][y][diff] != -1) return;
  dp[x][y][diff] = 1;
  int ans = 0;
  go(x + 1, y, abs(diff + abs(a[x][y] - b[x][y])));
  go(x + 1, y, abs(diff - abs(a[x][y] - b[x][y])));
  go(x, y + 1, abs(diff + abs(a[x][y] - b[x][y])));
  go(x, y + 1, abs(diff - abs(a[x][y] - b[x][y])));
}

int main() {
  memset(dp, -1, sizeof dp);
  cin >> n >> m;
  for(int i = 1; i <= n; i++) {
    for(int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  for(int i = 1; i <= n; i++) {
    for(int j = 1; j <= m; j++) {
      cin >> b[i][j];
    }
  }
  ans = 1e9;
  go(1, 1, );
  cout << ans << '\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:12: error: expected primary-expression before ')' token
   43 |   go(1, 1, );
      |            ^
Language: C++

#include <bits/stdc++.h>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
using namespace std;

int L = 80*80*5;
int mid = L/2;
int l2, l3;
˜
int main() {
    int H, W; cin >> H >> W;
    int A[H][W];
    int B[H][W];
    REP(h, H){
        REP(w, W){
            cin >> l2;
            A[h][w] = l2;
        }
    }
    REP(h, H) {
        REP(w, W){
            cin >> l3;
            B[h][w] = l3;
        }
    }
    bool dp1[H+1][W+1][L+1];
    REP(h, H+1){
        REP(w, W+1){
            REP(l, L+1) {
                dp1[h][w][l] = false;
            }
        }
    }
    REP(h, H+1){
        dp1[h][0][mid] = true;
    }
    REP(w, W+1){
        dp1[0][w][mid] = true;
    }

    REP(h, H){
        REP(w, W){
            REP(l, L+1){
                int c1 = A[h][w]-B[h][w];
                if (0 <= l-c1 <= L){
                    dp1[h+1][w+1][l] = dp1[h][w+1][l-c1] || dp1[h+1][w][l-c1];
                }
                if (0 <= l+c1 <= L){
                    dp1[h+1][w+1][l] = dp1[h+1][w+1][l] || dp1[h][w+1][l+c1] || dp1[h+1][w][l+c1];
                }
            }
        }
    }

    int ans = 1000000000;
    REP(l1, L+1){
        if (dp1[H][W][l1]){
            //cout << l1-mid << endl;
            ans = min(abs(l1-mid), ans);
        }
    }
    cout << ans << endl;

}

Compiler output:
a.cc:10:2: error: stray '\16' in program
   10 | <U+02DC><U+000E>
      |         ^~~~~~~~
a.cc:10:1: error: '\U000002dc' does not name a type
   10 | ˜
      | ^
Language: C++

#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>

#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;


const int mod = 1000000007;
int main(int argc, char *argv[]) {
	int h, w;
	cin >> h >> w;
	vector<vector<int>> v1(h, vector<int> (w, 0)), v2(h, vector<int> (w, 0));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			int a;
			// cin >> a;
			scanf("%d", &a);
			v1[i][j] = a;
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			int b;
			scanf("%d", &b);
			v2[i][j] = b;
		}
	}
	unordered_map<int, unordered_map<int, bitset<512512 * 2>>> um;
	um[-1][0][512512] = true;
	um[0][-1][512512] = true;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			um[i][j] = um[i][j - 1] | um[i - 1][j];
			int diff = v1[i][j] - v2[i][j];
			if (diff < 0)
			diff = -diff;
			um[i][j] = (um[i][j] >> diff) | (um[i][j] << diff);
		}
	}
	int res;
	for (res = 0; 512512 - res >= 0 && !um[h - 1][w - 1][512512 + res] && !um[h - 1][w - 1][512512 - res]; res++);
	cout << res << endl;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:45:47: error: 'bitset' was not declared in this scope
   45 |         unordered_map<int, unordered_map<int, bitset<512512 * 2>>> um;
      |                                               ^~~~~~
a.cc:22:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   21 | #include <iomanip>
  +++ |+#include <bitset>
   22 | using namespace std;
a.cc:45:63: error: template argument 2 is invalid
   45 |         unordered_map<int, unordered_map<int, bitset<512512 * 2>>> um;
      |                                                               ^
a.cc:45:63: error: template argument 5 is invalid
a.cc:45:64: error: template argument 2 is invalid
   45 |         unordered_map<int, unordered_map<int, bitset<512512 * 2>>> um;
      |                                                                ^~
a.cc:45:64: error: template argument 5 is invalid
a.cc:45:66: error: expected unqualified-id before '>' token
   45 |         unordered_map<int, unordered_map<int, bitset<512512 * 2>>> um;
      |                                                                  ^
a.cc:46:9: error: 'um' was not declared in this scope; did you mean 'tm'?
   46 |         um[-1][0][512512] = true;
      |         ^~
      |         tm
Language: C++

//#include<bits/stdc++.h>
#include<iostream>

using namespace std;
#define ll long long 


bool ke(int x,int y){


    if((x&(1<<y)))return 1;
    return 0;
}

template <class T> inline T BM(T p, T e, T M) {
    ll ret = 0;
    for(; e > 0; e >>= 1) {
        if(e & 1) ret = (ret + p) % M;
        p = (p + p) % M;
    }
    return (T)ret;
}


int dp[81][81];




int main(){

    int n,m;
    cin>>n>>m;
    int res=0;
    int  ar[n+2][m+2];
    for (int i=1;i<=n;i++){

        for(int j=1;j<=m;j++){
            cin>>ar[i][j];
        }
    }

    int br[n+2][m+2];


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

        for(int j=1;j<=m;j++){
            cin>>br[i][j];
        }
    }

    int dp[2][m+2][6402][2];
    memset(dp,0,sizeof dp);
    dp[0][1][0][0] = 1; 
    bool fl1 = 0;
    for(int i=1;i<=n;i++){
        fl1^=1;
        memset(dp[fl1],0,sizeof dp[fl1]);
        for(int j=1;j<=m;j++){

            int x= ar[i][j]-br[i][j];
            for(int k=-6400;k<=6400;k++){
                bool fl =0;
                if(k<0)fl=1;
                if(dp[fl1^1][j][abs(k)][fl]==1||dp[fl1][j-1][abs(k)][fl]==1){
                    int y=x+k;
                    //cout<<y<<endl;
                    if(abs(y)<=6400){
                        dp[fl1][j][abs(y)][y<0] = 1;
                    }
                }
            }
            x= -ar[i][j]+br[i][j];
            for(int k=-6400;k<=6400;k++){
                bool fl =0;
                if(k<0)fl=1;
                if(dp[fl1^1][j][abs(k)][fl]==1||dp[fl1][j-1][abs(k)][fl]==1){
                    int y=x+k;
                    if(abs(y)<=6400){
                        dp[fl1][j][abs(y)][y<0] = 1;
                    }
                }
            }
        }
    }

    int ans=6400;

    for(int i=0;i<=6400;i++){
        if(dp[fl1][m][i][0]||dp[fl1][m][i][1])ans = min(ans,i);
    }

    cout<<ans<<endl;
    return 0;

}

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

#include <bits/stdc++.h>
using namespace std;
 
const long long mod = 1e9 + 7 ;
const int N = 3e5+122; 

int n,m;
int a[100][100], b[100][100], c[100][100];

unordered_map<int,int> dp[100][100];
int main () {

	cin >> n>>m;
	for(int i = 1; i <= n; i++) 
	for(int j = 1; j <= m; j++)
		cin >> a[i][j];
		
	for(int i = 1; i <= n; i++) 
	for(int j = 1; j <= m; j++)
		cin >> b[i][j], c[i][j] = a[i][j] - b[i][j];

	dp[1][1][c[1][1]] = 1;
	dp[1][1][-c[1][1]] = 1;

	for(int i = 1; i <= n; i++)
	for(int j = 1; j <= m; j++) {
		if(i==j&&i==1)continue;
		if(i>1) {
			for(auto it : dp[i - 1][j])
              if(abs(it.first)<=9000)
				dp[i][j][abs(it.first + c[i][j])] =dp[i][j][abs(it.first-c[i][j]])] |= 1;

		}
		if(j>1) {
			for(auto it : dp[i][j-1])
              if(abs(it.first)<=9000)
				dp[i][j][abs(it.first + c[i][j])] =dp[i][j][abs(it.first-c[i][j])] |= 1;

		}
	}
	int res = 1e9;
	int ans;
	for(auto it: dp[n][m])
		if(abs(it.first) <res)
			res=abs(it.first),ans=it.first;
	cout<<res;
}
            

              




Compiler output:
a.cc: In function 'int main()':
a.cc:31:97: error: expected ')' before ']' token
   31 |                                 dp[i][j][abs(it.first + c[i][j])] =dp[i][j][abs(it.first-c[i][j]])] |= 1;
      |                                                                                ~                ^
      |                                                                                                 )
Language: C++

#include<iostream>


using namespace std;
#define ll long long 


bool ke(int x,int y){


    if((x&(1<<y)))return 1;
    return 0;
}

template <class T> inline T BM(T p, T e, T M) {
    ll ret = 0;
    for(; e > 0; e >>= 1) {
        if(e & 1) ret = (ret + p) % M;
        p = (p + p) % M;
    }
    return (T)ret;
}


int dp[81][81];




int main(){

    int n,m;
    cin>>n>>m;
    int res=0;
    int  ar[n+2][m+2];
    for (int i=1;i<=n;i++){

        for(int j=1;j<=m;j++){
            cin>>ar[i][j];
        }
    }

    int br[n+2][m+2];


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

        for(int j=1;j<=m;j++){
            cin>>br[i][j];
        }
    }

    int dp[n+2][m+2][6402][2];
    memset(dp,0,sizeof dp);
    dp[0][1][0][0] = 1; 
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            int x= ar[i][j]-br[i][j];
            for(int k=-6400;k<=6400;k++){
                bool fl =0;
                if(k<0)fl=1;
                if(dp[i-1][j][abs(k)][fl]==1||dp[i][j-1][abs(k)][fl]==1){
                    int y=x+k;
                    //cout<<y<<endl;
                    if(abs(y)<=6400){
                        dp[i][j][abs(y)][y<0] = 1;
                    }
                }
            }
            x= -ar[i][j]+br[i][j];
            for(int k=-6400;k<=6400;k++){
                bool fl =0;
                if(k<0)fl=1;
                if(dp[i-1][j][abs(k)][fl]==1||dp[i][j-1][abs(k)][fl]==1){
                    int y=x+k;
                    if(abs(y)<=6400){
                        dp[i][j][abs(y)][y<0] = 1;
                    }
                }
            }
        }
    }

    int ans=6400;

    for(int i=0;i<=6400;i++){
        if(dp[n][m][i][0]||dp[n][m][i][1])ans = min(ans,i);
    }

    cout<<ans<<endl;
    return 0;

}

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(_i,_m,_n) for(ll _i = (_m); i <= (_n); _i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll h, w, a[82][82], b;
int g[82][82][12800];

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> h >> w;
	rep(i, 1, h){
		rep(j, 1, w){
			cin >> a[i][j];
		}
	}
	rep(i, 1, h){
		rep(j, 1, w){
			cin >> b;
			a[i][j] = abs(a[i][j]-b);
		}
	}
	
	memset(g, 0, sizeof(g));
	g[1][1][a[1][1]] = 1;
	rep(i, 1, h){
		rep(j, 1, w){
			rep(k, 0, 12800){
				if(g[i][j][k] == 1){
					g[i+1][j][abs(k+a[i+1][j])] = 1;
					g[i+1][j][abs(k-a[i+1][j])] = 1;
					g[i][j+1][abs(k+a[i][j+1])] = 1;
					g[i][j+1][abs(k-a[i][j+1])] = 1;
				}
			}	
		}	
	}
	ll ans = -1;
	rep(k, 0, 12800){
		if(g[h][w][k] == 1){
			ans = k;
			break;
		}
	}
	print(ans)
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:41: error: 'i' was not declared in this scope
    7 | #define rep(_i,_m,_n) for(ll _i = (_m); i <= (_n); _i++)
      |                                         ^
a.cc:46:9: note: in expansion of macro 'rep'
   46 |         rep(k, 0, 12800){
      |         ^~~
Language: C++

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 h,w;
    cin >> h >> w;
    vector<vector<int32>> a(h, vector<int32>(w));
    vector<vector<int32>> b(h, vector<int32>(w));
    REP(i,h)REP(j,w)cin >> a[i][j];
    REP(i,h)REP(j,w)cin >> b[i][j];
    vector<vector<int32>> c(h, vector<int32>(w));
    REP(i,h)REP(j,w){
        c[i][j] = abs(a[i][j] - b[i][j]);
    }
    vector<vector<vector<bool>> dp(h, vector<vector<bool>>(w, vector<bool>(13000, false)));
    dp[0][0][c[0][0]] = true;
    REP(i,h)REP(j,w){
        if(i != h-1){    //dp[i+1][j]
            // for(auto x : dp[i+j]){
            //     if(x + c[i+1][j] <= min<int64>(1000, 80 * (min(i + 1, h - i) + min(w + 1, w - j))))
            //         dp[i+1+j].insert(x + c[i+1][j]);
            //     dp[i+1+j].insert(abs(x - c[i+1][j]));
            // }
            REP(k,13000 - c[i+1][j] - 1){
                if(dp[i][j][k]){
                    dp[i+1][j][k + c[i+1][j]] = true;
                    dp[i+1][j][abs(k - c[i+1][j])] = true;
                }
            }
        }
        if(j != w-1){
            // for(auto x : dp[i+j]){
            //     if(x + c[i][j+1] <= min<int64>(1000, 80 * (min(i + 1, h - i) + min(w + 1, w - j))))
            //         dp[i+j+1].insert(x + c[i][j+1]);
            //     dp[i+j+1].insert(abs(x - c[i][j+1]));
            // }
            REP(k,13000 - c[i][j+1] - 1){
                if(dp[i][j][k]){
                    dp[i][j+1][k + c[i][j+1]] = true;
                    dp[i][j+1][abs(k - c[i][j+1])] = true;
                }
            }
        }
    }
    REP(i,13000){
        if(dp[h-1][w-1][i]){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:90: error: template argument 1 is invalid
   36 |     vector<vector<vector<bool>> dp(h, vector<vector<bool>>(w, vector<bool>(13000, false)));
      |                                                                                          ^
a.cc:36:90: error: template argument 2 is invalid
a.cc:37:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
   37 |     dp[0][0][c[0][0]] = true;
      |     ^~
      |     dup
Language: C++

#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> VI;
typedef vector<long long int> VLLI;
typedef vector<pair<int, int> > VPI;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll, ll> PLL;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int h, w;
    cin >> h >> w;
    vector<vector<PII>> mat(h, vector<PII>(w));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> mat[i][j].first;
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> mat[i][j].second;
        }
    }

    unordered_set<int> dp[h][w];
    dp[h-1][w-1].insert(abs(mat[h-1][w-1].first - mat[h-1][w-1].second));

    for (int i = h-1; i >= 0; i--) {
        for (int j = w-1; j >= 0; j--) {
            int val = mat[i][j].first - mat[i][j].second
            if (i < h-1) {
                for (auto x : dp[i+1][j]) {
                    dp[i][j].insert(abs(x + val));
                    dp[i][j].insert(abs(x - val));
                }
            }
            if (j < w-1) {
                for (auto x : dp[i][j+1]) {
                    dp[i][j].insert(abs(x + val));
                    dp[i][j].insert(abs(x -val));
                }
            }
        }
    }

    int ans = INT_MAX;
    for (auto x : dp[0][0]) {
        ans = min(ans, abs(x));
    }
    cout << ans << "\n";
}



Compiler output:
a.cc: In function 'int main()':
a.cc:65:13: error: expected ',' or ';' before 'if'
   65 |             if (i < h-1) {
      |             ^~
Language: C++

#include <stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main(){
     int t,i,j,m,k=0,s[16]={0},n[20],a[20][20],b[20][20];
     scanf("%d%d",&m,&n);
     for(i=1;i<=m;i++)
       for(j=1;j<=n;j++){
         scanf("%d",&a[i][j]);
       }
     for(i=1;i<=m;i++)
       for(j=1;j<=n;j++){
          scanf("%d",&b[i][j]);
          a[i][j]=a[i][j]-b[i][j];
       }
    for(i=3;i<=m+n;i++)
      for(j=1;j<=m;j++){
        if(1<=i-j && i-j<=n)
            if(j==1) a[j][i-j]+=a[j][i-j-1];
            else if(i-j==1) a[j][i-j]+=a[j-1][i-j];
                 else if(fabs(a[j][i-j-1]+a[j][i-j])<fabs(a[j-1][i-j]+a[j][i-j])) a[j][i-j]+=a[j][i-j-1];
                      else a[j][i-j]+=a[j-1][i-j];
    a[m][n]=fabs(a[m][n]);                  
    printf("%d",a[m][n]);
     return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |        for(j=1;j<=n;j++){
      |                ~^~~
a.cc:13:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 |        for(j=1;j<=n;j++){
      |                ~^~~
a.cc:17:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 |     for(i=3;i<=m+n;i++)
      |             ~^~~~~
a.cc:19:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   19 |         if(1<=i-j && i-j<=n)
      |                      ~~~^~~
a.cc:24:9: error: invalid types 'int [20][int [20]]' for array subscript
   24 |     a[m][n]=fabs(a[m][n]);
      |         ^
a.cc:24:22: error: invalid types 'int [20][int [20]]' for array subscript
   24 |     a[m][n]=fabs(a[m][n]);
      |                      ^
a.cc:25:21: error: invalid types 'int [20][int [20]]' for array subscript
   25 |     printf("%d",a[m][n]);
      |                     ^
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int H,W;
  cin >> H >> W;
  vector<vector<int>> A(H,vector<int>(W)), B(H,vector<int>(W));
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      cin >> A[i][j];
    }
  }
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      cin >> B[i][j];
    }
  }
  vector<vector<int>> D(H,vector<int>(W));
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      D[i][j] = abs(A[i][j]-B[i][j]);
    }
  }
  vector<vector<vector<bool>> DP(H,vector<vector<bool>>(W,vector<bool>(161,false)));
  DP[0][0][D[0][0]]=true;
  for (int i = 1; i < H; i++){
    for (int k = 0; k <= 160; k++){
      if (DP[i-1][0][k]){
        if (k+D[i][0]<=160) DP[i][0][k+D[i][0]]=true;
        if (abs(k-D[i][0])<=160) DP[i][0][abs(k+D[i][0])]=true;
      }
    }
  }
  for (int j = 1; j < W; j++){
    for (int k = 0; k <= 160; k++){
      if (DP[0][j-1][k]){
        if (k+D[0][j]<=160) DP[0][j][k+D[0][j]]=true;
        if (abs(k-D[0][j])<=160) DP[0][j][abs(k+D[0][j])]=true;
      }
    }
  }
  for (int i = 1; i < H; i++){
    for (int j = 1; j < W; j++){
      for (int k = 0; k <= 160; k++){
        if (DP[i][j-1][k]){
          if (k+D[i][j]<=160) DP[i][j][k+D[i][j]]=true;
          if (abs(k-D[i][j])<=160) DP[i][j][abs(k+D[i][j])]=true;
        }
      }
      for (int k = 0; k <= 160; k++){
        if (DP[i-1][j][k]){
          if (k+D[i][j]<=160) DP[i][j][k+D[i][j]]=true;
          if (abs(k-D[i][j])<=160) DP[i][j][abs(k+D[i][j])]=true;
        }
      }
    }
  }
  int i = 0;
  while (!DP[H-1][W-1][i]) i++;
  cout << i;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:83: error: template argument 1 is invalid
   23 |   vector<vector<vector<bool>> DP(H,vector<vector<bool>>(W,vector<bool>(161,false)));
      |                                                                                   ^
a.cc:23:83: error: template argument 2 is invalid
a.cc:24:3: error: 'DP' was not declared in this scope; did you mean 'D'?
   24 |   DP[0][0][D[0][0]]=true;
      |   ^~
      |   D
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int DIM = 87;

bool dp[DIM][DIM][DIM * DIM * DIM];

int v[DIM][DIM];

main()
{
	int n, m;
	cin >> n >> m;
	
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			cin >> v[i][j];
	
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
		{
			int x;
			cin >> x;
			
			v[i][j] -= x;
			v[i][j] = abs(v[i][j]);
		}
	
	dp[1][1][v[1][1]] = true;
	
	for(int x = 1; x <= n; x++)
		for(int y = 1; y <= m; y++)
			for(int k = 0; k < DIM * DIM; k++)
				if(dp[x][y][k] == true)
				{
					int nx = x;
					int ny = y;
					
					nx++;
					
					if(nx <= n)
					{
						int d1 = k + v[nx][ny];
						int d2 = abs(k - v[nx][ny]);
						
						dp[nx][ny][d1] = true;
						dp[nx][ny][d2] = true;
					}
					
					nx--;
					ny++;
					
					if(ny <= m)
					{
						int d1 = k + v[nx][ny];
						int d2 = abs(k - v[nx][ny]);
						
						dp[nx][ny][d1] = true;
						dp[nx][ny][d2] = true;
					}
				}
	
	for(int i = 0; i < DIM * DIM; i++)
		if(dp[n][m][i] == true)
		{
			cout << i;
			return 0;
		}
}

Compiler output:
a.cc:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main()
      | ^~~~
/tmp/ccb2v3pN.o: in function `main':
a.cc:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccb2v3pN.o
a.cc:(.text+0xdb): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccb2v3pN.o
a.cc:(.text+0x106): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccb2v3pN.o
a.cc:(.text+0x12a): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccb2v3pN.o
a.cc:(.text+0x156): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccb2v3pN.o
a.cc:(.text+0x17f): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccb2v3pN.o
a.cc:(.text+0x22f): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccb2v3pN.o
a.cc:(.text+0x25b): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccb2v3pN.o
a.cc:(.text+0x306): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccb2v3pN.o
a.cc:(.text+0x332): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccb2v3pN.o
collect2: error: ld returned 1 exit status
Language: C++

    //For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;

    int ar[101][101],n,m,ar2[101][101];

    bool chk(int i,int j)
    {
        if(i<=0 || j<=0 || i>n || j>m)
            return false;
        return true;
    }

    set<int> st[101][101];

    void func(int i,int j)
    {
        int a,b,x;
        a=ar[i][j]-ar2[i][j];
        b=ar2[i][j]-ar[i][j];
        
        if(i==n && j==m)
        {
            st[i][j].insert(a);
            st[i][j].insert(b);
            return;
        }
        if(chk(i+1,j))
        {
            if(st[i+1][j].empty())
                func(i+1,j);
            for(auto it:st[i+1][j])
            {
                x=it+a;
                if(x>80)
                    x=80-x;
                else if(x<-80)
                    x=-80-x;
                st[i][j].insert(x);
                x=it+b;
                if(x>80)
                    x=80-x;
                else if(x<-80)
                    x=-80-x;
                st[i][j].insert(x);
            }
        }
        if(chk(i,j+1))
        {
                x=it+a;
                if(x>80)
                    x=80-x;
                else if(x<-80)
                    x=-80-x;
                st[i][j].insert(x);
                x=it+b;
                if(x>80)
                    x=80-x;
                else if(x<-80)
                    x=-80-x;
                st[i][j].insert(x);
        }
    }

    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            int i,j;
            cin>>n>>m;
            for(i=1;i<=n;++i)
            {
                for(j=1;j<=m;++j)
                    cin>>ar[i][j];
            }
            for(i=1;i<=n;++i)
                for(j=1;j<=m;++j)
                    cin>>ar2[i][j];
            func(1,1);
            int ans=1e8;
            for(auto it:st[1][1])
            {
                ans=min(ans,abs(it));
            }
            cout<<ans<<endl;
        }
        return 0;
    }


Compiler output:
a.cc: In function 'void func(int, int)':
a.cc:73:19: error: 'it' was not declared in this scope; did you mean 'i'?
   73 |                 x=it+a;
      |                   ^~
      |                   i
Language: C++

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  ll h, w;
  cin >> h >> w;

  if (h * x <= 9) return -1; // デバックするべきは方針か…？

  vector<vector<pair<int, int>>> g(h + 1, vector<pair<int, int>>(w + 1));
  for (int y = 0; y < h; y++)
    for (int x = 0; x < w; x++)
      cin >> g[y][x].first;
  for (int y = 0; y < h; y++)
    for (int x = 0; x < w; x++)
      cin >> g[y][x].second;

  vector<vector<set<int>>> dp(h + 1, vector<set<int>>(w + 1));
  dp[0][0].insert(abs(g[0][0].first - g[0][0].second));
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      int migi = abs(g[y][x + 1].first - g[y][x + 1].second);
      int shita = abs(g[y + 1][x].first - g[y + 1][x].second);
      for (auto d : dp[y][x]) {  // 自分が作れる差
        if (abs(migi + d) <= 80) dp[y][x + 1].insert(abs(migi + d));
        if (abs(migi - d) <= 80) dp[y][x + 1].insert(abs(migi - d));
        if (abs(shita + d) <= 80) dp[y + 1][x].insert(abs(shita + d));
        if (abs(shita - d) <= 80) dp[y + 1][x].insert(abs(shita - d));
      }
    }
  }

  cout << *dp[h - 1][w - 1].begin() << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:11: error: 'x' was not declared in this scope
   15 |   if (h * x <= 9) return -1; // デバックするべきは方針か…？
      |           ^