Harryxun/stf_run huggingface dataset:
import heapq
n,m = map(int,input().split())
if n == 1:
  print(0)
  exit()
if m*2 < n:
    print("Impossible")
    exit()

class Unionfind:
     
    def __init__(self,n):
        self.uf = [-1]*n
 
    def find(self,x):
        if self.uf[x] < 0:
            return x
        else:
            self.uf[x] = self.find(self.uf[x])
            return self.uf[x]
 
    def same(self,x,y):
        return self.find(x) == self.find(y)
 
    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if self.uf[x] > self.uf[y]:
            x,y = y,x
        self.uf[x] += self.uf[y]
        self.uf[y] = x
        return True
 
    def size(self,x):
        x = self.find(x)
        return -self.uf[x]

u = Unionfind(n)
a = list(map(int,input().split()))
for i in range(m):
    x,y = map(int,input().split())
    u.union(x,y)

l = [[] for i in range(n)]
for i in range(n):
    x = u.find(i)
    if x < 0:
        heapq.heappush(l[i],a[i])
    else:
        heapq.heappush(l[x],a[i])

h = []
for i in range(n):
    if l[i]:
        x = heapq.heappop(l[i])
        heapq.heappush(h,[x,i])
ans = 0
while len(h) > 1:
    a = heapq.heappop(h)
    b = heapq.heappop(h)
    ans += a[0]+b[0]
   
    l[a[1]] = list(heapq.merge(l[a[1]],l[b[1]]))
    
    x = heapq.heappop(l[a[1]])
    heapq.heappush(h,[x,a[1]])
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
from collections import deque

n,m = map(int,input().split())
if m == n-1:
  print(0)
  exit()
if 2*(n-m-1) > n:
    print("Impossible")
    exit()

e = [[] for i in range(n)]
a = list(map(int,input().split()))
for i in range(m):
    x,y = map(int,input().split())
    e[x].append(y)
    e[y].append(x)

def dfs(x):
    l = []
    d[x] = 1
    l.append(a[x])
    q = deque([])
    q.append(x)
    while q:
        now = q.pop()
        for nex in e[now]:
            if d[nex] > 0:
                continue
            l.append(a[nex])
            d[nex] = 1
            q.append(nex)
    l.sort()
    ans = l[0]
    
    for i in l[1:]:
        h.append(i)
    return ans
count = 2*(n-m-1)
d = [-1]*n
ans = 0
h = []
for i in range(n):
    if d[i] < 0:
        ans += dfs(i)
        count -= 1
if count > 0:
    h.sort()
    ans += sum(h[:count])
print(ans)
A = []
A = list(map(int, input().split()))
s = A.sort()[0]
m = A.sort()[1]
l = A.sort()[2]
count = 0
difs = l-s
difm = l-m
count += difs//2 + difm//2
if difs%2 == 0 and difm%2 == 0:
  print(count)
elif difs%2 == 0 and difm%2 = 1:
  count += 2
  print(count)
else:
  count += 1
  print(count)
  


### FIXED CODE ###

A = [int(i) for i in input().split()]
A.sort()
s,m,l = A
count = 0
ls = l-s
lm = l-m
count += ls//2
count += lm//2
if ls%2 == 0 and lm%2 == 0:
  print(count)
  exit()
elif ls%2 == 1 and lm%2 == 1:
  count += 1
  print(count)
else:
  count += 2
  print(count)
D,T,S = map(int,input(),slpit())
if D/S <= T:
  print("Yes")
else:
  print("No")
  

### FIXED CODE ###

D,T,S = map(int, input().split())
if D/S <= T:
  print("Yes")
else:
  print("No")
S = str(input())

ans = ""

for mask in range(1 << (len(S)-1)):
    for i in range(len(S)):
        if (mask >> i) & 1:
            ans += f"{S[i]}+"
        else:
            ans += f"{S[i]}"
    ans += "+"
print(eval(ans[:-1]))


### FIXED CODE ###

S = list(input())
ans = 0

for state in range(1 << len(S)-1):
    ans += eval(S[0] + ''.join(('+' if state >> i & 1 else '') + x for i, x in enumerate(S[1:])))

print(ans)
K , X = map(int,input().split())

if K * 500 >= X:
  print("Yes")
else print("No")

### FIXED CODE ###

K , X = map(int,input().split())

if K * 500 >= X:
  print("Yes")
else: print("No")
n = input()
li = list(map(int, input().split()))
count = 0


#all 全ての要素がTrueならTrue
while all(a % 2 == 0 for a in li):
    li = [ a / 2 for a in li]
    count += 1
# a,b = map(int, input().split())
print(count)

### FIXED CODE ###

print(input().count("1"))
a=[int(input().split()) for i in range(3)]
print(max(a)-min(a))

### FIXED CODE ###

*a,=map(int,input().split())
print(max(a)-min(a))
def solve(string):
    n, s = string.split()
    n = int(n)
    return "Yes" if s[:n // 2] == s[n // 2:] else "No"


if __name__ == '__main__':
    print(solve(input()))


### FIXED CODE ###

def solve(string):
    n, s = string.split()
    n = int(n)
    return "Yes" if s[:n // 2] == s[n // 2:] else "No"


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))
bingo = [ list(map(int, input().split())) for _ in range(3) ]
t_or_f = [ [False]*3 for _ in range(3) ]

n = int(input())
for _ in range(n):
  i = int(input())

  for x in range(3):
    for y in range(3):
      if bingo[x][y] == i:
        t_or_f[x][y] = True
        break


is_bingo = False
if t_or_f[0][0] and t_or_f[1][1] and t_or_f[2][2]:
  is_bingo = True
  print('Yes')
elif t_or_f[0][2] and t_or_f[1][1] and t_or_f[2][0]:
  is_bingo = True
  print('Yes')
else:
  for i in range(3):
    if t_or_f[i][i] and t_or_f[i+1][i+1] and t_or_f[i+2][i+2]:
      is_bingo = True
      print('Yes')

if not is_bingo: print('No')


### FIXED CODE ###


bingo = [ list(map(int, input().split())) for _ in range(3) ]
t_or_f = [ [False]*3 for _ in range(3) ]

nums = [ r[i]for i in range(3) for r in bingo ]

n = int(input())
appear = [ int(input()) for _ in range(n) ]

for x in range(3):
  for y in range(3):
    if bingo[x][y] in appear:
      t_or_f[x][y] = True

is_bingo = False
if t_or_f[0][0] and t_or_f[1][1] and t_or_f[2][2]:
  is_bingo = True
elif t_or_f[0][2] and t_or_f[1][1] and t_or_f[2][0]:
  is_bingo = True
else:
  for i in range(3):
    if t_or_f[i][0] and t_or_f[i][1] and t_or_f[i][2]: is_bingo = True
    if t_or_f[0][i] and t_or_f[1][i] and t_or_f[2][i]: is_bingo = True

if is_bingo:
  print('Yes')
else:
  print('No')
from itertools import accumulate

N, K = list(map(int, input().split()))
P = list(map(lambda x: int(x) + 1, input().split()))
P_cumsum = list(accumulate(P))
print(max([P_cumsum[i+K]-P_cumsum[i] for i in range(N-K)])/2)

### FIXED CODE ###

from itertools import accumulate

N, K = list(map(int, input().split()))
P = list(map(lambda x: int(x) + 1, input().split()))
P_cumsum = [0] + list(accumulate(P))
print(max([P_cumsum[i+K]-P_cumsum[i] for i in range(N-K+1)])/2)
# run-length encoding, decoding
def rle_encode(data):
    encoding = ''
    prev_char = ''
    count = 1

    if not data: return ''

    for char in data:
        # If the prev and current characters
        # don't match...
        if char != prev_char:
            # ...then add the count and character
            # to our encoding
            if prev_char:
                encoding += str(count) + prev_char + ' '
            count = 1
            prev_char = char
        else:
            # Or increment our counter
            # if the characters do match
            count += 1
    else:
        # Finish off the encoding
        encoding += str(count) + prev_char + ' '
        return encoding

N, K = [int(s) for s in input().split()]
S = input()
S_rle = rle_encode(S).split()
total = 0
for i, bunch in enumerate(S_rle):
  total += int(list(bunch)[0]) - 1

if len(S_rle) >= 2*K+3:
  print(total+2*K)
elif len(S_rle) >= 2*K:
  print(total+2*K-1)
else:
  print(N-1)

### FIXED CODE ###

N = int(input())
print(N*N*N)
S,W = amp(int,input,split)

if S <= W :
    print("unsafe")

else :
    print("safe")

### FIXED CODE ###

#入力例全てOKだけど黄色#
S,W = map(int,input().split())

if S <= W :
    print("unsafe")

else :
    print("safe")
#Grid Repainting 2

#初期化
S = []
p = []
flag = True

#入力
H,W = map(int, input().split())
for i in range(W):
	s = input()
	s_list = list(s)
	S.append(s_list)

#枠外を白に塗りつぶす
for  i in range(H+2):
	p.append(".")

S.insert(0,p)
S.insert(W+1,p)

for i in range(1,W+1,1):
	S[i].insert(0,".")
	S[i].insert(H+2,".")

#計算
for i in range(1, W+1, 1):
	for j in range(1, H+1, 1):
		if S[i][j] == "#" and S[i+1][j] == "." and S[i][j+1] == "." and S[i+1][j+1] == "." and S[i-1][j] == "." and S[i][j-1] == "." and S[i-1][j-1] == ".":
			flag = False

#出力
if flag == True:
	print("Yes")

else:
	print("No")

### FIXED CODE ###

#Grid Repainting 2

#初期化
S = []
p = []
flag = True

#入力
H,W = map(int, input().split())
for i in range(H):
	s = input()
	s_list = list(s)
	S.append(s_list)

#計算
for i in range(0, H-1, 1):
	for j in range(0, W-1, 1):
		if S[i][j] == "#" and S[i+1][j] == "." and S[i][j+1] == "."  and S[i-1][j] == "." and S[i][j-1] == "." :
			flag = False
		

#出力
if flag == True:
	print("Yes")

else:
	print("No")
import math

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

b = b - a
a = a - 1
print(1+math.ceil(b/a))

### FIXED CODE ###

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

res=0
cnt=0
for i in range(n-1):
	if H[i]>=H[i+1]:
		cnt += 1
	else:
		cnt = 0
	res=max(res,cnt)
print(res)
n=int(input())
a=(input().split())
for i in range(n):
    x=0
    for j in range(n):
        for k in range(n):
            if j>k:
                if a[j]==a[k] and j!=i and k!=i:
                    x=x+1
    print(x)


### FIXED CODE ###

n,m=list(map(int,input().split()))
x=0
if n<2 and m<2:
    x=0
elif n<2 :
    x=int(m*(m-1)/2)
elif m<2:
    x=int(n*(n-1)/2)
else:
    x=int(m*(m-1)/2+n*(n-1)/2)
print(x)
n, x = map(int, input().split())
l = list(map(int, input().split()))
dis = 0
ans = 0
while (dis <= x):
    dis += l[ans]
    ans += 1
print(ans)

### FIXED CODE ###

n, x = map(int, input().split())
l = list(map(int, input().split()))
dis = 0
ans = 0
if sum(l) <= x:
    print(len(l) + 1)
else:
    while (dis <= x):
        dis += l[ans]
        ans += 1
    print(ans)
N,K = map(int, input().split())
S = input()


if S[K+1] == "A":
    S[K+1] = "a"
elif S[K+1] == "B":
    S[K+1] = "b"
elif S[K+1] == "C":
    S[K+1] = "c"

print("".join(S))

### FIXED CODE ###

n, k = map(int,input().split())
s = list(input())
 
if s[k-1] == "A":
  s[k-1] = "a"
elif s[k-1] == "B":
  s[k-1] = "b"
elif s[k-1] == "C":
  s[k-1] = "c"
 
print("".join(s))
S = input()
S.replace()

ans = []

for i in range(len(s)):
    ans.append("x")

print("".join(ans))

### FIXED CODE ###

S = input()
ans = []

for i in range(len(S)):
    ans.append("x")

print("".join(ans))
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F551C':
    sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    S = read_str()
    T = read_str()
    n = len(S)
    res = 'Yes'
    A = [0] * n
    B = [0] * n
    vu = {}
    for i in range(n):
        if S[i] in vu:
            A[i] = vu[S[i]]
        else:
            vu[S[i]] = i
            A[i] = vu[S[i]]

    vu = {}
    for i in range(n):
        if T[i] in vu:
            T[i] = vu[T[i]]
        else:
            vu[T[i]] = i
            B[i] = vu[T[i]]

    if A != B:
        res = 'No'

    # for i in range(n):
    #     for j in range(n):
    #         if S[i] != S[j] and T[i] == T[j]:
    #             res = 'No'
    #         if S[i] == S[j] and T[i] != T[j]:
    #             res = 'No'
    print(res)


main()


### FIXED CODE ###

import sys
import socket

hostname = socket.gethostname()

if hostname == 'F551C':
    sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    S = read_str()
    T = read_str()
    n = len(S)
    res = 'Yes'
    A = [0] * n
    B = [0] * n
    vu = {}
    for i in range(n):
        if S[i] in vu:
            A[i] = vu[S[i]]
        else:
            vu[S[i]] = i
            A[i] = vu[S[i]]

    vu = {}
    for i in range(n):
        if T[i] in vu:
            B[i] = vu[T[i]]
        else:
            vu[T[i]] = i
            B[i] = vu[T[i]]

    if A != B:
        res = 'No'

    # for i in range(n):
    #     for j in range(n):
    #         if S[i] != S[j] and T[i] == T[j]:
    #             res = 'No'
    #         if S[i] == S[j] and T[i] != T[j]:
    #             res = 'No'
    print(res)


main()
input_X = input()
input_Y = input()
X = int(input_X)
Y = int(input_X)
x = X + Y/2

print(x)    

### FIXED CODE ###

X,Y = map(int,input().split())
print(X+Y//2)
s = input()
w = int(input())
ans=""
for i in range(w):
  ans = ans + s[i*w]

print(ans)

### FIXED CODE ###

s = input()
w = int(input())
ans = ""
for i in range(-(-len(s) // w)):
    ans = ans + s[i * w]

print(ans)
N = int(input())
A = list(map(int,input().split()))

asorted = sorted(A)
print(asorted[N]-asorted[0])


### FIXED CODE ###

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

asorted = sorted(A)
print(asorted[N-1]-asorted[0])
import math
n=int(input())
A=list(map(int,input().split()))
L=[0]*(n+1)
R=[0]*(n+1)
for i in range(n):
    L[i+1]=math.gcd(L[i],A[i])
for i in range(n,0,-1):
    R[i-1]=math.gcd(R[i],A[i-1])
ans=[]
for k in range(n):
    ans.append(math.gcd(L[k],R[k+1]))
print(max(ans))


### FIXED CODE ###

n=int(input())
A=list(map(int,input().split()))
L=[0]*(n+1)
R=[0]*(n+1)
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
for i in range(n):
    L[i+1]=gcd(L[i],A[i])
for i in range(n,0,-1):
    R[i-1]=gcd(R[i],A[i-1])
ans=[]
for k in range(n):
    ans.append(gcd(L[k],R[k+1]))
print(max(ans))
def pt(s: list):
    if len(s) = 1:
        return eval(s[0])
    return pt([s[0]+s[1]]+s[2:]) + pt([s[0]+'+'+s[1]]+s[2:])
print(pt(list((input()))))

### FIXED CODE ###

def plus_or_through(s):
    if len(s) <= 1:
        return eval(s[0])
    return plus_or_through([s[0]+s[1]]+s[2:]) + plus_or_through([s[0]+'+'+s[1]]+s[2:])
print(plus_or_through(list(input())))
def otoshi(n, y):
    x=0
    for i in range(n+1):
        x = i*1000
        if x >= y :
            break
        for i2 in range(n+1 - i):
            x = i*1000 + i2 * 5000
            if x >= y :
                break
            for i3 in range(n+1 - (i+i2)):
                x =  i*1000 + i2 * 5000 + i3 *10000
                if x > y :
                    break
                
                if i + i2 + i3 != n :
                    pass
                else :
                    if x  == y :
                        print(i3, i2, i1)
                        return 
    
    print(-1, -1, -1)
    return 

n, y = [int(i)  for i in input().split()]

otoshi(n, y)

### FIXED CODE ###

def otoshi(n, y):
    x=0
    for i in range(n+1):
        x = i*10000
        if x >y :
            break
        for i2 in range(n+1 - i):
            x = i*10000 + i2 * 5000
            if x > y :
                break
                
            i3 = n - i - i2
            x =  i*10000 + i2 * 5000 + i3 *1000
            if x > y :
                break

            if i + i2 + i3 != n :
                pass
            else :
                if x  == y :
                    print(i, i2, i3)
                    return 

    print(-1, -1, -1)
    return 

n, y = [int(i)  for i in input().split()]

otoshi(n, y)
n, q = map(int, input().split())

answer = []
# create segtree
size = 2

while size < n :
    size *= 2
    
size = size * 2 - 1
segtree = [2**31 - 1 for x in range(size)]

# update query
def update(i, x) :
    ind = size // 2 + i
    segtree[ind] = x
    
    while ind :
        ind = (ind - 1) // 2 # parent
        ch1 = segtree[ind * 2 + 1]
        ch2 = segtree[ind * 2 + 2]
        segtree[ind] = min(ch1, ch2)
    
def query(s, t, l, r, p) :
    if s > r or t < l :
        return 2**31 - 1
    if s <= l and t >= l :
        return segtree[p]
    else :
        vl = query(s, t, l, (l + r) // 2, p * 2 + 1)
        vr = query(s, t, (l + r) // 2, r, p * 2 + 2)
        
        return min(vl, vr)
    
for i in range(q) :
    com, x, y = map(int, input().split())
     
    if com == 0 :
        update(x, y)
    else :
        answer.append(query(x, y, 0, size // 2, 0))

# print(answer)

for a in answer :
    print(a)
    



### FIXED CODE ###

n, q = map(int, input().split())

# max_num
INF = 2**31 - 1

# generate seg tree
seg_size = 2

while seg_size < n :
    seg_size *= 2
    
seg_size = seg_size * 2 - 1
seg_tree = [INF for x in range(seg_size)]

answer_stk = []

# update 
def update(i, x) :
    # leaf for index @ i
    idx = seg_size // 2 + i
    seg_tree[idx] = x
    
    while idx :
        idx = (idx - 1) // 2
        l_child = seg_tree[idx * 2 + 1]
        r_child = seg_tree[idx * 2 + 2]
        
        seg_tree[idx] = min(l_child, r_child)

# query
def query(s, t, l, r, curnode) :
    # no overlap then return INF
    if s > r or t < l :
        return INF
    
    # full overlap then return current node
    if s <= l and t >= r :
        return seg_tree[curnode]
    
    # partial overlap then return min for next
    else :
        l_child = curnode * 2 + 1
        r_child = curnode * 2 + 2
        
        l_value = query(s, t, l, (l + r) // 2, l_child)
        r_value = query(s, t, (l + r) // 2 + 1, r, r_child)
        
        return min(l_value, r_value)
    
# do main query
for i in range(q) :
    q, x, y = map(int, input().split())
    
    # update
    if q == 0 :
        update(x, y)
        
    # query 
    else :
        answer_stk.append(query(x, y, 0, seg_size // 2, 0))
        
for a in answer_stk :
    print(a)
import fractions

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

used={}
unused={}

def gcd(x,y):
    if x==-1 or y==-1:
        return max(x,y)
    return fractions.gcd(x,y)

def rec(i,x,f):
    if i+1==N and f==1:
        return x
    elif i+1==N and f==0:
        return -1
    
    if f==1 and used.get(x,-1)>0:
        return used[x]
    if f==0 and unused.get(x,-1)>0:
        return unused[x]
    
    if f==0:
        unused[x]=rec(i+1,gcd(x,A[i+1]),0)
        used[x]=rec(i+1,x,1)
        return max(unused[x],used[x])
    else:
        used[x]=rec(i+1,gcd(x,A[i+1]),1)
        return used[x]


print(rec(-1,-1,0))


### FIXED CODE ###

import fractions

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

L=[0]*(N+1)
R=[0]*(N+1)

def gcd(x,y):
    if x==0 or y==0:
        return max(x,y)
    return fractions.gcd(x,y)

for i in range(N):
    j=N-i

    L[i+1]=gcd(L[i],A[i])
    R[j-1]=gcd(R[j],A[j-1])
ans=0

for i in range(N):
    ans=max(ans,gcd(L[i],R[i+1]))

print(ans)
N, P = map(int, input().split())
odd = sum([int(i) % 2 for i in input().split()])
even = N-odd

if odd == 0:
    if P == 0:
        print(2**even)
    else:  # P==1
        print(0)
else:
    print(2**even * (2**odd//2))


### FIXED CODE ###

from collections import defaultdict
N = int(input())
A = [int(i) for i in input().split()]

d = defaultdict(int)

d[0] = 1
sum = 0
for i in range(N):
    sum += A[i]
    d[sum] += 1

ans = 0
for v in d.values():
    if v >= 2:
        ans += (v*(v-1))//2

print(ans)
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

plus = []
minus = []
for i in a:
    if i > 0: plus.append(i)
    if i < 0: minus.append(i)

ans = 1
if k > len(plus) + len(minus):
    ans = 0
elif len(minus) == 0:
    plus.sort(reverse=True)
    for i in range(k):
        ans = (ans * plus[i]) % mod
elif len(plus) == 0:
    if k % 2 == 0:
        minus.sort()
        for i in range(k):
            ans = (ans * minus[i]) % mod
    else:
        minus.sort(reverse=True)
        for i in range(k):
            ans = (ans * minus[i]) % mod
elif k == len(plus) + len(minus) and (len(minus) % 2) == 1:
    if n != len(plus) + len(minus):
        ans = 0
    else:
        for x in plus:
            ans = (ans * x) % mod
        for y in minus:
            ans = (ans * y) % mod
else:
    plus.sort(reverse=True)
    minus.sort()
    i, j = 0, 0
    if k % 2 == 1:
        ans = plus[0]
        i = 1
    while i + j < k:
        tmp_p = plus[i] * plus[i + 1] if i <= len(plus) - 2 else 1
        tmp_m = minus[j] * minus[j + 1] if j <= len(plus) - 2 else 1
        if tmp_p >= tmp_m:
            ans = (ans * (tmp_p % mod)) % mod
            i += 2
        else:
            ans = (ans * (tmp_m % mod)) % mod
            j += 2
print(ans)


### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

plus = []
minus = []
for i in a:
    if i > 0: plus.append(i)
    if i < 0: minus.append(i)

ans = 1
if k > len(plus) + len(minus):
    ans = 0
elif len(minus) == 0:
    plus.sort(reverse=True)
    for i in range(k):
        ans = (ans * plus[i]) % mod
elif len(plus) == 0:
    if k % 2 == 0:
        minus.sort()
        for i in range(k):
            ans = (ans * minus[i]) % mod
    else:
        if n != len(minus):
            ans = 0
        else:
            minus.sort(reverse=True)
            for i in range(k):
                ans = (ans * minus[i]) % mod
elif k == len(plus) + len(minus) and (len(minus) % 2) == 1:
    if n != k:
        ans = 0
    else:
        for x in plus:
            ans = (ans * x) % mod
        for y in minus:
            ans = (ans * y) % mod
else:
    plus.sort(reverse=True)
    minus.sort()
    i, j = 0, 0
    if k % 2 == 1:
        ans = plus[0]
        i = 1
    while i + j < k:
        tmp_p = plus[i] * plus[i + 1] if i <= len(plus) - 2 else 1
        tmp_m = minus[j] * minus[j + 1] if j <= len(minus) - 2 else 1
        if tmp_p >= tmp_m:
            ans = (ans * (tmp_p % mod)) % mod
            i += 2
        else:
            ans = (ans * (tmp_m % mod)) % mod
            j += 2
print(ans)
a,b,x = map(int,input().split())
maxv2 = a*(10**9)+b*10
minv2 = a*1+b
maxv1 = 10**9
minv1 =0

if  maxv2 <= x:
    print(10**9)
    
elif minv2 > x:
    print(0)
    

while True:
    #print(minv1,maxv,avg)
    avg =(maxv1+minv1)//2
    maxv = a*avg + b*len(str(avg))
           
    if maxv > x:
        if (a*(avg-1) + b*len(str(avg-1))) <x:
            print(avg-1)
            break
        else:
            maxv1 = avg
                         
    elif maxv < x:
        if (a*(avg+1) + b*len(str(avg+1))) >x:
            print(avg)
            break
        else:
            minv1 = avg


### FIXED CODE ###

week = ["MON","TUE","WED","THU","FRI","SAT","SUN" ]
S = input()
a =week.index(S)
print(7 if a==6 else 6-a)
import sys
import heapq

stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces


N, K = na()

A_array = na()

cusum = 0
mod_array = [0]
for i, a in enumerate(A_array):
    cusum = (cusum + a) % K
    mod = (cusum + K - (i+1)) % K
    mod_array.append(mod)

# print(mod_array)

ans = 0
mod_queue = []
cnt_array = [0] * K
for i, v in enumerate(mod_array):
    heapq.heappush(mod_queue, (i, 1, v))

while(len(mod_queue)):
    i, q, v = heapq.heappop(mod_queue)
    if q == 1:
        ans += cnt_array[v]
        cnt_array[v] += 1
        heapq.heappush(mod_queue, (i+K-0.5, 2, v))
    else:
        cnt_array[v] -= 1
    # print(i, v, q, ans)

print(ans)


### FIXED CODE ###

import sys
import heapq
from collections import defaultdict

stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces


N, K = na()

A_array = na()

cusum = 0
mod_array = [0]
for i, a in enumerate(A_array):
    cusum = (cusum + a) % K
    mod = (cusum + K - (i+1)) % K
    mod_array.append(mod)

# print(mod_array)

ans = 0
mod_queue = []
cnt_dic = defaultdict(int)
for i, v in enumerate(mod_array):
    heapq.heappush(mod_queue, (i, 1, v))

while(len(mod_queue)):
    i, q, v = heapq.heappop(mod_queue)
    if q == 1:
        ans += cnt_dic[v]
        cnt_dic[v] += 1
        if i + K <= N:
            heapq.heappush(mod_queue, (i+K-0.5, 2, v))
    else:
        cnt_dic[v] -= 1
    # print(i, v, q, ans)

print(ans)
n = int(input())
k=[]
for i in range(n):
    k.append(input())
p = set(k)
if len(p) == 3:
    print("Three")
else:
    print("Four")


### FIXED CODE ###

n = int(input())
k = list(map(str, input().split()))
p = set(k)
if len(p) == 3:
    print("Three")
else:
    print("Four")