Problem:


Score : 100 points

Problem Statement

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 1

2002
2017

Sample Output 1

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.

Sample Input 2

4500
0

Sample Output 2

-4500

Although the current and desired ratings are between 0 and 4500, the performance of a user can be below 0.



Sample input:
2002
2017


Sample output:
2032

Submission status: Wrong Answer

Solution code:
print(2 * int(input()) - int(input()))

Submission status: Wrong Answer

Solution code:
R = float(input())
G = float(input())
print((2 * G) - R)

Submission status: Wrong Answer

Solution code:
R = int(input())
G = int(input())
print(float(2 * G - R))

Submission status: Wrong Answer

Solution code:
a = int(input())
b = int(input())
print(b + (a - b))

Submission status: Wrong Answer

Solution code:
r=int(input())
c=int(input())
print(max(0,2*c-r))

Submission status: Wrong Answer

Solution code:
S=input()
T=input()

lt=len(T)
ls=len(S)
if ls<lt:f=0
else:
 for i in range(ls-lt,-1,-1):
  f=1
  for s,t in zip(S[i:i+lt],T):
    if s=='?' or s==t: continue
    f=0
  if f:break
print((S[0:i]+T+S[i+lt:ls]).replace('?','a') if f else 'UNRESTORABLE')

Submission status: Wrong Answer

Solution code:
n = int(input())
k = int(input())
 
num = 1
count = 0
 
while num < k:
    num *= 2
    count += 1
    
while count < n:
  num += k
  count += 1
  
print(num)

Submission status: Wrong Answer

Solution code:
r=float(input())
g=float(input())
print(g*2-r)

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
print((a+b)/2)

Submission status: Wrong Answer

Solution code:
R=int(input())
G=int(input())

print(float(2*G-R))

Submission status: Wrong Answer

Solution code:
R = int(input())
G = int(input())

sa = R-G
print(G+sa)

Submission status: Wrong Answer

Solution code:
R = int(input())
G = int(input())

if R >= G:
    sa = R-G
    print(G+sa)
else:
    sa = G-R
    print(R+sa)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = int(input())
print(b**2 - a)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

r, g = [int(readline()) for _ in range(2)]
ans = r + (g - r) * 2
print(r, (g - r), (g - r) * 2)

Submission status: Wrong Answer

Solution code:
x = int(input())
y = int(input())
print(y**2-x)

Submission status: Wrong Answer

Solution code:
R = int(input())
G = int(input())

print(R+(G-R)**2)

Submission status: Wrong Answer

Solution code:
R,G=int(input()),int(input())
for i in range(-4500,4500):
    if int(R+i)==G:
        print(i+G)
        break

Submission status: Wrong Answer

Solution code:
R,G=int(input()),int(input())
for i in range(4501):
    if int(R+i)==G:
        print(i+G)
        break

Submission status: Wrong Answer

Solution code:
n,k=map(int,open(0));r=1
for _ in[0]*n:r+=min(r,k)
print(r)

Submission status: Wrong Answer

Solution code:
now_rate = int(input())
to_rate = int(input())

print(abs(now_rate - to_rate * 2))

Submission status: Wrong Answer

Solution code:
print(
  abs(
    int(input())-int(input())*2
  )
)

Submission status: Wrong Answer

Solution code:
r,g = [int(input()) for i in range(2)]

print(g * 2 + r)

Submission status: Wrong Answer

Solution code:
r=int(input())
g=int(input())
ans=g//2-r
print(ans)

Submission status: Wrong Answer

Solution code:
r=int(input())
g=int(input())
ans=g-r
print(ans)

Submission status: Wrong Answer

Solution code:
r = int(input())
g = int(input())
if r>g:
    print(g-r)
else:
    for i in range(r,4501):
        if (r+i)/2==g:
            print(i)

Submission status: Wrong Answer

Solution code:
print(-int(input())+int(input())<<1)

Submission status: Wrong Answer

Solution code:
r=float(input())
g=float(input())
print(2.0*g-r)

Submission status: Wrong Answer

Solution code:
r=float(input())
g=float(input())
print(2*g-r)

Submission status: Wrong Answer

Solution code:
r = float(input())
g = float(input())

s = (g-r)*2
sum = r + s
print(sum)

Submission status: Wrong Answer

Solution code:
n = int( input())
k = int( input())
 
a = 1
for i in range(k+1):
  a = min(a+k, a*2)  
print(a)

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
print(a+b/2)

Submission status: Wrong Answer

Solution code:
print(-(int(input())+int(input()))/2)

Submission status: Wrong Answer

Solution code:
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    R = float(sys.stdin.readline().rstrip())
    G = float(sys.stdin.readline().rstrip())
    print(R+(G-R)*2)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
code = S
 
if (len(T) > len(S)):
    for x in range(len(S)):
        if (S[x] == '?'):
            code = code[:x] + 'a' + code[x+1:]
    for x in range(len(S)-(len(T)-1),-1,-1):
        if (x == -1):
            print('UNRESTORABLE')
        elif (S[x:x+len(T)] == (('?')*len(T)) or (S[x:x+len(T)] == ( T[0] + (('?')*(len(T)-1))))):
            code = code[:x] + T + code[x+len(T):]
            print(code)
else:
    print('UNRESTORABLE')

Submission status: Wrong Answer

Solution code:
def start(S,T):
    for x in range(len(S)-(len(T)-1)):
        if (S[x] == T[0] and (S[x+(len(T)-1)] == (T[len(T)-1]) or (S[x+(len(T)-1)] == '?'))):
            return x
    return len(S)

def delete(A,code):
    for x in range(len(code)):
        if code[x] in A:
            A.remove(code[x])
    return A
    

S = input()
T = input()
code = ''
left = list(map(chr, range(97, 123)))
if (len(S)-(len(T)-1) > 0):
    startingpoint = start(S,T)
    if (startingpoint == len(S)):
        print('UNRESTORABLE')
    else:
        if (S[0] != '?'):  
            code = S[:startingpoint] + T + S[startingpoint+(len(T)):]
        else:
            code = S[:startingpoint] + T + S[startingpoint+(len(T)):]
        left = delete(left,code)
        for x in range(len(code)):
            if (code[x] == '?'):
                if (code[0] != '?'):  
                    code = code[:x] + left[x] + code[x+1:]
                else:
                    code = code[:x] + left[x] + code[x+1:]
                left.remove(left[x])
        print(code)
else:
    print('UNRESTORABLE')

Submission status: Wrong Answer

Solution code:
##Rating Goal

a = int(input())
b = int(input())
print((a+b)/2)

Submission status: Wrong Answer

Solution code:
print(-int(input())-2*int(input()))

Submission status: Wrong Answer

Solution code:
print(-int(input())-2*int(input()))

Submission status: Wrong Answer

Solution code:
def newrating(r , g):

    return (g - r) * 2

def main():
    r = int(input())
    g = int(input())
    print(newrating(r , g))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def newrating(r , g):

    return (r + g) / 2

def main():
    r = int(input())
    g = int(input())
    print(newrating(r , g))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
r = int(input())
g = int(input())

print((r + (g - r))//2)

Submission status: Wrong Answer

Solution code:
A = int(input())
B = int(input())
print(B * 2 + A)

Submission status: Wrong Answer

Solution code:


import numpy as np

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

Submission status: Wrong Answer

Solution code:
a = int(input())
b = int(input())
print(b-a)

Submission status: Wrong Answer

Solution code:
r = int(input())
g = int(input())

if r<g:
  print(2*abs(r-g)+r)
elif r>g:
  print(2*abs(r-g)-r)
else:
  print(r)

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())

S1 = S[::-1]
T1 = T[::-1]
count = 0
for i in range(len(S)-len(T)+1):
    count = 0

    for j in range(len(T1)):
        
        if S1[i+j] == "?" or S1[i+j] == T1[j]:
            

            count += 1

    
    if count == len(T1):
        
        for k in range(len(T1)):
            S1[k+i] = T1[k]
            
        S2 = S1[::-1]

        for i in S2:
            if i == "?":
                print("a",end="")
            else:
                print(i,end="")
        exit()

print("UNRESTORABLE")

Submission status: Wrong Answer

Solution code:
r = float(input())
g = float(input())
print(2*g - r)

Submission status: Wrong Answer

Solution code:
print(abs(int(input())-int(input())*2))

Submission status: Wrong Answer

Solution code:
r = float(input())
g = float(input())

t = 2*g -r

print(t)

Submission status: Wrong Answer

Solution code:
r=int(input())
g=int(input())

print((g-r)/2)

Submission status: Wrong Answer

Solution code:
n=int(input())
k=int(input())
c = 1
for i in range(n):
    c+=min(c,k)
print(c)

Submission status: Wrong Answer

Solution code:
print(abs(int(input())-2*int(input())))

Submission status: Wrong Answer

Solution code:
R = int(input())
G = int(input())

print(G - 2*R)

Submission status: Wrong Answer

Solution code:
r = int(input())
g = int(input())
print(g+abs(g-r))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import re
No = "UNRESTORABLE"

def main():
    S = input()
    T = input()
    T_LEN = len(T)
    match_index = []

    for i in range(len(S) - T_LEN + 1):
        for idx in range(T_LEN):
            if S[i:i+T_LEN][idx] == T[idx] or S[i:i+T_LEN][idx] == "?":
                continue
            else:
                break
        else:
            match_index.append(i)
    
    if not match_index:
        print(No)
    
    else:
        answer = list(S)
        answer[match_index[0]:match_index[0] + T_LEN] = list(T)
        answer = "".join(answer)
        answer = answer.replace("?","a")

        if len(match_index) == 1:
            print(answer)

        else:
            for i in match_index[1:]:
                tmp_ans = list(S)
                tmp_ans[i:i + T_LEN] = list(T)
                tmp_ans = "".join(tmp_ans)
                tmp_ans = tmp_ans.replace("?","a")
                answer = min(tmp_ans,answer)

            print(answer)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from itertools import permutations
import re


def main():
    s = input().replace('?', '.')
    t = input()

    for i in reversed(range(len(s) - len(t) + 1)):
        # print(s[i:i + len(t)])
        if re.search(s[i:i + len(t)], t):
            result = (s[:i] + t + s[i + len(t):]).replace('.', 'a')
            print(result)
            return

    print('UNRESTORABLE')

main()

Submission status: Wrong Answer

Solution code:
from itertools import permutations
import re


def main():
    s = input().replace('?', '.')
    t = input()

    for i in reversed(range(len(s) - len(t) + 1)):
        # print(s[i:i + len(t)])
        if re.search(s[i:i + len(t)], t):
            result = (s[:i] + t + s[i + len(t):]).replace('.', 'a')
            print(result)
            return

    print('UNRESTORABLE ')

main()

Submission status: Wrong Answer

Solution code:
w=input()
w1=input()
num=len(w)
num1=len(w1)
start=-1
if num<num1:
  b1=False
for i in range(num-num1+1):
  b=True
  for j in range(num1):
    if w[i+j]=="?" or w[i+j]==w1[j]:
      pass
    else:
      b=False
  if b:
      start=i
if start==-1:
  print("UNRESTORABLE")
else:
  word=""
  for i in range(num):
    if i<start:
      if w[i]=="?":
        word+="a"
      else:
        word+=w[i]
    elif start<=i and i<=start+num1-1:
      word+=w1[i-start]
    else:
      if w[i]=="?":
        word+="a"
      else:
        word+=w[i]
  print(word)

Submission status: Wrong Answer

Solution code:
import sys

S = input()
T = input()
cnt = 0 #Tで置き換える必要のある?の個数
i = 0
j = 0
while j < len(S):
    if T[-i] == S[-j] or S[-j] == "?":
        i += 1
        cnt += 1
    else:
        i, cnt = 0, 0
    j += 1
    if i == len(T) and (T[-i] == S[-j] or S[-j] == "?"):
        l = 0
        for l in range(len(S)):
            if S[l] == "?" and (l <= len(S)-j-1 or len(S)-j-1+len(T) < l):
                print("a",end="")
            elif S[l] == "?":
                print(T[-cnt+1],end="")
                cnt -= 1
            else:
                print(S[l],end="")
        print()
        sys.exit()
print("UNRESTORABLE")

Submission status: Wrong Answer

Solution code:
R = int(input())
G = int(input())
print(3*G -2*R)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
R = int(input())
G = int(input())
print(G + (G-R)/2)

Submission status: Wrong Answer

Solution code:
print(int(input())**2 - int(input()))

Submission status: Wrong Answer

Solution code:
r = int(input())
g = int(input())
print((g-r)/2)

Submission status: Wrong Answer

Solution code:
def resolve():
    r = int(input())
    g = int(input())
    print((g - r) * 2)


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
r, g = [int(input()) for _ in range(2)]
print((r + g) / 2)

Submission status: Wrong Answer

Solution code:
r=float(input())
g=float(input())
print(2*g-r)

Submission status: Wrong Answer

Solution code:
print(2*int(input())-int(input()))

Submission status: Wrong Answer

Solution code:
r = int(input())
g = int(input())

print(abs(g - r)*2 + min(g,r))

Submission status: Wrong Answer

Solution code:
r = int(input())
g = int(input())

print(abs(g - r)*2 + r)

Submission status: Wrong Answer

Solution code:
r=int(input())
g=int(input())
print(2+g-r)

Submission status: Wrong Answer

Solution code:
print(-2*int(input())+int(input()))

Submission status: Wrong Answer

Solution code:
i1 = int(input())
i2 = int(input())
print(int((i1+i2)/2))

Submission status: Wrong Answer

Solution code:
R = int(input())
G = int(input())
ans = 2*G - R

Submission status: Wrong Answer

Solution code:
r = float(raw_input())
g = float(raw_input())
print 2*g - r

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    key = inputs[0]
    hint = inputs[1]
    len_hint = len(hint)
    possibility = []  # matched_index
    hint_start_i = -1
    for i, c in enumerate(key):
        if c == hint[0] or c == "?":
            possibility.append(0)

        new_possibility = []
        for matched_hint_index in possibility:
            if c == hint[matched_hint_index] or c == "?":
                new_possibility.append(matched_hint_index + 1)

                if matched_hint_index + 1 == len_hint:
                    hint_start_i = i - len_hint + 1
                    break

        possibility = new_possibility

        if hint_start_i != -1:
            break

    if hint_start_i == -1:
        return "UNRESTORABLE"

    resolved_key = ""
    for i, c in enumerate(key):
        if i == hint_start_i:
            resolved_key += hint
        elif i >= hint_start_i and i <= hint_start_i + len_hint:
            continue
        elif c == "?":
            resolved_key += "a"
        else:
            resolved_key += c
    return resolved_key


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(2))
    print(ret)

Submission status: Wrong Answer

Solution code:
print(-eval(input().replace(" ","-2*")))

Submission status: Wrong Answer

Solution code:
print(input() * -1 + input() * 2)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = int(input())
print(2*a-b)

Submission status: Wrong Answer

Solution code:
R = float(input())
G = float(input())

print(2 * G - R)

Submission status: Wrong Answer

Solution code:
s = input()[::-1]
t = input()[::-1]
for i,c in enumerate(s):
  if (c == t[0] or c == '?') and (i+len(t) < len(s)+1):
    for j in range(len(t)):
      if t[j] != s[i+j] and s[i+j] != '?':
        break
    else:
      str_list = list(s)
      for j in range(len(t)):
        str_list[i+j] =  t[j]
      s = ''.join(str_list)
      print(s.replace('?', 'a')[::-1])
      break
else:
  print('UNRESTORABLE')

Submission status: Wrong Answer

Solution code:
a = int(input())
b = int(input())

print((b - (a/2)) * 2)

Submission status: Wrong Answer

Solution code:
r = int(input())
g = int(input())
print(float(2*g-r))

Submission status: Wrong Answer

Solution code:
N=int(input())
K=int(input())
x=1
for i in range(N):
	if x<=K:
			x=x*2
	else:
			x=x+K
print(x)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

s = list(input())
t = list(input())

slen = len(s)
tlen = len(t)

cand = []
for i in range(slen - tlen + 1):
    match = True
    for j in range(tlen):
        if s[i + j] == "?" or s[i + j] == t[j]:
            pass
        else:
            match = False
    if match:
        cand.append(i)

if len(cand) != 0:
    cand.reverse()
    ans = ""
    for i in range(slen):
        if not (cand[0] <= i < cand[0] + tlen):
            if s[i] == "?":
                ans += "a"
            else:
                ans += s[i]
        else:
            ans += t[i - cand[0]]
    print(ans)
else:
    print("UNRESTORABLE")

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    hidden_key = input()
    flag_string = input()

    key_length = len(hidden_key)
    flag_length = len(flag_string)
    
    if key_length < flag_length:
        print('UNRESTORABLE')
        exit()

    key_list = list(hidden_key.replace('?', 'a'))

    for i in reversed(range(key_length - flag_length + 1)):
        part_key = hidden_key[i:i + flag_length]
        is_match = True

        for j in range(flag_length):
            if part_key[j] != '?' and part_key[j] != flag_string[j]:
                is_match = False
                break
            
        if is_match:
            for k in range(flag_length):
                key_list[i + k] = flag_string[k]
            print(''.join(key_list))
            break

    if not is_match:
        print('UNRESTORABLE')

Submission status: Wrong Answer

Solution code:
r=int(input())
g=int(input())
print((g-r)*2+g)

Submission status: Wrong Answer

Solution code:
sp = input()
t = input()
len_t = len(t)
len_s = len(sp)
cand = []

for i in range(len_s - len_t + 1):
    num = 0
    for j in range(len_t):
        if (sp[i + j] == '?' or sp[i + j] == t[j]):
            num += 1
    
    if (num == len_t):
        sp2 = sp
        sp2 = sp2.replace(sp2[i:i+len_t], t)
        cand.append(sp2)
    
if cand:
    # min = float('inf')
    # ans = ''
    # for c in cand:
    #     for i in range(len(c)):
    #         if (c[i] == 'a' or c[i] == '?'):
    #             if (min > i):
    #                 min = i
    #                 ans = c
    #             break
    for i in range(len(cand)):
        cand[i] = cand[i].replace('?', 'a')
    cand.sort()
    print(cand[0])

else:
    print('UNRESTORABLE')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
# s = 'c?????'
# t = 'coder'
errorword = 'UNRESTORABLE'

ls=len(s)
lt=len(t)
if ls < lt:
    print(errorword)
else:
    for i in range(ls-lt,-1,-1):
        is_matched = True
        s_slice = slice(i, lt+2)

        for s_char, t_char in zip(s[s_slice], t):
            # 文字が不一致かつ？以外の場合は文字列不一致のためbreak
            if (s_char != t_char) and s_char != '?':
                is_matched = False
                break
                
        # ここまでbreakせずに来たら文字列一致のため文字列Sを出力
        if is_matched:
            temp_sl1 = slice(0, i)
            temp_sl2 = slice(i+lt, ls+1)
            out_str = '{}{}{}'.format(s[temp_sl1], t, s[temp_sl2])
            print(out_str.replace('?', 'a'))
            break
    
    if not is_matched:
        print(errorword)

Submission status: Wrong Answer

Solution code:
n=int(input())
print((23-5)*60/(n-1))

Submission status: Wrong Answer

Solution code:
r=int(input())
g=int(input())
print(2*g+r)

Submission status: Wrong Answer

Solution code:
g=int(input())
r=int(input())
print(2*g-r)

Submission status: Wrong Answer

Solution code:
def rating_goal(R: float, G: float)->float:
    return 2*G - R


if __name__ == "__main__":
    R = float(input())
    G = float(input())
    ans = rating_goal(R, G)
    print(ans)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = int(input())
print(b*b-a)

Submission status: Wrong Answer

Solution code:
R = int(input())
G = int(input())
ans = G * 2 + R
print(ans)

Submission status: Wrong Answer

Solution code:
r = int(input())
g = int(input())

print(r+2*g)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()

res = []

for s_index in range(len(s)-len(t)+1):
    if s[s_index] in ['?', t[0]]:
        s_p = s[s_index:s_index+len(t)]
        if len([True for x in range(len(s_p)) if s_p[x] in ['?', t[x]]]) == len(t):
            res.append(s[:s_index].replace('?', 'a') + t + s[s_index+len(t):].replace('?', 'a'))

if res:
    print(sorted(res)[0])
else:
    print('UNRESTORABLE')

Submission status: Wrong Answer

Solution code:
a = int(input())
b = int(input())
ans = 1
for i in range(a):
  ans = min(ans * 2,ans + b)
print(ans)

Submission status: Wrong Answer

Solution code:
R=float(input())
G=float(input())

print(G*2-R)

Submission status: Wrong Answer

Solution code:
A = input()
B = input()
print ((A+B)/2)

Submission status: Wrong Answer

Solution code:
def sys(a,b):
    return (2*b-a)

Submission status: Wrong Answer

Solution code:
import sys
def aa(a,b):
    return (2*b-a)

Submission status: Wrong Answer

Solution code:
import sys

def solve(a,b):
    return b+(b-a)

def readQuestion():
    a = sys.stdin.readline().strip()
    b = sys.stdin.readline().strip()
    
    return (int(a),int(b))

def main():
    a ,b  = readQuestion()
    answer = solve(a ,b)
    print(answer)

#if __name__ == '__main__':
#    main()

Submission status: Wrong Answer

Solution code:
def aa(a,b):
    return (2*b-a)

Submission status: Wrong Answer

Solution code:
def solve(a,b):
    return b+(b-a)

def readQuestion():
    a = sys.stdin.readline().strip()
    b = sys.stdin.readline().strip()
    
    return (int(a),int(b))

def main():
    a ,b  = readQuestion()
    answer = solve(a ,b)
    print(answer)

#if __name__ == '__main__':
#    main()

Submission status: Wrong Answer

Solution code:
def aa(a,b):
    return (2*b-a) 
aa(2002,2017)

Submission status: Wrong Answer

Solution code:
import sys

def solve(R,G):
    print(G*2-R)
    # Uncomment the following if you want to check the input.
    # print('R =', R)
    # print('G =', G)


def readQuestion():
    ws = sys.stdin.readline().strip().split()
    R = int(ws[0])
    ws = sys.stdin.readline().strip().split()
    G = int(ws[0])
    return (R,G)

def main():
    solve(readQuestion())

Submission status: Wrong Answer

Solution code:
import sys

def solve(R,G):
    print(G*2-R)
    # Uncomment the following if you want to check the input.
    # print('R =', R)
    # print('G =', G)
    pass


def readQuestion():
    ws = sys.stdin.readline().strip().split()
    R = int(ws[0])
    ws = sys.stdin.readline().strip().split()
    G = int(ws[0])
    return (R, G,)

def main():
    solve(*readQuestion())

Submission status: Wrong Answer

Solution code:
import sys

def solve(R,G):
    return(G*2-R)
    # Uncomment the following if you want to check the input.
    # print('R =', R)
    # print('G =', G)
    pass


def readQuestion():
    ws = sys.stdin.readline().strip().split()
    R = int(ws[0])
    ws = sys.stdin.readline().strip().split()
    G = int(ws[0])
    return (R, G,)

def main():
    solve(*readQuestion())

Submission status: Wrong Answer

Solution code:
R=int(input())
G=int(input())


print(G/2-R)

Submission status: Wrong Answer

Solution code:
p=input;a,b=map(int,[p(),p()]);print(abs(b-a)+b)

Submission status: Wrong Answer

Solution code:
r = int(input())
g = int(input())

print(g + abs(g-r))

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
print(2*a-b)

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
print(b-2*a)

Submission status: Wrong Answer

Solution code:
R = int(input())
G = int(input())

W = R + R - G

print(W)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
res = ''
end = -1
for i in range(len(S) - len(T) + 1):
    for j in range(len(T)):
        start = i
        if S[i+j] == T[j]:
            end = i + j
            flag = 1
        elif S[i+j] == '?':
            end = i + j
            flag = 1
        else:
            flag = 0
            pass
            break
    if flag == 1:
        break
            
if end == -1:
    print('UNRESTORABLE')
    
else:
    j = 0
    for i in range(len(S)):
        if start <= i <= end:
            res += T[j]
            j += 1

        elif S[i] == '?':
            res += 'a'

        else:
            res += S[i]

    print(res)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()

answer = ''
for i in range(len(S)-len(T)+1):
    if any([S[i+j] != '?' and S[i+j] != T[j] for j in range(len(T))]):
        continue
    tmp = (S[:i] + T + S[i+len(T):]).replace('?', 'a')
    if answer == '' or tmp < answer:
        answer = tmp 

if answer == '':
    print('UNRESTORABLE')
else:
    print(answer)

Submission status: Wrong Answer

Solution code:
R=int(input())
G=float(input())
print(2*G-R)

Submission status: Wrong Answer

Solution code:
R = float(input())
G = float(input())
print(G * 2 - R)

Submission status: Wrong Answer

Solution code:
r = int(input())
g = int(input())

print((r + g) / 2)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
u = len(t)
for i in range(len(s)-u,-1,-1):
    for j in range(u):
        if s[i+j]!="?" and s[i+j]!=t[j]:
            break
    else:
        print((s[:i]+t+s[u+i:]).replace("?","a"))
        break
else:
    print("UNRESTORABLE")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
u = len(t)
for i in range(len(s)-u,-1,-1):
  for j in range(u):
    if s[i+j] != '?' and s[i+j] != t[j]:
      break
  else:
    print((s[:i] + t + s[u + i:]).replace("?", "a"))
    break
else:
  print('UNRESTORABLE')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
for i in range(len(s)-len(t),-1,-1):
  for j in range(len(t)):
    if s[i+j] != '?' and s[i+j] != t[j]:
      break
  else:
    print('{}{}{}'.format(s[:i],t,s[i+len(t):]).replace('?','a'))
    break
else:
  print('UNRESTORABLE')

Submission status: Wrong Answer

Solution code:
nr = float(input())
p = float(input())
print((p-nr)+p)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = int(input())
if a>=b:
    print('{}'.format((a+b)/2))
else :
    print('{}'.format(-(b-a)/2))

Submission status: Wrong Answer

Solution code:
S = str(input())
T = str(input())
a = len(S)
b = len(T)
if (a < b):
    print("UNRESTORABLE")
    exit()
    
m = a-b
B = "UNRESTORABLE"
for i in range(m+1):
    for j in range(b):
        if S[i+j] == T[j]:
            S =S.replace(S[i:i+b+1], T)
            S = S.replace('?', 'a')
            print(S)
            exit()
print(B)

Submission status: Wrong Answer

Solution code:
r=float(raw_input())
g=float(raw_input())

print g*2-r

Submission status: Wrong Answer

Solution code:
def padding(S, T, i):
    ans = S[:i] + T + S[i+len(X):]
    print(ans.replace("?","a"))
    return

if __name__ == '__main__':
    
    S = input()
    T = input()

    if len(S) < len(T):
        print("UNRESTORABLE")

    sizeX = len(T)
    for i in range(len(S) - len(T) + 1):
        X = S[i:i+sizeX]
        for j in range(sizeX):
            if X[j] == "?" or X[j] == T[j]:
                if j == sizeX - 1:
                    padding(S, T, i)
                    exit(0)
            else:
                break
            


    print("UNRESTORABLE")

Submission status: Wrong Answer

Solution code:
N=int(input())
K=int(input())
ans=1
c=0
while c<N:
	if ans<K:
		ans=ans*2
	else:
		ans=ans+K
	c+=1
print(ans)

Submission status: Wrong Answer

Solution code:
print((int(input())+int(input()))//2)

Submission status: Wrong Answer

Solution code:
print((int(input())+int(input()))/2)

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
c=a-b
print(b+c)

Submission status: Wrong Answer

Solution code:
r = input()
g = input()

b = float(g)*2.0-float(r)
print(b)

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())
i = 1
for num in range(N):
  if i < K:
    i *= 2
  else:
    i += K
print (i)

Submission status: Wrong Answer

Solution code:
import sys
s = input()
T=input()
p = 0
for i in range(len(s)-len(T)+1,0,-1):
  for j in range(len(T)):
    if T[j]!=s[i-1+j] and "?"!= s[i-1+j] :
      break
      p = 1
  else:
    s=s[:i-1]+T+s[i+len(T)-1:]
    s = s.replace('?', 'a')
    print(s)
    sys.exit()
if p == 1:
  print("UNRESTORABLE")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())

def eq(s, t):
    for i in range(len(s)):
        if s[i] != t[i] and s[i] != '?':
            return False
    return True

for i in reversed(range(len(s) - len(t)+1)):
    if eq(s[i:i+len(t)], t[:]):
        s[i:i + len(t)] = t[:]
        ans = ''.join(s)
        print(ans.replace('?', 'a'))
        quit()
print('UNRESTORABLE')

Submission status: Wrong Answer

Solution code:
r = float(input())
g = float(input())


print(g*2 - r)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = int(input())
i = 0
p= 1
while i < a:
 if p > b:
  p = p+b
  i = i+1
 else:
  p = 2*p
  i = i+1
print(p)

Submission status: Wrong Answer

Solution code:
#coding: utf-8
SS = input()
T = input()
f = 0

if len(SS) < len(T):
    print('UNRESTORABLE')

else:
    for i in range(0, len(SS)-len(T)+1):
        pSS = SS[i:len(T)+i]
        Tt = ''
        for j in range(0,len(T)):

            if pSS[j] == T[j]:
                Tt += T[j]

            elif pSS[j] == '?':
                Tt += T[j]
            else:
                break

        if Tt == T:
            f += 1
            SS = SS.replace(SS[i:len(T)+i], Tt)
            ans = SS.replace('?','a')
            break
        else:
            f += 0

    if f == 1:
        print(ans)
    else:
        print('UNRESTORABLE')

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())

ans = 1
count = 0
while ans <= K:
    ans = 2 * ans
    count += 1
ans = ans + K*(N-count)

print(ans)