submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s578237770
p00015
Accepted
if __name__ == '__main__': N = int(input()) for _ in range(N): a = input() b = input() c = str(int(a) + int(b)) if len(a) > 80 or len(b) > 80 or len(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>
s877995761
p00015
Accepted
while 1: try: n = int(input()) except:break n1 = 0 n2 = 0 for i in range(n): n1 = int(input()) n2 = int(input()) isOver = False ans = n1 + n2 if len(str(ans)) >= 81 | len(str(n1)) | len(str(n1)) : isOver = True if isOver: print("overflow") else: 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>
s823632632
p00015
Accepted
N = int(input()) list = [] for n in range(0, N): tmp = [] for _ in range(0, 2): tmp.append(int(input())) list.append(tmp) for a, b in list: c = a + b if c >= 10 ** 80: print('overflow') else: print(str(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>
s550005894
p00015
Accepted
import heapq from collections import deque from enum import Enum import sys import math from _heapq import heappush, heappop import copy BIG_NUM = 2000000000 HUGE_NUM = 99999999999999999 MOD = 1000000007 EPS = 0.000000001 sys.setrecursionlimit(100000) num_query = int(input()) for _ in range(num_query): A = list(map(int,input())) B = list(map(int,input())) if len(A) > 80 or len(B) > 80: print("overflow") continue if len(B) > len(A): #len(B) <= len(A)にする A,B = B,A A.reverse() B.reverse() ANS = deque() add = 0 for digit in range(len(A)): if digit >= len(B): tmp = add+A[digit] add = tmp//10 ANS.append(tmp%10) else: tmp = add+B[digit]+A[digit] add = tmp//10 ANS.append(tmp%10) if len(A) == 80 and add == 1: print("overflow") else: if add == 1: ANS.append(1) while len(ANS) > 0: print("%d"%(ANS.pop()),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>
s657851493
p00015
Accepted
n = int(input()) for _ in range(n): a = int(input()) b = int(input()) c = a + b if max(len(str(a)), len(str(b)), 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>
s630408710
p00015
Accepted
n = int(input()) for i in range(n): a = int(input()) b = int(input()) if len(str(a + 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>
s046501788
p00015
Accepted
n = int(input()) for i in range(n): a = int(input()) b = int(input()) if (a + b) // (10 ** 80) > 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>
s798855088
p00015
Accepted
m = 100000000000000000000000000000000000000000000000000000000000000000000000000000000 n = int(input()) for i in range(n): a = int(input()) b = int(input()) sum = a + b if sum > m or sum == m: 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>
s952892596
p00015
Accepted
n = int(input()) for i in range(n): s = int(input()) + int(input()) if len(str(s)) <= 80: print(s) 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>
s750154254
p00015
Accepted
n =int(input()) for i in range(n): a =int(input()) b=int(input()) if (a+b)<(10 **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>
s798263728
p00015
Accepted
n=int(input()) for i in range(n): a=input() b=input() s=int(a)+int(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>
s929278861
p00015
Accepted
N=int(input()) for i in range(N): a=int(input()) b=int(input()) retval=a+b if len(str(retval))>80: print("overflow") else: print(retval)
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>
s220144218
p00015
Accepted
n=int(input()) for i in range(n): a,b=[int(input()) for _ in range(2)] print("overflow" if len(str(a+b))>80 else 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>
s718488348
p00015
Accepted
if __name__ == '__main__': n = int(input()) for i in range(n): a = int(input()) b = int(input()) if len(str(a+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>
s666831269
p00015
Accepted
n = int(input()) for i in range(n): a = input() b = input() if len(a) > 80 or len(b) > 80: print("overflow") else: aa = int(a) bb = int(b) c = str(aa + bb) if len(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>
s103917312
p00015
Accepted
n = int(input()) for i in range(n): a = int(input()) b = int(input()) if len(str(a+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>
s226573019
p00015
Accepted
while True: try: N=int(input()) for i in range(N): a=input() b=input() if len(a)>80 or len(b)>80: print("overflow") else: a=int(a) b=int(b) s=a+b if len(str(s))>80: print("overflow") else: print(s) except:break
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>
s818665792
p00015
Accepted
num_datasets = int(input()) for i in range(num_datasets): n = input().strip() m = input().strip() first_num_str = "" second_num_str = "" if len(n) > len(m): first_num_str = n second_num_str = m else: first_num_str = m second_num_str = n total = "" carry = 0 first_int = 0 second_int = 0 first_last_index = len(first_num_str)-1 second_last_index = len(second_num_str)-1 for i in range(len(first_num_str)): first_int = int(first_num_str[first_last_index-i]) if i < len(second_num_str): second_int = int(second_num_str[second_last_index-i]) else: second_int = 0 added = (first_int + second_int + carry) % 10 carry = (first_int + second_int + carry) // 10 total = str(added) + total if carry > 0: total = str(carry) + total if len(total) > 80: print("overflow") else: print(total)
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>
s111301741
p00015
Accepted
import math n=int(input()) s=[int(input()) for _ in range(n*2)] for i in range(n): a=s[i*2]+s[i*2+1] st=str(a) if len(st)>80: 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>
s462076538
p00015
Accepted
n = int(input()) for i in range(n): a = int(input()) b = int(input()) c = a+b if c >= (10**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>
s330190250
p00015
Accepted
# N行の入力(Nが最初の行) n = int(input()) for _ in range(n): m1, m2 = int(input()), int(input()) print(m1 + m2 if len(str(m1 + m2)) <= 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>
s428527473
p00015
Accepted
n = int(input()) for _ in range(n): a = int(input()) b = int(input()) s = a + 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>
s256529192
p00015
Accepted
N = int(input()) num = [sum([int(input()) for _ in range(2)]) for _ in range(N)] for n in num: if n < 10**80: print(n) 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>
s178231326
p00015
Accepted
# 12,432 -> 012,432 def align_digits(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 add(a, b): a, b = align_digits(a, b) zipped = list(zip(a[::-1], b[::-1])) carry = 0 result = [] for i, z in enumerate(zipped): a, b = z s = int(a) + int(b) + carry carry = int(s / 10) if i == len(zipped) - 1: result.append(str(s)) else: result.append(str(s % 10)) ans = ''.join(result[::-1]) if len(ans) > 80: return 'overflow' return ans if __name__ == '__main__': n_input = int(input()) inputs = [] for i in range(n_input): inputs.append((input(), input())) for a, b in inputs: 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>
s256962194
p00015
Accepted
n = int(input()) for _ in range(n): s1 = int(input()) s2 = int(input()) s3 = s1+s2 if len(str(s3)) > 80: print("overflow") else: print(s3)
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>
s994577967
p00015
Accepted
def run(): N = int(input()) for _ in range(N): x = int(input()) y = int(input()) if 80 < len(str(x)) or 80 < len(str(y)) or 80 < len(str(x+y)): print('overflow') else: print(x+y) if __name__ == '__main__': run()
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>
s513146221
p00015
Accepted
n = int(input()) for i in range(n): a = int(input()) b = int(input()) s = a+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>
s283143443
p00015
Accepted
for i in range(int(input())): s=int(input())+int(input()) if s>=int("1"+"0"*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>
s230522674
p00015
Accepted
n = int(input()) for i in range(n): a = int(input()) b = int(input()) if (a+b) < (10**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>
s815733945
p00015
Accepted
# -*- coding: utf-8 -*- import math BIG_NUM = 100000000000000000000000000000000000000000000000000000000000000000000000000000000 def main(): n = int(input()) for _ in range(n): a = int(input()) b = int(input()) if a >= BIG_NUM or b >= BIG_NUM or a + b >= BIG_NUM: print("overflow") else: print(a+b) 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>
s349037587
p00015
Accepted
# National Budget md = 80 for _ in range(int(input())): a,b = int(input()),int(input()) ab = a + b if a >= pow(10,md) or b >= pow(10,md) or ab >= pow(10,md): 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>
s796651662
p00015
Runtime Error
import sys if __name__=='__main__': lines = [int(x.strip()) for x in sys.stdin.readlines()] n = lines[0] for i in range(n): # a, b = int(lines[i+1]), int(lines[i+2]) a, b = lines[2*i+1], lines[2*i+2] 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>
s015033570
p00015
Runtime Error
import sys if __name__=='__main__': lines = [int(x.strip()) for x in sys.stdin.readlines()] n = lines[0] for i in range(n): # a, b = int(lines[i+1]), int(lines[i+2]) a, b = lines[2*i+1], lines[2*i+2] if len(str(a+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>
s428208440
p00015
Runtime Error
#! -*- coding: utf-8-unix -*- import sys if __name__=='__main__': lines = [int(x.strip()) for x in sys.stdin.readlines()] n = lines[0] for i in range(n): # a, b = int(lines[i+1]), int(lines[i+2]) a, b = lines[2*i+1], lines[2*i+2] if len(str(a+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>
s272872669
p00015
Runtime Error
import sys if __name__=='__main__': lines = [int(x.strip()) for x in sys.stdin.readlines()] n = lines[0] for i in xrange(n): # a, b = int(lines[i+1]), int(lines[i+2]) a, b = lines[2*i+1], lines[2*i+2] if len(str(a+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>
s033784547
p00015
Runtime Error
import sys if __name__=='__main__': lines = [int(x.strip()) for x in sys.stdin.readlines() if x != ''] n = lines[0] for i in xrange(n): # a, b = int(lines[i+1]), int(lines[i+2]) a, b = lines[2*i+1], lines[2*i+2] if len(str(a+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>
s400819264
p00015
Runtime Error
import sys if __name__=='__main__': lines = [int(x.strip()) for x in sys.stdin.readlines() if x != ''] n = lines[0] for i in xrange(n): a, b = lines[2*i+1], lines[2*i+2] if len(str(a+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>
s898167433
p00015
Runtime Error
import math c = input(); for var in range(0, int(c)) : n1 = input(); n2 = input(); sum = int(n1) + int(n2); if int(math.log10(sum)) + 1 > 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>
s601558393
p00015
Runtime Error
import math c = raw_input(); for var in range(0, int(c)) : n1 = raw_input(); n2 = raw_input(); sum = int(n1) + int(n2); if int(math.log10(sum)) + 1 > 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>
s262434427
p00015
Runtime Error
import math c = raw_input() for var in range(0, int(c)) : n1 = raw_input() n2 = raw_input() sum = int(n1) + int(n2) if int(math.log10(sum)) + 1 > 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>
s260963345
p00015
Runtime Error
import math c = raw_input() for var in range(0, int(c)) : n1 = raw_input(); n2 = raw_input(); sum = int(n1) + int(n2) if int(math.log10(sum)) + 1 > 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>
s249298449
p00015
Runtime Error
import math c = raw_input(); for var in range(0, int(c)) : n1 = raw_input(); n2 = raw_input(); sum = int(n1) + int(n2) if int(math.log10(sum)) + 1 > 80 : print("overflow") else : print(sum) exit(0)
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>
s273152612
p00015
Runtime Error
import math c = raw_input(); for var in range(0, int(c)) : n1 = raw_input(); n2 = raw_input(); sum = int(n1) + int(n2) if int(math.log10(sum)) + 1 > 80 : print("overflow") else : print(sum) exit()
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>
s412339887
p00015
Runtime Error
import math n = input(); for var in range(0, int(n)) : c1 = input(); c2 = input(); sum = int(c1) + int(c2); if(math.log10(sum) + 1 > 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>
s800492819
p00015
Runtime Error
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>
s698527850
p00015
Runtime Error
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import math def dig(n): return int(math.log10(n)) num = input() count = 0 for i in range(num): num1 = [] s = input() t = input() if dig(s) > 80 or dig(t) > 80 or dig(s+t) > 80 : print "overflow" else: print s+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>
s057502141
p00015
Runtime Error
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys num = input() for i in range(num): num1 = [] s = input() t = input() u = s+u if len(str(u)) > 80 : print "overflow" else: print u
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>
s109789181
p00015
Runtime Error
import math n = int(raw_input()) for i in range(n): a = int(raw_input()) b = int(raw_input()) if math.log10(a) > 79 or math.log10(b) > 79: print 'overflow' else: c = a + b if math.log10(c) > 79: print 'overflow' 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>
s894976475
p00015
Runtime Error
import math n = int(raw_input()) for i in range(n): a = int(raw_input()) b = int(raw_input()) if math.log10(a) > 79 or math.log10(b) > 79: print 'overflow' else: c = a + b if math.log10(c) > 79: 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>
s319795429
p00015
Runtime Error
import math import sys for cnt, line in enumerate(sys.stdin): if cnt == 0:continue if cnt % 2 == 1: a = int(line) continue else: b = int(line) if math.log10(a) > 79 or math.log10(b) > 79: print 'overflow' else: c = a + b if math.log10(c) > 79: 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>
s402201831
p00015
Runtime Error
n = int(input()) for _ in range(n): a = sum([int(input()) for _ in range(n)]) print(a if a < 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>
s188752518
p00015
Runtime Error
for _ in range(int(input()): a=int(input())+int(input()) print(a if a < 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>
s308954873
p00015
Runtime Error
for _ in range(int(input())): a=int(input())+int(input()) print(a if a<10**80else'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>
s894584549
p00015
Runtime Error
from math import log10 n = int(input()) for i in range(n): a = int(input()) b = int(input()) c = a+b if (log10(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>
s241295805
p00015
Runtime Error
for x in range(input()): x=raw_input() x=x[::-1] y=raw_input() y=y[::-1] z=[0]*81 for i in xrange(len(x)): z[i]=int(x[i]) for j in xrange(len(y)): z[j]=z[j]+int(y[j]) for k in xrange(max(len(x),len(y))): sum=z[k] z[k]=sum%10 z[k+1]+=sum/10 z.reverse() for j in xrange(len(z)): if z[0]==0: z.pop(0) else: break print ''.join(map(str,z))
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>
s428547793
p00015
Runtime Error
a=input() for i in range(2): x=input() y=input() if len(x+y)>80: print "overflow" else: 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>
s702094172
p00015
Runtime Error
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>
s003046653
p00015
Runtime Error
n = input() for i in range(n): a = input(), b = input() c = a + b if len(a) > 80 or len(b) > 80 or len(c) > 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>
s607933444
p00015
Runtime Error
#!/usr/bin/env python #-*- coding:utf-8 -*- import sys import math n = int(input()) anss = [] for _ in range(n): x = int(input()) y = int(input()) anss.append(x+y) if int(math.log10(x)+1) > 80: print("overflow") elif int(math.log10(y)+1) > 80: print("overflow") elif int(math.log10(x+y)+1) > 80: print("overflow") for data in anss: print(data)
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>
s784680171
p00015
Runtime Error
#!/usr/bin/env python #-*- coding:utf-8 -*- import sys import math n = int(input()) anss = [] for _ in range(n): x = int(input()) y = int(input()) if int(math.log10(x)+1) > 80: print("overflow") elif int(math.log10(y)+1) > 80: print("overflow") elif int(math.log10(x+y)+1) > 80: print("overflow") else: anss.append(x+y) for data in anss: print(data)
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>
s844800769
p00015
Runtime Error
#!/usr/bin/env python #-*- coding:utf-8 -*- import sys import math def digit(x): d = 0 while x >= 1: x /= 10 d += 1 return d n = int(input()) anss = [] for _ in range(n): x = int(input()) y = int(input()) if int(digit(x)) > 80: print("overflow") elif int(digit(y)) > 80: print("overflow") elif int(digit(x+y)) > 80: print("overflow") else: anss.append(x+y) for data in anss: print(data)
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>
s008838597
p00015
Runtime Error
import math def main() : n = int(input()) for i in range(0, n) : a = int(input()) b = int(input()) if (math.log10(a + b) + 1 > 80) : print("overflow") continue print(a + b) 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>
s563370592
p00015
Runtime Error
import math n = int(input()) for i in range(0, n) : a = int(input()) b = int(input()) if (math.log10(a + b) + 1 > 80) : print("overflow") continue 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>
s813080451
p00015
Runtime Error
#!/usr/bin/env python # -*- coding: utf-8 -*- import math n = int(raw_input()); for i in range(0, n): a = long(raw_input()); b = long(raw_input()); if math.log10(a + 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>
s255371411
p00015
Runtime Error
#!/usr/bin/env python # -*- coding: utf-8 -*- import math n = int(raw_input()); for i in range(0, n): a = int(raw_input()); b = int(raw_input()); if math.log10(a + 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>
s737343543
p00015
Runtime Error
# -*- coding:utf-8 -*- def main(): for i in range(int(input())): a=int(input())+int(input()) if la>=10**80: print("overflow") print(a) 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>
s642373564
p00015
Runtime Error
n = int(raw_input()) while n > 0: a = int(raw_input()) b = int(raw_input()) if len(str(a+b))>80: print('overflow') else: print(a+b) 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>
s546287684
p00015
Runtime Error
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>
s737199678
p00015
Runtime Error
import math n = int(input()) for i in range(n): for i in range(2): x = int(input()) y = int(input()) result = x * y print(result) if math.log10(result) + 1 < 10 ** 80 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>
s959501297
p00015
Runtime Error
import math n = int(input()) for i in range(n): for i in range(2): x = int(input()) y = int(input()) result = x + y print(result) if math.log10(result) + 1 < 10 ** 80 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>
s207518303
p00015
Runtime Error
import math n = int(input()) for i in range(n): for i in range(2): x = int(input()) y = int(input()) result = x + y print(result) if math.log10(result) + 1 < 80 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>
s459553798
p00015
Runtime Error
import math n = int(input()) for i in range(n): x = int(input()) y = int(input()) result = x + y if math.log10(result) + 1 < 80: print(result) 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>
s143090752
p00015
Runtime Error
import math n = int(input()) for i in range(n): x = int(input()) y = int(input()) result = x + y if math.log10(result) + 1 < 81: print(result) 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>
s346222807
p00015
Runtime Error
n=int(input()) for _ in range(n): s=int(input())+int(input()) print('overflow' iflen(str(s))>80 else 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>
s590343632
p00015
Runtime Error
import math N = int(input()) for i in range(N): a = int(input()) b = int(input()) if math.log10(a) > 79 or math.log10(b) > 79 or 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>
s697958764
p00015
Runtime Error
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>
s871137707
p00015
Runtime Error
import math for i in range(int(input())): a = int(input()) b = int(input()) if int(math.log10(a+b) + 1) > 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>
s586749419
p00015
Runtime Error
import math n = int(input()) for i in range(0, n): a = int(input()) b = int(input()) if math.log10(a + b) + 1 > 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>
s812397798
p00015
Runtime Error
import math n = int(input()) for i in range(0, n): a = int(input()) b = int(input()) if int(math.log10(a + b)) + 1 > 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>
s303800096
p00015
Runtime Error
import math n = int(input()) for i in range(0, n) : a = int(input()) b = int(input()) if math.log10(a + b) + 1 > 80 : print("overflow") elif math.log10(a) + 1 > 80 : print("overflow") elif math.log10(b) + 1 > 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>
s413206818
p00015
Runtime Error
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>
s541413815
p00015
Runtime Error
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>
s312214726
p00015
Runtime Error
n = int(input()) for i in range(n): s = int(input())+int(input()) if len(str(s))>=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>
s715891489
p00015
Runtime Error
import math n = input() for i in xrange(n): result = long(raw_input()) + long(raw_input()) if int(math.log10(result)) + 1 >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>
s358586817
p00015
Runtime Error
import math n = input() for i in xrange(n): result = long(raw_input()) + long(raw_input()) if math.log10(result) + 1 >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>
s462346879
p00015
Runtime Error
for i in xrange(input()): a, b = map(int, raw_input().split()) print a+b if len(str(a+b)) <= 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>
s728064668
p00015
Runtime Error
# -*- coding: utf-8 -*- N = int(input()) for _ in range(N): a = int(input()) b = int(input()) s = str(a + b) limit = '1' + '0'*79 if len(s) <= limit: print(s) 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>
s599037944
p00015
Runtime Error
n = int(input()) for i in range(n): x = int(input()) y = int(input()) ans = x + y if len(str(ans)) > 80 : print 'overflow' else: 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>
s757697522
p00015
Runtime Error
n=input() for x in 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>
s851291587
p00015
Runtime Error
n=input() while (i<n): a=input() b=input() print(a+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>
s719329589
p00015
Runtime Error
n=input() while (i<n): a=input() b=input() a=a+b print(a) 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>
s827019471
p00015
Runtime Error
while True: n = int(input()) for _ in range(n): a, b = int(input()), int(input()) x = str(a+b) print('overflow' if len(x) > 80 else x)
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>
s106209458
p00015
Runtime Error
while True: n = int(input()) for _ in range(n): a, b = int(input()), int(input()) x = str(a+b) print('overflow' if len(x) > 80 else 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>
s092689465
p00015
Runtime Error
import math count=int(input()) for i in range(count): x=int(input()) y=int(input()) ans=x+y if int(math.log10(ans)>=80) print("overflow") else: 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>
s821094863
p00015
Runtime Error
import math count=int(input()) for i in range(count): x=int(input()) y=int(input()) ans=x+y if int(math.log10(ans)>=80): print("overflow") else: 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>
s422495536
p00015
Runtime Error
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>
s351615462
p00015
Runtime Error
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>
s996557683
p00015
Runtime Error
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>
s539278246
p00015
Runtime Error
for i in range(int(input())): try: 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>
s973864594
p00015
Runtime Error
n = int(input()) for i in range(0, n) : a, b = list(map(int, input().split())) sum = a + b if str(sum).length() > 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>