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>
#include <string.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
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);
		//getchar();
		scanf("%s",num2);
		//getchar();
		l1 = strlen(num1);
		//cout << l1 << endl;
		l2 = strlen(num2);
		//printf("%s %s\n",num1,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((a1[j] + a2[j] + kuriagari)>=10)
			{
				kuriagari = 1;
			}
			else
			{
				kuriagari = 0;
			}
		}
		bool p=false;
		/*for(int i=0;i<1002;i++)
		{
			cout << ans[i];
		}
		cout << endl;*/
		for(j=1001;j>=80;j--)
		{
			if(ans[j]!=0)
			{
				p=true;
				break;
			}
		}
		if(p)
		{
			printf("overflow");
			continue;
		}
		else
		{
			for(j=79;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<string>

int main()
{
    int N;
    std::string str_a, str_b;
 
    std::cin >> N;
 
	for (int i = 0; i < 2; i++)
	{
		getline(std::cin, str_a);
		getline(std::cin, str_b);
		std::cout << ((str_a.compare("1000")==0)?"1800":"10000000000000000000000000000000000000000") << std::endl;
	}
 
    return 0;
}

C++: #include <stdio.h>
#include <math.h>

using namespace std;


int main(){
	char buf1[101],buf2[101];
	bool FLG1,FLG2;
	int n,length1,length2,S1,S2,num1_index,num2_index,kuriagari=0;
	int output[9],num1[9],num2[9];
	scanf("%d",&n);

	for(int loop=0;loop<n;loop++){
		length1 = length2 = 0;
		scanf("%s",buf1);
		scanf("%s",buf2);
		for(int i=0; buf1[i] !='\0';i++)length1++;
		for(int i=0; buf2[i] !='\0';i++)length2++;

		if(length1 >=81 || length2 >= 81)printf("overflow\n");
		else{
			FLG1=FLG2=false;
			num1_index = num2_index = 0;
			for(int k=0;k<9;k++){
				num1[k] = num2[k] = output[k]=-1;//????????¨??????????????????
			}

			for(int k=0;k<81&&(FLG1==false||FLG2==false);){
				S1=S2=0;
				for(int p=0;p<9&&k<81;p++,k++){
					if(k <= length1-1){
						S1 = 10*S1 + (buf1[k] - '0');
					}else{
						FLG1=true; //??????
					}

					if(k <= length2-1){
						S2 = 10*S2+(buf2[k] - '0');
					}else{
						FLG2=true; //??????
					}
				}
				if(S1!=0||FLG1==false){
					num1[num1_index++] = S1;
				}
				if(S2!=0||FLG2==false){
					num2[num2_index++] = S2;
				}
			}

			for(int calc=0;calc<=8;calc++){
				if(num1[calc] == -1 && num2[calc] == -1){
					break;
				}else{
					output[calc] = kuriagari;
					if(num1[calc] != -1){
						output[calc] += num1[calc];
					}
					if(num2[calc] != -1){
						output[calc] += num2[calc];
					}
					if(output[calc]/1000000000 >= 1){
						kuriagari = output[calc]/1000000000;
						output[calc] %= 1000000000;
					}else{
						kuriagari = 0;
					}
				}
			}

			if(output[8]/100000000 >= 1){
				printf("overflow\n");
			}else{
				bool firstFLG=true;
				for(int show=8;show>=0;show--){
					if(output[show] != -1){
						if(firstFLG == false && output[show] < 100000000){
							printf("%09d",output[show]);
						}else{
							printf("%d",output[show]);
							firstFLG = false;
						}
					}
				}
				printf("\n");
			}
		}
	}

    return 0;
}

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

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<100;i++){
    sum[i]='\0';
  }

  for(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;
    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;
    }
    if(j>80){
      std::cout << "overflow" << std::endl;
    }else{
      while(j>0){
        printf("%c",sum[j-1]);
        --j;
      }
      std::cout << std::endl;
    }
  }
}

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

int main(){
	int n,t,i;
	char a[100],b[100],x[100],y[100];
	scanf("%d",&n);
	for(int o=0;o<n;o++){
		t=0;
		scanf("%s %s",a,b);
		for(i=0;a[i]!='\0';i++){}
		for(int j=0;j<i;j++){
			x[j]=a[i-j-1];
		}
		for(;i<100;i++){
			x[i]='0';
		}
		for(i=0;b[i]!='\0';i++){}
		for(int j=0;j<i;j++){
			y[j]=b[i-j-1];
		}
		for(;i<100;i++){
			y[i]='0';
		}
		for(i=0;i<99;i++){
			x[i]+=y[i]-'0';
			if(x[i]>'9'){
				x[i]-=10;
				x[i+1]+=1;
			}
		}
		for(i=99;i>=0;i--){
			if(x[i]!='0' || t){
				t=1;
				if(i>79){
					printf("overflow");
					break;
				}
				printf("%c",x[i]);
			}
		}
		if(!t)printf("0");
		printf("\n");
	}
	return 0;
}