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<string>
 
using namespace std;
 
class compute
{
private:
        vector<int> sum;
        int carry, temp;
        void Init();
public:
        void calc(string s1, string s2);
};
 
void compute::Init()
{ sum.clear(); }
 
void compute::calc(string s1, string s2)
{
        Init();
        int a = s1.size();
        int b = s2.size();
 
        if(a > 80 || b > 80){ cout << "overflow" << endl; return; }
        
        a--; b--;
        carry = 0;
        
        while(a >= 0 || b >= 0){
                temp = 0;
                if(a >= 0){ temp += (s1[a]-'0'); }
                if(b >= 0){ temp += (s2[b]-'0'); }
                sum.push_back((temp+carry)%10);
                carry = (temp+carry)/10;
                a--; b--;
        }
        if(carry){ sum.push_back(carry); }
        if(sum.size() > 80){ cout << "overflow" << endl; return; }
        for(int i = sum.size()-1; i >= 0 ; i--){
                cout << sum[i]; 
        }
        cout << endl;
}
 
int main(void)
{
 
        int n;
        string s1, s2;
        compute s;
        
        cin >> n;
        
        while(n-->0){
                cin >> s1 >> s2;
                s.calc(s1, s2);
        }
 
        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[a.size()-2-l] -= 10;
						}else break;
					}
				}
			}
		}
		cout << a << endl;

		}

	return 0;
}

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(final.size()>80) cout<<"overflow"<<endl;
    else cout<<final<<endl;
    final.clear();
  }
}