BISHOPS  Bishops
Yesterday was Sam's birthday. The most interesting gift was definitely the chessboard. Sam quickly learned the rules of chess and defeated his father, all his friends, his little sister, and now no one wants to play with him any more.
So he decided to play with another birthday gift – a Book of Math Problems for Young Mathematicians. He opened the book somewhere in the middle and read the following problem: "How many knights can be placed on a chessboard without threatening each other?" After a while he realized that this was trivial and moved on to the next problem: "How many bishops can be placed on a chessboard without threatening each other?". Sam is in trouble here. He is not able to solve this problem and needs your help.
Sam's chessboard has size N x N. A bishop can move to any distance in any of the four diagonal directions. A bishop threatens another bishop if it can move to the other bishop's position. Your task is to compute the maximum number of bishops that can be placed on a chessboard in such a way that no two bishops threaten each other.
Input
The input file consists of several lines. The line number i contains a single positive integer N representing the size of the ith chessboard. [1 <= N <= 10^100]
Output
The output file should contain the same number of lines as the input file. The ith line should contain one number – the maximum number of bishops that can be placed on ith chessboard without threatening each other.
Example
Input: 2 3 Output: 2 4
hide comments
yogesh1208:
20181211 19:33:27
i am getting NZEC in java


deveshd2k:
20181031 16:56:56
isn't the answer 2*input  2 in python! 

bloodgreed99:
20180901 23:51:58
if you are doing in c++ using string then the input 5 will give ans 08 instead of 8 so make a separate case for 5 . cost me 1 WA 

pavanjupalli:
20180808 17:54:53
i am getting tle in c++, even i use string 

joeyndchandler:
20180706 10:36:43
be careful for n=0 answer is 0, though n=0 doesn't make sense still that was my only test case failing got 2 WAs :( Last edit: 20180706 10:37:16 

pratikshit:
20180318 15:03:44
used python and was getting NZEC ran the loop for 1024 times and VOILA AC!!! 

srjsunny:
20180125 19:47:31
use boost/multiprecision in c++ or else biginteger in java


akhand_mishra:
20180118 18:36:18
please try it with c++. Last edit: 20180118 18:36:35 

sandilya1599:
20180112 08:16:36
take care of corner cases 

sayasaiteja:
20180108 18:37:49
ac in one go!!! 
Added by:  Roman Sol 
Date:  20050417 
Time limit:  1s 
Source limit:  10000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All 
Resource:  IPSC 2004 