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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <iostream>
#include <algorithm>

using namespace std;

// #define DEBUG
#ifdef DEBUG
#define dassert(x) assert(x);
#define df(...) printf(__VA_ARGS__)
#else
#define dassert(x)
#define df(...)
#endif

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define ir(x, a, b) ((a) <= (x) && (x) <= (b))
#define vec vector
#define sz(x) (ll)x.size()
#define foru(i, n) for (int i = 0; (i) < (n); ++(i))
#define all(x) (x).begin(), (x).end()

typedef int64_t ll;

int main() {
    df("debug mode\n");
#ifndef DEBUG
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif
    string a, b;
    cin >> a >> b;
    reverse(all(a)); reverse(all(b));
    if (a.size() < b.size()) swap(a, b);
    foru (i, a.size()) a[i] -= '0';
    foru (i, b.size()) b[i] -= '0';
    for (int i = b.size(); i < a.size(); ++i) b.push_back(0);
    a.push_back(0);
    foru (i, b.size()) {
        a[i+1] += (a[i] + b[i])/10;
        a[i] = (a[i]+b[i])%10;
    }
    if (a.back() == 0) a.pop_back();
    reverse(all(a));
    foru (i, a.size()) a[i] += '0';
    cout << a << endl;
    return 0;
}