Harryxun/stf_run huggingface dataset:
#include <complex>
#include <iostream>
#include <vector>
using namespace std;
typedef complex<double> cd;
vector<cd >A;
cd j=sqrt(-1),p,p1,p2;
double a,b;
int n;
int f(int m,int i1,int i2){
	int i,s1=2,s2=2;
	double c=acos(a/2);
	p1=polar(1.0,b+c)+p;
	p2=polar(1.0,b-c)+p;
	for(i=0;i<n;i++){
		if(i==i1||i==i2)continue;
		if(abs(A[i]-p1)-1<1e-6)s1++;
		if(abs(A[i]-p2)-1<1e-6)s2++;
	}
	if(m<s1)m=s1;
	if(m<s2)m=s2;
	return m;
}
int main(){
	int m,i,i1;
	char c;
	while(cin>>n,n!=0){
		A.clear();A.resize(n);
		for(i=0;i<n;i++){
			cin>>a>>c>>b;
			A[i]=cd(a,b);
		}
		m=1;
		for(i=0;i<n;i++){
			p=A[i];
			for(i1=i+1;i1<n;i1++){
				a=abs(A[i1]-p);
				b=arg(A[i1]-p);
				if(a<=2)m=f(m,i,i1);
			}
		}
		cout<<m<<endl;
	}
}

### FIXED CODE ###

import math,cmath
def f(m):
  c=1j*math.acos(a/2)
  r=cmath.exp(b+c)+p
  s=cmath.exp(b-c)+p
  u,v=2,2
  for t in A:
    if t in[p,q]:continue
    if abs(t-r)-1<1e-6:u+=1
    if abs(t-s)-1<1e-6:v+=1
  return max(m,u,v)

while 1:
  n=input()
  if n==0:break
  N=range(n)
  A=[]
  for i in N:
    x,y=map(float,input())
    A+=[x+1j*y]
  m=1
  for i in N:
    p=A[i]
    for q in A[i+1:]:
      a,b=cmath.polar(q-p)
      b*=1j
      if a<=2:m=f(m)
  print m
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

plus = []
minus = []
for i in a:
    if i > 0: plus.append(i)
    if i < 0: minus.append(i)

ans = 1
if k > len(plus) + len(minus):
    ans = 0
elif len(minus) == 0:
    plus.sort(reverse=True)
    if k > len(plus):
        ans = 0
    else:
        for i in range(k):
            ans = (ans * plus[i]) % mod
elif len(plus) == 0:
    if k > len(minus):
        ans = 0
    elif k % 2 == 0:
        minus.sort()
        for i in range(k):
            ans = (ans * minus[i]) % mod
    else:
        if n != len(minus):
            ans = 0
        else:
            minus.sort(reverse=True)
            for i in range(k):
                ans = (ans * minus[i]) % mod
elif k == len(plus) + len(minus) and (len(minus) % 2) == 1:
    if n != len(plus) + len(minus):
        ans = 0
    else:
        for x in plus:
            ans = (ans * x) % mod
        for y in minus:
            ans = (ans * y) % mod
else:
    plus.sort(reverse=True)
    minus.sort()
    if k > len(plus) + len(minus):
        ans = 0
    else:
        i, j = 0, 0
        if k % 2 == 1:
            ans = plus[0]
            i = 1
        while i + j < k:
            tmp_p = plus[i] * plus[i + 1] if i <= len(plus) - 2 else 1
            tmp_m = minus[j] * minus[j + 1] if j <= len(plus) - 2 else 1
            if tmp_p >= tmp_m:
                ans = (ans * (tmp_p % mod)) % mod
                i += 2
            else:
                ans = (ans * (tmp_m % mod)) % mod
                j += 2
print(ans)


### FIXED CODE ###

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

plus = []
minus = []
for i in a:
    if i > 0: plus.append(i)
    if i < 0: minus.append(i)

ans = 1
if k > len(plus) + len(minus):
    ans = 0
elif len(minus) == 0:
    plus.sort(reverse=True)
    for i in range(k):
        ans = (ans * plus[i]) % mod
elif len(plus) == 0:
    if k % 2 == 0:
        minus.sort()
        for i in range(k):
            ans = (ans * minus[i]) % mod
    else:
        if n != len(minus):
            ans = 0
        else:
            minus.sort(reverse=True)
            for i in range(k):
                ans = (ans * minus[i]) % mod
elif k == len(plus) + len(minus) and (len(minus) % 2) == 1:
    if n != k:
        ans = 0
    else:
        for x in plus:
            ans = (ans * x) % mod
        for y in minus:
            ans = (ans * y) % mod
else:
    plus.sort(reverse=True)
    minus.sort()
    i, j = 0, 0
    if k % 2 == 1:
        ans = plus[0]
        i = 1
    while i + j < k:
        tmp_p = plus[i] * plus[i + 1] if i <= len(plus) - 2 else 1
        tmp_m = minus[j] * minus[j + 1] if j <= len(minus) - 2 else 1
        if tmp_p >= tmp_m:
            ans = (ans * (tmp_p % mod)) % mod
            i += 2
        else:
            ans = (ans * (tmp_m % mod)) % mod
            j += 2
print(ans)
n,x=map(int,input().split())
l=list(map(int,input().split()))
i=z=0
while z<=x:
    z+=l[i]
    i+=1
print(i)

### FIXED CODE ###

n,x=map(int,input().split())
l=list(map(int,input().split()))
i=z=0
while z<=x and i<n:
    z+=l[i]
    i+=1
if z<=x:
    i+=1
print(i)
S=int()
W=int()
S=input()
W=input()

if S<=W:
    print("unsafe")
else:
    print("safe")

### FIXED CODE ###

S, W = map(int, input().split())
 
print("unsafe" if W >= S else "safe")
N,M = map(int,input().split())
print("Yes" N==M else "No")

### FIXED CODE ###

a,b = map(int,input().split())
print("Yes" if a==b else "No")
n,m = map(int,input().split())
cnt = 0
for i in range(n,m+1):
  s = str(i)
  if s == s[::-1]
    cnt +=1
print(cnt)

### FIXED CODE ###

a,b = map(int,input().split())
cnt = 0
for i in range(a,b+1):
  i = list(str(i))
  if i == i[::-1]:
    cnt += 1
print(cnt)
a, b, c = map(int,input(),split())
if c == a + b:
    print("Yes")
if b == a + c:
    print("Yes")
if a == b + c:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a,b,c = map(int,input().split())
if c == a+b or b == a+c or a == b+c:
    print("Yes")
else:
    print("No")
a,b = map(int,input())
print(str(a*b-a-b+1))

### FIXED CODE ###

a,b = map(int,input().split())
print(str(a*b-a-b+1))
a, b = (int(i) for i in input().split()) 

list=[]
 
for i in range(a):
    list.append(int(input()))

new_list = sorted(list)

sabun = None

for i in range(len(new_list)-1):

    if b - i < 1:
        break

#    if i+b-1 > len(new_list):
#        break

    bbb = new_list[i+b-1] - new_list[i]

    if sabun == None:
        sabun = bbb
        continue

    if sabun > bbb:
        sabun = bbb
    
print(sabun)

### FIXED CODE ###

a, b = (int(i) for i in input().split()) 

list=[]
 
for i in range(a):
    list.append(int(input()))

new_list = sorted(list)

sabun = None

for i in range(len(new_list)):

    bbb = new_list[i+b-1] - new_list[i]

    if sabun == None:
        sabun = bbb
        continue

    if sabun > bbb:
        sabun = bbb

    if i+b == len(new_list):
        break
    
print(sabun)
#108b
import math

x1,y1,x2,y2 = map(int, input().split())

#正方形なのでベクトル(x2,y2)→(x3,y3)とベクトル(x2,y2)→(x1,y1)は同じ長さで直交している。
#(x3-x2)=xA
#(y3-y2)=yA
#(x1-x2)=xB
#(y1-y2)=yB
#とする。

#・大きさ同じ
# (x3-x2)**2+(y3-y2)**2 = (x1-x2)**2+(y1-y2)**2
# xA**2 + yA**2 = xB**2 + yB**2
#・直交→内積は0
# (x3-x2)*(x1-x2) + (y3-y2)*(y1-y2) = 0
# xA * xB = yA * yB

#整理すると
#yA = xA * xB / yB
#xA**2 + yA**2 = xB**2 + yB**2
#xA**2 + (xA * xB / yB)**2 = xB**2 + yB**2
#xA**2 * {1 + (xB / yB)**2)} = xB**2 + yB**2
#xA**2 = {xB**2 + yB**2} / {1 + (xB / yB)**2}

#xA = ±sqrt({xB**2 + yB**2} / {1 + (xB / yB)**2})
#yA = xA * xB / yB

xB = x1 - x2
yB = y1 - y2

xA = math.sqrt((xB**2 + yB**2) / (1 + (xB / yB)**2))
yA = xA * xB / yB
y3 = yA + y2

xA = -1 * math.sqrt((xB**2 + yB**2) / (1 + (xB / yB)**2))
yA = xA * xB / yB
x3 = xA + x2

###############################################################
#上と同様に考える
#xA = x4-x1
#yA = y4-y1
xB = x2 - x1
yB = y2 - y1

xA = math.sqrt((xB**2 + yB**2) / (1 + (xB / yB)**2))
yA = xA * xB / yB
y4 = yA + y1

xA = -1 * math.sqrt((xB**2 + yB**2) / (1 + (xB / yB)**2))
yA = xA * xB / yB
x4 = xA + x1

print(int(x3),int(y3),int(x4),int(y4))

### FIXED CODE ###

def get_ans(x1,y1,x2,y2):
    def_x = abs(x2-x1)
    def_y = abs(y2-y1)

    if x2 < x1 and y2 <= y1:
        x3 = x2+def_y
        y3 = y2-def_x
        x4 = x1+def_y
        y4 = y1-def_x 
    elif y2 < y1 and x1 <= x2:
        x3 = x2+def_y
        y3 = y2+def_x
        x4 = x1+def_y
        y4 = y1+def_x     
    elif x2 > x1 and y1 <= y2:
        x3 = x2-def_y
        y3 = y2+def_x
        x4 = x1-def_y
        y4 = y1+def_x 
    elif y2 > y1 and x1 >= x2:
        x3 = x2-def_y
        y3 = y2-def_x
        x4 = x1-def_y
        y4 = y1-def_x

    print(x3,y3,x4,y4)
    #return x3,y3,x4,y4

x1,y1,x2,y2 = map(int, input().split())
get_ans(x1,y1,x2,y2)
x, y, a, b, c = map(int, input().split())
pn = list(map(int, input().split()))
qn = list(map(int, input().split()))
rn = list(map(int, input().split()))

pn.sort(reverse=True)
qn.sort(reverse=True)

pqr = pn[:x] + qn[:y] + rn
pqr.sort(reverse=True)
  
print(sum(pqr[:x+y]))


### FIXED CODE ###

s = input()
if s[2] == s[3] and s[4] == s[5]:
  print('Yes')
else:
  print('No')
int x
raw_input(x)
int y = x%3
print(y)

### FIXED CODE ###

x = int(input())
y = int(x/3)
print(y)
# -*- coding: utf-8 -*-
from itertools import itertools_with_replacement
N,M,Q=map(int,input().split())
abcd=[]
for _ in range(Q):
    abcd.append(tuple(map(int,input().split())))
Abase=[]
for a in range(1,M+1):
    Abase=Abase+[a]
A=set(itertools.combinations_with_replacement(Abase,N))
ans=0
for i in A:
    temp=0
    for j in abcd:
        if i[j[1]-1]-i[j[0]-1]==j[2]:
            temp=temp+j[3]
    if temp>=ans:
        ans=temp
print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import itertools
N,M,Q=map(int,input().split())
abcd=[]
for _ in range(Q):
    abcd.append(tuple(map(int,input().split())))
Abase=[]
for a in range(1,M+1):
    Abase=Abase+[a]
A=set(itertools.combinations_with_replacement(Abase,N))
ans=0
for i in A:
    temp=0
    for j in abcd:
        if i[j[1]-1]-i[j[0]-1]==j[2]:
            temp=temp+j[3]
    if temp>=ans:
        ans=temp
print(ans)
n,m=map(int, input().split())
list1=[list(map(int,input().split())) for i in range(m)]

ans=['x']*3
non=0
for i in range(m):
    if ans[list1[i][0]-1]!='x':
        if int(ans[list1[i][0]-1])==list1[i][1]:
            continue
        else:
            non=-1
            break
    else:
        ans[list1[i][0]-1]=str(list1[i][1])

if non==-1:
    print(-1)
else:
    if ans[0]=='0':
        print(-1)
    else:
        if 'x' in ans:
            if ans[0]=='x':
                ans[0]='1'
            else:
                for i in range(n):
                    if ans[i]=='x':
                        ans[i]='0'
        K=''
        for i in range(n):
            K+=ans[i]
        print(int(K))

### FIXED CODE ###

n,m=map(int, input().split())
list1=[list(map(int,input().split())) for i in range(m)]

ans=['x']*n
non=0
for i in range(m):
    if ans[list1[i][0]-1]!='x':
        if int(ans[list1[i][0]-1])==list1[i][1]:
            continue
        else:
            non=-1
            break
    else:
        ans[list1[i][0]-1]=str(list1[i][1])

if non==-1:
    print(-1)
else:
    if ans[0]=='0' and n!=1:
        print(-1)
    else:
        if 'x' in ans:
            if ans[0]=='x' and n!=1:
                ans[0]='1'
            for i in range(n):
                if ans[i]=='x':
                    ans[i]='0'
        K=''
        for i in range(n):
            K+=ans[i]
        print(int(K))
import itertools

N,C=map(int,input().split())
D=[[] for _ in range(C)]
c=[[] for _ in range(N)]

for i in range(C):
    D[i]=list(map(int,input().split()))
    
for i in range(N):
    c[i]=list(map(int,input().split()))
    
hist=[[0]*3 for i in range(C)]#hist[i][j]は余りiのマスにj色のマスがいくつあるか
    
    
for i in range(N):
    for j in range(N):
        rem=(i+j+2)%3
        hist[rem][c[i][j]-1]+=1
    
ans=10**10
for cset in itertools.permutations(range(C), 3):
    temp=0
    for i in range(3):
        for j in range(C):
            temp+=hist[i][j]*D[j][cset[i]]
    ans=min(ans,temp)
    
print(ans)
    

### FIXED CODE ###

import itertools

N,C=map(int,input().split())
D=[[] for _ in range(C)]
c=[[] for _ in range(N)]

for i in range(C):
    D[i]=list(map(int,input().split()))
    
for i in range(N):
    c[i]=list(map(int,input().split()))
    
hist=[[0]*C for i in range(3)]#hist[i][j]は余りiのマスにj色のマスがいくつあるか
    
    
for i in range(N):
    for j in range(N):
        rem=(i+j+2)%3
        hist[rem][c[i][j]-1]+=1
    
ans=10**10
for cset in itertools.permutations(range(C), 3):
    temp=0
    for i in range(3):
        for j in range(C):
            temp+=hist[i][j]*D[j][cset[i]]
    ans=min(ans,temp)
    
print(ans)
N, S = map(int, input().split())
A = list(int(x) for x in input().split())
MOD = 998244353

dp = [[0] * (S+1) for _ in range(N+1)]
dp[0][0] = 1

for i in range(N):
    for j in range(S+1):
        print(i, j)
        # 1,2のケース。jが変わらない遷移が2通りある。
        dp[i+1][j] += dp[i][j] * 2
        # 3のケース。j+A[i] <= Sならば、j+A[i]に遷移する。
        if j + A[i] <= S:
            dp[i+1][j+A[i]] += dp[i][j]
        print(dp)
print(dp[N][S])

### FIXED CODE ###

import sys
readline = sys.stdin.readline

N, S = map(int, readline().split())
A = list(int(x) for x in readline().split())
MOD = 998244353

dp = [[0] * (S+1) for _ in range(N+1)]
dp[0][0] = 1

for i in range(N):
    for j in range(S+1):
        # 1,2のケース。jが変わらない遷移が2通りある。
        dp[i+1][j] = (dp[i+1][j] + dp[i][j] * 2) % MOD
        # 3のケース。j+A[i] <= Sならば、j+A[i]に遷移する。
        if j + A[i] <= S:
            dp[i+1][j+A[i]] = (dp[i+1][j+A[i]] + dp[i][j]) % MOD
print(dp[N][S])
s = input()

rtn="dream"and "dreamer" and "eraser" and "erase" in s #""内は探したい文字列，戻り値はtrue/false

    if (rtn) == True:
        print(YES)
    else:
        print(NO)

### FIXED CODE ###

s = input()
a = 0
t = ("")

while a < len(s):
    if s[a+0:a+5] == ("dream") and s[a+5+0:a+5+2] != ("er"):
        a += 5

    elif s[a+0:a+5] == ("dream") and s[a+5+0:a+5+2] == ("er"):
        if s[a+7+0:a+7+3] != ("ase"):
            a += 7

        elif s[a+7+0:a+7+3] == ("ase") and s[a+10+0:a+10+1] != ("r"):
            a += 10

        elif s[a+7+0:a+7+3] == ("ase") and s[a+10+0:a+10+1] == ("r"):
            a += 11

    elif s[a+0:a+5] == ("erase") and s[a+5+0:a+5+1] != ("r"):
        a += 5

    elif s[a+0:a+5] == ("erase") and s[a+5+0:a+5+1] == ("r"):
        a += 6

    else:
        break

if a == len(s):
    print("YES")
else:
    print("NO")
def gcd(a, b):
    if a < 0:
        a = -a
    if b < 0:
        b = -b
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
 

def reduce(function, iterable, initializer=None):
    it = iter(iterable)
    if initializer is None:
        value = next(it)
    else:
        value = initializer
    for element in it:
        value = function(value, element)
    return value

def gcd_list(ls):
    return reduce(gcd, ls)

N, X = list(map(int, input().split()))
xs = list(map(int, input().split()))
ys = [x - X for x in xs]

print(gcd_list(ys))

### FIXED CODE ###

A, B = list(map(int, input().split()))
m = A * B

if m % 2 == 1:
    print('Yes')
else:
    print('No')
N,M=map(int,input().split())
a=[]
for i in range(M):
    tmp=list(map(int,input().split()))
    tmpc=list(map(int,input().split()))
    c=0
    for j in range(len(tmpc)):
        c+=2**(tmpc[j]-1)
    tmp[1]=c
    a+=[tmp]


dp=[[10**10 for j in range(2**N)] for i in range(M)]
dp[0][0]=0
dp[0][a[0][1]]=a[0][0]


for i in range(1,M):
    dp[i]=dp[i-1]
    for j in range(2**N):
        if dp[i-1][j]<10**10:
            q=j|a[i][1]
            dp[i][q]=min(dp[i-1][j]+a[i][0],dp[i][q])

ans=dp[M-1][2**N-1]
print(ans if ans<10**10 else -1)

### FIXED CODE ###

n=int(input())
print(1-(n//2)/n)
inp=input().split(" ")
N=int(inp[0])
K=int(inp[1])
dislike=input().split(" ")
like=[]
for i in range(0,10):
    if str(i) not in dislike:
        like.append(str(i))
def search_min(n,like):
    n=str(n)
    if len(n)==1:
        for i in like:
            if i>=n:
                return i
    else:
        if n[0] in like:
            if n[1]<=like[-1]:
                return n[0]+search_min(n[1:],like)
            else:
                j=like.index(n[0])
                return like[j+1]+like[0]*(len(n)-1)
        else:
            for i in like:
                if i>n[0]:
                    return i+like[0]*(len(n)-1)
search_min(N,like)

### FIXED CODE ###

inp=input().split(" ")
N=int(inp[0])
K=int(inp[1])
dislike=input().split(" ")
like=[]
for i in range(0,10):
    if str(i) not in dislike:
        like.append(str(i))
def search_min(n,like):
    n=str(n)
    if len(n)==1:
        for i in like:
            if i>=n:
                return i
    else:
        if n[0] in like:
            if n[1]<=like[-1]:
                try:
                    return n[0]+search_min(n[1:],like)
                except TypeError:
                    return None
            else:
                j=like.index(n[0])
                if j+1<len(like):
                    return like[j+1]+like[0]*(len(n)-1)
        else:
            for i in like:
                if i>n[0]:
                    return i+like[0]*(len(n)-1)
if search_min(N,like)==None:
    n=len(str(N))
    k="1"+"0"*n
    print(search_min(k,like))
else:
    print(search_min(N,like))
import math
def lcm(x,y):
    return (x * y) // math.gcd(x,y)

A,B,C,D = map(int,input().split())

cnt = 0
cnt += ((B // C) - ((A-1) // C))
cnt += ((B // D) - ((A-1) // D))

tmp = 0
tmp = ((B//lcm(C,D)) - (A//lcm(C,D)))

print(B-A+1-cnt+tmp)


### FIXED CODE ###

from fractions import gcd

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

A,B,C,D = list(map(int,input().split()))
C1 = B//C
C2 = (A-1)//C
C3 = B//D
C4 = (A-1)//D
C5 = B//lcm(C,D)
C6 = (A-1)//lcm(C,D)
print((B-(A-1))-((C1-C2)+(C3-C4)-(C5-C6)))
=int(input())
even=N//2
odd=N-even
print(str(odd/N)+'000000000')


### FIXED CODE ###

n = int(input())
a = n // 2
if n % 2 == 1:
    a += 1
print(a / n)
N = int(input())
p = list(map(int, input().split()))
score = [0] * 101
for x in p:
    score[x] += 1

while True:
    if sum(score[i:]) < i:
        break
    i += 1
print(i-1)

### FIXED CODE ###

N = int(input())
p = list(map(int, input().split()))
score = [0] * 101
for x in p:
    score[x] += 1
print(max(i * (sum(score[i:]) >= i) for i in range(101)))
a,b,k = list(map( int, input().split()))
x = list(range(a,b+1))
x = sorted(list(set(x[:k]+x[-k:])))
for i in x:
  print(i)

### FIXED CODE ###

a,b,k=map(int,input().split())
l=range(a,b+1)
ans=sorted(set(l[:k])|set(l[-k:]))
for i in ans:
    print(i)
import sys
sys.setrecursionlimit(1000000)
a=['dream','dreamer','erase','eraser']
def check(c):
    rt=False
    size=len(c)
    if c=='':
        return True
    for i in a:
        if size>=len(i) and c[:len(i)]==i:
            rt=check(c[len(i):]) or rt
    return rt

print(cnt,'YES' if check(s) else 'NO', s)

### FIXED CODE ###

a=['dream','dreamer','erase','eraser']
def check(c):
    if c=='':
        return True
    size=len(c)
    n=len(c)
    while n>0:
        tmp=n
        for i in a:
            #print(-n-len(i),-n)
            if size>=len(i) and c[n-len(i):n]==i:
                n-=len(i)
        if tmp==n:
            return False
    return True

print('YES' if check(input()) else 'NO')
h, w = map(int, input().split())
board = [[i for i in input()] for _ in range(w)]

def check(i, j):
    if (j-1 >= 0):
        if(board[i][j-1] == "#"):
            return False
    if (j+1 < w):
        if(board[i][j+1] == "#"):
            return False
    if (i-1 >= 0):
        if(board[i-1][j] == "#"):
            return False
    if (i+1 < h):
        if(board[i+1][j] == "#"):
            return False

    return True

def main():
    for i in range(h):
        for j in range(w):
            if (board[i][j] == "#"):
                if(check(i,j)):
                    return "No"

    return "Yes"

if __name__ == '__main__':
    print(main())

### FIXED CODE ###

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

def check(i, j):
    if (j-1 >= 0):
        if(board[i][j-1] == "#"):
            return False
    if (j+1 < w):
        if(board[i][j+1] == "#"):
            return False
    if (i-1 >= 0):
        if(board[i-1][j] == "#"):
            return False
    if (i+1 < h):
        if(board[i+1][j] == "#"):
            return False

    return True

def main():
    for i in range(h):
        for j in range(w):
            if (board[i][j] == "#"):
                if(check(i,j)):
                    return "No"

    return "Yes"

if __name__ == '__main__':
    print(main())
X =int(input())
list = []
for k in range(X):
    for j in range(X):
        if k**2 > X:
            break
        elif k**j > X:
            list.append(k**(j-1))
            break
            
print(max(list))

### FIXED CODE ###

X =int(input())
max = 1 #このように書かないとX = 1,2 のときに正しい値を返せない。listにappendだとlistが空になってエラーになる。
for k in range(X):
    for j in range(X):
        if k**2 > X:
            break
        elif k**j > X:
            sub_max = k**(j-1)
            if sub_max >= max:
                max = sub_max
            break
            
print(max)
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(X: int):
    if X >= 30:
        ret = YES
    else:
        ret = NO
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(X: int):
    if X >= 30:
        ret = YES
    else:
        ret = NO
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()
a, b, n = map(int, input().split())
f = max(n, b-1)

print((a*f)//b -a*(f//b))

### FIXED CODE ###

k = int(input())
a, b = map(int, input().split())
flag = 0
for i in range(a, b+1):
    if i%k == 0:
        flag = 1
        break
if flag == 0:
    print('NG')
else:
    print('OK')
N = int(input())
A = list(map(int, input().split()))

flag = 0

for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0 or if A[i] % 5 == 0:
            pass
        else:
            flag = 1
            break
        
 if flag = 0:
    print("PASS")
 else:
    print("DENIED")

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
flag = 0
for i in range(N):
  if A[i] % 2 == 0:
    if A[i] % 3 == 0 or A[i] % 5 == 0:
      pass
    else:
      flag = 1
      break
if flag == 0:
  print("APPROVED")
else:
  print("DENIED")
while 1:
   H, W = map(raw_input().split())
 
   if H == 0 and W == 0:
      break
   else:
      for i in range(0, H-1):
         print '#'*W
      print '\n'

### FIXED CODE ###

while 1:
   H, W = map(int, raw_input().split())

   if H == 0 and W == 0: 
      break
   for i in range(H):
      print "#"*W
   print ""
n = int(input())
a_list = list(map(int, input().split()))
n_operation = 0
for i in range(n):
    even_len = len([a for a in a_list if a % 2 == 0])
    if len(a_list) != even_len:
        print(n_operation)
        exit()
    else:
        a_list = [a / 2 for a in a_list]
        n_operation += 1

print(n_operation)

### FIXED CODE ###

print(input().count("1"))
h = int(input())
a = int(input())
ans = 0
ans = h // a
ans += 1
print(ans)

### FIXED CODE ###

h,a = list(map(int,input().split()))
ans = 0
syou = h // a
mod = h % a
ans = syou
if(mod != 0):
    ans += 1
print(ans)
import math
a, b = map(int,float,input().split())
ans = int(a * (100*b))
print(int(ans/100))

### FIXED CODE ###

from decimal import Decimal

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

print(int(a*b))
m=[0,1,0,0,0,0,1,0]
(a, b, c) = map(int, raw_input().split())
print ["Close", "Open"][a * 4 + b * 2 + c]

### FIXED CODE ###

m=[0,1,0,0,0,0,1,0]
(a, b, c) = map(int, raw_input().split())
print ["Close", "Open"][m[a * 4 + b * 2 + c]]