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>
using namespace std;

int main() {
  int n;
  cin>>n;
  while(n--) {
    string s1,s2;
    cin >> s1 >> s2;

    int a = s1.length()-1;
    int b = s2.length()-1;
    int c = 0;
    vector<int> ans;
    for (; a>=0 || b>=0; a--, b--) {
      int s = c;
      if (a>=0) s+=s1[a]-'0';
      if (b>=0) s+=s2[b]-'0';
      c = s / 10;
      ans.push_back(s % 10);
    }
    if (c) ans.push_back(1);
    reverse(ans.begin(), ans.end());
    if (ans.size()<=80)
      for (int i=0; i<ans.size(); i++)
        cout << ans[i];
    else
      cout << "overflow";
    cout << endl;
  }
}

C++: #include <iostream>
#include <string>

using namespace std;

void sum80(int* a, int* b);
int get80(string str, int* num);

int main(void){
	string a80, b80;
	int a[81], b[81], s[81];
	char c;
	int i, N;
	cin>>N;
	i=0;
	while(i<N){
		cin>>a80;
		cin>>b80;
		if(get80(a80, a)<0 || get80(b80, b)<0){
			cout<<"overflow"<<endl;
		}else{
			sum80(a, b);
		}
		i++;
	}
	return 0;
}

int get80(string str, int* num){
	char c;
	int k;
	int d=str.length();
	if(d<=80){
		for(int i=0; i<d; i++){
			num[i]=str[d-1-i]-'0';
		}
		for(int i=d;i<81; i++){
			num[i]=0;
		}
		return d;
	}else{
		return -1;
	}

}

void sum80(int* a, int* b){
	int s[81], amari;
	amari=0;
	for(int i=0; i<81; i++){
		s[i]=(a[i]+b[i]+amari)%10;
		if(a[i]+b[i]>=10){
			amari=1;
		}else{
			amari=0;
		}
	}
	if(s[80]!=0){
		cout<<"overflow"<<endl;
	}else{
		bool flag=false;
		for(int i=79; i>=0; i--){
			if(flag==true || s[i]!=0){
				flag=true;
				cout<<s[i];
			}
		}
		cout<<endl;
	}
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  string s,n,final;
  int o,c=0,lim;
  cin>>lim;
  for(int j = 0 ; j < lim ; j++){
    cin>>s>>n;
      reverse(s.begin(),s.end());
    reverse(n.begin(),n.end());
    for(int i = 0; i < s.size() || i<n.size() || c;i++){
      o = (s.size() > i ? s[i]-'0' : 0) +(n.size() > i ? n[i]-'0' : 0) + c;
      
      //   o = (s[i]-'0')+(n[i]-'0')+c;
      c = o / 10;
      o %= 10;
      final.append(1,o+'0');
    }
    reverse(final.begin(),final.end());
    if(n.size()>=80 || s.size()>=80 || final.size()>=80) cout<<"overflow"<<endl;
    else cout<<final<<endl;
    final.clear();
  }
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <fstream>

using namespace std;

#define MAX_INT_LENGTH 80

//large integer upto 80 digits
struct largeInt{
    int vals[MAX_INT_LENGTH]; // MAX_INT_LENGTH digits
};

void toLargeInt(string str, largeInt &lv){
    int start = MAX_INT_LENGTH-str.length();
    for (int i = 0; i < MAX_INT_LENGTH; i++){
        if (i >= start)
            lv.vals[i] = (str[i-start] - '0');
        else
            lv.vals[i] = 0;
    }
}

largeInt addLargeInt(const largeInt &lv1, const largeInt &lv2){
    largeInt sum;
    int carry = 0;
    for (int i = MAX_INT_LENGTH-1; i >= 0; i--){
        int sub_sum = lv1.vals[i] + lv2.vals[i] + carry;
        sum.vals[i] = sub_sum % 10;
        carry = sub_sum / 10;
    }
    return sum;
}

string toString(const largeInt &v){
    stringstream ss;
    int i = 0;
    while (i < MAX_INT_LENGTH-1 && v.vals[i]==0) i++;
    while (i < MAX_INT_LENGTH){
        ss << v.vals[i];
        i++;
    }
    return ss.str();
}

int main()
{
    //ifstream cin("input.txt");
    
    // input data
    int n;
    cin >> n;
    for (int i = 0; i < n; i++){
        string v1,v2;
        cin >> v1 >> v2;
        largeInt lv1, lv2;
        if (v1.length()>MAX_INT_LENGTH || v2.length()>MAX_INT_LENGTH){
            cout << "overflow" << endl;
            continue;
        }
        toLargeInt(v1,lv1);
        toLargeInt(v2,lv2);
        largeInt sum = addLargeInt(lv1,lv2);
        cout << toString(sum) << endl;
    }
   return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin>>n;
  cin.ignore();
  while(n--){
    string a,b;
    getline(cin,a);
    getline(cin,b);
    int num[150] = {0},tab = 0,i = 0;
    int as = a.size()-1;
    int bs = b.size()-1;
    int nmi = min(a.size(),b.size());
    int nma = max(a.size(),b.size());
    for(int x; i<nma; i++){
      if(i<nmi){x = tab+a[as-i]+b[bs-i]-'0'*2;}
      else if(i>as){x = tab+b[bs-i]-'0';}
      else if(i>bs){x = tab+a[as-i]-'0';}
      tab = x/10;
      num[i] = x%10;
    }
    if(tab){num[nma] = tab;i++;}
    if(i>80){cout <<"overflow"<<endl;}
    else{
      for(int x=i-1; x>=0; x--){
	cout <<num[x];
      }
      cout <<endl;
    }
  }
  return 0;
}