Problem:


Score : 100 points

Problem Statement

The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)

We will close the window so as to minimize the total horizontal length of the uncovered part of the window.
Find the total horizontal length of the uncovered parts of the window then.

Constraints

1 \leq A \leq 100

1 \leq B \leq 100

A and B are integers.

Input

Input is given from Standard Input in the following format:

A B

Output

Print the total horizontal length of the uncovered parts of the window.

Sample Input 1

12 4

Sample Output 1

4

We have a window with a horizontal length of 12, and two curtains, each of length 4, that cover both ends of the window, for example. The uncovered part has a horizontal length of 4.

Sample Input 2

20 15

Sample Output 2

0

If the window is completely covered, print 0.

Sample Input 3

20 30

Sample Output 3

0

Each curtain may be longer than the window.



Sample input:
12 4


Sample output:
4

Submission status: Runtime Error

Solution code:
x=A
while x>=B:
  x-=B
 return(x)

Submission status: Runtime Error

Solution code:
A = input()
B = input()
B *= 2
if A < B:
    print('0')
else:
    print(A - B)

Submission status: Runtime Error

Solution code:
def main():
  n=int(input())
  a=sorted(list(map(int,input().split())))

  result=0
  dic={}
  dic[0]=0

  for i in range(1,a[-1]+100):
    if i in a:
      dic[i]=dic[i-1]+a.count(i)
    else:
      dic[i]=dic[i-1]

  #print(dic)

  for i in range(n-2):
    for j in range(i+1,n-1):
      if a[i]+a[j]>a[j+1]:
        temp=a[i]+a[j]
        #print(temp,a[j],a[-1])
        result+=dic[min(a[-1],temp-1)]-dic[a[j]]
        #print(a[i],a[j],a[j+1:],result)

  print(result)



if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def func():
  A,B= map(int,input().split())
  if A >= B*2:
  	print(A-2B)
  else:
  	print(0)
  
if __name__=="__main__":
  print("Input two Integers with space")
  func()

Submission status: Runtime Error

Solution code:
A,B= map(int,input().split())

if A >= B*2:
  print(A-2B)
else:
  print(0)

Submission status: Runtime Error

Solution code:
gomi=input()
tako=[int(i) for i in input().split()]
print(int((sum(tako)**2-sum([i**2 for i in tako]))/2))

Submission status: Runtime Error

Solution code:
a,b = map(input().split(' '))
print(maximum(a-2*b,0))

Submission status: Runtime Error

Solution code:
a,b = map(input().split(' '))
print(max(a-2*b,0))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A,B=input().sp;it()
print(int(A)-int(B)*2)

Submission status: Runtime Error

Solution code:

from scipy.sparse.csgraph import floyd_warshall as fw
N, M, L = map(int, input().split())

# 町間の道の長さのマトリックスを初期値無限で作成
S = [[float("INF") for i in range(N)] for i in range(N)]

# 町間の道の長さ情報をマトリックスに入力
for i in range(M):
    a, b, c = map(int,input().split())
    S[a-1][b-1] = c
    S[b-1][a-1] = c


# ワーシャルフロイド法で最短距離のマップを生成
Sf = fw(S)

T = [[float("INF")for i in range(N)] for i in range(N)]

# 町間を補給なしで通行可能な場合は1、不可能な場合はINFとしてマトリックスを作成
# （町間距離がタンク容量より大きい場合は通行不可）
for i in range(N):
    for j in range(N):
        if Sf[i][j] <= L:
            T[i][j] = 1

# ワーシャルフロイド法で町間移動可否のマップを生成
# すぐ上のfor文で、補給なしで移動できない町間の移動コストはINFにしたが、
# この処理で複数回の補給を行えば移動できる距離を
Tf = fw(T)

for i in range(int(input())):
    a, b = map(int, input().split())
    if Tf[a-1][b-1] != float("INF"):
        print(int(Tf[a-1][b-1])-1)
    else:
        print(-1)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A,B=Imput()
print(int(A)-int(B)*2)

Submission status: Runtime Error

Solution code:
N = int(input())
lst = list(map(int, input().split()))
ret = 0
for idx_a, a in enumerate(lst[:-2]):
    for idx_b, b in enumerate(lst[idx_a + 1:-1]):
        for idx_c, c in enumerate(lst[idx_a + idx_b + 2:]):
            if a < b + c and b < c + a and c < a + b:
                ret += 1
print(ret)

Submission status: Runtime Error

Solution code:
mado = int(input())
ka-ten = int(input())
 
n = mado - (ka-ten*2)
 
if n >= 0:
  print(n)
else:
  print(0)

Submission status: Runtime Error

Solution code:
mado = input()
ka-ten = input()

n = mado - (ka-ten*2)

if n >= 0:
  print(n)
else:
  print(0)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(float, input().split()))

for i in a:
	sum += i 
	double = i ** 2
print((sum**2-double)/2)

Submission status: Runtime Error

Solution code:
n = input()
a = list(map(double, input().split()))

for i in a:
	sum += i 
	double = i ** 2
print((sum**2-double)/2)

Submission status: Runtime Error

Solution code:
A = input()
B = input()
if A > 2*B:
  print(A-2*B)
else:
  print(0)

Submission status: Runtime Error

Solution code:
N=int(input())
b=[]
L=[]
b=input().split()
M=[]
for i in range(N):
    L.append(int(b[i]))
L.sort()
L.reverse()
#print(L)
x=0
y=0
p=0
index=0
for i in range(N-2):
    x=L.pop(0)
    for j in range(N-2-i):
        y=L.pop(0)
        for k in range(N-2-i-j):
#            print('i,j,k :'+str(i)+str(j)+str(k)+':'+str(x)+str(y)+str(L[k]))
            if x<y+L[k]:
                index+=1
            else:
                break
        M.append(y)
    L=M+L
    M.clear()
print(index)

Submission status: Runtime Error

Solution code:
print(max(0,eval(input().replace('','-2*'))))

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())

0<=A<=100
0<=B<=100
 
if A>B*2:
  print(A-B*2)
 
else:
  print(0)

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())

0<=A<=100
0<=B<=100

if A>B*2:
  print(A-B*2)

else:
  print(0)

Submission status: Runtime Error

Solution code:
A = input()
B = input()

0<=int(A)<=100
0<=int(B)<=100

if int(A)>int(B)*2:
  print(int(A)-int(B)*2)

else:
  print(0)

Submission status: Runtime Error

Solution code:
0<=int(A)<=100
0<=int(B)<=100

if int(A)>int(B)*2:
  print(int(A)-int(B)*2)

else:
  print(0)

Submission status: Runtime Error

Solution code:
if int(A)-int(B)*2 <=0:
  print('0')

else:
  print(str(int(A)-int(B)*2))

Submission status: Runtime Error

Solution code:
if A-2*B <= 0:
  print(0)

else:
  print(A-2*B)

Submission status: Runtime Error

Solution code:
    a,b = map(int, input().split())
    print( max(0, a-b*2) )

Submission status: Runtime Error

Solution code:
a,b = (int, input().split())
print( max(0, a-b*2) )

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
D = list(map(int, input().split()))
#print(D)
sum = 0
for i in range(N):
  for j in range(i+1,N):
    sum += D[i]*D[j]

print(sum)

Submission status: Runtime Error

Solution code:
i = input(map(int, input().split()))
A = i[0]
B = i[1]

if A-B*2>0;
	print(A-B*2)
  else;
	print(0)

Submission status: Runtime Error

Solution code:
A = input()
B = input()

if B > A/2:
  print(0)
else:
  print(A-2*B)

Submission status: Runtime Error

Solution code:
from bisect import bisect_left
 
N = int(input())
Lmat = [int(n) for n in input().split()]
Lmat.sort()
 
sum = 0

for i in range(N):
    for j in range(i + 1, N):
        sum += bisect_left(Lmat, Lmat[i]+Lmat[j]) - (j + 1)
print(sum)

Submission status: Runtime Error

Solution code:
a, b = int(input().split())
if 2*b > a:
  print(0)
else:
  print(a-2*b)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

horizontal_length = b * 2

uncovered_part = a - horizontal_length

if uncovered_part < 0:
  uncovered_part = 0
  
print str(uncovered_part)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

horizontal_length = b * 2

uncovered_part = a - horizontal_length

if uncovered_part > 0:
  return
else:
  uncovered_part = 0
  
print str(uncovered_part)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

horizontal_length = b * 2

uncovered_part = a - horizontal_length

if uncovered_part > 0:
  return
else:
  uncovered_part = 0
  
print uncovered_part

Submission status: Runtime Error

Solution code:
a, b = map(int, intput().split())
print(max(0, a - 2 * b))

Submission status: Runtime Error

Solution code:
n = input()
a = list(map(int, input().split()))

for i in a:
	sum += a[i] 
	double = a[i] ** 2
print((sum**2-double)/2)

Submission status: Runtime Error

Solution code:
a , b = map(int, input().split())

if (a <= b * 2):
  print 0:
else:
  print a - b * 2:

Submission status: Runtime Error

Solution code:
a , b = map(int, input().split())

if (a <= b * 2):
  print 0
else:
  print a - b * 2

Submission status: Runtime Error

Solution code:
a, b = int(input())
if b > 2*a:
  print(b - 2*a)
else:
  print(0)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
if a<=b*2:
    print(0)
else:
    print(a-b*2)a, b = map(int, input().split())

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
if a<=b*2:
    print(0)
else:
    print(a-b*2)a, b = map(int, input().split())
if a<=b*2:
    print(0)
else:
    print(a-b*2)

Submission status: Runtime Error

Solution code:
import bisect
N = int(input())
L = list(map(int,input().split()))
L.sort()
sum = 0
for i in range(0,N):
  L_1st= L[i]
  for j in range(i+1,N):
    L_2nd = L[j]
    c_min = b-a+1
    c_max = b+a-1
    l = bisect.bisect_left(Ls,c_min,lo = j+1)
    if l!= N:
      r = bisect.bisect_right(Ls,c_max,lo = j+1)
      if r:
        r = r-1
        if r>= l:
          sum += r-l+1
print(sum)

Submission status: Runtime Error

Solution code:
N = int(input())
S = list(input())

slime = 1

for i in range(0,N-1):
  if S[i] != S[i+1]:
    slime += 1
  else:
    slime += 0
    
print(slime)

Submission status: Runtime Error

Solution code:
C=A-2*B
if C>0:
    uncovered = C
else:
    uncovered = 0
print('the lenth of unvocered =',uncovered)

Submission status: Runtime Error

Solution code:
import copy
def warshall_floyd(dist):
    #d[i][j]: iからjへの最短距離
    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])
    return dist

n, m, l = map(int, input().split()) #N:頂点数　M:辺の数 L:容量
dist = [[float("inf") for i in range(n)] for j in range(n)]
dist2 = copy.deepcopy(dist) 
for i in range(n):
    dist[i][i] = 0

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

warshall_floyd(dist)


for i in range(n):
    for j in range(n):
        if dist[i][j] <= l:
            dist2[i][j] = 1

warshall_floyd(dist2)
q = int(input())
for i in range(q):
    s, t = map(int, input().split())
    ans = dist2[s-1][t-1]-1
    if dist2[s-1][t-1] == float("inf"):
        ans = -1
    print(ans)

Submission status: Runtime Error

Solution code:
A , B = map(int, input().split())
C = A - B*2
if C <= 0
	C = 0
else 
print(C)

Submission status: Runtime Error

Solution code:
A = input(int())
B = input(int())
C = A - B*2
if C <= 0
	C = 0
else 
print(C)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

N,M,L = map(int,input().split())
ABC = [list(map(int,input().split())) for _ in [0]*M]
Q = int(input())
ST = [list(map(int,input().split())) for _ in [0]*Q]


INF = (L+1)*N
d = [[INF]*N for _ in [0]*N]
for i in range(N):
    d[i][i] = 0
for a,b,c in ABC:
    a-=1;b-=1
    d[a][b] = c
    d[b][a] = c

def Warshall_Floyd(d,N=None):
    if N==None : N = len(d)
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j],d[i][k]+d[k][j])

Warshall_Floyd(d,N)

d2 = [None]*N
for i,row in enumerate(d):
    d2[i] = [1 if e<=L else INF for e in row]
    d2[i][i] = 0

Warshall_Floyd(d2,N)

for s,t in ST:
    s-=1;t-=1
    ans = (d2[s][t]%INF)-1
    print(ans)

Submission status: Runtime Error

Solution code:
N, M, L = map(int,input().split())
ABC = [list(map(int, input().split())) for _ in [0] * M]
Q = int(input())
ST = [list(map(int, input().split())) for _ in [0] * Q]


INF = (L + 1) * N
d = [[INF] * N for _ in [0] * N]
for i in range(N):
    d[i][i] = 0
for a, b, c in ABC:
    a -= 1
    b -= 1
    d[a][b] = c
    d[b][a] = c

def Warshall_Floyd(d, N=None):
    if N is None:
      N = len(d)
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])

Warshall_Floyd(d, N)

d2 = [None] * N
for i, row in enumerate(d):
    d2[i] = [1 if e <= L else INF for e in row]
    d2[i][i] = 0

Warshall_Floyd(d2, N)

for s, t in ST:
    s -= 1
    t -= 1
    ans = (d2[s][t] % INF) - 1
    print(ans)

Submission status: Runtime Error

Solution code:

from scipy.sparse import csr_matrix #pypyだとエラーになるので、pythonを使うこと
from scipy.sparse.csgraph import shortest_path, floyd_warshall
import numpy as np

import sys
def input():
	return sys.stdin.readline().strip()

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

graph = np.full((N, N), np.inf)
for i in range(M):
	A, B, C = list(map(int, input().split()))
	graph[A - 1, B - 1] = C
	graph[B - 1, A - 1] = C

graph = csr_matrix(graph)
dist = floyd_warshall(graph, directed=False)
graph2 = np.full((N, N), np.inf)
for i in range(N):
	for j in range(N):
		if dist[i, j] <= L:
			graph2[i, j] = 1
graph2 = csr_matrix(graph2)
num = shortest_path(graph2, directed=False)


Q = int(input())
for q in range(Q):
	s, t = list(map(int, input().split()))
	if num[s - 1][t - 1] < 10000000:
		print(int(num[s - 1][t - 1] - 1))
	else:
		print(-1)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
if a - a*b >= 0:
  print(a-2*b)
else
  print("0")

Submission status: Runtime Error

Solution code:
a,b = map(raw_input().split())
print max(0,a-2*b)

Submission status: Runtime Error

Solution code:
a = input()
b = input()
print max(0,a-2*b)

Submission status: Runtime Error

Solution code:
from bisect import bisect_left,bisect_right
import sys
def input(): return sys.stdin.readline().strip()
n=int(input())
ll=sorted(list(map(int,input().split())))
c=0
lll=len(ll)
for i in range(lll-2):
    for j in range(i+1, lll-1):
        uk = bisect_left(ll, ll[i] + ll[j], j+1)
        lk = bisect_right(ll, abs(ll[j] - ll[i]), j+1, uk)
        c+=uk-lk
print(c)

Submission status: Runtime Error

Solution code:
N = int(input())
S = input()
 
ans = 1
for i in range(N - 1):
    if S[i] != S[i + 1]:
        ans = ans + 1
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
S = list(input().split())
 
ans = 1
for i in range(N - 1):
    if S[i] != S[i + 1]:
        ans = ans + 1
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
d = [int(input()) for i in range(N)]
sum = 0
for i in range(N):
    if i > 0:
        for j in range(i):
            sum = sum + d[i] * d[j]
print(sum)

Submission status: Runtime Error

Solution code:
N = int(input())
d = [int(input()) for k in range(N)]
sum = 0
for i in range(N):
    if i > 0:
        for j in range(i):
            sum = sum + d[i] * d[j]
print(sum)

Submission status: Runtime Error

Solution code:
N = int(input())
d = [int(input()) for k in range(N)]
sum = 0
for i in range(N):
    for j in range range(i-1):
        sum = sum + d[i] * d[j]
print(sum)

Submission status: Runtime Error

Solution code:
N = int(input())
d = list(map(int, input().split()))
sum = 0
for i in range(N):
    for j in range range(i-1):
        sum = sum + d[i] * d[j]
print(sum)

Submission status: Runtime Error

Solution code:
a,b = map(int,input())
ans = a-2*b
if ans <= 0:
  print(0)
else:
  print(ans)

Submission status: Runtime Error

Solution code:
a,b = map(int,inpout())
ans = a-2*b
if ans <= 0:
  print(0)
else:
  print(ans)

Submission status: Runtime Error

Solution code:
A,B=map(int,input().spllit())
if A - B * 2 < 0:
  print(0)
else:
  print(A - B * 2)

Submission status: Runtime Error

Solution code:
A, B=map(int, input().split())
ans=a-2*b if a-2*b>0 else 0
print(ans)

Submission status: Runtime Error

Solution code:
A = int(input(stdin))
B = int(input(stdin))
 
if(A > 2 * B):
  print(A - 2 * B)
else:
  print("0")

Submission status: Runtime Error

Solution code:
int A = input(stdin)
int B = input(stdin)
 
if(A > 2 * B):
  print(A - 2 * B)
else:
  print("0")

Submission status: Runtime Error

Solution code:
int A = input(stdin)
int B = input(stdin)

if(A > 2 * B):
  return A - 2 * B
else:
  return 0

Submission status: Runtime Error

Solution code:
#coding:utf-8
a, b = map(int, input().split)
print(min(0, a - 2*b))

Submission status: Runtime Error

Solution code:
#coding:utf-8
a, b = map(int, input().split)
print(max(0, a - 2*b))

Submission status: Runtime Error

Solution code:
from bisect import *
if __name__ == '__main__':
    N = int(input())
    L = sorted(map(int, input().split()))
    print(sum(jdx - bisect(L, a - L[jdx], 0, jdx) for idx, a in enumerate(L) for jdx in range(idx)))

Submission status: Runtime Error

Solution code:
def lowerBound(nums, target):
    if nums[-1] < target: return -1
    lp = 0
    rp = len(nums) - 1
    mp = lp + rp >> 1
    while lp <= rp:
        mp = lp + rp >> 1
        if nums[mp] == target:
            return mp
        if nums[mp] < target:
            lp = mp + 1
        else:
            rp = mp - 1
    return mp if target < nums[mp] else -1

if __name__ == '__main__':
    N = int(input())
    L = [int(l) for l in input().split()]
    L.sort()
    ret = 0
    for idx in range(len(L) - 1, 1, -1):
        for jdx in range(idx - 1, 0, -1):
            c = L[idx] - L[jdx] + 1
            ldx = lowerBound(L[:jdx], c)
            if ldx == -1: continue
            ret += jdx - ldx
    print(ret)

Submission status: Runtime Error

Solution code:
a,b = int(input())
s = a-b*2
if s <= 0:
    print(0)
else:
    print(s)

Submission status: Runtime Error

Solution code:
N=int(input())
List=list(map(int,input().split()))
c=0
for i in range(N-1):
  for j in range(i+1,N):
    c=c+(List[i]*List[j])
print(c)

Submission status: Runtime Error

Solution code:
N=int(input())
List=list(map(int,input().split()))
c=0
for i in range(N-1):
  for j in range(i+1:N):
    c=c+(List[i]*List[j])
print(c)

Submission status: Runtime Error

Solution code:
S = raw_input()
S = S.split()
n,m,l = int(S[0]),int(S[1]),int(S[2])
MAX = int(1e15)
G = []
for i in xrange(n):
    temp=[]
    for j in xrange(n):
        temp.append(MAX)
    G.append(temp)
for i in xrange(n):
    G[i][i]=0

for i in xrange(m):
    S = raw_input()
    S = S.split()
    a,b,c = int(S[0]),int(S[1]),int(S[2])
    a-=1
    b-=1
    G[a][b]=c
    G[b][a]=c
for k in xrange(n):
    for i in xrange(n):
        for j in xrange(n):
            val = G[i][k]+G[k][j]
            G[i][j] = min(G[i][j],val)
dd = G
for i in xrange(n):
    for j in xrange(n):
        if(dd[i][j]<=l):
            G[i][j]=1
        else :
            G[i][j]=MAX
        if(i==j):
            G[i][j]=0

for k in xrange(n):
    for i in xrange(n):
        for j in xrange(n):
            val = G[i][k]+G[k][j]
            G[i][j] = min(G[i][j],val)
#print(G)
q = input()
while(q):
    q-=1
    S = raw_input()
    S =S.split()
    s,t = int(S[0]),int(S[1])
    s-=1
    t-=1
    p = G[s][t]
    if(p>=MAX):
        print -1
    else:
        print p-1

Submission status: Runtime Error

Solution code:
0from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
#import random  # randome is not available at Codeforces
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
#eps=10**(-10)
#ts=time.time()
#sys.setrecursionlimit(10**6)
input=lambda: sys.stdin.readline().rstrip()

show_flg=False
show_flg=True

a,b=MI()
print(max(0,a-2*b))

Submission status: Runtime Error

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

print(a-b*2 if a-b*2 >= 0 else 0)

Submission status: Runtime Error

Solution code:
n = int(input())
ds = [int(x) for x in input().split()]
ds2 = [x*x for x in ds]
s = 0
s2 = 0
for i in range(n):
  s += ds[i]
  s2 += ds2[i]
ss = 0
for i in range(n):
  ss += ds[i] * s

print((ss - s2) / 2 )

Submission status: Runtime Error

Solution code:
#import numpy as np
n = int(input())
#ds = np.array([int(x) for x in input().split()])
ds = [int(x) for x in input().split()]
ds2 = [x*x for x in ds]
s = sum(ds)
#print((sum(ds * sum(ds)) - sum(ds ** 2)) / 2 )
print(int((sum(ds * s) - sum(ds2)) / 2 ))

Submission status: Runtime Error

Solution code:
#################################
##ワーシャルフロイド法 n~3
#################################
def warshall_floyd(n,d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d
##############################
from scipy.sparse.csgraph import csgraph_from_dense,dijkstra,floyd_warshall
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
ans = int(0)
N,M,L =LI()
s = []
t = []
dp = [[inf] * (N) for _ in range(N)]
for i in range(M):
    a, b, c = map(int, input().split())
    dp[a-1][b-1] = c
    dp[b-1][a-1] = c
Q = I()
for i in range(Q):
    a,b = LI()
    s.append(a-1)
    t.append(b-1)

for i in range(N):
    dp[i][i] = 0

#print(warshall_floyd(N,dp))
#d1 = [[0] * (N) for _ in range(N)]
#d1 = warshall_floyd(N,dp)
G = csgraph_from_dense(dp, null_value=10**9)
d1 = floyd_warshall(G)

newdp = [[inf] * (N) for _ in range(N)]
for i in range(N):
    for j in range(i+1,N):
        if d1[i][j]<=L:
            newdp[i][j] = 1
            newdp[j][i] = 1

for i in range(N):
    newdp[i][i] = 0
#print(newdp)
#print(warshall_floyd(N,newdp))
#d2 = [[0] * (N) for _ in range(N)]
#d2 = warshall_floyd(N,newdp)
G = csgraph_from_dense(newdp, null_value=10**9)
d2 = floyd_warshall(G)

for i in range(Q):
    ans = d2[s[i]][t[i]]-1
    if ans!= inf:
        print(int(ans))
    else:
        print("-1")

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
#n,k=map(int,input().split())
#H=list(map(int,input().split()))
print(max(a-2*b),0)

Submission status: Runtime Error

Solution code:
N = int(input())
L = input().split()
L = [int(i) for i in L ]
total = 0

L_sort = sorted(L)


def test(total):
	for i in range(N-2):
		for j in range(i+1,N - 1):
							temp_L = L_sort[j + 1:]
							
							#total += len(temp_L[temp_L < L_sort[i]+ L_sort[j]])
							temp_L = [k for k in temp_L if k < L_sort[i]+ L_sort[j]]
							total += len(temp_L)

	return total
						
				  	
print(test(total))

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())
 
answer = A - 2*B
if answer < 0:
  answer = 0
 
print(answer)

Submission status: Runtime Error

Solution code:

num1 = int(input())
num2 = int(input())

if num1 >= 2*num2:
    print(num1 - 2*num2)
else:
    print(0)

Submission status: Runtime Error

Solution code:

num1 = int(input())
num2 = int(input())

if num1 >= 2*num2:
    print(num1 - 2*num2)
else:
    print('0')

Submission status: Runtime Error

Solution code:
A = input()
B = input()

answer = A - 2B
if answer < 0:
  answer = 0

print(answer)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
#ABC143D
import sys
import math
import collections
#sys.setrecursionlimit(100000)
 
 
n=int(input())
 
tmp = input().split()
l = list(map(lambda a: int(a), tmp))
 
sum=0
 
for i in range(n):
	for j in range(i+1,n):
		tmp1 = l[i]+l[j]
		tmp2 = abs(l[i]-l[j])
		for k in range(j+1,n):
			if((tmp1>l[k])and(tmp2<l[k])):
				sum+=1
print(sum)

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
c=b*2
if a-c>0:
  print(a-c)
else:
  print("0")

Submission status: Runtime Error

Solution code:
A, B = [int(x) for x in innput().split()]
print(max(0, A - B*2))

Submission status: Runtime Error

Solution code:
from bisect import bisect_right
N = int(input())
D = list(map(int, input().split()))
D.sort(reverse=False)

count = 0

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        l = D[:N - j - 1]
        ind = bisect_right(D, D[i] + D[j] - 1)
        count += max(ind - j - 1, 0)

print(count)

Submission status: Runtime Error

Solution code:

a, b = map(int, input.split(''))
ans = a - 2 * b
if ans < 0:
	ans = 0
print(ans)

Submission status: Runtime Error

Solution code:
a, b = map(int, input.split(''))
ans = a - 2 * b
if ans < 0:
  ans = 0
 print(ans)

Submission status: Runtime Error

Solution code:
import sys
input=sys.stdin.readline
n,m,l=map(int,input().split())
INF=10**10
graph=[[INF for i in range(n)] for j in range(n)]
fuel=[[INF for i in range(n)] for j in range(n)]
for i in range(n):
    graph[i][i]=0
for i in range(m):
    a,b,c=map(int,input().split())
    a-=1;b-=1
    if c>l:continue
    graph[a][b],graph[b][a]=c,c
for i in range(n):
  for j in range(n):
    for k in range(n):
      graph[j][k]=min(graph[j][k],graph[j][i]+graph[i][k])
for i in range(n):
    for j in range(n):
        if graph[i][j]<=l:
            fuel[i][j]=1
for i in range(n):
  for j in range(n):
    for k in range(n):
      fuel[j][k]=min(fuel[j][k],fuel[j][i]+fuel[i][k])
q=int(input())
for i in range(q):
    s,t=map(int,input().split())
    s-=1;t-=1
    if fuel[s][t]==INF:print(-1)
    else:print(fuel[s][t]-1)

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
L = np.array([int(l) for l in input().split(' ')])
counts =0

for i in range(N):
    for j in range(i+1,N):
        B2  = L[j+1:][(L[j+1:]<L[i]+L[j]) & (L[j+1:]>abs(L[i]-L[j]))]
        counts +=len(B2)
print(counts)

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
L = np.array([int(l) for l in input().split(' ')])
counts =0

for i in range(N):
    for j in range(i+1,N):
        B2  = L[j+1:][(L[j+1:]<L[i]+L[j]) & (L[j+1:]>abs(L[i]-L[j]))]
        counts +=len(B2)
print(counts)

Submission status: Runtime Error

Solution code:
import bisect
#input
n = int(input())
list1 = list(map(int,input().split()))
list1.sort()

cout = 0 #最終的な三角形の個数

for i in range(n-2): #リストから三角形が作れなくなるまでループ
	o = list1[i] #1辺を確定、そのままリストから消去
	for j in range(i+1,n-1): #残りの二辺のループ(iで使っている次の値から)
		p = list1[j] #２辺目を確定

		b = o+p -1 #昇順にソートしてあるので、c<a+b条件のみ計算

		d = bisect.bisect_right(list1[j+1:],b) #３辺目を確定
		
		cout += d

print(cout)

Submission status: Runtime Error

Solution code:
def main():
    number_of_bars = int(input())
    bar_list = list(map(int,input().split()))
    print(len(traiangle_maker(bar_list))//3)
    # print(traiangle_maker(bar_list))


def traiangle_maker(bar_list):
    bar_list.sort(reverse=True)
    result_list = []
    for i in range(len(bar_list)):
        for j in range(len(bar_list)):
            if i == j or bar_list[i] < bar_list[j]:
                continue
            minimum_length = bar_list[i] - bar_list[j]
            max_length = bar_list[i] + bar_list[j]
            for k in bar_list:
                if k < minimum_length:
                    break
                if k > minimum_length and k < max_length and k != bar_list[i] and k != bar_list[j]:
                    traiangle = [bar_list[i],bar_list[j],k]
                    result_list.append(traiangle)

    return result_list


main()

Submission status: Runtime Error

Solution code:
a,b=int(input().split())
if a-b*2<=0:
  
  print(0)
else:
  print(a-b*2)

Submission status: Runtime Error

Solution code:
a,b=int(input().split())
if a-b＊2<=0:
  
  print(0)
else:
  print(a-b＊2)

Submission status: Runtime Error

Solution code:
a,b=int(input().split())
if a-(b＊2)<=0:
  
  print(0)
else:
  print(a-(b＊2))

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
if a-b＊2<=0:
  
  print(0)
else:
  print(a-b＊2)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
if a-b＊2<0:
  
  print(0)
else:
  print(a-b＊2)

Submission status: Runtime Error

Solution code:
A,B = map(int, input().split())
if A-2*B <= 0:
    print(o)
else:
    print(A-2*B)

Submission status: Runtime Error

Solution code:
a,b=int(input().split())
if a-b＊2<0:
  
  print(0)
else:
  print(a-b＊2)

Submission status: Runtime Error

Solution code:
a,b=int,input().split()
if a-b＊2<=0:
  
  print(0)
else:
  print(a-b＊2)

Submission status: Runtime Error

Solution code:
a,b=map(int.input(),split())
if a-b＊2<=0:
  
  print(0)
else:
  print(a-b＊2)

Submission status: Runtime Error

Solution code:
a,b=map(int.input(),split())
if a-b＊2<=0:
 print(0)
else:
 print(a-b＊2)

Submission status: Runtime Error

Solution code:
a,b=map(int.input(),split())
if a-b＊2<0:
 print(0)
else:
 print(a-b＊2)

Submission status: Runtime Error

Solution code:
N=int(input())
S=str(input())

a=N

for i in range(N-1):
    if S[i]==S[i+1]:
        a-=1

print(a)

Submission status: Runtime Error

Solution code:
a,b=map(int.input(),split())
if a-b＊2>=0:
  print(a-b＊2)
else:
  print(0)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

print(max(o, a-2*b))

Submission status: Runtime Error

Solution code:
a,b=map(int.input(),split())
if a-b＊2>=0:
  print(a-b＊2)
else:
   print('0')

Submission status: Runtime Error

Solution code:
N = int(input())
d = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
  for j in range(i + 1, N):
    ans += d[i] * d[j]
print(ans)

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<numeric>
#include<cctype>
#include<random>
using namespace std;

//fixed << setprecision(10)
#define Yes(a) a ? "Yes" : "No";
#define YES(a) a ? "YES" : "NO";
#define rep(i,n) for(int i=0;i<n;i++)

int gcd(int a,int b) {
	if (a < b) {
		int tmp = a;
		a = b;
		b = tmp;
	}
	int r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}
/*
map<int, int> prime;
void Prime(long long int n) {
	for (int i = 2; i <= n; i++) {
		int count = 0;
		while (n % i == 0) {
			count++;
			n /= i;
		}
		if (count != 0) {
			prime.insert(make_pair(i, count));
		}
	}
}
*/
int main() {
	int a, b;
	cin >> a >> b;
	if (a <= 2 * b)
		cout << 0 << endl;
	else
		cout << a - 2 * b << endl;
}

Submission status: Runtime Error

Solution code:
a,b=int.input(),split()
if a-b＊2>=0:
  print(a-b＊2)
else:
   print('0')

Submission status: Runtime Error

Solution code:
a,b=int.input(),split()
if a-b＊2>=0:
  print(a-b＊2)
else:
   print(0)