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 <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

const int MAX_INPUT = 1000000;
const int ARRAY_SIZE = 11;
const int MAX_LEN = 8;
char inputA[MAX_INPUT];
char inputB[MAX_INPUT];

void toBigInt(char *str, long *r) {
    int len = strlen(str);
    int startIndex = ARRAY_SIZE - (len / MAX_LEN) - 1;

    {
        int offset = 0;
        for (int i = 0; i < ARRAY_SIZE; ++i) {
            char temp[MAX_LEN + 1] = { 0 };
            char* start = str + ((i == 0) ? 0 : offset);
            int readLen = ((len - offset) < MAX_LEN) ? len - offset : MAX_LEN;

            strncpy(temp, start, readLen);
            r[ARRAY_SIZE - i - 1] = (long)atoi(temp);
            offset += readLen;
        }
    }
}

int main() {
    while (scanf("%s\n%s", &inputA, &inputB) != EOF) {
        long a[ARRAY_SIZE] = { 0 };
        long b[ARRAY_SIZE] = { 0 };
        long r[12] = { 0 };
        int lenA = 0;
        int lenB = 0;
        const int MAX_INPUT_LEN = 80;
        lenA = strlen(&inputA[0]);
        lenB = strlen(&inputB[0]);
        if ((MAX_INPUT_LEN < lenA) || (MAX_INPUT_LEN < lenB)) {
            printf("overflow\n");
            continue;
        }

        toBigInt(inputA, a);
        toBigInt(inputB, b);
        for (int i = 0; i < ARRAY_SIZE; ++i) {
            int curRIndex = 12 - i - 1;
            r[curRIndex] += a[ARRAY_SIZE - i - 1] + b[ARRAY_SIZE - i - 1];
            const int MAX = 99999999;
            if (MAX < r[curRIndex]) {
                r[curRIndex - 1] = r[curRIndex] / (MAX + 1);
                r[curRIndex] %= (MAX + 1);
            }
        }

        {
            bool started = false;
            bool noOutput = true;
            for (int i = 0; i < 12; ++i) {
                if (!started && (0 < r[i])) {
                    started = true;
                    printf("%d", r[i]);
                    noOutput = false;
                    continue;
                }

                if (started) {
                    long temp = (r[i] == 0) ? 1 : r[i];
                    for (int j = 0; temp * pow(10, j) < 10000000; ++j) {
                        printf("0");
                    }

                    printf("%d", r[i]);
                }
            }

            if (noOutput) {
                printf("0");
            }
        }
        printf("\n");
    }

    return 0;
}

C++: #include <iostream>

int main()
{
        char a[1000], b[1000];
        int c[80], ca, cb, set, up = 0;
        std::cin >> set;

        for(int i = 0; i < set; ++i)
        {
                for(int j = 0; j < 80; ++j)
                        c[j] = 0;
                up = ca = cb = 0;
                std::cin >> a >> b;

                for(int j = 0; j < 1000; ++j)
                        if((a[j] - '0' < 0) || (a[j] - '0' > 9))
                        {
                                ca = j - 1;
                                break;
                        }

                if(ca > 79)
                {
                        std::cout << "overflow" << std::endl;
                        continue;
                }

                for(int j = 0; j < 1000; ++j)
                        if((b[j] - '0' < 0) || (b[j] - '0' > 9))
                        {
                                cb = j - 1;
                                break;
                        }

                if(cb > 79)
                {
                        std::cout << "overflow" << std::endl;
                        continue;
                }
                for(int j = 0; j < 80; ++j)
                {
                        if(ca < j && cb < j)
                        {
                                c[j] = up % 10;
                                up = up / 10;
                        }
                        else if(ca < j)
                        {
                                c[j] = (b[cb - j] - '0' + up) % 10;
                                up = (b[cb - j] - '0' +up) / 10;
                        }
                        else if(cb < j)
                        {
                                c[j] = (a[ca - j] - '0' + up) % 10;
                                up = (a[ca - j] - '0' +up) / 10;
                        }
                        else
                        {
                                c[j] = (a[ca - j] - '0' + b[cb - j] - '0' + up) % 10;
                                up = (a[ca -j] - '0' + b[cb - j] - '0' +up) / 10;
                        }
                }

                if(up > 0)
                {
                        std::cout << "overflow" << std::endl;
                        continue;
                }

                int k = 0;
                for(int j = 0; j < 80; ++j)
                        if(c[79 - j])
                        {
                                k = j;
                                break;
                        }

                if(k)
                        for(int j = k; j < 80; ++j)
                                std::cout << c[79 - j];
                else
                        std::cout << 0;
                std::cout << std::endl;
        }
        return 0;
}

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

char iota(int n){
  switch (n) {
    case 0: return '0';
    case 1: return '1';
    case 2: return '2';
    case 3: return '3';
    case 4: return '4';
    case 5: return '5';
    case 6: return '6';
    case 7: return '7';
    case 8: return '8';
    case 9: return '9';
  }
  return '0';
}

int main(){

  std::string num1;   //("10000");
  std::string num2;   //("990000");
  char sum[100]={};
  int n,i,j,flag=0,temp;

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

  for(i=0;i<n;i++){
    for(j=0;j<100;j++){
      sum[j]='\0';
    }
    std::cin >> num1 >> num2;
    if(num1.size()<num2.size()){
      num1.swap(num2);
    }
    //std::cout << num1 << std::endl;
    //std::cout << num2 << std::endl;
    for(j=0;j<num1.size();j++){
      if(j<num2.size()){
        temp = (num1[num1.size()-j-1]-'0')+(num2[num2.size()-j-1]-'0');
      }
      if(j>=num2.size()){
        temp = num1[num1.size()-j-1]-'0';
      }
      if(flag){
      ++temp;
      flag = 0;
      }
      if(temp>9){
        temp -= 10;
        flag = 1;
      }
      sum[j] = iota(temp);
    }
    if(flag){
      sum[j] = '1';
      flag = 0;
    }
    //printf("%s\n",sum);
    j=0;
    while(sum[j]!='\0'){
      ++j;
    }
    //std::cout << j <<std::endl;
    if(j>80){
      std::cout << "overflow" << std::endl;
    }else{
      while(j>0){
        printf("%c",sum[j-1]);
        --j;
      }
      std::cout << std::endl;
    }
  }
}