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<cstdlib>
#include<cmath>
#include<string>
#include<sstream>
#include<iomanip>
using namespace std;
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        string first,second;
        cin>>first;
        cin>>second;
        int carry=0;
        ostringstream sout;
        sout<<setfill('0')<<setw(max(first.length(),second.length()))<<first;
        first=sout.str();
        sout.str("");
        sout<<setfill('0')<<setw(max(first.length(),second.length()))<<second;
        second=sout.str();
        string ans="";
        for(int j=first.length()-1;j>=0;j--){
           int d1,d2;
           d1=first[j]-'0';
           d2=second[j]-'0';
           int sum=d1+d2+carry;
           carry=sum/10;
           char d3=sum%10+'0';
           ans=d3+ans;
        }
        if(carry==1)ans='1'+ans;
        if(ans.length()<=80)cout<<ans<<endl;
        else cout<<"overflow"<<endl;
    }
    return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <math.h>
#include <stack>

using namespace std;

int main(){
    
    char d;
    char e;
    using namespace std;
    stack<int> st1;
    stack<int> st2;
    stack<int> st3;
    int n;
    //scanf("%d",&n);
    while((d=getchar())!='\n'){
        n=atof(&d);
    }
    
    for(int i=0; i<n; i++){
        
        while((d=getchar())!='\n'){
            //printf("a%c\n",d);
            st1.push(atof(&d));
        }
        
        //while(getchar()!='\n'){}
        
        while((e=getchar())!='\n'){
            //printf("b%c\n",e);
            st2.push(atof(&e));
        }
        int temp=0;
        int num=0;
        
        while(st1.empty() != true || st2.empty() != true){
            if(st1.empty()==true && st2.empty()!=true){
                temp+=st2.top();
                st2.pop();
            }else if(st1.empty()!=true && st2.empty()==true){
                temp+=st1.top();
                st1.pop();
            }else{
                temp+=st1.top()+st2.top();
                st1.pop();
                st2.pop();
            }
            st3.push(temp%10);
            temp=temp/10;
            num++;
        }
        if(temp!=0){
            st3.push(temp);
        }
        if(st3.size()>=80){
            printf("overflow");
        }else{
            while(st3.empty()!=true){
                cout << st3.top();
                st3.pop();
            }
        }
        printf("\n");
        
        
        
    }
    
}

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

int main() {
   int n;
   string str_a;
   string str_b;
   string sum = "";

   scanf("%d", &n);
   for(int i=0; i < n; ++i){
       cin >> str_a >> str_b;

   int id_a = str_a.size();
   int id_b = str_b.size();
   int c = 0;

   // ???????????????????????°?????????????????????
   while (id_a > 0 || id_b > 0) {
     int a = 0, b = 0;
     // int??§??°???????????????
     if (id_a > 0) a = str_a[--id_a] - '0';
     if (id_b > 0) b = str_b[--id_b] - '0';
     // ?????¨???????????°???????????????c?????????????????????????????°???????????????
     sum = to_string(((a + b + c) % 10)) + sum;
     // ?¬???????????????°????????????????¨????
     c = (a + b + c) / 10;
   }
   if (c > 0) sum = to_string(c) + sum;
   cout << sum << endl;
   }
}

C++: #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
	char num1[1002],num2[1002];
	int a1[1002],a2[1002],ans[1002];
	int i,j,n,k,l1,l2,kuriagari=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		kuriagari=0;
		for(j=0;j<1002;j++)
		{
			num1[j]='\0';
			num2[j]='\0';
			a1[j] = 0;
			a2[j] = 0;
			ans[j] = 0;
		}
		scanf("%s",num1);
		scanf("%s",num2);
		l1 = strlen(num1);
		l2 = strlen(num2);
		for(j=0;j<l1;j++)
		{
			a1[j] = num1[l1-1-j] - '0';
		}
		for(j=0;j<l2;j++)
		{
			a2[j] = num2[l2-1-j] - '0';
		}
		for(j=0;j<1002;j++)
		{
			ans[j] = (a1[j] + a2[j] + kuriagari) % 10;
			if((int)((a1[j] + a2[j] + kuriagari)/10) == 1)
			{
				kuriagari = 1;
			}
			else
			{
				kuriagari = 0;
			}
		}
		bool k=false;
		for(j=1001;j>=80;j--)
		{
			if(ans[j]!=0)
			{
				k=true;
				break;
			}
		}
		if(k)
		{
			printf("overflow\n");
			continue;
		}
		else
		{
			for(j=1001;j>=0;j--)
			{
				if(ans[j] != 0)
				{
					k = j;
					break;
				}
			}
			for(j=k;j>=0;j--)
			{
				printf("%d",ans[j]);
			}
			printf("\n");
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    string a,b,ans;
    cin >>a>>b;
    int as = a.size(),bs = b.size(),s,c,t=0;
    s = (as<bs)? bs:as;
    for(int i=0; i<s; i++){
      if(i<as && i<bs) c = a[as-i-1]+b[bs-i-1]-'0'*2+t;
      else if(i<as) c = a[as-i-1]-'0'+t;
      else if(i<bs) c = b[bs-i-1]-'0'+t;
      t = c/10;
      ans+=('0'+c%10);
    }
    if(t) ans+='1';
    if(ans.size()>80) cout <<"overflow";
    else for(int i=ans.size()-1; i>=0; i--) cout <<ans[i];
    cout <<endl;
  }
}