submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s260741101
p00015
Wrong Answer
#encoding=utf-8 x = input() for i in xrange(x): x = input() y = input() print x + y
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s321800797
p00015
Wrong Answer
#encoding=utf-8 x = input() for i in xrange(x): x = input() y = input() print str(x + y)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s279846297
p00015
Wrong Answer
# -*- coding: utf-8 -*- n = int(raw_input()) for i in range(n): a = str(raw_input()) b = str(raw_input()) if len(a) < len(b): a, b = b, a l = len(a) for j in range(len(b), len(a)): b = '0'+b sum = "" nextdigit = 0 for j in range(l): digit = int(a[l-1-j]) + int(b[l-1-j]) + nextdigit nextdigit = 0 if (nextdigit+digit) >= 10: nextdigit = 1 digit %= 10 sum = str(digit) + sum if nextdigit: sum = '1'+sum print sum
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s772463300
p00015
Wrong Answer
# -*- coding: utf-8 -*- n = int(raw_input()) ans = [] for i in range(n): a = str(raw_input()) b = str(raw_input()) if len(a) < len(b): a, b = b, a l = len(a) for j in range(len(b), len(a)): b = '0'+b sum = "" nextdigit = 0 for j in range(l): digit = int(a[l-1-j]) + int(b[l-1-j]) + nextdigit nextdigit = 0 if (nextdigit+digit) >= 10: nextdigit = 1 digit %= 10 sum = str(digit) + sum if nextdigit: sum = '1'+sum ans.append(sum) for i in ans: print i
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s127942823
p00015
Wrong Answer
# -*- coding: utf-8 -*- n = int(raw_input()) ans = [] for i in range(n): a = str(raw_input()) b = str(raw_input()) if len(a) < len(b): a, b = b, a l = len(a) for j in range(len(b), len(a)): b = '0'+b sum = "" nextdigit = 0 for j in range(l): digit = int(a[l-1-j]) + int(b[l-1-j]) + nextdigit nextdigit = 0 if (nextdigit+digit) >= 10: nextdigit = 1 digit %= 10 sum = str(digit) + sum if nextdigit: sum = '1'+sum ans.append(sum) for i in ans: print int(i)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s296730436
p00015
Wrong Answer
# -*- coding: utf-8 -*- n = int(raw_input()) ans = [] for i in range(n): a = str(raw_input()) b = str(raw_input()) if len(a) < len(b): a, b = b, a l = len(a) for j in range(len(b), len(a)): b = '0'+b sum = "" nextdigit = 0 for j in range(l): digit = int(a[l-1-j]) + int(b[l-1-j]) + nextdigit nextdigit = 0 if (nextdigit+digit) >= 10: nextdigit = 1 digit %= 10 sum = str(digit) + sum if nextdigit: sum = '1'+sum ans.append(sum) for i in ans: print i if len(i) < 80 else "overflow"
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s195059590
p00015
Wrong Answer
import math N = int(input()) for i in range(N): a = int(input()) b = int(input()) if (a != 0 and math.log10(a) > 79) or (b != 0 and math.log10(b) > 79) or (a + b != 0 and math.log10(a + b)) > 79: print("overflow") else: print(a + b)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s552455401
p00015
Wrong Answer
import math N = int(input()) for i in range(N): a = int(input()) b = int(input()) if a >= 10**79 or b >= 10 ** 79 or a + b >= 10 ** 79: print("overflow") else: print(a + b)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s511064972
p00015
Wrong Answer
import sys import itertools dataset_num = int(input()) class Overflow(Exception): pass for _ in range(dataset_num): try: k1 = input() k2 = input() k1_val = [0] * 80 k2_val = [0] * 80 if len(k1) >= 80 or len(k2) >= 80: raise Overflow() for i, x in enumerate(reversed(k1)): k1_val[i] = int(x) for i, x in enumerate(reversed(k2)): k2_val[i] = int(x) res = [0] * 80 for i in range(0, 80): res[i] += k1_val[i] + k2_val[i] if res[i] >= 10: res[i+1] += 1 res[i] -= 10 sumstr = "".join([str(x) for x in itertools.dropwhile(lambda x: x == 0, reversed(res))]) if len(sumstr) >= 80: raise Overflow() print(sumstr) except Overflow: print("overflow")
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s202824482
p00015
Wrong Answer
import sys import itertools dataset_num = int(input()) class Overflow(Exception): pass for _ in range(dataset_num): try: k1 = input() k2 = input() k1_val = [0] * 100 k2_val = [0] * 100 if len(k1) > 80 or len(k2) > 80: raise Overflow() for i, x in enumerate(reversed(k1)): k1_val[i] = int(x) for i, x in enumerate(reversed(k2)): k2_val[i] = int(x) res = [0] * 100 for i in range(0, 100): res[i] += k1_val[i] + k2_val[i] if res[i] >= 10: res[i+1] += 1 res[i] -= 10 sumstr = "".join([str(x) for x in itertools.dropwhile(lambda x: x == 0, reversed(res))]) if len(sumstr) > 80: raise Overflow() print(sumstr) except Overflow: print("overflow")
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s652204452
p00015
Wrong Answer
import sys import itertools dataset_num = int(input()) class Overflow(Exception): pass for _ in range(dataset_num): try: k1 = input() k2 = input() k1_val = [0] * 100 k2_val = [0] * 100 if len(k1) >= 80 or len(k2) >= 80: raise Overflow() for i, x in enumerate(reversed(k1)): k1_val[i] = int(x) for i, x in enumerate(reversed(k2)): k2_val[i] = int(x) res = [0] * 100 for i in range(0, 100): res[i] += k1_val[i] + k2_val[i] if res[i] >= 10: res[i+1] += 1 res[i] -= 10 sumstr = "".join([str(x) for x in itertools.dropwhile(lambda x: x == 0, reversed(res))]) if len(sumstr) >= 80: raise Overflow() print(sumstr) except Overflow: print("overflow")
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s875594951
p00015
Wrong Answer
n=int(input()) ans_list=[] for i in range(n): a=int(input()) b=int(input()) ans_list.append(a+b) for i in ans_list: print(i)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s410235213
p00015
Wrong Answer
n = int(input()) for i in range(0, n): a = int(input()) b = int(input()) if a + b > 10 ** 80: print("overflow") elif a > 10 ** 80: print("overflow") elif b > 10 ** 80: print("overflow") else : print(a + b)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s264698583
p00015
Wrong Answer
n = int(input()) for i in range(0, n): a = int(input()) b = int(input()) if len(str(a + b)) >= 80: print("overflow") elif len(str(a)) >= 80: print("overflow") elif len(str(b)) >= 80: print("overflow") else : print(a + b)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s678336141
p00015
Wrong Answer
ans = [] i = int(input()) for n in range(i): j = int(input()) k = int(input()) x = str(j + k) if len(x) >= 80: ans.append("overflow") else: ans.append(x) for n in range(i): print(ans[n])
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s797115255
p00015
Wrong Answer
i = int(input()) for n in range(i): j = int(input()) k = int(input()) if len(str(j + k)) >= 80: print("overflow") else: print(j + k)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s402176572
p00015
Wrong Answer
i = int(input()) for n in range(i): j = int(input()) k = int(input()) if len(str(j + k)) > 80: print("overflow") elif len(str(j)) or len(str(k)): print("overflow") else: print(j + k)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s659074922
p00015
Wrong Answer
i = int(input()) for n in range(i): j = int(input()) k = int(input()) if len(str(j + k)) > 80: print("overflow") elif len(str(j)) or len(str(k)) > 80: print("overflow") else: print(j + k)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s006073879
p00015
Wrong Answer
n = int(input()) for i in range(n): a = int(input()) b = int(input()) print(a+b)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s232687509
p00015
Wrong Answer
n = int(input()) for i in range(n): a = int(input()) b = int(input()) print((str(a+b)))
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s220958151
p00015
Wrong Answer
N = input() for i in range(N): a = input() b = input() if a >= 1E80 or b >= 1E80 or a+b >= 1E80: print "overflow" else: print a+b
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s388198892
p00015
Wrong Answer
def Add(numa, numb): longer = (numa if len(numa) >= len(numb) else numb) shorter = (numa if len(numa) < len(numb) else numb) carry = 0 result = '' for s in range(-1,-len(shorter) - 1, -1): ans = int(longer[s]) + int(shorter[s]) + carry if ans >= 10: result = str(ans % 10) + result carry = 1 else: result = str(ans) + result carry = 0 for l in range(-len(shorter) - 1, -len(longer) - 1, -1): ans = int(longer[l]) + carry if ans >= 10: result = str(ans % 10) + result carry = 1 else: result = str(ans) + result carry = 0 return (result if carry == 0 else '1' + result) N = eval(input()) for _ in range(N): a = input() b = input() print(Add(a, b))
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s042717079
p00015
Wrong Answer
def Add(numa, numb): longer = (numa if len(numa) >= len(numb) else numb) shorter = (numa if len(numa) < len(numb) else numb) carry = 0 result = '' for s in range(-1, -len(shorter) - 1, -1): ans = int(longer[s]) + int(shorter[s]) + carry if ans >= 10: result = str(ans % 10) + result carry = 1 else: result = str(ans) + result carry = 0 for l in range(-len(shorter) - 1, -len(longer) - 1, -1): ans = int(longer[l]) + carry if ans >= 10: result = str(ans % 10) + result carry = 1 else: result = str(ans) + result carry = 0 return (result if carry == 0 else '1' + result) N = eval(input()) for _ in range(N): a = input() b = input() print(Add(a, b))
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s378303547
p00015
Wrong Answer
def Add(numa, numb): longer = (numa if len(numa) >= len(numb) else numb) shorter = (numa if len(numa) < len(numb) else numb) carry = 0 result = '' for s in range(-1, -len(shorter) - 1, -1): ans = int(longer[s]) + int(shorter[s]) + carry if ans >= 10: result = str(ans % 10) + result carry = 1 else: result = str(ans) + result carry = 0 for l in range(-len(shorter) - 1, -len(longer) - 1, -1): ans = int(longer[l]) + carry if ans >= 10: result = str(ans % 10) + result carry = 1 else: result = str(ans) + result carry = 0 return (result if carry == 0 else '1' + result) N = eval(input()) for _ in range(N): a = input() b = input() ans = Add(a, b) print('overflow' if len(a) >= 80 or len(b) >= 80 or len(ans) >= 80 else ans)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s793821573
p00015
Wrong Answer
for _ in range(int(input())): a = int(input()) b = int(input()) s = a + b if s >= 1e79: print('overflow') else: print(s)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s040144146
p00015
Wrong Answer
for _ in range(int(input())): a = int(input()) b = int(input()) s = a + b if s >= 1e80: print('overflow') else: print(s)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s373727869
p00015
Wrong Answer
N = int(raw_input()) for i in range(N): a = int(raw_input()) b = int(raw_input()) print a + b
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s670647260
p00015
Wrong Answer
N = int(raw_input()) for i in range(N): a = int(raw_input()) b = int(raw_input()) if a + b > 10 ** 79 - 1: print "overflow" else: print a + b
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s392928565
p00015
Wrong Answer
n = int(input()) for i in range(n): a=int(input()) b=int(input()) print(a+b)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s823452760
p00015
Wrong Answer
n = int(input()) for i in range(n): s = int(input())+int(input()) if len(str(s))>=80: print("overflow") else: print(s)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s401243549
p00015
Wrong Answer
n = int(input()) for i in range(n): s = int(input())+int(input()) if len(str(s))>=10**80: print("overflow") else: print(s)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s927111043
p00015
Wrong Answer
n = input() for i in xrange(n): print long(raw_input()) + long(raw_input())
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s516466661
p00015
Wrong Answer
# ?????¶??????????±???????????????°?????? import sys def main(): n = int(sys.stdin.readline().strip()) for _ in range(n): x = int(sys.stdin.readline().strip()) y = int(sys.stdin.readline().strip()) print(x + y) if __name__ == '__main__': main()
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s724735043
p00015
Wrong Answer
# ?????¶??????????±???????????????°?????? import sys def main(): n = int(sys.stdin.readline().strip()) for _ in range(n): x = sys.stdin.readline().strip() y = sys.stdin.readline().strip() if len(x) > 80 or len(y) > 80: print('overflow') else: ans = int(x) + int(y) if len(str(ans)) > 80: print('overflow') else: print(x + y) if __name__ == '__main__': main()
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s414277576
p00015
Wrong Answer
n = input() for i in range(n): a = input() b = input() sum = a + b if str(a) > 80 or str(b) > 80 or abs(sum) > 80: print 'overflow' else: print sum
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s208946469
p00015
Wrong Answer
n = int(input()) for i in range(n): x = input() y = input() if len(x) > 80 or len(y) > 80: print("overflow") continue s = "" rx = x[::-1] ry = y[::-1] lx = len(x) ly = len(y) if lx > ly: ml = lx else: ml = ly c = 0 for j in range(ml + 1): x1 = 0 y1 = 0 if j < lx: x1 = int(rx[j]) if j < ly: y1 = int(ry[j]) c1 = x1 + y1 + c s += str(c1 % 10) c = c1 // 10 rs = s[::-1] result = "" for j in range(len(rs)): if rs[j] != "0": result = rs[j:] break if len(result) > 80: print("overflow") else: print(result)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s264422576
p00015
Wrong Answer
times=int(input()) for i in range(times): a=int(input()) b=int(input()) if int((a+b)/(1e80))!=0: print("overflow") else: print(a+b)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s194968341
p00015
Wrong Answer
times=int(input()) for i in range(times): a=int(input()) b=int(input()) if int(a/1e80)!=0 or int(b/1e80)!=0 or int((a+b)/(1e80))!=0: print("overflow") else: print(a+b)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s334932983
p00015
Wrong Answer
times=int(input()) for i in range(times): a=int(input()) b=int(input()) if len(str(a))<80 or len(str(b))<80 or len(str(a+b))<80: print(a+b) else: print("overflow")
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s238947526
p00015
Wrong Answer
times=int(input()) for i in range(times): a=int(input()) b=int(input()) if len(str(a))<80 and len(str(b))<80 and len(str(a+b))<80: print(a+b) else: print("overflow")
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s784116769
p00015
Wrong Answer
upper = 10**80 n = int(input()) for i in range(n): n1 = int(input()) if n1 >= upper: print("overflow") continue n2 = int(input()) if n2 >= upper: print("overflow") continue print( n1 + n2 if n1+n2 < upper else "overflow")
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s758682555
p00015
Wrong Answer
upper = 10**81 n = int(input()) for i in range(n): n1 = int(input()) if n1 >= upper: print("overflow") continue n2 = int(input()) if n2 >= upper: print("overflow") continue print( n1 + n2 if n1+n2 < upper else "overflow")
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s309798438
p00015
Wrong Answer
upper = 10**81 n = int(input()) for i in range(n): n1 = int(input()) n2 = int(input()) if n1 >= upper or n2 >= upper: print("overflow") continue print( n1 + n2 if n1+n2 < upper else "overflow")
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s714925361
p00015
Wrong Answer
n=int(input()) for _ in range(n): a=int(input()) b=int(input()) ab=a+b print(ab if ab<=10**80 else "overflow")
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s406397225
p00015
Wrong Answer
n=int(input()) for _ in range(n): a=int(input()) b=int(input()) ab=a+b print(ab if ab<10**79 else "overflow")
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s172646296
p00015
Wrong Answer
for _ in range(int(input())): a=int(input())+int(input()) print([a,'overflow'][a>10**80])
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s672226572
p00015
Wrong Answer
n=int(input()) for i in range(n): a=int(input()) b=int(input()) num=str(a+b) if len(num)>80: print("onerflow") else: print(num)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s817518603
p00015
Wrong Answer
import sys N=int(input()) N=int(N/2) for i in range(N): a=input() b=input() len_a=len(a) len_b=len(b) c=[] kuriage=0 if(len_a>=len_b): for i in range(len_b): c.append((kuriage+int(a[len_a-1-i])+int(b[len_b-1-i]))%10) kuriage=(kuriage+int(a[len_a-1-i])+int(b[len_b-1-i]))//10 for i in range(len_b,len_a): c.append((kuriage+int(a[len_a-1-i]))%10) kuriage=(kuriage+int(a[len_a-1-i]))//10 else : for i in range(len_a): c.append((kuriage+int(a[len_a-1-i])+int(b[len_b-1-i]))%10) kuriage=(kuriage+int(a[len_a-1-i])+int(b[len_b-1-i]))//10 for i in range(len_a,len_b): c.append((kuriage+int(b[len_b-1-i]))%10) kuriage=(kuriage+int(b[len_b-1-i]))//10 if(kuriage==1): c.append(1) if(len(c)>=80): print('overflow') else: for i in c[::-1]: print(i,end='') print('')
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s133112157
p00015
Wrong Answer
import sys N=int(input()) for i in range(N): a=input() b=input() len_a=len(a) len_b=len(b) c=[] kuriage=0 if(len_a>=len_b): for i in range(len_b): c.append((kuriage+int(a[len_a-1-i])+int(b[len_b-1-i]))%10) kuriage=(kuriage+int(a[len_a-1-i])+int(b[len_b-1-i]))//10 for i in range(len_b,len_a): c.append((kuriage+int(a[len_a-1-i]))%10) kuriage=(kuriage+int(a[len_a-1-i]))//10 else : for i in range(len_a): c.append((kuriage+int(a[len_a-1-i])+int(b[len_b-1-i]))%10) kuriage=(kuriage+int(a[len_a-1-i])+int(b[len_b-1-i]))//10 for i in range(len_a,len_b): c.append((kuriage+int(b[len_b-1-i]))%10) kuriage=(kuriage+int(b[len_b-1-i]))//10 if(kuriage==1): c.append(1) if(len(c)>=80): print('overflow') else: for i in c[::-1]: print(i,end='') print('')
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s131313149
p00015
Wrong Answer
n = int(input()) for _ in range(n): a = input() b = input() m = max(len(a), len(b)) if m > 80: print("overflow") a = list(reversed(a)) b = list(reversed(b)) t = 0 ans = [] for i in range(m): try: num_a = int(a[i]) except: num_a = 0 try: num_b = int(b[i]) except: num_b = 0 s = num_a + num_b + t if s >= 10: t = 1 s -= 10 ans.insert(0, s) else: ans.insert(0, s) t = 0 if t == 1: ans.insert(0, 1) if len(ans) > 80: print("overflow") else: print(*ans, sep="")
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s102244505
p00015
Wrong Answer
from decimal import Decimal n = int(input()) for _ in range(n): a = Decimal(input()) b = Decimal(input()) s = a + b s = str(s) if len(s) > 80: print("overflow") else: print(s)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s554279808
p00015
Wrong Answer
from decimal import Decimal n = int(input()) for _ in range(n): a = Decimal(input()) b = Decimal(input()) s = a + b s = str(s) if len(s) >= 80: print("overflow") else: print(s)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s992834995
p00015
Wrong Answer
from decimal import Decimal n = int(input()) for _ in range(n): a = input() b = input() if max(len(a), len(b)) >= 80: print("overflow") s = Decimal(a) + Decimal(b) if len(str(s)) >= 80: print("overflow") else: print(s)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s621023890
p00015
Wrong Answer
from decimal import Decimal n = int(input()) for _ in range(n): a = input() b = input() if max(len(a), len(b)) >= 80: print("overflow") continue s = Decimal(a) + Decimal(b) if len(str(s)) >= 80: print("overflow") else: print(s)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s384990948
p00015
Wrong Answer
N=int(input()) A=[] B=[] for i in range(N): a = int(input()) b = int(input()) A.append(a) B.append(b) for i in range(N): if A[i] >= 10 ** 79 or B[i] >= 10 ** 79: print("overflow") elif A[i] + B[i]>= 10 ** 79: print("overflow") else: print(A[i]+B[i])
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s503839163
p00015
Wrong Answer
N=int(input()) A=[] B=[] for i in range(N): a = int(input()) b = int(input()) A.append(a) B.append(b) for i in range(N): if A[i] >= 10 ** 79 or B[i] >= 10 ** 79: print("overflow") elif A[i] + B[i]>= 10 ** 79: print("overflow") else: print(str(A[i]+B[i]))
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s082510413
p00015
Wrong Answer
N = int(input()) import re for _ in [0]*N: a = tuple(map(int, input().zfill(100))) b = tuple(map(int, input().zfill(100))) result = [] prev = 0 for i in range(1, 80): n = int(a[-i]) + int(b[-i]) + prev result.append(n%10) prev = n // 10 if a[-81] + b[-81] + prev > 0: print("overflow") else: print(re.sub(r"^0+", "", "".join(map(str, result[::-1]))))
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s090449140
p00015
Wrong Answer
N = int(input()) import re for _ in [0]*N: a = tuple(map(int, input().zfill(100))) b = tuple(map(int, input().zfill(100))) result = [] prev = 0 for i in range(1, 81): n = int(a[-i]) + int(b[-i]) + prev result.append(n%10) prev = n // 10 if a[-81] + b[-81] + prev > 0: print("overflow") else: print(re.sub(r"^0+", "", "".join(map(str, result[::-1]))))
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s291549423
p00015
Wrong Answer
N = int(input()) import re for _ in [0]*N: a = input().zfill(100) b = input().zfill(100) result = [] prev = 0 for i in range(1, 81): n = int(a[-i]) + int(b[-i]) + prev result.append(n%10) prev = n // 10 if int(a[-81]) + int(b[-81]) + prev > 0 or int(a[:20]) + int(b[:20]) > 0: print("overflow") else: print(re.sub(r"^0+", "", "".join(map(str, result[::-1]))))
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s954316361
p00015
Wrong Answer
N = int(input()) import re for _ in [0]*N: a = input().zfill(100) b = input().zfill(100) result = [] prev = 0 for i in range(1, 81): n = int(a[-i]) + int(b[-i]) + prev result.append(n%10) prev = n // 10 if prev > 0 or int(a[:21]) + int(b[:21]) > 0: print("overflow") else: result = "".join(map(str, result[::-1])) print(int(result))
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s506206210
p00015
Wrong Answer
if __name__ == '__main__': n = (int)(input()) for _ in range(n): sNumber = (int)(input()) tNumber = (int)(input()) uNumber = sNumber+tNumber print("over flow" if uNumber > 10**80 else uNumber)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s448572492
p00015
Wrong Answer
for i in range(int(input())): try: a = sum([int(j) for j in input().split()]) except: print("overflow") else: print(a)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s359727387
p00015
Wrong Answer
for i in range(int(input())): try: a = int32(sum([int32(j) for j in input().split()])) except: print("overflow") else: print(a)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s905885095
p00015
Wrong Answer
for i in range(int(input())): a = sum([int(j) for j in input().split()]) if a > 2147483647: print("overflow") else: print(a)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s747075574
p00015
Wrong Answer
for i in range(int(input())): a = int(input()) + int(input()) if a > 2147483647: print("overflow") else: print(a)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s546176630
p00015
Wrong Answer
for i in range(int(input())): a = int(input()) b = int(input()) if a + b > 2147483647: print("overflow") else: print(a)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s729090802
p00015
Wrong Answer
n = int(input()) for _ in range(n): a = input() if len(str(a)) > 80: print("overflow") continue b = input() if len(str(b)) > 80: print("overflow") continue c = int(a) + int(b) if len(str(c)) > 80: print("overflow") else: print(c)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s611678059
p00015
Wrong Answer
n = int(input()) for _ in range(n): a = input() if len(a) > 80: print("overflow") continue b = input() if len(b) > 80: print("overflow") continue c = int(a) + int(b) if len(str(c)) > 80: print("overflow") else: print(c)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s794505222
p00015
Wrong Answer
# coding:utf-8 syako = [] try: while True: number = int(raw_input()) if number != 0: syako.append(number) elif number == 0: print syako.pop() except: pass
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s669382638
p00015
Wrong Answer
n = int(raw_input()) for i in range(0,n): #a,b=map(int,raw_input().splitlines()) a = int(raw_input()) b = int(raw_input()) sum = a+b if len(str(sum)) < 80: print sum else: print "overflow"
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s132276031
p00015
Wrong Answer
n = int(input()) for i in range(n): x = int(input()) y = int(input()) ans = x + y if(ans <= 10**80): print(ans) else: print("overflow")
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s006505117
p00015
Wrong Answer
from collections import deque """ # Too slow def add2(a, b): a, b = align_digit(a, b) zipped = zip(a[::-1], b[::-1]) carry = 0 result = [] for a, b in zipped: s = int(a) + int(b) + carry carry = int(s / 10) result.append(str(s % 10)) if result[-1] == '0': result[-1] = str(carry) print(''.join(result[::-1])) """ def align_digit(a, b): la, lb = len(a), len(b) if la < lb: a = a.zfill(lb) elif lb < la: b = b.zfill(la) return a, b def split_to_ints(s, n=10): length = len(s) return reversed([int(s[i:i + n]) for i in range(0, length, n)]) def add(a, b, n=10): a, b = align_digit(a, b) ints_a = split_to_ints(a, n) ints_b = split_to_ints(b, n) carry = 0 result = deque() zipped = list(zip(ints_a, ints_b)) for i, (int_a, int_b) in enumerate(zipped): s = int_a + int_b + carry carry = int(s / (10 ** n)) if i != len(zipped) - 1: result.append(str(s % (10 ** (n - 1))).zfill(n)) else: result.append(str(s)) i += 1 return str(int(''.join(result))) if __name__ == '__main__': n_input = int(input()) for i in range(n_input): a, b = input(), input() #print(a + b) print(add(a, b))
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s185996628
p00015
Wrong Answer
from collections import deque """ # Too slow def add2(a, b): a, b = align_digit(a, b) zipped = zip(a[::-1], b[::-1]) carry = 0 result = [] for a, b in zipped: s = int(a) + int(b) + carry carry = int(s / 10) result.append(str(s % 10)) if result[-1] == '0': result[-1] = str(carry) print(''.join(result[::-1])) """ def align_digit(a, b): la, lb = len(a), len(b) if la < lb: a = a.zfill(lb) elif lb < la: b = b.zfill(la) return a, b def split_to_ints(s, n=10): length = len(s) return reversed([int(s[i:i + n]) for i in range(0, length, n)]) def add(a, b, n=10): a, b = align_digit(a, b) ints_a = split_to_ints(a, n) ints_b = split_to_ints(b, n) carry = 0 result = deque() zipped = list(zip(ints_a, ints_b)) for i, (int_a, int_b) in enumerate(zipped): s = int_a + int_b + carry carry = int(s / (10 ** n)) if i != len(zipped) - 1: result.append(str(s % (10 ** (n - 1))).zfill(n)) else: result.append(str(s)) i += 1 ret = str(int(''.join(result))) if len(ret) > 80: return 'overflow' return ret if __name__ == '__main__': n_input = int(input()) for i in range(n_input): a, b = input(), input() print(add(a, b))
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s715020512
p00015
Wrong Answer
n = int(raw_input()) for i in range(0, n): x = int(raw_input()) y = int(raw_input()) print x+y
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s970426943
p00015
Wrong Answer
n = int(raw_input()) for i in range(0, n): x = int(raw_input()) y = int(raw_input()) sum = str(x+y) if len(sum) >= 80: print 'overflow' else: print sum
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s973335784
p00015
Wrong Answer
#!/bin/python def largeBudget(a, b): if a+b > 10e+80: print("overflow") else: print("%d"%(a+b)) N = int(input()) for i in range(N): a = int(input()) b = int(input()) largeBudget(a, b)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s234680311
p00015
Wrong Answer
def largeBudget(a, b): if a > 1e+80 or b > 1e+80: print("overflow") elif a+b > 1e+80: print("overflow") else: print("%d"%(a+b)) N = int(input()) for i in range(N): a = int(input()) b = int(input()) largeBudget(a, b)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s461162936
p00015
Wrong Answer
#!/usr/bin/python #-*- coding:utf-8 -*- def largeBudget(a, b): if a >= 1e+80 or b >= 1e+80: print("overflow") elif a+b >= 1e+80: print("overflow") else: print("%d"%(a+b)) N = int(input()) for i in range(N): a = int(input()) b = int(input()) largeBudget(a, b)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s637734872
p00015
Wrong Answer
#!/usr/bin/python #-*- coding:utf-8 -*- def largeBudget(a, b): if a >= 1e+79 or b >= 1e+79: print("overflow") elif a+b >= 1e+79: print("overflow") else: print("%d"%(a+b)) N = int(input()) for i in range(N): a = int(input()) b = int(input()) largeBudget(a, b)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s430931071
p00015
Wrong Answer
#!/usr/bin/python #-*- coding:utf-8 -*- lim = 1000000000000000000000000000000000000000000000000000000000000000000000000000000 def largeBudget(a, b): if a >= lim or b >= lim: print("overflow") elif a+b >= lim: print("overflow") else: print("%d"%(a+b)) N = int(input()) for i in range(N): a = int(input()) b = int(input()) largeBudget(a, b)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s359549821
p00015
Wrong Answer
count = int(input()) for a in range(count): q,w =int(input()),int(input()) t=q+w if t >10**80: print "overflow" else: print t
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s730830078
p00015
Wrong Answer
for i in range(int(input())): a=int(input()) ; b = int(input()) ; print a+b
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s143969627
p00015
Wrong Answer
line_num = int(raw_input()) for n in range(line_num): a = raw_input() b = raw_input() if len(a) > 80 or len(b) > 80: print 'overflow' filled_a, filled_b = a.zfill(80), b.zfill(80) rlist_a = map(int,list(filled_a)[::-1]) rlist_b = map(int,list(filled_b)[::-1]) rlist_sum = [] for n in range(80): rlist_sum.append(rlist_a[n]+rlist_b[n]) for n in range(79): if rlist_sum[n] > 9: rlist_sum[n] -= 10 rlist_sum[n+1] += 1 if rlist_sum[79] > 9: print 'overflow' list_sum = [] f = 0 for n in rlist_sum[::-1]: if f > 0: list_sum.append(n) else: if n > 0: f = 1 list_sum.append(n) print ''.join(map(str,list_sum))
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s008808724
p00015
Wrong Answer
line_num = int(raw_input()) for n in range(line_num): a = raw_input() b = raw_input() ov = 0 if len(a) > 80 or len(b) > 80: print 'overflow' ov = 1 filled_a, filled_b = a.zfill(80), b.zfill(80) rlist_a = map(int,list(filled_a)[::-1]) rlist_b = map(int,list(filled_b)[::-1]) rlist_sum = [] for n in range(80): rlist_sum.append(rlist_a[n]+rlist_b[n]) for n in range(79): if rlist_sum[n] > 9: rlist_sum[n] -= 10 rlist_sum[n+1] += 1 if rlist_sum[79] > 9: if ov < 1: print 'overflow' else: list_sum = [] f = 0 for n in rlist_sum[::-1]: if f > 0: list_sum.append(n) else: if n > 0: f = 1 list_sum.append(n) print ''.join(map(str,list_sum))
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s381625466
p00015
Wrong Answer
n=input() for i in xrange(n): a=input() b=input() sum=a+b if sum>10**80: print "overflow" else : print sum
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s884719966
p00015
Wrong Answer
n=input() for i in xrange(n): a=input() b=input() sum=a+b if sum>=10**79: print "overflow" else : print sum
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s543576288
p00015
Wrong Answer
n=input() for i in range(n): a=input() b=input() print a+b
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s496969154
p00015
Wrong Answer
def datasets(): import sys for i in range(int(sys.stdin.readline().strip())): s1 = sys.stdin.readline().strip() s2 = sys.stdin.readline().strip() yield s1, s2 for s1, s2 in datasets(): if len(s1)>80 or len(s2)>80: print "overflow" continue print int(s1)+int(s2)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s138905846
p00015
Wrong Answer
for i in range(int(raw_input())): x = int(raw_input()) y = int(raw_input()) print x+y
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s015970354
p00015
Wrong Answer
from __future__ import (absolute_import, division, print_function, unicode_literals) from sys import stdin n = int(stdin.readline()) while n: result = long(stdin.readline()) + long(stdin.readline()) if len(str(result)) >= 80: print('overflow') else: print(result) n -= 1
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s593262914
p00015
Wrong Answer
''' Created on Mar 21, 2013 @author: wukc ''' from sys import stdin n=int(stdin.readline()) for i in range(n): a,b=[stdin.readline().strip().lstrip("0") for k in range(2)] if len(a)>80 or len(b)>80: print("overflow") continue a,b=a.rjust(len(b),'0'),b.rjust(len(a),'0') ans=[] c=0 for x,y in zip(a[::-1],b[::-1]): t=int(x)+int(y)+c c=t//10 ans+=[t%10] ans+=[c] ans="".join(map(str,ans[::-1])).lstrip("0") if len(ans)>80: print("overflow") continue print(ans)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s029423768
p00015
Wrong Answer
for val in xrange(0,input()): a = input() b = input() c = a+b if len(str(a)) > 80 and len(str(b)) > 80 and len(str(c)) > 80: print c else: print 'overflow'
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s050178732
p00015
Wrong Answer
c = int(raw_input()) for i in range(c): a = int(raw_input()) if a == 1: break b = int(raw_input()) print "%d" % (a+b)
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s878994225
p00015
Wrong Answer
c = int(raw_input()) for i in range(c): a = int(raw_input()) if a == 1: break b = int(raw_input()) print "%s" % (str(a+b))
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s070321712
p00015
Wrong Answer
n=input() for i in range(n): x=input() y=input() print x+y
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s328478866
p00015
Wrong Answer
n = int(raw_input()) for i in range(0,n): a = int(raw_input()) b = int(raw_input()) ans = str(a+b) if len(ans) > 80: print 'overflow' else: print sum
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s513430940
p00015
Wrong Answer
n = int(raw_input()) for _ in range(n): print int(raw_input()) + int(raw_input())
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s596224407
p00015
Wrong Answer
for x in range(input()): x = input() + input() print("{:.80g}".format(x) if x < 1E79 else "overflow")
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s524554652
p00015
Wrong Answer
for x in range(input()): x = input() + input() print x if len(str(x)) < 80 else "overflow"
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>
s274106585
p00015
Wrong Answer
for x in range(input()): a = input() + input() print a if len(str(a)) < 80 else "overflow"
6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000
1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow
<H1>National Budget</H1> <p> A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. </p> <p> Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. </p> <p> If given integers or the sum have more than 80 digits, print "overflow". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets <var>N</var> (1 &le; <var>N</var> &le; 50) is given. Each dataset consists of 2 lines: </p> <pre> The first integer The second integer </pre> <p> The integer has at most 100 digits. </p> <H2>Output</H2> <p> For each dataset, print the sum of given integers in a line. </p> <H2>Sample Input</H2> <pre> 6 1000 800 9999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 1 99999999999999999999999999999999999999999999999999999999999999999999999999999999 0 100000000000000000000000000000000000000000000000000000000000000000000000000000000 1 100000000000000000000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000000000000000000 </pre> <H2>Output for the Sample Input</H2> <pre> 1800 10000000000000000000000000000000000000000 overflow 99999999999999999999999999999999999999999999999999999999999999999999999999999999 overflow overflow </pre>