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<stdio.h>
#include <algorithm>
#include<string>
#include <utility>
using namespace std;
using namespace std;
int main(){
	int m;
	string in,in2;
	int a[90],b[90],ans[90];
	int f;
	int a_len,b_len,m_len;
	cin>>m;
	while(m--){
		for(int i=0;i<90;i++){
			a[i]=b[i]=ans[i]=0;
		}
		cin>>in;
		cin>>in2;
		a_len=in.size();
		b_len=in2.size();
		for(int i=0;i<a_len;i++){
			a[a_len-1-i]=in[i]-'0';
		}
		for(int i=0;i<b_len;i++){
			b[b_len-1-i]=in2[i]-'0';
		}
		m_len=max(a_len,b_len);
		if(m_len>80){
			cout<<"overflow"<<endl;
			continue;
		}
		f=0;
		for(int i=0;i<m_len+1;i++){
			ans[i]=(a[i]+b[i]+f)%10;
			f=(a[i]+b[i]+f)/10;
		}
		if(ans[m_len]!=0){
			printf("%d",ans[0]);
		}
		
		
	}
	
	
	return 0;
}

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

int main()
{
  int N;
  char str1[81];
  char str2[81];
  char s1[81];
  char s2[81];
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> str1;
    cin >> str2;
    int m1 = strlen(str1), m2 = strlen(str2);
    if(m1 > 80 || m2 > 80)
      cout << "overflow" << endl;
    else if(atoi(str1) + atoi(str2) < 2147483647 && atoi(str1) + atoi(str2) > 0)
      cout << atoi(str1) + atoi(str2) << endl; 
    else{
      if(m1 > m2){
	for(int i = 0; i < m1 - m2 + 1; i++)
	  s1[i] = '0';
	s1[m1 - m2] = '\0';
	strcat(s1, str2);
	strcpy(s2, str1);
      }else if(m2 > m1){
	for(int i = 0; i < m2 - m1; i++)
	  s2[i] = '0';
	s2[m2 - m1] = '\0';
	strcat(s2, str1);
	strcpy(s1, str2);
      }else{
	strcpy(s1, str2);
	strcpy(s2, str1);
      }
      char ans[81];
      int n = 0;
      for(int i = ((m1 > m2) ? m1 : m2) - 1; i >= 0; i--, n++)
	if((s1[i] - '0') + (s2[i] - '0') >= 10){
	  s1[i - 1] = s1[i - 1] + 1;
	  ans[i] = (s1[i]- '0') + (s2[i] - '0') + 38;
	}else
	  ans[i] = (s1[i] - '0') + (s2[i] - '0') + 48;
      ans[n] = '\0';
      if(n > 80)
	cout << "overflow" << endl;
      else{
	if((s1[0] - '0') + (s2[0] - '0') >= 10)
	  cout << "1";
	cout << ans << endl;
      }
    }
  }
}

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

string pls(string a,string b){
	string ret;
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	if(a.size()<b.size())swap(a,b);
	while(a.size()!=b.size())b+='0';
	while(a.size()+1!=ret.size())ret+='0';
	for(int i=0;i < a.size(); i++){
		ret[i] = a[i] + b[i] + ret[i] - '0'*3;
		if(ret[i]>9){
			ret[i] = '0' + ret[i]%10;
			ret[i+1] = '1';
		}else{
			ret[i]= '0' + ret[i];
		}
	}
	
	reverse(ret.begin(),ret.end());
	if(~ret.find_first_not_of('0'))return ret.substr(ret.find_first_not_of('0'),ret.size()-ret.find_first_not_of('0'));
	else return "0";
}

int main(){
	string a,b;
	int n;
	
	cin >> n;
	while(n--){
		cin >> a >> b;
		cout << pls(a,b) << endl;
	}
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include<string.h>
#include <utility>
using namespace std;
using namespace std;
int main(){
	int m;
	string in,in2;
	int a[90],b[90],ans[90];
	int f;
	int alen,blen,mlen;
	cin>>m;
	while(m--){
		for(int i=0;i<90;i++){
			a[i]=b[i]=ans[i]=0;
		}
		cin>>in;
		cin>>in2;
		alen=in.size();
		blen=in2.size();
		for(int i=0;i<alen;i++){
			a[alen-1-i]=in[i]-'0';
		}
		for(int i=0;i<blen;i++){
			b[blen-1-i]=in[i]-'0';
		}
		mlen=max(alen,blen);
		if(mlen>80){
			cout<<"overflow"<<endl;
			continue;
		}
		f=0;
		for(int i=0;i<mlen+1;i++){
			ans[i]=(a[i]+b[i]+f)%10;
			f=(a[i]+b[i]+f)/10;
		}
		if(ans[mlen]!=0){
			//if(mlen>79){
				//cout<<"overflow"<<endl;
				//continue;
			//}
			//cout<<ans[mlen];
		}
		
		for(int i=0;i<mlen;i++){
			//cout<<ans[mlen-1-i];
		}cout<<endl;
		
		
	}
	return 0;
}

C++: //0015 National Budget
//80ÜÅÌ2ÂÌ®Ì«µZÊðoÍ¹æ
//1sÚÉf[^Zbgnª^¦çêé

#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

int main(void)
{
	int n;
	cin >> n;
	while(n--)
	{
		const int N = 82;
		char a[N], b[N], c[N] = "";
		int i;

		cin >> a >> b;

		//CfbNXª¬³¢Ù¤©çºÌÉÈéæ¤É½ÎÉ·é
		reverse(a, a+strlen(a));
		reverse(b, b+strlen(b));

		bool isReadA = true, isReadB = true;
		for(i = 0; i < N; i++)
		{
			int s = 0;
			if(isReadA)
			{
				int lhv = a[i];
				if(!lhv)
					isReadA = false;
				else
					s += (lhv-'0');
			}
			if(isReadB)
			{
				int rhv = b[i];
				if(!rhv)
					isReadB = false;
				else
					s += (rhv-'0');
			}

			
			c[i] += s;
			if(c[i] >= 10)
			{
				c[i+1]++;
				c[i] -= 10;
			}
			c[i] += '0';

			if(!isReadA && !isReadB)
			{
				if(c[i] == '0')
					c[i] = '\0';
				break;
			}
		}

		reverse(c, c+strlen(c));
		cout << c << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;

int main(){
	int n;
	cin >> n;
	while( n-- > 0 ){
		string num1, num2;
		cin >> num1 >> num2;
		char sum[101];
		int degit = 0;
		for( int i = 0; i < 101; i++ ) sum[i] = '0';
		for( int i = 0; i < num1.size(); i++ ){
			sum[100-i] = num1[num1.size()-i-1];
		}
		int d;
		for( int i = 0; i < num1.size() || i < num2.size() || degit != 0; i++ ){
			int now = 3;
			/*
			if( i < num2.size() ){
				now = (int)(sum[100-i]-'0') + (int)(num2[num2.size()-i-1]-'0') + degit;
			}else{
				now = (int)(sum[100-i]-'0') + degit;
			}
			*/
			sum[100-i] = (char)(now%10)+'0';
			if( now >= 10 ) degit = 1;
			else degit = 0;
			d = i;
		}
		if( d < 80 ){
			for( int i = 100-d; i < 101; i++ ) cout << sum[i];
			cout << endl;
		}else{
			cout << "overflow" << endl;
		}
	}
}

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

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

   vector<int> V;

   for(int i = 0; i < n; i++){
     string a, b;
     int slength[2];

    
     cin >> a >> b;

     slength[0] = a.length();
     slength[1] = b.length();


     if(a.length() != 1)reverse(a.begin(), a.end());
     if(b.length() != 1)reverse(b.begin(), b.end());

     if(a.length() > b.length()){
       for(int j = 0; j < slength[0] - slength[1]; j++) b+="0";
     }else{
       for(int j = 0; j < slength[1] - slength[0]; j++) a+="0";
     }
     int flag = 0;

     for(int j = 0; j < a.length(); j++){
       if(flag){
	 a[j]++;
	 flag--;
       }
       if((a[j]+b[j]-96)/10 == 0){
	 V.push_back(a[j]+b[j]-96);
       }else{
	 flag++;
	 V.push_back((a[j]+b[j]-96)%10);
       }
     }
 
     if(flag) V.push_back(1);

     if(V.size()-1 >= 80){
       cout << "overflow" <<endl;
     }else{
       for(int j = V.size()-1; j >= 0; j--){
	 cout << V[j];
       }
       cout << endl;
     }
     V.clear();
   }  
   return 0;
}