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 <stdio.h>

#define BUF_SIZE 256

int main(void) {
	char buf[BUF_SIZE];
	int num1[80];
	int num2[80];
	int sum[81];
	char str[82];
	int n;
	int i, j, k;
	
	fgets(buf, sizeof(buf), stdin);
	sscanf(buf, "%d", &n);
	
	for (i=0; i<n; i++) {
		for (j=0; j<80; j++) {
			num1[j] = num2[j] = 0;
		}
		for (j=0; j<81; j++) {
			sum[j]=0;
		}		
		
		fgets(buf, sizeof(buf), stdin);
		sscanf(buf, "%s", &str);
		j=k=0;
		while (str[j] != '\0')  j++;
		while (--j >= 0) num1[k++] = (int)(str[j] - '0'); 
		
		fgets(buf, sizeof(buf), stdin);
		sscanf(buf, "%s", &str);
		j=k=0;
		while (str[j] != '\0')  j++;
		while (--j >= 0) num2[k++] = (int)(str[j] - '0'); 
		
		for (j=0; j<80; j++) {
			sum[j] += num1[j]+num2[j];
			if (sum[j] >= 10) {
				sum[j+1] += 1;
				sum[j] = sum[j]%10;
			}
		}
		
		if (sum[80] != 0) {
			printf("overflow\n");
		}
		else {
			j=79;
			while (sum[j] == 0)  j--;
			for (; j>=0; j--) {
				printf("%d", sum[j]);
			}
			printf("\n");
		}
	}
	
	return 0;
}

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

/** Problem0015 : National Budget **/
int main()
{
	string a, b, s;
	int n, tmp, la, lb;
	bool up=false;
	
	cin >> n;
	for (int i=0; i<n; i++) {
		cin >> a >> b;
		s="";
		
		std::reverse(a.begin(), a.end());
		std::reverse(b.begin(), b.end());
		la=(int)a.length();
		lb=(int)b.length();
		
		if (la < lb) {
			swap(la, lb);
			swap(a, b);
		}
		
		for (int i = 0; i<la-lb; i++) b+='0';
		
		for (int i=0; i<la; i++) {
			tmp = (a[i]-'0') + (b[i] - '0') + (up?1:0);
			if (tmp>=10) {
				s += '0'+tmp%10;
				up = true;
			} else {
				s += '0'+tmp;
				up = false;
			}
		}
		
		if (up)
			s+='1';
		std::reverse(s.begin(), s.end());
		if (s.length()>80)
			cout << "overflow" << endl;
		else
			cout << s << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <math.h>
#include <stack>

using namespace std;

int main(){
    
    string d;
    string e;
    
    
    int n=0;
    scanf("%d",&n);
    
    for(int i=0; i<n; i++){
        int f[81]={0};
        int g[81]={0};
        int h[81]={0};
        
        cin>>d;
        cin>>e;
        
        if((int)d.length()>80||(int)e.length()>80){
            printf("overflow\n");
        }else{
            int j=80;
            for(int i=(int)d.length()-1; i>=0; i--){
                f[j] = (d[i]-'0');
                j--;
            }
            j=80;
            for(int i=(int)e.length()-1; i>=0; i--){
                g[j] = (e[i]-'0');
                j--;
            }
            
//            for(int i=0; i<81; i++){
//                printf("%d",f[i]);
//            }
//            printf("\n");
//            
//            for(int i=0; i<81; i++){
//                printf("%d",g[i]);
//            }
//            printf("\n");
            
            int temp=0;

            for(int i=80; i>=0; i--){
                temp = temp + f[i] + g[i];
                h[i] = temp % 10;
                temp = temp / 10;
            }
            j=0;
            if(h[j]!=0){
                printf("overflow\n");
            }else{
                while(h[j]==0){
                    j++;
                }
                if(j==165){
                    printf("0");
                }else{
                    for(int i=j; i<81; i++){
                        printf("%d",h[i]);
                    }
                }
            }
            printf("\n");
        }
        
        
        
    }
    
    
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
int main(){

	int n;
	cin >> n;
	while(n > 0){
        char a[120] = {0};
        char b[120] = {0};
        scanf("%s%s",a,b);
        char ans[120] = {0};
        for(int i = 0; i < strlen(a)/2; i++){
            swap(a[i],a[strlen(a)-i-1]);
        }
        for(int i = 0; i < strlen(b)/2; i++){
            swap(b[i],b[strlen(b)-i-1]);
        }
        int len = max(strlen(a),strlen(b));
        for(int i = 0; i < len; i++){
            if(ans[i] != 0){
                if(a[i] == 0 || b[i] == 0)
                    ans[i] += a[i] + b[i] - '0';
                else ans[i] += a[i] + b[i] - '0' - '0';

            }
            else if(a[i] == 0 || b[i] == 0) ans[i] += a[i] + b[i];
            else ans[i] += a[i] + b[i] - '0';
            if(ans[i] >= 58){
                ans[i+1]+='1';
                ans[i] -= 10;
            }
        }
        for(int i = 0; i < strlen(ans)/2; i++){
            swap(ans[i],ans[strlen(ans)-i-1]);
        }
        int Len_a = 0,Len_b = 0,Len_ans = 0;
        for(int i = 0; a[i] != 0; i++) Len_a++;
        for(int i = 0; b[i] != 0; i++) Len_b++;
        for(int i = 0; ans[i] != 0; i++) Len_ans++;
        if(Len_a > 80 || Len_b > 80 || Len_ans > 80) printf("overflow");
        else for(int i = 0; ans[i] != 0; i++) printf("%c",ans[i]);
        printf("\n");
        n--;
	}

	return 0;
}

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

int main(){
	int n;
	cin >> n;
	for(int j=0;j<n;j++){
		char a[81],b[81],c[81];
		int ka = 0;
		int kb = 0;
		int kc = 0;
		bool ovf = false;
		cin >> a[ka];
		ka++;
		while(1){
			scanf("%c",&a[ka]);
			if(ka==80 and a[ka]!='\n') ovf = true;
			if(a[ka]=='\n' or ovf) break;
			ka++;
		}
		while(1){
			scanf("%c",&b[kb]);
			if(kb==80 and b[kb]!='\n') ovf = true;
			if(b[kb]=='\n' or ovf) break;
			kb++;
		}
		int k = 0;
		char t;
		for(int i=0;i<81;i++){
			if(ka<=i and kb<=i){
				if(k==1){
					sprintf(&c[i],"%d",k);
					kc++;
					if(i==80) ovf = true;
					break;
				}
			}
			int ia = 0;
			t = a[ka-i-1];
			if(ka>=i) ia = atoi(&t);
			int ib = 0;
			t = b[kb-i-1];
			if(kb>=i) ib = atoi(&t);
			int s = ia + ib + k;
			k = 0;
			if(s>9){ k = 1; s = s%10;}
			sprintf(&c[i],"%d",s);
			kc++;
		}
		if(ovf) cout << "overflow" << endl;
		else{
			for(int i=kc-1;i>=0;i--) cout << c[i];
			cout << endl;
		}
	}
}

C++: #include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
int main(){

int n;
cin>>n;
for(int iii=0;iii<n;iii++){
string st1,st2;
int n1[82]={},n2[82]={};
cin>>st1>>st2;
for(int i=0;i<st1.size();i++)
n1[i]=st1[st1.size()-i-1]-'0';
for(int i=0;i<st2.size();i++)
n2[i]=st2[st2.size()-i-1]-'0';
int N[82]={};int y=0;

int r=st1.size();
if(r<st2.size())r=st2.size();
for(int i=0;i<r;i++){
N[i]=(n1[i]+n2[i]+y)%10;
y=(n1[i]+n2[i]+y)/10;
if(i==r-1&&y>0)r++;
}
if(r>80)cout<<"overflow"<<endl;
else{
for(int i=0;i<r;i++)
cout<<N[r-i-1];
cout<<endl;
}}
return 0;
}

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

using namespace std;

int main(void){
	int n;

	cin >> n;
	for(int i=0;i<n;i++){
	}

	return 0;
}