Harryxun/stf_run huggingface dataset:
n = int(input())
h = [int(i) for i in input().split()]
import numpy as np

h = np.array(h)
zero = np.array([int(0) for i in range(len(h))])

def calc(h, zero, minus):
    for k in range(len(h)):
        if minus[k] != 0:
            if k == len(h) - 1:
                zero[k] = zero[k] + 1
                return
            for w in range(k+1, len(h)):
                if minus[w] == 0:
                    zero[k:w] = zero[k:w] + 1
                    return
                elif w == len(h) - 1:
                    zero[k::] = zero[k::] + 1
                    return

def main(h, zero):
    i = 0
    minus = h - zero
    while np.sum(minus) != 0:
        calc(h ,zero, minus)
        i += 1
        minus = h - zero
    print(i)

main(h, zero)

### FIXED CODE ###

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

ans_list = [0]*N
pen_num = 0
cor_num = 0

for i in range(M):
  p_i, S_i = input().split()
  p_i = int(p_i)
  
  if (ans_list[p_i] == 0):
    if(S_i == "WA"):
      pen_num += 1
    elif(S_i == "AC"):
      cor_num += 1
      ans_list[p_i] = 1
      
print("{} {}".format(cor_num,pen_num))
  
  


### FIXED CODE ###

import itertools
N, M = map(int, input().split())

ans_list = [0]*(N+1)
pen_list = [0]*(N+1)

for i in range(M):
  p_i, S_i = input().split()
  p_i = int(p_i)
  
  if (ans_list[p_i] == 0):
    if(S_i == "WA"):
      a = pen_list[p_i]
      a += 1
      pen_list[p_i] = a
    elif(S_i == "AC"):
      ans_list[p_i] = 1

pen_lis_ans = list(itertools.compress(pen_list, ans_list))
cor_num = sum(ans_list)
pen_num = sum(pen_lis_ans)
                   
print("{} {}".format(cor_num,pen_num))
n=int(input())
s=input()
if n%2!=0:
  print('NO')
else:
  if s[0:n//2]==s[n//2:n]:
  print('Yes')
  else:
  print('No')

### FIXED CODE ###

n=int(input())
s=input()
if s[0:n//2]==s[n//2:n]:
  print('Yes')
else:
  print('No')
L = int(input())
s = []
for i in range(1,L+1):
    for j in range(1,L - i + 1):
        for k in range(1, L - i - j + 1):
            s.append(i * j * k)
print(max(s))





### FIXED CODE ###

L = int(input())

c = float(L) / 3
print(c * c * c)
#cording; UTF-8
a,b=[int(x) for x in input().split()]

S = a*b
L = 2*(a+b)
print(s, l)


### FIXED CODE ###

#cording; UTF-8
a,b=[int(x) for x in input().split()]

S = a*b
L = 2*(a+b)
print(S,L)
import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
sys.setrecursionlimit(10**6)

import math

mod = 10**9+7

n = ni()
a = na()
b,c = 1,0

def lcm(m,n):
    return (m*n)//math.gcd(m,n)

for i in a:
    b=lcm(b,i)

for i in a:
    c+=b//i

print(c%mod)

### FIXED CODE ###

import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
sys.setrecursionlimit(10**6)
from fractions import gcd

mod = 10**9+7

n = ni()
a = na()
b,c = 1,0

def lcm(m,n):
    return (m*n)//gcd(m,n)

for i in a:
    b=lcm(b,i)

for i in a:
    c+=b//i

print(c%mod)
import numpy as np
flag = False

N = int(input())
H = list(map(int, input().split()))
H = np.array(H)
D = (H[1:]-H[:-1])

for i in range(len(H[1:]-H[:-1])):
    if D[i] < -1:
        flag = True
        break
    elif D[i] == -1:
        if i-1 < 0:
            continue
        elif i+1 == len(D):
            continue
        else:
            if len(D[D[i+1] == -1]) >= 1:
                flag = True
                break
            elif len(D[D[i-1] == -1]) >= 1:
                flag = True
                break

if flag == True:
    print('No')
else:
    print('Yes')


### FIXED CODE ###

import sys

n = int(input())
h = list(map(int, input().split()))

for i in range(n-1):
    d = h[i+1] - h[i]
    if d >= 1:
        h[i+1] -= 1
    elif d < 0:
        print('No')
        sys.exit()
print('Yes')
from sys import stdin
import math

a,b,c,d = [int(x) for x in stdin.readline().rstrip().split()]
kouyaku = math.gcd(c, d)
koubai = c * d // math.gcd(c, d)
b_s = b - b//c - b//d + b//koubai
a_s = a-1 - (a-1)//c - (a-1)//d + (a-1)//koubai
print(b_s - a_s)

### FIXED CODE ###

from sys import stdin
import fractions
a,b,c,d = [int(x) for x in stdin.readline().rstrip().split()]
kouyaku = fractions.gcd(c, d)
koubai = c * d // fractions.gcd(c, d)
b_s = b - b//c - b//d + b//koubai
a_s = a-1 - (a-1)//c - (a-1)//d + (a-1)//koubai
print(b_s - a_s)
A, B, K = map(int, input().split())

L = list(range(A, B+1))
ans = L[:K] + L[-K:]
print(*ans, sep="\n")

### FIXED CODE ###

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

L = list(range(A, min(B, A+K))) + list(range(max(A, B-K+1), B+1))
L_no_duplication = set(L)
print(*sorted(L_no_duplication), sep="\n")
X,N=map(int,input().split())
P=list(map(int,input().split()))

if N==0:
    print(X)
    exit(0)

if X<min(P):
    ans=X
    print(ans)
    
elif X in range(min(P),max(P)+1):
    #大した大きい数じゃないので全探索すればいい
    ans_len=200 #ひとまずの仮定
    for i in range(min(P),max(P)+1):
        if i in P:
            continue
        else:
            l=abs(X-i)
            if l < ans_len:
                ans_len=l
                ans=i
    print(ans)
                
else:
    ans=X
    print(ans)

### FIXED CODE ###

X,N=map(int,input().split())
P=list(map(int,input().split()))

if N==0:
    print(X)
else:
    if X<min(P):
        ans=X
        print(ans)
    
    elif X in range(min(P),max(P)+1):
        #大した大きい数じゃないので全探索すればいい
        ans_len=200 #ひとまずの仮定
        for i in range(250):
            if i in P:
                continue
            else:
                l=abs(X-i)
                if l < ans_len:
                    ans_len=l
                    ans=i
        print(ans)
                
    else:
        ans=X
        print(ans)
A,B=map(int,input().split())
if A==1,B==2 or A==2,B==1:
  print(3)
elif A==1,B==3 or A==3,B==1:
  print(2)
else:
  print(1)

### FIXED CODE ###

a=int(input())
b=int(input())
print(6-a-b)
def cmb(n, r):
  n_ = math.factorial(n)
  n_r_ = math.factorial(n-r) 
  r_ = math.factorial(r)
  return n_//(r_*n_r_)
 
i = list(map(int, input().split(" ")))
k = i[1]
n = i[0]
a = 1000000007
 
for i in range(1, k+1):
  if n-k+1 >= i:
  	ni =  cmb(n-k+1,i)*cmb(k-1,i-1)
  	print(int(ni%a))
  else:
    print(0)

### FIXED CODE ###

import math
def cmb(n, r):
  n_ = math.factorial(n)
  n_r_ = math.factorial(n-r) 
  r_ = math.factorial(r)
  return n_//(r_*n_r_)

n,k = list(map(int, input().split(" ")))

for i in range(1, k+1):
  if n-k+1 >= i:
    ans =  cmb(n-k+1,i)*cmb(k-1,i-1)%(10**9+7)
  else:
    ans = 0
  print(ans)
n, k = map(int,input().sprit())
a = list(map(int,input().sprit()))
a.sort()
b = 0
for i in range(k)
	b += a[k]
print(b)

### FIXED CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
total = 0
for i in range(k):
    total+=p[i]
print(total)
n, a, b = list(map(int, input().split()))

mod = 10**9 + 7

import time
start = time.time()

# xの逆元を求める。フェルマーの小定理より、 x の逆元は x ^ (mod - 2) に等しい。計算時間はO(log(mod))程度。
# https://qiita.com/Yaruki00/items/fd1fc269ff7fe40d09a6
def modinv(x):
	return pow(x, mod-2, mod)

modinv_table = [-1] * (b+1)
for i in range(1, b+1):
    modinv_table[i] = modinv(i)

end = time.time()
# print("time: ", end - start)

def binomial_coefficients2(n, k):
    ans = 1
    for i in range(k):
        ans *= n-i
        ans *= modinv_table[i + 1]
        ans %= mod
    return ans

# (2 ** n - 1) - nCa - nCb
ans = power(2, n) - 1

ans -= (binomial_coefficients2(n, a) + binomial_coefficients2(n, b))
print(ans % mod)


# print(binomial_coefficients2 (5, 2) % mod)


### FIXED CODE ###

n, a, b = list(map(int, input().split()))

mod = 10**9 + 7

import time
start = time.time()


# x ** a をmodで割った余りを、O(log(a))時間で求める。
def power(x, a):
	if a == 0:
		return 1
	elif a == 1:
		return x
	elif a % 2 == 0:
		return power(x, a//2) **2 % mod
	else:
		return power(x, a//2) **2 * x % mod

# xの逆元を求める。フェルマーの小定理より、 x の逆元は x ^ (mod - 2) に等しい。計算時間はO(log(mod))程度。
# https://qiita.com/Yaruki00/items/fd1fc269ff7fe40d09a6
def modinv(x):
	return pow(x, mod-2, mod)

modinv_table = [-1] * (b+1)
for i in range(1, b+1):
    modinv_table[i] = modinv(i)

end = time.time()
# print("time: ", end - start)

def binomial_coefficients2(n, k):
    ans = 1
    for i in range(k):
        ans *= n-i
        ans *= modinv_table[i + 1]
        ans %= mod
    return ans

# (2 ** n - 1) - nCa - nCb
ans = power(2, n) - 1

ans -= (binomial_coefficients2(n, a) + binomial_coefficients2(n, b))
print(ans % mod)


# print(binomial_coefficients2 (5, 2) % mod)
import math

def prime(num):
  for i in range(math.sqrt(num)+1):
    if num%i==0:
      return False
  else:
    return True

n=int(input())
ans=0
for i in range(n):
  if prime(int(input())):
    ans+=1
print(ans)


### FIXED CODE ###

import math
 
def prime(num):
  if num==1 or num==2 or num==3:
    return True
  for i in range(2,int(math.sqrt(num))+1):
    if num%i==0:
      return False
  else:
    return True
 
n=int(input())
ans=0
for i in range(n):
  tmp=int(input())
  if prime(tmp):
    ans+=1
print(ans)
a=list(map(int,input().split()))
print(max[a]-min[a])

### FIXED CODE ###

a=list(map(int,input().split()))
print(max(a)-min(a))
import copy

n = int(input())
h = []
for i in range(n):
    h.append(int(input()))

h = h.sort()

cnt = 1
now = copy.deepcopy(h[0])
h.pop(0)

while not len(h) == 0:
    if h[0] != now:
        cnt += 1
        now = copy.deepcopy(h[0])
    h.pop(0)

### FIXED CODE ###

s = int(input())

def func(n):
    if n % 2 == 0:
        return n / 2
    else:
        return 3 * n + 1

a = {}
a[1] = s

i = 2
while True:
    tmp = func(a[i-1])
    if tmp in a.values():
        print(i)
        break
    else:
        a[i] = tmp
        i += 1
import sys
input = sys.stdin.readline
n = int(input())
a = list(input())
for i in a:
    print(a.count(str(i+1)))

### FIXED CODE ###

import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
for i in a:
    ans[i-1] += 1
for j in ans:
    print(j)
a=int(input())
b=list(map(int,input().split()))(A1,A2...AN)
t=0
for i in b:
	if x % 2 ==0 and x % 3 != 0 and x % 5 != 0:
		t=t+1
if t>0:
	print('DENIED')
else:
	print('APPROVED')

### FIXED CODE ###

import sys
N = int(input())
A = [int(i) for i in input().split()]
for i in A:
  if i%2 == 0 and (not i%3 == 0 and not i % 5 == 0):
    print("DENIED")
    sys.exit()
  else :
    continue
print("APPROVED")
a = int(input()split())
b = int(input()split())
print((a*b),(a+b*2))

### FIXED CODE ###

a,b=[int(i) for i in input().split()]
print(a*b,(a+b)*2)
n = int(input())

i = 1
while i <= n:
    if i % 3 == 0:
        print(" {:d}".format(i),end="")
    elif i % 10 == 3:
        print(" {:d}".format(i),end="")
    i += 1
print("")


### FIXED CODE ###

n = int(input())

i = 1
while i <= n:
    x = i
    if x % 3 == 0:
        print(" {:d}".format(i),end="")
    else:
        while x:
            if x % 10 == 3:
                print(" {:d}".format(i),end="")
                break
            x = x // 10
    i += 1
print("")
import math
n  int(input())
print(math.ceil(n/2))

### FIXED CODE ###

import math
n = int(input())
print(math.ceil(n/2))
a

### FIXED CODE ###

# coding: utf-8

import sys
input = sys.stdin.readline

# N = int(input())
# L = list(map(int, input().split()))
A, B = map(int, input().split())

print(max(A + B, (max(A, B) + max(A - 1, B - 1))))
from collections import defaultdict

n, m = [int(i) for i in raw_input().split()]
parents = defaultdict(list)

i = 0
while i < m:
    u, v = [int(x) for x in raw_input().split()]
    parents[v-1].append(u-1)
    i += 1

def calc_f(parents, f, i):
    if i < 0 or i >= len(f):
        return 0

    if f[i] != -1:
        return f[i]

    f[i] = 0
    for v in parents[i]:
        f[i] = max(f[i], calc_f(parents, f, v)+1)

    return f[i]

f = [-1] * n
j = 0
while j < n:
    calc_f(parents, f, j)
    j += 1

if len(f) == 0:
    print 0
else:
    print max(f)

### FIXED CODE ###

from collections import defaultdict
import sys
sys.setrecursionlimit(1000000)

n, m = [int(i) for i in raw_input().split()]
parents = defaultdict(list)

i = 0
while i < m:
    u, v = [int(x) for x in raw_input().split()]
    parents[v-1].append(u-1)
    i += 1

def calc_f(parents, f, i):
    if i < 0 or i >= len(f):
        return 0

    if f[i] != -1:
        return f[i]

    f[i] = 0
    for v in parents[i]:
        f[i] = max(f[i], calc_f(parents, f, v)+1)

    return f[i]

f = [-1] * n
j = 0
while j < n:
    calc_f(parents, f, j)
    j += 1

if len(f) == 0:
    print 0
else:
    print max(f)
l = input()
m = input()
z = l.split(' ')
M = int(z[1])
N = int(z[0])
F = m.split(' ')
X = []

for item in F:
  votes = int(item)
  X.append(votes)
print("Yes")
S = sum(S)
C = (S/(4*M))
X.sort(reverse=True)
if X[M-1]<C:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

l = input()
m = input()
z = l.split(' ')
M = int(z[1])
N = int(z[0])
F = m.split(' ')
X = []
 
for item in F:
  votes = int(item)
  X.append(votes)

S = sum(X)
C = (S/(4*M))
X.sort(reverse=True)
if X[M-1]<C:
  print("No")
else:
  print("Yes")
R=input(int())
R=R*2*(22/7)
print(R,end="")

### FIXED CODE ###

R=input()
R=int(R)
c=R*(44/7)
print(c)
a,b=map(int,input().split())
print(max(a,b)+max(max(a,b)-1,min(a,b))

### FIXED CODE ###

a,b=map(int,input().split())
if a == b:
  print(a*2)
else :
  print(2*max(a,b)-1)
class Node:
    def __init__(self,data):
        self.data=data
        self.left=None
        self.right=None
class BST:
    def __init__(self,number_list):
        self.root=None
        for node in number_list:
            self.insert(node)
    def insert(self,data):
        n=self.root
        if n is None:
            self.root=Node(data)
            return
        else:
            while True:#これ抜けてた。やばい。
                entry=n.data
                if data<entry:
                    if n.left is None:
                        n.left=Node(data)
                        return
                    n=n.left
                elif data>entry:
                    if n.right is None:
                        n.right=Node(data)
                        return
                    n=n.right
                else:
                    n.data=data
                    return
    def search(self,target):
        n = self.root
        if n is None:
            return None
        else:#深さ優先探索
            lst = []
            lst.append(n)
            while len(lst) > 0:
                node = lst.pop()
                if node is None:
                    return False
                if node.data == target:
                    self.node_recreate(node)
                    return True
                elif node.data < target :
                    lst.append(node.right)
                elif node.data > target:
                    lst.append(node.left)
            return False
        
    def node_recreate(self,node):
        #ノード再作成機能を装着
        num_lst=[]
        node_lst=[node]
        while len(node_lst)>0:
            node_=node_lst.pop()
            if node_.right is not None:
                node_lst.append(node_.right)
                num_lst.append(node_.right.data)
            if node_.left is not None:
                node_lst.append(node_.left)
                num_lst.append(node_.left.data)
        node=None
        for num in num_lst:
            self.insert(num)
            
                
    
import math
N=int(input())
a=list(map(int,input().split()))
t_max=int(math.log2(max(a)*2)+1)
ans=0
bst=BST(a)
for t in range(t_max,0,-1):
    i=0
    while i<len(a):
    #forだとout of rangeしてしまうので。
        x,y=0,0
#         bst=BST(a)#二分木も更新しないと。
#更新を削除に変更。大分計算回数は減るはず。
        if bst.search(2**t-a[i]):
            if a[i]!=2**t-a[i]:
                #同じだったらNG
                ans+=1
                x+=a[i]
                y+=2**t-a[i]
                #IDを共有すると、インデックスがずれる。
                a.remove(x)
                bst.search(x)#削除を兼ねて
                a.remove(y)
        else:
            i+=1 #ペアが見つからなかったときだけ進めばいい。
print(ans)

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
c = Counter(a)

ans = 0
for i in a:
    if c[i] == 0:
        continue
    c[i] -= 1
    k = 1<<i.bit_length()
    j = k-i
    if j in c and c[j] > 0:
        ans += 1
        c[j] -= 1
print(ans)
line = int(intput())
print(line.count('1'))

### FIXED CODE ###

line = input()
print(line.count("1"))
a,b=map(int, input().split())
if a<=5:
  b=0
elif 6<=a<=12:
  b=b/2
  
 print(int(b))

### FIXED CODE ###

a,b=map(int, input().split())
if a<=5:
    b=0
elif 6<=a<=12:
    b=b/2
print(int(b))
n,d = map(int,input().split())
points = []
for _ in range(n):
  X = tuple(map(int,input().split()))
  points.append(X)
  
ans = 0

import math
def distance(x,y):
  dis = 0
  for i in range(d):
    dis += (x[i]-y[i])**2
  return math.sqrt(dis)

for i in range(n-1):
  for j in range(i+1,n):
    dis = distance(X[i],X[j])
    if dis == int(dis):
      ans += 1
print(ans)

### FIXED CODE ###

n,d = map(int,input().split())
points = []
for _ in range(n):
  X = tuple(map(int,input().split()))
  points.append(X)
  
ans = 0

import math
def distance(x,y):
  dis = 0
  for i in range(d):
    dis += (x[i]-y[i])**2
  return math.sqrt(dis)

for i in range(n-1):
  for j in range(i+1,n):
    dis = distance(points[i],points[j])
    if dis == int(dis):
      ans += 1
print(ans)
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def calc_gcd(a, b):
  if a > b:
    a, b = b, a
  a, b = b%a, a
  if a != 0:
    return calc_gcd(a, b)
  else:
    return b

def calc_lcm(a, b):
  gcd = calc_gcd(a, b)
  return int(a * b / gcd)

def main():
  n = int(input())
  As = list(map(int, input().strip().split()))
  lcm = As[0]
  total = 0
  for a in As[1:]:
    lcm = calc_lcm(lcm, a)
  for a in As:
    total += lcm / a
  print(int(total) % (10**9+7))


if __name__=='__main__':
  main()

### FIXED CODE ###

#!/usr/bin/python3
# -*- coding:utf-8 -*-

def calc_gcd(a, b):
  if a > b:
    a, b = b, a
  while True:
    a, b = b%a, a
    if a == 0:
      return b

def calc_lcm(a, b):
  gcd = calc_gcd(a, b)
  return int(a * b // gcd)

def main():
  n = int(input())
  As = list(map(int, input().strip().split()))
  lcm = As[0]
  total = 0
  for a in As[1:]:
    lcm = calc_lcm(lcm, a)
  for a in As:
    total += lcm // a
  print(total % (10**9+7))


if __name__=='__main__':
  main()
n, m, q = map(int, input().split())   
a = []
for i in range(10):
  a.append(1)
max = 0
inp = []
for i in range(q):
  ta,tb,tc,td = map(int,input().split())
  inp.append((ta,tb,tc,td))
for i1 in range(1,m+1):
  a[0] = i1
  for i2 in range(i1,m+1):
    a[1] = i2
    for i3 in range(i2,m+1):
      a[2] = i3
      for i4 in range(i3,m+1):
        a[3] = i4
        for i5 in range(i4,m+1):
          a[4] = i5
          for i6 in range(i5,m+1):
            a[5] = i6
            for i7 in range(i6,m+1):
              a[6] = i7
              for i8 in range(i7,m+1):
                a[7] = i8
                for i9 in range(i8,m+1):
                  a[8] = i9
                  for i10 in range(i9,m+1):
                    a[9] = i10
                    sum = 0
                    for i in range(q):
                      if a[inp[i][1]] - a[inp[i][0]] == inp[i][2]:
                        sum = sum + inp[i][3]
                      if sum > max:
                        max = sum

print(max)

### FIXED CODE ###

n, m, q = map(int, input().split())   
a = []
for i in range(10):
  a.append(1)
max = 0
inp = []
for i in range(q):
  ta,tb,tc,td = map(int,input().split())
  inp.append((ta,tb,tc,td))
for i1 in range(1,m+1):
  a[0] = i1
  for i2 in range(i1,m+1):
    a[1] = i2
    for i3 in range(i2,m+1):
      a[2] = i3
      for i4 in range(i3,m+1):
        a[3] = i4
        for i5 in range(i4,m+1):
          a[4] = i5
          for i6 in range(i5,m+1):
            a[5] = i6
            for i7 in range(i6,m+1):
              a[6] = i7
              for i8 in range(i7,m+1):
                a[7] = i8
                for i9 in range(i8,m+1):
                  a[8] = i9
                  for i10 in range(i9,m+1):
                    a[9] = i10
                    sum = 0
                    if q != 1:
                      for i in range(q):
                        if a[inp[i][1]-1] - a[inp[i][0]-1] == inp[i][2]:
                          sum = sum + inp[i][3]
                        if sum > max:
                          max = sum
                    else:
                      if a[inp[0][1]-1] - a[inp[0][0]-1] == inp[0][2]:
                          sum = sum + inp[0][3]
                      if sum > max:
                          max = sum

print(max)
if __name__ == ‘__main__’:
  inputs=[int(line) for line in input().split(' ')]
  age,b=inputs[0],inputs[1]
  if age<6:
    print(0)
  elif age<13:
    print(b/2)
  else:
    print(b)

### FIXED CODE ###

age,b = map(int,input().split())	
if age<6:
  print(0)
elif age<13:
  print(b//2)
else:
  print(b)
from heapq import heappush, heappop
input = sys.stdin.readline

N, M, L = map(int, input().split())
inf = 10**20
d = [[inf]*N for _ in range(N)]
for i in range(N):
    for j in range(N):
        if i==j:
            d[i][j] = 0

for _ in range(M):
    A, B, C = map(int, input().split())
    d[A-1][B-1] = C
    d[B-1][A-1] = C

charged_dict = [[(inf,inf)]*N for _ in range(N)]
for j in range(N):
    charged_dict[j][j] = (0, 0)
    q = [(0, -L, j)]
    while q:
        charged, fuel, u = heappop(q)
        for v, next_cost in enumerate(d[u]):
            if next_cost == inf:
                continue
            c = (charged+1, -(L-next_cost)) if -fuel-next_cost<0 else (charged, -(-fuel-next_cost))
            if charged_dict[j][v] > c:
                charged_dict[j][v] = c
                heappush(q, c+(v,))

Q = int(input())
for _ in range(Q):
    s, t = map(int, input().split())
    ans = charged_dict[s-1][t-1][0]
    print(ans if ans!=inf else -1)

### FIXED CODE ###

from heapq import heappush, heappop
import sys
input = sys.stdin.readline

N, M, L = map(int, input().split())
inf = 10**15
V = [[] for _ in range(N)]

for _ in range(M):
    A, B, C = map(int, input().split())
    if C>L:continue
    V[A-1].append((B-1, C))
    V[B-1].append((A-1, C))

dists = []
for i in range(N):
    dist = [(inf,inf)] * N
    dist[i] = (0, 0)
    u = [False] * N
    for _ in range(N):
        (charged, used), j = min([(dist[i], i) for i in range(N) if not u[i]])
        u[j] = True
        for k, next_cost in V[j]:
            if j==k: continue
            c = (charged+1, next_cost) if used+next_cost>L else (charged, used+next_cost)
            if dist[k] > c:
                dist[k] = c
    dists.append(dist)

Q = int(input())
for _ in range(Q):
    s, t = map(int, input().split())
    ans = dists[s-1][t-1][0]
    print(ans if ans!=inf else -1)
N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
  a, b = map(int, input().split())
  G[a - 1].append(b - 1)
  G[b - 1].append(a - 1)
V = []
for i in range(N):
  if len(G[i]) % 2:
    print('No')
    break
  if len(G[i]) >= 6:
    print('Yes')
    break
  if len(G[i]) == 4:
    V.append[i]
else:
  if len(V) != 2:
    print('Yes' if len(V) > 2 else 'No')
  else:
    s = V[0]
    for i in range(3):
      t = G[s].pop()
      G[t].pop(G[t].index(s))
      while t not in V:
        d = G[t].pop()
        G[d].pop(G[d].index(t))
        t = d
      if s == t:
        print('Yes')
        break
      else:
        s = t
    else:
      print('No')

### FIXED CODE ###

N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
  a, b = map(int, input().split())
  G[a - 1].append(b - 1)
  G[b - 1].append(a - 1)
V = []
D = 0
for i in range(N):
  if len(G[i]) % 2:
    print('No')
    break
  D = max(len(G[i]), D)
  if len(G[i]) == 4:
    V.append(i)
else:
  if D >= 6:
    print('Yes')
  elif len(V) != 2:
    print('Yes' if len(V) > 2 else 'No')
  else:
    s = V[0]
    for i in range(3):
      t = G[s].pop()
      G[t].pop(G[t].index(s))
      while t not in V:
        d = G[t].pop()
        G[d].pop(G[d].index(t))
        t = d
      if s == t:
        print('Yes')
        break
      else:
        s = t
    else:
      print('No')