Harryxun/stf_run huggingface dataset:
S = list(input())
N = len(S)
T = input()
M = len(T)

ans = "UNRESTORABLE"

def changehatena(S):
    S = "".join(S)
    S = S.replace("?", "a")
    return S

def check_after(S, i):
    try:
        if S[i+1] == T[-1]:
            return True
        else:
            return False
    except:
        return False

def check_before(S, i):
    if i-M+2 < 0:
        return False
    try:
        if S[i-M+2] == T[0]:
            return True
        else:
            return False
    except:
        return False


for i in reversed(range(N)):
    hatena_num = 0
    if S[i] == "?":
        hatena_num = 1
        for j in reversed(range(i)):
            if S[j] == "?":
                hatena_num += 1
            else:
                break
        if hatena_num > M-1:
            if check_after(S, i):
                # print("check1")
                tmp = 0
                for k in reversed(range(M-1)):
                    S[i-tmp] = T[k]
                    tmp += 1
                ans = changehatena(S)
                break
            elif check_before(S, i):
                # print("check2")
                tmp = 0
                for k in reversed(range(M-1)):
                    S[i-tmp] = T[k]
                    tmp += 1
                ans = changehatena(S)
                break
            tmp = 0
            for k in reversed(range(M)):
                S[i-tmp] = T[k]
                tmp += 1
            ans = changehatena(S)
            break
        elif hatena_num == M-1:
            try:
                if S[i+1] == T[-1]:
                    # print("check3")
                    tmp = 0
                    for k in reversed(range(M-1)):
                        S[i-tmp] = T[k]
                        tmp += 1
                    ans = changehatena(S)
                    break
            except:
                pass
            try:
                if S[i-M+1] == T[0]:
                    # print("check4")
                    tmp = 0
                    for k in reversed(range(1, M)):
                        S[i-tmp] = T[k]
                        tmp += 1
                    ans = changehatena(S)
                    break
            except:
                pass
        elif hatena_num == M-2:
            raise
            if check_after(S, i) and check_before(S, i):
                S[i-M+3:i+1] = T[1:-1]
                ans = changehatena(S)
                break
print(ans)


### FIXED CODE ###

import re
S = str(input())
T = str(input())
S = S.replace("?",".")

for i in range(len(S)-len(T),-1,-1):
  if re.match(S[i:i+len(T)],T):
    S = S.replace('.','a')
    print(S[:i]+T+S[i+len(T):])
    exit()

print('UNRESTORABLE')
import numpy
n = int(input())
a = [int(x) for x in input().split()]
MOD = 10**9 +7
x = numpy.array(a)
result = ((x.sum()**2 - x.dot(x)) // 2)%MOD
        
print(result)
# print(s%MOD)

### FIXED CODE ###

def findProductSum(A, n): 
      
    # calculating array sum (a1 + a2 ... + an) 
    array_sum = 0
    for i in range(0, n, 1): 
        array_sum += A[i]
  
    # calcualting square of array sum 
    # (a1 + a2 + ... + an)^2 
    array_sum_square = (array_sum * array_sum )
  
    # calcualting a1^2 + a2^2 + ... + an^2 
    individual_square_sum = 0
    for i in range(0, n, 1): 
        individual_square_sum += (A[i] * A[i]) 
  
    # required sum is (array_sum_square - 
    # individual_square_sum) / 2 
    return (array_sum_square - individual_square_sum) // 2 
n = int(input())
a = [int(x) for x in input().split()]
MOD = 10**9 +7

print(int(findProductSum(a,n))%MOD)

# print(s%MOD)
from math import gcd

def ngcd(nums):
	n = 0
	for i in nums:
		n = gcd(n, i)
	return n

def resolve():
	nums = list(map(int, input().split()))
	t = ngcd(nums)
	if t != 1:
		nums = [int(i/t) for i in nums]
	if gcd(nums[0], nums[1]) == 1:
		print("YES")
	else:
		print("NO")
resolve()

### FIXED CODE ###

def resolve():
	a, b, c = map(int, input().split())
	ans = "NO"
	for i in range(1, b+1):
		if i*a % b == c:
			ans = "YES"
			break
	print(ans)
resolve()
n = int(input())
a = [int(i) for i in input().split()]
c = 0
i = 0
 
while a[i]%2 == 0:
  if a[i]%2 ==0:
    a[i]//=2
  if i == n-1:
    c +=1
    i = 0
  i += 1
print(c)

### FIXED CODE ###

s = input()
 
x = 0
 
 
for i in range(len(s)):
  if s[i] == "1":
    x += 1
  
print(x)
N = input()
A = [int(i) for i in input().split()]

count = 1

for i in A:
    if A > 10**18:
        print(-1)
        exit()

for i in A:
    count *= i

if count > 10**18:
    print(-1)
else:
    print(count)

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]

count = 1

if 0 in A:
    print(0)
    exit()

for i in A:
    count *= i
    if count > 10**18:
        print(-1)
        exit()

print(count)
a,b,c = map(int, input().split())
print(a*b//2)


### FIXED CODE ###

t,x = map(int, input().split())
print(t/x)
N = int(input())
X = input()
S = []
for a in range(N):
    S.append(X[a])
if N == 1:
    print(S)
else:
    
    for i in range(N-1):
        if S[i] != S[i+1] or S[i] == 'X':
            continue
        else:
            j = i+1
            while S[i] == S[j]:
                j += 1
            for l in range(i+1,j):
                S[l] = 'X'
lista = [k for k in S if k != 'X']
print(''.join(lista))

### FIXED CODE ###

N = int(input())
X = input()
S = []
for a in range(N):
    S.append(X[a])

if N == 1:
    print(1)
else:
    for i in range(1,N):
        if S[i] != S[i-1]:
            continue
        else:
            S[i-1] = 'X'
    lista = [k for k in S if k != 'X']
    print(len(lista))
a=int(input())
print(a.count("1"))

### FIXED CODE ###

print(input().count("1"))
X = int(input().strip())
A = int(input().strip())

if A > X:
	print(0)
else:
	print(10)

### FIXED CODE ###

X, A = input().strip().split()
X, A = [int(X), int(A)]
if A > X:
	print(0)
else:
	print(10)
n = int(input())
nums = input().split()
su = 0
ma = -1000000
mi = 1000000

for v in range(n):
    num = int(nums[v])
    print(num)
    if num > ma:
        ma = num
        print('max is',ma)
    if num < mi:
        mi = num
        print('min is',mi)
    su += num

print(mi, ma, su)

}


### FIXED CODE ###

n = int(input())
nums = input().split()
su = 0
ma = -1000000
mi = 1000000

for v in range(n):
    num = int(nums[v])
    if num > ma:
        ma = num
    if num < mi:
        mi = num
    su += num

print(mi, ma, su)
n = int(input())

if n%2==0:
  print(1/2)
else:
  print((n+1)/2n)


### FIXED CODE ###

n = int(input())

if n%2==0:
  print(1/2)
else:
  print((n+1)/(2*n))
import math

N, K = map(int, input().split())
pro = 0
for score in range(N+1):
    a = math.floor(math.log(K,score))
    pro += 1/N * 0.5**a
print(pro)

### FIXED CODE ###

N, K = map(int, input().split())
pro = 0
for score in range(1, N+1):
    a = 0
    while score < K:
        score *= 2
        a += 1
    pro += 1/N * (0.5**a)
print(pro)
n = input()
l = [111, 222, 333, 444, 555, 666, 777, 888, 999]
for i in l:
    if n<=i:
        print(i)
        break

### FIXED CODE ###

n = int(input())
l = [111, 222, 333, 444, 555, 666, 777, 888, 999]
for i in l:
    if n<=i:
        print(i)
        break
n=int(input())
if n == 1:
  print("Hello World")
  
else:
	a=int(input())
	b=int(input())
    print(a+b)

### FIXED CODE ###

n=int(input())
if n==1:
  print('Hello World')
else:
    print(int(input())+int(input()))
import numpy as np
def main():

    n = int(input())
    N, M = map(int, input().split())
    e = list(map(int, input().split()))
    #e = [[int(i) for i in input().split()] for i in range(int(input()))]
    #n = 3
    #e = [[21,-11],[81234,94124,52141
    for j in range(n):
        t = N - e[j]*0.006
        tt = abs(M - t)
        ttt.append(tt)
    ttt = np.array(ttt)
    print(np.argmin(ttt)+1)
main()

### FIXED CODE ###

import numpy as np
def main():
    ttt = []
    n = int(input())
    N, M = map(int, input().split())
    e = list(map(int, input().split()))
    #e = [[int(i) for i in input().split()] for i in range(int(input()))]
    #n = 3
    #e = [[21,-11],[81234,94124,52141
    for j in range(n):
        t = N - e[j]*0.006
        tt = abs(M - t)
        ttt.append(tt)
    ttt = np.array(ttt)
    print(np.argmin(ttt)+1)
main()
str = input()

ct = str.count('A')

if ct == 0 or ct == 3:
  print('No')
else :
  pritn('Yes')

### FIXED CODE ###

str = input()

ct = str.count('A')

if ct == 0 or ct == 3:
  print('No')
else:
  print('Yes')
n=int(input())
l=[list(map(int,input().split()))]
l1=[0]*n
for i in range(n-1):
    l1[i]+=l[i][0]+l[i][1]
    for j in range(1,n-i-1):
        if l1[i]<l[i+j][1]:
            l1[i]-=l1[i]
            l1[i]+=l[i+j][1]
            
        if l1[i]>=l[i+j][1] and (l1[i]-l[i+j][1])%l[i+j][2]!=0:
            l1[i]+=((l[i+j][1]%l[i+j][2])+(l[i+j][2]*l1[i]))%l1[i]
            
        if l1[i]>=l[i+j][1] and (l1[i]-l[i+j][1])%l[i+j][2]==0:
            l1[i]+=l[i+j][0]
    print(l1[i])
print(0)

### FIXED CODE ###

import math

n = int(input())
csf = [list(map(int, input().split())) for i in range(n-1)]
ANS = []
for i in range(n):
  ans = 0
  for c,s,f in csf[i:]:
    if ans <= s:
      ans = s + c
    else:
      ans = s + math.ceil((ans-s)/f) * f + c
  ANS.append(ans)
for i in ANS:
  print(i)
x = lsit(map(int, input().split()))
if x.count[5] == 2 and x.count[7] == 1:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

x = list(map(int, input().split()))
if x.count(5) == 2 and x.count(7) == 1:
    print("YES")
else:
    print("NO")
N,K = map(int, input().split())
l = list(map(int,input().split()))

j = sum(l[0:0+K])
m = 0
for i in range(1,len(l)-(K-1)):
    j = j - l[i-1] + l[i+K-1]
    if l[i] < l[i-1]:
        continue
    elif m < j:
        m = j
        t = l[i:i+K]
        
def E(n):
    return sum(range(1,n+1)) / n

l2 = list(map(E, t))

print(sum(l2))

### FIXED CODE ###

N,K = map(int, input().split())
l = list(map(int,input().split()))
 
def E(n):
  return (1 + n) / 2
 
j = sum(l[0:0+K])
m = 0
if N == 1:
  l2 = list(map(E, l))
  print(sum(l2))
elif N == K:
  l2 = list(map(E, l))  
  print(sum(l2))
else:
  for i in range(1,len(l)-(K-1)):
      j = j - l[i-1] + l[i+K-1]
      if l[i] < l[i-1]:
          continue
      elif m < j:
          m = j
          t = l[i:i+K]

  l2 = list(map(E, t))
 
  print(sum(l2))
flag = 0
for a in range(0,N+1):
    if flag == 1:break
    for b in range(0,N+1):
        if flag == 1:break
        for c in range(0,N+1):
            if flag == 1:break
            if a+b+c == N and a*10000+b*5000+c*1000 == Y:
                print(a,b,c)
                flag = 1
                break
if flag == 0:
    print(-1,-1,-1)

### FIXED CODE ###

N,Y = map(int,input().split())
flag = 0
for a in range(N+1):
    for b in range(N+1):
        if a+b > N:
            break
        elif (N-(a+b))*1000 == Y-(10000*a+5000*b):
            A,B,C = a,b,N-(a+b)
            flag = 1
if flag == 0:print(-1,-1,-1)
else:print(A,B,C)
r,c=list(map(int,input().split()))
l=[]
for i in range(r):
	a=list(map(int,input().split()))
	a.append(sum(a))
	l.append(a)
b=[]
for i in range(c+1):
	c=0
	for j in range(r):
		c+=l[j][i]
	b.append(c)
l.append(b)

for i in l:
	print(" ".join(list(map(str,i))))

### FIXED CODE ###

while(True):
	a,b=list(map(int,input().split()))
	if a==0 and b==0:
		break
	c=0
	for i in range(1,a+1):
		for j in range(1,i):
			for k in range(1,j):
				if i+j+k==b:
					c+=1
	print(c)
def main():
  _map = map
  _range = range
  _len = len
  _max = max
  _input = input
  _int = int
  n, m = _map(_int, _input().split())
  d1 = [None] * (m + 1)
  for _ in _range(n):
    a, b = _map(_int, _input().split())
    if d1[a] is None:
      d1[a] = [b]
    else:
      d1[a].append(b)
  result = 0
  d2 = {}
  maxb = -1
  for i in _range(1, m + 1):
    if d1[i] is None:
      if _len(d2) == 0:
        continue
    else:
      for j in d1[i]:
        if j not in d2:
          d2[j] = 1
        else:
          d2[j] += 1
        if j > maxb:
          maxb = j
    else:
    result += maxb
    d2[maxb] -= 1
    if d2[maxb] == 0:
      del d2[maxb]
      if _len(d2) == 0:
        maxb = -1
      else:
        maxb = _max(d2.keys())
  print(result)
main()

### FIXED CODE ###

n, m = map(int, input().split())
d1 = {}
for _ in range(n):
  a, b = map(int, input().split())
  if a in d1:
    d1[a].append(b)
  else:
    d1[a] = [b]
result = 0
d2 = {}
maxb = -1
for i in range(1, m + 1):
  if i in d1:
    for j in d1[i]:
      if j not in d2:
        d2[j] = 0
      d2[j] += 1
      if j > maxb:
        maxb = j
  else:
    if len(d2) == 0:
      continue
  result += maxb
  if d2[maxb] == 1:
    del d2[maxb]
    if len(d2) == 0:
      maxb = 0
    else:
      maxb = max(d2.keys())
  else:
    d2[maxb] -= 1
print(result)
N=int(input())
a=list(map(int, input().split()))
Flag=True

#print(bin(a[N-1] ^ a[1]))
#print(bin(a[0]))

if bin(a[N-2] ^ a[0]) == bin(a[N-1]):
  if bin(a[N-1] ^ a[1]) == bin(a[0]):
    for i in range(0,N-3):
      #print(bin(a[N] ^ a[N+2]),bin(a[N+1]))
      if Flag:
        if bin(a[N] ^ a[N+2])!=bin(a[N+1]):
          Flag=False
          break  
    if Flag:
      print("Yes")
    else:
      print("No")
  else:
    print("No")    
else:
  print("No")
    

### FIXED CODE ###

from collections import Counter,OrderedDict

N=int(input())
a=list(map(int,input().split()))
d=OrderedDict(Counter(a))
e=list(d)
e.sort()

if len(d)>3:
    ans="No"
else:
    ans="No"
    if len(d)==1:
        if e[0]==0:
            ans="Yes"
    elif len(d)==2:
        if N%3==0:
            if e[0]==0 and d[0]==N//3 and d[e[1]]==2*N//3:
                ans="Yes"
    else:
        if N%3==0:
            if d[e[0]]==d[e[1]]==d[e[2]]:
                if e[0]^e[1]^e[2]==0:
                    ans="Yes"
                   
print(ans)
import sys
input = lambda:sys.stdin.readline().rstrip()

n, m, l = map(int, input().split())
f_inf = float('inf')
dist = [[f_inf]*n for _ in range(n)]
for i in range(m): dist[i][i] = 0

for _ in range(m):
    a, b, c = map(int, input().split())
    dist[a-1][b-1] = c
    dist[b-1][a-1] = c

for k in range(n):
  for i in range(n):
    for j in range(n):
      dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j])


dist2 = [[f_inf]*n for _ in range(n)]
for i in range(n):
    for j in range(n):
        if dist[i][j] <= l:
            dist2[i][j] = 1
for k in range(n):
  for i in range(n):
    for j in range(n):
      dist2[i][j] = min(dist2[i][j], dist2[i][k]+dist2[k][j])

q = int(input())
for _ in range(q):
    s, t = map(int, input().split())
    ans = dist2[s-1][t-1]
    if dist2[s-1][t-1] == f_inf:
        print(-1)
    else:
        print(ans-1)

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N, M, L = map(int, input().split())
    dist = [[float('inf')] * N for _ in range(N)]
    for _ in range(M):
        A, B, C = map(int, input().split())
        if C > L:
            continue
        A -= 1
        B -= 1
        dist[A][B] = C
        dist[B][A] = C

    for k in range(N):
        for i in range(N):
            for j in range(N):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

    e = [[float('inf')] * N for _ in range(N)]
    for i in range(N):
        for j in range(N):
            if dist[i][j] <= L:
                e[i][j] = 1
    
    for k in range(N):
        for i in range(N):
            for j in range(N):
                e[i][j] = min(e[i][j], e[i][k] + e[k][j])


    Q = int(input())
    for _ in range(Q):
        s, t = map(int, input().split())
        s -= 1
        t -= 1
        if e[s][t] == float('inf'):
            print(-1)
            continue
        ans = e[s][t]
        print(ans-1)


if __name__ == "__main__":
    main()
import math

a, b = map(int, input().split())  # 複数数値入力

A = list()
B = list()

if b == 0:
    B = [0]
elif b == 1:
    B = [1]
else:
    for i in range(1, int(math.log2(b))+2):
        tmp = b // (2 ** i) * 2 ** (i - 1)

        if b % (2 ** i) < (2 ** (i-1)):
            plus = 0
        else:
            plus = b % (2 ** i) - 2 ** (i-1) + 1

        B.append(tmp+plus)
if a == 0:
    A = [0]
elif a == 1:
    A = [0]
else:
    for i in range(1, int(math.log2(a-1))+2):
        tmp = (a-1) // (2 ** i) * 2 ** (i - 1)

        if (a-1) % (2 ** i) < (2 ** (i-1)):
            plus = 0
        else:
            plus = (a-1) % (2 ** i) - 2 ** (i-1) + 1

        A.append(tmp + plus)

print(A)
print(B)
ans = 0
for i in range(0, int(math.log2(b)) + 1):
    print(i)
    if i >= len(A):
        ans += (B[i]) % 2 * 10 ** i
    else:
        ans += (B[i] - A[i]) % 2 * 10 ** i

print(int(str(ans), 2))


### FIXED CODE ###

import math

a, b = map(int, input().split())  # 複数数値入力

A = list()
B = list()

if b == 0:
    B = [0]
elif b == 1:
    B = [1]
else:
    for i in range(1, int(math.log2(b))+2):
        tmp = b // (2 ** i) * 2 ** (i - 1)

        if b % (2 ** i) < (2 ** (i-1)):
            plus = 0
        else:
            plus = b % (2 ** i) - 2 ** (i-1) + 1

        B.append(tmp + plus)

if a == 0:
    A = [0]
elif a == 1:
    A = [0]
else:
    for i in range(1, int(math.log2(a-1))+2):
        tmp = (a-1) // (2 ** i) * 2 ** (i - 1)

        if (a-1) % (2 ** i) < (2 ** (i-1)):
            plus = 0
        else:
            plus = (a-1) % (2 ** i) - 2 ** (i-1) + 1

        A.append(tmp + plus)

if b == 0:
    print(0)
else:
    ans = 0
    for i in range(0, int(math.log2(b)) + 1):
        if i >= len(A):
            ans += (B[i]) % 2 * 10 ** i
        else:
            ans += (B[i] - A[i]) % 2 * 10 ** i

    print(int(str(ans), 2))
pronunciation = {0: 'pon', 1: 'pon', 2: 'hon', 3: 'bon', 4: 'hon', 5: 'hon', 6: 'pon', 7: 'hon', 8: 'pon', 9: 'hon'}
input = int(input())
print(pronunciation[input])

### FIXED CODE ###

pronunciation = {0: 'pon', 1: 'pon', 2: 'hon', 3: 'bon', 4: 'hon', 5: 'hon', 6: 'pon', 7: 'hon', 8: 'pon', 9: 'hon'}
input = input()
if len(input) > 1:
  input = int(input[-1])
if type(input) != int:
    input = int(input)
print(pronunciation[input])
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N = INT()
A = [MAP() for _ in range(N)]

fin = False
for cx in range(101):
	for cy in range(101):
		tmp = 10**9+7
		for a in A:
			x, y, h = a
			if h != 0:
				H = abs(cx-x)+abs(cy-y)+h
				if tmp == 10**9+7:
					tmp = H
				else:
					if tmp != H:
						break
			else:
				if tmp > abs(cx-x)+abs(cy-y):
					break
		else:
			X ,Y ,CH = cx, cy, H
			fin = True
print(X, Y, CH)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N = INT()
A = [MAP() for _ in range(N)]

fin = False
for cx in range(101):
	for cy in range(101):
		tmp = 10**9+7
		for a in A:
			x, y, h = a
			if h != 0:
				H = abs(cx-x)+abs(cy-y)+h
				if tmp == 10**9+7:
					tmp = H
				else:
					if tmp != H:
						break
			else:
				if tmp == 10**9+7: continue
				if tmp > abs(cx-x)+abs(cy-y):
					break
		else:
			X ,Y ,CH = cx, cy, H
			fin = True
print(X, Y, CH)
A,B = map(int,input().split())

if B == 1:
  return 0

if B <= A:
  return 1

B -= A
ans = 1

while B > 0:
  B -= (A - 1)
  ans += 1
  
print(ans)
exit()


### FIXED CODE ###

A,B = map(int,input().split())

if B == 1:
  print(0)
  exit()

if B <= A:
  print(1)
  exit()

B -= A
ans = 1

while B > 0:
  B -= (A - 1)
  ans += 1
  
print(ans)
exit()
s,c = map(int,input().split(" "))
     
counter = 0
if s >= 1 and c >= 2:
    temp = min(s,c//2)
    s -= temp
    c -= temp * 2
    counter += temp
    #print("s:",s)
    #print("c:",c)
    #print("counter:",counter)
    
if s<=0 and c >= 4:
    temp = c // 4
    counter += temp
    c -= temp
    #print("s:",s)
    #print("c:",c)
    #print("counter:",counter)
      
print(temp)


### FIXED CODE ###


n,m=map(int,input().split())
first=min(n,m//2)
n -=first
m-=first*2
second = m//4
print(second+first)
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
alice = sum([a[i] for i in a if i%2 == 0])
bob = sum([a[i] for i in a if i%2 == 1])
print(alice-bob)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
alice = sum([a[i] for i in range(0,n,2)])
bob = sum([a[i] for i in range(1,n,2)])
print(alice-bob)
import sys
sys.setrecursionlimit(10**6)

N,M=map(int,input().split())
V=list(map(int,input().split()))

P=[i for i in range(N)]
size=[1 for i in range(N)]

def find(x):
    if x==P[x]:
        return x
    else:
        return find(P[x])
    
def union(y,z):
    Y=find(y)
    Z=find(z)
    if size[y]>=size[z]:
        P[Z]=P[Y]
        size[Y]+=size[Z]
    else:
        P[Y]=P[Z]
        size[Z]+=size[Y]

for i in range(M):
    x,y=map(int,input().split())
    if find(x)!=find(y):
        union(x,y)
#print(P)
S=[]
for i in range(N):
    S.append(find(i))
#print(S)
D={}
O={}
for i in range(N):
    if S[i] not in D:
        D[S[i]]=V[i]
        O[S[i]]=1
    else:
        O[S[i]]+=1
        if D[S[i]]>V[i]:
            D[S[i]:V[i]]
#print(D,O)
One=0
#print("S",S)
for i in O:
    #print(O[i])
    if O[i]==1:
        One+=1
#print("One",One)
if (One-1)*2>N:
    print("Impossible")
    exit()
W=[]
for i in range(N):
    W.append([V[i],S[i]])
W.sort()
#print(W)
ans=sum(D.values())
#print(ans)
#print(D)
if len(D)==1:
    print(0)
    exit()
for i in range(len(D)-1):
    if W[i][1] in D:
        if D[W[i][1]]==W[i][0]:
            continue
        else:
            ans+=W[i][0]
    else:
        ans+=W[i][0]
print(ans)

### FIXED CODE ###

N,M=map(int,input().split())
A=list(map(int,input().split()))
P=[i for i in range(N)]
size=[1 for i in range(N)]

def find(a):
    if a==P[a]:
        return a
    else:
        return find(P[a])
        
def union(b,c):
    B=find(b)
    C=find(c)
    if size[B]>=size[C]:
        P[C]=P[B]
        size[B]+=size[C]
    else:
        P[B]=P[C]
        size[C]+=size[B]
for i in range(M):
    x,y=map(int,input().split())
    if find(x)!=find(y):
        union(x,y)
        
p=[]
for i in range(N):
    p.append([A[i],find(P[i])])
#print(p)
p.sort()
ANS1=[]
ANS2=[]
d={}
for i in range(N):
    if p[i][1] in d:
        ANS2.append(p[i][0])
    else:
        d[p[i][1]]=1
        ANS1.append(p[i][0])
#print(ANS1,ANS2)
if (len(ANS1)+len(ANS1)-2)>N:
    print("Impossible")
elif len(ANS1)==1:
    print(0)
else:
    ANS=sum(ANS1)+sum(ANS2[:len(ANS1)-2])
    print(ANS)
N = int(input())


def kakuinowa(n):
    a = str(n)
    s = 0
    for i in range(len(a)):
        s += int(a[i])
    return s

import math
m = kakuinowa(N)
for i in range(int(math.log10(N)) + 1):
    n = kakuinowa((N // 10**i) * 10**i - 1)
    if n > m:
        m = n


print(m)

### FIXED CODE ###

a = input()
a = list(a)
l = len(a)
for i in range(l):
    a[i] = int(a[i])
m = sum(a)
for i in range(l):
    n = a[i]-1 + 9*(l-i-1)
    if n > m:
        m = n
print(m)
S = input()
Sunny, Cloudy, Rainy
if(S=="Sunny"):
    print("Cloudy")
elif(S=="Cloudy"):
    print("Rainy")
elif(S=="Rainy"):
    print(Sunny)

### FIXED CODE ###

S = input()
if(S=="Sunny"):
    print("Cloudy")
elif(S=="Cloudy"):
    print("Rainy")
elif(S=="Rainy"):
    print("Sunny")
s = input()
a = [int(c) for c in a]
total = sum(a)
print(total)

### FIXED CODE ###

s = input()
a = [int(c) for c in s]
total = sum(a)
print(total)
import sys
import bisect

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n = ni()
l = sorted(nm())

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        a = l[i]
        b = l[j]
        idx = bisect.bisect_left(l, a + b)
        if idx > j: ans += idx - j - 1
print(ans)

### FIXED CODE ###

A, B = map(int, input().split())
print(max(A - 2 * B, 0))