Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	n := nextInt()
	maxint, _ := new(big.Int).SetString("100000000000000000000000000000000000000000000000000000000000000000000000000000000", 10)

	for i := 0; i < n; i++ {
		aStr := nextString()
		bStr := nextString()

		a, _ := new(big.Int).SetString(aStr, 10)
		b, _ := new(big.Int).SetString(bStr, 10)
		c := big.NewInt(0).Add(a, b)

		if c.Cmp(maxint) < 0 {
			fmt.Println(c)
		} else {
			fmt.Println("overflow")
		}
	}
}

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

int main(void){
	int n;
	std::cin >> n;
	char i1[81]="",i2[81]="",res[81]="";
	for(int i=0; i<n; i++){
		bool cflag=false;
		std::string tmp;
		std::cin >> tmp;
		if(tmp.size()>80){
			cflag=true;break;
		}
		strcpy(i1,tmp.c_str());
		std::cin >> tmp;
		if(tmp.size()>80){
			cflag=true;break;
		}
		strcpy(i2,tmp.c_str());
		for(int j=0;j<80;j++){
			char c='0';
			if(cflag)
				c+=1;
			cflag=false;
			if(strlen(i1)>j){
				c+=i1[strlen(i1)-j-1]-'0';
			}
			if(strlen(i2)>j){
				c+=i2[strlen(i2)-j-1]-'0';
			}
			if(c > '9'){
				cflag=true;
				c-=10;
			}
			res[79-j]=c;
		}

		if(cflag){
			std::cout << "overflow" << std::endl;
		}else{
			char *p = res;
			while(*p++ == '0');
			std::cout << (p-1) << std::endl;
		}
	}
	return 0;
}

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

int main(void){
  string x,y;
  int tmp, c;
  int N;
  int cnt;
  cin >> N;

  for(int i = 0; i < N; i++){
    stack<int> a, b, ans;
    cnt = 0;

    cin >> x;
    cin >> y;

    for(int j = 0; j < x.length(); j++){
      a.push(x[j] - '0');
    }
    for(int j = 0; j < y.length(); j++){
      b.push(y[j] - '0');
    }

    c = 0;

    while(a.empty() != true || b.empty() != true){
      tmp = 0;
      
      if(a.empty() != true){
	tmp += a.top();
	a.pop();
      }
      if(b.empty() != true){
	tmp += b.top();
	b.pop();
      }
      tmp += c;

      ans.push(tmp % 10);
      cnt++;

      if(tmp >= 10)
	c = tmp / 10;
      else
	c = 0;
    }

    if(c != 0){
      ans.push(c);
      cnt++;
    }

    if(cnt > 80)
      cout << "overflow" << endl;
    else{
      while(ans.empty() != true){
	cout << ans.top();
	ans.pop();
      }
      cout << endl;
    }
  }
  return 0;
}

C++: #include <stdio.h>

#define DEGITS 8

void load(int a[]);
void print(int a[]);

int main(void){
    int a[DEGITS]; // a[0] = LSD
    int b[DEGITS];
    int n;
    int cry;
    
    scanf("%d", &n);
    for (int i=0; i<n; i++){
        // reset
        for (int i=0; i<DEGITS; i++){
            a[i]=b[i]=0;
        }
        // load
        load(a);
        load(b);
        // add ( a <- a + b )
        cry=0;
        for (int d=0; d<DEGITS; d++){
            a[d] += (b[d] + cry);
            cry = a[d]/10;
            if (a[d]>9){
                a[d]-=10;
            }
        }
        // print
        if (cry){
            printf("overflow\n");
        } else{
            print(a);
        }
    }

    return 0;
}

void load(int a[]){
    char *pt;
    char st[DEGITS+1];
    
    scanf("%s", st);
    for (pt=st; *pt!='\0'; pt++) ;
    for (int i=0; pt!=st; i++){
        a[i] = *(--pt)-'0';
    }
}

void print(int a[]){
    int d;
    
    for (d=DEGITS-1; d>0; d--){ 
        if (a[d] != 0) break;
    }
    for (; d>0; d--) printf("%d", a[d]);
    printf("%d\n", a[0]);
}

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

int main(){
  std::string str1,str2,sumstr;
  int n;
  std::cin>>n;
  std::vector<std::string> ans;
  while((ans.size()<n)&&std::cin>>str1>>str2){
    sumstr.clear();
    std::reverse(str1.begin(),str1.end());
    std::reverse(str2.begin(),str2.end());
    unsigned size=std::min(str1.size(),str2.size());
    unsigned i;
    unsigned carry=0;
    for(i=0;i<size;++i){
      unsigned sum=str1[i]+str2[i]+carry-'0'*2;
      sumstr.push_back(sum%10+'0');
      carry=sum/10;
    }
    std::string large=(str1.size()>str2.size())?str1:str2;
    for(;i<large.size();++i){
      unsigned sum=large[i]+carry-'0';
      sumstr.push_back(sum%10+'0');
      carry=sum/10;
    }
    if(carry)sumstr.push_back(carry+'0');
    std::reverse(sumstr.begin(),sumstr.end());
    sumstr.push_back('\0');
    ans.push_back(sumstr);
  }
  for(auto s:ans){
    if(s.size()<=81)
      std::cout<<s<<std::endl;
    else
      std::cout<<"overflow"<<std::endl;
  }
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <stack>

using namespace std;

int main (int argc, char * const argv[]) {
    // insert code here...
	int n;
    string a, b;
		
	cin>> n;	
	for(int i=0;i<n;i++){
		int x[81]={0}, y[81]={0};

		cin >> a;
		cin >> b;
		
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		
		for(int j=0;j<a.size();j++){
			x[j]=a[j]-'0';
		}
		for(int j=0;j<b.size();j++){
			y[j]=b[j]-'0';
		}
		
		for(int j=0;j<80;j++){
			x[j]=x[j]+y[j];
			if(x[j]>=10){
				x[j+1]++;
				x[j]-=10;
			}
		}
		cout << 0 << endl;
		/*
		if(x[80]>0){
			cout << "overflow" <<endl;
		}else{
			bool flag = 0;
			for(int j=79;j>=0;j--){
				if(x[j]!=0){
					cout<<x[j];
					flag=1;
				}else if(flag){
					cout<<x[j];
				}
			}
			cout<<endl;
		}
		*/
	}
	
	return 0;
}

C++: #include <stdio.h>
#include <string.h>
int main(void){
    int ap,bp,cp,t;
    char a[999],b[999],c[82];
    scanf("%d",&t);
    while(~scanf("%s%s",&a,&b)){
        ap=strlen(a);
        bp=strlen(b);
        c[cp=(ap>80||bp>80)?0:81]='\0';
        t=0;
        while((t||ap||bp)&&cp>0){
            t+=(ap?a[--ap]-'0':0)+(bp?b[--bp]-'0':0);
            c[--cp]='0'+t%10;
            t/=10;
        }
        if(cp>0)puts(&c[cp]);
        else puts("overflow");
    }
    return 0;
}

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

using namespace std;

int main(){
    
    string d;
    string e;
    
    stack<char> st1;
    stack<char> st2;
    stack<int> st3;
    int n=0;
    scanf("%d",&n);
    
    for(int i=0; i<n; i++){
        cin>>d;
        cin>>e;
        
    }
    
    for(int j=0; j<(int)(d.size()); j++){
        st1.push(d[j]);
    }
    for(int j=0; j<(int)(e.size()); j++){
        st2.push(e[j]);
    }
    int temp=0;
    char temp_char;
    while(st1.empty()==false||st2.empty()==false){
        if(st1.empty()==false&&st2.empty()==false){
            temp_char=st1.top();
            temp+=atoi(&temp_char);
            temp_char=st2.top();
            temp+=atoi(&temp_char);
            st1.pop();
            st2.pop();
        }else if(st1.empty()==false&&st2.empty()==true){
            temp_char=st1.top();
            temp+=atoi(&temp_char);
            st1.pop();
        }else if(st1.empty()==true&&st2.empty()==false){
            temp_char=st2.top();
            temp+=atoi(&temp_char);
            st2.pop();
        }
        st3.push(temp%10);
        temp=temp/10;
    }
    
    if(temp!=0){
        st3.push(temp);
    }
    
    if(st3.size()>80){
        printf("overflow");
    }else{
        while(st3.empty()==false){
            printf("%d",st3.top());
            st3.pop();
        }
    }
    
    
    printf("\n");
}