Harryxun/stf_run huggingface dataset:
n,k = map(int,input().split())
ai = [int(i) for i in input().split()]

tmp = format(max(k,max(ai)), 'b')

lng = len(tmp)
tmp = format(k, '0'+str(lng)+'b')

li = [0]*(lng)
ai_li = [0]*(n)
#print(len(ai))
#exit()
for i in range(n):
    #print(i)
    #print(ai[i])
    #print(format(ai[i], '0'+str(lng)+'b'))
    ai_li[i] = format(ai[i], '0'+str(lng)+'b')

add_enb_flag = False

for i in range(lng):
    cnt = 0
    for j in range(n):
        if ai_li[j][i] == '1':
            cnt += 1
    #print(cnt,i)
    if cnt >= (n+1) // 2:
        if tmp[i] == "1":
            add_enb_flag = True
        li[i] = 0
    elif tmp[i] == '1' or add_enb_flag == True:
        li[i] = 1
    else:
        li[i] = 0
k_m = 0
bai = 1

for i in range(lng):
    k_m += li[n-i-1] *bai
    bai *= 2

#print(k_m,ai_li,tmp,li)
        
ans = 0
for i in range(n):
    ans += k_m^ai[i]
    
print(ans)

### FIXED CODE ###

n,k = map(int,input().split())
ai = [int(i) for i in input().split()]

tmp = format(max(k,max(ai)), 'b')

lng = len(tmp)
tmp = format(k, '0'+str(lng)+'b')

li = [0]*(lng)
ai_li = [0]*(n)

for i in range(n):
    #print(i)
    #print(ai[i])
    #print(format(ai[i], '0'+str(lng)+'b'))
    ai_li[i] = format(ai[i], '0'+str(lng)+'b')

add_enb_flag = False

for i in range(lng):
    cnt = 0
    for j in range(n):
        if ai_li[j][i] == '1':
            cnt += 1
    #print(cnt,i)
    if cnt >= (n+1) // 2:
        if tmp[i] == "1":
            add_enb_flag = True
        li[i] = 0
    elif tmp[i] == '1' or add_enb_flag == True:
        li[i] = 1
    else:
        li[i] = 0
k_m = 0
bai = 1

for i in range(lng):
    k_m += li[lng-i-1] *bai
    bai *= 2

#print(k_m,ai_li,tmp,li)
        
ans = 0
for i in range(n):
    ans += k_m^ai[i]
    
print(ans)
x = input()
y = input()

if x < y:
	tmp = x
	x = y
	y = tmp

x_y_divisor = list()
y_divisor = list()
x_mod_y = x % y


for i in range(1,(x_mod_y)+1):
	if x_mod_y % i == 0:
		x_y_divisor.append(i)


for i in range(1,y+1):
	if y % i == 0:
		y_divisor.append(i)


x_y_divisor_set = set(x_y_divisor)
y_divisor_set = set(y_divisor)

ans_divisor = y_divisor_set.intersection(x_y_divisor_set)
print(max(ans_divisor))



### FIXED CODE ###

import sys

input_list = map(int, raw_input().split())

x = input_list[0]
y = input_list[1]

if x < y:
	tmp = x
	x = y
	y = tmp
elif x == y:
	print(x)
	sys.exit(0)


r = 0
while y != 0:
	r = x % y
	x = y
	y = r

print(x)
import sys

sys.setrecursionlimit(20000)

tmp=input().split(" ")
n = int(tmp[0])
m = int(tmp[1])

node_groups = [ i for i in range(n)]
group_sizes = [ 1 for _ in range(n)]

edges = []
for i in range(m):
    tmp=input().split(" ")
    edges.append([int(tmp[0])-1, int(tmp[1])-1])

hubensa_list = [0] * (m + 1)
hubensa_list[m] = n*(n-1)//2

def root(i):
    if node_groups[i] == i:
        return i
    else:
        node_groups[i] = root(node_groups[i])
        return node_groups[i]

def same(a, b):
    return root(a) == root(b)

def size(i):
    return group_sizes[root(i)]

def unite(a, b):
    a = root(a)
    b = root(b)

    if a == b:
        return
    
    group_sizes[a] += size(b)
    node_groups[b] = a


for i in range(m-1, 0, -1):
    edge = edges[i]
    #print("node_groups: ", node_groups)
    node_1 = edge[0]
    node_2 = edge[1]

    root_1 = root(node_1)
    root_2 = root(node_2)
    if root_1 == root_2:
        hubensa_list[i] = hubensa_list[i+1]
        continue

    # 不便さをだす
    hubensa_list[i] = hubensa_list[i+1] - (size(root_1) * size(root_2))

    unite(root_1, root_2)

#print("node_groups: ", node_groups)


for i in range(1, m+1):
    print(hubensa_list[i])

### FIXED CODE ###

import sys

sys.setrecursionlimit(100000)

tmp=input().split(" ")
n = int(tmp[0])
m = int(tmp[1])

node_groups = [ i for i in range(n)]
group_sizes = [ 1 for _ in range(n)]

edges = []
for i in range(m):
    tmp=input().split(" ")
    edges.append([int(tmp[0])-1, int(tmp[1])-1])

hubensa_list = [0] * (m + 1)
hubensa_list[m] = n*(n-1)//2

def root(i):
    if node_groups[i] == i:
        #print(i, "is root.")
        return i
    else:
        #_1 = node_groups[i]
        node_groups[i] = root(node_groups[i])
        #_2 = node_groups[i]
        #print ("root: ", _1, _2)
        return node_groups[i]

def same(a, b):
    return root(a) == root(b)

def size(i):
    return group_sizes[root(i)]

def unite(a, b):
    a = root(a)
    b = root(b)

    if a == b:
        return
    
    group_sizes[a] += size(b)
    node_groups[b] = a


for i in range(m-1, -1, -1):
    edge = edges[i]
    # print("edge: ",edge)
    #print("node_groups: ", node_groups)
    node_1 = edge[0]
    node_2 = edge[1]

    root_1 = root(node_1)
    root_2 = root(node_2)
    if root_1 == root_2:
        hubensa_list[i] = hubensa_list[i+1]
        continue

    # 不便さをだす
    hubensa_list[i] = hubensa_list[i+1] - (size(root_1) * size(root_2))

    unite(root_1, root_2)

#print("node_groups: ", node_groups)


for i in range(1, m+1):
    print(hubensa_list[i])
import sys
xs = [int(x) for x in  sys.stdin.readline()]
sort(xs)
for x in xs:
  print x,

### FIXED CODE ###

import sys
xs = [int(x) for x in  sys.stdin.readline().split()]
for x in sorted(xs):
  print x,
a, b, c = map(int, input().split())
modb = []
for n in range(a, b+1):
  if n % c == 0:
    modb.append(n)
print(len(modb))


### FIXED CODE ###

a, b, c = map(str, input().split())
B = b[:1]

ans = 'A' + B + 'C'
print(ans)
def lcs():
???x, y = raw_input()
???x_len = len(x)
  y_len = len(y)
  z2 = [0 for i in range(y_len+1)]

???for j in range(x_len):
   z1 = z2 + []
    for k in range(y_len):
       if x[k] = y[k]:
          z2[k+1] = z2[k] + 1
       elif z2[j+1] = z2[j]:???
?????????    z2[j+1] = z2[j]

  return z2[-1]

num = input()
for l in range(num):
  print lcs()

### FIXED CODE ###

def lcs():
  x = raw_input()
  y = raw_input()
  x_len = len(x)
  y_len = len(y)
  z2 = [0 for i in range(y_len+1)]

  for i in range(x_len):
    z1 = z2 + []
    ele = x[i]
    for k in range(y_len):
      if ele == y[k]:
        z2[k+1] = z1[k] + 1
      elif z2[k+1] < z2[k]:
        z2[k+1] = z2[k]

  return z2[-1]

num = input()
for j in range(num):
  print lcs()
N = int(input())
ans = 0
for i in range(N):
  x, u = map(str, input().split())
  if u == "JPY":
    ans += float(x)
  else:
    ans += float(x * 38000.0)
    
print(ans)

### FIXED CODE ###


N = int(input())
ans = 0
for i in range(N):
  x, u = map(str, input().split())
  if u == "JPY":
    ans += float(x)
  else:
    ans += float(x) * 380000.0
    
print(ans)
n = int(input())
int ans = (n + 1) // 2;
print(ans)
  

### FIXED CODE ###

n = int(input())
ans = (n + 1) // 2;
print(ans)
while True:
    x = input().split()
    x_int = [int(i) for i in x]

    for i in range(x_int[0]):
        z = '#' * x_int[1]
        print(z)
    print()

### FIXED CODE ###

while True:
    x = input().split()
    x_int = [int(i) for i in x]

    if x_int[0] == 0 and x_int[1] ==0:
        break
    for i in range(x_int[0]):
        z = '#' * x_int[1]
        print(z)
    print()
n = int(input())
F = [1, 1] + [0] * [44 + 1]
for i in range(2, n + 1):
    fib[i] = fib[i - 1] + fib[i - 2]
print(fib[n])

### FIXED CODE ###

n = int(input())
fib = [1, 1] + [0 for i in range(44)]
for i in range(2, n + 1):
    fib[i] = fib[i - 1] + fib[i - 2]
print(fib[n])
import math
from collections import Counter

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

K = 20
fact = [0] * (n+1+K)
ifact = [0] * (n+1+K)
fact[0] = 1
for i in range(1,n+1+K):
    fact[i] = fact[i-1] * i % mod
ifact[n+K] = pow(fact[n+K], mod-2, mod)
for i in reversed(range(1,n+1+K)):
    ifact[i-1] = ifact[i] * i % mod

def comb(n, k):
    return fact[n] * ifact[n-k] % mod * ifact[k] % mod

def getprime(n):
    primes = []
    i = 2
    while n >= i * i:
        while n % i == 0:
            n //= i
            primes.append(i)
        i += 1
    if n != 1:
        primes.append(n)
    return primes

ans = 1
counter = Counter(getprime(m))
for k in counter.values():
    ans *= comb(n+k-1, k)
    ans %= mod
print(ans)

### FIXED CODE ###

import math
from collections import Counter

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

K = 50
fact = [0] * (n+1+K)
ifact = [0] * (n+1+K)
fact[0] = 1
for i in range(1,n+1+K):
    fact[i] = fact[i-1] * i % mod
ifact[n+K] = pow(fact[n+K], mod-2, mod)
for i in reversed(range(1,n+1+K)):
    ifact[i-1] = ifact[i] * i % mod

def comb(n, k):
    return fact[n] * ifact[n-k] % mod * ifact[k] % mod

def getprime(n):
    primes = []
    i = 2
    while n >= i * i:
        while n % i == 0:
            n //= i
            primes.append(i)
        i += 1
    if n != 1:
        primes.append(n)
    return primes

ans = 1
counter = Counter(getprime(m))
for k in counter.values():
    ans *= comb(n+k-1, k)
    ans %= mod
print(ans)
d = {AC:0; WA:0; TLE:0; RE:0}
for i in range(int(input())): d[input()]+=1
for i in d: print(i+' x', d[i])

### FIXED CODE ###

d = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}
for i in range(int(input())): d[input()]+=1
for i in d: print(i+' x', d[i])
s = input()
n = len(s)
cr, cl = 1, 0
ans = [0]*len(s)
isRL = False

for i in range(1, n):
    cr += 1 if s[i] == "R" else 0
    cl += 1 if s[i] == "L" else 0
    if  isRL:
        if s[i] == "R" or i == n-1:
            cr -= 1 if i != n-1 else 0
            ans[bp-1] = math.ceil(cr/2) + int(cl/2)
            ans[bp] = int(cr/2) + math.ceil(cl/2)
            cr, cl, isRL = 1, 0, False
    else:
        if s[i-1] == "R" and s[i] == "L":
            bp = i
            isRL = True
            if i == n-1:
                ans[bp-1] = math.ceil(cr/2) + int(cl/2)
                ans[bp] = int(cr/2) + math.ceil(cl/2)
            
for i in ans:
    print(i, end=" ")

### FIXED CODE ###

import math
s = input()
n = len(s)
cr, cl = 1, 0
ans = [0]*n
isRL = False
bp = 0

for i in range(1, n):
    cr += 1 if s[i] == "R" else 0
    cl += 1 if s[i] == "L" else 0
    if  isRL:
        if s[i] == "R" or i == n-1:
            cr -= 1 if i != n-1 else 0
            ans[bp-1] = math.ceil(cr/2) + int(cl/2)
            ans[bp] = int(cr/2) + math.ceil(cl/2)
            cr, cl, isRL = 1, 0, False
    else:
        if s[i-1] == "R" and s[i] == "L":
            bp = i
            isRL = True
            if i == n-1:
                ans[bp-1] = math.ceil(cr/2) + int(cl/2)
                ans[bp] = int(cr/2) + math.ceil(cl/2)
            
for a in ans:
    print(a, end=" ")
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")

# k: number of transfer
_,k = LI()
a = LI()
# 街の番号を0始まりに変更
a = list(map(lambda x:x-1,a))
# print(a)

s = set([0])
# 再帰関数
def rec(visited,next):
    if next in s:
        return visited,visited.index(next)
    else:
        s.add(next)
        visited.append(next)
        return rec(visited,a[next])

visited = [0]
# 訪れた街、初めて2度訪れた街のインデックスを取得
visited,loopStart = rec(visited,a[0])

# print(visited,loopStart)

if k <= len(visited):
    townIndex = visited[k]
else:
    visitedLoop = visited[loopStart:]
    # print(visitedLoop)
    # 残り回数を循環配列の長さで割った余り
    index = (k-(loopStart))%len(visitedLoop)
    # print(index)
    townIndex = visitedLoop[index]

print(townIndex+1)

### FIXED CODE ###

import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")

# k: number of transfer
_,k = LI()
a = LI()
# 街の番号を0始まりに変更
a = list(map(lambda x:x-1,a))
# print(a)

s = set([0])

# 再帰関数
def rec(visited,next):
    if next in s:
        # print(visited)
        return visited,visited.index(next)
    else:
        s.add(next)
        visited.append(next)
        return rec(visited,a[next])

visited = [0]
# 訪れた街、初めて2度訪れた街のインデックスを取得
visited,loopStart = rec(visited,a[0])

# print(visited,loopStart)

if k < len(visited):
    townIndex = visited[k]
else:
    visitedLoop = visited[loopStart:]
    # print(visitedLoop)
    # 残り回数を循環配列の長さで割った余り
    index = (k-(loopStart))%len(visitedLoop)
    # print(index)
    townIndex = visitedLoop[index]

print(townIndex+1)
import math

def main():
    A, B = [int(i) for i in input().split()]

    print(int(A*B/math.gcd(A,B)))

if __name__=="__main__":
    main()


### FIXED CODE ###


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

def main():
    A, B = [int(i) for i in input().split()]

    print(int(A*B/gcd(A,B)))


    
if __name__=="__main__":
    main()
n=int(input())
lists=[input() for x in range(n)]
listget=[]
for s in lists:
    for y in range(1,n+1):
        listget.append(s[y])
print(len(set(listget))
      
     

### FIXED CODE ###

n=int(input())
lists=[input() for x in range(n)]
print(len(set(lists)))
#!/usr/bin/env python3
import sys
from bisect import bisect_left


def main():
    N, Q = map(int, input().split())
    XST = []
    for i in range(N):
        s, t, x = map(int, input().split())
        XST.append((x, s-x, t-x))
    XST.sort(reverse=True)
    D = [0]*Q
    for i in range(Q):
        D[i] = int(input())
    start = [set() for _ in range(Q)]
    end = [set() for _ in range(Q)]
    # Dはソートされている。
    for x, s, t in XST:
        # こっから！
        frm = bisect_left(D, s)
        to = bisect_left(D, t, lo=frm)
        # 数列の範囲を代入で更新して、値を取得する
        start[frm].add(x)
        end[to].add(x)
        # print(*stop, sep="\n")
        # for j in range(frm, to):
        #     stop[j] = x
    curr = set()
    for i in range(Q):
        curr |= start[i] - (start[i] & end[i])
        curr -= (end[i]-start[i])
        if len(curr) == 0:
            print(-1)
        else:
            print(min(curr))


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from bisect import bisect_left, bisect_right
import heapq

INF = float("inf")


class ErasableHeap(object):
    # https://qiita.com/Salmonize/items/638da118cd621d2628d1
    def __init__(self):
        self.data = []
        self.event = []

    def push(self, x):
        return heapq.heappush(self.data, x)

    def erase(self, x):
        return heapq.heappush(self.event, x)

    def _check(self):
        while self.event and\
                self.data[0] == self.event[0]:
            heapq.heappop(self.data)
            heapq.heappop(self.event)

    def front(self):
        self._check()
        return self.data[0]

    def pop(self):
        self.check()
        return heapq.heappop(self.data)

    def __len__(self):
        self._check()
        return len(self.data)


def main():
    N, Q = map(int, input().split())
    XST = [0]*N
    for i in range(N):
        s, t, x = map(int, input().split())
        XST[i] = (x, s-x, t-x)
    D = [0]*Q
    for i in range(Q):
        D[i] = int(input())
    event = []
    for x, s, t in XST:
        event.append((s, 1, x))
        event.append((t, -1, x))

    event.sort()

    head = 0
    stack = ErasableHeap()
    for t, p, x in event:
        while D[head] < t:
            if len(stack) == 0:
                print(-1)
            else:
                print(stack.front())
            head += 1
            if head >= Q:
                return
        if p == 1:
            stack.push(x)
        else:
            stack.erase(x)

    while head < len(D):
        if len(stack) == 0:
            print(-1)
        else:
            print(stack.front())
        head += 1
        if head >= Q:
            return


if __name__ == '__main__':
    main()
n=int(input())
d=dict()
m=[2,3,5,7,11,13,17,19,23,29,31]
for i in m:
  d[i]=0
  nn=n
  while nn:
    d[i]+=nn//i
    nn//=i
ans=1
for i in dict.values():
  ans*=i+1
print(ans)


### FIXED CODE ###

n=int(input())
d=dict()
for i in range(1,n+1):
  for j in range(1,i+1):
    if j==1:
      continue
    while i%j==0:
      if j not in d:
        d[j]=1
      else:
        d[j]+=1
      i//=j
ans=1
for i in d.values():
  ans*=i+1
print(ans%1000000007)
n = int(input())
ans = [0] * (n + 1)
for x in range(1, n**0.5 + 1):
    for y in range(1, n**0.5 + 1):
        for z in range(1, n**0.5 + 1):
            if x**2 + y**2 + z**2 + x*y + y*z + z*x <= n:
                ans[x**2 + y**2 + z**2 + x*y + y*z + z*x] += 1
print(*ans[1:], sep='\n')

### FIXED CODE ###

n = int(input())
ans = [0] * (n + 1)
for x in range(1, int(n**0.5) + 1):
    for y in range(1, int(n**0.5) + 1):
        for z in range(1, int(n**0.5) + 1):
            if x**2 + y**2 + z**2 + x*y + y*z + z*x <= n:
                ans[x**2 + y**2 + z**2 + x*y + y*z + z*x] += 1
print(*ans[1:], sep='\n')
def solve(s,t,n,m,dp):
    if n<0 or m<0:
            return ''
    if dp[n][m]!=-1:
        return dp[n][m]
    else:
        ans=''
        if s[n]==t[m]:
            ans=s[n]+solve(s,t,n-1,m-1,dp)
            dp[n][m]= ans
        else:
            s1=solve(s,t,n-1,m,dp)
            s2=solve(s,t,n,m-1,dp)
            if len(s1)>len(s2):
                ans=s1
            else:
                ans=s2
            dp[n][m]= ans
        return dp[n][m]


s=input()
t=input()
dp=[[-1]*(len(t)) for i in range(len(s))] 
# print(dp)
solve(s,t,len(s)-1,len(t)-1,dp)
print(dp[-1][-1][::-1])

### FIXED CODE ###


# Returns length of LCS for X[0..m-1], Y[0..n-1] 
def lcs(X, Y, m, n): 
	L = [[0 for x in range(n+1)] for x in range(m+1)] 

	# Following steps build L[m+1][n+1] in bottom up fashion. Note 
	# that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] 
	for i in range(m+1): 
		for j in range(n+1): 
			if i == 0 or j == 0: 
				L[i][j] = 0
			elif X[i-1] == Y[j-1]: 
				L[i][j] = L[i-1][j-1] + 1
			else: 
				L[i][j] = max(L[i-1][j], L[i][j-1]) 

	# Following code is used to print LCS 
	index = L[m][n] 

	# Create a character array to store the lcs string 
	lcs = [""] * (index+1) 
	lcs[index] = "" 

	# Start from the right-most-bottom-most corner and 
	# one by one store characters in lcs[] 
	i = m 
	j = n 
	while i > 0 and j > 0: 

		# If current character in X[] and Y are same, then 
		# current character is part of LCS 
		if X[i-1] == Y[j-1]: 
			lcs[index-1] = X[i-1] 
			i-=1
			j-=1
			index-=1

		# If not same, then find the larger of two and 
		# go in the direction of larger value 
		elif L[i-1][j] > L[i][j-1]: 
			i-=1
		else: 
			j-=1

	print (''.join(lcs))

# Driver program 

s=input()
t=input()
m = len(s) 
n = len(t) 
lcs(s, t, m, n)
I,O,T,J,L,S,Z=map(int,raw_input().split())
ans=0
ans+=2*O
ans1+=2*O
ans+=4*(I/2)
ans+=4*(J/2)
ans+=4*(L/2)
JL=min(J,L)
if JL>=1 and I>=1:
    ans1+=6
    J-=1
    L-=1
    I-=1
ans1+=4*(I/2)
ans1+=4*(J/2)
ans1+=4*(L/2)
print(max(ans/2,ans1/2))

### FIXED CODE ###

I,O,T,J,L,S,Z=map(int,raw_input().split())
ans=0
ans1=0
ans+=2*O
ans1+=2*O
ans+=4*(I/2)
ans+=4*(J/2)
ans+=4*(L/2)
JL=min(J,L)
if JL>=1 and I>=1:
    ans1+=6
    J-=1
    L-=1
    I-=1
ans1+=4*(I/2)
ans1+=4*(J/2)
ans1+=4*(L/2)
print(max(ans/2,ans1/2))
N = input()
S = input()
if S[:N]==S[N:]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = int(input())
S = input()
if S[:N//2]==S[N//2:]:
  print("Yes")
else:
  print("No")
if rest >= b:
   print('Yes')
else:
   print('No')

### FIXED CODE ###

a,b = map(int, input().split())
rest = a*500

if rest >= b:
   ans = "Yes"
else:
   ans = "No"

print(ans)
import copy
import itertools


drc = [(-1, 0), (0, 1), (1, 0), (0, -1)]
C_NUM = 6
while True:
    H, W, C = map(int, input().split())
    if not (H | W | C):
        break
    board = [[int(x) - 1 for x in input().split()] for _ in range(H)]
    ans = 0
    for ope in itertools.product(range(C_NUM), repeat=4):
        # print(ope)
        tmp_board = copy.deepcopy(board)
        for color in itertools.chain(ope, (C - 1,)):
            now_c = tmp_board[0][0]
            if now_c == color:
                continue
            stack = [(0, 0)]
            while stack:
                r, c = stack.pop()
                if tmp_board[r][c] == color:
                    continue
                tmp_board[r][c] = color
                for dr, dc in drc:
                    nr, nc = r + dr, c + dc
                    if 0 <= nr < H and 0 <= nc < W and tmp_board[nr][nc] == now_c:
                        stack.append((nr, nc))
        stack = [(0, 0)]
        while stack:
            r, c = stack.pop()
            if tmp_board[r][c] == -1:
                continue
            tmp_board[r][c] = -1
            for dr, dc in drc:
                nr, nc = r + dr, c + dc
                if 0 <= nr < H and 0 <= nc < W and tmp_board[nr][nc] == C - 1:
                    stack.append((nr, nc))
        ans = max(ans, sum(row.count(-1) for row in tmp_board))
    print(ans)

### FIXED CODE ###

import copy
import itertools
import sys

if sys.version[0] == '2':
    range, input = xrange, raw_input

drc = [(-1, 0), (0, 1), (1, 0), (0, -1)]
C_NUM = 6


def dfs(r, c, now_c, next_c):
    tmp_board[r][c] = next_c
    for dr, dc in drc:
        nr, nc = r + dr, c + dc
        if 0 <= nr < H and 0 <= nc < W and tmp_board[nr][nc] == now_c:
            dfs(nr, nc, now_c, next_c)


while True:
    H, W, C = map(int, input().split())
    if not (H | W | C):
        break
    board = [[int(x) - 1 for x in input().split()] for _ in range(H)]
    ans = 0
    for ope in itertools.product(range(C_NUM), repeat=4):
        if ope[0] == board[0][0] or ope[-1] == C - 1 or any(ope[i] == ope[i + 1] for i in range(3)):
            continue
        tmp_board = copy.deepcopy(board)
        for color in ope:
            dfs(0, 0, tmp_board[0][0], color)
        dfs(0, 0, tmp_board[0][0], C - 1)
        dfs(0, 0, tmp_board[0][0], -1)
        cand = sum(row.count(-1) for row in tmp_board)
        if cand > ans:
            ans = cand
    print(ans)
seq = raw_input()

total = int(0)
for i in range(1, int(seq)+1, 1):
    if ((i % 3) != 0) & ((i % 5) != 0):
        total = total + i
print(total)


### FIXED CODE ###

seq = int(input())

total = int(0)
for i in range(1, seq+1, 1):
    if ((i % 3) != 0) and ((i % 5) != 0):
        total = total + i
print(total)