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 <vector>
#include <algorithm>
#include <cstring>
using namespace std;

int main(void){
  int N;
  string str1, str2;
  cin >> N;
  for(int k = 0; k < N; k++){
    vector<int> ans;
    cin >> str1 >> str2; 
    if(str1.size() > 80 || str2.size() > 80){
      cout << "overflow" << endl;
      continue;
    }

    int carry, sum;
    string *bigger;

    if(str1.size() > str2.size()){
      bigger = &str1;
    }else{
      bigger = &str2;
    }

    vector<int>::iterator ite = ans.begin();
    pair<int, int> P;
    P.first = min(str1.size(), str2.size());
    P.second = max(str1.size(), str2.size());

    for(int i = 0; i < P.first; i++){
      sum = (str2[str2.size() - 1 - i] - 48) + (str1[str1.size() - 1 - i] - 48) + carry;
      if((sum / 10) >= 0){
        carry = sum / 10;
        sum -= (sum / 10) * 10;
      }else{
        carry = 0;
      }
      ans.insert(ans.begin(), sum);
    }
    
    for(int i = P.first; i < P.second; i++){
      sum = (bigger->at(bigger->size() - 1 - i) - 48) + carry;
      if((sum / 10) >= 0){
        carry = sum / 10;
        sum -= (sum / 10) * 10;
      }else{
        carry = 0;
      }
      ans.insert(ans.begin(), sum);
    }

    for(int i = 0; i < ans.size(); i++){
      if(carry != 0){
        cout << carry;
        carry = 0;
      }
      cout << ans[i];
    }
    cout << endl;
  }
  return 0;
}

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

using namespace std;
void add(string& ans,string& a,string& b);
int main() {
	string a,b;
	int al,bl;
	int n;
	cin>>n;
	while(n--){
	        string ans= "";
		cin>>a>>b;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		al=a.size();
		bl=b.size();
		if(bl>al){
			swap(a,b);
			swap(al,bl);
		}
		for(int i=0;i<(al-bl);i++){
			b+='0';
		}
		add(ans,a,b);
		if(ans.size()>80) ans="overflow";
		else{
		  reverse(ans.begin(),ans.end());
		}
	  	cout<<ans<<endl;
	}
	return 0;
}
void add(string& ans,string& a,string& b){
	int x,y=0;
	for(int i= 0;i<a.size();i++){
		x=a[i]-'0'+b[i]-'0';
		if(x>=10){
			ans+= (x%10)+'0';
			y=1;
		}else{
			ans+= x+y+'0';
			y=0;
		}
	}
	if(y==1)ans+='1';
}

C++: import java.util.Scanner;
import java.math.BigInteger;

public class a0015{
    public static void main(String args[]) {
	Scanner scanner = new Scanner(System.in);
	int N = scanner.nextInt();
	for (int i = 0; i < N; i++) {
	    String a = scanner.next(), b = scanner.next();
	    BigInteger A = new BigInteger(a), B = new BigInteger(b);
	    BigInteger sum = A.add(B);
	    if ((sum.toString()).length() > 80) {
		System.out.println("overflow");
	    }
	    else {
		System.out.println(sum.toString());
	    }
	}
    }
}

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

int main () {
    int n;
    string a, b;
    
    cin >> n;
    for(int i=0;i<n;i++){
        int x[81]={0}, y[81]={0}, z[81]={0};
        
        cin >> a;
        cin >> b;
        
        reverse(a.begin(), a.end());
        reverse(b.begin(), b.end());
        
        for(int j=0;j<a.size();j++){
            x[j]=a[j]-'0';
        }
        for(int j=0;j<b.size();j++){
            y[j]=b[j]-'0';
        }
        int c=0;
        int r;
        for(int j=0;j<80;j++){
            r=x[j]+y[j]+c;
            if (r >= 10){
                z[j]=r%10;
                c=1;
            }else{
                z[j]=r;
                c=0;
            }
        }
        
//        if(z[80]==1){
//            cout << "overflow" <<endl;
//        }else{
        int j;
        for(j=79;j>=0;j--){
                if(z[j]==0){
                    continue;
                }else{
                    break;
                }
        }
        for(int k=j;k>=0;k--){
                cout<<z[k];
            }
            if(j==-1){
                cout<<0;
            }
            cout<<endl;
            
//        }
    }
    return 0;
}

C++: #include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<sstream>
#include<iostream>
using namespace std;
string str_plus(string s,string t){
    if(s == "0"&&t == "0")return "0";
    reverse(s.begin(),s.end());
    reverse(t.begin(),t.end());
    string u = "0",v;
    int n1 = s.size(),n2 = t.size();
    int k = max(n1,n2);
    while(s.size()!=k)s+='0';
    while(t.size()!=k)t+='0';
    for(int i = 0;i < k ;i++){
        u[i] += s[i] - '0' + t[i] - '0';
        if(u[i]>='9')u+="1",u[i]-=10;
        else u+="0";
    }
    reverse(u.begin(),u.end());
    bool flg = true;
    if(u == "0")return u;
    for(int i = 0;i < u.size();i++){
        if(u[i]=='0'&flg)continue;
        v+=u[i];
        flg = false;
    }

    return v;
}
int main(void){

    int n;
    cin>>n;
    while(n--){
        string s,t;
        cin>>s>>t;
        string u = str_plus(s,t);
        if(u.length()>=80)cout<<"overflow"<<endl;
        else cout<<u<<endl;
    }
    return 0;
}