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<stdio.h>
#include<string.h>

int n;
char a[256], b[256];
int temp[100], temp2[100];

int main()
{
        std::cin >> n;
	
	while( n-- ){
		memset( temp, 0, sizeof( temp ) );
		memset( temp2, 0, sizeof( temp2 ) );
		
		std::cin >> a >> b;
		
		int maxlen = std::max( strlen( a ), strlen( b ) );
		
		if( maxlen > 80 ){
			std::cout << "overflow" << std::endl;
		 	continue;
		}
		
		for( int i = 0; i < strlen( a ); i++ ){
			temp[strlen( a ) - i - 1] = a[i] - '0';
		}
		
		for( int i = 0; i < strlen( b ); i++ ){
			temp2[strlen( b ) - i - 1] = b[i] - '0';
		}
		
		for( int i = 0; i < maxlen; i++ ){
			temp[i+1] += ( temp[i] + temp2[i] ) / 10;
			temp[i] = ( temp[i] + temp2[i] ) % 10;
		}
		
		if( temp[maxlen] ){
		 	if( maxlen + 1 > 80 ){
				std::cout << "overflow" << std::endl;
				continue;
			}
			
			std::cout << temp[maxlen];
		}
		
		for( int i = maxlen - 1; i >= 0; i-- ){
		 	std::cout << temp[i];
		}
		std::cout << std::endl;
	}

 	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include <utility>
using namespace std;
using namespace std;
int main(){
	
	int m;
	char in[2][100];
	char ans[100];
	int ie[2];
	int ien[2];
	bool max10;
	int Min;
	bool NMin;
	scanf("%d",&m);
	for(;m--;){
		
		for(int i=0;i<2;i++){
			scanf(" %s",&in[i]);
		}
		for(int i=0;i<2;i++){
			for(ie[i]=0;in[i][ie[i]]!='\0';ie[i]++){
				in[i][ie[i]]=in[i][ie[i]]-'0';
			}
		}
		ie[0]--;
		ie[1]--;
		Min=max(ie[0],ie[1]);
		if((Min>79)||((Min>78)&&(ie[0]==ie[1])&&((int(in[0][0])+int(in[1][0]))>9))){
			cout<<"overflow"<<endl;
		}else{	
			if(ie[0]>ie[1]){
				NMin=0;
			}else{
				NMin=1;
			}
			ien[0]=ie[0];
			ien[1]=ie[1];
			for(;min(ien[0],ien[1])+1;ien[0]--,ien[1]--){
				in[NMin][ien[NMin]]=in[0][ien[0]]+in[1][ien[1]];
				if(in[NMin][ien[NMin]+1]>9){
					in[NMin][ien[NMin]+1]-=10;
					in[NMin][ien[NMin]]  +=1;
				}
			}
			max10=0;
			
			for(;ien[NMin];ien[NMin]--){
				in[NMin][ien[NMin]]=in[NMin][ien[NMin]];
				if(in[NMin][ien[NMin]+1]>9){
					in[NMin][ien[NMin]+1]-=10;
					in[NMin][ien[NMin]]  +=1;
				}
			}
			for(int i=0;i<2;i++){
				for(int j=0;j<ie[i]+1;j++){
					in[i][j]=in[i][j]+'0';
				}
			}
			if(max10) cout<<"1";
			cout<<in[NMin]<<endl;
		}
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

string ans;
string s1,s2;

void Calc(int up,int indx1,int indx2){


  if(indx1==-1){
    if(up!=0){ans.insert(ans.begin(),(char)(up+(int)'0'));}
    return;
  }


  if(indx2>=0){
    int work = s1[indx1]-'0' + s2[indx2]-'0' + up;

    up = work/10;
    work = work%10;

    ans.insert(ans.begin(),(char)((int)'0'+work));
  }

  else{
    int work = s1[indx1]-'0' + up;

    up = work/10;
    work = work%10;

    ans.insert(ans.begin(),(char)((int)'0'+work));
  }


  Calc(up,indx1-1,indx2-1);
}

int main(){

  char head1,head2;
  string tmp;
  int size;
  int n;


  cin >> n;

  for(int i=0; i<n; i++){
    ans="";
    cin >> s1;
    cin >> s2;
    if(s1.size()<s2.size()){ tmp=s1;s1=s2;s2=tmp; }

    if(s1.size()>=80 || s2.size()>=80)
      cout<<"overflow"<<endl;
    else if(s1.size()>=79 && s2.size()>=79 && s1[0]-'0'+s2[0]-'0'>=10)
      cout<<"overflow"<<endl;
    else{
      Calc(0,s1.size()-1,s2.size()-1);
      cout << ans << endl;
    }
  }

  return 0;
}