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

S=input()
l=len(S)
c=0
for i in range(l+1):
  a=0
  b=0
  for j in range(i-1,-1,-1):
    if S[j]=='<':
      a+=1
    else:
      break
  for k in range(i,l):
    if S[k]=='>':
      b+=1
    else:
      break
  c+=max(a,b)
print(c)

### FIXED CODE ###

S=input()
l=len(S)
A=[0]*(l+1)
B=[0]*(l+1)
for i in range(l):
  if S[i]=='<':
    A[i+1]=A[i]+1
  if S[l-i-1]=='>':
    B[l-i-1]=B[l-i]+1
print(sum([max(a,b) for a,b in zip(A,B)]))
### BUGGY CODE ###

n=int(input())
c=[]
for i in range(n):
    a=int(input())
    if a not in c:
        c.append(a)
    else:
        c.remove(a)
print(len(c))

### FIXED CODE ###

n=int(input())
a=[int(input()) for i in range(n)]
a.append(1000000001)
a.append(0)
a.sort()
c=0
ans=0
s=0
#print(a)
for i in range(1,n+2):
    if a[i]==c:
        s+=1
    else:
        ans+=(s%2)
        c=a[i]
        s=1
    #print(s)
print(ans)
### BUGGY CODE ###

N = int(input())
a = list(map(int, input().split()))
b = 1

for i in range(N):
  b *= a[i]
  if b==0:
    break

if b>10**(18):
  print('-1')
else:
  print(b)

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
b = 1

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

for i in range(N):
  b *= a[i]
  if b>10**(18):
    print('-1')
    exit()

print(b)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string, copy
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7
ans = count = 0; pro = 1

d,g=map(int,input().split());g//=100
D=collections.defaultdict(lambda: inf )
D[0]=0
for i in range(1,d+1):
    p,c=map(int,input().split());c//=100
    # for key, value in tuple(D.items()):
    #     print(D[key],p)
    #     D[key+i*p+c//100] = min(D[key+i*p+c//100], D[key]+p)
    S=D.copy()
    for key,value in S.items():
        for k in range(1,p):    
        # print(D[key+i])
            D[key+i*k] = min(D[key+i*k],S[key]+k)
        D[key+i*p+c] = min(D[key+i*p+c],S[key]+p)
ans=inf
for key,value in D.items():
    # print(key,value)
    if key>=g:
        ans=min(ans,value)
print(ans)
        


### FIXED CODE ###

#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string, copy
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7
ans = count = 0; pro = 1

d,g=map(int,input().split());g//=100
D=collections.defaultdict(lambda: inf )
D[0]=0
for i in range(1,d+1):
    p,c=map(int,input().split());c//=100
    # for key, value in tuple(D.items()):
    #     print(D[key],p)
    #     D[key+i*p+c//100] = min(D[key+i*p+c//100], D[key]+p)
    S=D.copy()
    for key,value in S.items():
        for k in range(1,p):    
        # print(D[key+i])
            D[key+i*k] = min(D[key+i*k],S[key]+k)
        D[key+i*p+c] = min(D[key+i*p+c],S[key]+p)
ans=inf
for key,value in D.items():
    # print(key,value)
    if key>=g:
        ans=min(ans,value)
print(ans)
### BUGGY CODE ###

from sys import stdin
def main():
    readline = stdin.readline
    N = int(input())
    A = list(map(int, readline().split()))
    
    for i in range(1, N+1):
        print(A.count(i))
        
main()


### FIXED CODE ###

from sys import stdin
import collections

def main():
    readline = stdin.readline
    N = int(input())
    A = list(map(int, readline().split()))
    listN = list(range(1, N+1))    
    c = collections.Counter(A)
    
    for i in listN:
        print(c[i])
main()
### BUGGY CODE ###

N, M = map(int, input().split())
adjacent = []
score = ['None' for i in range(N)]
score[0] = 0
for i in range(M):
    a, b, c = map(int, input().split())
    adjacent.append([a-1, b-1, c])
for i in range(2*N):
    for j in adjacent:
      if score[j[1]] == 'None' and score[j[0]] != 'None':
        score[j[1]] = score[j[0]] + j[2]
      if score[j[1]] != 'None' and score[j[0]] != 'None':
        if score[j[1]] < score[j[0]] + j[2]:
          score[j[1]] = score[j[0]] + j[2]
    if i == N-2:
      t = score[N-1]
    if i == 2*N-1:
      if t != score[N-1]:
        score[N-1] = 1e+15
if score[N-1] < 1e+15:
    print(t)
else:
    print('inf')

### FIXED CODE ###

N, M = map(int, input().split())
adjacent = []
score = ['None' for i in range(N)]
score[0] = 0
for i in range(M):
    a, b, c = map(int, input().split())
    adjacent.append([a-1, b-1, c])
for i in range(N):
    for j in adjacent:
      if score[j[1]] == 'None' and score[j[0]] != 'None':
        score[j[1]] = score[j[0]] + j[2]
      if score[j[1]] != 'None' and score[j[0]] != 'None':
        if score[j[1]] < score[j[0]] + j[2]:
          score[j[1]] = score[j[0]] + j[2]
    if i == N-2:
      t = score[N-1]
    if i == N-1:
      if t != score[N-1]:
        score[N-1] = 1e+15
if score[N-1] < 1e+15:
    print(t)
else:
    print('inf')
### BUGGY CODE ###

n=int(input())
s=[]
for i in range(n):
    x=list(input())
    x=sorted(x)
    s.append("".join(x))
s=sorted(s)

l=list(set(s))

ans=[]
for i in range(len(l)):
    ans.append(s.count(l[i]))
m=0
for i in range(len(l)):
    j=ans[i]
    m+=j*(j-1)//2
print(m)

    
               


### FIXED CODE ###

n=int(input())
s=[]
for i in range(n):
    x=list(input())
    x=sorted(x)
    s.append("".join(x))
s=sorted(s)
m=1
ans=0
for i in range(n-1):
    if s[i]==s[i+1]:
        m+=1
    else:
        ans+=m*(m-1)//2
        m=1
ans+=m*(m-1)//2
print(ans)
### BUGGY CODE ###

n,a,b=map(int,input().split())
binary=(format(n,"b"))#二進数に変換
templi=[binary[i] for i in range(len(str(binary)))]
templi.reverse()
res=2
beki=1
for i in range(0,len(templi)):
    if templi[i]=="1":
        beki*=res
    else:
        beki*=1
    res=res**2
firs=beki-1
#conbination_algorithm
def kaijo(k):
    sum=1
    for j in range(1,k+1):
        sum*=j
    return sum
def comb(n,k):
    ans=int(kaijo(n))/(int(kaijo(k))*int(kaijo(n-k)))
    return int(ans)
#subtract
sub_1=comb(n,a)+comb(n,b)
print((firs-sub_1)%(10**9+7))

### FIXED CODE ###

n, a, b = map(int, input().split())
mod = 10**9+7
def comb(n, r, mod):
    if r == 0 or r == n:
        return 1
    r = min([r, n-r])
    x, y = 1, 1
    for i in range(1, r+1):
        x *= n+1-i
        x %= mod
        y *= i
        y %= mod
    return x*pow(y, mod-2, mod)%mod

ans = (pow(2, n, mod)-1-comb(n, a, mod)-comb(n, b, mod))%mod
print(ans)
### BUGGY CODE ###

def judge(n):
    if n < 2:
        return False
    if n == 2 or n == 3 or n == 5 or n == 7 or n == 11 or n == 13 or n == 17:
        return True
    if n % 2 == 0 or n % 3 == 0 or n % 5 == 0 or n % 7 == 0 or n % 11 == 0 or n % 13 == 0 or n % 17 == 0:
        return False
    i = 19
    while i < n:
        if n % i == 0:
            return False
        i += 1
    return True


N = int(input())
count = 0
for i in range(N):
    if (judge(int(input())) == True):
        count += 1

print(count)

### FIXED CODE ###

import math


def judge(n):
    if n < 2:
        return False
    i = 2
    while i <= math.sqrt(n):
        if n % i == 0:
            return False
        i += 1
    return True


count = 0
n = int(input())
for i in range(n):
    if judge(int(input())):
        count += 1
print(count)
### BUGGY CODE ###

N, M = [int(_) for _ in input().split()]
bridge = [[int(_) for _ in input().split()] for _ in range(M)]

bridge.reverse()


islands_group = []
inconvenience = N * (N - 1) // 2
inconvenience_history = [inconvenience]

for bridge_built in bridge:
    A_i, B_i = bridge_built

    for islands in islands_group:
        if A_i in islands:
            islands_of_A = islands
            break
    else:
        islands_of_A = {A_i}
        islands_group.append(islands_of_A)

    for islands in islands_group:
        if B_i in islands:
            islands_of_B = islands
            break
    else:
        islands_of_B = {B_i}
        islands_group.append(islands_of_B)

    if islands_of_A == islands_of_B:
        inconvenience_history.append(inconvenience)
        continue
    else:
        improvement = len(islands_of_A) * len(islands_of_B)
        inconvenience -= improvement
        if inconvenience == 0:
            inconvenience_history += [0] * (M - len(inconvenience_history))
            break
        inconvenience_history.append(inconvenience)
        islands_group.remove(islands_of_A)
        islands_group.remove(islands_of_B)
        islands_group.append(islands_of_A | islands_of_B)

inconvenience_history.reverse()

for inc in inconvenience_history:
    print(inc)

### FIXED CODE ###

N, M = [int(_) for _ in input().split()]
bridge = [[int(_) for _ in input().split()] for _ in range(M)]

bridge.reverse()
bridge = bridge[:-1]

inconvenience = N * (N - 1) // 2
inconvenience_history = [inconvenience]


class UnionFind:
    def __init__(self, N):
        self.par = [i for i in range(N + 1)]
        self.rank = [0] * (N + 1)
        self._number = [1] * (N + 1)

    def root(self, i):
        if self.par[i] == i:
            return i
        self.par[i] = self.root(self.par[i])
        return self.par[i]

    def tree_rank(self, i):
        return self.rank[self.root(i)]

    def number(self, i):
        return self._number[self.root(i)]

    def union(self, i, j):
        _root_i = self.root(i)
        _root_j = self.root(j)
        if _root_i == _root_j:
            return
        else:
            if self.tree_rank(i) < self.tree_rank(j):
                self.par[_root_i] = _root_j
                self._number[_root_j] += self._number[_root_i]
            else:
                self.par[_root_j] = _root_i
                self._number[_root_i] += self._number[_root_j]
                if self.tree_rank(i) == self.tree_rank(j):
                    self.rank[_root_i] += 1


islands = UnionFind(N)

for A_i, B_i in bridge:

    root_A = islands.root(A_i)
    root_B = islands.root(B_i)

    if root_A == root_B:
        inconvenience_history.append(inconvenience)
        continue
    else:
        improvement = islands.number(A_i) * islands.number(B_i)
        islands.union(A_i, B_i)

        inconvenience -= improvement
        if inconvenience == 0:
            inconvenience_history += [0] * (M - len(inconvenience_history))
            break
        inconvenience_history.append(inconvenience)

print(*inconvenience_history[::-1], sep='\n')
### BUGGY CODE ###

import sys
import numpy as np

input = sys.stdin.readline

N,K = map(int, input().split())
h = [int(i) for i in input().split()]
dp = [float('inf')] * N
h = np.array(h)

dp[0] = 0
for i in range(1, N):
  tmp = i
  if tmp > K:
    tmp = K
  for j in range(1,tmp + 1):
      dp[i] = min(dp[i], dp[i - j] + abs(h[i - j] - h[i]))

print(dp[N-1])


### FIXED CODE ###

N,K = map(int, input().split())
h = list(map(int, input().split()))
dp = [float('inf')] * 10 ** 5

dp[0] = 0
for i in range(1, N):
  tmp = i
  if tmp > K:
    tmp = K
  for j in range(1,tmp + 1):
      dp[i] = min(dp[i], dp[i - j] + abs(h[i - j] - h[i]))

print(dp[N-1])
### BUGGY CODE ###

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

ans = 1
for i in a:
    ans *= i
    
if ans <= 1000000000000000000:
    print(ans)
else:
    print(-1)

### FIXED CODE ###

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

if 0 in a:
    print(0)
    sys.exit()
    
ans = 1
for i in a:
    ans *= i
    if ans > 10**18:
        print(-1)
        sys.exit()
print(ans)
### BUGGY CODE ###

import numpy as np
from sys import stdin

N, S = map(int, stdin.readline().split())
A = list(map(int,stdin.readline().split()))
M = 998244353
V = max(max(A), S)

ans = 0
cs = np.zeros((V + 1,), dtype=np.int32)
for i, a in enumerate(A):
    dp = np.zeros((V + 1,), dtype=np.int32)
    dp[a] = i + 1
    for s in range(a + 1, S + 1):
        dp[s] = cs[s - a] % M
    cs = (cs + dp) % M
    ans = (ans + (N - i) * dp[S]) % M
print(ans)

### FIXED CODE ###

from sys import stdin

N, S = map(int, stdin.readline().split())
A = list(map(int,stdin.readline().split()))
M = 998244353
V = max(max(A), S)

ans = 0
cs = [0 for _ in range(V + 1)]
for i, a in enumerate(A):
    dp = [0 for _ in range(V + 1)]
    dp[a] = i + 1
    for s in range(a + 1, S + 1):
        dp[s] = cs[s - a]
    cs = [(a + b) % M for a, b in zip(cs, dp)]
    ans = (ans + (N - i) * dp[S]) % M
print(ans)
### BUGGY CODE ###

k, s = map(int, input().split())
res = 0
for a in range(k + 1):
  for b in range(k + 1):
    for c in range(k + 1):
      if a + b + c == s:
        res += 1
        break
        
print(res)

### FIXED CODE ###

k, s = map(int, input().split())
res = 0
for a in range(k + 1):
  for b in range(k + 1):
    z = s - a - b
    if z >= 0 and z <= k:
        res += 1
        
print(res)
### BUGGY CODE ###

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

dp = [0] * n

for i in range(1, n):
    s = max(i-k, 0)
    dp[i] = min(dp[j] + abs(h[i]-h[j]) for j in range(s, i))

print(dp[-1])

### FIXED CODE ###

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

dp = [0] * n

for i in range(1, n):
  s = max(i-k, 0)
  dp[i] = min(dp[j] + abs(h[j]-h[i]) for j in range(s, i))

print(dp[n-1])
### BUGGY CODE ###

from collections import deque
def dfs(i,j):
    q = deque()
    q.append((i, j, 0))

    d = [(1, 0), (0, 1), (-1, 0), (0, -1)]
    cnt = 1

    while q:
        x, y, num = q.pop()
        if num == 0:
            for i in range(1,5):
                dx, dy = d[i-1]
                nx = x + dx
                ny = y + dy
                if not(0 <= nx < h and 0 <= ny < w):continue
                if s[nx][ny] == '#':continue
                q.append((nx, ny, i))
                cnt += 1

        else:
            nx = x + d[num-1][0]
            ny = y + d[num-1][1]
            if not(0 <= nx < h and 0 <= ny < w):continue
            if s[nx][ny] == '#':continue
            q.append((nx, ny, num))
            cnt += 1

    return cnt

h,w = map(int, input().split())
s = [list(input()) for i in range(h)]

ans = 0
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':continue
        temp = dfs(i, j)
        #print(temp,(i,j))
        if temp > ans:ans = temp
print(ans)

### FIXED CODE ###

h, w = map(int,input().split())
s = [list(input()) for i in range(h)]

L = [[0] * w for i in range(h)]
R = [[0] * w for i in range(h)]
D = [[0] * w for i in range(h)]
U = [[0] * w for i in range(h)]
for i in range(h):
    for j in range(w):
        if j == 0:
            if s[i][j] == '.':
                L[i][j] = 1
            if s[i][- (j + 1)] =='.':
                R[i][- (j + 1)] = 1

        if j != 0:
            if s[i][j] == '.':
                L[i][j] = L[i][j - 1] + 1
            if s[i][- (j + 1)] == '.':
                R[i][- (j + 1)] = R[i][- (j + 1) + 1] + 1

        if i == 0:
            if s[i][j] == '.':
                U[i][j] = 1
            if s[- (i + 1)][j] == '.':
                D[- (i + 1)][j] = 1
        if i != 0:
            if s[i][j] == '.':
                U[i][j] = U[i - 1][j] + 1
            if s[- (i + 1)][j] == '.':
                D[- (i + 1)][j] = D[- (i + 1) + 1][j] + 1
ans = 0
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':continue
        temp = R[i][j] + L[i][j] + D[i][j] + U[i][j] -3
        if ans < temp:ans = temp
        #print(temp)
print(ans)
### BUGGY CODE ###

def management():
    N=int(input())
    static_list=list(map(int,input().split()))
    result_list=[]
    for i in range(0,N):
        result_list.append(0)
    for i in range(0,len(static_list)):
        for j in range(0,N):
            if static_list[i]==j+1:
                result_list[j]=result_list[j]+1
    for i in range(0,N):
        print(result_list[i])


if __name__=="__main__":
    management()


### FIXED CODE ###

N = int(input())
a = list(map(int, input().split(' ')))
b = [0 for i in range(N)]
for i in a:
    b[i-1] += 1
for i in b:
    print(i)
### BUGGY CODE ###

import sys

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline


def searchPrimeNumber(N):
    N = N + 1
    is_prime = np.ones((N,), dtype=bool)
    is_prime[:2] = 0
    N_max = int(np.sqrt(N))
    for j in range(2, N_max+1):
        if (is_prime[j]):
            is_prime[j*j::j] = False
    prime = np.arange(N)[is_prime]
    return prime


def main():
    Q = int(readline())
    m = map(int, read().split())
    LR = list(zip(m, m))
    # 事前に10**5までにある2017に似た素数リストを作る
    A = searchPrimeNumber(10**5)

    like_2017 = np.zeros(10**5 + 1, dtype=bool)
    for a in A:
        if (a + 1) / 2 in A:
            like_2017[a] = True

    B = np.arange(10**5+1)[like_2017]
    for l, r in LR:
        C = B[B <= r]
        print(len(C[l <= C]))
        


main()


### FIXED CODE ###

import sys

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline


def searchPrimeNumber(N):
    N = N + 1
    is_prime = np.ones(N, dtype=bool)
    is_prime[:2] = 0
    N_max = int(np.sqrt(N))
    for j in range(2, N_max+1):
        if (is_prime[j]):
            is_prime[j*j::j] = False
    prime = np.arange(N)[is_prime]
    return prime


def main():
    Q = int(readline())
    m = map(int, read().split())
    LR = list(zip(m, m))
    A = searchPrimeNumber(10**5)
    B = np.zeros(10**5+3, dtype=np.int32)  # Bはゼロ始まり
    for a in A:
        if (a + 1) / 2 in A:
            B[a+1:] += 1  # like 2017の数より１つ大きい数から1増やす

    for l, r in LR:
        print(B[r+1] - B[l])


main()
### BUGGY CODE ###

n, k = map(int, raw_input().split(" "))

d = {}
for i in range(n):
    a1, b1 = map(int, raw_input().split(" "))
    if a1 in d.keys():
        d[a1] += b1
    else:
        d[a1] = b1


l = sorted(d.items(), key=lambda x: x[0])
#print (l)
count = 0
for e, item in enumerate(l):
    if k <= count + item[1]:
        print item[0]
        break
    else:
        count += item[1]


### FIXED CODE ###

line_one = raw_input().split()
n = int(line_one[0])
k = int(line_one[1])

l = []
#d = {}
for i in range(n):
    line_one2 = raw_input().split()
    a1 = int(line_one2[0])
    b1 = int(line_one2[1])
    l.append( ( a1, b1 ))
    #if a1 in l:
    #    #d[a1] += b1
    #    l[a1][1] += b1
    #else:
    #    l.append( ( a1, b1 ))
    #    #//d[a1] = b1

#l.sort()
l = sorted(l, key=lambda x: x[0])
count = 0
for item in l:
    count += item[1]
    if k <= count:
        print item[0]
        break
### BUGGY CODE ###

#!/usr/bin/env python
# -*- coding:utf-8 -*-
#from __future__ import print_function
import time
import sys
import io
import re
import math
start = time.clock()
i = 0
ans=[]
#n=int(raw_input())
#for _ in range(n):
for _ in range(int(raw_input())):
#    a=sys.stdin.readline().split()
    a=sys.stdin.readline().strip()
#    chk=a[0]
    chk=a[6]
    if a[0]=='i': ans.insert(0,a[7:])
#    elif chk=='deleteFirst': ans.pop(0)
    elif chk=='F': del ans[0]
#    elif chk=='deleteLast': ans.pop()
    elif chk=='L': del ans[-1]
#    else: ans.remove(str(a[1]))
    else:
#        if a[1] in ans:
        if ans.count(a[7:])>0:
            ans.remove(a[7:])
#print ans
#    print ans
print ' '.join(ans)

### FIXED CODE ###

import sys
import collections
n=int(raw_input())
ans=collections.deque()
while n:
    n-=1
    s=sys.stdin.readline().rstrip().split(' ')
    if s[0][0]=='i':
        ans.appendleft(s[1])
    elif s[0][-3]=='r':
        ans.popleft()
    elif s[0][-3]=='a':
        ans.pop()
    else:
        try:
            ans.remove(s[1])
        except:
            pass
sys.stdout.write(' '.join(ans))
print
### BUGGY CODE ###

from collections import Counter
N = int(input())
A = list(map(int , input().split()))
bb = dict(Counter(A))
for j in A:
    bb[j] -= 1
    pattern_ = []
    for i in bb.values():
        pattern_.append((i*(i-1))//2)
    print(sum(pattern_))
    bb[j] += 1

### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int , input().split()))
bb = dict(Counter(A))
pattern_ = 0
for i in bb.values():
    pattern_ += ((i*(i-1))//2)
for j in A:
    print(pattern_ - ((bb[j]-1)))
### BUGGY CODE ###

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


ans = 2018
if l-n >= 672:
    ans = 0
else:
    ll = l % 2019
    for i in range(ll,ll + n-l +1):
        for j in range(ll,ll + n-l +1):
            if i != j:
                ansss = i*j%2019
                if ansss == 0:
                    ans = 0
                    break
                elif ansss < ans:
                    ans = ansss

print(ans)


### FIXED CODE ###

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

ll = l % 2019
ans = 2018
if l-n >= 672:
    ans = 0
else:
    for i in range(ll,ll + n-l +1):
        if i % 673 == 0:
            ans = 0
            break
        else:
            for j in range(ll,ll + n-l +1):
                if i != j:
                    ansss = i*j%2019
                    if ansss == 0:
                        ans = 0
                        break
                    elif ansss < ans:
                        ans = ansss

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

N=int(input())
a=list(map(int,input().split()))
a.sort()
cnt=0

while len(a)>0:
  item=a[0]
  t=a.count(item)
  #print(item,t,a)
  if t>item:
    cnt+=t-item
  elif t==item:
    pass
  else:
    cnt+=t
  del a[0:t]
  #print("after",a)
  
print(cnt)

### FIXED CODE ###

import collections

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

cnt=0

c=collections.Counter(a)
#print(c)

for item in c:
  t=c[item]
  if t>item:
    cnt+=t-item
  elif t==item:
    pass
  else:
    cnt+=t

#while len(a)>0:
#  item=a[0]
#  t=(item)
#  #print(item,t,a)
#  if t>item:
#    cnt+=t-item
#  elif t==item:
#    pass
#  else:
#    cnt+=t
#  del a[0:t]
#  #print("after",a)
  
print(cnt)
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 1
if n == 2:
  print(max(a))
else:
  a0 = a[0]
  a1 = a[1]
  r = 0
  while True:
    r = a1 % a0
    if r == 0:
      b0 = a0
      break
    elif r > a0:
      a1, a0 = r, a0
    else:
      a1, a0 = a0, r
  a1 = a[1]
  a2 = a[2]
  r = 0
  while True:
    r = a2 % a1
    if r == 0:
      b1 = a1
      break
    elif r > a1:
      a2, a1 = r, a1
    else:
      a2, a1 = a1, r
  a0 = a[0]
  a2 = a[2]
  r = 0
  while True:
    r = a2 % a0
    if r == 0:
      b2 = a0
      break
    elif r > a0:
      a2, a0 = r, a0
    else:
      a2, a0 = a0, r
  max_a = max(b0,b1,b2)
  for j in range(max_a,1,-1):
    c = list(map(lambda x: x % j,a))
    c_ng = [i for i in c if i > 0]
    #print("j=",j,"c=",c,"c_ng=",c_ng)
    if len(c_ng) <= 1:
      ans = j
      break
  print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 1
if n == 2:
  print(max(a))
else:
  a0 = a[0]
  a1 = a[1]
  r = 0
  while True:
    r = a1 % a0
    if r == 0:
      b0 = a0
      break
    elif r > a0:
      a1, a0 = r, a0
    else:
      a1, a0 = a0, r
  a1 = a[1]
  a2 = a[2]
  r = 0
  while True:
    r = a2 % a1
    if r == 0:
      b1 = a1
      break
    elif r > a1:
      a2, a1 = r, a1
    else:
      a2, a1 = a1, r
  a0 = a[0]
  a2 = a[2]
  r = 0
  while True:
    r = a2 % a0
    if r == 0:
      b2 = a0
      break
    elif r > a0:
      a2, a0 = r, a0
    else:
      a2, a0 = a0, r
  max_a = max(b0,b1,b2)
  kouho = []
  for j in range(max_a,1,-1):
    if max_a % j == 0:
      c = list(map(lambda x: x % j,a))
      c_ng = [i for i in c if i > 0]
    #print("j=",j,"c=",c,"c_ng=",c_ng)
      if len(c_ng) <= 1:
        ans = j
        break
  print(ans)
### BUGGY CODE ###

n, q = map(int, input().split())
p = []
t = i = 0
for i in range(n):
    c = input().split()
    c[1] = int(c[1])
    p.append(c)
left = n
while left:
    i = (i+1) % n
    if p[i][1] == 0:
        continue
    if p[i][1] <= q:
        t += p[i][1]
        p[i][1] = 0
        print(p[i][0], t)
        left -= 1
    else:
        p[i][1] -= q
        t += q

### FIXED CODE ###

n, q = map(int, input().split())
p = [input().split() for _ in range(n)]
t = i = 0
while n:
    i = i % n
    if int(p[i][1]) <= q:
        t += int(p[i][1])
        print(p[i][0], t)
        del p[i]
        n -= 1
    else:
        p[i][1] = int(p[i][1]) - q
        t += q
        i += 1