AtCoder Beginner Contest 076 - Rating Goal

Takahashi is a user of a site that hosts programming contests.

When a user competes in a contest, the rating of the user (not necessarily an integer) changes according to the performance of the user, as follows:  
 - Let the current rating of the user be a.
 - Suppose that the performance of the user in the contest is b.
 - Then, the new rating of the user will be the avarage of a and b.
For example, if a user with rating 1 competes in a contest and gives performance 1000, his/her new rating will be 500.5, the average of 1 and 1000.
Takahashi's current rating is R, and he wants his rating to be exactly G after the next contest.

Find the performance required to achieve it.  

-----Constraints-----
 - 0 \leq R, G \leq 4500
 - All input values are integers.

-----Input-----
Input is given from Standard Input in the following format:
R
G

-----Output-----
Print the performance required to achieve the objective.

-----Sample Input-----
2002
2017

-----Sample Output-----
2032

Takahashi's current rating is 2002.

If his performance in the contest is 2032, his rating will be the average of 2002 and 2032, which is equal to the desired rating, 2017.

Source: atcoder | Difficulty: EASY


Solutions:
x = int(input())
y = int(input())
print(y + y - x)


R = int(input())
G = int(input())
print(2 * G - R)


r = int(input())
g = int(input())
print(2 * g - r)


print(int(input()) * -1 + 2 * int(input()))


A = int(input())
B = int(input())
print(2 * B - A)


n = int(input())
m = int(input())
l = m * 2 - n
print(l)


s = int(input())
t = int(input())
print((t - s) * 2 + s)


print(-int(input()) + int(input()) * 2)


a = int(input())
b = int(input())
print(b * 2 - a)


(R, G) = map(int, open(0).read().split())
print(2 * G - R)


(r, g) = open(0)
print(2 * int(g) - int(r))


def iroha():
	a = [int(input()) for _ in range(2)]
	print(2 * a[1] - a[0])

def __starting_point():
	iroha()
__starting_point()


(n, m) = (int(input()) for _ in range(2))
print(n + (m - n) * 2)


import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

def I():
	return int(input())

def F():
	return float(input())

def SS():
	return input()

def LI():
	return [int(x) for x in input().split()]

def LI_():
	return [int(x) - 1 for x in input().split()]

def LF():
	return [float(x) for x in input().split()]

def LSS():
	return input().split()

def resolve():
	R = I()
	G = I()
	ans = 2 * G - R
	print(ans)

def __starting_point():
	resolve()
__starting_point()


with open(0) as f:
	(R, G) = map(int, f.read().split())
print(2 * G - R)


i = int(input())
j = int(input())
print(-1 * i + 2 * j)


x = int(input())
m = int(input())
print(m * 2 - x)


a = int(input())
G = int(input())
print(2 * G - a)


(r, g) = (int(input()) for _ in range(2))
print(g * 2 - r)


x = int(input())
y = int(input())
print(y * 2 - x)


(r, g) = [int(input()) for s in range(2)]
print(2 * g - r)


(R, G) = (int(input()) for i in range(2))
R += (G - R) * 2
print(R)


r = int(input())
print(int(input()) * 2 - r)


r = int(input())
a = int(input())
print(a * 2 - r)


old = int(input())
new = int(input())
print(2 * new - old)


(a, b) = map(int, open(0))
print(2 * b - a)


a = int(input())
m = int(input())
print(2 * m - a)


print(int(-int(input()) + 2 * float(input())))


(R, G) = (int(input()), int(input()))
d = G - R
print(G + d)


A = int(input())
G = int(input())
print(A + (G - A) * 2)


a = int(input())
g = 2 * int(input())
print(g - a)


R = input()
G = input()
a = int(R)
b = int(G)
c = b * 2 - a
print(c)


(r, g) = (int(input()), int(input()))
print(g + g - r)


(r, g) = map(int, open(0).read().split())
print(g * 2 - r)


R = int(input())
G = int(input())
print(G + (G - R))


(R, G) = [int(input()) for _ in range(2)]
print(2 * G - R)


N = int(input())
G = int(input())
print(2 * G - N)


nr = int(input())
p = int(input())
print(p - nr + p)


A = int(input())
B = int(input())
print(B + B - A)


a = int(input())
b = int(input())
print(b + (b - a))


r = int(input())
g = int(input())
p = g + (g - r)
print(p)


(R, G) = map(int, open(0))
print(2 * G - R)


import bisect, collections, copy, heapq, itertools, math, string
import sys

def I():
	return int(sys.stdin.readline().rstrip())

def LI():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def S():
	return sys.stdin.readline().rstrip()

def LS():
	return list(sys.stdin.readline().rstrip().split())
R = I()
G = I()
x = 2 * G - R
print(x)


r = int(input())
g = int(input())
t = g - r
print(g + t)


(a, b) = [int(input()) for i in range(2)]
print(b * 2 - a)


(R, G) = (int(input()) for T in range(0, 2))
print(2 * G - R)


r = int(input())
c = int(input())
print(2 * c - r)


R = int(input())
G = int(input())
if (0 <= R and R <= 4500) and (0 <= G and G <= 4500):
	print(2 * G - R)


i = lambda : int(input())
print(-i() + 2 * i())


R = int(input())
G = int(input())
W = G + G - R
print(W)


a = int(input())
c = int(input())
print(2 * c - a)


S = int(input())
T = int(input())
print(2 * T - S)


R = int(input())
N = int(input())
print(N + (N - R))


(a, b) = [int(input()) for _ in range(2)]
print(b * 2 - a)


def main():
	r = int(input())
	g = int(input())
	x = 2 * g - r
	print(x)
main()


n = int(input())
g = int(input())
print(g * 2 - n)


a = float(input())
b = float(input())
print(int(b + (b - a)))


s = int(input())
a = int(input())
print(2 * a - s)


r = int(input())
n = int(input())
print(n * 2 - r)


R = int(input())
B = int(input())
print(2 * B - R)


n = int(input())
a = int(input())
print(2 * a - n)


b = int(input())
c = int(input())
print(2 * c - b)


N = int(input())
M = int(input())
print(2 * M - N)


(r, g) = [int(input()) for i in range(2)]
print(2 * g - r)


cur = int(input())
goal = int(input())
print(2 * goal - cur)


import sys
sys.setrecursionlimit(10 ** 6)
r = int(input())
g = int(input())
print(2 * g - r)


r = int(input())
g = int(input())
num = g - r
print(num + g)


a = int(input())
print(int(input()) * 2 - a)


r = int(input())
b = int(input())
print(2 * b - r)


current_rating = int(input())
final_rating = int(input())
performance = final_rating * 2 - current_rating
print(performance)


n = int(input())
a = int(input())
print(a - n + a)


R = int(input())
D = int(input())
print(D + (D - R))


R = int(input())
G = int(input())
x = 2 * G - R
answer = x
print(answer)


r = int(input())
s = int(input())
print(2 * s - r)


B = int(input())
T = int(input())
print(B + (T - B) * 2)


import io
print(-int(input()) + 2 * int(input()))


print(eval(input() + '*-1+2*' + input()))


R = int(input())
print(int(input()) * 2 - R)


x = int(input())
ave = int(input())
print(2 * ave - x)


(R, G) = map(int, (input(), input()))
print(G + (G - R))


l = int(input())
l2 = int(input())
print(l + (l2 - l) * 2)


R = int(input())
N = int(input())
print(2 * N - R)


a = int(input())
ave = int(input())
print(2 * ave - a)


N = int(input())
S = int(input())
ans = S * 2 - N
print(ans)


S_list = [int(input()) for i in range(2)]
mokuhyou = 2 * S_list[1] - S_list[0]
print(mokuhyou)


a = int(input())
b = int(input())
c = b - a
print(b + c)


(i, p) = (int, input)
print(-i(p()) + 2 * i(p()))


(A, G) = [int(input()) for i in range(2)]
print(2 * G - A)


i1 = int(input())
i2 = int(input())
print(i2 * 2 - i1)


def main():
	my_rate = int(input())
	avarage_rate = int(input())
	target_rate = avarage_rate * 2 - my_rate
	print(target_rate)

def __starting_point():
	main()
__starting_point()


a = [int(input()) for i in range(2)]
print(2 * a[1] - a[0])


a = int(input())
g = int(input())
print(g - a + g)


r = int(input())
d = int(input())
print(2 * d - r)