Go: package main

import (
        "fmt"
        "bufio"
        "os"
)

func main() {
        var n int
        var a, b string
        sc := bufio.NewScanner(os.Stdin)
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                sc.Scan()
                a = sc.Text()
                sc.Scan()
                b = sc.Text()

                if len(a) > len(b) {
                        s := add(a, b)
                        if s[len(a)] > 0 {
                                if len(a) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(a)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                } else {
                        s := add(b, a)
                        if s[len(b)] > 0 {
                                if len(b) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(b)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                }
        }
}

// expects ln > lm
func add(n string, m string) (s [100]int) {
        ln := len(n)
        lm := len(m)
        var sum [100]int

        for i := 0; i < ln; i++ {
                var s, t int
                s = int(n[ln-1-i]) - int('0')

                if lm - 1 - i >= 0 {
                        t = int(m[lm-1-i]) - int('0')
                } else {
                        t = 0
                }

                sum[i+1] = (s + t + sum[i]) / 10
                sum[i] = (s + t + sum[i]) % 10
        }

        return sum
}

C++: #include<iostream>
#include<string>
#include<cstring>
using namespace std;

int main(){
	string s1,s2;
	int num;
	cin>>num;
	for(int j=0;j<num;j++){
		cin>>s1;
		cin>>s2;
		int size1=s1.size();
		int size2=s2.size();
		if(size1>80 || size2>80){
			cout<<"overflow"<<endl;
			return 0;
		}
		if(size1>size2){
			for(int a=0;a<(size1-size2);a++){
				s2='0'+s2;
			}
		}else if(size1<size2){
			for(int a=0;a<(size2-size1);a++){
				s1='0'+s1;
			}
		}
		string ans="";
		int plus=0;
		for(int i=size1-1;i>=-1;i--){
			if(i==-1){
				if(plus!=0){
					ans=(char)(plus+'0')+ans;
					continue;
				}else{
					continue;
				}
			}
			int alt=(s1[i]-'0')+(s2[i]-'0')+plus;
			if(alt>=10){
				ans=(char)(alt-10+'0')+ans;
				plus=alt/10;
			}else ans=(char)(alt+'0')+ans;
		}
		cout<<ans<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n; cin >> n;
  for(int i=0;i<n;i++) {
    string s1,s2;
    cin >> s1;
    cin >> s2;
    int s1_itr = s1.length() - 1;
    int s2_itr = s2.length() - 1;
    bool is_shift = false;
    int digit;
    vector<int> sum;
    while(s1_itr >= 0 || s2_itr >= 0) {
      digit = 0;
      if(s1_itr >= 0)
        digit += s1[s1_itr] - '0';
      if(s2_itr >= 0)
        digit += s2[s2_itr] - '0';
      if(is_shift)
        digit += 1;

      if(digit >= 10) {
        is_shift = true;
        digit = digit - 10;
      }
      else {
        is_shift = false;
      }
      sum.push_back(digit);
      s1_itr--;
      s2_itr--;
    }
    if(is_shift)
      sum.push_back(1);

    if(sum.size() >= 80) {
      cout << "overflow" << endl;
    }
    else {
      for(int i=sum.size()-1;i>=0;i--) {
        cout << sum[i];
      }
      cout << endl;
    }
  }
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>

using namespace std;


int main(){

	int n;
	cin >> n;
	for(int i=0 ; i<n ; i++){
		string a, b;
		cin >> a;
		cin >> b;

		if(b.size() > a.size()){
			string temp;
			temp = a;
			a = b;
			b = temp;
		}

		if(a.size() > 80){
			cout << "overflow" << endl;
		}else{
			for(int j=0 ; j<b.size() ; j++){
				a[a.size()-1-j] = a[a.size()-1-j] + b[b.size()-1-j] -'0';
				if(a[a.size()-1-j] > '9'){
					a[a.size()-1-j] -= 10;
					for(int l=j+1 ; l<a.size() ; l++){
						a[a.size()-1-l] += 1;
						if(a[a.size()-1-l] <= '9'){
							break;
						}else{
							a[a.size()-1-l] -= 10;
							if((a.size()-1-l) == 0){
								a = '0' + a;
							}
						}
					}
				}
			}
			if(a.size() > 80){
				cout << "overflow" << endl;
			}else{
				cout << a << endl;
			}
		}

		}

	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  int tcase;
  
  cin >> tcase;
  while(tcase--) {
    string A, B, C = "";
    cin >> A >> B;
    
    unsigned sz = max(A.size(), B.size());
    while(A.size()<sz) A = '0' + A;
    while(B.size()<sz) B = '0' + B;

    int c = 0;
    for(int i=sz-1; i>=0; i--) {
      // 確定情報
      C += ( (A[i]-'0') + (B[i]-'0') + c ) % 10 + '0';
      // 前座
      c = ( (A[i]-'0') + (B[i]-'0') + c ) / 10;
    }
    if(c>0) C += ( (A[sz-1]-'0') + (B[sz-1]-'0') + c ) % 10 + '0';
    
    reverse(C.begin(), C.end());
    cout << C << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cstdlib>
#include <stdint.h>
#include <cmath>
using namespace std;

int getNumberOfDigits(int64_t i)
{
    return i > 0 ? (int) log10(((double) i)) + 1 : 1;
}

int main()
{
    int iN;
    cin >> iN;
    int64_t sum, iA, iB;
    for(int c = 0; c < iN; c++)
    {
        cin >> iA;
        cin >> iB;
        sum = iA + iB;
        if(getNumberOfDigits(sum) > 80)
            cout << "overflow" << endl;
        else
            cout << sum << endl;
    }
    return EXIT_SUCCESS;
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#define MAX_LEN 101

using namespace std;

void q15() {
	int N;
	scanf("%d\n", &N);
	for (int n = 0; n < N; n++) {
		string a, b;
		getline(cin, a);
		getline(cin, b);

		if (a.length() < b.length()) {
			string tmp = a;
			a = b;
			b = tmp;
		}

		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		
		int carry = 0;
		string ans="";

		int i = 0;
		for (; i < b.length(); i++) {
			ans+= (((a[i] - '0') + (b[i] - '0') + carry) % 10) + '0';
			carry = ((a[i] - '0') + (b[i] - '0') + carry) / 10;
		}
		for (; i < a.length(); i++) {
			ans+= (((a[i] - '0') + carry) % 10) + '0';
			carry = ((a[i] - '0') + carry) / 10;
		}
		for (; carry; i++) {
			ans+= (carry % 10) + '0';
			carry = carry / 10;
		}

		reverse(ans.begin(), ans.end());
		cout << (ans.length() > 80 ? "overflow" : ans) << endl;
	}
}
int main() {
	q15();
	return 0;
}