Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

#!/usr/bin/env python3
#ABC138 E

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
t = input()
n = len(s)
m = len(t)
f = [False]*26
f2 = [False]*26
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(n):
    f[alpha.index(s[i])] = True
for i in range(m):
    f2[alpha.index(t[i])] = True
for i in range(26):
    if not f[i] and f2[i]:
        print(-1)
        quit()
ans = 0
pre = s.index(t[0])
ans += pre+1
for i in range(1,m):
    s = s[pre+1:] + s[:pre+1]
    inde = s.index(t[i])
    ans += inde+1
    pre = inde
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
#ABC138 E

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
t = input()
n = len(s)
m = len(t)
f = [False]*26
f2 = [False]*26
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(n):
    f[alpha.index(s[i])] = True
for i in range(m):
    f2[alpha.index(t[i])] = True
for i in range(26):
    if not f[i] and f2[i]:
        print(-1)
        quit()
ans = 0
pre = s.index(t[0])
ans += pre+1
for i in range(1,m):
    s = s[pre+1:] + s[:pre+1]
    inde = s.index(t[i])
    ans += inde+1
    pre = inde
print(ans)
### BUGGY CODE ###

import math

def comb_count(n, r):
    return math.factorial(n) // math.factorial(r) // math.factorial(n - r)

S = input()[::-1]
ans = 0

mods = [0] * 2019 #余りが0~2018
mods[0] = 1
current = 0
tmp = 1

for i in range(len(S)):
    current = (int(S[i]) * tmp + current) % 2019
    mod = current % 2019
    # ans += mods[mod]
    mods[mod] += 1
    tmp = tmp * 10

for mod in mods:
    if mod > 1:
        # print(mod)
        ans += comb_count(mod, 2)

print(ans)


### FIXED CODE ###

import math

# def comb_count(n, r):
#     return math.factorial(n) // math.factorial(r) // math.factorial(n - r)

S = input()[::-1]
ans = 0

mods = [0] * 2019 #余りが0~2018
mods[0] = 1
current = 0
tmp = 1

for i in range(len(S)):
    current = (int(S[i]) * tmp + current) % 2019
    mod = current % 2019
    ans += mods[mod]
    mods[mod] += 1
    tmp = tmp * 10 % 2019

# for mod in mods:
#     if mod > 1:
#         ans += comb_count(mod, 2)
print(ans)
### BUGGY CODE ###

import math
n, m = input().split()
N = int(n)
M = int(m)

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

for i in range(M):
    k = A.index(max(A))
    A[k] = math.floor(A[k] / 2)

count = 0
for i in A:
    count += i

print(count)

### FIXED CODE ###

N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse = True)
it = 0
for i in range(M):
    A[it]=A[it]//2
    if it<N-1:
        if A[it]<A[it+1] and A[0]<A[it+1]:
            it+=1
        else:
            A.sort(reverse = True)
            it = 0
    if it == N-1:
        A.sort(reverse = True)
        it = 0
print(sum(A))
### BUGGY CODE ###

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

for i in range(n):
  ans*=a[i]
    
if ans>1000000000000000000:
  print("-1")
  
else:
  print(ans)

### FIXED CODE ###

import math
import sys

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


ans = 1
num = 1000000000000000000

if 0 in a:
    print(0)
    sys.exit()

for i in a:
    ans *= i
    if ans > num:
        print(-1)
        sys.exit()

print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

S = input().rstrip()
T = input().rstrip()

S,T

# Sの方が長くする
LS = len(S)
LT = len(T)
n = (LT + (-LT) % LS) // LS
S *= (n+1)
S = S[:LS+LT]

MOD = 10 ** 16 + 61
base = 12345
base_inv = pow(base,MOD-2,MOD) 
power = [1] * (LS+LT)
power_inv = [1] * (LS+LT)
for n in range(1,LS+LT):
    power[n] = power[n-1] * base % MOD
    power_inv[n] = power_inv[n-1] * base_inv % MOD

def to_rolling_hash(S):
    ret = [0] * len(S)
    for i,s in enumerate(S):
        ret[i] = (ret[i-1] + power[i] * ord(s)) % MOD
    return ret

S_hash = to_rolling_hash(S) + [0]
T_hash = to_rolling_hash(T)[-1] # 文字列全体

can_start = [(S_hash[i + LT - 1] - S_hash[i - 1]) * power_inv[i] % MOD == T_hash for i in range(LS)]

INF = 10 ** 18
visited = [False] * LS
dp = [None] * LS

arr = [INF] * LS

q = [(i,0) for i,bl in enumerate(can_start) if not bl]

while q:
    qq = []
    for x,d in q:
        if arr[x] == INF:
            arr[x] = d
            qq.append(((x-LT)%LS, d+1))
    q = qq

answer = max(arr)

if answer >= INF:
    answer = -1

print(answer)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

S = input().rstrip()
T = input().rstrip()

S,T

# Sの方が長くする
LS = len(S)
LT = len(T)
n = (LT + (-LT) % LS) // LS
S *= (n+1)
S = S[:LS+LT]

MOD = 10 ** 16 + 61
base = 12345
base_inv = pow(base,MOD-2,MOD) 
power = [1] * (LS+LT)
power_inv = [1] * (LS+LT)
for n in range(1,LS+LT):
    power[n] = power[n-1] * base % MOD
    power_inv[n] = power_inv[n-1] * base_inv % MOD

def to_rolling_hash(S):
    ret = [0] * len(S)
    for i,s in enumerate(S):
        ret[i] = (ret[i-1] + power[i] * ord(s)) % MOD
    return ret

S_hash = to_rolling_hash(S) + [0]
T_hash = to_rolling_hash(T)[-1] # 文字列全体

can_start = [(S_hash[i + LT - 1] - S_hash[i - 1]) * power_inv[i] % MOD == T_hash for i in range(LS)]

INF = 10 ** 18
visited = [False] * LS
dp = [None] * LS

arr = [INF] * LS

q = [(i,0) for i,bl in enumerate(can_start) if not bl]

while q:
    qq = []
    for x,d in q:
        if arr[x] == INF:
            arr[x] = d
            qq.append(((x-LT)%LS, d+1))
    q = qq

answer = max(arr)

if answer >= INF:
    answer = -1

print(answer)
### BUGGY CODE ###

H,W = map(int,input().split())
A = []
C = []
for i in range(H):
	tmp = [s for s in input()]
	indexes = [k for k, x in enumerate(tmp) if x == "#"]
	A.append(tmp)
	for k in indexes:
		C.append((i,k))

c = 0
for i in range(H):
	for j in range(W):
		if A[i][j] == ".":
			tmp = H+W
			for x,y in C:
				if tmp > abs(x-i) + abs(y-j):
					tmp = abs(x-i)+abs(y-j)
					if tmp == 1:
						break
			A[i][j] = tmp
			if tmp > c:
				c = tmp
print(c)

### FIXED CODE ###

import numpy as np

H,W = map(int,input().split())
A = []
for i in range(H):
	A.append([0 if s == "#" else H+W for s in input()])

A = np.array(A)
for x in range(W - 1):
	A[:,x+1] = np.minimum(A[:, x]+1,A[:, x+1])
for x in range(W - 1, 0 , -1):
	A[:,x-1] = np.minimum(A[:, x-1],A[:, x]+1)
for y in range(H -1):
	A[y+1,:] = np.minimum(A[y, :]+1,A[y+1, :])
for y in range(H -1, 0, -1):
	A[y-1,:] = np.minimum(A[y-1, :],A[y, :]+1)

print(np.max(A))
### BUGGY CODE ###

L,R=map(int,input().split())

x=[]
for i in range(L,R):
    for j in range(L+1,R+1):
        y=((i*j)%2019)
        x.append(y)

z=min(x)
print(z)

### FIXED CODE ###

L,R=map(int,input().split())

x=[]
a=0
for i in range(L,R):
    for j in range(L+1,R+1):
        y=((i*j)%2019)
        x.append(y)
        if y==0:
            break
    if y==0:
            break

print(min(x))
### BUGGY CODE ###

import heapq

n ,m = map(int,input().split())
li = []
for i in range(n):
    x, y= map(int,input().split())
    li.append([x,y])
li.sort()
heap = []

ans = 0
for i in range(m):
    bar = True
    while bar:
        if len(li) == 0:
            break
        if i >= li[0][0] - 1:
            price = li.pop(0)
            heapq.heappush(heap,-price[1])
        else:
            bar = False
    try:
        ans += -heapq.heappop(heap)
    except IndexError:
        ans += 0
 
print(ans)

### FIXED CODE ###

import heapq

n ,m = map(int,input().split())
li = []
for i in range(n):
    x, y= map(int,input().split())
    li.append([x,y])
li.sort()
heap = []

ans = 0
j = 0
for i in range(1, m + 1):
    while j < n and li[j][0] <= i:
        heapq.heappush(heap,-li[j][1])
        j += 1
    if heap:
        ans += -heapq.heappop(heap)
 
print(ans)
### BUGGY CODE ###

s = str(input())
l = []
for i in range(len(s)):
    for j in range(len(s)-1,0,-1):
        if s[i] == "A":
            if s[j] == "Z":
                l.append(j+1-i)
print(max(l))

### FIXED CODE ###

s = str(input())
a = []
b = []
for i in range(len(s)):
    if s[i] == "A":
        a.append(i)
    elif s[i] == "Z":
        b.append(i)
print(max(b)-min(a)+1)
### BUGGY CODE ###

from collections import deque

h, w = map(int, input().split())

as_ = []
for i in range(h):
    a = [s for s in input().split()]
    for a_ in a:
        as_.append(a_)

ds = [[None]*w for _ in range(h)]
# ds = [[None]*w]*h ←これだとうまくいかないので注意

starts = deque()
for i, a in enumerate(as_):
    for j, a_ in enumerate(a):
        if a_ == "#":
            ds[i][j] = 0
            starts.append((i,j))
def bfs(starts, ds):
    d = 0
    while starts:
        i, j = starts.popleft()
        d = ds[i][j]
        for mx, my in [(0,1),(1,0),(-1,0),(0,-1)]:
            ni = i + my
            nj = j + mx
            if 0 <= ni < h and 0 <= nj < w:
                if ds[ni][nj] == None:
                    ds[ni][nj] = d + 1
                    starts.append((ni, nj))
    return d
d = bfs(starts, ds)
print(d)

### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())

as_ = []
for i in range(h):
    a = [s for s in input().split()]
    for a_ in a:
        as_.append(a_)

ds = [[None]*w for _ in range(h)]
# ds = [[None]*w]*h ←これだとうまくいかないので注意

starts = deque()
for i, a in enumerate(as_):
    for j, a_ in enumerate(a):
        if a_ == "#":
            ds[i][j] = 0
            starts.append((i,j))
def bfs(starts, ds):
    d = 0
    while starts:
        i, j = starts.popleft()
        d = ds[i][j]
        for mx, my in [(0,1),(1,0),(-1,0),(0,-1)]:
            ni = i + my
            nj = j + mx
            if 0 <= ni < h and 0 <= nj < w:
                if ds[ni][nj] == None:
                    ds[ni][nj] = d + 1
                    starts.append((ni, nj))
    return d
d = bfs(starts, ds)
print(d)
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from math import floor

a, b, n = map(int, readline().split())
max = 0
for i in range(n + 1):
    v = floor(a * i / b) - a * floor(i / b)
    if v >= max:
        max = v
    else:
        break
print(max)


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from math import floor

a, b, n = map(int, readline().split())
if b > n:
    print(floor(a * n / b) - a * floor(n / b))
else:
    print(floor(a * (b - 1) / b) - a * floor((b - 1) / b))
### BUGGY CODE ###

def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    S = list(input())
    Q = int(input())
    K = list(map(int, input().split()))
    d_list = [0] * N
    m_list = [0] * N
    c_list = [0] * N
    M_list = [0] * N
    for index, s in enumerate(S[:-1]):
        if s == 'D':
            d_list[index] += 1
        elif s == 'M':
            m_list[index] += d_list[index - 1]
            M_list[index] += 1
        elif s == 'C':
            c_list[index] += m_list[index - 1]
        d_list[index] += d_list[index - 1]
        m_list[index] += m_list[index - 1]
        c_list[index] += c_list[index - 1]
        M_list[index] += M_list[index - 1]
    
    # print (d_list)
    # print (m_list)
    # print (c_list)
    # print (M_list)



    def calc(k):
        # d = 0
        # m = 0
        # c = 0
        # M = 0
        # for s in S[:k]:
        #     if s == 'D':
        #         d += 1
        #     elif s == 'M':
        #         m += d
        #         M += 1
        #     elif s == 'C':
        #         c += m
        # print (d, m, c)

        d = d_list[k - 1]
        m = m_list[k - 1]
        c = c_list[k - 1]
        M = M_list[k - 1]

        for index, x in enumerate(S[k:]):
            tmp = S[index]
            if tmp == 'D':
                m -= M
                d -= 1
            elif tmp == 'M':
                M -= 1

            if x == 'D':
                d += 1
            elif x == 'M':
                m += d
                M += 1
            elif x == 'C':
                c += m            
            # print (d, m, c)
                
        return c

    for k in K:
        print (calc(k))

    # print (calc(5))

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    N = int(input())
    S = list(input())
    Q = int(input())
    K = tuple(map(int, input().split()))
    d_list = [0] * N
    m_list = [0] * N
    c_list = [0] * N
    M_list = [0] * N
    for index, s in enumerate(S):
        if s == 'D':
            d_list[index] += 1
        elif s == 'M':
            m_list[index] += d_list[index - 1]
            M_list[index] += 1
        elif s == 'C':
            c_list[index] += m_list[index - 1]
        d_list[index] += d_list[index - 1]
        m_list[index] += m_list[index - 1]
        c_list[index] += c_list[index - 1]
        M_list[index] += M_list[index - 1]



    for k in K:
        d = d_list[k - 1]
        m = m_list[k - 1]
        c = c_list[k - 1]
        M = M_list[k - 1]

        for index, x in enumerate(S[k:]):
            if S[index] == 'D':
                m -= M
                d -= 1
            elif S[index] == 'M':
                M -= 1

            if x == 'D':
                d += 1
            elif x == 'M':
                m += d
                M += 1
            elif x == 'C':
                c += m            
        print (c)                


if __name__ == "__main__":
    main()
### BUGGY CODE ###

N = int(raw_input())
L = []
for i in range(N):
  L.append(raw_input())
A = []
B = []
for i in range(N):
    # print(L[i])
    L[i] = L[i].split()
    A.append([int(L[i][0]), int(L[i][1]), i])
    B.append([int(L[i][1]), int(L[i][0]), i])
    L[i].append(i)
A.sort()
B.sort()
used = []
time = 0
resultA = 0
resultB = 0
i = N-1
while i >= 0:
    if time % 2 == 0:
        if A[i][2] not in used:
            resultA += A[i][0]
            used.append(A[i][2])
            time += 1
    else:
        if B[i][2] not in used:
            resultB += B[i][0]
            used.append(B[i][2])
            time += 1
    i -= 1

result = resultA - resultB
# print(used)
print(result)

### FIXED CODE ###

N = int(raw_input())
L = []
for i in range(N):
  L.append(raw_input())
result = []
sumA = 0
sumB = 0
for i in range(N):
    L[i] = L[i].split()
    result.append([int(L[i][0]) + int(L[i][1]), i])
result.sort()
for i in range(N-1, -1, -2):
    index = result[i][1]
    sumA += int(L[index][0])
for i in range(N-2, -1, -2):
    index = result[i][1]
    sumB += int(L[index][1])
result_K = sumA - sumB
print(result_K)
### BUGGY CODE ###

import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right
import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i)% MOD)
    return ret

def solve():
    n, k = getList()
    nums = getList()
    pro = [1]
    for num in nums:
        pro.append(pro[-1] * num)
    # print(pro)
    for i in range(n - k):
        # print(i)
        ku = pro[k+i] / pro[i]
        ku2 = pro[k+i + 1] / pro[i+ 1]
        if ku2 > ku:
            print("Yes")
        else:
            print("No")
if __name__ == "__main__":
    # main()
    solve()

### FIXED CODE ###

import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right
import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i)% MOD)
    return ret

def solve():
    n, k = getList()
    nums = getList()
    # pro = [1]
    # for num in nums:
    #     pro.append(pro[-1] * num)
    # print(pro)
    for i in range(n - k):
        # print(i)
        # ku = pro[k+i] / p/] / pro[i+ 1]
        if nums[i] < nums[i+k]:
            print("Yes")
        else:
            print("No")
if __name__ == "__main__":
    # main()
    solve()
### BUGGY CODE ###

n=int(input()) 
c=list(map(int, input().split()))
l = []

if n%2 == 0:
    for i in range(n):
        if i%2 == 0:
            l.append(c[i])
        if i%2 != 0:
            l.insert(0,c[i])
if n%2 != 0:
    for i in range(n):
        if i%2 != 0:
            l.append(c[i])
        if i%2 == 0:
            l.insert(0,c[i])
print(*l)

### FIXED CODE ###

n = int(input())
a = input().split()
 
if n % 2 == 1:
    print(" ".join((a[0::2][::-1] + a[1::2])))
else:
    print(" ".join((a[1::2][::-1] + a[0::2])))
### BUGGY CODE ###

p = 10 ** 9 + 7
N = 10 ** 7
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p
X,Y = list(map(int,input().split()))
if (X+Y)%3 != 0:
    print(0)
    exit()
N = (X+Y)//3
K = 2*N-X
print(cmb(N,K,p))

### FIXED CODE ###

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**6
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

X,Y = list(map(int,input().split()))
if (X+Y)%3 != 0:
    print(0)
    exit()
N = (X+Y)//3
K = min(2*N-X,X-N)
print(cmb(N,K,mod))
### BUGGY CODE ###

def main():
    S = input()
    N = len(S)

    MOD = 10**9 + 7
    dp = [[0 for _ in range(13)] for _ in range(N)]  # dp[i][j]: S[i]までみて13で割ってjあまるものの個数

    # 初期値
    if S[0] == "?":
        for j in range(10):
            dp[0][j] = 1
    else:
        dp[0][int(S[0])] = 1


    # dpテーブル更新式
    for i in range(1, N):
        si = S[i]
        if si == "?":
            for si_cand in range(10):
                for j in range(13):
                    dp[i][(j*10+si_cand)%13] += dp[i-1][j] % MOD
        else:
            for j in range(13):
                dp[i][(j*10+int(si))%13] += dp[i-1][j] % MOD

    print(dp[N-1][5] % MOD)

if __name__ == '__main__':
    main()


### FIXED CODE ###

INF = 10 ** 9 + 7

S = input()
# dp[i][j]はうしろからi桁を13で割った余りがjであるものの個数
dp = [[0] * 13 for _ in range(len(S) + 1)]
dp[0][0] = 1
mul = 1

for i in range(len(S)):
    x = S[-(i + 1)]
    if x == "?":
        for k in range(10):
            for j in range(13):
                dp[i + 1][(mul * k + j) % 13] += dp[i][j]
                dp[i + 1][(mul * k + j) % 13] %= INF
    else:
        k = int(x)
        for j in range(13):
            dp[i + 1][(mul * k + j) % 13] += dp[i][j]
            dp[i + 1][(mul * k + j) % 13] %= INF
    mul = mul * 10 % 13

print(dp[len(S)][5])
### BUGGY CODE ###

N,M = map(int,input().split())
import time
start_t = time.time()
path = [[] for _ in range(N*3+3)]
for _ in range(M):
    u,v = map(int,input().split())
    path[u].append(v)

S,T = map(int,input().split())
import collections

q = collections.deque()
vis = [[-1 for _ in range(3)] for _ in range(N+3)]
def bfs():
    while len(q) > 0:
        now,cnt = q.popleft()
        step = cnt % 3
        vis[now][step] = cnt
        if now == T and step  == 0:  
            return cnt
        for x in path[now]:
            if vis[x][(step+1)%3] < 0:
                q.append((x,cnt+1))
    return -3
vis[S][0] = 1
q.append([S,0])
print(bfs()//3)





### FIXED CODE ###

N,M = map(int,input().split())
import time
start_t = time.time()
path = [[] for _ in range(N+3)]
for _ in range(M):
    u,v = map(int,input().split())
    path[u].append(v)

S,T = map(int,input().split())
import collections

q = collections.deque()
vis = [[-1 for _ in range(3)] for _ in range(N+3)]
vis[S][0] = 1
q.append([S,0])
while len(q):
    now,cnt = q.popleft()
    step = cnt % 3
    for x in path[now]:
        if vis[x][(step+1)%3] < 0:
            vis[x][(step+1)%3] = cnt
            q.append((x,cnt+1))

if vis[T][0] == -1:
    print(-1)
else:
    print(vis[T][0]//3+1)
### BUGGY CODE ###

import numpy as np
N, M = list(map(int, input().split()))
A = np.array([int(i) for i in input().split()])
BC_array = np.array([[int(i) for i in input().split()] for i in range(M)])
#print(A)
#print(BC_array)
#BC_array_sorted = BC_array[np.argsort(BC_array[:,1])[::-1]]
for b, c in BC_array:
    A = np.sort(A)
    tmp = np.where(A < c)
    #print("==================")
    #print(A[tmp])
    #print(A)
    #print(tmp)
    #print(len(A[tmp]))
    if(len(A[tmp]) < b):
        A[tmp] = c
    else:
        A[0:b] = c
   
print(sum(A))

### FIXED CODE ###

import numpy as np
N, M = list(map(int, input().split()))
A = np.array([int(i) for i in input().split()])
BC_array = np.array([[int(i) for i in input().split()] for i in range(M)])
BC_array_sorted = BC_array[np.argsort(BC_array[:,1])[::-1]]
D = np.array(np.zeros(N, dtype = int))
index = 0
for b, c in BC_array_sorted:
    D[index:min(index+b, N)] = c
    index += b
    if(N < index):
        break
E = np.concatenate((A, D))
E = np.sort(E)
ans = sum(E[N:2*N])
print(ans)
### BUGGY CODE ###

k = int(input())
seven = '7'
sevens ='7'
cnt = 1

if k % 2 ==0:
    print(-1)
else:
    while len(sevens) < 10**6:
        if int(sevens) % k ==0:
            print(cnt)
            break
        else:
            sevens += seven
            cnt += 1

### FIXED CODE ###

k = int(input())
sevens = 7 % k

if k % 2 ==0:
    print(-1)
else:
    for i in range(k):
        if sevens % k ==0:
            print(i+1)
            break
        else:
            sevens = (sevens*10 + 7) % k
    else:
        print(-1)
### BUGGY CODE ###

R, G, B, N = map(int, input().split())

ans = 0

for i in range((N//R)+1):
    r = i
    for j in range(((N-R*r)//G)+1):
        g = j
        if (N-R*r-G*g) % B == 0 and N-R*r-G*g >= 0:
            ans += 1

print(ans)

### FIXED CODE ###

def main():

    R, G, B, N = map(int, input().split())

    ans = 0

    for i in range((N//R)+1):
        r = i
        for j in range(((N-R*r)//G)+1):
            g = j
            if (N-R*r-G*g) % B == 0 and N-R*r-G*g >= 0:
                ans += 1

    print(ans)

if __name__=='__main__':
    main()