Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10 ** 5)

N, K = [int(v) for v in sys.stdin.readline().split()]
R, S, P = [int(v) for v in sys.stdin.readline().split()]
T = input()

l = [''] * K

for i in range(N):
    l[i % K] += T[i]


def okjudge(rest):
    if len(rest) == 0:
        return 0

    c = rest[0]

    if len(rest) == 1:
        if c == 'r':
            return P
        elif c == 's':
            return R
        else:
            return S
    if rest[1] == rest[0]:
        if c == 'r':
            return max(okjudge(rest[1:]), P + okjudge(rest[2:]))
        elif c == 's':
            return max(okjudge(rest[1:]), R + okjudge(rest[2:]))
        else:
            return max(okjudge(rest[1:]), S + okjudge(rest[2:]))
    elif c == 'r':
        return P + okjudge(rest[1:])
    elif c == 's':
        return R + okjudge(rest[1:])
    else:
        return S + okjudge(rest[1:])

print(sum([okjudge(v) for v in l]))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)

N, K = [int(v) for v in sys.stdin.readline().split()]
R, S, P = [int(v) for v in sys.stdin.readline().split()]
T = input()

l = [''] * K
memo = [{} for _ in range(K)]

for i in range(N):
    l[i % K] += T[i]

def okjudge(m, ss, p):
    if p in memo[m]:
        return memo[m][p]

    lss = len(ss)
    if p == lss:
        ret =  0
        memo[m][p] = ret
        return ret

    c = ss[p]

    if lss - p == 1:
        if c == 'r':
            ret = P
        elif c == 's':
            ret =  R
        else:
            ret =  S
        memo[m][p] = ret
        return ret

    if ss[p + 1] == ss[p]:
        if c == 'r':
            ret =  max(okjudge(m, ss, p + 1), P + okjudge(m, ss, p + 2))
        elif c == 's':
            ret =  max(okjudge(m, ss, p + 1), R + okjudge(m, ss, p + 2))
        else:
            ret =  max(okjudge(m, ss, p + 1), S + okjudge(m, ss, p + 2))
    elif c == 'r':
        ret =  P + okjudge(m, ss, p + 1)
    elif c == 's':
        ret =  R + okjudge(m, ss, p + 1)
    else:
        ret =  S + okjudge(m, ss, p + 1)

    memo[m][p] = ret
    return ret

print(sum([okjudge(mi, v, 0) for mi,v in enumerate(l)]))
N, M = map(int,input().split())
H = list(map(int,input().split()))

A = []
B = []
cmb = {}
cnt = 0
flag = 1

for i in range(1, M+1):
	cmb.setdefault(i, [])


for i in range(M):
	a,b = map(int,input().split())

	cmb.setdefault(a, []).append(b)
	cmb.setdefault(b, []).append(a)

for j in range(1,N+1):
	if len(cmb[j])==0:
		cnt  += 1
	else:
		k = list(set(cmb[j]))
		flag = 1
		for i in range(len(k)):
			print(j)
			if H[j-1] <= H[k[i]]:
				flag = 0
				break;

		if flag  == 1:
			cnt += 1
print(cnt-1)

### FIXED CODE ###

N, M = map(int,input().split())
H = list(map(int,input().split()))

A = []
B = []
cmb = {}
cnt = 0
flag = 1
ma = [0]*N

for i in range(M):
	a,b = map(int,input().split())

	cmb.setdefault(i, [])
	cmb.setdefault(a-1, []).append(b-1)
	cmb.setdefault(b-1, []).append(a-1)

	ma[a-1] = max(ma[a-1], H[b-1])
	ma[b-1] = max(ma[b-1], H[a-1])
# print(cmb)

for j in range(N):
	# # print("展望台:", j)
	# k = list(set(cmb[j]))
	# # print(k)
	# if len(cmb[j])==0:
	# 	# print('正しく分岐')
	# 	cnt +=1
	# else:
	# 	# print(H[j], '>', ma[j])

	if H[j] > ma[j]:
		# print('GOOD')
		cnt += 1
print(cnt)
N = int(input())
A = []
lst = [list(f"{i:0{N}b}") for i in range(2**N)]
X = [[] for i in range(N)]
Y = [[] for i in range(N)]

for i in range(N):
    tmp_A = int(input())
    A.append(tmp_A)
    for j in range(tmp_A):
        tmp_x,tmp_y = input().split()
        X[i].append(int(tmp_x)-1)
        Y[i].append(tmp_y)

ans = -1

# for i in range(2**N):
#     flag = 1
#     for j in range(N):
#         if lst[i][j] == "1":
#             for k in range(A[j]):
#                if lst[i][X[j][k]] != Y[j][k]:
#                    flag = 0
#     if flag:
#         tmp = 0
#         for j in lst[i]:
#             if j == "1":
#                tmp += 1
#         if tmp > ans:
#             ans = tmp

print(ans)

### FIXED CODE ###

N = int(input())
A = []
lst = [list(format(i, '0%db' % N)) for i in range(2**N)]
X = [[] for i in range(N)]
Y = [[] for i in range(N)]

for i in range(N):
    tmp_A = int(input())
    A.append(tmp_A)
    for j in range(tmp_A):
        tmp_x,tmp_y = input().split()
        X[i].append(int(tmp_x)-1)
        Y[i].append(tmp_y)

ans = -1

for i in range(2**N):
    flag = 1
    for j in range(N):
        if lst[i][j] == "1":
            for k in range(A[j]):
               if lst[i][X[j][k]] != Y[j][k]:
                   flag = 0
    if flag:
        tmp = 0
        for j in lst[i]:
            if j == "1":
               tmp += 1
        if tmp > ans:
            ans = tmp

print(ans)
n,m = map(int,input().split())
li = []
itg = 0
flag = True
for _ in range(m):
  li.append(list(map(int,input().split())))
li = sorted(li, key = lambda x:x[0], reverse=True)
for i in range(m-1):
  if li[i][0] == li[i+1][0]:
    if li[i][1] != li[i+1][1]:
      print(-1)
      flag = False
    else:
      li[i][1] = 0
if flag:
  k = li[0][0]
  for l in li:
    itg += l[1] * (10 ** (k-l[0]))
  if len(str(itg)) > n:
    print(-1)
  elif itg == 0 and n >= 2:
    print(-1)
  else:
    print(itg)

### FIXED CODE ###

from sys import stdin
import math

n, m = [int(x) for x in stdin.readline().rstrip().split()]

s = [0] * m
c = [0] * m
for i in range(m):
    s[i], c[i] = [int(x) for x in stdin.readline().rstrip().split()]

result = -1
for nn in range(10 ** n):
    ns = str(nn)
    if len(ns) < n:
        continue
    #ns = ns.zfill(n)
    flag = True
    for i in range(m):
        if ns[s[i]-1] == str(c[i]):
            continue
        else:
            flag = False
            break
    if flag:
        result = nn
        if n > 1 and result == 0:
            result = -1
        break

print(result)
N = int(input())
A = list(map(int,input().split()))
self_front = [0]*(2*(10**5)+3)
for i in range(N):
    if(i-A[i] >= 0):
        self_front[i-A[i]] += 1
cnt = 0
for i in range(N):
    cnt += self_front[i+A[i]]
print(cnt)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
self_front = [0]*(2*(10**5)+3)
for i in range(N):
    if(i-A[i] >= 0):
        self_front[i-A[i]] += 1
cnt = 0
for i in range(N):
    if(i+A[i] < 2*(10**5)+3):
        cnt += self_front[i+A[i]]
print(cnt)
S = str(input())
if S == 'ABC':
  return 'ARC'
else:
  return 'ABC'

### FIXED CODE ###

S = str(input())
if S == 'ABC':
  print('ARC')
else:
  print('ABC')
n = input()
  
def scalar(n):
   m = [[0 for i in range(len(n))] for j in range(len(n))]
  
   for l in range(2, len(n)):
      for i in range(0, len(n)):
         j = i + l - 1
         m[i][j] = min(m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] for k in range(i, j))
  
   print m[0][len(n)-1]
  
for i in range(n):
   M.append(map(int, raw_input().split()))
scalar(M)

### FIXED CODE ###

n = input()
M = []
 
def scalar(n):
   m = [[0 for i in range(len(n))] for j in range(len(n))]
 
   for l in range(2, len(n)+1):
      for i in range(0, len(n)-l+1):
         j = i + l - 1
         m[i][j] = min(m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] for k in range(i, j))
 
   print m[0][len(n)-1]
 
for i in range(n):
   M.append(map(int, raw_input().split()))
scalar(M)
d=[0]*13
d[0]=1
mul=1
for c in reversed(input()):
    e=[0]*13
    """
    if c=="?":
        for i in range(10):
            for j in range(13):
                e[(i*mul+j)%13]+=d[j]
                e[(i*mul+j)%13]%=(10**9+7)
    else:
        for j in range(13):
            e[(int(c)*mul+j)%13]+=d[j]
            e[(int(c)*mul+j)%13]%=(10**9+7)
    """
    for j in (range(10) if c=="?" else[int(c)]):
        for i in range(13):
            e[(int(c)*mul+j)%13]+=d[j]
            e[(int(c)*mul+j)%13]%=(10**9+7)    
    d=e[:]
    mul*=10
print(d[5])


### FIXED CODE ###

# coding: utf-8
# Your code here!
 
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意
 
s = input()
l = len(s)
MOD = 10**9+7
 
dp = [0]*13
dp[0] = 1
for i in s:
    new = [0]*13
    if i == "?":
        for i in range(10):
            for j in range(13):
                new[(10*j+i)%13] += dp[j]
    else:
        i = int(i)
        for j in range(13):
            new[(i+10*j)%13] += dp[j]
    
    for i in range(13):
        new[i] %= MOD
    dp,new = new,dp
#    print(dp)
 
print(dp[5]%MOD)
a,b=map(int,input().split())
d=dict()
for i in range(b):
  s,l=input().split()
  if s in d.keys():
    d[s]+=1
    if l in d.keys():
      d[l]+=1
    else:
      d[l]=1
  else:
    d[s]=1
    if l in d.keys():
      d[l]+=1
    else:
      d[l]=1
score_sorted = sorted(d.items(), key=lambda x:x[0])

for i in range(a):
  print(score_sorted[i][1])


### FIXED CODE ###

n,m=map(int,input().split())
l=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  l[a-1]+=1
  l[b-1]+=1
for i in range(n):
  print(l[i])
from functools import reduce
import math
 
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
 
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
N = int(input().rstrip())
As = input().rstrip().split(" ")
As = [int(p) for p in As]
 
cand = lcm_list(As)
 
sum = 0
 
for num in As:
    sum = sum + cand // num
 
print(sum % (10**9 + 7))

### FIXED CODE ###

from functools import reduce
import fractions

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input().rstrip())
As = input().rstrip().split(" ")
As = [int(p) for p in As]

cand = lcm_list(As)

sum = 0

for num in As:
    sum = sum + cand // num

print(sum % int(1e9+7) )
left, right = map(int, input().split())
imod = []
jmod = []

for i in range(left, right):
    imod.append(i % 2019)

for i in range(imod.index(min(imod))+1, len(imod)):
    jmod.append(imod[i])

print(min(imod) * min(jmod) % 2019)


### FIXED CODE ###

left, right = map(int, input().split())
mod = []
if right - left > 2019:
    print(0)
    exit()
else:
    for i in range(left, right):
        for j in range(left+1, right+1):
            mod.append(i*j%2019)
print(min(mod))
from fractions import gcd

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

m = A[0]
for i in range(1,N):
    lm = lm*A[i] // gcd(lm,A[i])

ans = 0

for i in range(N):
    ans += ( lm//A[i] )
    ans %= Mod

print(ans)

### FIXED CODE ###

from fractions import gcd

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

lm = A[0]
for a in A[1:]:
    lm = lm*a//gcd(lm,a)

ans = 0
for i in range(N):
    ans += lm//A[i]
ans %= Mod

print(ans)
N,T=map(int,input().split(' '))
costs = []
for i in range(N):
  c,t = map(int,input().split(' '))
  if t<=T:
    costs.append(c)
print(min(costs))

### FIXED CODE ###

N,T=map(int,input().split(' '))
costs = []
for i in range(N):
  c,t = map(int,input().split(' '))
  if t<=T:
    costs.append(c)
if costs == []:
  print('TLE')
else:
  print(min(costs))
import math

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

print(int(a * b / math.gcd(a,b)))

### FIXED CODE ###

import fractions

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

print(int((a * b) // fractions.gcd(a,b)))
a = input()
b = input()
n = a * b

if n % 2 == 1 :
  print('Odd')
else :
  print('Even')

### FIXED CODE ###

a,b = map( int , input().split() )
c = ( a * b ) % 2

if c == 1 :
  print('Odd')
else :
  print('Even')
a,b = map(int,input().split())
import math
print(a*b//math.gcd(a,b))

### FIXED CODE ###

a,b = map(int,input().split())
import fractions
print(a*b//fractions.gcd(a,b))
n=int(input())
k=int(input())
print(n % k)

### FIXED CODE ###

#-*-coding:utf-8-*-

def main():
    n, k = map(int, input().split())

    if n % k == 0:
        print(0)
    else:
        print(1)

if __name__ == '__main__':
    main()
A,B=map(int,input().split())
N = list(int,input().split())

c=0

for i in range(A):
  if N[i] >= B:
    c+=1
  else:
    pass
  i+=1
print(c)


### FIXED CODE ###

N = int(input())

L = [i for i in range(N+1)]

odd = []

for j in range(N+1):
  if L[j] % 2 == 0:
    pass
  else:
    odd.append(L[j])
  j+=1

print(len(odd)/(len(L)-1))
import sys

N = int(input())
XY = [[int(_) for _ in input().split()] for i in range(N)]

mc = [0, 0]
maxl = 0

for x, y in XY:
    l = abs(x) + abs(y)
    maxl = max(maxl, l)
    mc[l % 2] += 1

if mc[0] > 0 and mc[1] > 0:
    print(-1)
    sys.exit()

print(maxl)
print(*([1]*maxl))

for x, y in XY:
    w = ""
    if x < 0:
        w += "L" * (-x)
    if x > 0:
        w += "R" * (+x)
    if y < 0:
        w += "D" * (-y)
    if y > 0:
        w += "U" * (+y)
    a = (maxl - len(w)) // 2
    if a > 0:
        if x == 0:
            w = "R"*a + w + "L"*a
        elif y < 0:
            w = "U"*a + w + "D"*a
        else:
            w = "D"*a + w + "U"*a
    print(w)


### FIXED CODE ###

import sys

N = int(input())
XY = [[int(_) for _ in input().split()] for i in range(N)]

mc = [0, 0]
maxl = 0

for x, y in XY:
    l = abs(x) + abs(y)
    maxl = max(maxl, l)
    mc[l % 2] += 1

if mc[0] > 0 and mc[1] > 0:
    print(-1)
    sys.exit()

#print(maxl)

def calc(sx, sy, ex, ey, d):
    dx, dy = ex - sx, ey - sy
    rx, ry = dx - dy, dx + dy
    if rx > 0:
        if ry > 0:
            d, x, y = "R", sx + d, sy
        else:
            d, x, y = "D", sx, sy - d
    else:
        if ry > 0:
            d, x, y = "U", sx, sy + d
        else:
            d, x, y = "L", sx - d, sy
    return d, x, y

import math

l = math.ceil(math.log(maxl + 1, 2))

ms = [2 ** (l - i - 1) for i in range(l)]

rms = ms

if mc[0] > 0:
    rms = [1] + ms

print(len(rms))
print(*rms)

for ex, ey in XY:
    x, y = 0, 0
    w = ""
    if mc[0] > 0:
        w = "R"
        x += 1
    for m in ms:
        d, x, y = calc(x, y, ex, ey, m)
        w += d
    print(w)
import math

H, W = map(int, input().split())

if H%3 == 0 or W%3 == 0:
    print(0)
else:
    res = 10 ** 11
    for i in range(1, H):
        a = W*i
        b = math.ceil(W/2) * (H-i)
        m = W//2 * (H-i)

        res = min(res, max(a,b,m)-min(a,b,m))

    for i in range(1, W):
        a = H*i
        b = math.ceil(H/2) * (W-i)
        m = H//2 * (W-i)
        res = min(res, max(a,b,m)-min(a,b,m))

               
print(res)

### FIXED CODE ###

import math

H, W = map(int, input().split())

if H%3 == 0 or W%3 == 0:
    print(0)
else:
    res = 10 ** 11
    for i in range(1, H):
        a = W*i
        b = math.ceil(W/2) * (H-i)
        m = W//2 * (H-i)
        res = min(res, max(a,b,m)-min(a,b,m))

    for i in range(1, W):
        a = H*i
        b = math.ceil(H/2) * (W-i)
        m = H//2 * (W-i)
        res = min(res, max(a,b,m)-min(a,b,m))

    for i in range(1, H-1):
        a = W*i
        b = W * math.ceil((H-i)/2)
        m = W * ((H-i)//2)
        res = min(res, max(a,b,m)-min(a,b,m))

    for i in range(1, W-1):
        a = H*i
        b = H * math.ceil((W-i)/2)
        m = H * ((W-i)//2)
        res = min(res, max(a,b,m)-min(a,b,m))

               
    print(res)
x = input()
y = x*x*x
print (y)


### FIXED CODE ###

x = input()
x = int(x)
print (x*x*x)
N, M = list(map(int, input().split()))
G = {i:[] for i in range(N)}
for _ in range(M):
    x, y = list(map(int, input().split()))
    G[x-1].append(y-1)
    
dp = [-1]*N

# node iを起点とした時の有効パスの最大値
def rec(i):
    if dp[i] != -1:
        return dp[i]
    res = 0
    for v in G[i]:
        res = max(res, rec(v)+1)
    dp[i] = res
    return res

ans = 0
for i in range(N):
    ans = max(ans, rec(i))
    
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5+100)

N, M = list(map(int, input().split()))
G = {i:[] for i in range(N)}
for _ in range(M):
    x, y = list(map(int, input().split()))
    G[x-1].append(y-1)
    
dp = [-1]*N
 
# node iを起点とした時の有効パスの最大値
def rec(i):
    if dp[i] != -1:
        return dp[i]
    res = 0
    for v in G[i]:
        res = max(res, rec(v)+1)
    dp[i] = res
    return res
 
ans = 0
for i in range(N):
    ans = max(ans, rec(i))
    
print(ans)
nums = list(map(int, input().split())) # "1 2 3"と入力
n = nums[0]
t = nums[1]
minC = 1001
for i in range(n):
    numss = list(map(int, input().split()))
    c = numss[0]
    ti = numss[1]
    if ti <= t and minC > c:
        minC = c
if minC = 1001:
    print('TLE')
else:
    print(minC)


### FIXED CODE ###

n, tx = input().strip().split(' ')
n, tx = [int(n),int(tx)]

c_ans = 1001
for i in range (n):
    c, t = input().strip().split(' ')
    c, t = [int(c),int(t)]
    if c < c_ans and t <= tx:
        c_ans = c
if c_ans == 1001:
    print('TLE')
else:
    print(c_ans)
S=list(input())
T=list(input())
flag = True
for i in range(N):
    s = S[i]
    t = T[i]
    if s != t:
        flag = False
        
if flag:
    if len(T) == N+1:
        print("Yes")
    else:
        print("No")
else:
    print("No")

### FIXED CODE ###

s = input()
t = input()
if s == t[:-1]:
  print('Yes')
else:
  print('No')
a,b,c = map(int,input().split())
 
if a*b < c:
  print(a:b)
else:
  print(c)

### FIXED CODE ###

a,b,c = map(int,input().split())
if a*b < c:
  print(a*b)
else:
  print(c)
def main():

    Counter = 0
    Text_W = input()
    while True:
        Text_T = input().lower()
        if "END_OF_TEXT" in Text_T:
            temp = Text_T.split()
            for i in range(len(temp)):
                Counter += 1 if Text_W == temp[i] else 0
            break
        else:
            temp = Text_T.split()
            for i in range(len(temp)):
                Counter += 1 if Text_W == temp[i] else 0

    print (Counter)

if __name__ == '__main__':
    main()
    


### FIXED CODE ###

W = input()
count_W = 0
while True:
    s = input()
    if s == 'END_OF_TEXT':
        break
    else:
        count_W += s.lower().split().count(W)

print(count_W)
#

import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop

def solve(positions, s, t):
    # print('{}, s = {}, t = {}'.format(positions, s, t))
    if len(t) == 0:
        return 0
    if len(positions[t[0]]) == 0:
        return -1

    i = 0
    j = 0
    while i < len(s) and j < len(t):
        pos = list(filter(lambda idx: idx >= i, positions[t[j]]))
        # print('pos = {} t = {}, i = {}'.format(pos, t[j], i))
        if len(pos) == 0:
            break
        i = pos[0] + 1
        j += 1

    if j == len(t):
        return i
    else:
        rest = solve(positions, s, t[j:])
        return len(s) + rest if rest != -1 else -1


def main():
    s = input()
    t = input()

    positions = defaultdict(list)
    for i in range(len(s)):
        positions[s[i]].append(i)

    # check can or cannot
    print(solve(positions, s, t))


if __name__ == '__main__':
    main()


### FIXED CODE ###

#

import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def solve(positions, s, t):

    if not set(t) <= set(s):
        return -1

    loop = 0
    prev = -1

    for tchar in t:
        candidates = positions[tchar]
        pos = bisect.bisect_right(candidates, prev)

        if pos == len(candidates):
            loop += 1
            pos = 0
        prev = candidates[pos]

    return loop * len(s) + prev + 1


def main():
    s = input()
    t = input()

    positions = defaultdict(list)
    for i in range(len(s)):
        positions[s[i]].append(i)

    print(solve(positions, s, t))


if __name__ == '__main__':
    main()
#!/usr/bin/env pypy
from __future__ import division, print_function

import os
import sys
from __builtin__ import xrange as range
from cStringIO import StringIO
from future_builtins import ascii, filter, hex, map, oct, zip
from io import IOBase
from collections import defaultdict

import __pypy__


def main():
    n = int(input())
    a = [int(i) for i in input().split(" ")]
    s = defaultdict(int)
    for i in xrange(n):
    	ans += s[a[i]-i]
        s[-i-a[i]] += 1
    print(ans)


# region fastio

BUFSIZE = 8192


class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()


class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()


def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


### FIXED CODE ###

from collections import defaultdict
import sys

n = int(raw_input())
a = [int(i) for i in raw_input().split(' ')]
s = defaultdict(int)
ans = 0

for i in xrange(n):
  ans += s[a[i] - i]
  s[-i-a[i]] += 1

print ans
H, W = map(int, input().split())

S = [list(input()) for _ in range(H)]

# #の座標(i,j)を与え、隣接している#があるならばTrue、そうでなければNoを出力して終了する
def exist_neighbor_black_cell(i,j):
    if "#" in [S[max(0,i-1)][j], S[min(H-1,i+1)][j], S[i][max(0,j-1)], S[i][min(W-1,j+1)]]:
        return True
    else:
        print("No")
        exit()

# どの#にも隣接していない#マスがあれば不可。そうでなければ可
for i in range(H):
    for j in range(W):
        if S[i][j] == "#":
            exist_neighbor_black_cell(i, j)

print("Yes")

### FIXED CODE ###

# A - Day of Takahashi

a, b = map(int, input().split())
print(a if a <= b else a-1)
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
x_li = []
y_li = []
h_li = []
for i in range(n):
    x, y, h = na()
    x_li.append(x)
    y_li.append(y)
    h_li.append(h)
ans = []
flag = False
for x in range(101):
    for y in range(101):
        H = h_li[0] + abs(x_li[0] - x) + abs(y_li[0] - y)
        for i in range(n):
            if h_li[i] == max(H - abs(x_li[i] - x) - abs(y_li[i] - y), 0):
                if i == n - 1:
                    flag = True
                    ans.append([x, y, H])
                    break
            else:
                break
        if flag:
            break
    if flag:
        break
print(*ans[0])


### FIXED CODE ###

import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
x_li = []
y_li = []
h_li = []
for i in range(n):
    x, y, h = na()
    x_li.append(x)
    y_li.append(y)
    h_li.append(h)
H = -1
ansX = -1
ansY = -1
flag = False
if h_li.count(0) == len(h_li) - 1:
    idx = h_li.index(1)
    print(x_li[idx], y_li[idx], h_li[idx])
else:
    for x in range(101):
        for y in range(101):
            for i in range(n):
                tmp = h_li[i] + abs(x_li[i] - x) + abs(y_li[i] - y)
                if H == -1 and h_li[i] != 0:
                    H = tmp
                    ansX = x
                    ansY = y
                elif H == tmp or h_li[i] == 0:
                    if i == n - 1:
                        flag = True
                        break
                else:
                    H = -1
                    break
            if flag:
                break
        if flag:
            break

    print(ansX, ansY, H)