Language: C++

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

int dir[2][2] = {{0,1},{1,0}};
const int maxn = 85;
int t[maxn][maxn];
int ans;

struct STA {
	int x,y;
	long long val;
	STA() {}
	STA(int x,int y,int val):x(x),y(y),val(val) {}
	void display() {
		cout << x << " " << y << endl;
	}
};
set<ll> app[maxn][maxn];

int H,W;
inline bool isIn(int x,int y) {
	return (x>=1 && x<=H && y>=1 && y<=W);
}

void bfs(int x,int y) {
	STA now;
	queue<STA> list;
	list.push({x,y,t[x][y]});
	while(!list.empty()) {
		now = list.front();
		list.pop();
		if(now.x == H && now.y == W) ans = min(now.val,ans);
		else {
			if(app[now.x][now.y].count(now.val)) continue;
			app[now.x][now.y].insert(now.val);
			for(int i=0; i<2; i++) {
				x = now.x + dir[i][0];
				y = now.y + dir[i][1];
				if(isIn(x,y)) {
					list.push({x,y,now.val+t[x][y]});
					list.push({x,y,abs(now.val-t[x][y])});
				}
			}
		}
	}
}

int main() {
	int tp;
	ans = INT_MAX;
	cin >> H >> W;
	for(int i=1; i<=H; i++)
		for(int j=1; j<=W; j++)
			cin >> t[i][j];
	for(int i=1; i<=H; i++)
		for(int j=1; j<=W; j++) {
			cin >> tp;
			t[i][j] = abs(tp-t[i][j]);
		}
	bfs(1,1);
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc:18:5: error: 'll' was not declared in this scope
   18 | set<ll> app[maxn][maxn];
      |     ^~
a.cc:18:7: error: template argument 1 is invalid
   18 | set<ll> app[maxn][maxn];
      |       ^
a.cc:18:7: error: template argument 2 is invalid
a.cc:18:7: error: template argument 3 is invalid
a.cc: In function 'void bfs(int, int)':
a.cc:32:55: error: no matching function for call to 'min(long long int&, int&)'
   32 |                 if(now.x == H && now.y == W) ans = min(now.val,ans);
      |                                                    ~~~^~~~~~~~~~~~~
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:   template argument deduction/substitution failed:
a.cc:32:55: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   32 |                 if(now.x == H && now.y == W) ans = min(now.val,ans);
      |                                                    ~~~^~~~~~~~~~~~~
/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, 2 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:   candidate expects 1 argument, 2 provided
/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:   template argument deduction/substitution failed:
a.cc:32:55: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   32 |                 if(now.x == H && now.y == W) ans = min(now.val,ans);
      |                                                    ~~~^~~~~~~~~~~~~
a.cc:34:46: error: request for member 'count' in 'app[now.STA::x][now.STA::y]', which is of non-class type 'int'
   34 |                         if(app[now.x][now.y].count(now.val)) continue;
      |                                              ^~~~~
a.cc:35:43: error: request for member 'insert' in 'app[now.STA::x][now.STA::y]', which is of non-class type 'int'
   35 |                         app[now.x][now.y].insert(now.val);
      |                                           ^~~~~~
a.cc:40:63: warning: narrowing conversion of '(now.STA::val + ((long long int)t[x][y]))' from 'long long int' to 'int' [-Wnarrowing]
   40 |                                         list.push({x,y,now.val+t[x][y]});
      |                                                        ~~~~~~~^~~~~~~~
a.cc:41:59: warning: narrowing conversion of 'std::abs((now.STA::val - ((long long int)t[x][y])))' from 'long long int' to 'int' [-Wnarrowing]
   41 |                                         list.push({x,y,abs(now.val-t[x][y])});
      |                                                        ~~~^~~~~~~~~~~~~~~~~