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 <string.h>
 
int main(void)
{
    unsigned char num1[100],num2[100];
    int ia,ib,i,j,k,l,num,ex,large,small;
    int size1,size2;
    int sum[100];
 
    scanf("%d",&num);//????????????????????°
 
    for (l = 0; l < num; ++l)
    {
        scanf("%s",num1);
        scanf("%s",num2);
 
        size1 = strlen(num1);
        size2 = strlen(num2);
 
        if (size2 >= size1)// ???>??????????????¨?????????????????°???
        {
            large = (size2 - 1);
            small = (size1 - 1);
        }
        else if (size1 >= size2)
        {
            large = (size1 - 1);
            small = (size2 - 1);
        }
 
        //80?????\?????§overflow
        if (large > 80)
        {
            printf("overflow\n");
            continue;
        }
 
 
        //num1?????°?????????????????????******************************************
        for(ia = 0; ia < 100; ia++)
        {
            if(num1[ia+1] == '\0')break;   //NULL?????????????????????????????????
             
            ex = num1[ia];
            num1[ia] = num1[ia+1];
            num1[ia+1] = ex;
        }
 
        for (j = ia; j > 0 ; --j) //ia?????????????????§??????????????£??????
        {
            for (k = 0; k < j-1; ++k) //????????????????????????????????£??????
                                      //??????????????¨??????????????? ?????????????????§
            {
                ex = num1[k];
                num1[k] = num1[k+1];
                num1[k+1] = ex;
            }
        }
 
        j=0;
        k=0;
 
        //num2?????°?????????????????????******************************************
        for(ib = 0; ib < 100; ib++)
        {
            if(num2[ib+1] == '\0')break;   //NULL?????????????????????????????????
             
            ex = num2[ib];
            num2[ib] = num2[ib+1];
            num2[ib+1] = ex;
        }
 
        for (j = ib; j > 0 ; --j) //ib?????????????????§??????????????£??????
        {
            for (k = 0; k < j-1; ++k) //????????????????????????????????£??????
                                      //??????????????¨??????????????? ?????????????????§
            {
                ex = num2[k];
                num2[k] = num2[k+1];
                num2[k+1] = ex;
            }
        }
 
        j=0;
        k=0;
 
 
        //??±????????????????????\???????????????
        //(large???0?????\???????????¨??????????????????????????????)
        if (ia == 0 && ib == 0)
        {
            printf("%d\n", (num1[0]-48) + (num2[0]-48));
            continue;
        }
 
        //??°??????????????\???????????????
        //??\???????¶???????????????????????????????????????????0???????´?
        if (ia != ib)
        {
            for (j = small + 1; j <= large ; ++j)
            {
                if (ia < ib)
                {
                    num1[j] = '0';
                }
                else if (ib < ia)
                {
                    num2[j] = '0';
                }
            }
        }
 
        //?????????
        for (i = 0; i <= large+1; ++i)
        {
            sum[i] = 0;
        }
 
        i = 0;
 
        for (i = 0; i <= large; ++i)
        {
            sum[i] += ((num1[i]-'0') + (num2[i]-'0'));
 
            if (sum[i] >= 10)//??????????????¢??¬??§10?¶?????????????
            {
                sum[i] -= 10;   //??????????????°????????\??????
                sum[i+1] += 1;; //??°?????????
 
                //(???)80 + 50?????????????????????????????´????????????
                if (i == large)
                {
                    large += 1;
                    break;
                }
            }
        }
 
        //?¶????????????????80????¶??????????overflow
        if (large > 80)
        {
            printf("overflow\n");
            continue;
        }
 
        for (i = large; i >= 0; --i)
        {
            printf("%d", sum[i]);
        }
        printf("\n");
 
        i = 0;
 
    }
 
    return 0;
}