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

N = int(input())
S = []
SS = []
for i in range(N):
    tmp = input()
    S.append(tmp)
    if tmp not in SS:
        SS.append(tmp)
S.sort()
SS.sort()
T = {}
for i in range(N):
    if S[i] in T:
        T[S[i]] += 1
    else:
        T[S[i]] = 1
m = 0
for i in SS:
    m = max(T[i],m)
##print("--------")
for i in SS:
    if T[i] == m:
        print(i)

### FIXED CODE ###

N = int(input())
S = []

for i in range(N):
    tmp = input()
    S.append(tmp)
S.sort()
if N == 1:
    print(S[0])
    exit()
ans = []
SS = []
count = 1

for i in range(N-1):
    if i == N-2:
        if S[i] == S[i+1]:
            count += 1
            ans.append(count)
            SS.append(S[i])
        else:
            ans.append(count)
            SS.append(S[i])
            ans.append(1)
            SS.append(S[i+1])
    elif S[i] == S[i+1]:
        count += 1
    else:
        ans.append(count)
        SS.append(S[i])
        count = 1

m = max(ans)

for i in range(len(SS)):
    if ans[i] == m:
        print(SS[i])
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**5)

def solve(ab, hp, memo):
  if hp <= 0:
    return 0, -hp
  else:
    err = 0
    if not hp in memo:
      c_min = 10**10
      for attack, cost in ab:
        c, e = solve(ab, hp-attack, memo)
        if c+cost < c_min:
          c_min = c+cost
          err = e
      for i in range(err+1):
        memo[hp+i] = c_min
    return memo[hp], err

H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
print(solve(AB, H, {})[0])

### FIXED CODE ###

H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
memo = [10**10]*(H+1)
memo[0] = 0
i = 0
while i <= H:
  for a, b in AB:
    memo[i] = min(memo[i], b+memo[max(0, i-a)])
  i += 1
print(memo[H])
### BUGGY CODE ###

n, m  = map(int, input().split())
g     = {}
used  = {i:[False for _ in range(11)] for i in range(n)}
color     = [0  for _ in range(n)]

for _ in range(m):
    u, v = map(int, input().split())
    u-=1
    v-=1
    if u not in g:
        g[u] = []
    if v not in g:
        g[v] = []
    g[u].append(v)
    g[v].append(u)
    
q = int(input())
Q = []

for _ in range(q):
    node, dis, col = map(int, input().split())
    Q.append([node-1, dis, col])
Q = Q[::-1]

def bfs(now, dist, col):
    
    if used[now][dist]:
        return
 
    used[now][dist] = True
    
    if not color[now]:
        color[now] = col
 
    if now in g and dist > 0:
        for x in g[now]:
            bfs(x, dist - 1, col)
            
for node, dis, col in Q:
    bfs(node, dis, col)

for x in color:
    print(x)


### FIXED CODE ###

n, m  = map(int, input().split())
g     = {}
used  = {i:[False for _ in range(11)] for i in range(n)}
color     = [0  for _ in range(n)]

for _ in range(m):
    u, v = map(int, input().split())
    u-=1
    v-=1
    if u not in g:
        g[u] = []
    if v not in g:
        g[v] = []
    g[u].append(v)
    g[v].append(u)
    
q = int(input())
Q = []

for _ in range(q):
    node, dis, col = map(int, input().split())
    Q.append([node-1, dis, col])
Q = Q[::-1]

def bfs(now, dist, col):
    if dist < 0:
        return
    
    if used[now][dist]:
        return
 
    used[now][dist] = True
    
    if not color[now]:
        color[now] = col
 
    if now in g:
        for x in g[now]:
            bfs(x, dist - 1, col)
            
for node, dis, col in Q:
    bfs(node, dis, col)

for x in color:
    print(x)
### BUGGY CODE ###

K,S = map(int,input().split(" "))
 
s = 0
 
for x in range(K+1):
  for y in range(K+1):
    for z in range(K+1):
      if x +y +z ==S:
        s +=1
 
print(s)

### FIXED CODE ###

K,S = map(int,input().split(" "))
             
s = 0
             
for x in range(K+1):
  for y in range(min(K+1,S-x+1)):
    if 0<=S-x - y <= K:
      s+=1
                     
print(s)
### BUGGY CODE ###

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

b = []
for i in range(n):
    b.append(str(l[i]))
    b.reverse()

print(' '.join(b))

### FIXED CODE ###

from collections import deque

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

b = deque()
for i in range(n):
    if (n % 2 == 0 and (i+1) % 2 == 0) or (n % 2 != 0 and (i+1) % 2 != 0):
        b.appendleft(l[i])
    else:
        b.append(l[i])

print(' '.join(map(str, b)))
### BUGGY CODE ###

D = 60

N, K = map(int, input().split())
to = [[None] * N for _ in range(D)]
to[0] = list(map(lambda x: int(x)-1, input().split()))

for i in range(D-1):
    for j in range(N):
        to[i+1][j] = to[i][to[i][j]]

v = 0
for i in range(D, -1, -1):
    hops = 1 << i
    if K >= hops:
        K -= hops
        v = to[i][v]

print(v+1)


### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(lambda x: int(x)-1, input().split()))

town = 0
visited = [town]
index = 0
visited_index = {town: index}
loop = None
while K > 0:
    K -= 1
    town = A[town]
    if town in visited_index:
        loop = visited[visited_index[town]:]
        break
    visited.append(town)
    index += 1
    visited_index[town] = index

if loop:
    K %= len(loop)
    print(loop[K]+1)
else:
    print(town+1)
### BUGGY CODE ###

mod = 10**9+7
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(60):
    cnt = 0
    for j in range(N):
        cnt += (A[j]>>i)&1
    ans = (ans+(((N-cnt)*cnt)%mod)*2**i)%mod
print(ans)

### FIXED CODE ###

mod = 10**9+7
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(60):
    cnt = 0
    for j in range(N):
        cnt += (A[j]>>i)&1
    ans = (ans+(((N-cnt)*cnt)%mod)*2**i)%mod
print(ans)
### BUGGY CODE ###

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

hs += [0]*k

dp = [float('inf')]*(n+k)

dp[0] = 0

for i in range(n):
  for j in range(k+1):
    dp[i+j] = min(dp[i+j], dp[i]+abs(hs[i]-hs[i+j]))
print(dp[n-1])


### FIXED CODE ###

n, k = map(int, input().split())
hs = list(map(int, input().split()))
 
dp = [0]*n
 
for i in range(1, n):
  first = max(0, i-k)
  dp[i] = min([d + abs(hs[i]-h) for d, h in zip(dp[first:i], hs[first:i])])
print(dp[-1])
### BUGGY CODE ###

a,b,k = map(int,input().split())
ans = set()
n = [i for i in range(a,b+1)]
[ans.add(i) for i in n[:k]]
[ans.add(i) for i in n[-k:]]
ans = list(ans)
ans.sort()
[print(a) for a in ans]

### FIXED CODE ###

a,b,k = map(int,input().split())
k -= 1
aa = min(a+k,b)
bb = max(b-k,a)
if aa < bb:
	[print(i) for i in range(a,aa+1)]
	[print(i) for i in range(bb,b+1)]
else:
	[print(i) for i in range(a,b+1)]
### BUGGY CODE ###

N, W = map(int, input().split())
dp = [[0]*(W+1) for _ in range(N+1)]
for j in range(1, N+1):
        w, v = map(int, input().split())
        for k in range(1, W+1):
                if k < w:
                        dp[j][k] = dp[j-1][k]
                else:
                        dp[j][k] = max(dp[j-1][k-w]+v, dp[j-1][k])
print(dp[N][W])

### FIXED CODE ###

N, W = map(int, input().split())
val = [0]*(W+1)
for i in range(N):
  w, v = map(int, input().split())
  for j in reversed(range(w,W+1)):
    val[j] = max(val[j], val[j-w] + v) 
print(val[W])
### BUGGY CODE ###

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


lis = [1 for i in range(n)]

dic = {}
for i in range(n):
    if not s[i] in dic:
        dic[s[i]] = [i]
    else:
        dic[s[i]].append(i)

for i in range(q):
    t,d = input().split()
    if t in dic:
        for num in dic[t]:
            if d == "L":
                if num != 0:
                    lis[num-1] += lis[num]
                    lis[num] = 0
                else:
                    lis[num] = 0
            if d == "R":
                if num != n-1:
                    lis[num+1] += lis[num]
                    lis[num] = 0
                else:
                    lis[num] = 0

print(sum(lis))


### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,q = LI()
    s = S()
    aa = [LS() for _ in range(q)]
    
    li = -1
    ri = n
    for t,d in aa[::-1]:
        if s[li+1] == t and d == 'L':
            li += 1
            if li == n-1:
                return 0
        elif li >= 0 and s[li] == t and d == 'R':
            li -= 1
        if s[ri-1] == t and d == 'R':
            ri -= 1
            if ri == 0:
                return 0
        elif ri < n and s[ri] == t and d == 'L':
            ri += 1

    r = n - (li + 1) - (n - ri)

    return r


print(main())
### BUGGY CODE ###

import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
B = [0]*Q
C = [0]*Q
num = [0]*100000
s = sum(A)
for i in range(Q):
    B[i], C[i] = map(int,input().split())
for i in range(max(A)):
    num[i] = A.count(i+1)
for i in range(Q):
    s += (C[i]-B[i])*num[B[i]-1]
    print(s)
    num[C[i]-1] += num[B[i]-1]
    num[B[i]-1] = 0

### FIXED CODE ###

import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
cnt = [0]*100005
s = sum(A)
for i in A:
    cnt[i] += 1
for i in range(Q):
    B, C = map(int,input().split())
    s += (C-B)*cnt[B]
    print(s)
    cnt[C] += cnt[B]
    cnt[B] = 0
### BUGGY CODE ###

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

b = 0
for i in range(N):
    if S[N-i-1] == '#':
        b += (2**i)

print(min(bin((2**i-1)^b).count("1") for i in range(N+1)))


### FIXED CODE ###

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

w = [0] * N
b = [0] * N

if S[0] == '#':
    w[0] = 1
for i in range(1, N):
    if S[i] == '#':
        w[i] = w[i-1] + 1
    else:
        w[i] = w[i-1]

if S[N-1] == '.':
    b[N-1] = 1
for i in range(N-2, -1, -1):
    if S[i] == '.':
        b[i] = b[i+1] + 1
    else:
        b[i] = b[i+1]

m = min(b[0], w[N-1])
for n in range(N-1):
    v = w[n] + b[n+1]
    if v < m:
        m = v
print(m)
### BUGGY CODE ###

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

flag = 1
if n % 2 == 1 :
    for i in range(0,n,2):
        if i == 0 :
            if x.count(i) !=1:
                flag = 0
                break
        elif x.count(i) != 2:
            flag = 0
            break
else:
    for i in range(1,n,2):
        if x.count(i) != 2:
            flag = 0
            break
            
if flag == 1:
    ans = 1
    if n >=2:
        for i in range(n // 2 ):
            ans = (ans * 2) % (10 ** 9 + 7)
        
    print(2 ** ((n) // 2 ))
else:
    print(0)
    

### FIXED CODE ###

n = int(input())
x = list(sorted(list(map(int,input().split()))))

flag = 1
if n % 2 == 1 :
    for i in range(0,n):
        if i == 0 :
            co = 0
            if x[i] == 0:
                x[i] = -1

        elif i != 0 and i <= n-2 and (i) % 2 ==1 :
            if x[i] == i+1 and x[i+1] == i+ 1 and (i+1) % 2 == 0:
                x[i] = -1
                x[i+1] = -1
        else:
            continue
else:
    for i in range(0,n):  
        if x[i] == i+1 and x[i+1] == i+ 1 and (i+1) % 2 == 1 and i <= n-2:
            x[i] = -1
            x[i+1] = -1
        else:
            continue
            
if list(set(x)) == [-1]:
    ans = 1
    if n >=2:
        for i in range(n // 2 ):
            ans = (ans * 2) % (10 ** 9 + 7)
        
    print(ans)
else:
    print(0)
### BUGGY CODE ###

import sys
N=int(sys.stdin.readline())
A=list(map(int,sys.stdin.readline().split()))
count=[0]*N
def f(K,L):
  B = L[0:K]+L[K+1:] #popを使うとなぜか元のAまで変化してしまう
  C=list(set(B))
  d = [0]*len(C)
  x=0
  for i in range(len(C)):
    d[i] = int((B.count(C[i]))*(B.count(C[i])-1)/2)
    x += d[i]
  return x

for k in range(N):
  count[k]=f(k,A)

for i in count:
  print(i)

### FIXED CODE ###

import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)
### BUGGY CODE ###

import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
ans = int(0)
S = str(input())
N = len(S)
M = 13
#c = [0]*(N)
#for i in range(N):
#    c[i] = (10**i)%M
#    c[i] = pow(10,i,M)
#print(c)
#c.reverse()
#print(c)
"""
dp = [[0]*M for _ in range(N+1)]
i = int(0)
for j in range(M):
    dp[0][j] = 1
for s in S:
    if s == "?":
        for l in range(10):
            m = l * c[i] % M
            dp[i+1][(M - m) % M] += dp[i][j]
    else:
        m = int(s) * c[i] % M
        dp[i][(M - m) % M] +=dp[i][j]
    i +=1
"""
dp = [[0]*M for _ in range(N)]
c = (10**(N-1))%M
if S[0] == "?":
    for l in range(10):
        dp[0][l*c%M] += 1
else:
    m = int(S[0]) * c%M
    dp[0][m] = 1
S = S[1:]
i = int(1)
for s in S:
    c = (10 ** (N - 1-i)) % M
    if s == "?":
        for j in range(13):
            for l in range(10):
                dp[i][j] += dp[i-1][(j-l*c)%13]
    else:
        for j in range(13):
            dp[i][j] = dp[i-1][(j-int(s)*c)%13]
    i +=1

"""
dp = [[0]*M for _ in range(N)]
if S[0] == "?":
    for l in range(10):
        m = l * c[0]%M
        dp[0][m] += 1
else:
    m = int(S[0]) * c[0]%M
    dp[0][m] = 1

for i in range(1,N):
    if S[i] == "?":
        for j in range(M):
            for l in range(10):
                m = l*c[i]%M
                dp[i][j] += dp[i-1][(M+j-m)%M]
    else:
        for j in range(M):
            m = int(S[i])*c[i]%M
            dp[i][j] = dp[i-1][(M+j-m)%M]
"""
#print(dp)
print(dp[-1][5]%mod)


### FIXED CODE ###

import sys
 
 
def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    s = str(input().rstrip('\n'))
    ls = [[0] * 13 for _ in range(len(s))]
    for i in range(len(s)):
        if i == 0:
            if s[-i-1] == "?":
                for j in range(10):
                    ls[i][j] += 1
            else:
                ls[i][int(s[-i-1])] += 1
        else:
            mult = pow(10, i, 13)
            if s[-i-1] == "?":
                for j in range(13):
                    for k in range(10):
                        ls[i][(k * mult + j) % 13] += ls[i-1][j]
            else:
                st = int(s[-i-1])
                for j in range(13):
                    ls[i][(st * mult + j) % 13] += ls[i-1][j]
        for j in range(13):
            ls[i][j] = ls[i][j] % mod
    print(ls[-1][5])
 
 
if __name__ == '__main__':
    solve()
### BUGGY CODE ###

import numpy as np

N = int(input())
A = []
B = []
for i in range(N):
    a,b = map(int, input().split())
    A.append(a)
    B.append(b)

A = [A[i] for i in np.argsort(B)]
B = np.sort(B)

if all(sum(A[0:i+1]) <= B[i] for i in range(N)):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import bisect

N = int(input())

L = []
for i in range(N):
    a,b = map(int, input().split())
    L.append([b,a])
L.sort()

Sum = 0

for i in range(N):
    Sum = Sum + L[i][1]
    if Sum <= L[i][0]:
        continue
    else:
        print("No")
        quit()
print("Yes")
### BUGGY CODE ###

n = int(input())

L = []
for i in range(n):
    tmp = int(input())
    if tmp in L:
        L = [i for i in L if i != tmp]
    else:
        L.append(tmp)

print(len(L))   

### FIXED CODE ###

n = int(input())

L = set([])

for i in range(n):
    tmp = int(input())
    if tmp in L:
        L.remove(tmp)
    else:
        L.add(tmp)

print(len(L))
### BUGGY CODE ###

'''
        2 A1 = M_1 + M_2
        2 A2 = M_2 + M_3
        2 A3 = M_3 + M_4
        2 A4 = M_4 + M_5
        2 A5 = M_5 + M_1
A1 + A2 + A3 = M_1 + M_2 + M_3

M_1 = (A1 + A2 + A3) - (M_2 + M_3 + M_4 + M_5)
M_2 = (A1 + A2 + A3) - (M_3 + M_4 + M_5 + M_6)
M_3 = (A1 + A2 + A3) - (M_4 + M_5 + M_6 + M_7)
'''

n    = int(input())
ai   = list(map(int, input().split()))
aix2 = list(map(lambda x: x * 2, ai))

sum_a = sum(ai)

def ring_get(xs, s, e, mod):
    ys = []
    i  = s % mod

    while i != (e % mod):
        ys.append(xs[i])
        i = (i + 2) % mod

    return ys

for i in range(1, n):
    print(sum_a - sum(ring_get(aix2, i, i + (n - 1), n)))

print(sum_a - sum(ring_get(aix2, 0, 0 + (n - 1), n)))

### FIXED CODE ###

'''
        2 A1 = M_1 + M_2
        2 A2 = M_2 + M_3
        2 A3 = M_3 + M_4
        2 A4 = M_4 + M_5
        2 A5 = M_5 + M_1
A1 + A2 + A3 = M_1 + M_2 + M_3

M_1 = (A1 + A2 + A3) - (M_2 + M_3 + M_4 + M_5)
M_2 = (A1 + A2 + A3) - (M_3 + M_4 + M_5 + M_6)
M_3 = (A1 + A2 + A3) - (M_4 + M_5 + M_6 + M_7)
'''

n    = int(input())
ai   = list(map(int, input().split()))
aix2 = list(map(lambda x: x * 2, ai))

sum_a = sum(ai)

def ring_get(xs, s, e, mod):
    ys = []
    i  = s % mod

    while i != (e % mod):
        ys.append(xs[i])
        i = (i + 2) % mod

    return ys

beforeM = sum_a - sum(ring_get(aix2, 1, 1 + (n - 1), n))

print(beforeM)

for i in range(1, n):
    print(aix2[i - 1] - beforeM)
    beforeM = aix2[i - 1] - beforeM
### BUGGY CODE ###

import itertools
import math

n, k = map(int, input().split())
alist = sorted(list(map(int, input().split())))
alist_rev = alist[::-1]
divide = 10**9 + 7

def comb(n, k):
    return math.factorial(n) // (math.factorial(n-k) * math.factorial(k))



amax = 0
i = n-1
while i >= k-1:
    amax += alist[i] * comb(i, k-1)
    i -= 1

amin = 0
i = 0
while i <= n-k:
    amin += alist[i] * comb(n-i-1, k-1)
    i += 1

print((amax - amin) % divide)

### FIXED CODE ###

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

def comb(n, r, p=mod):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
p = mod
N = n
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)

amax = 0
amin = 0
i = 0
while i <= n-k:
    cnt = comb(n-i-1, k-1)
    amax += (alist[n-i-1] * cnt)%mod
    amin += (alist[i] * cnt)%mod
    i += 1

print((amax - amin) % mod)
### BUGGY CODE ###

from collections import deque
import copy
 
def main():
  H, W = map(int, input().split())
  M = [['#' == x for x in input()] for _ in range(H)]
  que = deque([[i, j] for i in range(H) for j in range(W) if M[i][j]])
  ans = 0
  while True:
    qq = deque()
    ans += 1
    while que:
      nh, nw = que.popleft()
      if nw+1<=W-1 and not M[nh][nw+1]:
        qq.append([nh,nw+1])
        M[nh][nw+1] = True
      if  0<=nw-1 and not M[nh][nw-1]:
        qq.append([nh,nw-1])
        M[nh][nw-1] = True
      if nh+1<=H-1 and not M[nh+1][nw]:
        qq.append([nh+1,nw])
        M[nh+1][nw] = True
      if 0<=nh-1 and not M[nh-1][nw]:
        qq.append([nh-1,nw])
        M[nh-1][nw] = True
    if qq:
      que = copy.copy(qq)
    else:
      break
  print(ans-1)
  
if __name__ == "__main__":
  main()

### FIXED CODE ###

import copy
from collections import deque
def main():
  H, W = map(int, input().split())
  G = [['#' == x for x in input()] for _ in range(H)]
 
  black = deque([(i, j) for i in range(H) for j in range(W) if G[i][j]])
 
  ans = 0
  while True:
    ans += 1
    next_black = deque()
    while black:
      bi, bj = black.popleft()
      if bi > 0 and not G[bi - 1][bj]:
        G[bi - 1][bj] = True
        next_black.append((bi - 1, bj))
      if bj > 0 and not G[bi][bj - 1]:
        G[bi][bj - 1] = True
        next_black.append((bi, bj - 1))
      if bi < H - 1 and not G[bi + 1][bj]:
        G[bi + 1][bj] = True
        next_black.append((bi + 1, bj))
      if bj < W - 1 and not G[bi][bj + 1]:
        G[bi][bj + 1] = True
        next_black.append((bi, bj + 1))
    if next_black:
       black = copy.copy(next_black)
    else:
       break
  print(ans - 1)
  
if __name__ == "__main__":
  main()
### BUGGY CODE ###

n=int(input())
count=0
li=[0 for i in range(n)]
for i in range(n):
    a=int(input())
    li[i]=a
li.sort()
while len(li)!=0:
    x=li.count(li[0])
    if x%2==1:
        count+=1
    li=li[x:]
print(count)

### FIXED CODE ###

n=int(input())
count=0
li=[0 for i in range(n)]
for i in range(n):
    a=int(input())
    li[i]=a
li.sort()
i=0
x=1
while i<n-1:
    if li[i]==li[i+1]:
        x+=1
        if i+2==n-1:
            count+=1
    else:
        x=1
        if i+1==n-1:
            count+=1
    if x%2==1:
        count+=1
    i+=x
    x=1
print(count)
### BUGGY CODE ###

n,p = map(int,input().split())
s = list(map(int,(list(input()))))

def keychange(dic,x):
    newdic = {}
    for k in dic:
        b = (k*10 + x) % p
        newdic[b] = dic[k]
    return newdic
dic = {}
count = 0
for i in range(n):
    x = s[i] % p
    dic = keychange(dic,x)
    if x in dic:
        dic[x] += 1
    else:
        dic[x] = 1
    if 0 in dic:
        count += dic[0]
print(count)

### FIXED CODE ###

n,p = map(int,input().split())
s = list(map(int,(list(input()))))
def keychange(dic,x):
    newdic = {}
    for k in dic:
        b = (k*10 + x) % p
        newdic[b] = dic[k]
    return newdic
count = 0
if p == 2:
    for i in range(n):
        if s[i] % 2 == 0:
            count += i+1
    print(count)
    exit()
if p == 5:
    for i in range(n):
        if s[i] % 5 == 0:
            count += i+1
    print(count)
    exit()
inv_t = [0]+[1]
for i in range(2,p):
  inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
dic = {}
memory = [1,0]
for i in range(n):
    x = s[i] % p
    memory[0] = 10*memory[0] % p
    memory[1] = (10*memory[1] + x) % p
    xinv = inv_t[memory[0]]*(x-memory[1]+p) % p
    if xinv in dic:
        dic[xinv] += 1
    else:
        dic[xinv] = 1
    zeroinv = (p-memory[1])*inv_t[memory[0]] % p
    if zeroinv in dic:
        count += dic[zeroinv]
print(count)
### BUGGY CODE ###

import sys
import unittest
import random

T = 26


def solve(d, c, s):
    best = [0] * d
    last = [-1]*T

    for i in range(d):
        max_v = -float('inf')
        for j in range(T):
            v = s[i][j] + c[j] * (i - last[j])
            if max_v < v:
                max_v = v
                best[i] = j
        last[best[i]] = i

    score = get_score(d, c, s, best)
    for i in range(1900):
        a = random.randint(0, d-1)
        b = random.randint(0, T-1)
        old = best[a]
        best[a] = b
        t_score = get_score(d, c, s, best)
        if t_score > score:
            score = t_score
        else:
            best[a] = old
    return best


def get_score(d, c, s, t):
    last = [-1]*T
    total = 0
    for i in range(d):
        total += s[i][t[i]]
        last[t[i]] = i
        for j in range(T):
            total -= c[j] * (i - last[j])
    return total


def main():
    d = int(input())
    c = list(map(int, input().split()))
    s = [list(map(int, input().split())) for i in range(d)]
    t = solve(d, c, s)
    print(get_score(d, c, s, t), file=sys.stderr)
    for i in range(d):
        print(t[i]+1)


if __name__ == "__main__":
    main()


class Test(unittest.TestCase):
    def test_score(self):
        pass


### FIXED CODE ###

def solve(d, c, s):
    return [1]*d


def main():
    d = int(input())
    c = list(map(int, input().split()))
    s = [list(map(int, input().split())) for i in range(d)]
    answer = solve(d, c, s)
    print(*answer, sep='\n')


if __name__ == "__main__":
    main()