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(){
	int n, len, car;
	string a, b, ans;
	cin >> n;
	for(int i = 0;i < n;++i){
		car = 0;
		ans = "";
		cin >> a >> b;
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		len = max(a.length(), b.length());
		for(int i = 0;i < len;++i){
			int x, y, s;
			x = i < a.length() ? a[i] - '0' : 0;
			y = i < b.length() ? b[i] - '0' : 0;
			s = x + y + car;
			car = s / 10;
			ans += (s % 10 + '0');
		}
		if(car != 0) ans += (car + '0');
		if(ans.length() <= 80){
			reverse(ans.begin(), ans.end());
			cout << ans << endl;
		}
		else{
			cout << "overflow" << endl;
		}
	}
	return 0;
}

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

int main(){
	int n, max;
	cin >> n;
	for (int z = 0; z < n;z++) {
		string x, xx, y, yy, outp;
		cin >> x >> y;
		if (cin.eof()) { break; }
		int lengx = x.size();
		int lengy = y.size();
		
		if (lengx > 80 || lengy > 80) {
			cout << "overflow" << endl;
			continue;
		}
		
		if (lengx < lengy){
			max = lengy;
		}
		else{
			max = lengx;
		}

		int m[81], n[81], wa[81];
		for(int i=0;i<81;i++){
			m[i] = 0;
			n[i] = 0;
			wa[i] = 0;
		}

		for (int i = 0; i<lengx; i++) {
			xx = x[lengx - i - 1];
			m[i] = stoi(xx);
		}
		for (int i = 0; i<lengy; i++) {
			yy = y[lengy - i - 1];
			n[i] = stoi(yy);
		}

		for(int i = 0; i < max; i++){
			wa[i] += n[i];
			wa[i] += m[i];

			if (wa[i]>=10){
				wa[i] -= 10;
				wa[i + 1] += 1;
			}

		}
		if(wa[80] == 1){
			cout << "overflow" << endl;
			continue;
		}

		int c = max;
		if(wa[max] == 1){
			c += 1;
		}

		for(int i=0;i<c;i++){
			outp += to_string(wa[c - i -1]);
		}
		cout << outp << 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");
        }
        
        
        
    }
return 0;
    
    
}

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

int main(){
  int j;
  char s1[111] = {0};
  char tmp[111] = {0};
  char s2[111] = {0};
  char ans[111];
  int  kuri = 0 ;
  memset(ans,0,sizeof(ans));
  cin >> s1 >> s2;
  if(strlen(s1) < strlen(s2)){
      for(int i=0,j=strlen(s1)-1;i<=j;i++,j--) swap(s1[i],s1[j]);
      for(int i=0,j=strlen(s2)-1;i<=j;i++,j--) swap(s2[i],s2[j]);
      for(int i=0;i<strlen(s2);i++){
	if((s2[i] + (s1[i]%'0') + kuri) > '9'){
	  ans[i] = (s2[i] + (s1[i]%'0') + kuri)-10;
	  kuri = 1;
	}
	else {
	  ans[i] = (s2[i] + (s1[i]%'0') + kuri);
	  kuri = 0;
	}
	if(i == strlen(s2)-1 && kuri == 1) ans[i+1] = '1';
      }
      for(int i=strlen(ans)-1;i>=0;i--) cout << ans[i];
  }
  else{
    for(int i=0,j=strlen(s1)-1;i<=j;i++,j--) swap(s1[i],s1[j]);
    for(int i=0,j=strlen(s2)-1;i<=j;i++,j--) swap(s2[i],s2[j]);
    for(int i=0;i<strlen(s1);i++){
      if((s1[i] + (s2[i]%'0') + kuri) > '9'){
	ans[i] = (s1[i] + (s2[i]%'0') + kuri)-10;
	kuri = 1;
      }
      else {
	ans[i] = (s1[i] + (s2[i]%'0') + kuri);
	kuri = 0;
      }
      if(i == strlen(s1)-1 && kuri == 1) ans[i+1] = '1';
    }
    for(int i=strlen(ans)-1;i>=0;i--) cout << ans[i];
  }
  cout << endl;
}