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

def eratosthenes(n):
    prime = []
    limit = n**0.5
    numbers = [i for i in range(2,n+1)]
    while True:
        p = numbers[0]
        if limit <= p:
            return prime + numbers
        prime.append(p)
        numbers = [i for i in numbers if i%p != 0]
    return prime

def prime_decomposition(n):
  i = 2
  d = {}
  while i * i <= n:
    while n % i == 0:
      n //= i
      if i not in d:
          d[i] = 0
      d[i] += 1
    i += 1
  if n > 1:
    if n not in d:
        d[n] = 1
  return d

pl = eratosthenes(10**6)
pd = {}
for p in pl:
    pd[p] = 0

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

A.sort()



d = {}
ans = 0
for i in range(N):
    if A[i] not in pd:
        primes = prime_decomposition(A[i])
        for p in primes:
            if p not in d:
                d[p] = 0
            else:
                ans = 1
                break
    else:
        if A[i] in d:
            ans = 1
            break
        d[A[i]] = 0

if ans == 0:
    print('pairwise coprime')
else:
    def gcd(a, b):
    	while b:
    		a, b = b, a % b
    	return a
    a = A[0]
    for i in range(N):
        a = gcd(a,A[i])
    if a==1:
        print('setwise coprime')
    else:
        print('not coprime')

### FIXED CODE ###

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

def prime_decomposition(n):
  i = 2
  d = {}
  while i * i <= n:
    while n % i == 0:
      n //= i
      if i not in d:
          d[i] = 0
      d[i] += 1
    i += 1
  if n > 1:
    if n not in d:
        d[n] = 1
  return d

A.sort()
M = A[-1]
d = {}
ans = 0

for i in range(N):
    if A[i] not in d:
        primes = prime_decomposition(A[i])
        for p in primes:
            for j in range(1,M//p+1):
                d[j*p] = 0
    else:
        ans = 1
        break
if ans == 0:
    print('pairwise coprime')
else:
    def gcd(a, b):
    	while b:
    		a, b = b, a % b
    	return a
    a = A[0]
    for i in range(N):
        a = gcd(a,A[i])
    if a==1:
        print('setwise coprime')
    else:
        print('not coprime')
### BUGGY CODE ###

S=input()
lens=len(S)

mod=10**9+7

Alist=[0]*lens
#Blist=[0]*lens
Clist=[0]*lens
qlist=[0]*lens

Asum=[0]*lens
#Bsum=[0]*lens
Csum=[0]*lens
qsum=[0]*lens

for i in range(lens):
    if S[i]=="A":
        Alist[i]=1
    #elif S[i]=="B":
    #    Blist[i]=1
    elif S[i]=="C":
        Clist[i]=1
    elif S[i]=="?":
        qlist[i]=1

    Asum[i]=Asum[i-1]+Alist[i]
    #Bsum[i]=Bsum[i-1]+Blist[i]
    Csum[i]=Csum[i-1]+Clist[i]
    qsum[i]=qsum[i-1]+qlist[i]

#ASUM=Asum[lens-1]
CSUM=Csum[lens-1]
QSUM=qsum[lens-1]


count=0
for i in range(1,lens-1):
    if S[i]=="B":
        count+=Asum[i-1]*(CSUM-Csum[i])*(3**max(0,QSUM))%mod
        count+=Asum[i-1]*(QSUM-qsum[i])*(3**max(0,(QSUM-1)))%mod
        count+=qsum[i-1]*(CSUM-Csum[i])*(3**max(0,(QSUM-1)))%mod
        count+=qsum[i-1]*(QSUM-qsum[i])*(3**max(0,(QSUM-2)))%mod


    elif S[i]=="?":
        count+=Asum[i-1]*(CSUM-Csum[i])*(3**max(0,(QSUM-1)))%mod
        count+=Asum[i-1]*(QSUM-qsum[i])*(3**max(0,(QSUM-2)))%mod
        count+=qsum[i-1]*(CSUM-Csum[i])*(3**max(0,(QSUM-2)))%mod
        count+=qsum[i-1]*(QSUM-qsum[i])*(3**max(0,(QSUM-3)))%mod

        
    



#count=0
#for a in range(lens-2):
#    if S[a]=="A" or S[a]=="?":
#        for b in range(a+1,lens-1):
#            if S[b]=="B" or S[b]=="?":
#                for c in range(b+1,lens):
#                    if S[c]=="C" or S[c]=="?":
#                        count+=1
print(count%mod)


            


### FIXED CODE ###

S=input()
lens=len(S)

mod=10**9+7


Asum=[0]*lens
#Bsum=[0]*lens
Csum=[0]*lens
qsum=[0]*lens

for i in range(lens):
    if S[i]=="A":
        Asum[i]=Asum[i-1]+1
        Csum[i]=Csum[i-1]
        qsum[i]=qsum[i-1]
    elif S[i]=="C":
        Asum[i]=Asum[i-1]
        Csum[i]=Csum[i-1]+1
        qsum[i]=qsum[i-1]
    elif S[i]=="?":
        Asum[i]=Asum[i-1]
        Csum[i]=Csum[i-1]
        qsum[i]=qsum[i-1]+1
    else:
        Asum[i]=Asum[i-1]
        Csum[i]=Csum[i-1]
        qsum[i]=qsum[i-1]        

CSUM=Csum[lens-1]
QSUM=qsum[lens-1]


count=0
for i in range(1,lens-1):
    if S[i]=="B":
        count+=Asum[i-1]*(CSUM-Csum[i])*pow(3,max(0,QSUM),mod)%mod
        count+=Asum[i-1]*(QSUM-qsum[i])*pow(3,max(0,QSUM-1),mod)%mod
        count+=qsum[i-1]*(CSUM-Csum[i])*pow(3,max(0,QSUM-1),mod)%mod
        count+=qsum[i-1]*(QSUM-qsum[i])*pow(3,max(0,QSUM-2),mod)%mod


    elif S[i]=="?":
        count+=Asum[i-1]*(CSUM-Csum[i])*pow(3,max(0,QSUM-1),mod)%mod
        count+=Asum[i-1]*(QSUM-qsum[i])*pow(3,max(0,QSUM-2),mod)%mod
        count+=qsum[i-1]*(CSUM-Csum[i])*pow(3,max(0,QSUM-2),mod)%mod
        count+=qsum[i-1]*(QSUM-qsum[i])*pow(3,max(0,QSUM-3),mod)%mod
        
    



#count=0
#for a in range(lens-2):
#    if S[a]=="A" or S[a]=="?":
#        for b in range(a+1,lens-1):
#            if S[b]=="B" or S[b]=="?":
#                for c in range(b+1,lens):
#                    if S[c]=="C" or S[c]=="?":
#                        count+=1
print(count%mod)
### BUGGY CODE ###

import math

def main():
    input1 = input().split()
    A = int(input1[0])
    B = int(input1[1])
    N = int(input1[2])

    output = 0
    result = 0
    for x in range(N+1):
        result = (math.floor(A*x / B)) - A*(math.floor(x/B))
        if result > output:
            output = result

    print(output)


if __name__ == "__main__":
    main()

### FIXED CODE ###

import math

input1 = input().split()
A = int(input1[0])
B = int(input1[1])
N = int(input1[2])

x = 0
result = 0
if N >= B-1:
    x = B-1
    result = (A*(x%B) - (A*x)%B)/B
elif N < B-1:
    x = N
    result = (A*(x%B) - (A*x)%B)/B

print(int(result))
### BUGGY CODE ###

N=int(input())
S=input()

res=0
for i in range(N):
    for j in range(N):
        for k in range(N):
            if not i<j<k:
                continue
            if len(set([S[i],S[j],S[k]]))==3 and 2*j!=i+k:
                res+=1
print(res)

### FIXED CODE ###

N=int(input())
S=input()

res=0
R=[]
G=[]
B=[]
r,g,b=0,0,0
for i in range(N):
    if S[i]=='R':
        r+=1
    elif S[i]=='G':
        g+=1
    else:
        b+=1
    R.append(r)
    G.append(g)
    B.append(b)
    
for i in range(N):
    for j in range(N):
        if not i<j:
            continue
        k=S[2*j-i] if 2*j-i<N else 'A'
        if set([S[i],S[j]])==set(['R','G']):
            res+=B[-1]-B[j]-(k=='B')
        elif set([S[i],S[j]])==set(['B','G']):
            res+=R[-1]-R[j]-(k=='R')
        elif set([S[i],S[j]])==set(['R','B']):
            res+=G[-1]-G[j]-(k=='G')
print(res)
### BUGGY CODE ###

h, w = map(int, input().split())
bits = ''.join(input() for _ in range(h))
bits = bits.replace('.', '1').replace('#', '0')
bits = int(bits, 2)
count = 0
     
line_b = (1 << w) - 1
line_t = line_b << w * (h - 1)
line_r = sum(1 << b for b in range(0, h * w, w))
line_l = line_r << w - 1
while bits:
    mask_t = (bits << w) | line_b
    mask_b = (bits >> w) | line_t
    mask_l = (bits << 1) | line_r
    mask_r = (bits >> 1) | line_l
    bits &= mask_t & mask_b & mask_l & mask_r
    count += 1
print(count)


### FIXED CODE ###

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

a = ''.join(input() + '#' for _ in range(h))
a = a.replace('.', '1').replace('#', '0')

bits = int(a, 2)

w1 = w + 1
h1 = h + 1
bits <<= w1

frame = (1 << w1) - 1
frame |= frame << h1 * w1
frame |= sum(1 << b for b in range(w1, h1 * w1, w1))

count = 0
while bits:
    count += 1
    mask = bits | frame
    #       up             down           left          right
    bits &= (mask << w1) & (mask >> w1) & (mask << 1) & (mask >> 1)
print(count)
### BUGGY CODE ###

X, Y, Z, K = map(int, input().split())
A = sorted([int(a) for a in input().split()])[::-1]
B = sorted([int(a) for a in input().split()])[::-1]
C = sorted([int(a) for a in input().split()])[::-1]
L = [(0,0,0)]
for k in range(K):
    ma = 0
    for i,j,k in L:
        if A[i]+B[j]+C[k] > ma:
            ma = A[i]+B[j]+C[k]
            mai,maj,mak = i,j,k
    if mai+1<X and (mai+1,maj,mak) not in L: L.append((mai+1,maj,mak))
    if maj+1<Y and (mai,maj+1,mak) not in L: L.append((mai,maj+1,mak))
    if mak+1<Z and (mai,maj,mak+1) not in L: L.append((mai,maj,mak+1))
    print(ma)
    L.remove((mai,maj,mak))


### FIXED CODE ###

X, Y, Z, K = map(int, input().split())
A = sorted([int(a) for a in input().split()])[::-1]
B = sorted([int(a) for a in input().split()])[::-1]
C = sorted([int(a) for a in input().split()])[::-1]
L = [(0,0,0)]
for k in range(K):
    ma = 0
    for i,j,k in L:
        if A[i]+B[j]+C[k] > ma:
            ma = A[i]+B[j]+C[k]
            mai,maj,mak = i,j,k
    if mai+1<X and (mai+1,maj,mak) not in L: L.append((mai+1,maj,mak))
    if maj+1<Y and (mai,maj+1,mak) not in L: L.append((mai,maj+1,mak))
    if mak+1<Z and (mai,maj,mak+1) not in L: L.append((mai,maj,mak+1))
    print(ma)
    L.remove((mai,maj,mak))
### BUGGY CODE ###

n = int(input())


k=1
for i in range(1,n+1):
  k = k * i

  
  
if k <(10**9 + 7):
  print(k)
else:
  print(k % (10**9 + 7))


### FIXED CODE ###

n = int(input())

x = (10**9 + 7)
k=1
for i in range(1,n+1):
  k = k * i
  k = k%x

print(k)
### BUGGY CODE ###

from collections import Counter
n = int(input())

cnt = 0
anas = [Counter(input())]

for _ in range(n-1):
    _s = Counter(input())
    for a in anas:
        if a == _s:
            cnt += 1

    anas.append(_s)

print(cnt)

### FIXED CODE ###

from collections import Counter
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n = int(input())
anas = [''.join(sorted(input())) for _ in range(n)]
c = Counter(anas)


cnt = 0
for v in c.values():
    if v < 2:
        continue
    else:
        cnt += cmb(v, 2)

print(cnt)
### BUGGY CODE ###

import math
k= int(input())
ans = 0
for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      g = math.gcd(a,b)
      g = math.gcd(g,c)
      ans = ans + g
print(ans)

### FIXED CODE ###

import math
n=int(input())
ans=0
for i in range(1,n+1):
  for j in range(1,n+1):
    for k in range(1,n+1):
      ans+=math.gcd(i,math.gcd(j,k))
print(ans)
### BUGGY CODE ###

import numpy as np
import sys
import collections
import copy

def IDgyakusan(aidi):
    return((aidi//W,aidi%W))
def chokusenkyori(i,j,k):
    return(abs(i-k[0])+abs(j-k[1]))
    
deque=collections.deque
fastinput=sys.stdin.readline
blacks=deque()
H,W=map(int,input().split())
A=[list(fastinput().rstrip()) for j in range(H)]
curmax=0
for k,i in enumerate(A):
    for l,j in enumerate(i):
        if j=="#":
            blacks.append(k*W+l)
for k,i in enumerate(A):
    for l,j in enumerate(i):
        if j==".":
            curmax=max(curmax,min([chokusenkyori(k,l,IDgyakusan(x)) for x in blacks]))
            
print(curmax)

### FIXED CODE ###

import collections
H,W=map(int,input().split())
went=[[False]*W for i in range(H)]
queue=collections.deque()
for hoge in range(H):
    for huga,t in enumerate(input()):
        if t=="#":
            went[hoge][huga]=True
            queue.append([hoge,huga,0])
while queue:
    curx,cury,ct=queue.popleft()
    for dx,dy in [[1,0],[-1,0],[0,1],[0,-1]]:
        newx,newy=curx+dx,cury+dy
        newct=ct+1
        if 0<=newx<H and 0<=newy<W and (not went[newx][newy]):
            went[newx][newy]=True
            queue.append([newx,newy,newct])
print(ct)
### BUGGY CODE ###

import sys


def inp():
    return sys.stdin.readline().strip()


n, q = map(int, inp().split())
s = inp()
a = []

for i in range(n - 1):
    if s[i:i+2] == 'AC':
        a.append(1)
    else:
        a.append(0)

for _ in range(q):
    l, r = map(int, inp().split())
    print(sum(a[l-1:r-1]))

### FIXED CODE ###

import sys


def inp():
    return sys.stdin.readline().strip()


n, q = map(int, inp().split())
s = inp()
a = [0] * n

for i in range(1, n):
    if s[i-1] == 'A' and s[i] == 'C':
        a[i] = a[i-1] + 1
    else:
        a[i] = a[i-1]

for _ in range(q):
    l, r = map(int, inp().split())
    print(a[r-1] - a[l-1])
### BUGGY CODE ###

import sys
sys.setrecursionlimit(1000000)


def isFRIEND(a, b):
  return b in F[a] if a in F.keys() else False


def isBLOCK(c,d):
  return d in B[c] if c in B.keys() else False


def isFtoF(a, b, chk):
  #print(chk, a, b)
  chk.append(a)
  if a not in F.keys():
    return False
  for i in F[a]: # search for friends
    if not i in F.keys():
      continue
    if i in chk: # completed
      continue
    if i==b: # Friend to Friend
      return True
    else:
      if isFtoF(i, b, chk):
        return True
  return False


def calc():
  for n1 in range(1,N+1):
    for n2 in range(n1+1,N+1):
      #print(0,n1,n2,D)
      if not isBLOCK(n1,n2) and not isFRIEND(n1,n2) and isFtoF(n1,n2, []):
        D[n1]+=1
        D[n2]+=1


def main():
  calc()
  print(*D[1:])


if __name__=='__main__':
  N, M, K = map(int, input().split())
  F={}
  for m in range(M):
    a, b = map(int, input().split())
    F[a]=F.get(a, []) + [b]
    F[b]=F.get(b, []) + [a]
  B={}
  for k in range(K):
    c, d = map(int, input().split())
    B[c]=B.get(c, []) + [d]
    B[d]=B.get(d, []) + [c]
  D=[0]*(N+1)
  #print(F)
  #print(B)
  main()

### FIXED CODE ###

def makeRelation():
  visited=[False]*(N+1)
  g=0 # group
  for n in range(1,N+1):
    if visited[n]:
      continue
    q={n}
    D.append(set())
    while q:
      j=q.pop()
      for i in F[j]: # search for friend
        if not visited[i]:
          visited[i]=True
          q.add(i)
          D[g]|={i}
    g+=1
    
def main():
  makeRelation()
  #print(D)
  for g in D:
    for d in g:
      ans[d]=len(g) - len(F[d]) - len(g&B[d]) - 1
  print(*ans[1:])


if __name__=='__main__':
  N, M, K = map(int, input().split())
  F=[set() for n in range(N+1)]
  AB=[list(map(int, input().split())) for m in range(M)]
  for a,b in AB:
    F[a].add(b)
    F[b].add(a)
  B=[set() for n in range(N+1)]
  CD=[list(map(int, input().split())) for k in range(K)]
  for c,d in CD:
    B[c].add(d)
    B[d].add(c)
  D=[]
  #print(F)
  #print(B)
  ans=[0]*(N+1)
  main()
### BUGGY CODE ###

def resolve():
    n,k= map(int,input().split())
    h = list(map(int,input().split()))
    d = [float("inf")]*(n)
    d[0] = 0
    for i in range(n):
        for j in range(1,min(i,k)+1):
            d[i] = min(d[i-j]+abs(h[i]-h[i-j]),d[i])
#            print(i,j)
#        print(d[i])
    print(d[-1])

resolve()


### FIXED CODE ###

import numpy as np
def resolve():
    n,k= map(int,input().split())
    h = np.array(list(map(int,input().split())))
    d = np.array([0]*n)
    d[0] = 0
    for i in range(1,n):
        j=max(0,i-k)
        d[i] = (d[j:i]+np.abs(h[i]-h[j:i])).min()
    print(d[-1])

resolve()
### BUGGY CODE ###

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = sorted(A)
    count =[]
    for i in ans:
        count.append(A.index(i)+1)
    print(*count)
resolve()

### FIXED CODE ###

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = []
    for _ in range(N):
        ans.append("0")
    for i in range(N):
        ans[A[i]-1] = i+1
    print(*ans)
resolve()
### BUGGY CODE ###

n,m = map(int, input().split())
dic = {}

AB = [map(int, input().split()) for _ in range(m)]

dic = [[] for _ in range(n + 1)]

for a,b in AB:
    a -= 1
    b -= 1

    dic[a].append(b)
    dic[b].append(a)

dist = {}
queue = []
visited = []
pre = {}

dist[0] = 0 
queue.append(0)

while len(queue) > 0:
    v = queue.pop(0)
    
    for i in dic[v]:
        if i in visited:
            continue
        
        visited.append(i)
        dist[i] = dist[v] + 1
        pre[i]= v
        queue.append(i)


print("Yes")
for i in range(n):
    ans = 0
    
    if(i == 0):
        continue
    
    ans = pre[i]
    ans += 1
    print(ans)

### FIXED CODE ###

from collections import deque

n,m = map(int, input().split())
dic = {}

AB = [map(int, input().split()) for _ in range(m)]

dic = [[] for _ in range(n + 1)]

for a,b in AB:
    a -= 1
    b -= 1

    dic[a].append(b)
    dic[b].append(a)

#dist = {}
queue = deque([0])
visited = []
pre = [-1] * (n+1)

#dist[0] = 0 
queue.append(0)

while queue:
    v = queue.popleft()
    
    for i in dic[v]:
        if pre[i] == -1:
        #dist[i] = dist[v] + 1
            pre[i]= v
            queue.append(i)

print("Yes")
for i in range(n):
    ans = 0
    
    if(i == 0):
        continue
    
    ans = pre[i]
    ans += 1
    print(ans)
### BUGGY CODE ###

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

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

# list内の最も大きい数字を2で割るのをm回行う
for i in range(m):
    a = sorted(a)
    a[n -1] = int(a[n -1] / 2)

print(sum(a))

### FIXED CODE ###

import heapq

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

a = [-int(a) for a in input().split()]
heapq.heapify(a)

for i in range(m):
    heapq.heappush(a, int(heapq.heappop(a) / 2))

print(sum(a) * -1)
### BUGGY CODE ###

import sys
# input処理を高速化する
input = sys.stdin.readline
# 許容する再帰処理の回数を変更
sys.setrecursionlimit(300*300*300+10)

def main():
    N = int(input())
    lst_a = list(map(int, input().split()))
    one, two, three = lst_a.count(1), lst_a.count(2), lst_a.count(3)
    # dp[i][j][k] := 残り1個の皿がi枚、2個の皿がj枚、3個の皿がk枚の状態から、
    # 寿司をすべてなくすのに必要な操作回数の期待値
    # dpは-1で初期化
    dp = [[[-1.0] * (N+1) for _ in range(N+1)] for _ in range(N+1)]
    def rec(i, j, k):
        if dp[i][j][k] >= 0:
            return dp[i][j][k]
        if (i == 0 and j == 0 and k == 0):
            return 0.0
        
        res = 0.0
        if i > 0:
            res += rec(i-1, j, k) * i
        if j > 0:
            res += rec(i+1, j-1, k) * j
        if k > 0:
            res += rec(i, j+1, k-1) * k
        res += N
        res *= 1.0 / (i + j + k)
        dp[i][j][k] = res
        return dp[i][j][k]
    print(rec(one, two, three))

main()

### FIXED CODE ###

import sys

# input処理を高速化する
input = sys.stdin.readline

def main():
    N = int(input())
    lst_a = list(map(int, input().split()))
    one, two, three = lst_a.count(1), lst_a.count(2), lst_a.count(3)

    # dp[i][j][k] := 残り1個の皿がi枚、2個の皿がj枚、3個の皿がk枚の状態から、
    # 寿司をすべてなくすのに必要な操作回数の期待値
    dp = [[[0.0] * (N+1) for _ in range(N+1)] for _ in range(N+1)]

    for k in range(three + 1):
        for j in range(two + three + 1  - k):
            for i in range(one + two + three + 1 - k -j):
                if i == 0 and j == 0 and k == 0:
                    continue
                tmp = N * 1.0
                if i > 0:
                    tmp += i * dp[i -1][j][k]
                if j > 0:
                    tmp += j * dp[i + 1][j - 1][k]
                if k > 0:
                    tmp += k * dp[i][j + 1][k -1]
                dp[i][j][k] = tmp / (i + j + k)

    print(dp[one][two][three])


main()
### BUGGY CODE ###

def solve(n, s, MOD):
    d = 26
    ttt = [ord(c) - 97 for c in s]

    ttx = []
    c = 1
    for t in ttt[::-1]:
        ttx.append(t * c % MOD)
        c = c * d % MOD
    ttx.reverse()
    ttc = [0]
    for t in ttx:
        ttc.append((ttc[-1] + t) % MOD)

    for l in range(n // 2, 0, -1):
        appeared = []
        comparing = set()
        l2 = l * 2
        p = 1

        for i in range(l, n + 1):
            t = (ttc[i] - ttc[i - l]) * p % MOD
            if i >= l2:
                comparing.add(appeared[i - l2])
                if t in comparing:
                    return l
            appeared.append(t)
            p = p * d % MOD

    return 0


n = int(input())
s = input()
print(min(solve(n, s, MOD) for MOD in (1000000000039,)))


### FIXED CODE ###

def z_algorithm(s):
    n = len(s)
    prefix = [0] * n
    j = 0
    ret = 0
    for i in range(1, n):
        if i + prefix[i - j] < j + prefix[j]:
            prefix[i] = prefix[i - j]
        else:
            k = max(0, j + prefix[j] - i)
            while i + k < n and s[k] == s[i + k]:
                k += 1
            prefix[i] = k
            ret = max(ret, min(i, k))
            j = i
    return ret


n = int(input())
s = input()
print(max(z_algorithm(s[i:]) for i in range(n - 1)))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import math
from functools import reduce
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
K = int(input())
ans = 0
 
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            ans += gcd(i, j, k)
print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import math
from functools import reduce
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
K = int(input())
ans = 0
 
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            ans += gcd(i, j, k)
print(ans)
### BUGGY CODE ###

import bisect

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

a.sort()
b.sort()
c.sort()

total = 0
for i in c:
  index_b = bisect.bisect( b, i-1 )
  for j in b[:index_b]:
    index_c = bisect.bisect( a, j-1 )
    total += index_c
print(total)
    

### FIXED CODE ###

import bisect

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

total = 0
for i in b:
  index_a = bisect.bisect_right( a, i-1 )
  index_c = n - bisect.bisect_left( c, i+1 )
  total += index_a * index_c
print(total)
### BUGGY CODE ###

def main():
    n,k=map(int,input().split())
    p=list(map(int,input().split()))
    kitai=[]
    ans=0
    for i in range(n):
        buf=sum(range(1,p[i]+1))/p[i]
        kitai.append(buf)
        if i<=k-1:
            ans+=buf
    x=ans
    for i in range(k,n):
        x-=kitai[i-k]
        x+=kitai[i]
        if ans<=x:
            ans=x
    print(ans)

if __name__=='__main__':
    main()

### FIXED CODE ###

def main():
    n,k=map(int,input().split())
    p=list(map(int,input().split()))
    kitai=[]
    ans=0
    for i in range(n):
        buf=sum(range(1,p[i]+1))/p[i]
        kitai.append(buf)
        if i<=k-1:
            ans+=buf
    x=ans
    for i in range(k,n):
        x-=kitai[i-k]
        x+=kitai[i]
        if ans<=x:
            ans=x
    print(ans)

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

def MAIN():
    H, W = map(int, input().split())
    MAP = tuple(input() for _ in range(H))
    R, C = map(int, input().split())
    PTN = tuple(input() for _ in range(R))
    def solve(a, b):
        k = 0
        for i in range(a, a + R):
            if MAP[i][b:b + C] == PTN[k]:
                k += 1
            else:
                return False
        return True
    ans = []
    for i in range(H - R + 1):
        if PTN[0] not in MAP[i]:
            continue
        for j in range(W - C + 1):
            if solve(i, j):
                ans.append(f"{i} {j}")
    if ans:
        print("\n".join(a for a in ans))
MAIN()



### FIXED CODE ###

base1 = 1009
base2 = 1013
mask = (1 << 32) - 1
def calc_hash(f, r, c):
    global ph, pw, h
    tmp = [[0] * c for _ in range(r)]
    dr, dc = r - ph, c - pw
    # t1 = 1
    t1 = (base1 ** pw) & mask
    # for _ in range(pw):
        # t1 = (t1 * base1) & mask
    for i in range(r):
        e = 0
        for j in range(pw):
            e = e * base1 + f[i][j]
        for j in range(dc):
            tmp[i][j] = e
            e = (e * base1 - t1 * f[i][j] + f[i][j + pw]) & mask
        tmp[i][dc] = e
    t2 = 1
    for _ in range(ph):
        t2 = (t2 * base2) & mask
    for j in range(dc + 1):
        e = 0
        for i in range(ph):
            e = e * base2 + tmp[i][j]
        for i in range(dr):
            h[i][j] = e
            e = (e * base2 - t2 * tmp[i][j] + tmp[i + ph][j]) & mask
        h[dr][j] = e
th, tw = map(int, input().split())
t = tuple(tuple(ord(c) for c in input()) for _ in range(th))
ph, pw = map(int, input().split())
p = tuple(tuple(ord(c) for c in input()) for _ in range(ph))
ans = []
if th >= ph and tw >= pw:
    h = [[0] * tw for _ in range(th)]
    calc_hash(p, ph, pw)
    key = h[0][0] & mask
    calc_hash(t, th, tw)
    for i in range(th - ph + 1):
        for j in range(tw - pw + 1):
            if h[i][j] & mask == key:
                ans.append(f"{i} {j}")
if ans:
    print("\n".join(a for a in ans))