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

#define L 10
#define MAX 100000000
#define D 8

int main() {
  string s[2];
  int n, num[2][L], sum[L], dig[D+1];
  for(int i=0; i<=D; ++i) dig[i] = i ? 10*dig[i-1] : 1;
  cin >> n;
  while(n--) {
    cin >> s[0] >> s[1];
    if(s[0].length() > 80 || s[1].length() > 80) {
      cout << "overflow" << endl;
      continue;
    }
    for(int i=0; i<2; ++i) {
      for(int j=0; j<L; ++j) num[i][j] = 0;
      int len = s[i].length();
      for(int j=0; j<len; ++j) {
        num[i][j/D] += dig[j%D]*(s[i][len-1-j] - '0');
        //cout << i << ", " << j << " "<< num[i][j/D] << endl;
      }
    }
    int carry = 0;
    for(int i=0; i<L; ++i) {
      sum[i] = num[0][i] + num[1][i] + carry;
      carry = sum[i] / MAX;
      sum[i] %= MAX;
    }
    if(carry > 0) {
      cout << "overflow" << endl;
    }else {
      string ans;
      bool st = false;
      for(int i=L-1; i>=0; --i) {
        if(sum[i] == 0 && st) {
          ans += "00000000";
        }else if(sum[i] > 0) {
          for(int j=D-1; j>=0; --j) {
            int d = (sum[i]%dig[j+1])/dig[j];
            if(d > 0 || st) {
              ans += (char)(d + '0');
              st = true;
            }
          }
        }
      }
      cout << (ans.length() ? ans : "0") << endl;
    }
  }
  return 0;
}

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

int main(){
	string a,b;
	vector<int> sum;
	int al, bl, sl;
	int n, up, num;
	cin >> n;
	for(int i=0;i<n;++i){
		cin >> a >> b;
		al = a.size()-1;
		bl = b.size()-1;
		up = 0;
		while(al >= 0 || bl >= 0){
			num = up;
			if(al>=0) num += a[al] - 48;
			if(bl>=0) num += b[bl] - 48;
			if(num > 9){
				sum.push_back(num - 10);
				up = 1;
			}else{
				sum.push_back(num);
				up = 0;
			}
			al -= 1;
			bl -= 1;
		}
		if(up == 1){
			sum.push_back(1);
		}
		sl = sum.size();
		if(sl > 80){
			cout << "overflow" << endl;
		}else{
			for(int j=sl-1;j>=0;--j){
				cout << sum[j];
			}
			cout << endl;
			sum.clear();
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
 
main(){
    int tcase, m; cin >> tcase;
    string s1, s2, s3;
    for ( int i = 0; i < tcase; i++ ){
    cin >> s1 >> s2; s3 = "";
    m = max(s1.size(), s2.size());
    while( s1.size() < m ) s1 = '0' + s1;
    while( s2.size() < m ) s2 = '0' + s2;
    int c = 0;
    for ( int i = m-1; i >= 0; i-- ){
        char ch = ((s1[i]-'0')+(s2[i]-'0')+c)%10 + '0';
        c = ((s1[i]-'0')+(s2[i]-'0')+c)/10;
        s3 += ch;
    }
    if ( c ) s3 += c+'0';
    reverse(s3.begin(), s3.end());
    while( s3.size() > 1 && s3[0] == '0' ) s3.erase(s3.begin());
    if ( s3.size() > 80 ) cout << "overflow" << endl;
    else cout << s3 << endl;
    }
}