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>

int main(){

  std::string num1("10000");
  std::string num2("990000");
  int n;

  //std::cin >> n;
  n=1;

  for(int i=0;i<n;i++){
    //std::cin >> num1 >> num2;
    if(num1.size()<num2.size()){
      num1.swap(num2);
    }
    std::cout << num1 << std::endl;
    std::cout << num2 << std::endl;
  }
}

C++: #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
	char num1[1002],num2[1002];
	int a1[1002],a2[1002],ans[1002];
	int i,j,n,k,l1,l2,kuriagari=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		kuriagari=0;
		for(j=0;j<1002;j++)
		{
			num1[j]='\0';
			num2[j]='\0';
			a1[j] = 0;
			a2[j] = 0;
			ans[j] = 0;
		}
		scanf("%s",num1);
		scanf("%s",num2);
		l1 = strlen(num1);
		l2 = strlen(num2);
		for(j=0;j<l1;j++)
		{
			a1[j] = num1[l1-1-j] - '0';
		}
		for(j=0;j<l2;j++)
		{
			a2[j] = num2[l2-1-j] - '0';
		}
		for(j=0;j<1002;j++)
		{
			ans[j] = (a1[j] + a2[j] + kuriagari) % 10;
			if((int)((a1[j] + a2[j] + kuriagari)/10) == 1)
			{
				kuriagari = 1;
			}
			else
			{
				kuriagari = 0;
			}
		}
		if(ans[1000] != 0)
		{
			printf("overflow\n");
		}
		else
		{
			for(j=1001;j>=0;j--)
			{
				if(ans[j] != 0)
				{
					k = j;
					break;
				}
			}
			for(j=k;j>=0;j--)
			{
				printf("%d",ans[j]);
			}
			printf("\n");
		}
	}
	return 0;
}

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

using namespace std;

int main(void){
	stack <char> buffer;
	int a[80],n,i,j;
	char buffer2;
	cin >> n;
	scanf(" ");
	for (int i = 0; i < n; i++)
	{
		for(j=0;j<80;j++) a[j]=0;
		while(1){
			scanf("%c",&buffer2);
			if(buffer2=='\n') break;
			buffer.push(buffer2);
		}
		buffer2 = 0;
		for(j=0;!buffer.empty();j++){
			a[j]+=buffer.top()-'0';
			buffer.pop();
		}
		while(1){
			scanf("%c",&buffer2);
			if(buffer2=='\n') break;
			buffer.push(buffer2);
		}
		buffer2 = 0;
		for(j=0;!buffer.empty();j++){
			a[j]+=buffer.top()-'0';
			buffer.pop();
		}
		for(j=0;a[j]!=0;j++){
			if(a[j]>=10){
				if(j==79) goto error;
				a[j]-=10;a[j+1]++;
			}
		}
		for(j=79;a[j]==0;j--);
		for(;j>=0;j--){
			cout << a[j];
		}
		error:	cout << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
	char num1[82],num2[82];
	int a1[82],a2[82],ans[82];
	int i,j,n,k,l1,l2,kuriagari=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		for(j=0;j<82;j++)
		{
			a1[j] = 0;
			a2[j] = 0;
			ans[j] = 0;
		}
		scanf("%s",num1);
		scanf("%s",num2);
		l1 = strlen(num1);
		l2 = strlen(num2);
		for(j=0;j<l1;j++)
		{
			a1[j] = num1[l1-1-j] - '0';
		}
		for(j=0;j<l2;j++)
		{
			a2[j] = num2[l2-1-j] - '0';
		}
		for(j=0;j<82;j++)
		{
			ans[j] = (a1[j] + a2[j] + kuriagari) % 10;
			if((int)((a1[j] + a2[j] + kuriagari)/10) == 1)
			{
				kuriagari = 1;
			}
			else
			{
				kuriagari = 0;
			}
		}
		if(ans[80] != 0)
		{
			printf("overflow\n");
		}
		else
		{
			for(j=81;j>=0;j--)
			{
				if(ans[j] != 0)
				{
					k = j;
					break;
				}
			}
			for(j=k;j>=0;j--)
			{
				printf("%d",ans[j]);
			}
			printf("\n");
		}
	}
	return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        string a,b;
        int aa[81]={0},bb[81]={0};
        cin>>a>>b;
        for(int j=a.size()-1,jj=80;0<=j;j--,jj--)
            aa[jj]=a[j]-'0';
        for(int j=b.size()-1,jj=80;0<=j;j--,jj--)
            bb[jj]=b[j]-'0';
        for(int j=80;0<j;j--){
            aa[j]+=bb[j];
            aa[j-1]+=aa[j]/10,aa[j]=aa[j]%10;
        }
        if(aa[0])puts("overflow");
        else{
            int j=0;
            for(;;j++)
                if(aa[j])break;
            for(int k=j;k<=80;k++)
                printf("%d",aa[k]);
            puts("");
        }
    }
    return 0;
}

C++: #include<iostream>

using namespace std;


string solve(string s1, string s2){

while(s1.size()<85){
s1 = '0' + s1;
}
while(s2.size()<85){
s2 = '0' + s2;
}
string ret = "";
int kuri = 0;
for(int i=0;i<80;i++){
int r = (int)(s1[s1.size()-1-i]-'0' + s2[s2.size()-1-i]-'0') + kuri;
kuri = r/10;
r = r%10;
ret = ((char)('0'+r)) + ret;
}
if (kuri>0) return "overflow"; else return ret;
}

int main(void){
int N;
cin >> N;
for(int i=0i<N;i++){
string s1, s2;
cin >> s1 >> s2;
cout << solve(s1, s2) << endl;
}
return 0;
}

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

string solve(string s1, string s2){
while(s1.size()<100){
s1 = '0' + s1;
}
while(s2.size()<100){
s2 = '0' + s2;
}
string ret = "";
int kuri = 0;
for(int i=0;i<80;i++){
int r = (int)(s1[s1.size()-1-i]-'0') + (int)(s2[s2.size()-1-i]-'0') + kuri;
kuri = r/10;
r = r%10;
ret = ((char)('0'+r)) + ret;
}
if (kuri>0) return "overflow";
else{
string ret2 = "0";
for(int i=0;i<ret.size();i++){
if (ret[i]!='0'){ret2 = ret.substr(i);break;}
}
return ret2;
}
}

int main(void){
int N;
cin >> N;
for(int i=0;i<N;i++){
string s1, s2;
cin >> s1;
cin >> s2;
cout << solve(s1, s2) << endl;
}
return 0;
}