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 <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;

int main()
{
	
	
	int t;
	scanf("%d",&t);
	for(int i=0;i<t;i++){
		string a;
		string b;

		cin >> a;
		cin >> b;	
		string res;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		int carry = 0;
		int idx;
		for(int j=0;j<min(a.size(),b.size());j++){
			int lhs = a[j] - '0';
			int rhs = b[j] - '0';
			res.push_back((carry + lhs + rhs) % 10 + '0');
			carry = (carry + lhs + rhs) / 10 ? 1 : 0;
			idx =j;
		}

		for(int j=idx+1;j<max(a.size(),b.size());j++){
			if(a.size() > b.size()){
				int lhs = a[j] - '0';
				res.push_back((carry + lhs) % 10 + '0');
				carry = (carry + lhs) / 10 ? 1 : 0;
			}
			else{
				int rhs = b[j] - '0';
				res.push_back((carry + rhs) % 10 + '0');
				carry = (carry + rhs) / 10 ? 1 : 0;
			}
		}
		if(carry) res.push_back(carry+'0');
		reverse(res.begin(),res.end());
		cout << res << endl;
	}	
}

C++: #include <stdio.h>
#include <string.h>

int main(void)
{
	char str[2][1000];
	int b, s;
	int len[2];
	int i, j;
	int n;
	int flag;
	
	scanf("%d", &n);
	
	while (n){
		for (i = 0; i < 1000; i++){
			str[0][i] = str[1][i] = 0;
		}
		s = 1;
		b = 0;
		for (i = 0; i < 2; i++){
			scanf("%s", str[i]);
			len[i] = strlen(str[i]);
		}
		
		if (len[0] > 80 || len[1] > 80){
			printf("overflow\n");
		}
		else {
			if (len[0] < len[1]){
				s = 0;
				b = 1;
			}
			
			for (i = len[b], j = len[s]; i >= 0; i--, j--){
				if (j >= 0){
					str[s][i] = str[s][j];
				}
				else {
					str[s][i] = '0';
				}
			}
			
			flag = 0;
			i = len[b];
			while (i >= 0){
				if (str[s][i] + str[b][i] - '0' + flag > '9'){
					flag = 1;
				}
				else {
					flag = 0;
				}
				i--;
			}
			
			if (flag){
				for (i = len[b]; i >= 0; i--){
					for (j = 0; j < 2; j++){
						str[j][i + 1] = str[j][i];
					}
				}
				str[0][0] = '0';
				str[1][0] = '0';
			}
			
			for (i = len[b] + flag; i >= 0; i--){
				str[b][i] += (str[s][i] - '0');
				if (str[b][i] > '9'){
					str[b][i] -= 10;
					str[b][i - 1]++;
				}
			}
			str[b][len[b] + flag] = '\0';
			
			printf("%s\n", str[b]);
		}
		
		n--;
	}
	
	return (0);
}

C++: #include<iostream>
#include<string>
#include<math.h>
using namespace std;
int main() {
	int N,a,b,c,d,f;
	int e = 0;
	string s,t,u;
	cin >> N;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 2; j++) {
			if (j == 0) {
				cin >> s;
			}
			else if (j == 1) {
				cin >> t;
			}
		}
		a = s.size();
		b = t.size();
		if (a < b) {
			c = a;
		}
		else if (a >= b) {
			c = b;
		}
		for (int k =c; k >= 0; k++) {
			d = s[c - 1] + t[c - 1];
			while (e == 1) {
				e = 0;
				d += 1;
			}
			if (d < 10) {
				u[c - k] = d;
			}
			else {
				u[c - k] = d - 10;
				e = 1;
			}
		}
		f = u.size();
		while (f > 80) {
			cout << "overflow" << endl;
			break;
		}
		while (f <= 80) {
			for (int i2 = 0; i2 < f; i2++) {
				cout<< u[f - 1 - i2];
			}
			break;
		}
	}
	return 0;
}

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

using namespace std;

int main(){
	int n,l1,l2,i;
	string a, b;
	char ans[80];
	int ia,ib,sum;
	cin>>n;
	while(n--){
		cin>>a>>b;
		if(a.length()>80 || b.length()>80){
			cout<<"overflow"<<endl;
			continue;
		}
		if(a.length()==80 || b.length()==80){
			if((int)a[0]-'0'+(int)b[0]-'0'>9){
				cout<<"overflow"<<endl;
				continue;
			}
		}
		if(a.length()<b.length()){
			swap(a,b);
		}
		l1=a.length();
		l2=b.length();
		for(i=0;i<80;i++)ans[i]=0;
		for(i=1;i<l2+1;i++){
			ia=(int)a[l1-i]-(int)'0';
			ib=(int)b[l2-i]-(int)'0';
			sum=ia+ib;
			ans[80-i]+=sum+'0';
		}
		for(i=l2+1;i<l1+1;i++){
			ans[80-i]=a[l1-i];
		}
		for(i=79;i>=0;i--){
			if(ans[i]-'0'>9 && ans[i]!=0){
				ans[i]=ans[i]-10;
				if(ans[i-1]==0)ans[i-1]+=1+'0';
				else ans[i-1]+=1;
			}
		}
		for(i=0;i<80;i++){
			if(ans[i]!=0){
				cout<<(int)ans[i]-'0';
			}
		}
		cout<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
void add(string & ,string &,string &);
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=bl;i<al;i++){
			b+='0';
		}
		add(ans,a,b);
		if(ans.size()>80){
		  printf("overflow\n");
		}else{
		  reverse(ans.begin(),ans.end());
		  cout<<ans<<endl;
		}
	  	
	}
	return 0;
}
void add(string &ans,string &a,string &b){
	int x,y=0;
	int i;
	int al=a.size();
	for(i=0;i<al;i++){
		x=a[i]-'0'+b[i]-'0';
		if((x+y)>=10){
		        ans+= ((x+y)%10)+'0';
			y=1;
		}else{
		        ans+= (x+y)+'0';
			y=0;
		}
	}
	if(y==1)ans+='1';
}