Harryxun/stf_run huggingface dataset:
import numpy


MOD = 10 ** 9 + 7
N = int(input())
A = list(map(int, input().split()))

lcm = 1
for a in A:
    lcm = numpy.lcm(lcm, a)
lcm %= MOD

ans = 0
for a in A:
    ans += lcm * pow(a, MOD - 2, MOD) % MOD
    ans %= MOD

print(ans)


### FIXED CODE ###

from fractions import gcd

mod = 10 ** 9 + 7

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

lcm = 1
for s in A:
    lcm = s * lcm // gcd(lcm, s)

ans = lcm * sum([pow(s, mod - 2, mod) for s in A]) % mod

print(int(ans % mod))
import itertools
import numpy as np

N,W,K = map(int,input().split())
g_all = np.array([list(input()) for i in range(N)])

K_all = np.count_nonzero(g_all == '#')
count = 0

def dfs(i,g):
  if (i<N):
    g[i,:] = ['r']*W
  else:
    g[:,i-N] = ['r']*N
  return g

g = g_all

for L in range(2**(N+W)): #2^n通り
  g = g_all.copy()
  for i in range(N+W):　#bit列分
    if (i<N):
      if ((L>>i)&1):
        g[i,:] = ['r']*W
    else:
      if ((L>>i)&1):
        g[:,i-N] = ['r']*N
  if np.count_nonzero(g == '#') ==K:
    count+=1
print(count)

### FIXED CODE ###

import itertools
import numpy as np
import copy

N,W,K = map(int,input().split())
g_all = np.array([list(input()) for i in range(N)])

K_all = np.count_nonzero(g_all == '#')
count = 0

def dfs(i,g):
  if (i<N):
    g[i,:] = ['r']*W
  else:
    g[:,i-N] = ['r']*N
  return g

g = g_all

for l in range(N+W+1):
  combi = itertools.combinations([i for i in range(N+W)],l)
  for com in combi:
    g = g_all.copy()
    for i in com:
      if (i<N):
        g[i,:] = ['r']*W
      else:
        g[:,i-N] = ['r']*N
    if np.count_nonzero(g == '#') ==K:
      count+=1
print(count)
import sys
import math
import collections
import bisect
import itertools
import numba
from numba import njit, b1, i4, i8, f8

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

@njit((i8, i8, i8, i8[:]), cache=True)
def main():
    r, c, k = ns()

    mat = [[0] * (c + 1)] * (r + 1)
    for _ in range(k):
        x, y, v = ns()
        x, y = x - 1, y - 1
        mat[x][y] = v

    dp = [[0] * 4] * (c + 1)

    for i in range(r):
        ndp = [[0] * 4] * (c + 1)
        for j in range(c):
            for n in range(2, -1, -1):
                dp[j][n + 1] = max(dp[j][n + 1], dp[j][n] + mat[i][j])

            ndp[j][0] = max(dp[j])
            for n in range(4):
                dp[j + 1][n] = max(dp[j + 1][n], dp[j][n])
        dp = ndp

    print(max(dp[c - 1]))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import math
import collections
import bisect
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

def main():
    r, c, k = ns()

    mat = [[0 for _ in range(c + 1)] for __ in range(r + 1)]
    for _ in range(k):
        x, y, v = ns()
        x, y = x - 1, y - 1
        mat[x][y] = v

    dp = [[0] * 4 for _ in range(c + 1)]

    for i in range(r):
        ndp = [[0] * 4 for _ in range(c + 1)]
        for j in range(c):
            for n in range(2, -1, -1):
                dp[j][n + 1] = max(dp[j][n + 1], dp[j][n] + mat[i][j])

            ndp[j][0] = max(dp[j])
            for n in range(4):
                dp[j + 1][n] = max(dp[j + 1][n], dp[j][n])
        dp = ndp

    print(max(dp[c - 1]))


if __name__ == '__main__':
    main()
n = list(str(input()))

cnt = 0
for i in range(0, len(n)):
    if int(s[i]) == 7:
        print("Yes")
        cnt += 1
        break
if cnt == 0:
    print("No") 

### FIXED CODE ###

n = list(str(input()))

cnt = 0
for i in range(0, len(n)):
    if int(n[i]) == 7:
        print("Yes")
        cnt += 1
        break
if cnt == 0:
    print("No")
import math

def lcm(x,y):
    return x*y/(math.gcd(x,y))

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

### FIXED CODE ###

def gcd(x,y):
    while y!=0:
        x,y=y,x%y
    return x

def lcm(x,y):
    return x*y/gcd(x,y)

A,B=map(int,input().split())
print(int(lcm(A,B)))
if input() == '1':
  print(Hello World)
else:
  print(eval(input()+'+'+input()))

### FIXED CODE ###

if input() == '1':
  print('Hello World')
else:
  print(eval(input()+'+'+input()))
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range (k, n);
  if a(i) > a(i-k):
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(k, n):
  if a[i] > a[i-k]:
    print("Yes")
  else:
    print("No")
import numpy as np

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

nl = np.array([i for i in range(n)]) + 1
ll = nl + l - 1

mini = ll.index(np.min(np.absolute(ll)))
lll = ll.pop(mini)

print(sum(lll))

### FIXED CODE ###

import numpy as np

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

nl = np.array([i for i in range(n)]) + 1
ll = nl + l - 1

mini = np.where(np.absolute(ll) == np.min(np.absolute(ll)))
ll = list(ll)
del ll[mini[0][0]]

print(np.sum(ll))
a=int(input())
b=list(map(int,input().split()))
c=sum(b)
d=[(c-x)*x for x in b]
e=sum(d)
print(e/2)


### FIXED CODE ###

a,b = map(int,input().split())
c = 2*b
d = a-c
if d > 0:
 print(d)
elif d <= 0:
 print(0)
h,w = map(int,raw_input().split())
a=[map(int,raw_input().split()) for _ in range(h)]
ret = []
for y in range(h):
    for x in range(w-1):
        if a[y][x]%2==1:
            ret.append((y,x,y,x+1))
            a[y][x+1]+=1
for y in range(h-1):
    if a[y][-1]==1:
        ret.append((y,w-1,y+1,w-1))
        a[y+1][-1]+=1
print len(seq)
for seq in ret:
    a,b,c,d = seq
    print a+1,b+1,c+1,d+1

### FIXED CODE ###

h,w = map(int,raw_input().split())
a=[map(int,raw_input().split()) for _ in range(h)]
ret = []
for y in range(h):
    for x in range(w-1):
        if a[y][x]%2==1:
            ret.append((y,x,y,x+1))
            a[y][x+1]+=1
for y in range(h-1):
    if a[y][-1]%2==1:
        ret.append((y,w-1,y+1,w-1))
        a[y+1][-1]+=1
print len(ret)
for seq in ret:
    a,b,c,d = seq
    print a+1,b+1,c+1,d+1
n, a, b = map(int, input().split())

s = "b"*a + "r"*b
s = s*(10**8)
print(s[:n].count("b"))

### FIXED CODE ###

n, a, b = map(int, input().split())
d = n//(a+b)
e = 0
if n%(a+b) <= a:
  e += n%(a+b)
else:
  e += a
print(d*a+e)
n = int(input())
s = [list(input()) for i in range(h)]
s += s

def ok(array):
    for i in range(1,n):
        for j in range(i):
            if array[i][j] != array[j][i]:
                return False
    return True
ans = 0
for i in range(n-1):
    if ok(s[i:i+n]):
        ans += n
print(ans)


### FIXED CODE ###

n = int(input())
s = [list(input()) for i in range(n)]
s += s

def ok(array):
    for i in range(1,n):
        for j in range(i):
            if array[i][j] != array[j][i]:
                return False
    return True
ans = 0
for i in range(n):
    if ok(s[i:i+n]):
        ans += n
print(ans)
I=lambda:[input()for _ in[0]*int(input())].count;s=I();t=I();print(max([0]+[s(i)-t(i)for i in set(s)]))

### FIXED CODE ###

I=lambda:[input()for _ in[0]*int(input())];s=I();t=I();print(max([0]+[s.count(i)-t.count(i)for i in set(s)]))
X = int(input())

def move(i, x):
 if x == X:
  return i
 elif i > X:
  return X+1
 else:
  if x > X:
   return min([move(i+1, x-(i+1)), move(i+1, x)])
  else:
   return min([move(i+1, x+(i+1)), move(i+1, x)])

print((move(0,0)))


### FIXED CODE ###

X = int(input())

i=0
while(i*(i+1)<2*X):
 i+=1

print(i)
c = input()
print(char(c + 1))

### FIXED CODE ###

c = input()
print(chr(ord(c) + 1))
from math import factorial
n,m=map(int,input().split())
mod=10**9+7
f=factorial(n)
if abs(n-m)>1:
  print(0)
elif abs(n-m)==1:
  print((f**2)%mod)
else :
  print((2*f**2%mod)


### FIXED CODE ###

from math import factorial
n,m=map(int,input().split())
MOD=10**9+7
if abs(n-m)>1:
  print(0)
elif abs(n-m)==1:
  print(factorial(n)*factorial(m)%MOD)
else:
  print(2*factorial(n)*factorial(m)%MOD)
S = list(input())

if S[0] == "L" and S[2] == "L":
    print("No")
elif S[1] == "R" and S[3] == "R":
    print("No")
else:
    print("Yes")

### FIXED CODE ###

S = str(input())

num = 0
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "L":
            num += 1
    else:
        if S[i] == "R":
            num += 1

if num == 0:
    print("Yes")
else:
    print("No")
def main():
    S = input()
    K = int(input())
    i = 0
    while S[i] == "1":
        i += 1
    if K <= i:
        return "1"
    else:
        return S[i]

if __name__ == '__main__':
    print(main())


### FIXED CODE ###

def main():
    S = input()
    K = int(input())
    i = 0
    while i < len(S) and S[i] == "1":
        i += 1
    if K <= i:
        return "1"
    else:
        return S[i]

if __name__ == '__main__':
    print(main())
def linearSearch(key, list, N):
    list[N] = key
    i = 0
    while l[i] != key:
        i += 1
    return int(i != N)


N1 = int(input())
arr1 = [int(n) for n in input().split() + [0]]
N2 = int(input())
arr2 = [int(n) for n in input().split()]

print(sum([linearSearch(key, arr1, N1) for key in arr2))



### FIXED CODE ###

def linearSearch(key, list):
    for e in list:
        if key == e:
            return 1
    return 0


N1 = int(input())
arr1 = [int(n) for n in input().split()]
N2 = int(input())
arr2 = [int(n) for n in input().split()]

print(sum([linearSearch(key, arr1) for key in arr2]))
from collections import deque
s=deque(input())
n=int(input())
r=0
for i in range(n):
    strlist=input()
    if strlist[0]=='1':
        r+=1
    elif strlist[0]=='2' and strlist[2] == '1':
        if r%2==0:
            s.appendleft(strlist[4])
        else:
            s.append(strlist[4])
    elif strlist[0]=='2' and strlist[2] =='2':
        if r%2==0:
            s.append(strlist[4])
        else:
            s.appendleft(strlist[4])
if r%2==0:
    for s_ in s:
        print(s_, end='')
else:
    for s_ in s.reverse():
        print(s_, end='')

### FIXED CODE ###

from collections import deque
s=deque(input())
n=int(input())
r=0
for i in range(n):
    strlist=input()
    if strlist[0]=='1':
        r+=1
    elif strlist[0]=='2' and strlist[2] == '1':
        if r%2==0:
            s.appendleft(strlist[4])
        else:
            s.append(strlist[4])
    elif strlist[0]=='2' and strlist[2] =='2':
        if r%2==0:
            s.append(strlist[4])
        else:
            s.appendleft(strlist[4])
if r%2==0:
    for s_ in s:
        print(s_, end='')
else:
    s.reverse()
    for s_ in s:
        print(s_, end='')
import bisect
import math

n = int(input())
As = list(map(int, input().split()))
As.sort()

cons = 10 ** 6
is_prime = [True] * (cons + 1)
Ds = [i for i in range(cons + 1)]
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(cons**0.5) + 1):
    if not is_prime[i]:
        continue
    for j in range(i * 2, cons + 1, i):
        is_prime[j] = False
        if Ds[j] == j:
          Ds[j] = i 

Ps = [i for i in range(cons + 1) if is_prime[i]]
flags = [[0 for _ in range(n)] for _ in range(int(cons**0.5))]
pairwiseFlag = True
setwiseFlag = True

for ia, a in enumerate(As):
  if a <= 1:
    continue
  while a != 1:
    d = Ds[a]
    flags[d][ia] = 1
    a = a // d
for i in range(int(cons**0.5)):
  s = sum(flags[i])
  if s >= 2:
    pairwiseFlag = False
  if s == n:
    setwiseFlag = False

if pairwiseFlag:
  print('pairwise coprime')
elif setwiseFlag:
  print('setwise coprime')
else:
  print('not coprime')


### FIXED CODE ###

import bisect
import math

n = int(input())
As = list(map(int, input().split()))
As.sort()

# cons = 10 ** 6
# is_prime = [True] * (cons + 1)
# is_prime[0] = False
# is_prime[1] = False
# for i in range(2, int(cons**0.5) + 1):
#     if not is_prime[i]:
#         continue
#     for j in range(i * 2, cons + 1, i):
#         is_prime[j] = False
# Ps = [i for i in range(cons + 1) if is_prime[i]]
def eratosthenes(n):
    is_prime = [0, 0] + [1] * (n - 1)
    for i in range(int(n**0.5) + 1):
        if is_prime[i] == 0:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = 0
    return [i for i, pi in enumerate(is_prime) if pi == 1]
Ps = eratosthenes(10 ** 6)

def factorize(n):
    primes = set()
    for p in Ps:
        if p * p > n:
            break
        while n % p == 0:
            n //= p
            primes.add(p)
    if n > 1:
        primes.add(n)
    return primes

gcd = As[0]
for a in As:
  gcd = math.gcd(gcd, a)
setwiseFlag = (gcd == 1)

pairwiseFlag = True
target = set()
for a in As:
  primes = factorize(a)
  if len(primes & target) > 0:
    pairwiseFlag = False
  target |= primes

if pairwiseFlag:
  print('pairwise coprime')
elif setwiseFlag:
  print('setwise coprime')
else:
  print('not coprime')
numsstr = input().split()
nums = []
for i in range(3):
    nums.append(int(numsstr[i]))
S = (nums[0] + nums[1]) * nums[2] / 2
print(int(S))

### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())
S = (a+b)*h/2
print(int(S))
n = int(input())
s = input()
seq = list(set(list(s)))
genkai_list = []
for i in range(0,1000):
    if 0 <= i <= 9:
        ap = "00" + str(i)
        genkai_list.append(ap)
    elif 10 <= i <= 99:
        ap = "0" + str(i)
        genkai_list.append(ap)
    else:
        genkai_list.append(str(i))
ans = []
for a in range(len(genkai_list)):
    for i in range(len(s)):
        if s[i] == avcodelist[a][0]:
            for j in range(i + 1, len(s)):
                if s[j] == avcodelist[a][1]:
                    for k in range(j + 1, len(s)):
                        if s[k] == avcodelist[a][2]:
                            ans.append(a)
print(len(set(ans)))

### FIXED CODE ###

n = int(input())
s = list(input())
genkai_list = []
for i in range(0,1000):
    if 0 <= i <= 9:
        ap = "00" + str(i)
        genkai_list.append(ap)
    elif 10 <= i <= 99:
        ap = "0" + str(i)
        genkai_list.append(ap)
    else:
        genkai_list.append(str(i))
count = 0
for a in genkai_list:
    try:
        s_ = s[s.index(a[0])+1:]
        s__ = s_[s_.index(a[1])+1:]
        if a[2] in s__:
            count += 1
    except:
        continue
print(count)
n,k= map(int,input().split())
from math import factorial 
for i in range(1,k+1):
  if n-k+1 >= i:
    print(int(((factorial(k-1)) * (factorial(n-k+1))/(factorial(i-1))/(factorial(k-i))/(factorial(i))/(factorial(n-k+1-i)))%(10**9+7)))
  else:
    print(0)


### FIXED CODE ###

import math
MOD = 10 ** 9 + 7

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


def f(n):
    return math.factorial(n)


for i in range(K):
    if N - K - i >= 0:
        print(f(N - K + 1) // f(N - K - i) // f(i + 1)
              * (f(K - 1) // f(K - i - 1) // f(i)) % MOD)
    else:
        print(0)
from scipy.special import comb

n , m = map(int , input().split())
print(comb(n , 2 , exact = True) + comb(m , 2 , exact = True))

### FIXED CODE ###

n , m = map(int , input().split())
print(int(n*(n-1)/2 + m*(m-1)/2))
class Queue(object): 

def __init__(self): 
self.queue_list = [] 

def enqueue(self, value): 
self.queue_list.append(value) 

def dequeue(self): 
try: 
value = self.queue_list.pop(0) 
except IndexError: 
value = None 

return value 
N = int(input()) 

pair = [] 
tree = {} 

for _ in range(N-1): 
a, b = list(map(int, input().split(" "))) 
if a in tree.keys(): 
tree[a].append(b) 
else: 
tree[a] = [b] 

if b in tree.keys(): 
tree[b].append(a) 
else: 
tree[b] = [a] 
pair.append([a,b]) 

c = list(map(int, input().split(" "))) 
c.sort(reverse=True) 
c = c[:N+2] 


queue = Queue() 
tree_l = {} 
for key in tree.keys(): 
tree_l[key] = len(tree[key]) 

ans = {} 
max_node = max((v, k) for k, v in tree_l.items())[1] 
ans[max_node] = c[0] 
used = [max_node] 
cnt = 0 

candi = {} 
for i in tree[max_node]: 
candi[i] = tree_l[i] 

for k, v in sorted(candi.items(), key=lambda x: -x[1]): 
queue.enqueue(k) 
used.append(k) 

while True: 
node = queue.dequeue() 
cnt += 1 
ans[node] = c[cnt] 

if cnt == N-1: 
break 

candi = {} 
for i in tree[node]: 
candi[i] = tree_l[i] 
for k, v in sorted(candi.items(), key=lambda x: -x[1]): 
if k not in used: 
queue.enqueue(k) 
used.append(k) 
total = 0 
for a, b in pair: 
if ans[a] > ans[b]: 
total += ans[b] 
else: 
total += ans[a] 

print(total) 
for i in range(1, N, 1): 
print(ans[i], end=" ") 

print(ans[N])

### FIXED CODE ###

class Queue(object):

    def __init__(self):
        self.queue_list = []

    def enqueue(self, value):
        self.queue_list.append(value)

    def dequeue(self):
        try:
            value = self.queue_list.pop(0)
        except IndexError:
            value = None

        return value

N = int(input())

pair = []
tree = {}

for _ in range(N-1):
    a, b = list(map(int, input().split(" "))) 
    if a in tree.keys():
        tree[a].append(b)
    else:
        tree[a] = [b]
        
    if b in tree.keys():
        tree[b].append(a)
    else:
        tree[b] = [a]
    pair.append([a,b])
    
c = list(map(int, input().split(" ")))
c.sort(reverse=True)
c = c[:N+2]


queue = Queue()
tree_l = {}
for key in tree.keys():
    tree_l[key] = len(tree[key])

ans = {}
max_node = max((v, k) for k, v in tree_l.items())[1]
ans[max_node] = c[0]
used = [max_node]
cnt = 0

candi = {}
for i in tree[max_node]:
    candi[i] = tree_l[i]

for k, v in sorted(candi.items(), key=lambda x: -x[1]):
    queue.enqueue(k)
    used.append(k)

while True:
    node = queue.dequeue()
    cnt += 1
    ans[node] = c[cnt]
    
    if cnt == N-1:
        break
    
    candi = {}
    for i in tree[node]:
        candi[i] = tree_l[i]
    for k, v in sorted(candi.items(), key=lambda x: -x[1]):
        if k not in used:
            queue.enqueue(k)
            used.append(k)
total = 0
for a, b in pair:
    if ans[a] > ans[b]:
        total += ans[b]
    else:
        total += ans[a]
        
print(total)
for i in range(1, N, 1):
    print(ans[i], end=" ")

print(ans[N])
o = input()
e = input()
s = ""
for i in range(len(o)):
  s += o[i]
  s += e[i]
if len(o) > len(e):
  s += o[-1]
print(s)

### FIXED CODE ###

o = input()
e = input()
s = ""
for i in range(len(e)):
  s += o[i]
  s += e[i]
if len(o) > len(e):
  s += o[-1]
print(s)
S,T = .input().split()
print(T+S)


### FIXED CODE ###

S,T =input().split()
print(T+S)
int(input(a, b, c))
set(pennki) = (a, b, c)
len(set(pennki))

### FIXED CODE ###

s = set(map(int, input().split()))
n = len(list(s))
print(n)
i = list(map(int,input().split()))

if i[0] <= i[3]:
	saidai=1*i[0]
elif:
	saidai=1*i[3]
else:
if i[2] >= (i[3]-i[0]-i[1]):
	saidai=saidai-1*(i[3]-i[0]-i[1])

print (saidai)
	

### FIXED CODE ###

i = list(map(int,input().split()))

if i [0] >= i[3]:
	saidai=1*i[3]
else:
	saidai=1*i[0]-1*(i[3]-i[0]-i[1])
print (saidai)
n,k,q=map(int,input().split())
ans=[-q]*n
for i in range(q):
  a=int(input())
  ans[a]+=1
  
for i in range(n):
  print('Yes' if ans[i] > -k else 'No')

  

### FIXED CODE ###

n,k,q=map(int,input().split())
ans=[-q]*n
for i in range(q):
  a=int(input())
  ans[a-1]+=1
  
for i in range(n):
  print('Yes' if ans[i] > -k else 'No')
N = list(input())

if N in '9':
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N = list(input())

if '9' in N:
    print('Yes')
else:
    print('No')
n = int(raw_input)
lst = []
#store all the cards
for i in ["S","H","C","D"]:
	for j in xrange(1,14):
		lst.append("{0} {1}".format((i,j))
#discard the given cards
for i in xrange(0,n):
	a = raw_input()
	lst.remove(a)
#print the result
for i in xrange(0,len(lst)):
	print lst[i]

### FIXED CODE ###

n = int(raw_input())
lst = []
#store all the cards
for i in ["S","H","C","D"]:
	for j in xrange(1,14):
		lst.append("{0} {1}".format(i,j))
#discard the given cards
for i in range(n):
	a = raw_input()
	lst.remove(a)
#print the result
for i in range(len(lst)):
	print lst[i]
A,B,T = map(int,input().split)

def main(A,B,T):
    time = A
    sum = 0
    while time <= T+0.5:
        if time%A == 0:
            sum += B
            time += 1
    print(sum)
    return 0


### FIXED CODE ###

import math
A,B,T = map(int,input().split())

def main(A,B,T):
    sum = B*(math.floor(T/A))
    print(sum)
    return 0

main(A,B,T)
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, k = list(map(int, input().rstrip('\n').split()))
    ls = list(map(lambda x: int(x) % k, input().rstrip('\n').split()))
    cnt = 0
    print(ls)
    for i in range(min(n, k)):
        t = sum(ls[:i+1])
        if t % k == i + 1:
            cnt += 1
            print(i, j)
        for j in range(i+1, n):
            t -= ls[j-i-1]
            t += ls[j]
            if t % k == i + 1:
                cnt += 1
                print(i, j)
            elif t % k > k:
                break
    print(cnt)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys
import itertools
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, k = list(map(int, input().rstrip('\n').split()))
    ls = [0] + list(map(lambda x: int(x) - 1, input().rstrip('\n').split()))
    ls = [i % k for i in list(itertools.accumulate(ls))]
    
    d = collections.defaultdict(int)
    t = 0
    for i, x in enumerate(ls):
        t += d[x]
        d[x] += 1
        if i >= k - 1:
            d[ls[i - k + 1]] -= 1
    print(t)


if __name__ == '__main__':
    solve()
s = input()
se = s[::2]
so = s[1::2]
ans = "-1 -1"
for i in range(len(s)-1) :
    if s[i] == s[i+1] :
        ans = str(i+1)+" "+str(i+2)
for i in range(len(se)-1) :
    if se[i] == se[i+1] :
        ans = str(2*i+1)+" "+str(2*i+3)
for i in range(len(se)-1) :
    if so[i] == so[i+1] :
        ans = str(2*i+2)+" "+str(2*i+4)
print(ans)

### FIXED CODE ###

s = input()
se = s[::2]
so = s[1::2]
ans = "-1 -1"
for i in range(len(s)-1) :
    if s[i] == s[i+1] :
        ans = str(i+1)+" "+str(i+2)
for i in range(len(se)-1) :
    if se[i] == se[i+1] :
        ans = str(2*i+1)+" "+str(2*i+3)
for i in range(len(so)-1) :
    if so[i] == so[i+1] :
        ans = str(2*i+2)+" "+str(2*i+4)
print(ans)
a,b,k=map(int,input().split())

i=o
while i<k:
  if a>0:
    a=a-1
    i=i+1
  elif b>0:
    b=b-1
    i=i+1
print(a,b)
  

### FIXED CODE ###

a, b, k = map(int,input().split())
if k >= a + b:
  print("0 0")
elif k>a:
  print ("0 "+str(a+b-k))
else:
  print(str(a-k)+" "+str(b))
if n < 4:
    print('No')
    exit()
                                                                                                                
for i in range(1, n % 7):
    tmp = n - 7 * i
    if tmp % 4 == 0:
        print('Yes')
        exit()
for i in range(1, n & 4):
    tmp = n - 4 * i
    if tmp % 7 == 0:
        print('Yes')
        exit()

print('No')

### FIXED CODE ###

n = int(input())

if n < 4:
    print('No')
    exit()
elif n % 7 == 0 or n % 4 == 0:
    print('Yes')
    exit()
elif n % 7 % 4 == 0 or n % 4 % 7 == 0:
    print('Yes')
    exit()
else:
    for i in range(1, n % 7):
        tmp = n - 7 * i
        if tmp < 0:
            break
        elif tmp % 4 == 0:
            print('Yes')
            exit()
    for i in range(1, n & 4):
        tmp = n - 4 * i
        if tmp < 0:
            break
        elif tmp % 7 == 0:                                                                                      
            print('Yes')
            exit()

print('No')