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<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
using namespace std;
char a[101];
char b[101];
char c[101];
char d[101];
int main()
{
   int n;
   scanf("%d",&n);
   while(n--)
   {
       memset(a,'0',sizeof(a));
       memset(b,'0',sizeof(b));
      scanf("%s",c);
      scanf("%s",d);
      int k1=strlen(c);
       int k2=strlen(d);
       int k=max(k1,k2);
       for(int i=0;i<k1;i++)
       {
           a[i]=c[k1-1-i];
       }
        for(int i=0;i<k2;i++)
       {
          b[i]=d[k2-1-i];
       }
       int d=0;
       for(int i=0;i<=k;i++)
       {
           int s=a[i]-'0'+b[i]-'0'+d;
           a[i]=s%10;
           d=s/10;
       }
       if(a[k]==0)
           {
               a[k]='0';
           }
       int p;
       for(int i=k;i>=0;i--)
       {
           if(i!='0')
           {
               p=i;
               break;

           }
       }
int l=0;
        if(p>80)
        {
            printf("overflow\n");
        }
        else
        {
            for(int i=k;i>=0;i--)
            {
                if(a[i]!='0')
                {
                    l=1;
                }
                if(l==1)
                {
                      printf("%d",a[i]);
                }

            }
            printf("\n");
        }
   }
}

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

int a[101] {0};
int b[101] {0};
int sum[55][101] {0};

int trans(char);

int main()
{
    int n;
    cin >> n;

    for (int i = 0; i < n; i++)
    {
        string s1, s2;
        cin >> s1 >> s2;
        int l1 = s1.length(), l2 = s2.length();
        for (int j = l1 - 1; j >= 0; j--)
        {
            a[l1-1-j] = trans(s1[j]);
        }
        for (int j = l2 - 1; j >= 0; j--)
        {
            b[l2-1-j] = trans(s2[j]);
        }

        int ll = max(l1, l2);
        for (int j = 0; j < ll; j++)
            sum[i][j] = a[j] + b[j];

        for (int j = 0; j < ll; j++)
        {
            sum[i][j+1] += sum[i][j] / 10;
            sum[i][j] %= 10;
        }


        for (int j = 0; j < 101; j++)
        {
            a[j] = 0;
            b[j] = 0;
        }

    }

    for (int i = 0; i < n; i++)
    {
        bool over = false;
        for (int j = 100; j >= 80; j--)
        {
            if (sum[i][j]>0)
            {
                over = true;
                break;
            }
        }

        if (over)
        {
            cout << "overflow" << endl;
            continue;
        }
        else
        {
            int j = 80;
            while (sum[i][j] <= 0)
                j--;
            while (j >= 0)
            {
                cout << sum[i][j];
                j--;
            }
            cout << endl;
        }
    }

    return 0;
}

int trans(char ch)
{
    switch (ch)
    {
    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;

    }
}

C++: #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main( void )
{
	while (1)
	{
		int n;
		cin >> n;
		if ( cin.eof() )
			break;
		for ( int i = 0; i < n; i++ )
		{
			string a;
			string b;
			cin >> a >> b;

			reverse( a.begin(), a.end() );
			reverse( b.begin(), b.end() );

			string::iterator it_a = a.begin();
			string::iterator it_b = b.begin();

			string kotae;
			int carry = 0;
			while ( it_a != a.end() || it_b != b.end() )
			{
				int an;
				int bn;
				if ( it_a != a.end() )
					an = ((*it_a) - '0');
				else
					an = 0;

				if ( it_b != b.end() )
					bn = ((*it_b) - '0');
				else
					bn = 0;

				int cn = an + bn + carry;
				if ( cn >= 10 )
				{
					carry = 1;
					cn %= 10;
					kotae += ('0' + cn);
				}
				else
				{
					carry = 0;
					kotae += ('0' + cn);
				}

				if ( it_a != a.end() )
					it_a++;
				if ( it_b != b.end() )
					it_b++;
			}

			if ( carry == 1 )
				kotae += '1';

			reverse( kotae.begin(), kotae.end() );

			cout << kotae << endl;

		}
	}

	return 0;
}