1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <bits/stdc++.h>

int main() {
	std::ios_base::sync_with_stdio(0); std::cin.tie(NULL);
	std::vector<int> a, b;
	std::string s,z; std::cin >> s >> z;
	for (int i = s.length()-1; i >= 0; i--) a.push_back(s[i]-'0');
	for (int i = z.length()-1; i >= 0; i--) b.push_back(z[i]-'0');
	std::vector<int> c(6000, 0);
	for (int i = 0; i < 6000; i++) {
		if (i < a.size()) c[i] += a[i];
		if (i < b.size()) c[i] += b[i];
	}
	for (int i = 0; i < 5999; i++) {
		c[i+1] += c[i]/10;
		c[i] %= 10;
	}

	while (c.back() == 0) c.pop_back();
	for (int i = c.size()-1; i >= 0; i--) std::cout << c[i];
	std::cout << "\n";
}