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

N, Q = [int(v) for v in input().split()]
S = input()
for i in range(Q):
    l, r = [int(v) for v in input().split()]
    print(S[l - 1: r].count('AC'))


### FIXED CODE ###

N, Q = [int(v) for v in input().split()]
S = input()

cnt_list = [0] * len(S)
i = 0
for i in range(1, len(S)):

    cnt_list[i] = cnt_list[i - 1]
    if S[i - 1] == 'A' and S[i] == 'C':
        cnt_list[i] += 1

# print(cnt_list)
for i in range(Q):
    l, r = [int(v) for v in input().split()]
    print(cnt_list[r-1] - cnt_list[l-1])
### BUGGY CODE ###

N,M = map(int,input().split())
AC = 0
WA = 0
lis_ac = []
dic_wa ={}
if M == 0:
  print(0,0)
else:
  A = [list(input().split()) for i in range(M)]
  for i in range(M):
    if A[i][0] not in lis_ac:
      if A[i][1] == 'AC':
        lis_ac.append(A[i][0])
        if A[i][0] in dic_wa.keys():
          WA += dic_wa[A[i][0]]
      elif A[i][0] in dic_wa.keys():
        dic_wa[A[i][0]] += 1
      else:
        dic_wa[A[i][0]] = 1
  print(len(lis_ac), WA)


### FIXED CODE ###

N,M = map(int,input().split())
AC = 0
WA = 0
lis = [0] * N
for i in range(M):
  a,b = input().split()
  if lis[int(a)-1] < 0:
    pass
  elif b == 'AC':
    WA += lis[int(a)-1]
    AC += 1
    lis[int(a)-1] = -1
  else:
    lis[int(a)-1] += 1
print(AC, WA)
### BUGGY CODE ###

s = input()
t = input()
LENs = len(s)
LENt = len(t)
dp = [[0 for i in range(LENt+1)] for j in range(LENs+1)]
for i in range(LENs+1):
    for j in range(LENt+1):
        if i+1 <= LENs:
            dp[i+1][j] = max(dp[i+1][j],dp[i][j])
        if j+1 <= LENt:
            dp[i][j+1] = max(dp[i][j+1],dp[i][j])
        if i+1 <= LENs and j+1<=LENt:
            if s[i] == t[j]:
                dp[i+1][j+1] = dp[i][j]+1

ans = ''
x = LENs
y = LENt
while True:
    if len(ans)==dp[-1][-1]:
        break
    if dp[x-1][y] == dp[x][y-1]:
        if dp[x-1][y-1] < dp[x][y]:
            ans = ans+s[x-1]
            x = x-1
            y = y-1
            continue
        else:
            x = x-1
            continue
    elif dp[x-1][y] < dp[x][y-1]:
        y = y-1
    elif dp[x-1][y] < dp[x][y-1]:
        x = x-1

print(ans[::-1])

### FIXED CODE ###

s = input()
t = input()
LENs = len(s)
LENt = len(t)
dp = [[0 for i in range(LENt+1)] for j in range(LENs+1)]
for i in range(LENs+1):
    for j in range(LENt+1):
        if i+1 <= LENs:
            dp[i+1][j] = max(dp[i+1][j],dp[i][j])
        if j+1 <= LENt:
            dp[i][j+1] = max(dp[i][j+1],dp[i][j])
        if i+1 <= LENs and j+1<=LENt:
            if s[i] == t[j]:
                dp[i+1][j+1] = dp[i][j]+1

ans = ''
x = LENs
y = LENt
while True:
    if len(ans)==dp[-1][-1]:
        break
    if dp[x-1][y] ==dp[x][y]:
        x = x-1
    elif dp[x][y] == dp[x][y-1]:
        y = y-1
    elif dp[x-1][y-1]+1== dp[x][y]:
        ans =s[x-1] + ans
        x = x-1
        y = y-1
        continue
#     elif dp[x-1][y] == dp[x][y-1]:
#         x = x-1

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

def bubble_sort_revision(target_list):

    list_length = len(target_list)
    
    flag = True
    change_count = 0
    for top_index in range(1,list_length):
        for i in range(top_index, list_length)[::-1]:
            if target_list[i] < target_list[i - 1] and target_list[top_index] >= target_list[i]:
                tmp = target_list[i]
                target_list[i] = target_list[i - 1]
                target_list[i - 1] = tmp
                change_count += 1
    return change_count
if __name__ == "__main__":
    l = input()
    target_list = [int(i) for i in input().split()]
    print(bubble_sort_revision(target_list))

### FIXED CODE ###

def bubble_sort_revision(target_list):#?????????????????????

    list_length = len(target_list)
    
    flag = True
    change_count = 0
    
    for top_index in range(1,list_length):
        for i in range(top_index, list_length)[::-1]:
            if target_list[i] < target_list[i - 1] and target_list[top_index] >= target_list[i]:
                tmp = target_list[i]
                target_list[i] = target_list[i - 1]
                target_list[i - 1] = tmp
                change_count += 1
                
    return change_count

def my_add(bit, i, x):
    while i <= len(bit) - 1:
        bit[i] += x
        i += int(bin(i & -i), 2)
        
def my_sum(bit, i):
    s = 0
    while i > 0:
        s += bit[i]
        i -= int(bin(i & -i), 2)
    return s

def merge(l,r):
    global count
    l_index = 0
    r_index = 0
    merge_list = []
    l.append(pow(10,9) + 1)
    r.append(pow(10,9) + 1)

    len_l = len(l) - 1
    for k in range(len(l) + len(r) - 2):
        if l[l_index] < r[r_index]:
            merge_list.append(l[l_index])
            l_index += 1
            len_l -= 1
        else:
            count += len_l
            merge_list.append(r[r_index])
            r_index += 1

    return merge_list
    
def merge_sort(target_list):
    if len(target_list) == 1:
        return target_list
    
    mid = int(len(target_list) / 2)
    
    r = merge_sort(target_list[mid:])
    l = merge_sort(target_list[:mid])
    
    return merge(l, r)

def bit_solve(n, target_list):#???????????§????????????bit?????§?????????????????????
    bit = [0 for i in range(max(target_list) + 2)]
    ans = 0
    for i in range(n):
        ans += i - my_sum(bit, target_list[i] + 1)
        my_add(bit, target_list[i] + 1, 1)
        print(ans, target_list[i], bit)
    return ans

if __name__ == "__main__":
    global count
    count = 0
    l = int(input())
    target_list = [int(i) for i in input().split()]
    merge_sort(target_list)
    print(count)
### BUGGY CODE ###

def isP(n):
	for i in prime:
		if i >= n:
			break
		if n%i == 0:
			return False
	return True

r = int(10000001**0.5)
s = int(r**0.5)
p = [1]*r
p[0] = p[1] = 0
for i in range(2,s):
	if p[i]:
		p[2*i::i] = [0 for x in range(2*i,r,i)]
prime = []
for i in range(r):
	if p[i]:
		prime.append(i)

while 1:
	try:
		n = input()
		if n == 0: break
		i = n-(1-n%2)
		while i > 12:
			p6 = isP(i-6)
			if not isP(i-8) or not isP(i-2):
				if not p6:
					i -= 10
				else:
					i -= 4
				continue
			if isP(i) and p6:
				print i
				break
			i -= 2
	except:
		break

### FIXED CODE ###

ref = [[[10,8],[4,4]],[[10,2],[4,2]]]
r =10000001
p = [1]*r
p[0]= p[1] = 0
for i in range(int(r**0.5)):
	if p[i]:
		p[2*i::i] = [0]*len(p[2*i::i])
		
while 1:
	try:
		n = input()
		if n == 0: break
		n -= 1-n%2
		while any(not p[n-i] for i in [0,2,6,8]):
			n -= ref[p[n-2]][p[n-6]][p[n-8]]
		print n
	except:
		pass
### BUGGY CODE ###

N, W = map(int, input().split())
WV = [list(map(int, input().split())) for i in range(N)]
DP = [[0] * (W+1) for i in range(N+1)]
for n in range(1,N+1):
  wn, vn = WV[n-1]
  for w in range(1,W+1):
    if w >= wn:
      DP[n][w] = max(DP[n-1][w-wn] + vn, DP[n-1][w])
    else:
      DP[n][w] = DP[n-1][w]
print(DP[N][W])

### FIXED CODE ###

import sys
input = sys.stdin.readline
import numpy as np
N, W = map(int, input().split())
dp = np.zeros(W+1, dtype=np.int)
for n in range(1,N+1):
  wn, vn = map(int, input().split())
  dp[wn:]=np.maximum(dp[wn:], dp[:-wn]+vn)
print(dp[W])
### BUGGY CODE ###

N = int(input())
L = sorted([int(i) for i in input().split()])
ans = 0
for i,l in enumerate(L):
    for ii,m in enumerate(L[i+1:-1]):
        for n in L[i+ii+2:]:
            if l + m <= n:
                break
            else:
                ans += 1
print(ans)

### FIXED CODE ###

N = int(input())
L = sorted([int(i) for i in input().split()])
from bisect import bisect_left
ans = 0
for i1,a in enumerate(L):
    L_temp = L[i1+1:]
    for i2,b in enumerate(L_temp):
        L_temp2 = L_temp[i2+1:]
        #print(a,b,L_temp2,bisect_left(L_temp2,a+b),a+b,len(L_temp2) - bisect_left(L_temp2,a+b))
        ans += bisect_left(L_temp2,a+b)
print(ans)
### BUGGY CODE ###

import copy

H,N=map(int,input().split())
A=[]
B=[]
for _ in range(N):
    a,b=map(int,input().split())
    A.append(copy.copy(a))
    B.append(copy.copy(b))


inf=float('inf')
component=[0]
for i in range(H):
    component.append(inf)
DP=[]
for j in range(N+1):
    DP.append(copy.copy(component))#DPは(N+1)×(H+1)


for k in range(1,N+1):#k番目の魔法
    for l in range(1,H+1):#体力H
        DP[k][l]=min(DP[k-1][l],DP[k][max(0,l-A[k-1])]+B[k-1])

print(DP[N][H])










### FIXED CODE ###

H,N=map(int,input().split())
A=[]
B=[]
for _ in range(N):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)


inf=float('inf')
component=[0]
for i in range(H):
    component.append(inf)
DP=[]
for j in range(N+1):
    DP.append(component)#DPは(N+1)×(H+1)


for k in range(1,N+1):#k番目の魔法
    for l in range(1,H+1):#体力H
        DP[k][l]=min(DP[k-1][l],DP[k][max(0,l-A[k-1])]+B[k-1])

print(DP[N][H])
### BUGGY CODE ###

import sys
n = int(input())
D = {}
for i in [0,n-1]:
    print(i,flush=True)
    s = input()
    if s == "Vacant":
        sys.exit()
    D[i] = s
inf = 0
sup = n-1
k = 25
while k:
    mid = (sup+inf)//2
    k -= 1
    print(mid,flush=True)
    s = input()
    if s == "Vacant":
        sys.exit()
    else:
        D[mid] = s
        if D[inf] != D[mid] and (mid-1-inf)&1:
            sup = mid-1
        else:
            inf = mid+1

### FIXED CODE ###

import sys
n = int(input())
D = {}
for i in [0,n-1]:
    print(i,flush=True)
    s = input()
    if s == "Vacant":
        sys.exit()
    D[i] = s
inf = 0
sup = n
while True:
    mid = (sup+inf)//2
    print(mid,flush=True)
    s = input()
    if s == "Vacant":
        sys.exit()
    else:
        D[mid] = s
        if ((mid%2==inf%2) != (D[mid] == D[inf])):
            sup = mid
        else:
            inf = mid
### BUGGY CODE ###

n,*a=map(int,open(0).read().split())
b=[0]*n
b[0]=a[0]
for i in range(1,n):
    b[i]=b[i-1]+a[i]
c=set(b)
ans=b.count(0)
for i in c:
    j=b.count(i)
    ans+=j*(j-1)//2
print(ans)

### FIXED CODE ###

import collections
n,*a=map(int,open(0).read().split())
b=[0]*n
b[0]=a[0]
for i in range(1,n):
    b[i]=b[i-1]+a[i]
b.sort()    
b=[0]+b
ans=0
l=collections.Counter(b)
for i in l.values():
    ans+=i*(i-1)//2
print(ans)
### BUGGY CODE ###

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

L = []
for a in A:
    L.append(a)
    L.reverse() 
print(*L)

### FIXED CODE ###

from collections import deque
N = int(input())
A = list(map(int, input().split()))

B = deque()

if N % 2 == 0:
    for i in range(N):
        if i % 2 == 0:
            B.append(A[i])
        else:
            B.appendleft(A[i])
else:
    for i in range(N):
        if i % 2 == 0:
            B.appendleft(A[i])
        else:
            B.append(A[i])

print(*B)
### BUGGY CODE ###

import copy
N = int(input())
X = list(map(int, input().split()))
XX = sorted(X)
for i in range(N):
    delX = copy.copy(XX)
    delX.remove(X[i])
    # print(delX)
    print(delX[N // 2 - 1])


### FIXED CODE ###

N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
for x in X:
    if x <= Y[N // 2 - 1]:
        print(Y[N // 2])
    else:
        print(Y[N // 2 - 1])
### BUGGY CODE ###

import sys
A = input()
B = int(input())
for i in range(B):
    C = sys.stdin.readline().split()
    if C[0] == "1":
        A = A[::-1]
    else:
        if C[1] == "1":
            A=C[2]+A
        else:
            A=A+C[2]
print(A)

### FIXED CODE ###

A = input()
B = int(input())
C = ""
for i in range(B):
    D = input().split()
    if D[0] == "1":
        C,A = A,C
    else:
        if D[1] == "1":
            C += D[2]
        else:
            A += D[2]
C = C[::-1]
print(C+A)
### BUGGY CODE ###

ip1 = input()
ip1list = ip1.split(" ")
N = int(ip1list[0])
ip2 = input()
A_sub = ip2.split(" ")
A = []
for a in A_sub:A.append(int(a))

l = [0]*N
for i in range(max(A)):
    l[i] = A.count(i+1)
for sl in l:
    print(sl)

### FIXED CODE ###

N = int(input())
ip2 = input()
A_sub = ip2.split(" ")
A = []
for a in A_sub:A.append(int(a))
    
l = [0]*N
for a in A:
    l[a-1]+=1
for sl in l:print(sl)
### BUGGY CODE ###

#!/usr/bin/env python3

import sys, math, copy
# import fractions, itertools
# import numpy as np
# import scipy

HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

def adj_node(path, neighbor):
    for end in [path[0], path[-1]]:
        for node in neighbor[end - 1]:
            if node not in path:
                is_begin = (end == path[0])
                return node, is_begin
    return None, True

def get_path():
    n, m = map(int, input().split())
    am = []
    bm = []
    for i in range(m):
        a, b = map(int, input().split())
        am.append(a)
        bm.append(b)
    assert len(am) == len(bm) == m

    neighbor = [[] for j in range(n)]
    for i in range(m):
        a, b = am[i], bm[i]
        neighbor[a - 1].append(b)
        neighbor[b - 1].append(a)

    path = [am[0], bm[0]]
    for j in range(10 ** 6):
        node, is_begin = adj_node(path, neighbor)
        if node is None:
            return path
        if is_begin:
            path = [node] + path
        else:
            path.append(node)

def main():
    path = get_path()
    print(len(path))
    print(" ".join(map(str, path)))

main()


### FIXED CODE ###

#!/usr/bin/env python3

import sys, math, copy
from collections import deque
# import fractions, itertools
# import numpy as np
# import scipy

HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

def adj_node(path, paths, neighbor):
    for end in [path[0], path[-1]]:
        for node in neighbor[end - 1]:
            if node not in paths:
                is_begin = (end == path[0])
                return node, is_begin
    return None, True

def get_path():
    n, m = map(int, input().split())
    am = []
    bm = []
    for i in range(m):
        a, b = map(int, input().split())
        am.append(a)
        bm.append(b)
    assert len(am) == len(bm) == m

    neighbor = [[] for j in range(n)]
    for i in range(m):
        a, b = am[i], bm[i]
        neighbor[a - 1].append(b)
        neighbor[b - 1].append(a)

    path = deque([am[0], bm[0]])
    paths = set(path)
    for j in range(10 ** 6):
        node, is_begin = adj_node(path, paths, neighbor)
        if node is None:
            return path
        paths.add(node)
        if is_begin:
            path.appendleft(node)
        else:
            path.append(node)

def main():
    path = get_path()
    print(len(path))
    print(" ".join(map(str, path)))

main()
### BUGGY CODE ###

MOD1 = 13
MOD2 = 10 ** 9 + 7

S = input()
revS = S[::-1]
N = len(S)
dp = [[0 for _ in range(MOD1)] for _ in range(N)]

if revS[0] == '?':
    for k in range(10):
        dp[0][k % MOD1] += 1
else:
    dp[0][int(revS[0]) % MOD1] += 1

for i in range(1, N):
    if revS[i] == '?':
        for k in range(10):
            for j in range(MOD1):
                tmp_j = (k * 10 ** i % MOD1 + j) % MOD1
                dp[i][tmp_j] += dp[i - 1][j]
                dp[i][tmp_j] %= MOD2
    else:
        for j in range(MOD1):
            tmp_j = (int(revS[i]) * 10 ** i % MOD1 + j) % MOD1
            dp[i][tmp_j] += dp[i - 1][j]
            dp[i][tmp_j] %= MOD2

print(dp[-1][5])


### FIXED CODE ###

MOD1 = 13
MOD2 = 10 ** 9 + 7

S = input()
N = len(S)
dp = [[0 for _ in range(MOD1)] for _ in range(N)]

if S[0] == '?':
    for k in range(10):
        dp[0][k % MOD1] += 1
else:
    dp[0][int(S[0]) % MOD1] += 1

for i in range(N-1):
    if S[i+1] == '?':
        for j in range(MOD1):
            for k in range(10):
                tmp_j = (j * 10 + k) % MOD1
                dp[i+1][tmp_j] += dp[i][j]
                dp[i + 1][tmp_j] %= MOD2
    else:
        for j in range(MOD1):
            tmp_j = (j * 10 + int(S[i+1])) % MOD1
            dp[i+1][tmp_j] += dp[i][j]
            dp[i + 1][tmp_j] %= MOD2

print(dp[-1][5] % MOD2)
### BUGGY CODE ###

n, x, y = map(int, input().split())
for k in range(1, n):
    s = 0
    for i in range(1, n+1):
        for j in range(i+1, n+1):
            shortest = min(abs(j-i), abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x))
            if shortest == k:
                s += 1
    print(s)



### FIXED CODE ###

n, x, y = map(int, input().split())
ans = [0] * n
for i in range(1, n+1):
    for j in range(i+1, n+1):
        dist = min(abs(j-i), abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x))
        ans[dist] += 1
for i in range(1, n):
    print(ans[i])
### BUGGY CODE ###

import itertools


X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

AB = [a + b for (a, b) in list(itertools.product(A, B))]
AB.sort(reverse=True)
ans = [ab + c for (ab, c) in list(itertools.product(AB[:min(3000, X*Y*Z)], C))]
ans.sort(reverse=True)
for i in range(K):
    print(ans[i])

### FIXED CODE ###

from itertools import product

X,Y,Z,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

BC = [i+j for i,j in list(product(B,C))]
BC.sort(reverse=True)

ans = [i+j for i,j in list(product(BC[:min(3000, X*Y*Z)], A))]
ans.sort(reverse=True)

[print(ans[i]) for i in range(K)]
### BUGGY CODE ###

N, Q = map(int, input().split())
string = input()
 
for i in range(Q):
    l, r = map(int, input().split())
    ans = string[l-1:r].count("AC")
    print(ans)

### FIXED CODE ###

N, Q = map(int, input().split())
string = input()
 
counter = [0]*(N+1)

for i in range(N):
    counter[i+1] = counter[i] + (1 if string[i:i+2] == "AC" else 0)

for i in range(Q):
    l, r = map(int, input().split())
    print(counter[r-1] - counter[l-1])
### BUGGY CODE ###

# author:  Taichicchi
# created: 19.09.2020 00:14:21

import sys

N = int(input())

S = input()

ans = S.count("R") * S.count("G") * S.count("B")


for i in range(N - 2):
    for j in range(i + 1, N - 1):
        for k in range(j + 1, N):
            if j - i == k - j:
                if (S[i] != S[j]) & (S[j] != S[k]) & (S[k] != S[i]):
                    ans -= 1

print(ans)


### FIXED CODE ###

# author:  Taichicchi
# created: 19.09.2020 00:14:21

import sys

N = int(input())

S = input()

ans = S.count("R") * S.count("G") * S.count("B")


for i in range(N - 2):
    for j in range(i + 1, N - 1):
        try:
            k = 2 * j - i
            if (S[i] != S[j]) & (S[j] != S[k]) & (S[k] != S[i]):
                ans -= 1
        except:
            continue

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

import sys
import heapq


def dfs(u,s,target, vs):
    vs[u] = 1
    if(u == target):
        global h
        heapq.heappush(h,s)
        return
    for j in range(e):
        if(e_1[j] == u):
            if(vs[e_2[j]] != 1):
                count = s + e_w[j]
                print(s,e_2[j],vs)
                dfs(e_2[j],count,target,vs[0:])



v,e,r=map(int, input().split());

e_1=[0]*e;
e_2=[0]*e;
e_w=[0]*e;

for i in range(e):
    e_1[i], e_2[i], e_w[i] = map(int, input().split());

v_q=[];

INF = 9999999999999999999
d = [INF for i in range(v)]
d[r] = 0
heapq.heappush(v_q,(0,r))
heapq.heappush(v_q,(INF,0))
while(True):
    cost,u = heapq.heappop(v_q)
    if(cost == INF):
        break
    if(cost > d[u]):
        continue
    for j in range(e):
        if(u == e_1[j]):
            alt = d[u]+e_w[j]
            if(d[e_2[j]] > alt):
                d[e_2[j]] = alt
                heapq.heappush(v_q,(alt,e_2[j]))

for i in range(v):
    if(d[i] != INF):
        print(d[i])
    else:
        print("INF")





### FIXED CODE ###

import sys
from collections import deque

v,e,r=map(int, input().split());

edge_info=[0]*v;
for i in range(v):
    edge_info[i] = []

for i in range(e):
    e1, e2, w = map(int, input().split());
    edge_info[e1].append((e2,w))

v_q=deque();

INF = 9999999999999999999
d = [INF for i in range(v)]
d[r] = 0
v_q.append((0,r))
while(len(v_q) != 0):
    cost,u = v_q.popleft()
    if(cost > d[u]):
        continue
    for j in range(len(edge_info[u])):
        e2,w = edge_info[u][j]
        alt = cost+w
        if(d[e2] > alt):
            d[e2] = alt
            v_q.append((alt,e2))

for i in range(v):
    if(d[i] != INF):
        print(d[i])
    else:
        print("INF")
### BUGGY CODE ###

import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7


def gcd(x, y):
    if y % x == 0:
        return x

    return gcd(y % x, x)


def lcd(x, y):
    g = gcd(x, y)
    return x * y // g


l = 1
for e in a:
    l = lcd(l, e)

ans = 0
for e in a:
    ans += l // e
    ans %= mod

print(ans)



### FIXED CODE ###

from fractions import gcd


def lcm(a, b):
    return a * b // gcd(a, b)


n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

l = 1
for e in a:
    l = lcm(l, e)

l %= mod

ans = 0
for e in a:
    ans += l * pow(e, mod - 2, mod)
    ans %= mod

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

R, G, B, N = map(int, input().split())
ans = 0
for r in range(N+1):
    for g in range(N+1):
        b =( N - R * r - G * g) // B
        if R *r + G * g + B * b == N and b >= 0:
            ans += 1
print(ans)


### FIXED CODE ###

R, G, B, N = map(int, input().split())
ans = 0
for r in range((N//R)+1):
    for g in range((N//G)+1):
        v = R * r + G * g
        if v > N:
            break
        if (N - v) % B == 0:
            ans +=1 
        
print(ans)
### BUGGY CODE ###

N = int(input())
As = [int(i) for i in list(input().split())]

result = []

length = len(As)
for i in range(length):
	res = 0
	for j in range(length):
		if (i+j)%2 == 0:
			res += As[(i+j)%length]
		else:
			res -= As[(i+j)%length]
	result.append(str(abs(res)))

print(" ".join(result))

### FIXED CODE ###

N = int(input())
As = [int(i) for i in list(input().split())]

result = []

length = len(As)
before_res = 0
for i in range(length):
	res = 0
	if i == 0:
		for j in range(length):
			if (i+j)%2 == 0:
				res += As[(i+j)%length]
			else:
				res -= As[(i+j)%length]
	else:
		res = 2*As[(i-1)%length] - before_res
	before_res = res
	result.append(str(abs(res)))

print(" ".join(result))
### BUGGY CODE ###

s=input()
n=int(input())
cnt=0
for i in range(n):
  a=list(input())
  if a[0]=="1":
    cnt+=1
  else:
    if cnt%2==0 and a[2]=="1":
      s=a[4]+s
 
    elif cnt%2==0 and a[2]=="2":
      s=s+a[4]
     
    elif cnt%2==1 and a[2]=="1":
      s=s+a[4][::-1]

    elif cnt%2==1 and a[2]=="2":
      s=a[4][::-1]+s
    
if cnt%2==0:
  print(s)
else:
  print(s[::-1])

### FIXED CODE ###

from collections import deque
S=list(input())
Q=int(input())
query=[]
reverseflg=False
S=deque(S)

for i in range(Q):
  query.append(list(input().split()))

for q in range(Q):
  if query[q][0]=="1":
    reverseflg= not reverseflg
  
  if query[q][0]=="2":
    if query[q][1]=="1":
      if reverseflg== False:
        S.appendleft(query[q][2])
      else:
        S.append(query[q][2])
    
    else:
      if reverseflg== False:
        S.append(query[q][2])
      else:
        S.appendleft(query[q][2])

if reverseflg==True:
  S.reverse()
  
print(''.join(S))
### BUGGY CODE ###

import numpy as np
n,k,q=map(int,input().split())
a=[]
score=np.array([k]*n)
for i in range(q):
    score-=1
    score[int(input())-1]+=1
for i in range(n):
    print('Yes' if score[i]>0 else 'No')

### FIXED CODE ###

import numpy as np
n,k,q=map(int,input().split())
score=np.array([k-q]*n)
for i in range(q):
    score[int(input())-1]+=1
for i in range(n):
    print('Yes' if score[i]>0 else 'No')