Harryxun/stf_run huggingface dataset:
# coding: utf-8

n, k = map(int, input().split())
s = input()
s += "2"
n += 1

nums = []
if s[0] == "0":
    nums.append(0)

fin = False
i = 0
while i < n:
    if fin:
        break
    for j in range(i, n):
        if s[j] != s[i]:
            nums.append(j-i)
            i = j
            break
        if i == n-1:
            fin = True
            break

if s[-2] == "0":
    nums.append(0)
# print(nums)
length = min([2*k+1, len(nums)])

ans = 0
for i in range(0, length):
    ans += nums[i]

oldsum = ans
for i in range(0, length, 2):
    if i + length + 1 < len(nums):
        newsum = oldsum - (nums[i] + nums[i+1]) + (nums[length+i] + nums[length+2])
        if newsum > ans:
            ans = newsum
        oldsum = newsum
    else:
        break

print(ans)


### FIXED CODE ###

# coding: utf-8

n, k = map(int, input().split())
s = input()
s += "2"
n += 1

nums = []
if s[0] == "0":
    nums.append(0)

fin = False
i = 0
while i < n:
    if fin:
        break
    for j in range(i, n):
        if s[j] != s[i]:
            nums.append(j-i)
            i = j
            break
        if i == n-1:
            fin = True
            break

if s[-2] == "0":
    nums.append(0)
# print(nums)
length = min([2*k+1, len(nums)])

ans = 0
for i in range(0, length):
    ans += nums[i]

oldsum = ans
for i in range(0, len(nums), 2):
    if i + length + 1 < len(nums):
        newsum = oldsum - (nums[i] + nums[i+1]) + (nums[length+i] + nums[length+i+1])
        if newsum > ans:
            ans = newsum
        oldsum = newsum
    else:
        break

print(ans)
from functools import lru_cache

import numpy as np


def get_bit(n, d):
    return (n >> d) & 1


@lru_cache(maxsize=None)
def xor(bit, digit):
    """
    A の各要素について右から digit 桁目を bit で XOR した合計
    :param int bit:
    :param int digit:
    :return:
    """
    assert bit in [0, 1]
    # bit <<= digit
    # mask = 1 << digit
    # return sum([(a ^ bit) & mask for a in A])
    if bit == 0:
        return bit_counts[digit] << digit
    else:
        return (N - bit_counts[digit]) << digit


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

DIGIT = 50
bit_counts = [sum([get_bit(a, d=d) for a in A]) for d in range(DIGIT)]

# [桁][k 未満の桁をえらんだことがあるか]
dp = np.empty([DIGIT + 1, 2], dtype=int)
dp.fill(-np.inf)

dp[-1][0] = 0
for d in reversed(range(DIGIT)):
    k = get_bit(K, d=d)
    # bit=k
    dp[d][0] = max(dp[d][0], dp[d + 1][0] + xor(bit=k, digit=d))
    # k==1 なら bit=0 も OK
    if k == 1:
        dp[d][1] = max(dp[d][1], dp[d + 1][0] + xor(bit=0, digit=d))
    # k 未満の桁をえらんだことがあるなら bit にどっちを選んでも OK
    dp[d][1] = max(dp[d][1], dp[d + 1][1] + xor(bit=0, digit=d))
    dp[d][1] = max(dp[d][1], dp[d + 1][1] + xor(bit=1, digit=d))

print(dp[0].max())


### FIXED CODE ###

from functools import lru_cache


def get_bit(n, d):
    return (n >> d) & 1


@lru_cache(maxsize=None)
def xor(bit, digit):
    """
    A の各要素について右から digit 桁目を bit で XOR した合計
    :param int bit:
    :param int digit:
    :return:
    """
    assert bit in [0, 1]
    # bit <<= digit
    # mask = 1 << digit
    # return sum([(a ^ bit) & mask for a in A])
    if bit == 0:
        return bit_counts[digit] << digit
    else:
        return (N - bit_counts[digit]) << digit


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

DIGIT = 50
bit_counts = [sum([get_bit(a, d=d) for a in A]) for d in range(DIGIT)]

# [桁][k 未満の桁をえらんだことがあるか]
dp = [[-float('inf') for _ in range(2)] for _ in range(DIGIT + 1)]
# dp = np.empty([DIGIT + 1, 2], dtype=int)
# dp.fill(-np.inf)

dp[-1][0] = 0
for d in reversed(range(DIGIT)):
    k = get_bit(K, d=d)
    # bit=k
    dp[d][0] = max(dp[d][0], dp[d + 1][0] + xor(bit=k, digit=d))
    # k==1 なら bit=0 も OK
    if k == 1:
        dp[d][1] = max(dp[d][1], dp[d + 1][0] + xor(bit=0, digit=d))
    # k 未満の桁をえらんだことがあるなら bit にどっちを選んでも OK
    dp[d][1] = max(dp[d][1], dp[d + 1][1] + xor(bit=0, digit=d))
    dp[d][1] = max(dp[d][1], dp[d + 1][1] + xor(bit=1, digit=d))

print(max(dp[0]))
import sys
import random
H,W,M=map(int,input().split())

hlist=[0]*H
wlist=[0]*W
hwset=set()
for _ in range(M):
  h,w=map(int,input().split())
  hlist[h-1]+=1
  wlist[w-1]+=1
  hwset.add((h-1,w-1))
  
hmax=max(hlist)
wmax=max(wlist)

hlist2=[]
for i in range(H):
  if hlist[i]==hmax:
    hlist2.append(i)
hlist2.sort(reverse=True)
random.shuffle(hlist2)

wlist2=[]
for i in range(W):
  if wlist[i]==wmax:
    wlist2.append(i)
wlist2.sort(reverse=True)
random.shuffle(wlist2)

#print(hlist2,wlist2)
H2=len(hlist2)
W2=len(wlist2)

if H2*W2>10**7:
  norm=(H2*W2)//(10**7)
  H2=int(H2/(norm**0.5))
  W2=int(W2/(norm**0.5))

for i in range(H2):
  ii=hlist2[i]
  for j in range(W2):
    jj=wlist2[j]
    if not (ii,jj) in hwset:
      print(hh+ww)
      sys.exit(0)
else:
  print(hmax+wmax-1)

### FIXED CODE ###

import sys
import random
H,W,M=map(int,input().split())

hlist=[0]*H
wlist=[0]*W
hwset=set()
for _ in range(M):
  h,w=map(int,input().split())
  hlist[h-1]+=1
  wlist[w-1]+=1
  hwset.add((h-1,w-1))
  
hmax=max(hlist)
wmax=max(wlist)

hlist2=[]
for i in range(H):
  if hlist[i]==hmax:
    hlist2.append(i)
hlist2.sort(reverse=True)
random.shuffle(hlist2)

wlist2=[]
for i in range(W):
  if wlist[i]==wmax:
    wlist2.append(i)
wlist2.sort(reverse=True)
random.shuffle(wlist2)

#print(hlist2,wlist2)
H2=len(hlist2)
W2=len(wlist2)

if H2*W2>=10**7:
  norm=(H2*W2)//(10**7)
  H2=int(H2/(norm**0.5))
  W2=int(W2/(norm**0.5))

for i in range(H2):
  ii=hlist2[i]
  for j in range(W2):
    jj=wlist2[j]
    if not (ii,jj) in hwset:
      print(hmax+wmax)
      sys.exit(0)
else:
  print(hmax+wmax-1)
h, n = map(int, input().split())
a = [int(input()) for i in range(n)]
if sum(a) >= h:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

h, n = map(int, input().split())
a = list(map(int, input().split()))
if h <= sum(a):
  print("Yes")
else:
  print("No")
N, Z, W = map(int,input().split())
A = list(map(int,input().split()))
idea = abs(A[-1] - W)
idea2 = abs(A[-2] - A[-1])
print(max(idea,idea2))


### FIXED CODE ###

N, Z, W = map(int,input().split())
A = list(map(int,input().split()))
idea = abs(A[-1] - W)
try: idea2 = abs(A[-2] - A[-1])
except:
    print(idea)
    quit()
print(max(idea,idea2))
import math
A = [int(input()) for _ in range(5)]
A.sort()
print([(i//10+1)*10 for i in A])
print(sum([math.ceil(i/10)*10 for i in A])  -max([10-i for i in [ (i % 10) for i in A] if i != 0]))



### FIXED CODE ###

import math
A = [int(input()) for _ in range(5)]
print(sum([math.ceil(i/10)*10 for i in A])  -max([10-i for i in [ (i % 10) for i in A] if i != 0] +[0]))
n = int(input())
numbers = []
i = 0
while i <= n:
  numbers.append(int(input()))
  i += 1

j = 0
s = 0
while n >= j:
  s += 1/numbers[j]
  j += 1

print(1/s)

### FIXED CODE ###

n = int(input())
a = map(int, input().split())
print('{:.16g}'.format(1/sum(1/x for x in a)))
s=list(input())
divide=["dream","erase","eraser","dreamer"]
def dfs(n):
        if n==len(s):
                return True
        for i in divide:
                if n+len(i)<=len(s):
                        if "".join(s[n:n+len(i)]):
                                if dfs(n+len(i)):
                                        return True
        return False
print("YES") if dfs(0) else print("NO")


### FIXED CODE ###

s=input().replace("eraser",",").replace("erase",",").replace("dreamer",",").replace("dream",",").replace(",","")
print("YES" if s=="" else "NO")
x = ((N - (N % 111)) / 111) * 111

### FIXED CODE ###

N = int(input())
if N % 111 == 0:
        x = ((N - (N % 111)) / 111) * 111
else:
        x = (((N - (N % 111)) / 111) + 1) * 111
print(int(x))
data = [
    [[0 for r in range(10)] for f in range(3)] for b in range(4)
]
    
count = int(input())
for c in range(count):
    b,f,r,v = [int(i) for i in input().split()]
    data[b-1] [f-1] [r-1] += v
    
for bi, b in enumerate(data):
    for f in b:
        for r in f:
            print(' {0}'.format(r), end='')
        print()
     print()
    if bi < 3:
        print('#' * 20)

### FIXED CODE ###

data = [
    [[0 for r in range(10)] for f in range(3)] for b in range(4)
]
    
count = int(input())
for c in range(count):
    b,f,r,v = [int(i) for i in input().split()]
    data[b-1] [f-1] [r-1] += v
    
for bi, b in enumerate(data):
    for f in b:
        for r in f:
            print(' {0}'.format(r), end='')
        print()
    if bi < 3:
        print('#' * 20)
print("YES" if n == 7 or n == 5 or n == 3 for n in [int(input())] else "NO")

### FIXED CODE ###

n = int(input())
print("YES" if n == 7 or n == 5 or n == 3 else "NO")
n = input()
l = []
for i in range(1,int(n)+1):
  if len(i)%2 != 0:
    l.append(i)

print(len(l))

### FIXED CODE ###

n = input()
l = []
for i in range(1,int(n)+1):
  if len(str(i))%2 != 0:
    l.append(i)

print(len(l))
a,b = map(int, input().split())
if a*2 == b or a*4==b:
    print("Yes")
elif b%2==0 and y -2*a >= 0 and 4*a-b>=0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a,b = map(int, input().split())
if a*2 == b or a*4==b:
    print("Yes")
elif b%2==0 and b -2*a >= 0 and 4*a-b>=0:
    print("Yes")
else:
    print("No")
N = int(raw_input())
list_input = map(int, raw_input().split())

list_input = sorted(list_input)
sums = 0
for i in range(0,2*N,2):
    print(i)
    sums += min(list_input[i],list_input[i+1])
print(sums)

### FIXED CODE ###

N = int(raw_input())
L = map(int,raw_input().split())
L.sort(reverse = True)
ans = 0
for i in xrange(N):
    ans += min(L[2*i],L[2*i+1])
print ans
a, b = map(int(input()))

if abs(a-b) < 2:
    print("Yay!")
else:
    print(":(")

### FIXED CODE ###

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

if abs(a-b) < 2:
    print("Yay!")
else:
    print(":(")
a=int(input())
b=int(input())
for i in range(3)
	if((i+1==a or i+1==b)=False):
    	print(i+1)

### FIXED CODE ###

a=int(input())
b=int(input())
for i in range(3):
    if((i+1==a or i+1==b)==False):
        print(i+1)
###
### atcorder test program
###

### math class
class math:
    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    def gcd_list(self, A):
        if not A:
            return 0
        for i in reversed(range(1, self.gcd(max(A),min(A))+1)):
            count = 0
            for j in A:
                if (j % i) == 0:
                    count += 1
            if count == len(A):
                return i
        return 0

### input num
#i = input()
#A, B, T = [int(x) for x in i.split()]
N = int(input())
A = [int(x) for x in input().split()]
#C = [int(x) for x in input().split()]

### input debug
#print("debug:{}".format(gcd(max(A),min(A))))
#print(list(reversed(range(1, gcd(max(A),min(A))+1))))

mathfunc = math()
anslist = []

for i in range(N):
    Rgcd = mathfunc.gcd_list(A[:i])
    Lgcd = mathfunc.gcd_list(A[i+1:])
    anslist.append(mathfunc.gcd(Rgcd,Lgcd))

### output
print(max(anslist))


### FIXED CODE ###

## input num
i = input()
A, B, T = [int(x) for x in i.split()]

print((T//A)*B)
#066-D
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
d=Counter(a).most_common(1)[0][0]
f,s=-1,-1
fc=[1 for i in range(n+2)]
for i in range(n+1):
    if a[i]==d:
        if f==-1:
            f=i
        else:
            s=i
    fc[i+1]=(i+1)*fc[i]
fc[n+1]=(n+1)*fc[n]
for k in range(1,n+2):
    if k==1:
        print(n)
    elif k>f+1+n+1-s-1:
        print(int(fc[n+1]/(fc[k]*fc[n+1-k])))
    else:
        print(int(fc[n+1]/(fc[k]*fc[n+1-k])-fc[f+n-s]/(fc[k-1]*fc[f+n-s-(k-1)])))

### FIXED CODE ###

n = int(input())
a = input().split()
a = [int(m) for m in a]
dic = {}
dic2 = {}
for i in range(n + 1):
    dic[a[i]] = 0
    dic2[a[i]] = []
f = 0
s = 0
for i in range(n + 1):
    dic[a[i]] += 1
    dic2[a[i]].append(i)
    if dic[a[i]] == 2:
        f = dic2[a[i]][0]
        s = i
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
 
mod = 10**9+7 #出力の制限
N = n + 1
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
 
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
 
 
for i in range(n + 1):
    if i == 0:
        print(n)
    else:
        if f + n - s >= i:
            if (cmb(n + 1, i + 1, mod) - cmb(f + n - s, i, mod)) >= 0:
                print(cmb(n + 1, i + 1, mod) - cmb(f + n - s, i, mod))
            else:
                print(cmb(n + 1, i + 1, mod) - cmb(f + n - s, i, mod) + mod)
        else:
            print(cmb(n + 1, i + 1, mod))
n,m = set(map(int, input().split()))
a = set(map(int,input().split()))
d = sum(a)/(4.0*m)
count = 0
for x in a:
    if x >= d:
        count += 1
if m <= count:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
count = 0
for x in a:
    if x >= sum(a) / (4 * m):
        count += 1
if m <= count:
    print("Yes")
else:
    print("No")
sys.setrecursionlimit(1000000)
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)
n = int(input())
A = list(map(int, input().split()))
def left(i):
    if i < 1:
        return 0
    return gcd(left(i-1), A[i-1])
def right(i):
    if i+1 > n-1:
        return 0
    return gcd(right(i+1), A[i+1])
ans = 0
for i in range(n):
    ans = max(ans, gcd(left(i), right(i)))
print(ans)

### FIXED CODE ###

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)
n = int(input())
A = list(map(int, input().split()))
L = [0]*n
R = [0]*n
for i in range(n-1):
    R [i+1] = gcd(R[i], A[i])
    L[i+1] = gcd(L[i], A[-i-1])
print(max(gcd(R[i], L[-i-1]) for i in range(n)))
S = list(input())
ans = 0
i = 0
lst = ["A","C","G","T"]
while i < len(S):
    cnt = 0
    if S[i] in lst:
        cnt = 1
        for j in range(1 , 4):
            if not S[j + i] in lst or i + j >= len(S):
                break
            cnt += 1
        ans = cnt
    i += j
print(ans)

### FIXED CODE ###

S = list(input())
ans = 0
i = 0
cnt = 0
lst = ["A","C","G","T"]
for c in S:
    if c in lst:
        cnt += 1
    else:
        if ans < cnt:
            ans = cnt
        cnt = 0
if ans < cnt:
    ans = cnt
print(ans)
O = input()
E = input()
S = ''
for i in range(len(E)):
    S += O[i] + E[i]
print(S if len(O) == len(E) else S+0[-1])

### FIXED CODE ###

O = input()
E = input()
S = ''
for i in range(len(E)):
    S += O[i] + E[i]
print(S if len(O) == len(E) else S+O[-1])
a,b,c=map(int,input().split())
for _ in range(100):
  if (a*i)%b==c:
    print("YES")
    break
  else:
    pass

### FIXED CODE ###

a,b,c=map(int,input().split())
for i in range(100):
  if (a*i)%b==c:
    print("YES")
    exit()
print("NO")
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    s = input()
    n = len(s)
    cur_l = 0
    cur_r = n-1
    ans = 0
    cnt = 0
    while cur_l < cur_r:
        while s[cur_l] == 'x':
            cnt += 1
            cur_l += 1
        while s[cur_r] != s[cur_l]:
            if s[cur_r] != 'x':
                print(-1)
                return
            cur_r -= 1
            cnt -= 1
        ans += abs(cnt)
        cur_l += 1
        cur_r -= 1
        cnt = 0
        
    print(ans)   
    
        

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    s = input()
    n = len(s)
    sr = s.replace('x', '')
    if sr == '':
        print(0)
        return
    elif sr != sr[::-1]:
        print(-1)
        return
    cur_l = 0
    cur_r = n-1
    ans = 0
    cnt = 0
    while cur_l < cur_r:
        while s[cur_l] == 'x':
            cnt += 1
            cur_l += 1
        while s[cur_r] != s[cur_l]:
            cur_r-=1
            cnt -= 1
        ans += abs(cnt)
        cur_l += 1
        cur_r -= 1
        cnt = 0
        
    print(ans)   
    
        

if __name__ == '__main__':
    main()
l = input().split(" ")
s = input().split(" ")

H = int(l[0])
W = int(l[1])
h = int(s[0])
w = int(s[1])

print(HW-(wH + hW - wh))

### FIXED CODE ###

l = input().split(" ")
s = input().split(" ")

H = int(l[0])
W = int(l[1])
h = int(s[0])
w = int(s[1])

print(H*W-(w*H + h*W - w*h))
n = input();ans="ACGT";k=ans.index(n)^3;print(ans[k])

### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007


#A
def A():
    n = input()
    if n == "A":
        print("T")
    elif n == "C":
        print("G")
    elif n == "G":
        print("C")
    else:
        print("A")
    return

#B
def B():
    s = S()
    ans = 0
    n = len(s)
    for i in range(n):
        for j in range(i,n):
            f = 1
            for k in range(i,j+1):
                if s[k] not in list("AGCT"):f = 0
            if f:
                ans = max(ans,j+1-i)
    print(ans)
#C
def C():
    n,q = LI()

    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    B()
# coding: utf-8

def paint(node):
	for n in adj_list[node]:
		if color_list[n[0]] != "-1":
			continue

		if n[1] % 2 == 0:
			color_list[n[0]] = color_list[node]
		else:
			if color_list[node] == "0":
				color_list[n[0]] = "1"
			else:
				color_list[n[0]] = "0"

		paint(n[0])

N = int(input())
adj_list = [[] for i in range(N)]

for i in range(N - 1):
	elm = [int(x) for x in input().split()]
	adj_list[elm[0] - 1].append([elm[1] - 1, elm[2]])
	adj_list[elm[1] - 1].append([elm[0] - 1, elm[2]])

color_list = ["-1"] * N
color_list[0] = "0"

import sys
sys.setrecursionlimit(10000)
paint(0)

for c in color_list:
	print(c)

### FIXED CODE ###

# coding: utf-8

def paint():
	while len(stack) > 0:
		node = stack.pop()
		for n in adj_list[node]:
			if color_list[n[0]] != "-1":
				continue

			stack.append(n[0])

			if n[1] % 2 == 0:
				color_list[n[0]] = color_list[node]
			else:
				if color_list[node] == "0":
					color_list[n[0]] = "1"
				else:
					color_list[n[0]] = "0"

N = int(input())
adj_list = [[] for i in range(N)]

for i in range(N - 1):
	elm = [int(x) for x in input().split()]
	adj_list[elm[0] - 1].append([elm[1] - 1, elm[2]])
	adj_list[elm[1] - 1].append([elm[0] - 1, elm[2]])

color_list = ["-1"] * N
color_list[0] = "0"

import sys
sys.setrecursionlimit(10000)

stack = [0]
paint()

for c in color_list:
	print(c)
n,m = list(map(int,input().split()))
counter = 0
data = []
#入力処理
for i in range(n):
  data.append(input().split())
num = [int(s) for s in range(1,n+1)]
checkd = []
tmp = 0
wa = 0
for i in range(n):
  if data[i][1] == "WA":
    tmp += 1
  elif data[i][1] == "AC" and data[i][0] not in checkd:
    counter += 1
    checkd.append(data[i][0])
    wa += tmp
    tmp = 0
print(counter,wa)

  
  



### FIXED CODE ###

n,m = list(map(int,input().split()))
counter = 0
data = []
tmp = {}#問題番号をkeyとしてWAをカウント

wa = 0
#入力処理
for _ in range(m):
  a,b = input().split() #入力処理
  if b == "WA": #解答がWA→tmpに問題番号をkeyとしてカウント
    if int(a) not in tmp:
      tmp[int(a)] = 0
    if tmp[int(a)] != -1:
      tmp[int(a)] += 1
  if int(a) not in tmp: #WA無しのACの対応 
    tmp[int(a)] = 0
  if (( b == "AC") and (tmp[int(a)] != -1)):#解答がACでtmp[問題番号]が出力済みでない場合
    counter += 1
    #checkd.append(int(a))
    wa += tmp[int(a)] #問題番号aの値をWAの合計に加算
    tmp[int(a)] = -1 #問題番号aが加算済み


"""
for i in range(m):
  if data[i][1] == "WA":
    if int(data[i][0]) not in tmp:
      tmp[int(data[i][0])] = 0
    tmp[int(data[i][0])] += 1  
  elif ((data[i][1]) == "AC") and (int(data[i][0]) not in checkd):
    counter += 1
    checkd.append(int(data[i][0]))
    if int(data[i][0] ) not in tmp:
      tmp[int(data[i][0])] = 0  
    wa += tmp[int(data[i][0])]
"""    
print(counter,wa)
n,x,m = map(int,input().split())
exist = [0] * (m+1)
ans = 0
imamade = []
cnt = 0
for i in range(1,n+1):
    if exist[x] == 1:
        break
    else:
        ans += x
        exist[x] = 1
        imamade.append(x)
        x *= x
        x %= m
        cnt += 1
    if i == n-1:
        print(ans)
        exit()
num = imamade.index(x)
print(sum(imamade[:num]) + sum(imamade[num:]) * ((n-num) // (cnt-num)) + sum(imamade[num:num+((n-num) % (cnt-num))]))



### FIXED CODE ###

n,x,m = map(int,input().split())
exist = [0] * (m+1)
ans = 0
imamade = []
cnt = 0
for i in range(1,n+1):
    if exist[x] == 1:
        break
    else:
        ans += x
        exist[x] = 1
        imamade.append(x)
        x *= x
        x %= m
        cnt += 1
    if i == n:
        print(ans)
        exit()
num = imamade.index(x)
print(sum(imamade[:num]) + sum(imamade[num:]) * ((n-num) // (cnt-num)) + sum(imamade[num:num+((n-num) % (cnt-num))]))
import numpy as np
N = int(input())
A = list(map(lambda x:int(x),input().split(" ")))
npA = np.array(A)
B = npA-(1+np.arange(len(npA)))
opt_b = statistics.median(B)
print(int(np.sum(np.abs(B-opt_b))))

### FIXED CODE ###

import numpy as np
from statistics import median
N = int(input())
A = list(map(lambda x:int(x),input().split(" ")))
npA = np.array(A)
B = npA-(1+np.arange(len(npA)))
opt_b = median(B)
print(int(np.sum(np.abs(B-opt_b))))
import heapq

n = int(raw_input())
values = map(int, raw_input().split())
values = sorted(values)
h = []
for v in values:
  heapq.heappush(h, -v)

while len(h) > 1:
  a = heapq.heappop()
  b = heapq.heappop()
  c = (a+b)/2
  heapq.heappush(h, c)
 
print -heapq.heappop()


### FIXED CODE ###

import heapq
 
n = int(raw_input())
values = map(int, raw_input().split())
values = sorted(values, reverse=True)
 
print sum(((0.5)**(i+1))*v for i, v in enumerate(values)) + ((0.5)**(len(values)))*values[-1]
from math import sqrt
# map(int,input().split())
a,b,c = map(int,input().split())
if 4*a*b < (c-a-b)*(c-a-b):
  print("Yes")
else if 4*a*b >= (c-a-b)*(c-a-b):
  print("No")
else:
  print("Yes")

### FIXED CODE ###

from math import sqrt
# map(int,input().split())
a,b,c = map(int,input().split())
if (c-a-b>0)and(4*a*b < (c-a-b)*(c-a-b)):
  print("Yes")
else:
  print("No")
import math
N, P = map(int, input().split())
p = math.ceil(P**(1/N))
ans = 1
flag=False
if N==1:
  print(P)
  exit(0)


for i in reversed(range(1,p+1)):
    if P % (i ** N) == 0:
        ans = i
        break
print(ans)


### FIXED CODE ###

import math
N, P = map(int, input().split())
p = P**(1/N)
ans = 1
flag=False
if N==1:
  print(P)
  exit(0)


divisors=[]

for i in range(2,round(P**(1/N))+1):
  if P%i==0:
    divisors.append(i)
for i in reversed(divisors):
    if P % (i ** N) == 0:
        ans = i
        break
print(ans)