1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = b; i >= a; i--)
#define cat(x) cout << #x << ": " << x << endl

using namespace std;
using ll = long long;

string a, b;

int main() {
	cin.tie(0)->sync_with_stdio(0);

	cin >> a >> b;
	reverse(a.begin(), a.end());
	reverse(b.begin(), b.end());
	if (a.size() < b.size()) swap(a, b);
	b.resize(a.size(), '0');

	int carry = 0;
	for (int i = 0; i < a.size(); i++) {
		int d = (a[i] - '0') + (b[i] - '0') + carry;
		a[i] = d % 10 + '0';
		carry = d / 10;
	}
	if (carry) a.push_back(carry + '0');

	reverse(a.begin(), a.end());
	cout << a << "\n";

	return 0;
}