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++: #define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>

using namespace std;

const size_t opsize = 81, bufsize = 102;
unsigned char op1[opsize], op2[opsize];
char buf[bufsize];

bool readOp(unsigned char * op){
    memset(op, 0, opsize);
    
    fgets(buf, bufsize, stdin);
    int l = strlen(buf);
    if(l > 81) return true;

    char *p = &buf[l-2];
    for (int j = 0; j < l-1; j++) {
        op[j] = *p - '0';
        p--;
    }
    return false;
}

void printOp(unsigned char * op){
    int mh = opsize - 1;
    while(op[mh] == 0 && mh > 0) mh--;
    for(; mh >= 0; mh--){
        putchar(op[mh] + '0');
    }
    putchar('\n');
}

void plus(){
    for (int i = 0; i < opsize - 1; i++) {
        op1[i] += op2[i];
        if(op1[i] >= 10){
            op1[i] -= 10;
            op1[i+1] += 1;
        }
    }
}

int main(int argc, char const* argv[])
{
    int n;
    scanf("%d ", &n);
    for (int i = 0; i < n; i++) {
        bool overflow = false;
        overflow |= readOp(op1);
        overflow |= readOp(op2);
        if(overflow){
            puts("overflow");
            continue;
        }
        plus();
        printOp(op1);
    }
    
    return 0;
}

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

using namespace std;

int main()
{
	string str1, str2, ans;
	int n;

	cin >> n;

	for (int i=0; i<n; i++)
	{
		bool cryflag = false,	//trueのとき繰り上がり
		     overflag = false;	//trueのときoverflow
		ans.clear();
		cin >> str1 >> str2;

		int len1 = str1.size(), len2 = str2.size();

		for (int j=0, k=0; j<len1 || k<len2; j++, k++) {
			int c1 = 0, c2 = 0, c;

			if(j < len1)
				c1 = str1[len1-j-1] - '0';
			if(k < len2)
				c2 = str2[len2-k-1] - '0';

			//cout << len1 << len2;	//Debug

			c = c1 + c2;

			if(cryflag) {
				c++;
				cryflag = false;
			}

			if(c>=10)	cryflag = true;

			ans += c%10 + '0';

			//cout << len1 << len2;	//Debug

			if(ans.size() > 80 || (ans.size() == 80 && cryflag))	{
				overflag = true;
				break;
			}
		}

		if(overflag) {
			cout << "overflow";
		}
		else {
			if(cryflag)	cout << "1";
			for (int i=0; i<(int)ans.size(); i++) {
				cout << ans[ans.size()-i-1];
			}
		}

		cout << endl;
	}

	return 0;
}

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

using namespace std;

int main(void) {
	int sets;
	char input1[100], input2[100], out[100];
	int i1, i2, o, carry;
	int ic1, ic2;
	int i;

	cin >> sets;
	for(i=0;i<sets;i++) {
		scanf("%s", input1);
		scanf("%s", input2);
		for(i1=0;input1[i1] != '\0';i1++);
		for(i2=0;input2[i2] != '\0';i2++);
		i1--;i2--;o=0;carry=0;
		while(i1>=0 || i2>=0 || carry) {
			if(o > 80) { break; }
			if(i1>=0) { ic1 = input1[i1]-'0'; i1--; } else { ic1 = 0; }
			if(i2>=0) { ic2 = input2[i2]-'0'; i2--; } else { ic2 = 0; }
			if( ic1+ic2+carry < 10 ) { 
				out[o] = ic1+ic2+carry+'0';
				carry = 0;
			} else {
				out[o] = ic1+ic2+carry-10+'0';
				carry = 1;
			}
			o++;
		}
		if(o > 80) { printf("overflow"); }
		else { for(o--;o>=0;o--) { printf("%c", out[o]); } }
		printf("\n"); 
	}

	return 0;
}

C++:  #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 int main()
 {
   int N;
   cin>>N;
   while(N--)
   {
     string a,b,sum;
     cin>>a>>b;
     bool flag=false;
     if(a.length()>=80||b.length()>=80) flag=true;
     else
     {
       int up=0;
       int i;
       for(int j=0;j<a.length()/2;j++) swap(a[j],a[a.length()-j-1]);
       for(int j=0;j<b.length()/2;j++) swap(b[j],b[b.length()-j-1]);
       for(i=0;i<a.length()&&i<b.length();i++)
       {
         sum+=(((a[i]-'0')+(b[i]-'0')+up)%10)+'0'; 
         if(a[i]-'0'+b[i]-'0'+up>=10) up=1;   
         else up=0;  
       }          
       while(i<a.length()) 
       {
         sum+=((a[i]-'0'+up)%10)+'0';
         if(a[i]-'0'+up>=10) up=1; 
         else up=0;         
         i++;          
       }
       while(i<b.length()) 
       {
         sum+=((b[i]-'0'+up)%10)+'0';
         if(b[i]-'0'+up>=10) up=1; 
         else up=0;
         i++;                   
       }
       if(up==1) sum+='1';
       if(sum.length()>=80) flag=true;
     }
     if(flag) cout<<"overflow"<<endl;
     else
     {
       for(int i=sum.length()-1;i>=0;i--) cout<<sum[i];
       cout<<endl;    
     }
   }
   //while(1);      
   return 0;    
 }