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 <algorithm>
using namespace std;
 
int main() {
	int tcase;
   
	cin >> tcase;
  	while(tcase--) {
    	string A, B, C = "";
   		cin >> A >> B;
     
    	unsigned sz = max(A.size(), B.size());
    	while(A.size()<sz) A = '0' + A;
    	while(B.size()<sz) B = '0' + B;
 
    	int c = 0;
    	for(int i=sz-1; i>=0; i--) {
      	//answer
      	C += (( (A[i]-'0') + (B[i]-'0') + c ) % 10 + '0');
      	//carry
      	c = ( (A[i]-'0') + (B[i]-'0') + c ) / 10;
    	}
    	if(c>0) C += (c + '0');
     
    	reverse(C.begin(), C.end());
    	if(C.size() > 80) cout << "overflow" << endl;
    	else cout << C << endl;
  	}
  	return 0;
}

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

using namespace std;

void solve()
{
	int n;
	cin >> n;
	while(n--)
	{
		string s, t;
		cin >> s >> t;
		if(s.size() < t.size())
		{
			string temp = s;
			s = t;
			t = temp;
		}
		reverse(s.begin(), s.end());
		reverse(t.begin(), t.end());
		string ans = "";
		string buf = "0";
		for(int i = 0; i < t.size(); ++i)
		{
			int a = s[i] - '0' + t[i] - '0' + buf[0] - '0';
			if(a >= 10)
			{
				buf = "1";
			}
			ans += (char)(a % 10 + '0');
		}
		for(int i = t.size(); i < s.size(); ++i)
		{
			int a = s[i] - '0' + buf[0] - '0';
			if(a >= 10)
			{
				buf = "1";
			}
			ans += (char)(a % 10 + '0');
		}
		if(buf != "0")
		{
			ans += buf[0];
		}
		reverse(ans.begin(), ans.end());
		cout << ans << endl;
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <string>

using namespace std;

void arrangeDigits(string &str1, string &str2){
  // st1 > str2
  if(str1.length() <= str2.length()){
    string tmp = str1;
    str1 = str2;
    str2 = tmp;
  }

  string tmp2;
  for(int i=0;i<str1.length()-str2.length();i++){
    tmp2 += '0';
  }
  tmp2 += str2;
  str2 = tmp2;
  // cout << "str1: " << str1 << endl;
  // cout << "str2: " << str2 << endl;
}

int main(){
  int numDatasets;
  cin >> numDatasets;
  
  for(int i=0;i<numDatasets;i++){
    bool flag = false;
    string str1, str2;

    cin >> str1;
    //80????¶?????????´???
    if(str1.length() > 80){
      flag = true;
    }

    cin >> str2;
    //80????¶?????????´???
    if(str2.length() > 80){
      flag = true;
    }

    // ??????????????????
    arrangeDigits(str1, str2);
      
    //?¨????

    int c = 0;
    string res;

    // cout << str1.length() << endl;
    
    for(int i=0;i<str1.length();i++){
      int now;
      if((int)((char)str2[str2.size()-i-1]-'0') == -48){
	now = (int)(str1[str1.size()-i-1]-'0') + c;
      }
      else{
	now = (int)(str1[str1.size()-i-1]-'0') + (int)((char)str2[str2.size()-i-1]-'0') + c;
      }
      
      res = (char)(now%10 + '0') + res;
      c = now/10;
      // str1.pop_back();
      // str2.pop_back();
      // cout << "----" << endl;
      // cout << "i:" << i << endl;
      // cout << (int)(str1[str1.size()-i-1]-'0') << " + " << (int)(str2[str2.size()-i-1]-'0') << endl;
      // cout << "now:" << now << endl;
      // cout << "res:" << res << endl;
    }

    if(c>0){
      res = (char)(c-'0') + res;
    }
    
    if(flag == false){
      
      cout << res << endl;
    }else{
      cout << "overflow" << endl;
    }
    
  }
}

C++: //Aizu - 0015 : National Budget
#include<stdio.h>
#include<string.h>

int a[1005],b[1005];

int reverse(int *a,int l,int r)
{
	int i,t;
	for(i=l;i<=r/2;i++)
	{
		t=a[i];
		a[i]=a[l+r-i];
		a[l+r-i]=t;
	}
	return 0;
}

int main()
{
	int n,i,la,lb,lmax,c,tmp;
	char t;
	
	scanf("%d%*c",&n);		//霎灘?扈?焚?悟帥謗牙屓霓ヲ隨ヲ
	
	while(n--)		//隶。邂?	{
		la=0;		//貂?峺
		lb=0;
		c=0;
		memset(a,0,sizeof(a));
		memset(b,0,sizeof(b));
		
		while(1)	//蟄伜?謨ー蟄?		{
			t=getchar();
			if(t>='0'&&t<='9')
			{
				a[la]=t-'0';
				la++;
			}
			else if(t=='\n')
			{
				break;
			}
		}
		
		while(1)
		{
			t=getchar();
			if(t>='0'&&t<='9')
			{
				b[lb]=t-'0';
				lb++;
			}
			else if(t=='\n')
			{
				break;
			}
		}
		
		if(la>80||lb>80)		//霎灘?貅「蜃コ蛻、譁ュ
		{
			printf("overflow\n");
			return 0;
		}

		reverse(a,0,la-1);		//蜿榊髄
		reverse(b,0,lb-1);

		lmax=(la>lb)?la:lb;
		for(i=0;i<=lmax;i++)	//螟ァ謨ー蜉?ウ?		{
			tmp=a[i];
			a[i]=(tmp+b[i]+c)%10;
			c=(tmp+b[i]+c)/10;
		}

		for(i=lmax;i>=0;i--)	//霎灘?
		{
			if(a[i]!=0)
			{
				tmp=i;
				break;
			}
		}

		if(lmax+1>80)			//霎灘?貅「蜃コ蛻、譁ュ
		{
			printf("overflow\n");
			return 0;
		}

		for(i=tmp;i>=0;i--)
		{
			printf("%d",a[i]);
		}
		printf("\n");
	}
	return 0;
}