Harryxun/stf_run huggingface dataset:
n, m = map(int, input().split())

v = [0] * n
g = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    v[a] += 1
    v[b] += 1
    g[a].append(b)
    g[b].append(a)

for i in range(n):
    if v[i] % 2 == 1:
        print("No")
        exit()

v4 = 0
for i in range(n):
    if v[i] >= 6:
        print("Yes")
        exit()
    if v[i] == 4:
        v4 += 1

if v4 == 0:
    print("No")
    exit()
if v4 == 1:
    print("No")
    exit()
if v4 >= 3:
    print("Yes")
    exit()


memo = [0] * n
ord = [0] * n
lowlink = [0] * n
articulation = [0] * n

def dfs(v, p, k):
    memo[v] = 1
    ord[v] = k
    lowlink[v] = ord[v]
    isArticulation = False
    count = 0
    for nv in g[v]:
        if memo[nv] == 0:
            count += 1
            dfs(nv, v, k+1)
            lowlink[v] = min(lowlink[v], lowlink[nv])
            if p != -1 and ord[v] <= lowlink[nv]:
                isArticulation = True
        elif nv != p:
            lowlink[v] = min(lowlink[v], ord[nv])

    if p == -1 and count > 1:
        isArticulation = True
    if isArticulation:
        articulation[v] = 1

dfs(0, -1, 0)

count = 0
for i in range(n):
    if v[i] == 4 and articulation[i] == 1:
        count += 1

if count >= 2:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

n, m = map(int, input().split())

v = [0] * n
g = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    v[a] += 1
    v[b] += 1
    g[a].append(b)
    g[b].append(a)

for i in range(n):
    if v[i] % 2 == 1:
        print("No")
        exit()

v4 = 0
for i in range(n):
    if v[i] >= 6:
        print("Yes")
        exit()
    if v[i] == 4:
        v4 += 1

if v4 == 0:
    print("No")
    exit()
if v4 == 1:
    print("No")
    exit()
if v4 >= 3:
    print("Yes")
    exit()


memo = [0] * n
ord = [0] * n
lowlink = [0] * n
articulation = [0] * n

def dfs(v, p, k):
    memo[v] = 1
    ord[v] = k
    lowlink[v] = ord[v]
    isArticulation = False
    count = 0
    for nv in g[v]:
        if memo[nv] == 0:
            count += 1
            dfs(nv, v, k+1)
            lowlink[v] = min(lowlink[v], lowlink[nv])
            if p != -1 and ord[v] <= lowlink[nv]:
                isArticulation = True
        elif nv != p:
            lowlink[v] = min(lowlink[v], ord[nv])

    if p == -1 and count > 1:
        isArticulation = True
    if isArticulation:
        articulation[v] = 1

dfs(0, -1, 0)

count = 0
for i in range(n):
    if v[i] == 4 and articulation[i] == 1:
        count += 1

if count >= 2:
    print("Yes")
else:
    print("No")
a,b,c,d=map(int,input().split())
taka=c/b
ao=a/d
taka=taka if taka==c//b else int(taka)+1
ao=ao if ao==a//d else int(ao)+1
print("Yes" if taka<=ao else "No")

### FIXED CODE ###

s,w=map(int,input().split())
print("unsafe" if s<=w else "safe")
import math

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

gcd_l = [0]
gcd_r = [0]

for i in range(N):
    gcd_l.append(math.gcd(gcd_l[i], A[i]))
    gcd_r.append(math.gcd(gcd_r[i], A[-(i+1)]))
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(math.gcd(gcd_l[i], gcd_r[i+1]))
print(ans)

### FIXED CODE ###

A, B, T = map(int, input().split())
ans = 0
t = 0
while t <= T - A:
    ans += B
    t += A
print(ans)
n = int(input())
_ = [list(map(int, input().split())) for _ in range(n)]

dt = [0] * n
dx = [0] * n
dy = [0] * n

for i in range(n):
    dt[i] = _[i + 1][0] - _[i][0]
    dx[i] = _[i + 1][1] - _[i][1]
    dy[i] = _[i + 1][2] - _[i][2]

ans = "Yes"

for i in range(n):
    man_d = abs(dx[i]) + abs(dy[i])
    if not (dt[i] >= man_d and (dt [i]- man_d) % 2 == 0):
        ans = "No"

print(ans)

### FIXED CODE ###

n = int(input())
_ = [list(map(int, input().split())) for _ in range(n)]
_.insert(0, [0, 0, 0])

dt = [_[i + 1][0] - _[i][0] for i in range(n)]
dx = [_[i + 1][1] - _[i][1] for i in range(n)]
dy = [_[i + 1][2] - _[i][2] for i in range(n)]

for i in range(n):
    man_d = abs(dx[i]) + abs(dy[i])
    if dt[i] >= man_d and (dt [i]- man_d) % 2 == 0:
        ans = "Yes"
    else:
        ans = "No"
        break

print(ans)
if '9'.in(input()):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

if '9' in input():
  print("Yes")
else:
  print("No")
from sys import stdin

s = int(stdin.readline().rstrip().split())
h = s//3600
m = (s%3600)//60
sec = (s%3600)%60
print("{}:{}:{}".format(h, m, sec))



### FIXED CODE ###

def main():
    s = int(input())
    print("{}:{}:{}".format(s//3600, (s%3600)//60, (s%3600)%60))

if __name__ == "__main__":
    main()
n = int(input())
a = list(map(int, input().split()))

s = 1
for i in a:
    s = s * i

print(float(s/((n-1)*sum(a))))

### FIXED CODE ###

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

for i in a:
    ans = ans + 1/i
print(1/ans)
N = int(input())
A = list(map(int, input().split()))
chinpo = 0

for i in range(N-1):
    if A[i] >> A[i+1]:
        A[i] -= 1
    if A[i+1] >= A[i]:
        chinpo += 1

if chinpo == N-1:
    print("Yes")
else:
    print("No")



### FIXED CODE ###

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

X = b + c - a
if X >= 0:
    print(X)
else:
    print(0)
a,b = raw_input().sprit().split(" ")
print int(a)*int(b)

### FIXED CODE ###

a,b = raw_input().strip().split(" ")
print int(a)*int(b),(int(a)+int(b))*2
w,h,x,y = list(map(int,input().split(" ")))

sq = w*h/2
flag = 1 if w == x*2 and h = y*2 else 0

print(sq,flag)

### FIXED CODE ###

w,h,x,y = list(map(int,input().split(" ")))

sq = w*h/2
flag = 1 if w == x*2 and h == y*2 else 0

print(sq,flag)
N,X,M=map(int,input().split())
F=(N-1).bit_length()

A=[[0]*M for _ in range(F)]

for x in range(M):
    A[0][x]=(x*x)%M

for d in range(1,F):
    for x in range(M):
        A[d][x]=A[d-1][A[d-1][x]]

S=[[0]*M for _ in range(F)]
for x in range(M):
    S[0][x]=A[0][x]

for d in range(1,F):
    for x in range(M):
        S[d][x]=S[d-1][x]+S[d-1][A[d-1][x]]

Ans=0
depth=0
N-=1
Y=X
while N>0:
    if N%2:
        Ans+=S[depth][X]
        X=A[depth][X]
    depth+=1
    N>>=1
print(Ans+Y)

### FIXED CODE ###

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

if N==1 or M==1:
    print(X)
    exit()

F=(N-1).bit_length()

A=[[0]*M for _ in range(F)]

for x in range(M):
    A[0][x]=(x*x)%M

for d in range(1,F):
    for x in range(M):
        A[d][x]=A[d-1][A[d-1][x]]

S=[[0]*M for _ in range(F)]
for x in range(M):
    S[0][x]=A[0][x]

for d in range(1,F):
    for x in range(M):
        S[d][x]=S[d-1][x]+S[d-1][A[d-1][x]]

Ans=0
depth=0
N-=1
Y=X
while N>0:
    if N%2:
        Ans+=S[depth][X]
        X=A[depth][X]
    depth+=1
    N>>=1
print(Ans+Y)
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
  


N = int(input())
A = input().split()
for i in range(N):
    A[i] = int(A[i])
    
if N == 2:
    print(max(A[0],A[1]))
if N >= 3:
    gcd_all = gcd(A[0], A[1])
    gcd_without_1 = A[0]
    gcd_without_2 = A[1]
    gcd_without_1 = max(gcd_all, max( gcd(gcd_without_1, A[i]),gcd(gcd_without_2, A[i])))
    gcd_all = math.gcd(gcd_all,A[2])
    for i in range(3,N):
        gcd_without_1 = max(gcd_all, gcd(gcd_without_1, A[i]))
        gcd_all = gcd(gcd_all,A[i])
    print(max(gcd_all, gcd_without_1))





### FIXED CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
  


N = int(input())
A = input().split()
for i in range(N):
    A[i] = int(A[i])
    
if N == 2:
    print(max(A[0],A[1]))
if N >= 3:
    gcd_all = gcd(A[0], A[1])
    gcd_without_1 = A[0]
    gcd_without_2 = A[1]
    gcd_without_1 = max(gcd_all, max( gcd(gcd_without_1, A[i]),gcd(gcd_without_2, A[i])))
    gcd_all = gcd(gcd_all,A[2])
    for i in range(3,N):
        gcd_without_1 = max(gcd_all, gcd(gcd_without_1, A[i]))
        gcd_all = gcd(gcd_all,A[i])
    print(max(gcd_all, gcd_without_1))
N,M = map(int,input().split())
X = list(map(int,input().split()))
if N > M :
    print(0)
else:
    flag = [0 for fl in range(M)]
    X.sort()
    for _ in range(1,M+1):
        flag[_] += X[_] - X[_-1]
    for lp in range(len(flag)):
      	ff = flag.index(max(flag))
        flag.pop(ff)
        print(sum(flag))


### FIXED CODE ###

N,M = map(int,input().split())
X = list(map(int,input().split()))
if N > M :
    print(0)
else:
    X.sort()
    x_next = X[0]
    flag = [X[_] - X[_-1] for _ in range(1,M)]
    flag.sort()
    flag = flag[:M-N:]
    print(sum(flag))
num = int(input())
List = input().split(" ")
height = [int(n) for n in List]
dp = [0 for n in range(10 ** 5 * 2)]
def jump(a,now):
  if dp[a] != 0:
    return dp[a]
  if a == num:
    res = 0
  elif a+2 > num:
    res = jump(a+1,height[a])+abs(now-height[a])
  else:
    res = min(jump(a+1,height[a])+abs(now-height[a]),jump(a+2,height[a+1])+abs(now-height[a+1]))
  dp[a] = res
  return res
print(jump(1,height[0]))

### FIXED CODE ###

num = int(input())
List = input().split(" ")
height = [int(n) for n in List]
dp = [0 for n in range(10 ** 5 * 2)]
a = 0
while dp[num-1] == 0:
  a+= 1
  if a == num:
    break
  if a == 1:
    dp[a] = abs(height[a]-height[a-1])
  else:
    dp[a] = min(abs(height[a]-height[a-1])+dp[a-1],abs(height[a]-height[a-2])+dp[a-2])
print(dp[num-1])
#Lower
N = int(input())
H = list(map(int, input().split()))
max = 0
n=0

for i in range(N-1):
    if H[i] >= H[i+1]:
        n = n+1
    else :
        n = 0
    if n > max:
        max = n

print(max)


### FIXED CODE ###

S = input()
T = input()
ctr = 0

for i in range(len(S)):
    if S[i] == T[i]:
        ctr = ctr+1

print(ctr)
from sys import stdin
input = sys.stdin.buffer.readline
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n, m = MAP()
print('Yes') if n == m else print('No')

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))


n, m = MAP()
print('Yes') if n == m else print('No')
import math
n, m = map(int, input().split())

mod = 10 ** 9 + 7

b = []

c = int(math.sqrt(m))
for i in range(2, c+2):
    if m % i != 0:
        continue
    count = 0
    while m % i == 0:
        count += 1
        m = m // i
    b.append(count)

fac = [1, 1]
inv = [1, 1]
finv = [1, 1]
for i in range(2, n + max(b)+3):
    fac.append(fac[i-1] * i % mod)
    inv.append(mod - inv[mod%i] * (mod//i) % mod)
    finv.append(finv[i-1] * inv[i] % mod)

def nck(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod

ans = 1
for i in b:
    ans = (ans * nck(n-1+i, i)) % mod

print(ans)

### FIXED CODE ###

import math
n, m = map(int, input().split())

mod = 10**9 + 7

b = []

c = int(math.sqrt(m))
for i in range(2, c+2):
    count = 0
    while m % i == 0:
        count += 1
        m = m // i
    b.append(count)
if m > 1:
    b.append(1)

fac = [1, 1]
inv = [1, 1]
finv = [1, 1]
for i in range(2, n + max(b)+3):
    fac.append(fac[i-1] * i % mod)
    inv.append(mod - inv[mod%i] * (mod//i) % mod)
    finv.append(finv[i-1] * inv[i] % mod)

def nck(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod

ans = 1
for i in b:
    ans *= nck(n-1+i, i)
    ans %= mod

print(ans)
jfrom math import gcd

from math import factorial as f

from math import ceil, floor, sqrt
import math

import bisect
import re
import heapq

from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

yes = "Yes"
no = "No"


def main():
    n = ii()
    d, x = mi()
    a = []
    for i in range(n):
        tmp = ii()
        a.append(tmp)
    ans = 0
    for i in a:
        tmp = 1
        while tmp <= d:
            ans += 1
            tmp += i
    ans += x
    print(ans)


main()


### FIXED CODE ###

from math import gcd

from math import factorial as f

from math import ceil, floor, sqrt
import math

import bisect
import re
import heapq

from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

yes = "Yes"
no = "No"


def main():
    n = ii()
    d, x = mi()
    a = []
    for i in range(n):
        tmp = ii()
        a.append(tmp)
    ans = 0
    for i in a:
        tmp = 1
        while tmp <= d:
            ans += 1
            tmp += i
    ans += x
    print(ans)


main()
N,M,X= map(int,input().split())
A=[list(map(int,input().split()) for i in range(N)]
K=np.array([0*M])
m=[]
import numpy as np


def dfs(i, sum,K):
    # n 個決め終わったら、今までの和 sum が k と等しいかを返す
    if i == N:
        if j>=X for j in K:
            m.append(sum)
        return j>=X for j in K
            

    # a[i] を使わない場合
    if dfs(i + 1, sum+K[i][0],K+np.array([for j in A[i][1:]]):
        return True

    # a[i] を使う場合
    if dfs(i + 1, sum,K):
        return True

    # a[i] を使う使わないに拘らず k が作れないので False を返す
    return False
print(min(m) if dfs(0,0,K) else -1)


### FIXED CODE ###

n,m,x=map(int,input().split())
a=[list(map(int,input().split()))for i in range(n)]
ans=[]
for bit in range(1<<n):
  total=0
  skill=[0]*m
  for i in range(n):
    if bit & (1<<i):
      total+=a[i][0]
      for j in range(m):
        skill[j]+=a[i][j+1]
  if all([k>=x for k in skill]):
    ans.append(total)
print(min(ans) if len(ans)!=0 else -1)
STR = input().split()
N = int(STR[0])
M = int(STR[1])
Flag = True
a = []
a.append(-1)
for i in range(M):
    a.append(int(input()))
a.append(N+1)

for i in range(M+1):
    if (a[i+1]-a[i]) == 1:
        Flag = False

fib = []
fib.append(1)
fib.append(1)

for i in range(2,N):
    fib.append(fib[i-1] + fib[i-2])

SUM = 1
num = 0
for i in range(1,M+2):
    num = a[i]-1 - (a[i-1] +1)
    #print(a[i]-1)
    #print(a[i-1]+1)
    SUM = SUM * fib[num] % 1000000007
    #print(num)
    
if Flag:
    print(SUM)
else:
    print(0)

### FIXED CODE ###

BIG = 10**9+7

N,M = map(int,input().split())
a = []
for i in range(M):
    a.append(int(input()))


dp = [0 for i in range(N+1)]
for item in a:
    dp[item]=-1
dp[0]=1
if 1 in a:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2,N+1):
    if dp[i]!= -1:
        dp[i] = dp[i-1]+dp[i-2]
        dp[i] = dp[i]%BIG
    else:
        dp[i]=0

print(dp[-1])
a=input()
if(a%2==0):
  print((a/2)**2)
  return
else:
  print(((a-1)/2)*((a+1)/2))

### FIXED CODE ###

a=int(input())
if a%2==0:
  ans=int((a/2)**2)
else:
  ans=int(((a-1)/2)*((a+1)/2))
print(ans)
from collections import deque

h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

def bfs(y, x):
    cnt = [[-1] * w for _ in range(h)]
    queue = deque([[y, x]])
    cnt[y][x] = 1
    while queue:
        i, j = queue.popleft()
        for di, dj in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            if 0 <= i + di < h and 0 <= j + dj < w and cnt[i + di][j + dj] == -1:
                if s[i + di][j + dj] == ".":
                    cnt[i + di][j + dj] = cnt[i][j] + 1
                    queue.append([i + di, j + dj])
                else:
                    return cnt[i][j]

ans = 0
i = 0
j = 0
while i < h:
    while j < w:
        if s[i][j] == ".":
            ans = max(ans, bfs(i, j))
            i += ans
            j += ans
print(ans)

### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
cnt = [[-1] * w for _ in range(h)]

def bfs():
    queue = deque()
    for i in range(h):
        for j in range(w):
            if s[i][j] == "#":
                queue.append([i, j])
                cnt[i][j] = 0
    while queue:
        i, j = queue.popleft()
        for di, dj in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            if 0 <= i + di < h and 0 <= j + dj < w and cnt[i + di][j + dj] == -1:
                queue.append([i + di, j + dj])
                cnt[i + di][j + dj] = cnt[i][j] + 1

bfs()
print(max([max(l) for l in cnt]))
# import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))

# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))

from bisect import bisect_left


def solve():
    N, K = map(int, input().split())

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

    As.sort()
    index = bisect_left(As, 0)

    # neg = As[:index]
    # pos = As[index:]
    # pos = pos[bisect_left(pos, 1):]
    # pos.sort(reverse=True)
    # print(pos, neg)

    pos = sorted(As, reverse=True)
    ans = 1
    mod = 10 ** 9 + 7

    if N == K:
        for p in pos:
            ans *= p
            ans %= mod
        return ans

    if index == N and K % 2:
        for p in pos[:K]:
            ans *= p
            ans %= mod
        return ans

    pl = 0
    pr = N - 1
    
    if K % 2:
        ans *= pos[pr]
	    pr -= 1

    for i in range(K//2):
        left = pos[pl] * pos[pl+1]
        right = pos[pr] * pos[pr-1]

        if left > right:
            ans *= left
            ans %= mod
            pl += 2
        else:
            ans *= right
            ans %= mod
            pr -= 2

    return ans


def main():
    print(solve())


if __name__ == "__main__":
    main()


### FIXED CODE ###

# import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))

# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))

from bisect import bisect_left


def solve():
    N, K = map(int, input().split())

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

    As.sort()
    index = bisect_left(As, 0)

    # neg = As[:index]
    # pos = As[index:]
    # pos = pos[bisect_left(pos, 1):]
    # pos.sort(reverse=True)
    # print(pos, neg)

    pos = sorted(As, reverse=True)
    ans = 1
    mod = 10 ** 9 + 7

    if N == K:
        for p in pos:
            ans *= p
            ans %= mod
        return ans

    if index == N and K % 2:
        for p in pos[:K]:
            ans *= p
            ans %= mod
        return ans

    pl = 0
    pr = N - 1

    for i in range(K//2):
        left = pos[pl] * pos[pl+1]
        right = pos[pr] * pos[pr-1]

        if left > right:
            ans *= left
            ans %= mod
            pl += 2
        else:
            ans *= right
            ans %= mod
            pr -= 2

    if K % 2:
        ans *= max(pos[pl], pos[pr])
        ans %= mod

    return ans


def main():
    print(solve())


if __name__ == "__main__":
    main()
n = int(input())

if (n % 10)==2 or 4 or 5 or 7 or 9:
	print ("hon")
elif (n % 10) == 0 or 1 or 6 or 8:
    print (n+"pon")
else
    prnt(n+"bon):

### FIXED CODE ###

n = int(input())
# print(n % 10)
if (n % 10) in [2 , 4 , 5 , 7 , 9]:
	print ("hon")
elif (n % 10) in [ 0 , 1 , 6 , 8]:
    print ("pon")
else:
    print("bon")
n,m = map(int,input().split())
s = str(input())
t = str(input())
if n > m:
    bigg = n
    summoo = m
def get_gcd(a, b):
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    else:
        return get_gcd(b, a % b)
def get_lcm(a, b, gcd):
    lcm = a * b // gcd
    return lcm
saisyou = get_lcm(n,m,get_gcd(n,m))
unti = max(saisyou,n,m)
if unti%saisyou != 0:
    unti = saisyou((unti//saisyou)*saisyou + saisyou)
ans = 0
if bigg%summoo != 0:
    for l in range(unti,100000,saisyou):
        num = 0
        for i in range(min(n,m)):
            if 1+(l/n)*i+1 == 1+(l/m)*i+1:
                if s[i] == t[i]:
                    pass
                else:
                    num += 1
                    break
        if num == 0:
            ans = l
            break
    print(ans)
else:
    print(-1)

### FIXED CODE ###

n,m = map(int,input().split())
s = str(input())
t = str(input())
def get_gcd(a, b): #最大公約数を求める関数
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    else:
        return get_gcd(b, a % b)
def get_lcm(a, b, gcd): #みたまんまそういうやつです
    lcm = a * b // gcd
    return lcm
lcm = get_lcm(n,m,get_gcd(n,m)) #lcmはn,m最小公倍数
lcm2 = get_lcm(lcm/n,lcm/m,get_gcd(lcm/n,lcm/m)) #lcm２はlcm/nとlcm/mの最小公倍数
ans = 0
for i in range(int(lcm//lcm2)):
    if s[int(i*lcm2//(lcm/n))] == t[int(i*lcm2//(lcm/m))]:
        pass
    else:
        ans = 1
        break
if ans == 1:
    print(-1)
else:
    print(lcm)
N = int(input())
X = list(map(int, input().split()))
Min = min(X)
Max = max(X)
disList = []
flag = 1
for ass in range(Min, Max):
  dis = 0
  for person in range(N):
    dis += (X[person] - ass) * (X[person] - ass)
  disList.append(dis)  
for i in range(N):
  if not X[i] == 1:
    flag=0
    break
if N == 1:
  print(X[0])
elif flag == 0:
  print(min(disList))
else:
  print(1)

### FIXED CODE ###

N = int(input())
X = list(map(int, input().split()))
costMin = 9999999999
for locate in range(1, 101):
  cost = 0
  for i in range(N):
    cost += (X[i]-locate)**2
  if cost < costMin:
    costMin = cost
print(costMin)
from sympy import nextprime
from sympy import isprime
x = int(input())
if isprime(x):
    print(x)
else:
    print(nextprime(x))

### FIXED CODE ###

import math
x = int(input())
def check(x):
    for i in range(2, int(math.sqrt(x) + 1)):
        if x % i == 0:
            return False
    return True

for i in range(x, 200000):
    if check(i) == True:
        print(i)
        break
import numpy as np
N = int(input())

nums = [float(input()) for _ in range(N)]

two_fives = []


for i, num in enumerate(nums):
    int_converted = int(num * (10**9))
    
    two_div_count = 0
    while int_converted % 2 == 0:
        two_div_count += 1
        int_converted //= 2
    
    five_div_count = 0
    while int_converted % 5 == 0:
        five_div_count += 1
        int_converted //= 5

    two_fives.append((two_div_count,five_div_count))


ok_count = 0

two_five_exists = np.zeros((19,19), dtype=int)

for i in range(N):    
    two_count, five_count = two_fives[i]
    ok_count += two_five_exists[two_count, five_count]
    
    two_pair = 18 - two_count
    five_pair = 18 - five_count    
    two_five_exists[two_pair:, five_pair:] += 1

print(ok_count)



### FIXED CODE ###

import numpy as np
from decimal import Decimal

N = int(input())

nums = [Decimal(input()) for _ in range(N)]

two_fives = []


for i, num in enumerate(nums):
    int_converted = int(num * (10**9))
    
    two_div_count = 0
    while int_converted % 2 == 0:
        two_div_count += 1
        int_converted //= 2
    
    five_div_count = 0
    while int_converted % 5 == 0:
        five_div_count += 1
        int_converted //= 5

    two_fives.append((two_div_count,five_div_count))


ok_count = 0

two_five_exists = np.zeros((19,19), dtype=int)

for i in range(N):    
    two_count, five_count = two_fives[i]
    two_count = min(18, two_count)
    five_count = min(18, five_count)
    ok_count += two_five_exists[two_count, five_count]

    two_pair = 18 - two_count
    five_pair = 18 - five_count
    two_five_exists[two_pair:, five_pair:] += 1

print(ok_count)
n, a, b = map(int, input().split())
s = ""
whlie len(s) < n:
  s += "b" * a + "r" * b
print(s[:n+1].count("b"))
    

### FIXED CODE ###

n, a, b = map(int, input().split())
s = n // (a + b)
t = n % (a + b)
print(s * a + min(t, a))
print(48 - int(input())

### FIXED CODE ###

print(48 - int(input()))
import numpy as np
from collections import Counter
import collections
import numpy as np 
from scipy import sqrt, power, exp, log10
from scipy.fftpack import fft, ifft, fftfreq
import tarfile
import re
import os
import glob
from datetime import datetime
import time
import numpy.linalg as LA

round = lambda x:(x*2+1)//2
a,b = list(map(int,input().split()))
S = input()
sub= "AC"
for i in range(b):
    r,l = list(map(int,input().split()))
	S1 = S[r-1:l]
    n = S1.count(sub)
    print(n)

### FIXED CODE ###

import numpy as np
from collections import Counter
import collections
import numpy as np 
from scipy import sqrt, power, exp, log10
from scipy.fftpack import fft, ifft, fftfreq
import tarfile
import re
import os
import glob
from datetime import datetime
import time
import numpy.linalg as LA

round = lambda x:(x*2+1)//2
a,b = list(map(int,input().split()))
S = input()
sub= "AC"
l = np.zeros(len(S)+1)
for i in range(len(S)):
  l[i+1] = l[i] + (1 if S[i:i+2]=="AC" else 0)

for i in range(b):
    r,t = list(map(int,input().split()))
    n = l[t-1]-l[r-1]
    print(int(n))