Harryxun/stf_run huggingface dataset:
dict1 = {}
dict2 = {}

while True:
	str = raw_input().split(",")
	
	if len(str[0]) == 0:
		break
	
	if dict1.has_key(str[0]):
		dict1[str[0]] = dict1[str[0]] + 1
	else:
		dict1[str[0]] = 1
	
while True:
	str = raw_input().split(",")
	
	if len(str[0]) == 0:
		break
	
	if dict2.has_key(str[0]):
		dict2[str[0]] = dict2[str[0]] + 1
	else:
		dict2[str[0]] = 1

list = dict2.keys()

for var in list:
	dict1[var] = dict1[var] + dict2[var]
	print var, dict1[var]

### FIXED CODE ###

dict1 = {}
dict2 = {}

while True:
	log = raw_input()
	if len(log) == 0:
		break
	
	log = log.split(",")[0]
	
	if log in dict1:
		dict1[log] = dict1[log] + 1
	else:
		dict1[log] = 1
		
while True:
	try:
		log = raw_input()
		
		log = log.split(",")[0]
		
		if log in dict2:
			dict2[log] = dict2[log] + 1
		else:
			dict2[log] = 1
			
	except EOFError:
		break

list = set(dict1) & set(dict2)
for var in list:
	print var, dict1[var] + dict2[var]
n = int(input())
input(s)
s1 = [s[i : i + n / 2] for i in range(0, len(s), n / 2)]
if (s1 == s2)
  print("Yes")
else
  print ("No")    

### FIXED CODE ###

import sys

n = int(input())
s = input()
if n == 1:
  print("No")
  sys.exit()
n = n // 2
if s[:n]  == s[n:]:
    print("Yes")
else:
    print ("No")
N = int(input())
A = list(map(int, input().split()))

new_A = A.sort(reverse=True)

ans = 0
for i in range(len(new_A)):
    if i % 2 == 0:
        ans += new_A[i]
    if i % 2 == 1:
        ans -= new_A[i]

print(ans)

### FIXED CODE ###

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

A.sort(reverse=True)

ans = 0
for i in range(N):
    if i % 2 == 0:
        ans += A[i]
    if i % 2 == 1:
        ans -= A[i]

print(ans)
n=int(input())
a=list(map(int,input().split()))
 
b=[0]*n
for i in a:
    b[i-1]+=1
 
for i in b:
    print(i)

### FIXED CODE ###

import math
pi=math.pi

R=float(input())

print(2.0*pi*R)
n, x =  map(int, input().split())
xi = map(int, input().strip().split())
c = [x] * n
xi = [x - y for (x,y) in zip(xi,c)]
def gcd(a, b):
  
  if b == 0: return a
  return gcd(b, a % b)
d0 = xi[0]
for i in range(n-1):
    d = gcd(xi[i+1],d0)
    d0 = d
print(abs(d))   

### FIXED CODE ###

n, x =  map(int, input().split())
xi = map(int, input().strip().split())
c = [x] * n
xi = [x - y for (x,y) in zip(xi,c)]
def gcd(a, b):
  if b == 0: return a
  return gcd(b, a % b)
d0 = xi[0]
for i in range(n-1):
    d = gcd(xi[i+1],d0)
    d0 = d
if len(xi) == 1:
  d = xi[0]
print(abs(d))
from collections import defaultdict
import math

def main():
    n = int(input())
    mod = 1000000007
    zeroes = 0
    quadrant1 = defaultdict(int)
    quadrant2 = defaultdict(int)

    for _ in range(n):
        a, b = map(int, input().split())
        if a == b == 0:
            zeroes += 1

        g = math.gcd(a, b)
        a, b = a//g, b//g 
        
        if b < 0:
            a, b = -a, -b
        
        if a <= 0:
            a, b = b, -a
            quadrant1[(a, b)] += 0
            quadrant2[(a, b)] += 1
        else:
            quadrant1[(a, b)] += 1
            quadrant2[(a, b)] += 0
    
    ans = 1
    for key, value in quadrant1.items():
        now = 1
        now += pow(2, value, mod) - 1
        now += pow(2, quadrant2[key], mod) - 1
        ans = (ans * now) % mod
    
    ans += (zeroes - 1)
    return ans % mod

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

### FIXED CODE ###

from collections import defaultdict
import math


def main():
    n = int(input())
    mod = 1000000007
    zeroes = 0
    counter1 = defaultdict(int)
    counter2 = defaultdict(int)
    for _ in range(n):
        x, y = [int(x) for x in input().split()]

        if x == y == 0:
            zeroes += 1
            continue

        denominator = math.gcd(x, y)
        x, y = x // denominator, y // denominator

        if y < 0:
            # quadrant III, IV -> I, II
            x, y = -x, -y

        if x <= 0:
            # round 90° from quadrant II to I
            x, y = y, -x
            counter2[(x, y)] += 1
            counter1[(x, y)] += 0
        else:
            counter1[(x, y)] += 1
            counter2[(x, y)] += 0

    ans = 1
    for k, v in counter1.items():
        now = 1
        now += pow(2, v, mod) - 1
        now += pow(2, counter2[k], mod) - 1
        ans = ans * now % mod
    ans += zeroes
    ans -= 1  # choose no fish
    return ans % mod


if __name__ == '__main__':
    print(main())
import numpy as np
N = int(input())
S = input()

sa = np.array([1 if i == "#" else 0 for i in S])
num = np.arange(N)
num_w = num[sa==0]
num_b = num[sa==1]
if len(num_w) == 0 or len(num_b) == 0:
    print(0)
    import sys
    sys.exit()
if num_b[-1] == N-1:
    w0 = 0
    w = len(num_w)
    b = np.sum([num_b<num_w[-1]])
else:
    w = np.sum([num_w<num_b[-1]])
    w0 = len(num_w) - w
    b = np.sum([num_b<num_w[num_w<num_b[-1]][-1]])
if w > b:
    print(b+w0)
else:
    print(w+w0)

### FIXED CODE ###

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

s = [0 for _ in range(N+1)]
for i, x in enumerate(S):
    if x == "#":
        s[i+1] = s[i] + 1
    else:
        s[i+1] = s[i]
num = N
for i in range(N+1):
    w = s[i] - s[0]
    b = (N - i) - (s[N] - s[i])
    if w + b < num:
        num = w + b
print(num)
N, K = map(int, input().split())
A=list(map(int,input().split()))
A.sort()
right = A[-1]+1
left = -1
flag = True
mid = (left+right)//2
while right-left>1 and flag:
    mid = (left+right)//2
    count = 0
    for i in A:
        count += (i-1)//mid
    if count <= K:
        right = mid
    elif count > K:
        left = mid
    else:
        flag = False
print(mid)


### FIXED CODE ###

N, K = map(int, input().split())
A=list(map(int,input().split()))
A.sort()
right = A[-1]+1
left = 0
flag = True
mid = (left+right)//2
minN = right
result = mid
while right-left>1 and flag:
    mid = (left+right)//2
    count = 0
    for i in A:
        count += (i-1)//mid
    if count <= K:
        right = mid
        if minN>mid:
            minN = mid
            result = mid
    elif count > K:
        left = mid
print(result)
import math

while True :

x = int(input()) 

  if x == 0 :
    break 

  else :
    sum = 0 
    n=floor(log(x,10))
    sum = floor(x/pow(10,n))
    for i in reversed(xrange(n+1))
      sum = sum + floor((x%pow(10,i))/pow(10,i-1))

  print(sum)
      

  

### FIXED CODE ###

while True :
  x = input()
  if x == '0' :
    break 

  else:
   sum = 0 
   for i  in range(len(x)) :  
    sum += int(x[i])

  print(sum)
S=input()
K=int(input())
count=0
SS=S*K
flag=True
for i in range(1, len(SS)):
  if not flag:
    flag=True
    continue
  else:
    count+=1
    flag=False
print(count)

### FIXED CODE ###

S=input()
K=int(input())
SS=S+S
SSS=SS+S
count_single=count_double=count_triple=0
flag=True
for i in range(1, len(S)):
  if not flag:
    flag=True
    continue
  if S[i-1]==S[i]:
    count_single+=1
    flag=False
flag=True
for i in range(1, len(SS)):
  if not flag:
    flag=True
    continue
  if SS[i-1]==SS[i]:
    count_double+=1
    flag=False
flag=True
for i in range(1, len(SSS)):
  if not flag:
    flag=True
    continue
  if SSS[i-1]==SSS[i]:
    count_triple+=1
    flag=False
if K==1:
  print(count_single)
elif K==2:
  print(count_double)
else:
  diff21=count_double-count_single
  diff32=count_triple-count_double
  print(count_single+(K//2)*diff21+((K-1)//2)*diff32)
A,B,C,D = map(int,input().split())
print(min(A,B)+min(C,D))

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
D = int(input())

print(min(A,B)+min(C,D))
N = int(input())
a = list(map(int, input().split()))

t = [0] * N
for i in range(N - 1, -1, -1):
    t[i] = (sum(t[2 * (i + 1) - 1::i]) % 2) ^ a[i]

print(sum(t))
print(*[i + 1 for i in range(N) if t[i] == 1])


### FIXED CODE ###

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

t = [0] * (N + 1)
for i in range(N, 0, -1):
    t[i] = (sum(t[2 * i::i]) % 2) ^ a[i - 1]

print(sum(t))
print(*[i for i in range(1, N + 1) if t[i] == 1])
A=input("高橋君のHP:")
B=input("高橋君のATK:")
C=input("青木君のHP:")
D=input("青木君のATK:")

int_A=int(A)
int_B=int(B)
int_C=int(C)
int_D=int(D)

while True:
    int_C-=int_B
    int_A-=int_D
    if int_C<=0:
        result="Yes"
        break
    if int_A<=0:
        result="No"
        break

print(result)

### FIXED CODE ###

A,B,C,D = map(int,input().split())

while True:
    C -= B
    A -= D

    if C <= 0:
        result = "Yes"
        break
    if A <= 0:
        result = "No"
        break

print(result)
K = input()
S = input()
count = len(S)
list = 0
List = []
for i in range(K):
  print(S[list])
  list = list + 1
if (count <= K):
  print(S)
else:
  print( *i +"...")


### FIXED CODE ###

k = int(input())
s = str(input())
if len(s) <= k:
    print(s)
else:
    print((s[:k]) + "...")
n=int(input())
s=input()
t=s[0]
chk=0
d=[]
for i in s:
    if i==")"==t:
        chk-=1
    elif i=="("==t:
        chk+=1
    else:
        d.append(chk)
        t=["(",")"][i==")"]
        chk=[1,-1][i==")"]
d.append(chk)
if d[0]<0: d=[0]+d
if d[-1]>0: d.append(d[-1]*-1)
p=sum(d)
if p<0: ans[0]+=abs(p)
if p>0: ans[-1]+=p
ans=""
for i in d:
    ans+=["(",")"][i<0]*abs(i)
print(ans)


### FIXED CODE ###

n=int(input())
s=input()
d=[0,0]
for i in s:
    if i=="(": d[0]+=1
    if i==")" and d[0]>0: d[0]-=1
for i in s[::-1]:
    if i==")": d[1]+=1
    if i=="(" and d[1]>0: d[1]-=1
s="("*d[1]+s+")"*d[0]
print(s)
S = input()

if 'A' in S && 'B' in S
  print('Yes')
else
  print('No')
  

### FIXED CODE ###

S = input()
 
if 'A' in S and 'B' in S:
  print('Yes')
else:
  print('No')
i = list(map(int, input().split()))

if i[0] = i[1]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

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

if i[0] == i[1]:
  print('Yes')
else:
  print('No')
def make_divisor_list(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return divisor_list

N,M=list(map(int,input().split()))
LIST=[]
divide_list = make_divisor_list(M)
if M%N==0:
    print(M//N)
else:
    x = M/N
    for i in divide_list:
       if i <= x:
          LIST.append(i)
    print(max(LIST))

### FIXED CODE ###

N = int(input())
if N==1:
    print("Hello World")
else:
    A=int(input())
    B=int(input())
    print(A+B)
num_ints = int(input())
sum_ints = sum([int(i) for i in input().split()])

if sum % 2 == 0:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

num_ints = int(input())
sum_ints = sum([int(i) for i in input().split()])

if sum_ints % 2 == 0:
    print("YES")
else:
    print("NO")
#coding:utf-8
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
n,m = map(int,input().split())
s=input()
t=input()
lcm = lcm(n,m)
a = int(lcm/n)
b = int(lcm/m)
for i in range(math.gcd(n,m)):
    if s[i*b]==t[i*a]:
        pass
    else:
        print (-1)
        exit()
print (lcm)


### FIXED CODE ###

#coding:utf-8
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
n,m = map(int,input().split())
s=input()
t=input()
lcm = lcm(n,m)
a = int(lcm/n)
b = int(lcm/m)
for i in range(fractions.gcd(n,m)):
    if s[i*b]==t[i*a]:
        pass
    else:
        print (-1)
        exit()
print (lcm)
x = float(input())
print("%.6f %.6"%(a*a*3.14159265, a*2*3.14159265))


### FIXED CODE ###

import math
x = float(input())
print("%.6f %.6f"%(x*x*math.pi, x*2*math.pi))
n = input().split()
nums = list(map(int, input.split()))

flag = 0
ans = 0
for i, num in enumerate(nums):
  if i == num:
    if flag:
      ans += 1 
      flag = 0
    else:
      flag = 1
  else:
    if flag == 1:
      ans += 1
      flag = 0
      
if flag == 1:
  ans += 1
  
print(ans)

### FIXED CODE ###

def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
ans = 0
N = getN()
list = getList()
bind = []
for i, x in enumerate(list):
    if x == i+1:
        bind.append(x)
p = 0
l = len(bind)
while p<l:
    ans += 1
    if p == l-1:
        p += 1
    elif bind[p] + 1 == bind[p+1]:
        p += 2
    else:
        p += 1


print(ans)
N=int(input())
ans=1
for i in range(N):
  A=int(input())
  ans*=A
if ans>1000000000000000000:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

def kai():
    N=int(input())
    A=list(map(int,input().split()))
    
    if  0 in A:
        print(0)
        return
    
    ans=1
    for i in A:
        ans*=i
        if ans>10**18:
            print(-1)
            return
    print(ans)
    return
kai()
import numpy as np

n = int(input())
f = np.array([list(map(int, input().split())) for i in range(n)])
p = np.array([list(map(int, input().split())) for i in range(n)])

ans = -99999999

openptn=np.array([[int(s) for s in list('{0:010b}'.format(i))] for i in range(1,2**10)])

for i in range(2**10 - 1):
	subans = 0
	for j in range(n):
		count = sum(f[j]*openptn[i])
		print(f[j]*openptn[i])

		subans +=p[j][count]
        count = 0
		
		#print(subans)
	ans = max(ans, subans)

print(ans)

### FIXED CODE ###

n, a, b = list(map(int, input().split()))
print(min(n*a, b))
import math


def sub():
    N, As = [input() for _ in range(2)]
    N = int(N)
    As = [int(e) for e in As.split(" ")]

    dp = {(-1, 0): 0, (-1, 1): -math.inf}
    for i in range(0, N):
        dp[(i, 0)] = max(dp[(i - 1, 0)] + As[i], dp[(i - 1, 1)] - As[i])
        dp[(i, 1)] = max(dp[(i - 1, 0)] - As[i], dp[(i - 1, 1)] + As[i])
    print("{}".format(dp[(N - 1, 0)]))


sub()


### FIXED CODE ###

def sub():
    N, As = [input() for _ in range(2)]
    N = int(N)
    As = [int(e) for e in As.split(" ")]

    dp = {(-1, 0): 0, (-1, 1): -1e10}
    for i in range(0, N):
        dp[(i, 0)] = max(dp[(i - 1, 0)] + As[i], dp[(i - 1, 1)] - As[i])
        dp[(i, 1)] = max(dp[(i - 1, 0)] - As[i], dp[(i - 1, 1)] + As[i])
    print("{}".format(dp[(N - 1, 0)]))


sub()
import numpy as np
h,w,m=map(int, input().split())
a = np.zeros((h,w))
ans=0

for i in range(m):
    x,y=map(int, input().split())
    a[x-1,y-1]=1
    
c = a.sum(axis=0)
r = a.sum(axis=1)
cm = max(c)
rm = max(r)
ci = [i for i, x in enumerate(c) if x == cm]
ri = [i for i, x in enumerate(r) if x == rm]
ans = cm + rm

print(int(ans))

### FIXED CODE ###

h,w,m=map(int, input().split())
r = [0]*max(h,w)
c = [0]*max(h,w)
l=[]

for i in range(m):
    x,y=map(int, input().split())
    r[x-1]+=1
    c[y-1]+=1
    l.append([x,y])

cm = max(c)
rm = max(r)
ci = [i for i, x in enumerate(c) if x == cm]
ri = [i for i, x in enumerate(r) if x == rm]
ans = cm + rm

cnt = 0
#print(l,ci,ri)
for i in range(m):
    if r[l[i][0]-1] == rm and c[l[i][1]-1] ==cm:
        cnt += 1

if cnt == len(ci)*len(ri):
    print(int(ans)-1)
else:
    print(int(ans))
N,M = map(int,(input().split()))
X = list(map(int,(input().split())))
X.sort()
dist = [X[i+1]-X[i] for i in range(len(X) - 1)]
dist.sort(reverse = True)
for i in range(N - 1):
    del dist[0]
print(sum(dist))

### FIXED CODE ###

N,M = map(int,(input().split()))
X = list(map(int,(input().split())))
X.sort()
if M > N:
    dist = [X[i+1]-X[i] for i in range(M - 1)]
    dist.sort(reverse = True)
    for i in range(N - 1):
        del dist[0]
    print(sum(dist))
else:
 print(0)
N, K, S = map(int,input().split())
L = [S]*K
for i in range(N-K):
  L.append(S+1)
  
print(' '.join(L))

### FIXED CODE ###

N, K, S = map(int,input().split())
L = [S]*K
for i in range(N-K):
  if S < 10**9:
  	L.append(S+1)
  else:
    L.append(1)
  
print(' '.join(map(str, L)))
def calcBoundCount(rangex, lstL):
    d = 0
    for i in range(0, len(lstL)):
        d = d + lstL[i]
        if rangex < d:
            return i + 1
    return len(lstL) + 1

N, X = map(int, input().split())
lstL = list(map(int, input().split()))

count = calcBoundCount(X, lstL)
print((count if count <= N+1 else N+1))

### FIXED CODE ###

X,A = map(int, input().split())

res = (int)(10 if X>=A else 0)

print(res)
a = int(input())
b = int(input())
al = list([1,2,3])

remain = al.remove(a,b)

print(remain)


### FIXED CODE ###

a = int(input())
b = int(input())
al = [1,2,3]

al.remove(a)
al.remove(b)
print(al[0])
import sys
range = xrange
input = raw_input

def find_SCC(coupl):
    SCC, S, P = [], [], []
    depth = [0] * len(coupl)
 
    stack = list(range(len(coupl)))
    while stack:
        node = stack.pop()
        if node < 0:
            d = depth[~node] - 1
            if P[-1] > d:
                SCC.append(S[d:])
                del S[d:], P[-1]
                for node in SCC[-1]:
                    depth[node] = -1
        elif depth[node] > 0:
            while P[-1] > depth[node]:
                P.pop()
        elif depth[node] == 0:
            S.append(node)
            P.append(len(S))
            depth[node] = len(S)
            stack.append(~node)
            stack += coupl[node]
    return SCC[::-1]

inp = [int(x) for x in sys.stdin.read().split()]; ii = 0

n = inp[ii]; ii += 1
m = inp[ii]; ii += 1

coupl = [[] for _ in range(n)]
for _ in range(m):
  	u = inp[ii] - 1; ii += 1
    v = inp[ii] - 1; ii += 1
    coupl[u].append(v)

SCC = find_SCC(coupl)
out = [len(SCC)]
for scc in SCC:
	out.append(len(scc))
    for node in scc:
    	out.append(node + 1)
print ' '.join(str(x) for x in out)

### FIXED CODE ###

import sys
range = xrange
input = raw_input
 
def find_SCC(coupl):
    SCC, S, P = [], [], []
    depth = [0] * len(coupl)
 
    stack = list(range(len(coupl)))
    while stack:
        node = stack.pop()
        if node < 0:
            d = depth[~node] - 1
            if P[-1] > d:
                SCC.append(S[d:])
                del S[d:], P[-1]
                for node in SCC[-1]:
                    depth[node] = -1
        elif depth[node] > 0:
            while P[-1] > depth[node]:
                P.pop()
        elif depth[node] == 0:
            S.append(node)
            P.append(len(S))
            depth[node] = len(S)
            stack.append(~node)
            stack += coupl[node]
    return SCC[::-1]
 
inp = [int(x) for x in sys.stdin.read().split()]; ii = 0
 
n = inp[ii]; ii += 1
m = inp[ii]; ii += 1
 
coupl = [[] for _ in range(n)]
for _ in range(m):
    u = inp[ii]; ii += 1
    v = inp[ii]; ii += 1
    coupl[u].append(v)
 
SCC = find_SCC(coupl)
out = [len(SCC)]
for scc in SCC:
    out.append(len(scc))
    for node in scc:
        out.append(node)
print ' '.join(str(x) for x in out)
a, b = map(int, input().split())

print("Even" if a*b%==0 else "Odd")

### FIXED CODE ###

a, b = map(int, input().split())
 
print("Even" if a*b%2==0 else "Odd")
x1,y1,x2,y2 = map(int,input().split())
d1 = abs(x2-x1)
d2 = abs(y2-y1)
x3 = x2 + d2
y3 = y2 + d1
x4 = x1 + d1
y4 = y1 + d2
print(x3 y3 x4 y4)


### FIXED CODE ###

x1,y1,x2,y2 = map(int,input().split())
d1 = x2-x1
d2 = y2-y1
x3 = x2 - d2
y3 = y2 + d1
x4 = x1 - d2
y4 = y1 + d1
print(x3,y3,x4,y4)
N,M=map(int,input().split())
S=input()
T=input()
ans=["-1"]*()
def computeGCD(x, y): 
  if x > y: 
    small = y    
  else: 
    small = x
  for i in range(1, small+1): 
    if((x % i == 0) and (y % i == 0)): 
      gcd = i 
  return gcd 

lena=computeGCD(N,M)
glena=N*M//lena#45 , 15,9 , 3,5 
comm=computeGCD(glena//N, glena//M)
gcomm=(glena//N)*(glena//M)//comm
for i in range(glena//gcomm):
  if S[i*glena//M]!=T[i*glena//N]:
    print(-1)
    exit()
print(glena)

### FIXED CODE ###

N,M = map(int, input().split())
S = input()
T = input()
from fractions import gcd

# 15, 9
# 3$BJ8;z$:$D8+$F$$$/!"(B5$BJ8;z$:$D8+$F$$$/(B
LEN = N*M // gcd(N,M) # 45
p = LEN // N # 3
q = LEN // M # 5
lcm = p*q//gcd(p,q)

for i in range(0, LEN//lcm):
    if S[i*q] != T[i*p]:
        print(-1)
        exit()
print(LEN)
N = int(input())
list_d = [int(input()) for i int range(n)]

print(len(set(lst)))

### FIXED CODE ###

n = int(input())
list_d = [int(input()) for i in range(n)]

print(len(set(list_d)))
import sys

diff = deque()

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

if N >= M:
    print(0)
    exit()

X.sort()

for i in range(len(X)-1):
    diff.append(X[i+1]-X[i])

diff.sort()

for i in range(N-1):
    diff.pop()

print(sum(diff))


### FIXED CODE ###

import sys
from collections import deque


diff = deque()

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

if N >= M:
    print(0)
    exit()

X.sort()

for i in range(len(X)-1):
    diff.append(X[i+1]-X[i])

diff = list(diff)
diff.sort()

for i in range(N-1):
    diff.pop()

print(sum(diff))
n=int(input())
p = [int(x) for x in input().split()] 
count=0
for i in range(n-2)
	if p[i]>p[i+1]>p[i+2] or p[i+2]>p[i+1]>p[i]:
    	count=count+1
print(count)

### FIXED CODE ###


n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n - 2):
	if p[i] < p[i + 1] < p[i + 2] or p[i + 2] < p[i + 1] < p[i]:
		ans += 1
print(ans)
import math
from functools import reduce
N = int(input())
a = list(map(int, input().split()))
print(reduce(math.gcd, a))

### FIXED CODE ###

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

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)


if N == 1:
    print(x[0])
else:
    num = gcd(x[0], x[1])
    if N == 2:
        print(num)
    else:
        for i in range(2, N):
            num = gcd(num, x[i])
        print(num)
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, A: "List[int]"):
    s = [A[0]] * (N)
    e = [A[-1]] * (N)
    for i in range(1, N):
        s[i] = max(s[i-1], A[i])
    for i in range(N-2, -1, -1):
        e[i] = max(e[i+i], A[i])

    for i in range(N):
        if i == 0:
            print(e[i+1])
        elif i == N-1:
            print(s[i-1])
        else:
            print(max(s[i-1], e[i+1]))
        
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    ml = A.copy()
    ml.sort(reverse=True)

    Am = ml[0]
    As = ml[1]

    for i in range(N):
        if(A[i] == Am):
            print(As)
        else:
            print(Am)
    

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()
n, x = map(int, input().split())
L = list(map(int, input().split()))

d, i = 0, 0
while d < x:
    d += L[i]
    i += 1

print(i)

### FIXED CODE ###

import numpy as np

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

CS_L = np.cumsum(L).tolist()
ans = len([l for l in CS_L if l <= x])
print(ans + 1)
ipt = list(map(int, input().split()))
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]

if ipt[0] == ipt[1]:
    return True
else:
    if ipt[0] in a:
        return ipt[1] in a
    else:
        ipt[0] in b:
        return ipt[1] in b


### FIXED CODE ###

ipt = input().split()

a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
i=int(ipt[0])
j=int(ipt[1])
if i==j:
    print('Yes')
elif i in a and j in a:
    print('Yes')
elif i in b and j in b:
    print('Yes')
else:
    print('No')
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N-1):
  for j in range(i+1, N+1):
    number = abs(i-j)
    tall = A[i]+A[j]
    if number == tall:
      ans += 1
      
print(ans)

### FIXED CODE ###

from collections import defaultdict
 
n = int(input())
a = list(map(int, input().split()))
ap = defaultdict(int)
for i in range(n):
    ap[i - a[i]] += 1

ans= 0
for i in range(n):
    ans += ap[a[i] + i]
print(ans)