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<bits/stdc++.h>
using namespace std;
char str[102],str1[102],ans[102];
int sam(int ma1,int ma2)
{
    int co,carry=0,a,b;
    for(int i=0;ma1-i>=0||ma2-i>=0||carry==1;i++){
            if(ma1-i>=0&&ma2-i>=0){
                    a=str[ma1-i]-'0';
                    b=str1[ma2-i]-'0';
                    if(a+b+carry>=10){
                        ans[i]=a+b+carry-10+'0';
                        carry=1;
                    }
                    else {
                        ans[i]=a+b+carry+'0';
                        carry=0;
                    }
            }
            else if(ma1-i>=0){
                    a=str[ma1-i]-'0';
                    if(a+carry>=10){
                        ans[i]=a+carry-10+'0';
                        carry=1;
                    }
                    else {
                        ans[i]=a+carry+'0';
                        carry=0;
                    }
            }
            else if(ma2-i>=0){
                    b=str1[ma2-i]-'0';
                    if(b+carry>=10){
                        ans[i]=b+carry-10+'0';
                        carry=1;
                    }
                    else {
                        ans[i]=b+carry+'0';
                        carry=0;
                    }
            }
            else {
                ans[i]='0'+1;
                return i;
            }
        co=i;

    }
    return co;

}
int main()
{
    int a,b,n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>str>>str1;
        a=strlen(str);
        b=strlen(str1);
        a=sam(a,b);
        if(a>80)cout<<"overflow"<<endl;
        else for(int j=a;j>0;j--)cout<<ans[j];
        cout<<endl;
    }

}

C++: #include <iostream>
#include <vector>
#include <string>
#include <sstream>
using namespace std;
string toString(int n) {
    ostringstream os;
    os << n;
    return os.str();
}
string add(string a, string b) {
    if (a.size() > 80 || b.size() > 80) {
        return "overflow";
    }

    int siz = max(a.size(), b.size());
    vector<int> s1(siz, 0);
    for (int i=a.size()-1; i>=0; --i) {
        s1[a.size()-1-i] = a[i] - '0';
    }
    vector<int> s2(siz, 0);
    for (int i=b.size()-1; i>=0; --i) {
        s2[b.size()-1-i] = b[i] - '0';
    }

    string res = "";
    int carry = 0;
    for (int i=0; i<siz; ++i) {
        res = toString((s1[i] + s2[i] + carry) % 10) + res;
        carry = (s1[i] + s2[i] + carry >= 10);
    }
    if (carry) {
        res = '1' + res;
    }

    if (res.size() > 80) {
        return "overflow";
    }
    return res;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for (int i=0; i<n; ++i) {
        string a, b;
        cin >> a >> b;
        cout << add(a, b) << endl;
    }
    return 0;
}

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

int main() {
  
  int n,i,j;
  cin >> n;

  for(i=0;i<n;i++){
    string str1,str2,temp;
    int kuriagari=0;
    cin >> str1 >> str2;
    
    if (str1.size()<str2.size()){
      temp = str1;
      str1 = str2;
      str2 = temp;
    }
    int goukei[str1.size()+1];
    
    for(j=0;j<str1.size()+1;j++){
      
      if (j==str1.size()){
	goukei[0] = kuriagari;
      }else if (j<str2.size()){
	goukei[str1.size()-j] = str2[str2.size()-1-j] + str1[str1.size()-1-j] + kuriagari -'0' - '0';
	if (goukei[str1.size()-j] >= 10) {
	  goukei[str1.size()-j] -= 10;
	  kuriagari = 1;
	}else{
	  kuriagari = 0;
	}
      }else{
	goukei[str1.size()-j] = str1[str1.size()-1-j] + kuriagari -'0';
	if (goukei[str1.size()-j] >= 10) {
	  goukei[str1.size()-j] -= 10;
	  kuriagari = 1;
	}else{
	  kuriagari = 0;
	}
      }
    }
    if (str.size()>81)||( (str.size()==80)&&(goukei[0]==1) ){
      cout << "overflow" <<endl;
    }else{
      if (goukei[0]!=0)
	cout << goukei[0] ;
      for(j=0;j<str1.size();j++)
	cout << goukei[j+1];
      cout <<endl;
    }
  }
      
  return 0;
  
}

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=0 ; l<a.size()-1 ; l++){
						a[a.size()-2-l] ++;
						if(a[a.size()-2-l] > '9'){
							if(a.size()-2-l == 0){
								/*string A;
								A += '0';
								A += a;
								a = A;*/
								a = "0" + a;
							}
							a[a.size()-2-l] -= 10;
						}else break;
					}
				}
			}
		}
		cout << a << endl;

		}

	return 0;
}