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

int main()
{
	int n;
	cin >> n;

	for(int i=0;i<n;++i){
		string N1,N2;
		vector<int> num_line;
		cin >> N1 >> N2;

		int upper=0;
		int num;
		string longer  = N1.size() > N2.size() ? N1 : N2;
		string shorter = N1.size() < N2.size() ? N1 : N2;

		for(int i=0;i<longer.size();++i){
			if(i < shorter.size())
				num = longer[i]-'0' + shorter[i]-'0' + upper;
			else
				num = longer[i] - '0' + upper;
			
			if(num > 9){
				upper = 1;
				if(i != longer.size() -1)
					num -= 10;
			}else{
				upper = 0;
			}

			num_line.push_back(num);
		}

		for(int i = num_line.size()-1;i>=0;--i){
			cout << num_line[i] ;
		}

	}
	return 0;
}

C++: #include <stdio.h>
#include <string.h>
#define N 80

int main(void){
    char buf[N+1];
    int datas;
    int degits;
    int lint1[N+1], lint2[N+1], sum[N+1];
    int cry;
    
    scanf("%d", &datas);
    for (int n=0; n<datas; n++){
        // reset
        for (int i=0; i<N; i++) lint1[i]=lint2[i]=0;
        // input
        scanf("%s", buf);
        degits = strlen(buf);
        for (int i=0; i<degits; i++){
            lint1[degits-i-1]= buf[i]-'0';
        }
        scanf("%s", buf);
        degits = strlen(buf);
        for (int i=0; i<degits; i++){
            lint2[degits-i-1]= buf[i]-'0';
        }
        // calc
        cry=0;
        for (int i=0; i<N; i++){
            sum[i] = lint1[i]+lint2[i] + cry;
            cry = sum[i]>9 ? 1:0;
            if (cry) sum[i] -= 10;
        }
        // output
        if (cry){
            puts("overflow");
        } else {
            bool zero=true;
            if (cry) puts("1");
            for (int i=N-1; i>=0; i--){
                if (zero && sum[i] != 0) zero=false;
                if (!zero) printf("%d", sum[i], i);
            }
            printf("\n");
        }
        
    }
    
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

int N,ans[81],a,b,la,lb,up,deg;
string sta,stb;

int main(){
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>sta>>stb;
		la=sta.size();
		lb=stb.size();
		up=0;
		for(int i=0;i<max(la,lb)+1;i++){
			if(i>=la)a='0';
			else a=sta[la-1-i];
			if(i>=lb)b='0';
			else b=stb[lb-1-i];
			if(a+b+up>105){
				ans[i]=a+b+up-10-96;
				up=1;
			}
			else{
				ans[i]=a+b+up-96;
				up=0;
			}
			if(ans[i]!=0)deg=i+1;
		}
		if(deg>80)cout<<"overflow"<<endl;
		else{
			for(int i=0;i<deg;i++)cout<<ans[deg-1-i];
			cout<<endl;
		}
	}
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin >>n;
  cin.ignore();
  while(n--){
    string one;
    string two;
    string ans[200];
    getline(cin,one);
    getline(cin,two);
    int os = one.size()-1, ts = two.size()-1;
    int ls = max(os,ts), ss = min(os,ts);
    int as = 0,x,t = 0;
    for(int i=0; i<=ls; i++){
      if(i<=os && i<=ts){x = one[os-i]+two[ts-i]-'0'*2+t;}
      else if(i<=os){x = one[os-i]-'0'+t;}
      else if(i<=ts){x = two[ts-i]-'0'+t;}
      t = x/10;
      x = x%10;
      ans[i] = x+'0';
      as++;
    }
    if(t>0){ans[as+1] = t+'0';as++;}
    if(as>=80){cout <<"overflow"<<endl;}
    else{
      for(int i=as; i>=0; i--){
	cout <<ans[i];
      }
      cout <<endl;
    }
  }
  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
#define mp make_pair
#define pii pair<int,int> 
#define ff first
#define ss second

using namespace std;

int t,temp1,temp2,tempc;
char a[1000],b[1000];
char temp[1000];
int c[1000];

int addition(int n1,int n2)
{
	//printf("%d,%d ",n1,n2);
	if(n1>=n2)
	{
		if(n2!=-1)
		{
			temp1=(int)a[n1]-48;
			temp2=(int)b[n2]-48;
			tempc=temp1+temp2;
			//printf("%d,%d,%d",temp1,temp2,tempc);
			if(tempc>=10)
			{
				tempc-=10;
				c[n1]+=1;
			}
			c[n1+1]+=tempc;
			//printf("%d,%d",c[n1+1],tempc);
			addition(n1-1,n2-1);
		}
		else if(n1!=-1)
		{
			tempc=(int)a[n1]-48;
			if(tempc+c[n1+1]>=10)
			{
				c[n1+1]-=10;
				c[n1]+=1;
			}
			c[n1+1]+=tempc;
			addition(n1-1,n2);
		}
	}
	else
	{
		for(int x=0;x<max(strlen(a),strlen(b))+5;x++)
		{
			temp[x]=a[x];
			a[x]=b[x];
			b[x]=temp[x];
		}
		addition(n2,n1);
	}
}

int main()
{
	scanf("%d",&t);
	while(t--)
	{
		scanf("%s",a);
		scanf("%s",b);
		for(int x=0;x<max(strlen(a),strlen(b))+5;x++)
		{
			c[x]=0;
		}
		if(strlen(a)>80||strlen(b)>80)
		{
			printf("overflow\n");
			continue;
		}
		else
		{
			addition(strlen(a)-1,strlen(b)-1);
			//printf("%d",(int)a[1]);
			//printf("%d,%d\n",strlen(a),strlen(b));
		}
		for(int z=0;z<max(strlen(a),strlen(b))+1;z++)
		{
			if(c[z]==0&&z==0)
			continue;
			printf("%d",c[z]);
		}
		printf("\n");
	}
	return 0;
}