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

class prime_factorize_by_osa_k():
    def __init__(self, max_val):
        '''
        割ることが出来る最小の値を格納したリストを返す
        :param max_val:
        :return:
        '''
        self.minFactor = [-1] * (max_val + 1)
        for i in range(2, max_val + 1):
            if self.minFactor[i] == -1:
                self.minFactor[i] = i
                # エラトステネスの篩と同様の処理を行う
                for j in range(i * i, max_val + 1, i):
                    if self.minFactor[j] == -1:
                        self.minFactor[j] = i

    def osa_k(self, n):
        '''
        preprocessをしたあと、O(logN)で素因数分解を行う。nの最大値をn_maxとする。
        :param n:
        :return:
        '''
        from collections import defaultdict
        d = defaultdict(int)
        now = n
        while now > 1:
            d[self.minFactor[now]] += 1
            now //= self.minFactor[now]
        return d
def gcd(a, b):
    while b: a, b = b, a % b
    return a

N = int(input())
A = list(map(int, input().split()))
# N = 10 ** 6
# A = [10 ** 6] * N
ob = prime_factorize_by_osa_k(10 ** 6)
pairwise = False
prime_key = set(ob.osa_k(A[-1]).keys())
for i in range(N - 2, -1, -1):
    now = set(ob.osa_k(A[i]).keys())
    if prime_key & now:
        break
    else:
        prime_key = now | prime_key
else:
    pairwise = True
if pairwise:
    print('pairwise coprime')
    exit()
work = gcd(A[0], A[1])
for i in range(2, N):
    work = gcd(work, A[i])
if work != 1:
    print('not coprime')
else:
    print('setwise coprime')

### FIXED CODE ###

class prime_factorize_by_osa_k():
    def __init__(self, max_val):
        '''
        割ることが出来る最小の値を格納したリストを返す
        :param max_val:
        :return:
        '''
        self.minFactor = [-1] * (max_val + 1)
        for i in range(2, max_val + 1):
            if self.minFactor[i] == -1:
                self.minFactor[i] = i
                # エラトステネスの篩と同様の処理を行う
                for j in range(i * i, max_val + 1, i):
                    if self.minFactor[j] == -1:
                        self.minFactor[j] = i

    def osa_k(self, n):
        '''
        preprocessをしたあと、O(logN)で素因数分解を行う。nの最大値をn_maxとする。
        :param n:
        :return:
        '''
        from collections import defaultdict
        d = defaultdict(int)
        now = n
        while now > 1:
            d[self.minFactor[now]] += 1
            now //= self.minFactor[now]
        return d
def gcd(a, b):
    while b: a, b = b, a % b
    return a

N = int(input())
A = list(map(int, input().split()))
# N = 10 ** 6
# A = [10 ** 6] * N
ob = prime_factorize_by_osa_k(10 ** 6)
pairwise = False
prime_key = set(ob.osa_k(A[-1]).keys())
break_flag = False
prime_flags = [False] * (10 ** 6 + 1)
for i in range(N):
    for key in ob.osa_k(A[i]).keys():
        if prime_flags[key]:
            break_flag = True
            break
        else:
            prime_flags[key] = True
    if break_flag:
        break
else:
    pairwise = True
if pairwise:
    print('pairwise coprime')
    exit()
work = gcd(A[0], A[1])
for i in range(2, N):
    work = gcd(work, A[i])
if work != 1:
    print('not coprime')
else:
    print('setwise coprime')
### BUGGY CODE ###

import numpy as np
N, M = map(int,input().split())
Ps = np.zeros((M,2))
for i in range(M):
    j, Y = map(int,input().split())
    Ps[i] = [j,Y]

def rank(argsort):
    x = np.zeros(len(argsort))
    for i,s in enumerate(argsort):
        x[s] = i+1
    return list(x)


ranks = []
for i in range(N):
    s = np.argsort(Ps[np.where(Ps[:,0]==i+1)][:,1])
    ranks.append(rank(s))

for index, year in Ps:
    index = int(index)
    print("{:06d}{:06d}".format(index,int(ranks[index-1][0])))
    ranks[index-1].pop(0)

### FIXED CODE ###

from collections import defaultdict
from bisect import bisect_left
N, M = map(int, input().split())
A = []
B = defaultdict(list)
 
for i in range(M):
    p, y = map(int, input().split())
    A.append([p, y])
    B[p].append(y)
 
for key in B.keys():
    B[key].sort()

# print(A,B)
# for a in A:
#     print(a[0],a[1],B[a[0]],bisect_left(B[a[0]],a[1]))
for a in A:
    print("%06d%06d" % (a[0], bisect_left(B[a[0]], a[1])+1))
### BUGGY CODE ###

N,W=map(int,input().split())
lwv=[]
for i in range(N):
    lwv.append(list(map(int,input().split())))
#ldp=[[float("inf") for j in range(10**5+1)] for i in range(N)]
ldp=[[float("inf") for j in range(10**5)] for i in range(N)]
#for j in range(10**5+1):
for j in range(10**5):
    #if lwv[0][1]>=j:
    if lwv[0][1]>=j+1:
        ldp[0][j]=lwv[0][0]
for i in range(1,N):
    #for j in range(10**5+1):
    for j in range(10**5):
        #if j-lwv[i][1]>=0:
            #comp=ldp[i-1][j-lwv[i][1]]+lwv[i][0]
            #ldp[i][j]=min(ldp[i-1][j],ldp[i-1][j-lwv[i][1]]+lwv[i][0])
        #else:
            #ldp[i][j]=ldp[i-1][j]
        #comp=ldp[i-1][j-lwv[i][1]]+lwv[i][0] if j-lwv[i][1]>=0 else lwv[i][0]
        comp=ldp[i-1][j+1-lwv[i][1]-1]+lwv[i][0] if j+1-lwv[i][1]>0 else lwv[i][0]
        ldp[i][j]=min(ldp[i-1][j],comp)
#print(ldp[N-1][90])
#print(ldp[N-1][:91])
#print(ldp[0][:91])
#print(ldp[1][:91])

#for j in range(10**5,0,-1):
for j in range(10**5-1,-1,-1):
    if ldp[N-1][j]<=W:
        #print(j)
        print(j+1)
        break


### FIXED CODE ###

N,W=map(int,input().split())
lw=[]
lv=[]
for i in range(N):
    w,v=map(int,input().split())
    lw.append(w)
    lv.append(v)
ldp=[[float("inf") for j in range(10**5)] for i in range(N)]
for j in range(10**5):
    if lv[0]>=j+1:
        ldp[0][j]=lw[0]
for i in range(1,N):
    for j in range(10**5):
        ldp[i][j]=min(ldp[i-1][j],ldp[i-1][j+1-lv[i]-1]+lw[i] if j+1-lv[i]>0 else lw[i])
for j in range(10**5-1,-1,-1):
    if ldp[N-1][j]<=W:
        print(j+1)
        break
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
n_data = {i: A.count(i) for i in range(1, 10 ** 5 + 1)}
for _ in range(Q):
  b, c = map(int, input().split())
  n_data[c] += n_data[b]
  n_data[b] = 0
  print(sum([k * v for k, v in n_data.items()]))

### FIXED CODE ###

from collections import Counter


N = int(input())
A = list(map(int, input().split()))
Q = int(input())
n_data = Counter(A)
ans = sum(A)
for _ in range(Q):
  b, c = map(int, input().split())
  ans += (c - b) * n_data[b]
  n_data[c] += n_data[b]
  n_data[b] = 0
  print(ans)
### BUGGY CODE ###

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

T = [False]*(10**6+1)
D = [0]*(10**6+1)
for i in A:
    # iの2以上の倍数の値はTrueに
    for j in range(i*2, 10**6+1, i):
        T[j] = True
    # ダブってる値は2以上に
    D[i] += 1

# TがFalseかつDが1の数を数える
ans = 0
for i in A:
    if T[i] == False and D[i] == 1:
        ans += 1

print(ans)

### FIXED CODE ###

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

cnt = [0] * ((10 ** 6) + 1)

for elem in a:
    cnt[elem] += 1

unique = []

for i in range((10 ** 6) + 1):
    if cnt[i] == 1:
        unique.append(i)

cnt = [0] * ((10 ** 6) + 1)

a = list(set(a))

for elem in a:
    for m in range(elem * 2, (10 ** 6) + 1, elem):
        cnt[m] = 1

ans = 0
        
for elem in unique:
    if cnt[elem] == 0:
        ans += 1

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

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

ans = 1
for i in s:
    ans *= i
   
if ans > 10**18:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

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

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

ans = 1
for i in s:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit()

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

import sys
input=sys.stdin.readline

def main():
    N,K = map(int,input().split())
    ans = 0
    if K%2==0:
        a0 = K//2
    else:
        a0 = K
    for a in range(a0, N+1, a0):
        for b in range(K - a%K, N+1, K):
            for c in range(K - a%K, N+1, K):
                if (b+c)%K == 0:
#                    print(a,b,c)
                    ans += 1
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input=sys.stdin.readline

def main():
    N,K = map(int,input().split())
    r1 = 0
    for i in range(1,N+1):
        if i%K == 0:
            r1 += 1
    if K%2 == 1:
        print(r1**3)
    else:
        r2 = 0
        for i in range(1,N+1):
            if i%K == K//2:
                r2 += 1
        print(r1**3+r2**3)
    
if __name__ == '__main__':
    main()
### BUGGY CODE ###

num = int(input())
l = list(map(int,input().split()))
a = 0
for i in l:
    if l.count(i) > 1:
        a = a+1
print('YES') if a == 0 else print('NO')

### FIXED CODE ###

num = int(input())
l = list(map(int,input().split()))
print('NO') if len(l) != len(set(l)) else print('YES')
### BUGGY CODE ###

K, N = map(int, input().split())
mod = 998244353


def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


def H(n, k, mod):
    return cmb(n+k-1, k, mod)

Nmax = 10**5
g1 = [1, 1]
g2 = [1, 1]
inv = [0, 1]

for i in range(2, Nmax+1):
    g1.append((g1[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod//i)) % mod)
    g2.append((g2[-1] * inv[-1]) % mod)

ans = []
for i in range(2, K+2):
    res = 0
    if i % 2 == 1:
        for j in range(i//2+1):
            res += cmb(i//2, j, mod)*2**j*H(K-i//2*2+j, N-j, mod)
            res %= mod
    else:
        for j in range(i//2):
            res += cmb(i//2-1, j, mod)*2**j*H(K-i+1+j, N-j, mod)
            res += cmb(i//2-1, j, mod)*2**j*H(K-i+1+j, N-1-j, mod)
            res %= mod
    ans.append(res)

for elem in ans + ans[-2::-1]:
    print(elem)


### FIXED CODE ###

K, N = map(int, input().split())
mod = 998244353


def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


def H(n, k, mod):
    return cmb(n+k-1, k, mod)

Nmax = 10**5
g1 = [1, 1]
g2 = [1, 1]
inv = [0, 1]

for i in range(2, Nmax+1):
    g1.append((g1[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod//i)) % mod)
    g2.append((g2[-1] * inv[-1]) % mod)

ans = []
for i in range(2, K+2):
    res = 0
    if i % 2 == 1:
        for j in range(i//2+1):
            res += cmb(i//2, j, mod)*2**j*H(K-i//2*2+j, N-j, mod)
            res %= mod
    else:
        for j in range(i//2):
            res += cmb(i//2-1, j, mod)*2**j*H(K-i+1+j, N-j, mod)
            res += cmb(i//2-1, j, mod)*2**j*H(K-i+1+j, N-1-j, mod)
            res %= mod
    ans.append(res)

for elem in ans + ans[-2::-1]:
    print(elem)
### BUGGY CODE ###

import sys
from collections import deque


def bfs(x1, y1, d):
    q = deque([])
    q.append((d, x1, y1))

    while q:
        d, x1, y1 = q.popleft()

        M[x1][y1] = d

        if (x1 == xg - 1) and (y1 == yg - 1):
            print(d)
            return

        for dx, dy in ((0, 1), (1, 0), (0, -1), (-1, 0)):
            for k in range(1, K + 1):
                x2 = x1 + dx * k
                y2 = y1 + dy * k
                # if m[x2][y2] == '@':
                #     break
                # if x2 < 0 or x2 >= H:
                #     break
                # if y2 < 0 or y2 >= W:
                #     break
                # if M[x2][y2] < d + 1:
                #     break
                # if M[x2][y2] == d + 1:
                #     continue

                if (0 <= x2 < H) and (0 <= y2 < W):
                    if (m[x2][y2] == '@') or (M[x2][y2] < d + 1):
                        break
                    elif M[x2][y2] == d + 1:
                        continue

                    q.append((d + 1, x2, y2))
    print(-1)


# for i in range(len(M)):
#     print(M[i])


if __name__ == '__main__':
    H, W, K = map(int, sys.stdin.readline().strip().split())
    xs, ys, xg, yg = map(int, sys.stdin.readline().strip().split())

    m = []
    for _ in range(H):
        m.append(list(map(str, sys.stdin.readline().strip())))

    M = [[float('inf')] * W for _ in range(H)]

    bfs(xs - 1, ys - 1, 0)


### FIXED CODE ###

from collections import deque


def bfs(maze, visited, sy, sx, gy, gx):
    queue = deque([[sy, sx]])
    visited[sy][sx] = 0
    while queue:
        # queueには訪れた地点が入っている。そこから、4方向に移動できるか考え、queueから消す。
        y, x = queue.popleft()  # queueに入っていたものを消す。
        if [y, x] == [gy, gx]:  # もしゴールについていたならば、そのときの手数を出す。
            return visited[y][x]
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            l = 1
            while True:
                new_y, new_x = y + j * l, x + k * l
                if (0 <= new_y < H) and (0 <= new_x < W):
                    if maze[new_y][new_x] == "@":
                        break
                    elif visited[new_y][new_x] == -1:  # まだ来たことない点だったという条件
                        visited[new_y][new_x] = visited[y][x] + 1
                        queue.append([new_y, new_x])  # 新しい点を足す。
                    elif visited[new_y][new_x] < visited[y][x] + 1:
                        break
                else:
                    break
                l += 1
                if l == K + 1:
                    break


H, W, K = map(int, input().split())
# K = min(K, max(H, W))
x1, y1, x2, y2 = map(int, input().split())
x1, y1, x2, y2 = x1 - 1, y1 - 1, x2 - 1, y2 - 1
C = [0] * H
for i in range(H):
    C[i] = str(input())
visited = [[-1] * W for i in range(H)]
bfs(C, visited, x1, y1, x2, y2)
# print(visited)
print(visited[x2][y2])
### BUGGY CODE ###

import math
A,B,N = map(int,input().split())
ans = 0
for i in range(1,N+1):
	num = math.floor((A*i)/B) - A * math.floor(i / B)
	if ans < num:
		ans = num
print(ans)

### FIXED CODE ###

import math
A,B,N = map(int,input().split())
m = min(B-1,N)
num = math.floor((A*m)/B) - A * math.floor(m / B)
print(num)
### BUGGY CODE ###

N = int(input())
A = [int(x) for x in input().split()]

a_b = []
for i in A:
    this_b = []
    this_a = i
    for j in range(59,-1,-1):
        if this_a >= 2**j:
            this_b.append(1)
            this_a -= 2**j
        else:
            this_b.append(0)
    a_b.append(this_b)
    
#print(a_b)

count_a_b = []
for i in range(60):
    count_a_b.append(0)

    
for i in a_b:
    for j in range(len(i)):
        count_a_b[j] += i[j]
#print(count_a_b)

count = 0
for i in range(len(count_a_b)):
    count += (count_a_b[i] * (N-count_a_b[i])) *2**(59-i)
    
print(count%(10**9+7))

### FIXED CODE ###

N = int(input())
A = [int(x) for x in input().split()]

a_b = []
for i in A:
    this_b = []
    this_a = i
    for j in range(59,-1,-1):
        j2 = 2**j
        if this_a >= j2:
            this_b.append(1)
            this_a -= j2
        else:
            this_b.append(0)
    a_b.append(this_b)
    
#print(a_b)

count_a_b = []
for i in range(60):
    count_a_b.append(0)

    
for i in a_b:
    for j in range(len(i)):
        count_a_b[j] += i[j]
#print(count_a_b)

count = 0
for i in range(len(count_a_b)):
    count += (count_a_b[i] * (N-count_a_b[i])) *2**(59-i)
    
print(count%(10**9+7))
### BUGGY CODE ###

import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def reverse(S):
    return S[::-1]

def main():
    S = _S()
    Q = I()
    Querys = [LS() for _ in range(Q)]
    s = S
    rev_flg = -1
    for q in Querys:
        # print(q)
        if q[0]=='1':
            rev_flg *= -1
            # s = reverse(s)
        else:
            ti,fi,ci = q
            # print(ti,fi,ci)
            # print(int(fi)*rev_flg)
            if int(fi)*rev_flg in (1,-2):
                s = s+ci
            else:
                s = ci + s
            # elif int(fi)*rev_flg in (-1,2):
            #     s = ci+s
            # else:
            #     pass

    print(s[::-1] if rev_flg==1 else s)

main()



### FIXED CODE ###

import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    S = _S()
    Q = I()
    Querys = [LS() for _ in range(Q)]
    rev_flg = -1
    dq = collections.deque(S)
    for q in Querys:
        if q[0]=='1':
            rev_flg *= -1
        else:
            ti,fi,ci = q
            if int(fi)*rev_flg in (1,-2):
                dq.append(ci)
            else:
                dq.appendleft(ci)

    print("".join(dq)[::-1] if rev_flg==1 else "".join(dq))

main()
### BUGGY CODE ###

A, B, M = map(int,input().split())

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

x = list()
y = list()
c = list()
for i in range(M):
    xi, yi, ci = map(int,input().split())
    x.append(xi)
    y.append(yi)
    c.append(ci)

p = list()

for i in range(A):
    for j in range(B):
        pij = a[i] + b[j]
        p.append(pij)
        
for i in range(M):
    pi = a[x[i]-1] + b[y[i]-1] - c[i]
    p.append(pi)

print(min(p))


### FIXED CODE ###

A, B, M = map(int,input().split())

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

x = list()
y = list()
c = list()
for i in range(M):
    xi, yi, ci = map(int,input().split())
    x.append(xi)
    y.append(yi)
    c.append(ci)

p = list()

amin = min(a)
bmin = min(b)
pab  = amin + bmin
p.append(pab)
        
for i in range(M):
    pi = a[x[i]-1] + b[y[i]-1] - c[i]
    p.append(pi)

print(min(p))
### BUGGY CODE ###

import copy

n = int(input())
x = [int(num) for num in input().split()]
xs = sorted(x)

for i in range(n):
    xs_ = copy.copy(xs)
    xs_.remove(x[i])
    
    b = xs_[(n//2 - 1)]
    print(b)

### FIXED CODE ###

n = int(input())
x = [int(num) for num in input().split()]
xx = sorted(x)

mid_l = xx[n//2 -1]
mid_r = xx[n//2]

for _ in x:
    if _ <= mid_l:
        print(mid_r)
    else:
        print(mid_l)
### BUGGY CODE ###

from heapq import *
def abc144c():
  n,k=map(int,input().split())
  a=sorted(list(map(int,input().split())))
  f=sorted(list(map(int,input().split())))[::-1]
  q=[] 
  for i,j in zip(a,f):
    heappush(q,(-i*j,j))
  for i in range(k):
    tmp,key=heappop(q)
    heappush(q,(tmp+key,key))
  ans,key=heappop(q)
  print(max(-ans,0))
abc144c()


### FIXED CODE ###

n,k=map(int,input().split())
abilities=sorted(list(map(int,input().split())))
foods=sorted(list(map(int,input().split())),reverse=True)

if sum(abilities)<=k:
  print(0)
  exit()
  
def check(score):
  ret=0
  for a,f in zip(abilities,foods):
    ret+=max(0,(a*f-score+f-1)//f)
  return ret<=k

ok=10**12+1
ng=0
for _ in range(50):
  mid=(ok+ng)//2
  if check(mid):
    ok=mid
  else:
    ng=mid
print(ok)
### BUGGY CODE ###

n = int(input())
arr = list(map(int, input().split(' ')))
ans = 1
for i in arr:
  ans = ans * i
if ans > 1e18:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

def f():
    n = int(input())
    x = int(1e18)
    arr = list(map(int, input().split(' ')))
    arr.sort()
    ans = 1
    for i in arr:
        # print(i)
        ans = ans * i
        if ans > x:
            print(-1)
            return
    print(ans)
f()
### BUGGY CODE ###

from sys import stdin, setrecursionlimit


def main():
    mod = 10 ** 9 + 7
    input = stdin.buffer.readline
    s = list(input()[:-1].decode())
    s.reverse()
    n = len(s)

    p10 = [0] * n
    p10[0] = 1
    for i in range(1, n):
        p10[i] = 10 * p10[i - 1]

    dp = [0] * 13
    if s[0] == '?':
        for i in range(10):
            dp[i % 13] += 1
    else:
        dp[int(s[0]) % 13] += 1

    for i in range(1, n):
        tmp_dp = [0] * 13
        if s[i] == '?':
            for j in range(13):
                for k in range(10):
                    tmp_dp[(k * p10[i] + j) % 13] += dp[j] % mod
        else:
            for j in range(13):
                tmp_dp[(int(s[i]) * p10[i] + j) % 13] += dp[j] % mod
        dp = tmp_dp

    print(dp[5] % mod)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


### FIXED CODE ###

from sys import stdin, setrecursionlimit


def main():
    mod = 10 ** 9 + 7
    input = stdin.buffer.readline
    s = list(input()[:-1].decode())
    n = len(s)

    dp = [0] * 13
    if s[0] == '?':
        for i in range(10):
            dp[i % 13] += 1
    else:
        dp[int(s[0]) % 13] += 1

    for i in range(1, n):
        tmp_dp = [0] * 13
        if s[i] == '?':
            for j in range(13):
                for k in range(10):
                    index = (10 * j + k) % 13
                    tmp_dp[index] += dp[j]
                    tmp_dp[index] %= mod
        else:
            for j in range(13):
                index = (10 * j + int(s[i])) % 13
                tmp_dp[index] += dp[j]
                tmp_dp[index] %= mod
        dp = tmp_dp

    print(dp[5] % mod)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
### BUGGY CODE ###

import numpy as np
N = int(input())
S = input()

l_r = [i for i, s in enumerate(S) if s=='R']
l_g = [i for i, s in enumerate(S) if s=='G']
l_b = [i for i, s in enumerate(S) if s=='B']

ans = 0
for r in l_r:
  for g in l_g:
    for b in l_b:
      li = np.sort(np.array([r, g, b]))
      if abs(li[0]-li[1]) != abs(li[1]-li[2]):
        ans += 1

print(ans)


### FIXED CODE ###

import numpy as np
N = int(input())
S = input()

l_r = set()
l_g = set()
l_b = set()
for i in range(N):
  if S[i]=='R':
    l_r.add(i)
  if S[i]=='G':
    l_g.add(i)
  if S[i]=='B':
    l_b.add(i)

ans = len(l_r)*len(l_g)*len(l_b)

for r in l_r:
  for g in l_g:
    mi = min(r, g)
    ma = max(r, g)
    l = ma - mi
    if ma+l in l_b:
      ans -= 1
    if mi-l in l_b:
      ans -= 1
    if l%2==0 and l//2 + mi in l_b:
      ans -= 1

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

import sys
input=sys.stdin.readline
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
  kk=max(i-k,0)
  dp[i]=min(d+abs(hh-h[i])for d,hh in zip(dp[kk:i],h[kk:i]))
print(dp[n-1])

### FIXED CODE ###

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

K = 10 ** 9 + 7

def pow_K(x, n):
  if n == 0:
    return 1
  else:
    return (pow_K(x, n // 2) ** 2 * x ** (n % 2)) % K

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

fact = [0 for i in range(H+W-1)]
fact[0] = 1
for i in range(H+W-2):
  fact[i + 1] = fact[i] * (i+1) % K
fact_inv = [pow_K(fact[i], K-2) for i in range(H+W-1)]

r = 0
for i in range(B, W):
  r += ((fact[H-A-1+i] * fact_inv[H-A-1] %K)*fact_inv[i] % K) * ((fact[W-1-i+A-1] * fact_inv[W-1-i] %K) * fact_inv[A-1] % K) %K
  r %= K

print(r)


### FIXED CODE ###

K = 10 ** 9 + 7

def pow_K(x, n):
  if n == 0:
    return 1
  else:
    return (pow_K(x, n // 2) ** 2 * x ** (n % 2)) % K

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

fact = [0 for i in range(H+W-1)]
fact[0] = 1
for i in range(H+W-2):
  fact[i + 1] = fact[i] * (i+1) % K
fact_inv = [0 for i in range(H+W-1)]
fact_inv[H+W-2] = pow_K(fact[H+W-2], K-2)
for i in range(H+W-2, 0, -1):
  fact_inv[i-1] = fact_inv[i] * i % K

r = 0
for i in range(B, W):
  r += ((fact[H-A-1+i] * fact_inv[H-A-1] %K)*fact_inv[i] % K) * ((fact[W-1-i+A-1] * fact_inv[W-1-i] %K) * fact_inv[A-1] % K) %K
  r %= K

print(r)