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(){
	string a,b,c;
	int n;
	cin>>n;
	for(int fjal=0;fjal<n;fjal++){
	cin>>a>>b;
	c.clear();
	if(a.size()<b.size())swap(a,b);
	int as=a.size();]
	while(as!=b.size())b="0"+b;
	//cout<<a<<" "<<b;
	bool kuri=false;
	for(int i=as-1;i>=0;i--){
		int _a=a[i]-'0',_b=b[i]-'0',ans=_a+_b;
		if(kuri)ans++;
		if(ans>=10){
			kuri=true;
			ans-=10;
		}
		else {kuri=false;}
		//cout<<ans<<" "<<i;
		c.push_back(ans+'0');
	}
		if(kuri)c.push_back('1');
		string ans;
		if(c.size()<80){for(int i=c.size()-1;i>=0;i--)ans.push_back(c[i]);
		cout<<ans<<endl;
		}
		else cout<<"overflow"<<endl;
	}
	return 0;
}

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

int main()
{
char n[80]={};
char m[80]={};
int p[80]={};
int q[80]={};
int k=0;
int kk=0;
int kkk=0;
int H=0;
int bi;
string str1,str2;
char x;
char y;
cin>>bi;
/*

while(1)

{scanf("%c",&x);
	if(isspace(x)!=0)break;
	n[k]=x-'0';k++;} 

while(1)
{scanf("%c",&x);
	if(isspace(x)!=0)break;
	m[k]=x-'0';kk++;} 
	*/
for(int kk=0;kk<bi;kk++)
{
	cin>>str1>>str2;
	for(int i=0;i<str1.size();i++)
		{n[i]=str1[i];
	}
	for(int i=0;i<str2.size();i++)
		m[i]=str2[i];
	kkk=str1.size();
		for(int i=0;i<kkk;i++)
		p[kkk-i-1]=n[i]-'0';


		kkk=str2.size();
	for(int i=0;i<kkk;i++)
		p[kkk-i-1]+=m[i]-'0';
	if(str2.size()<str1.size())kkk=str1.size();

	for(int i=0;i<kkk;i++)
	{
		q[i]=(H+p[i])%10;
	    H=0;
		if(p[i]/10==1)H=1;
	}

	for(int i=0;i<kkk;i++)
		cout<<q[kkk-i-1];
	cout<<endl;
}
return 0;
}

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

int main() {
int N;
cin >> N;
for (; N > 0; --N) {
int a[80] = {}, b[80] = {}, sum[80] = {};
bool co = false;
string s, t;
cin >> s >> t;
for (int i = 0; i < s.length(); ++i) a[i] = (int)(s[i] - '0');
for (int i = 0; i < t.length(); ++i) b[i] = (int)(t[i] - '0');
for (int i = 0; i < 80; ++i) {
co = ((co?1:0)+a[i]+b[i]) >= 10;
sum[i] = ((co?1:0)+a[i]+b[i])%10;
}
if (co) cout << "overflow" << endl;
else {
bool fz = true;
for (int i = 79; i >= 0; --i) {
if (fz && sum[i] != 0) {fz = false;}
if (!fz) cout << sum[i];
}
}
cout << endl;
}
return 0;
}

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

using namespace std;

void arrangeDigits(string &str1, string &str2){

  reverse(str1.begin(), str1.end());
  reverse(str2.begin(), str2.end());
  
  while(str1.size() < str2.size()){
    str1 += '0';
  }
  while(str2.size() < str1.size()){
    str2 += '0';

  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.size();i++){
      int now = c + str1[i] - '0' + str2[i] -'0';
      res += now%10 + '0';
      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;


    // cout << "c:" << c << endl;

    if(c){
      res += (c+'0');
    }

    if(res.size()>80){
      flag == true;
    }

    reverse(res.begin(), res.end());
    
    if(flag == false){
      cout << res << endl;
    }else{
      cout << "overflow" << endl;
    }
    
  }
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main() {
	int dsn; scanf("%d", &dsn);
	for(int dsi = 0; dsi < dsn; dsi++) {
		static char ais[10000],bis[10000];
		scanf("%s%s",ais,bis);
		int aislen = strlen(ais);
		int bislen = strlen(bis);
		if(aislen > 80 || bislen > 80) {
			printf("overflow\n");
			continue;
		}
		static int ad[90],bd[90];
		fill(ad,ad+90,0);
		fill(bd,bd+90,0);
		for(int i = 0; i < aislen; i++) ad[i] = ais[aislen-1-i]-'0';
		for(int i = 0; i < bislen; i++) bd[i] = bis[bislen-1-i]-'0';
		int cl = 0;
		for(int i = 0; i < 90; i++) {
			ad[i] += bd[i]+cl;
			cl = ad[i]/10;
			ad[i] %= 10;
		}
		if(ad[80]) {
			printf("overflow\n");
			continue;
		}
		bool flag = false;
		for(int i = 89; i >= 0; i--) {
			flag = flag || ad[i];
			if(flag) {
				printf("%d",ad[i]);
			}
		}
		if(!flag)printf("0");
		printf("\n");
	}
	return 0;
}