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 <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;
		}
		
		
	}
	
	
	return 0;
}

C++: #include <stdio.h>
#include <string.h>

int chomp(char *str){
    int len = strlen(str);
    if(str[len-1]=='\n'){
        str[len-1] = '\0';
        len--;
    }
    return len;
}

int main(){
    int n;
    int i,j;
    int s1,s2,la,sm;
    char a1[102],a2[102],*pla,*psm,dummy[2];
    int carry,r;
    scanf("%d",&n);
    fgets(dummy,2,stdin);
    for(i=0;i<n;i++){
        fgets(a1,101,stdin);
        fgets(a2,101,stdin);
        s1 = chomp(a1);
        s2 = chomp(a2);
        if(s1<s2){
            pla = a2;
            la = s2;
            psm = a1;
            sm = s1;
        }else{
            pla = a1;
            la = s1;
            psm = a2;
            sm = s2;
        }
        carry = 0;
        for(j=0;j<la;j++){
            r = (j<sm) ? (psm[sm-j-1]-'0') : 0;
            r += (pla[la-j-1]-'0')+carry;
            carry = r/10;
            pla[la-j] = '0' + r%10;
        }
        if(carry){
            pla[0] = '1';
        }else{
            pla = (s1<s2) ? &a2[1] : &a1[1];
        }
        if(j>=80||(j==79&&carry)){
                printf("overflow\n");
                break;
        }
        printf("%s\n",pla);
    }
}

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;
			if( i < num2.size() ){
				now = (int)sum[100-i]-(int)('0') + (int)num2[num2.size()-i-1]-(int)('0') + degit;
			}else{
				now = (int)sum[100-i]-(int)('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 <stdio.h>
#include <string.h>
#include <math.h>

#define DIGIT 100000

int main(void){
	char temp[1000];
	int a[100];
	int b[100];
	int c[100];
	int t;
	int n;

	scanf("%d", &n);
	for(int i=0; i<n; i++){
		for(int k=0; k<100; k++){
			a[k] = 0;
			b[k] = 0;
			c[k] = 0;
		}
		int j;
		scanf("%s", temp);

		for(int k=0, j=strlen(temp)-1; j>=0; k++){
			for(int l=0; l<5; l++, j--){
				if(j < 0) break;
				a[k] +=	(temp[j] - '0') * pow(10, l);
			}
		}

		scanf("%s", temp);
		for(int k=0, j=strlen(temp)-1; j>=0; k++){
			for(int l=0; l<5; l++, j--){
				if(j < 0) break;
				b[k] +=	(temp[j] - '0') * pow(10, l);
			}
		}

		for(j=0; j<100; j++){
			t = a[j] + b[j] + c[j];
			c[j] = t % DIGIT;
			c[j+1] += (t / DIGIT);
		}
		
		j=99;
		while(c[j] == 0) j--;
		if(j > 15){
			printf("overflow\n");
		}else{
			printf("%d", c[j]);
			j--;
			for(; j>=0; j--){
				printf("%05d", c[j]);
			}
			printf("\n");
		}
	}

	return 0;
}

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

using namespace std;

void tasu(string s1, string s2){
	int num[2][max(s1.length(), s2.length())+1];
	for(int i = 0; i < sizeof(num[0])/sizeof(int); i++){
		if(s1.length() > i){
			num[0][i] = (int)s1.at(s1.length()-1-i) - (int)'0';
		}else{
			num[0][i] = 0;
		}
		if(s2.length() > i){
			num[1][i] = (int)s2.at(s2.length()-1-i) - (int)'0';
		}else{
			num[1][i] = 0;
		}
	}
	for(int i = 0; i < sizeof(num[0])/sizeof(int)-1; i++){
		num[1][i] += num[0][i];
		if(num[1][i] > 9){
			num[1][i+1] += (int)(num[1][i]/10);
			num[1][i] %= 10;
		}
	}
	int keta = sizeof(num[0])/sizeof(int);
	while(keta && !num[1][keta-1]){
		keta--;
	} 
	if(keta > 80){
		cout << "overflow" << endl;
	}else if(keta){
		while(keta--){
			cout << num[1][keta];
		}
		cout << endl;
	}else{
		cout << 0 << endl;
	}
}
int main(){
	int n;
	cin >> n;
	while(n--){
		string s1, s2;
		cin >> s1 >> s2;
		tasu(s1, s2);
	}
}