Harryxun/stf_run huggingface dataset:
from functools import reduce

def gcd(x,y):
    while y: x,y = y,x%y
    return x

def lcm(x,y):
    return x//gcd(x,y)*y

def ex_euclid(x,y):
    c0,c1 = x,y
    a0,a1 = 1,0
    b0,b1 = 0,1
    while c1:
        a0,a1 = a1,a0-c0//c1*a1
        b0,b1 = b1,b0-c0//c1*b1
        c0,c1 = c1,c0%c1
    return c0,a0,b0

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

LCM = reduce(lcm,A)

SCMs = []
flag = True

for i in range(N-1):
    c,a,b = ex_euclid(A[i],-A[i+1])
    if (A[i+1]-A[i])//2%c == 0:
        SCMs.append(A[i]*((A[i+1]-A[i])//2//c)*a+A[i]//2)
    else:
        flag = False
        break
        
print((M-reduce(lcm,SCMs)%LCM)//LCM+1 if flag else 0)

### FIXED CODE ###

from functools import reduce

def gcd(x,y):
    while y: x,y = y,x%y
    return x

def lcm(x,y):
    return x//gcd(x,y)*y

def ex_euclid(x,y):
    c0,c1 = x,y
    a0,a1 = 1,0
    b0,b1 = 0,1
    while c1:
        a0,a1 = a1,a0-c0//c1*a1
        b0,b1 = b1,b0-c0//c1*b1
        c0,c1 = c1,c0%c1
    return c0,a0,b0

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

if N == 1:
    a = A[0]
    print((M-a//2%a)//a+1)

else:
    LCM = reduce(lcm,A)

    SCMs = []
    flag = True

    for i in range(N-1):
        c,a,b = ex_euclid(A[i],-A[i+1])
        if (A[i+1]-A[i])//2%c == 0:
            SCMs.append(A[i]*((A[i+1]-A[i])//2//c)*a+A[i]//2)
        else:
            flag = False
            break

    print((M-reduce(lcm,SCMs)%LCM)//LCM+1 if flag else 0)
x = raw_input()
print = int(x)^3

### FIXED CODE ###

print int(raw_input()) ** 3
n,k=map(int,input().split())
if 2*n<=k:
    num1=k//n
    n=k-n*(num1-1)
    num = int(n / k)
    ans = min(abs(n - num * k), abs(n - (num + 1) * k))
    print(ans)
elif n<=k<2*n:
    print(min(k-n,k-2*n))
else:
    num=int(n/k)
    ans=min(n-num*k,abs(n-(num+1)*k))
    print(ans)


### FIXED CODE ###

import math
n,k=map(int,input().split())
num=n//k
n=n-num*k
ans=min(abs(k-n),n)
print(ans)
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 30 10:49:33 2018
ABC071C
@author: maezawa
"""
import collections
n = int(input())
a = list(map(int,input().split()))
acount = collections.Counter(a)
auniq = acount.keys()
auniq.sort(reverse=True)
edge1 = 0
ans = 0
for edge in auniq:
    if acount[edge] >= 4:
        if edge1 == 0:
            ans = edge*edge
            break
        else:
            ans = edge1*edge
            break
    if acount[edge] >= 2:
        if edge1 == 0:
            edge1 = edge
        else:
            ans = edge1*edge
            break
print(ans)       



### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sun Sep 30 10:49:33 2018
ABC071C
@author: maezawa
"""
import collections
n = int(input())
a = list(map(int,input().split()))
acount = collections.Counter(a)
auniq = list(acount.keys())
auniq.sort(reverse=True)
edge1 = 0
ans = 0
for edge in auniq:
    if acount[edge] >= 4:
        if edge1 == 0:
            ans = edge*edge
            break
        else:
            ans = edge1*edge
            break
    if acount[edge] >= 2:
        if edge1 == 0:
            edge1 = edge
        else:
            ans = edge1*edge
            break
print(ans)
N = int(input())
h = list(map(int, input().split()))
cnt=[0]*(N-1)
ans=[0]*(N-1)
counter=1
if N==1:
  print(0)
else:
  for i in range(N-1):
    if h[i] >= h[i+1]:
      cnt[i]=counter
    else:
      counter+=1
  for j in range(1,counter+1):
    ans[j-1]=cnt.count(j)
  print(max(ans))

### FIXED CODE ###

N = int(input())
H = [int(x) for x in input().split()]
dp = [0] * len(H) 
for i in range(1, len(H)):
  if H[i-1] >= H[i]: 
    dp[i] = dp[i-1] + 1
ans = max(dp)
print(ans)
from statistics import median

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

for i in range(N):
    an[i] = an[i] - (i+1)
    
b = int(median(bn))

k = []
for i in range(N):
    y = abs(an[i] - b)
    k.append(y)
ans = sum(k)

print(ans)

### FIXED CODE ###

import numpy as np

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

for i in range(N):
    an[i] = an[i] - (i+1)
    
b = int(np.median(an))

k = []
for i in range(N):
    y = abs(an[i] - b)
    k.append(y)
ans = sum(k)

print(ans)
s = input()
if s == str((set(s)):
    print("yes")
else:
    print("no")

### FIXED CODE ###

s = input()
if sorted(list(s)) == sorted(list((set(s)))):
    print("yes")
else:
    print("no")
N = int(input())

N = int(input())
power = 1
for i in range(N):
  power = power*(i+1)
  if power > 10**9+7:
    power = power % (10**9+7)
  
print(power)

### FIXED CODE ###

N = int(input())
power = 1
for i in range(N):
  power = power*(i+1) % (10**9+7)
  
print(power)
import fractions

A, B, C = map(int, input().split())
ab = math.gcd(A, B)
temp = fractions.gcd(A, ab)
if C % temp == 0:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

import fractions

A, B, C = map(int, input().split())
ab = fractions.gcd(A, B)
temp = fractions.gcd(A, ab)
if C % temp == 0:
    print("YES")
else:
    print("NO")
#usr/bin/python3
a, b = input().split()
print(6-int(a)-int(b))

### FIXED CODE ###

#usr/bin/python3
a = input()
b = input()
print(6-int(a)-int(b))
from math import factorial
import bisect

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

lst = sorted(lst)

ans = (-1,-1)
val = -1

def nCr(n,r):
    return factorial(n)/factorial(n-r) * factorial(r)

if n == 2:
    print(max(lst), min(lst))
else:
    for i in range(1, n):
        num = lst[i]
        pos = bisect.bisect_left(lst, num//2)
        r = lst[pos]
        
        tmp_val = nCr(num, r)
        if tmp_val > val:
            val = tmp_val
            ans = (num, r)
    
    print(max(ans), min(ans)

### FIXED CODE ###

n = int(input())
lst = list(map(int,input().split()))
lst.sort()

m = lst[-1]
line = m / 2
r = 10**10

for i in range(n):
    if abs(r-line) > abs(lst[i]-line):
        r = lst[i]
print(m,r)
x = input().split(" ")
command = x[1]
N = x[0]
N += command.lower(x[1])
print(N)

### FIXED CODE ###

n,k=map(int,input().split())
s = input()
 
s = list(s)
s[k - 1] = s[k-1].lower()
s = "".join(s)
print(s)
s = input()

def digitsum(n):
    for i in n:
        ni = int(i)
        res += ni
    return res 

res = digitsum(s)
if res % 9 == 0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

def digitsum(n):
    res = 0
    for i in n:
        #print(ni)
        ni = int(i)
        res += ni
    return res 

s = input()
r = digitsum(s)

if r % 9 == 0:
    print("Yes")
else:
    print("No")
h,w=map(int,input().split())
ans=[]
ans_2=[]
ans_3=[]
ans_4=[]
for i in range(1,w-1):
    a=h*i
    res=w-i
    if res%2==0:
        b=h*(res//2)
        c=b*(res//2)
    else:
        b=h*(res//2)
        c=h*(res//2+1)
    ans.append(max(a,b,c)-min(a,b,c))
for i in range(1,h-1):
    a_2=i*w
    res_2=h-i
    if res_2%2==0:
        b_2=w*(res_2//2)
        c_2=w*(res_2//2)
    else:
        b_2=w*(res_2//2)
        c_2=w*(res_2//2+1)
    ans_2.append(max(a_2,b_2,c_2)-min(a_2,b_2,c_2))
for i in range(1,w-1):
    a_3=i*h
    res_3=w-i
    if h%2==0:
        b_3=res_3*(h//2)
        c_3=res_3*(h//2)
    else:
        b_3=res_3*(h//2)
        c_3=res_3*(h//2+1)
    ans_3.append(max(a_3,b_3,c_3)-min(a_3,b_3,c_3))
for i in range(1,h-1):
    a_4=w*i
    res_4=h-i
    if w%2==0:
        b_4=res_4*(w//2)
        c_4=res_4*(w//2)
    else:
        b_4=res_4*(w//2)
        c_4=res_4*(w//2+1)
    ans_4.append(max(a_4,b_4,c_4)-min(a_4,b_4,c_4))
v=min(ans)
x=min(ans_2)
y=min(ans_3)
z=min(ans_4)
print(min(v,x,y,z))

        

### FIXED CODE ###

h,w=map(int,input().split())
import math
if h%3==0 or w%3==0:
    print(0)
    exit()
w_i=w//2
ans=[]
for i in range(1,h):
    sa=i*w
    sb=(h-i)*w_i
    sc=(h-i)*(w-w_i)
    ans.append(max(sa,sb,sc)-min(sa,sb,sc))
v=min(ans)
ans_3=[]
for l in range(1,h):
    h_half=(h-l)//2
    sa=w*l
    sb=w*h_half
    sc=w*((h-l)-h_half)
    ans_3.append(max(sa,sb,sc)-min(sa,sb,sc))
v_3=min(ans_3)
ans_i=[]
h_i=h//2
for j in range(1,w):
    sa=j*h
    sb=(w-j)*(h_i)
    sc=(w-j)*(h-h_i)
    ans_i.append(max(sa,sb,sc)-min(sa,sb,sc))
v_i=min(ans_i)
ans_2=[]
for k in range(1,w):
    w_half=(w-k)//2
    sa=h*k
    sb=h*w_half
    sc=h*((w-k)-w_half)
    ans_2.append(max(sa,sb,sc)-min(sa,sb,sc))
v_2=min(ans_2)
print(min(v,v_i,v_2,v_3))
#86 5
# sumitb2019_b.py
import math
N = int(input())
for i in range(N):
    if math.floor(i*1.08) == N:
#        print(i)
#        exit()
print(":(")

### FIXED CODE ###

# sumitb2019_b.py
import math 
N = int(input())
for i in range(50000):
    if math.floor(i*1.08) == N:
        print(i)
        exit()
print(":(")
s = 10000000

for i in range(2+max(a)):
  s_tmp = 0
  
  for j in range(n):
    s_tmp = s_tmp + abs(a[l] - i - (j+1))
    
    if s_tmp < s:
      s = s_tmp


### FIXED CODE ###

n = int(input())

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

sorted_num = sorted([a[i] - i for i in range(len(a))])

b = sorted_num[len(sorted_num)//2]
print(sum([abs(b-i) for i in sorted_num]))
a,b,c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)d
list1=[]
list1.append(a*c)
list1.append(a*d)
list1.append(b*c)
list1.append(b*d)
list1.sort()
print(list1[3])

### FIXED CODE ###

a,b,c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
list1=[]
list1.append(a*c)
list1.append(a*d)
list1.append(b*c)
list1.append(b*d)
list1.sort()
print(list1[3])
ans = ""
for i in range(n):
    ans += s[i]
    ans += t[i]

print(ans)


### FIXED CODE ###

n = int(input())
s, t = [ v for v in input().split() ]


ans = ""
for i in range(n):
    ans += s[i]
    ans += t[i]

print(ans)
import math
r = int(input())
area = math.pi * r * r
circum = 2 * math.pi * r
print(str("{0:.6f}".format(area)) + " " + str("{0:.6f}".format(circum)))


### FIXED CODE ###

import math
r = float(input())

area = math.pi * r * r
circum = 2 * math.pi * r
print(str("{0:.6f}".format(area)) + " " + str("{0:.6f}".format(circum)))
import sys

N, K = [int(_) for _ in input().split()]
list = [int(_) for _ in input().split()]

l1 = []
l2 = []
t = 0
for i in list:
    if i < 0:
        l1.append(i)
    elif i == 0:
        t = 1
    else:
        l2.append(i)
l1 = [abs(_) for _ in l1]
l1.sort()

if t == 1 and K == 1:
    print(0)
    sys.exit()

K = K - t
a = float('inf')
b = float('inf')
if len(l1) >= K:
    a = l1[K-1]
if len(l2) >= K:
    b = l2[K-1]

c = float('inf')
d = float('inf')
for i in range(len(l2)):
    if K-i-2 >= 0:
        c_new = l2[i] * 2 + l1[K-i-2]
        c = min(c, c_new)
for j in range(len(l1)):
    if K-j-2 >= 0:
        d_new = l1[j] * 2 + l2[K-j-2]
        d = min(d, d_new)

print(min(a, b, c, d))



### FIXED CODE ###

import sys

N, K = [int(_) for _ in input().split()]
list = [int(_) for _ in input().split()]

l1 = []
l2 = []
t = 0
for i in list:
    if i < 0:
        l1.append(i)
    elif i == 0:
        t = 1
    else:
        l2.append(i)
l1 = [abs(_) for _ in l1]
l1.sort()

if t == 1 and K == 1:
    print(0)
    sys.exit()

K = K - t
a = float('inf')
b = float('inf')
if len(l1) >= K:
    a = l1[K-1]
if len(l2) >= K:
    b = l2[K-1]

c = float('inf')
d = float('inf')
for i in range(len(l2)):
    if len(l1)-1 >= K-i-2 >= 0:
        c_new = l2[i] * 2 + l1[K-i-2]
        c = min(c, c_new)
for j in range(len(l1)):
    if len(l2)-1 >= K-j-2 >= 0:
        d_new = l1[j] * 2 + l2[K-j-2]
        d = min(d, d_new)

print(min(a, b, c, d))
N , T = map(int, input().split())
cost = []
error=[]
for i in range(0 , N ):
    x = [int(x) for x in input().split()]
for i in range (len(x)):
    if x[1]<=T :
        cost.append(x[i][0])
    if x[1] > T:
        error.append(x[i][1])
if len(error) == N :
    print("TLE")
else:
    print(min(cost))



### FIXED CODE ###

n, t = [int(x) for x in input().split()]
result = 1001
for i in range(n):
    a, b = [int(x) for x in input().split()]
    if b <= t and result >= a:
        result = a
if result < 1001:
    print(result)
else:
    print("TLE")
N = int(input())
S = input()

if N % 2 == 0 and S[0, N / 2] == S[N / 2 + 1, N - 1]:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N = int(input())
S = input()

if N % 2 == 0 and S[0:round(N / 2)] == S[round(N / 2):N]:
    print('Yes')
else:
    print('No')
N,A,B,C,D = (int(i) for i in input().split())
S = input()
S = list(S)

result = "Yes"
onon = True

if C < D:
    for i in range(A-1,D:
        if S[i] == "#" and S[i + 1] == "#":
            result =  "No"
else:
    result = "No"
    for i in range(A-1,C):
        if S[i] == "#" and S[i + 1] == "#":
            onon = False
    if onon:
        for i in range(B -2,D-1):
            if S[i] == "." and S[i + 1] == "."and S[i + 2] == ".":
                result = "Yes"


print(result)
    

### FIXED CODE ###

N,A,B,C,D = (int(i) for i in input().split())
S = input()
S = list(S)

result = "Yes"
onon = True

if C < D:
    for i in range(A-1,D):
        if S[i] == "#" and S[i + 1] == "#":
            result =  "No"
else:
    result = "No"
    for i in range(A-1,C):
        if S[i] == "#" and S[i + 1] == "#":
            onon = False
    if onon:
        for i in range(B -2,D-1):
            if S[i] == "." and S[i + 1] == "."and S[i + 2] == ".":
                result = "Yes"


print(result)
a, b, c = map(int, input().split())
if sum(abc)//2 == a or sum(abc)//2 == b or sum(abc)//2 == c:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

a, b, c = map(int, input().split())
if a + b + c == 2 * max(a, max(b, c)):
    print("Yes")
else:
    print("No")
N=int(input())
*V,=map(int,input().split())
import Counter from collections 

c1=Counter(V[0::2]).most_common()+[(0,0)]
c2=Counter(V[1::2]).most_common()+[(0,0)]
if c1[0][0]!=c2[0][0]:
    print(N-c1[0][1]-c2[0][1])
else:
    print(min(N-c1[0][1]-c2[1][1],N-c1[1][1]-c2[0][1]))

### FIXED CODE ###

N=int(input())
*V,=map(int,input().split())
import collections

import collections

c1=collections.Counter(V[0::2])
c1=sorted(c1.items(), key=lambda x: x[1], reverse=True)
e=c1[0][0]

c2=collections.Counter(V[1::2])
c2=sorted(c2.items(), key=lambda x: x[1], reverse=True)
o=c2[0][0]

cnt=0
if e!=o:
    cnt=sum(e!=i for i in V[0::2])
    cnt+=sum(o!=i for i in V[1::2])
else:
    if len(c1)==1 and len(c2)==1:
        cnt=N//2
    elif len(c1)==1:
        cnt1=sum(e!=i for i in V[0::2])
        cnt1+=sum(c2[1][0]!=i for i in V[1::2])
        
        cnt2=sum(e!=i for i in V[0::2])
        cnt2+=sum(c2[1][1]!=i for i in V[1::2])
        cnt=min(cnt1,cnt2)
    elif len(c2)==1:
        cnt1=sum(c1[1][0]!=i for i in V[0::2])
        cnt1+=sum(o!=i for i in V[1::2])

        cnt2=sum(c1[1][1]!=i for i in V[0::2])
        cnt2+=sum(o!=i for i in V[1::2])
        cnt=min(cnt1,cnt2)
    else:    
        cnt1=sum(e!=i for i in V[0::2])
        cnt1+=sum(c2[1][0]!=i for i in V[1::2])
        
        cnt2=sum(c1[1][0]!=i for i in V[0::2])
        cnt2+=sum(o!=i for i in V[1::2])
        cnt=min(cnt1,cnt2)
print(cnt)
import collections
import numpy as np

def prime_factorize(n):
    a = []
    if n%2 ==1:
		a=0
      
    while n % 2 == 0:
		a.append(2)
        n //= 2
    return a

N =int(input())

a = [int(i) for i in input().split()]

ans_array = np.zeros(N)

for i in range(N):
    dummy = prime_factorize(a[i])
  
    ans_array[i] = dummy
ans = int(sum(ans_array))
print(ans)

### FIXED CODE ###

import collections
import numpy as np

def prime_factorize(n):
	a = 0   
	while n % 2 == 0:
		a+=1
		n //= 2
	return a

N =int(input())

a = [int(i) for i in input().split()]

ans_array = np.zeros(N)

for i in range(N):
    dummy = prime_factorize(a[i])
  
    ans_array[i] = dummy
ans = int(sum(ans_array))
print(ans)
A = list(map(int, input().split()))
A.sort()

ans = 0
for i in range(1,3):
  ans += a[i] - a[i-1]
print(ans)

### FIXED CODE ###

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

ans = 0
for i in range(1,3):
  ans += A[i] - A[i-1]
print(ans)
# E - Double Factorial

N = int(input())

ans = 0
p = 10

if (N%2):
    continue
else:
    while True:
        if p > N:
            break
        ans += N // p
        p *= 5

print(ans)


### FIXED CODE ###

# E - Double Factorial

N = int(input())

ans = 0
p = 10

if (N%2==0):
    while True:
        if p > N:
            break
        ans += N // p
        p *= 5

print(ans)
U=int(input())
M=int(input())
B=int(input())

print(U[0].M[1].B[2])

### FIXED CODE ###


U=input()
M=input()
B=input()

print(U[0]+M[1]+B[2])
a = input().split()
n = int(a[0])
m = int(a[1])

x = [-1 for k in range(n)]
ans = "Yes"


for i in range(m):
    b = input().split()
    if i == 0:
        x[int(b[0])-1] = 0
        x[int(b[1])-1] = x[int(b[0])-1] + int(b[2])

    else:
        if (x[int(b[1])-1] != -1) and (x[int(b[1])-1] != (x[int(b[0])-1] + int(b[2]))):
            ans = "No"
            break
        else:
        	x[int(b[1])-1] = x[int(b[0])-1] + int(b[2])
        	

print(ans)
           
          
      
    

### FIXED CODE ###

x = int(input())
a = int(input())
b = int(input())

print((x-a)%b)
i = input()

if i = a :
    print("vowel")
elif i = i:
    print("vowel")
elif i = u:
        print("vowel")
elif i = e:
        print("vowel")
elif i = o:
    print("vowel")
else:
    print("consonant")

### FIXED CODE ###

a = ['a','i','u','e','o']
n = str(input())
 
if n in a:
    print('vowel')
else:
    print('consonant')
n, k = map(int, input().split())
s = input()


def split(s):
    last = ''
    new = []
    for x in s:
        if last != x:
            new.append(x)
        else:
            new[-1] += x
        last = x
    return new


def transform(s, k):

    for _ in range(k):
        s = split(s)
        ls = list(map(len, s))
        idx = ls.index(min(ls))
        if idx == 0:
            idx = ls[1:].index(min(ls[1:]))+1

        # print(s, idx, ls)
        s[idx] = s[idx].replace('L', 'X').replace('R', 'L').replace('X', 'R')

        if ''.join(s) == s:
            break
        else:
            s = ''.join(s)
    # print(s)
    return s


s = transform(s, k)


def count(s):
    cnt = 0
    for i in range(len(s)):
        if i+1 < len(s) and s[i] == 'R' and s[i+1] == 'R':
            cnt += 1
        elif i-1 >= 0 and s[i] == 'L' and s[i-1] == 'L':
            cnt += 1
    return cnt


print(count(s))


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n, k = map(int, input().split())
s = input().rstrip()

def count(s):
    cnt = 0
    for i in range(n):
        if i+1 < len(s) and s[i] == 'R' and s[i+1] == 'R':
            cnt += 1
        elif i-1 >= 0 and s[i] == 'L' and s[i-1] == 'L':
            cnt += 1
    return cnt


print(min(count(s)+2*k, n-1))
n = int(input())
li = input().split(" ")
x = 1
if 0 in li:
    print(0)
else:
    for i in li:
        x = x * i
        if x > 10**18:
            print(-1)
            exit()
    print(x)


### FIXED CODE ###

n = int(input())
al = list(map(int, input().split()))
al.sort()
ans = 1
for a in al:
    ans *= a
    if ans > 10**18:
        print(-1)
        exit()
print(ans)
N ,M ,K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

L = [float("inf") for _ in range(N+M+1)]
L[0] = 0

a = 0
b = 0
ans = 0
for k in range(len(A)):
    a += A[k]
    A[k] = a
for k in range(len(B)):
    b += B[k]
    B[k] = b

AA = [0] + A

BB = [0] + B

for k in range(N+1):
    for j in range(ans-k, M+1):
        if  K >= AA[k] + BB[j]:
            ans = max(k+j, ans)
            continue
        else:
            break
print(ans)

### FIXED CODE ###

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)
N=int(input)
print(N**2-int(input()))

### FIXED CODE ###

print((int(input()))**2-int(input()))
A = int(input())
B = int(input())
C = int(input())
X = int(input())
cnt = 0

for a in range(A + 1):
  for b in range(B + 1):
    for c in range(C + 1):
      if 500 * a + 100 * b + 50 * c == X:
        cnt += 1
        
print(cnt)


### FIXED CODE ###

X = int(input())
A = int(input())
B = int(input())
r = X - A - B * ((X - A) // B)
print(r)
K = int(input())
X = int(input())

if K*500 >= X:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

K,X = map(int, input().split())

if K*500 >= X:
  print("Yes")
else:
  print("No")
#整数の入力
N,K = int(input())

d_list = []
A_list_list = []
for i in range(K):
  #整数の入力
  d = int(input())
  d_list.append(d)
  #スペース区切りの整数の入力リスト
  A_list = list(map(int, input().split()))
  A_list_list.append(A_list)
  
counter = 0
for i in range(N):
  if((i+1 in A_list) ==True):
    counter = counter
  else:
    counter = counter + 1
print(counter)
  


### FIXED CODE ###

#整数の入力
N,K = map(int, input().split())

d_list = []
A_list_list = []
for i in range(K):
  #整数の入力
  d = int(input())
  d_list.append(d)
  #スペース区切りの整数の入力リスト
  A_list = list(map(int, input().split()))
  #print(A_list)
  A_list_list.extend(A_list)
#print(A_list)
counter = 0
for i in range(N):
  if((i+1 in A_list_list) ==True):
    counter = counter
  else:
    counter = counter + 1
print(counter)
import string

ALPHABETS = string.ascii_lowercase

s = input()
N = len(s)
MAX = 2 * 10 ** 5
a = [0] * (N + 1)
for i, c in enumerate(s):
    idx = ALPHABETS.index(c)
    a[i+1] = a[i] ^ (2 ** idx)

opt = [0] * (N + 1)
dp = {}
dp[0] = 0
for i in range(1, N + 1):
    dp[a[i]] = min(dp.get(a[i], MAX), min([dp.get(a[i] ^ 2 ** j, MAX) if not j == -1 else dp.get(a[i] ^ 0, MAX) for j in range(-1, 26)]) + 1)

print(dp[a[N]] if dp[a[N]] != 0 else 1)


### FIXED CODE ###

s = input()
found = False
for i in range(len(s)-1):
    if s[i] == 'A' and s[i+1] == 'C':
        print('Yes')
        found = True
        break
if not found:
    print('No')
n = int(input())
a = list(map(int,input().split()))
neg = 0
for i in a:
  r = r + abs(i)
  if i < 0 :
     neg = neg + 1
if neg % 2 != 0:
  s = 10000000000
  for i in a:
    s = min(s,abs(i))
  r = r - 2*s
  
print(r)

  

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
neg = 0
r=0
for i in a:
  r = r + abs(i)
  if i < 0 :
     neg = neg + 1
if neg % 2 != 0:
  s = 10000000000
  for i in a:
    s = min(s,abs(i))
  r = r - 2*s
  
print(r)
import math
from functools import reduce
def gcds(*numbers):
    return reduce(math.gcd, numbers)

def resolve():
    N = int(input())
    As = list(map(int, input().split(" ")))
    if N == 2:
        return max(As)

    gcdmax = 0
    for i in range(N):
        if i == N-1:
            gcd = gcds(*As[:i])
        else:
            gcd = gcds(*As[:i], *As[i+1:])
        gcdmax = max(gcdmax, gcd)

    return gcdmax

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

### FIXED CODE ###

import math
from fractions import gcd
from functools import reduce
def gcds(*numbers):
    return reduce(gcd, numbers)

def resolve():
    N = int(input())
    As = list(map(int, input().split(" ")))
    
    left = [0] * (N + 1)
    right = [0] * (N + 1)
    for i in range(N):
        left[i + 1] = (gcd(left[i],As[i]))
        right[N - 1 - i] = (gcd(right[(N - 1) - i + 1], As[(N - 1) - i]))

    gcdmax = 0
    for i in range(N):
        gcdmax = max(gcdmax, gcd(left[i], right[i+1]))
    return gcdmax

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