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

import math
(N, M) = map(int, input().split())
TMPM = M

MAX_SQRT = int(math.sqrt(M))
prime_flag = [True] * (MAX_SQRT+1)
primes = []

prime_flag[0] = False
prime_flag[1] = False

for i in range(2, MAX_SQRT+1):
    mul = 2
    while True:
        p = i * mul
        if p > MAX_SQRT:
            break
        prime_flag[p] = False
        mul += 1

for i in range(2, MAX_SQRT+1):
    if prime_flag[i]:
        while M%i == 0:
            primes.append(i)
            M = int(M/i)

if M > 1:
    primes.append(M)


def CalcMulti(primes, flags):
    mul = 1
    for i in range(len(primes)):
        if flags[i] == True:
            mul *= primes[i]
    return mul

max_mul = 1
def Rec(primes, p, flags):
    global max_mul
    if p >= len(primes):
        mul = CalcMulti(primes, flags)
        if TMPM//mul >= N and mul > max_mul:
            max_mul = mul
    else:
        flags[p] = False
        Rec(primes, p+1, flags)
        flags[p] = True
        Rec(primes, p+1, flags)


flags = [False] * len(primes)
Rec(primes, 0, flags)
print(max_mul)



### FIXED CODE ###

import math
(N, M) = map(int, input().split())

MAX_SQRT = int(math.sqrt(M))
prime_flag = [True] * (MAX_SQRT+1)
prime_dic = {}

prime_flag[0] = False
prime_flag[1] = False

for i in range(2, MAX_SQRT+1):
    mul = 2
    while True:
        p = i * mul
        if p > MAX_SQRT:
            break
        prime_flag[p] = False
        mul += 1

TMPM = M
for i in range(2, MAX_SQRT+1):
    if prime_flag[i]:
        while TMPM%i == 0:
            if i in prime_dic:
                prime_dic[i] += 1
            else:
                prime_dic[i] = 1
            TMPM = int(TMPM/i)

if TMPM > 1 or len(prime_dic) == 0:
    prime_dic[TMPM] = 1

max_mul = 1
def Rec(mul, p):
    global max_mul
    if M//mul < N:
        return

    if p >= len(prime_dic):
        if mul > max_mul:
            max_mul = mul
        return

    k = list(prime_dic.keys())[p]
    v = list(prime_dic.values())[p]
    for i in range(v+1):
        Rec(mul*(k**i), p+1)

Rec(1, 0)
print(max_mul)
### BUGGY CODE ###

from fractions import gcd

M = (10 ** 9 + 7)

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

lcm_ = A[0]
for a in A[1:]:
    lcm_ = lcm_ * a // gcd(lcm_, a)
 
ans = 0
for a in A:
    ans = (ans + lcm_ // a) % M
 
print(ans)

### FIXED CODE ###

from fractions import gcd

M = 10 ** 9 + 7

def xgcd(a, b):
    x0, x1 = 1, 0
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
    return x0 % M

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

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

ans = 0
for a in A:
    m = xgcd(a, M)
    ans = ans + lcm_ * m

print(ans % M)
### BUGGY CODE ###

import heapq
import copy


def dijkstra(adj, start):
    # adj: [[to, cost] * vertices], 0th index must be empty
    prev = [0] * len(adj)
    dist = [float('inf')] * len(adj)
    dist[start] = 0
    q = []
    heapq.heappush(q, [0, start])
    while q:
        min_dist, v_from = heapq.heappop(q)
        if min_dist > dist[v_from]:
            continue
        v_tos = adj[v_from]
        for v_to in v_tos:
            if min_dist + v_to[1] < dist[v_to[0]]:
                dist[v_to[0]] = min_dist + v_to[1]
                prev[v_to[0]] = v_from
                heapq.heappush(q, [dist[v_to[0]], v_to[0]])
    return dist, prev


N, M = map(int, input().split())
adj = [[] for _ in range(N + 1)]
for _ in range(M):
    A, B = map(int, input().split())
    adj[A].append([B, 1])

ans_best = []
len_ans = N+1
flg = 1
see = [0] * (N + 1)
for start in range(1, N+1):
    if flg == 0:
        if see[start] == 0:
            continue
    ans = []
    adj_new = copy.deepcopy(adj)
    adj_new.append(adj[start])
    dist, prev = dijkstra(adj_new, N + 1)
    if dist[start] < 10 ** 10:
        k = start
        while k != N + 1:
            ans.append(k)
            k = prev[k]
        if len(ans) < len_ans:
            ans_best = ans
            len_ans = len(ans)
            if flg:
                for a in ans:
                    see[a] = 1
                flg = 0

if len_ans == N+1:
    print(-1)
else:
    print(len_ans)
    for a in ans_best:
        print(a)


### FIXED CODE ###

import heapq


def dijkstra(adj, start):
    # adj: [[to, cost] * vertices], 0th index must be empty
    prev = [0] * len(adj)
    dist = [float('inf')] * len(adj)
    dist[start] = 0
    q = []
    heapq.heappush(q, [0, start])
    while q:
        min_dist, v_from = heapq.heappop(q)
        if min_dist > dist[v_from]:
            continue
        v_tos = adj[v_from]
        for v_to in v_tos:
            if min_dist + v_to[1] < dist[v_to[0]]:
                dist[v_to[0]] = min_dist + v_to[1]
                prev[v_to[0]] = v_from
                heapq.heappush(q, [dist[v_to[0]], v_to[0]])
    return dist, prev


N, M = map(int, input().split())
adj = [[] for _ in range(2 * N + 1)]
flg = 1
see = [0] * (N + 1)
for _ in range(M):
    A, B = map(int, input().split())
    adj[A].append([B, 1])
    adj[A].append([B + N, 1])

ans_best = []
len_ans = N+1
for start in range(1, N+1):
    if flg == 0:
        if see[start] == 0:
            continue
    ans = []
    dist, prev = dijkstra(adj, start)
    if dist[start + N] < 10 ** 10:
        k = start + N
        while k != start:
            k = prev[k]
            ans.append(k)
        if len(ans) < len_ans:
            ans_best = ans
            len_ans = len(ans)
            if flg:
                for a in ans:
                    see[a] = 1
                flg = 0

if len_ans == N+1:
    print(-1)
else:
    print(len_ans)
    for a in ans_best:
        print(a)
### BUGGY CODE ###

import math
from functools import reduce
 
def gcd_list(a,b,c):
    return reduce(math.gcd, [a,b,c])
 
n = int(input())
cnt = 0
for i in range(1,n + 1):
    for j in range(1,n + 1):
        for k in range(1,n + 1):
            
            cnt += gcd_list(i,j,k)
print(cnt)

### FIXED CODE ###

import math
from functools import reduce

def gcd_list(a,b,c):
    return reduce(math.gcd, [a,b,c])

n = int(input())
cnt = 0
for i in range(1,n + 1):
    for j in range(1,n + 1):
        for k in range(1,n + 1):
            
            cnt += gcd_list(i,j,k)
print(cnt)
### BUGGY CODE ###

def plus_and_check(list):
    sum_up = sum(list)
    i = 0
    while i < 8:
        number_1 = 10 * i
        number_2 = 10 * (i+1)
        if number_2  > sum_up and number_1 < sum_up:
            break
        else:
            continue
        i = i + 1
    return i

l = map(int, raw_input().split())
print "%d" % plus_and_check(l)

### FIXED CODE ###

import sys

a = []
answer_array = []
for line in sys.stdin:
    a.append(map(int, line.strip().split()))
    #except StopIteration:
        #break

for i in range(len(a)):
    sum_up = a[i][0] + a[i][1]

    answer = len(str(sum_up))

    answer_array.append(answer)

for j in range(len(answer_array)):
    print answer_array[j]
### BUGGY CODE ###

import sys
import os
import copy


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.readline().rstrip())
    A = [int(sys.stdin.readline().rstrip()) for _ in range(N)]

    for n in range(N):
        ary = copy.copy(A)
        ary.pop(n)
        print(max(ary))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import os
import copy

def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.readline().rstrip())
    A = [int(sys.stdin.readline().rstrip()) for _ in range(N)]
    B = copy.copy(A)
    A.sort(reverse=True)
    f = A[0]
    s = A[1]

    for n in range(N):
        t = B[n]
        if f == t:
            print(s)
        else:
            print(f)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

def bSort(a):
    for i in range(len(a)):
        for j in range(len(a)-1, i, -1):
            if a[j][1] < a[j-1][1]:
                a[j], a[j-1] = a[j-1], a[j]
    return a


N = int(input())
ab = [list(map(int, input().split())) for i in range(N)]
ab = bSort(ab)
for i in range(N):
    for j in range(i, N):
        ab[j][1] -= ab[i][0]
        if ab[j][1] < 0:
            print("No")
            exit()
print("Yes")


### FIXED CODE ###

N = int(input())
ab = [[0, 0]] + [list(map(int, input().split())) for i in range(N)]
ab = sorted(ab, key=lambda x: x[1])
for i in range(len(ab) - 1):
    ab[i + 1][0] += ab[i][0]
    if ab[i + 1][1] < ab[i + 1][0]:
        print("No")
        exit()

print("Yes")
### BUGGY CODE ###

# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
A = np.array(lr() + [0])
# ある回数から先は全ての電球にNを足す
for _ in range(min(K, 10 ** 2)):
    next = np.array([0] * (N+1))
    for i in range(N):
        x = A[i]
        next[max(0, i-x)] += 1
        next[min(N-1, i+x)+1] -= 1
    A = next.cumsum()

print(*A[:-1])

### FIXED CODE ###

# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
A = lr() + [0]
# ある回数から先は全ての電球にNを足す
for _ in range(min(K, 41)):
    next = [0] * (N+1)
    for i in range(N):
        x = A[i]
        next[max(0, i-x)] += 1
        next[min(N-1, i+x)+1] -= 1
    for i in range(N):
        next[i+1] += next[i]
    A = next.copy()

print(*A[:-1])
### BUGGY CODE ###

import heapq
import math
#これを加える！！！！
def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt

"""
a = [1,7,3,5,4]

#heapify
#配列a = [1,7,3,5,4]をheapにする
heapq._heapify_max(a)
print(a) #[7, 5, 3, 1, 4]

#heappop
#最大値の取り出し
print(_heappop_max(a)) #7
print(a) #[5, 4, 3, 1]

#heappush
#要素(2)の挿入
_heappush_max(a,2)
print(a) #[5, 4, 3, 1, 2]

#最大値の取り出し
print(_heappop_max(a)) #5
"""

N, M = map(int, input().split())
a = [int(i) for i in input().split()]
b = a[:N]
heapq._heapify_max(b)

okaiage = []
heapq._heapify_max(okaiage)
_heappush_max(okaiage, _heappop_max(b)/2)

m = M - 1
for j in range(N-1):
    temp_oka = _heappop_max(okaiage)
    temp_a = _heappop_max(b)
    if m > 0:
        if temp_a > temp_oka:
            _heappush_max(okaiage, temp_a/2)
            _heappush_max(okaiage, temp_oka)
        else:
            _heappush_max(okaiage, temp_a)
            _heappush_max(okaiage, temp_oka/2)
    else:
        _heappush_max(okaiage, temp_a)
        _heappush_max(okaiage, temp_oka)
    m -= 1
if m > 0:
    for i in range(m):
        temp_oka = _heappop_max(okaiage) / 2
        _heappush_max(okaiage, temp_oka)
okaiage_kiri = [int(math.floor(_heappop_max(okaiage))) for i in range(N)]
print(sum(okaiage_kiri))


### FIXED CODE ###

import heapq
import math
#これを加える！！！！
def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt

"""
a = [1,7,3,5,4]

#heapify
#配列a = [1,7,3,5,4]をheapにする
heapq._heapify_max(a)
print(a) #[7, 5, 3, 1, 4]

#heappop
#最大値の取り出し
print(_heappop_max(a)) #7
print(a) #[5, 4, 3, 1]

#heappush
#要素(2)の挿入
_heappush_max(a,2)
print(a) #[5, 4, 3, 1, 2]

#最大値の取り出し
print(_heappop_max(a)) #5
"""

N, M = map(int, input().split())
a = [int(i) for i in input().split()]
heapq._heapify_max(a)

for j in range(M):
    _heappush_max(a, _heappop_max(a)//2)
print(sum(a))
### BUGGY CODE ###

s = input()
v = s
n = 10**5
for i in range(n//2+1):
    s = s.replace('01','').replace('10','')
    if len(set(s)) <= 1:
        break

print(len(v) - len(s))
    


### FIXED CODE ###

s  = input()

one = len([i for i in s if i == '1'])
zero = len(s)- one

print(2*min(one,zero))
### BUGGY CODE ###

import itertools


def main():
    N, M = list(map(int, input().split(' ')))
    cakes = [list(map(int, input().split(' '))) for _ in range(N)]
    ans = 0
    for sign in itertools.product([-1, 1], repeat=3):
        dp = [[0 for _ in range(M + 1)] for _ in range(N + 1)]
        for n in range(N):
            cake_score = sum([s * c for s, c in zip(sign, cakes[n])])
            for m in range(M + 1):
                if m - 1 >= 0:
                    dp[n + 1][m] = max([dp[n][m], dp[n][m - 1] + cake_score])
                else:
                    dp[n + 1][m] = dp[n][m]
        ans = max([ans, dp[N][M]])
    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

import itertools


def main():
    N, M = list(map(int, input().split(' ')))
    cakes = [list(map(int, input().split(' '))) for _ in range(N)]
    ans = 0
    for sign in itertools.product([-1, 1], repeat=3):
        scores = [sum([s * c for s, c in zip(sign, cake)]) for cake in cakes]
        scores.sort(reverse=True)
        ans = max([ans, sum(scores[:M])])
    print(ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

#!/usr/bin/env python3
#EDPC P

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
graph = [[] for _ in range(n)]
for _ in range(n-1):
    x,y = LI()
    graph[x-1].append(y-1)
    graph[y-1].append(x-1)

dp = [[1,1] for _ in range(n)]
flg = [0]*n
def f(v):
    flg[v] = 1
    for u in graph[v]:
        if flg[u]:
            continue
        f(u)
        w,b = dp[u]
        dp[v][0] *= (w+b)
        dp[v][0] %= mod
        dp[v][1] *= w
        dp[v][1] %= mod

f(0)
ans = (dp[0][0] + dp[0][1]) % mod
print(ans)

### FIXED CODE ###

#!/usr/bin/env python3
#EDPC P

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
graph = [[] for _ in range(n)]
for _ in range(n-1):
    x,y = LI()
    graph[x-1].append(y-1)
    graph[y-1].append(x-1)

dp = [[1,1] for _ in range(n)]
flg = [0]*n
def f(v):
    flg[v] = 1
    for u in graph[v]:
        if flg[u]:
            continue
        f(u)
        dp[v][0] *= (dp[u][0]+dp[u][1])
        dp[v][0] %= mod
        dp[v][1] *= dp[u][0]
        dp[v][1] %= mod

f(0)
ans = (dp[0][0] + dp[0][1]) % mod
print(ans)
### BUGGY CODE ###

# coding: utf-8
# Your code here!

from collections import defaultdict

R, G, B, N = map(int, input().rstrip().split(' '))
A = [R, G, B]

dp = defaultdict(lambda: defaultdict(lambda: -1))
def rec(i, n):
    if dp[i][n] != -1:
        return dp[i][n]
    if n == 0:
        return 1
    if i > 2:
        return 0
        
    #print(i, n)
        
    temp = 0
    for j in range(n // A[i] + 1):
        temp += rec(i + 1, n - j * A[i])
        
    dp[i][n] = temp
    
    return temp
    
print(rec(0, N))

### FIXED CODE ###

# coding: utf-8
# Your code here!

from collections import defaultdict

R, G, B, N = map(int, input().rstrip().split(' '))
A = [R, G, B]

dp = defaultdict(lambda: defaultdict(lambda: -1))
def rec(i, n):
    if dp[i][n] != -1:
        return dp[i][n]
    if n == 0:
        return 1
    if i == 2:
        return n % A[2] == 0
       
    temp = 0
    for j in range(n // A[i] + 1):
        temp += rec(i + 1, n - j * A[i])
        
    dp[i][n] = temp
    
    return temp
    
print(rec(0, N))
### BUGGY CODE ###

import re
# パターンにマッチしたすべてをリストとして返す
N,Q =map(int,input().split())
S = input()
List=[[int(j) for j in input().split()] for i in range(1,Q+1)]
for i in range(Q):
    matchedList = re.findall(r"AC",S[List[i][0]-1:List[i][1]])
    print(len(matchedList))

### FIXED CODE ###

#122 C
N,Q= map(int,input().split())
S=input()
ans=[0]*(N+1)

for i in range(2,N+1):
    ans[i]=ans[i-1]
    if S[i-2:i]=='AC':
        ans[i]+=1
    
for i in range(Q):
    l,r=map(int,input().split())
    print(ans[r]-ans[l])
### BUGGY CODE ###

n = int(input())
lst = []
for _ in range(n):
  lst.append(int(input()))
for i in range(n):
  left = lst[:i]
  right = lst[i+1:]
  temp = left+right
  print(max(temp))

### FIXED CODE ###

import numpy as np

n = int(input())
lst = []
for _ in range(n):
  lst.append(int(input()))
max_idx = np.argmax(lst)
max_ = lst[max_idx]
lst[max_idx] = 0
next_max_ = max(lst)

for i in range(len(lst)):
  if i == max_idx:
    print(next_max_)
  else:
    print(max_)
### BUGGY CODE ###

from math import sqrt, sin, cos, pi
import time
import numpy as np

def main():
    N,L = map(int, input().split())
    t = [int(input()) for i in range(N)]
    #N,L = 3000, 3000
    #t = [int(i) for i in range(N)]

    comb = N * (N-1) * (N-2) / 6
    ans_X, ans_Y = 0, 0
    for i in range(N-1):
        for j in range(i+1,N):
            theta = pi * (t[j] + t[i]) / L

            I_X = cos(theta) * (N - 2*(j-i))
            I_Y = sin(theta) * (N - 2*(j-i))
            ans_X += I_X / comb
            ans_Y += I_Y / comb
            #print(ans_X, ans_Y)
    
    print(ans_X, ans_Y)


if __name__ == "__main__":
    #start = time.time()
    main()
    #elapsed_time = time.time() - start
    #rint ("elapsed_time:{0}".format(elapsed_time) + "[sec]")


### FIXED CODE ###

from math import sqrt, sin, cos, pi
import time

def main():
    N,L = map(int, input().split())
    t = [int(input()) for i in range(N)]
    #N,L = 3000, 3000
    #t = [int(i) for i in range(N)]

    comb = N * (N-1) * (N-2) / 6
    ans_X, ans_Y = 0, 0
    for i in range(N-1):
        for j in range(i+1,N):
            theta = pi * (t[j] + t[i]) / L

            I_X = cos(theta) * (N - 2*(j-i))
            I_Y = sin(theta) * (N - 2*(j-i))
            ans_X += I_X / comb
            ans_Y += I_Y / comb
            #print(ans_X, ans_Y)
    
    print(ans_X, ans_Y)


if __name__ == "__main__":
    #start = time.time()
    main()
    #elapsed_time = time.time() - start
    #rint ("elapsed_time:{0}".format(elapsed_time) + "[sec]")
### BUGGY CODE ###

N,K = list(map(int,input().split()))
PRR = list(map(int,input().split()))


def calculate(n, k, prr):

    maxSum = 0
    for i in range(n-k+1):
        sum = 0
        for j in range(k):
            sum = sum + (prr[i+j])

        if sum > maxSum:
            maxSum = sum


    print((k+maxSum)/2)


calculate(N, K, PRR)


### FIXED CODE ###

N,K = list(map(int,input().split()))
PRR = list(map(int,input().split()))

# N = 10
# K = 4
# PRR = [17, 13, 13, 12, 15, 20, 10, 13, 17, 11]
#
# N = 5
# K = 3
# PRR = [1, 2, 2, 4, 5]

def calculate(n, k, prr):

    sumarr = []
    for i in range(n):
        if len(sumarr) == 0:
            sumarr.append(prr[0])
        else:
            sumarr.append(sumarr[-1] + prr[i])

    maxSum = []

    for i in range(k-1,n):

        if i - k < 0:
            sss = sumarr[i] - 0
        else:
            sss = sumarr[i] - sumarr[i - k]
        maxSum.append(sss)

    print((k+max(maxSum))/2)


calculate(N, K, PRR)
### BUGGY CODE ###

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

x = 1
for i in range(n):
    if 0 in a:
        x = 0
        break
    else:
        x *= a[i]
    
if x > 10**18:
    print(-1)
else:
    print(x)


### FIXED CODE ###

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

x = 1
flag = False
INF = 10**18
if 0 in a:
    print(0)
else:
    for i in range(n):
        if flag == False:
            x *= a[i]
        if x > INF:
            flag = True
    
    if flag:
        print(-1)
    else:
        print(x)
### BUGGY CODE ###

N = int(input())
P = list(map(int, input().split()))
ans = 0

for i in range(N):
  flag = 1
  for j in range(i):
    if P[i] > P[j]:
      flag = 0
      break
  if flag == 1:
    ans += 1
    
print(ans)

### FIXED CODE ###

N = int(input())
P = list(map(int, input().split()))
ans = 0
min_number = 2*10**5+1

for i in range(N):
  min_number = min(min_number, P[i])
  if min_number == P[i]:
    ans += 1
  
print(ans)
### BUGGY CODE ###

N = int(input())
S= input()
ret = 0
count = 0
R,G,B = [],[],[]
for i in S:
    if i == 'R':
        R.append(count)
    elif i == 'G':
        G.append(count)
    else:
        B.append(count)
    count += 1

for r in R:
    for g in G:
        i = min(r,g)
        j = max(r,g)
        for b in B:
            if i < b < j and b != (i+j)/2:
                ret +=1
            if j < b and b != 2*j -i:
                ret +=1
            if b < i and b != 2*i-j:
                ret += 1
print(ret)

### FIXED CODE ###

N = int(input())
S= input()
sub = 0
R,G,B = [],[],[]
r = S.count('R')
g = S.count('G')
b = S.count('B') 
for i in range(N):
    for j in range(i+1,N):
        if 2*j-i > N-1:
            break
        if S[i] != S[j] and S[2*j-i] != S[i] and S[2*j-i] != S[j]:
            sub += 1
ans = r*g*b -sub
print(ans)
### BUGGY CODE ###

ab = lambda a,b:abs(a-b)
area = lambda a,b:ab(a[1],b[1])*ab(a[0],b[0])

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

x_lst.sort()
y_lst.sort()
mn = float('INF')
for x in range(N-1):
    for x_ in range(x,N):
        for y in range(N-1):
            for y_ in range(y,N):
                cnt = 0
                for a,b in A:
                    if x_lst[x] <= a <= x_lst[x_] and y_lst[y] <= b <= y_lst[y_]:
                        cnt += 1
                if cnt >= K:
                    mn = min(mn, area([x_lst[x],y_lst[y]], [x_lst[x_], y_lst[y_]]))
print(mn)


### FIXED CODE ###

ab = lambda a,b:abs(a-b)
area = lambda a,b:ab(a[1],b[1])*ab(a[0],b[0])

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

x_lst.sort()
y_lst.sort()
mn = float('INF')
for x in range(N-1):
    for x_ in range(x,N):
        for y in range(N-1):
            for y_ in range(y,N):
                cnt = 0
                for a,b in A:
                    if x_lst[x] <= a <= x_lst[x_] and y_lst[y] <= b <= y_lst[y_]:
                        cnt += 1
                if cnt >= K:
                    mn = min(mn, area([x_lst[x],y_lst[y]], [x_lst[x_], y_lst[y_]]))
print(mn)
### BUGGY CODE ###

S=input()

N=len(S)
M=[]
for s in S:
    if s == 'R':
        M.append(1)
    else:
        M.append(-1)


def move(C):
    D=[0] * N
    for i in range(N):
        D[i+M[i]] += C[i]
    return D


c=[1] * N
even_c = [0] * N

i=0
while True:
    d = move(c)
    if i%2 == 0:
        if c == even_c:
            break
        even_c = c
    c = d
    i+=1

for c in even_c:
    print(str(c)+' ',end='')
print()

### FIXED CODE ###

S=input()

N=len(S)
RLs=[]
Rs=[]
Ls=[]

rlen=0
llen=0
for i in range(N):

    if S[i]=='R':
        rlen+=1
        if S[i:i+2] == 'RL':
            RLs.append(i)
            Rs.append(rlen)
            rlen=0
    elif S[i]=='L':
        llen+=1
        if i==N-1 or S[i:i+2] == 'LR':
            Ls.append(llen)
            llen=0

ans = [0]*N
for i,rlpos in enumerate(RLs):
    rr=-(-Rs[i]//2)
    rl=Rs[i]//2

    lr=Ls[i]//2
    ll=-(-Ls[i]//2)

    ans[rlpos]+=rr+lr
    ans[rlpos+1]+=rl+ll

for a in ans:
    print(str(a)+' ',end='')
print()