Harryxun/stf_run huggingface dataset:
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
    
al = [1]
num2ind = {1:0}
for i in range(N):
    ne = A[al[-1]-1]
    if ne in al:
        tar = num2ind[ne]
        break
    al.append(ne)
    num2ind[ne] = i+1
    
ne = i+1
if K<=len(al):
    print(al[K])
else:
    K-=tar
    K%=(ne-tar)
    print(al[tar+K])


### FIXED CODE ###

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
    
al = [1]
num2ind = {1:0}
for i in range(K):
    ne = A[al[-1]-1]
    al.append(ne)
    if ne in num2ind:
        tar = num2ind[ne]
        break
    num2ind[ne] = i+1
    
ne = i+1
if K<=len(al):
    print(al[K])
else:
    K-=tar
    K%=(ne-tar)
    print(al[tar+K])
s=input()
x,y=map(int,input().split())
xy=[0,0]
xx=0
f=0
flag=True
for i in s:
  if i=="F":
    if flag and f==0:
      xx+=1
      continue 
    xy[f]+=1
  else:
    f^=1
    flag=False
ans="Yes"
if not(xx-xy[0]<=x<=xx+xy[0]):ans="No"
xy[0]+=xx
if (xy[0]+x)%2==0 and (xy[1]+y)%2==0:print(ans)
  else:print('No')

### FIXED CODE ###

s=input()
x,y=map(int,input().split())
ss=[len(i) for i in s.split("T")]
x-=ss[0]
a=[]
b=[]
for i in range(1,len(ss)):
  if ss[i]==0:continue
  if i%2==1:b.append(ss[i])
  else:a.append(ss[i])
x=abs(x)
y=abs(y)
if max(x,y)>8000:exit(print("No"))
def check(n,a):
  dp=[[0]*20001 for _ in range(len(a)+1)]
  n+=10000
  dp[0][10000]=1
  for i in range(1,len(a)+1):
    for j in range(20001):
      if j+a[i-1]<=20000:dp[i][j+a[i-1]]|=dp[i-1][j]
      if j-a[i-1]>=0:dp[i][j-a[i-1]]|=dp[i-1][j]
  if dp[len(a)][n]==1:return True
  return False
if check(x,a) and check(y,b):print("Yes")
else:print("No")
s=str(input())
price=700
count=0

if s[0]=='o':
  count+=1
else:
  continue
if s[1]=='o':
  count+=1
else:
  continue
if s[2]=='o':
  count+=1
else:
  continue
print(price+count*100)

### FIXED CODE ###

S=list(input())
count=0

if S[0]=='o':
  count+=1
if S[1]=='o':
  count+=1
if S[2]=='o':
  count+=1
  
print(count*100+700)
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if (W-V) == 0:
    print("NO")
elif (A-B) % (V-W) != 0:
    print("NO")
else:
    ans = (A-B)//(V-W)
    #print(ans)
    if 1 <= ans <= T:
        print("YES")
    else:
        print("NO")


### FIXED CODE ###

S = input()
print(S[:3])
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

t = inpl()
a = inpl()
b = inpl()
if (a[0] > b[0] and a[1] > b[1]) or (a[0] < b[0] and a[1] < b[1]):
    print(0)
    quit()
c = [0,0]
for i in range(2):
    c[i] = abs(a[i]-b[i]) * t[i]
if c[0] == c[1]:
    print('infinity')
    quit()
if c[0] > c[1]:
    print(0)
else:
    sa = c[1]-c[0]
    if c[1]%sa:
        tmp = 1
    print((c[1]-1)//(c[1]-c[0])*2 - tmp)


### FIXED CODE ###

from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

t = inpl()
a = inpl()
b = inpl()
if (a[0] > b[0] and a[1] > b[1]) or (a[0] < b[0] and a[1] < b[1]):
    print(0)
    quit()
c = [0,0]
for i in range(2):
    c[i] = abs(a[i]-b[i]) * t[i]
if c[0] == c[1]:
    print('infinity')
    quit()
if c[0] > c[1]:
    print(0)
else:
    sa = c[1]-c[0]
    tmp = 0
    if c[1]%sa:
        tmp = 1
    print((c[1]-1)//(c[1]-c[0])*2 - tmp)
import heapq

def main2(l, n):
    ans = 0
    length = len(l[0])
    lis = heapq.heapify(l[0])
    while length > 1:
        length -= 1
        ans += heapq.heappop(lis)
    for i in range(1, n):
        length += len(l[i])
        for j in l[i]:
            heapq.heappush(lis, j)
        while length > i + 1:
            length -= 1
            ans += heapq.heappop(lis)
    return ans

def main():
    from sys import stdin
    def input():
        return stdin.readline().strip()

    t = int(input())

    answer = []
    for _ in range(t):
        n = int(input())
        ans = 0
        l = [[] for _ in range(n)]
        r = [[] for _ in range(n)]
        for _ in range(n):
            i, j, k = map(int, input().split())
            if j > k:
                ans += j
                l[i-1].append(j-k)
            if j < k:
                ans += k
                r[n-i].append(k-j)
            ans -= main2(l, n) + main2(r, n)
            answer.append(ans)

    for i in answer:
        print(i)

main()

### FIXED CODE ###

import heapq

def main2(l, n):
    ans = 0
    lis = []
    heapq.heapify(lis)
    for i in range(1, n):
        for j in l[i]:
            heapq.heappush(lis, j)
        while len(lis) > i:
            ans += heapq.heappop(lis)
    return ans

def main():
    from sys import stdin
    def input():
        return stdin.readline().strip()

    t = int(input())

    answer = []
    for _ in range(t):

        n = int(input())
        ans = 0
        l = [[] for _ in range(n+1)]
        r = [[] for _ in range(n+1)]
        for _ in range(n):
            i, j, k = map(int, input().split())
            if j > k:
                ans += j
                l[i].append(j-k)
            elif j < k:
                if i == n:
                    ans += j
                else:
                    ans += k
                    r[n-i].append(k-j)
            else:
                ans += j

        ans -= main2(l, n) + main2(r, n)
        answer.append(ans)

    for i in answer:
        print(i)

main()
N = int(input())
lst_a = list(map(int, input().split()))
lst_color = [0] * 8
cnt_super = 0


for a in lst_a:
    i = a // 400
    if i == 8:
        cnt_super += 1
    else:
        lst_color[i] += 1
cnt_existed = sum(1 for x in lst_color if x!=0)


ans_min = max(cnt_existed, 1)
ans_max = cnt_existed + cnt_super


print(ans_min, ans_max)

### FIXED CODE ###

N = int(input())
lst_a = list(map(int, input().split()))
lst_color = [0] * 8
cnt_super = 0


for a in lst_a:
    if 1 <= a <= 399:
        lst_color[0] += 1
    elif 400 <= a <= 799:
        lst_color[1] += 1
    elif 800 <= a <= 1199:
        lst_color[2] += 1
    elif 1200 <= a <= 1599:
        lst_color[3] += 1
    elif 1600 <= a <= 1999:
        lst_color[4] += 1
    elif 2000 <= a <= 2399:
        lst_color[5] += 1
    elif 2400 <= a <= 2799:
        lst_color[6] += 1
    elif 2800 <= a <= 3199:
        lst_color[7] += 1
    else:
        cnt_super += 1
cnt_existed = sum(1 for x in lst_color if x!=0)


if cnt_existed == 0:
    ans_min = 1
    ans_max = cnt_super
else:
    ans_min = cnt_existed
    ans_max = cnt_existed + cnt_super


print(ans_min, ans_max)
a = int(input())
b = int(input())
c = int(input())
x = int(input())

cnt = 0

for h in range(0,c):
  for i in range(0,b):
    for j in range(0,a):
      if (x == (500 * a + 100 * b + 50 * c))
      	cnt = cnt +1

  print(cnt)


### FIXED CODE ###

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

cnt = 0

for h in range(0,c+1):
  for i in range(0,b+1):
    for j in range(0,a+1):
      if (x == ((500 * j) + (100 * i) + (50 * h))):
      	cnt = cnt +1

print(cnt)
a,b = int(input().split())

if (a*b)%2==0:
	print("Even")
else:
	print("Odd")
    

### FIXED CODE ###

a = list(map(int,input().split()))
 
if (a[0]*a[1])%2==0:
	print("Even")
else:
	print("Odd")
N, K = map(int, input().split())
A = list(map(int, input().split()))

dist = A[0]
visited = {1}
_v = [1]
stop = 0
for _ in range(10**7+1):
    if dist in visited:
        stop = dist
        break
    visited.add(dist)
    _v.append(dist)
    dist = A[dist-1]

made = 0
for i in range(len(_v)):
    if _v[i] == stop:
        break
    made += 1

loop = len(_v) - made
_v = _v[made:]

# print(stop)
# print(loop)
# print(made)
# print(_v)

if K <= made:
    print(_v[K])
else:
    K -= made
    K %= loop
    print(_v[K])

### FIXED CODE ###

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

dist = A[0]
visited = {1}
_v = [1]
stop = 0
while True:
    if dist in visited:
        stop = dist
        break
    visited.add(dist)
    _v.append(dist)
    dist = A[dist-1]

made = 0
l = len(_v)
for i in range(l):
    if _v[i] == stop:
        break
    made += 1

# print(stop)
# print(loop)
# print(made)
# print(_v)

if K <= made:
    print(_v[K])
else:
    loop = l - made
    _v = _v[made:]
    K -= made
    K %= loop
    print(_v[K])
class UnionFind:
  par = None
  
  def __init__(self, N):
    self.par = list(range(N))
    
  def root(self, x):
    if(self.par[x] == x):
      return x
    else:
      self.par[x] = self.root(self.par[x])
      return self.par[x]
  
  def unite(self, x, y):
    if(self.root(x) != self.root(y)):
      self.par[x] = self.root(y)
  
N, M = list(map(int, input().split()))
UF = UnionFind(N)
for i in range(M):
  print(UF.par)
  A, B = list(map(int, input().split()))
  UF.unite(A - 1, B - 1) 
ans = 0
for i in range(N):
  ans += (UF.par[i] == i)
print(UF.par)
print(ans - 1)  

### FIXED CODE ###

class UnionFind:
  par = None
  
  def __init__(self, n):
    self.par = [0] * n
    
  def root(self, x):
    if(self.par[x] == 0):
      return x
    else:
      self.par[x] = self.root(self.par[x])
      return self.root(self.par[x])
  
  def unite(self, x, y):
    if(self.root(x) != self.root(y)):
      self.par[self.root(x)] = self.root(y)
      
  def same(self, x, y):
    return self.root(x) == self.root(y)
  
N, M = list(map(int, input().split()))
UF = UnionFind(N)
for i in range(M):
  A, B = list(map(int, input().split()))
  UF.unite(A - 1, B - 1) 
ans = 0
for i in range(N):
  if(UF.par[i] == 0):
    ans += 1
print(ans - 1)
import math

l = list(map(int,input().split()))
A = l[0]
B = l[1]
C = l[2]
D = l[3]

E = C * D //math.gcd(C,D)

f = B//C - (A-1)//C
f = f+(B//D - (A-1)//D)
ans = B-A+1-f + B//E-(A-1)//E
print(ans)







### FIXED CODE ###

from fractions import gcd 

l = list(map(int,input().split()))
A = l[0]
B = l[1]
C = l[2]
D = l[3]

E = C * D //gcd(C,D)

f = B//C - (A-1)//C
f = f+(B//D - (A-1)//D)
ans = B-A+1-f + B//E-(A-1)//E
print(ans)
import math
a,b,x = map(float,input().split())

c = a/(2*b-2*x/a**2)
d = (2*x)/(a*b**2)
if x/a >= a*b/2:
  result = math.atan(c)
else:result = math.degrees(math.atan(d))
print(result)

### FIXED CODE ###

A,B = map(int,input().split())
if 1<=A<=9 and 1<=B<=9:
  print(A*B)
else:print(-1)
n, k = map(int, input().split())
num_lists = list(map(int, input().split()))

if len(set(num_lists)) <= k:
  ans = 0
else:
  num_counts = {}
  for i in set(num_lists):
    num_counts[i] = num_lists.count(i)
  
  numbers = list(num_counts.values())
  numbers.sort()
  ans = 0
  for i in range(k - len(set(num_lists)):
    ans += numbers[i]
print(ans)


### FIXED CODE ###

from collections import Counter

n, k = map(int, input().split())
num_lists = list(map(int, input().split()))

num_counts = dict()
length = len(set(num_lists))
ans = 0

if length > k:
  d = Counter()
  d.update(num_lists)
  count_sorted = list(d.values())
  count_sorted.sort()
  for i in range(length - k):
    ans += count_sorted[i]

print(ans)
def main:  
  import sys
  input = sys.stdin.readline
  import heapq
  def prim_heap():
      used = [True] * n #True:不使用
      edgelist = []
      for e in edge[0]:
          heapq.heappush(edgelist,e)
      used[0] = False
      res = 0
      while len(edgelist) != 0:
          minedge = heapq.heappop(edgelist)
          if not used[minedge[1]]:
              continue
          v = minedge[1]
          used[v] = False
          for e in edge[v]:
              if used[e[1]]:
                  heapq.heappush(edgelist,e)
          res += minedge[0]
      return res

  from collections import deque
  n = int(input())
  st = deque([])

  edge = deque([[] for i in range(n)])
  for i in range(n):
      x,y = map(int,input().split())
      st_append = st.append
      st_append((i,x,y))

  from operator import itemgetter
  bb = tuple(sorted(st,key=itemgetter(1)))
  chk = tuple(sorted(st,key=itemgetter(2)))
  #print(bb,chk)

  for i in range(n-1):
    x = bb[i][0]
    y = bb[i+1][0]
    z = bb[i+1][1]-bb[i][1]
    edge[x].append((z,y))
    edge[y].append((z,x))

  for i in range(n-1):
    a = chk[i][0]
    b = chk[i+1][0]
    c = chk[i+1][2]-chk[i][2]
    edge[a].append((c,b))
    edge[b].append((c,a))

  edge = tuple(edge)
  print(prim_heap())
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
import heapq
def prim_heap():
    used = [True] * n #True:不使用
    edgelist = []
    for e in edge[0]:
        heapq.heappush(edgelist,e)
    used[0] = False
    res = 0
    while len(edgelist) != 0:
        minedge = heapq.heappop(edgelist)
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,e)
        res += minedge[0]
    return res

from collections import deque
n = int(input())
st = deque([])

edge = deque([[] for i in range(n)])
for i in range(n):
    x,y = map(int,input().split())
    st_append = st.append
    st_append((i,x,y))
    
from operator import itemgetter
bb = tuple(sorted(st,key=itemgetter(1)))
chk = tuple(sorted(st,key=itemgetter(2)))
#print(bb,chk)

for i in range(n-1):
  x = bb[i][0]
  y = bb[i+1][0]
  z = bb[i+1][1]-bb[i][1]
  edge[x].append((z,y))
  edge[y].append((z,x))
  
for i in range(n-1):
  a = chk[i][0]
  b = chk[i+1][0]
  c = chk[i+1][2]-chk[i][2]
  edge[a].append((c,b))
  edge[b].append((c,a))
  
edge = tuple(edge)
print(prim_heap())
N = int(input())
edge = [[] for _ in range(N)]

for _ in range(N-1):
    u,v,w = map(int, input().split())
    w %= 2
    u, v = u-1, v-1
    edge[u].append((v,w))
    edge[v].append((u,w))

ret = [0] * N
def dfs(pv, v, dist):
    ret[v] = dist
    for nv, w in edge[v]:
        if nv == pv:
            continue
        dfs(v, nv, (dist+w)%2)

dfs(-1,0,0)
print(ret)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
N = int(input())
a = [[] for _ in range(N)]
b = [[] for _ in range(N)]
for i in range(N-1):
    x, y, z = map(int, input().split())
    x, y, z = x-1, y-1, z % 2
    a[x].append([y, z])
    b[y].append([x, z])
dist = [0] * N
visited = [0] * N
print("")

def dfs(v, prev, dist, predist, visited):
    if visited[v]:
        return dist
    dist[v] = dist[prev] ^ predist
    visited[v] = 1
    for i in a[v]:
        dist = dfs(i[0], v, dist, i[1], visited)
    for i in b[v]:
        dist = dfs(i[0], v, dist, i[1], visited)
    return dist

dist = dfs(0, 0, dist, 0, visited)
for i in dist:
    print(i)
n = int(input())
xls = [list(map(int, input().split()))for i in range(n)]
xls.sort(key=lambda x:x[0])
flag = 1
ans1 = ans2 = 1
x, l = xls[0]
for i in range(1, n):
    nx, nl = xls[i]
    if nx-nl+1<x+l: continue
    if i==1: flag=0
    ans1 += 1
    x, l = nx, nl

if flag:
    x, l = xls[1]
    for i in range(2, n):
        nx, nl = xls[i]
        if nx-nl+1<x+l: continue
        if i==1: flag=0
        ans2 += 1
        x, l = nx, nl
print(max(ans1, ans2))

### FIXED CODE ###

n = int(input())
xls = [list(map(int, input().split()))for i in range(n)]
xls.sort(key=lambda x:sum(x))

ans = 0
now = -1e11
for i in range(n):
    if now<=xls[i][0]-xls[i][1]:
        ans += 1
        now = xls[i][0]+xls[i][1]
print(ans)
def main():
    from collections import deque, defaultdict
    n, m = map(int, input().split())
    g = [[] for _ in range(n + 1)]
    ref = defaultdict(list)
    sta = 0

    for i in range(m):
        a, b, k = map(int, input().split())
        if i == 0:
            sta = a
        g[a].append(b)
        g[b].append(a)
        ref[(a, b)] = k

    q = deque([sta])
    visited = set()
    dist = [0] * (n + 1)
    dist[sta] = 1

    while q:
        v = q.pop()
        visited.add(v)
        for x in g[v]:
            if x not in visited:
                if ref[(v, x)]:
                    y = ref[(v, x)]
                    if not dist[x]:
                        dist[x] = dist[v] + y
                    elif not dist[v]:
                        dist[v] = dist[x] - y
                    elif dist[x] != dist[v] + y:
                        print("No")
                        exit()
                else:
                    y = ref[(x, v)]
                    if not dist[v]:
                        dist[v] = dist[x] + y
                    elif not dist[x]:
                        dist[x] = dist[v] - y
                    elif dist[v] != dist[x] + y:
                        print("No")
                        exit()
                q.append(x)
    print("Yes")
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    from collections import deque, defaultdict
    n, m = map(int, input().split())
    g = [[] for _ in range(n + 1)]
    ref = defaultdict(list)
    q = deque([])
    visited = set()
    inf = 10 ** 10
    dist = [-inf] * (n + 1)

    for i in range(m):
        a, b, k = map(int, input().split())
        g[a].append(b)
        g[b].append(a)
        ref[(a, b)] = k


    def dfs(u):
        q.append(u)
        while q:
            v = q.pop()
            visited.add(v)
            for x in g[v]:
                if x not in visited:
                    if ref[(v, x)] != []:
                        y = ref.get((v, x))
                        if dist[x] == -inf:
                            dist[x] = dist[v] + y
                        elif dist[x] != dist[v] + y:
                            print("No")
                            exit()
                    else:
                        y = ref.get((x, v))
                        if dist[x] == -inf:
                            dist[x] = dist[v] - y
                        elif dist[v] != dist[x] + y:
                            print("No")
                            exit()
                    q.append(x)


    for i in range(1, n + 1):
        if i not in visited:
            dist[i] = 1
            dfs(i)
    print("Yes")
if __name__ == '__main__':
    main()
import math

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

gcdd = 1

for i in range(N):
    num = times[i]
    gcdd = gcdd * num // (math.gcd(gcdd, num))


print(gcdd)

### FIXED CODE ###

import fractions

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

gcdd = 1

for i in range(N):
    num = times[i]
    gcdd = gcdd * num // (fractions.gcd(gcdd, num))


print(gcdd)
a=int(input())
b=list(map(int,input().split()))
total=0
total2=0
i=1
while True:
    if b[i-1]>=b[i]:
        total+=1
    else:
        if total2<=total:
            total2=total
            total=0
    i+=1
    if i==a:
        break
print(max(total2,total))

### FIXED CODE ###

a=int(input())
b=list(map(int,input().split()))
total=0
total2=0
i=1
for i in range(a-1):
    if b[i+1]<=b[i]:
        total+=1
    else:
        if total2<=total:
            total2=total
        total=0
print(max(total2,total))
# bsdk idhar kya dekhne ko aaya hai, khud kr!!!
# import math
# from itertools import *
# import random
# import calendar
import datetime
# import webbrowser

# f = open("input.txt", 'r')
# g = open("output.txt", 'w')
# n, m = map(int, f.readline().split())

n, k = map(int, input().split())
arr = []
for i in range(k):
    arr.append(input())
arr.sort()
print("".join(arr))


### FIXED CODE ###

# bsdk idhar kya dekhne ko aaya hai, khud kr!!!
# import math
# from itertools import *
# import random
# import calendar
import datetime
# import webbrowser

# f = open("input.txt", 'r')
# g = open("output.txt", 'w')
# n, m = map(int, f.readline().split())

n, k = map(int, input().split())
arr = []
for i in range(n):
    arr.append(input())
arr.sort()
print("".join(arr))
N,K = map(int,input().split())
ls = list(map(int,input().split()))
ls.sort(reverse=True)
for i in range(K):
    ls.pop(0)

print(sum(ls))

### FIXED CODE ###

N,K = map(int,input().split())
ls = list(map(int,input().split()))
ls.sort(reverse=True)
if N <= K:
    print(0)
else:    
    print(sum(ls[K:N+1]))
N , X = map(int,input().split())
L = list(input())
cnt = 1
b = 0
lst = list()
for i in range(N + 1):
    if int(len(L) / 2) + 1 > i   :
        lst.append(int(L[i*2]))
    else :
        break
for j in range (N + 1):
    b += lst[j]
    cnt += 1
    if b+lst[j+1] > X :
        break
    if cnt == N:
        break
print(cnt)


### FIXED CODE ###

N , X = map(int,input().split())
L=list(map(int,input().split()))
b = 0
cnt = 1
for i in range(N):
    b += L[i]
    if b <= X   :
        cnt+=1
    else:
        break
print(cnt)
n = int(input())
P = list(map(int,input().split()))
ans = 0
for i in range(n):
    m == min(P[0:i+1])
    if P[i] == m:
        ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
P = list(map(int,input().split()))
ans = 0
mi = P[0]
for i in range(n):
    if P[i] <= mi:
        mi = P[i]
        ans += 1
print(ans)
# coding: utf-8

import sys
import math


if __name__ == '__main__':
	input_list = sys.stdin.readlines()

	for num in input_list:
		target_number = int(num.replace('\n', ''))
		serial_number_list = [r for r in range(2, target_number + 1)]
		multiple_list = []

		while math.sqrt(target_number) >= serial_number_list[0]:
			serial_number = serial_number_list[0]
			i = 1
			multiple_list.append(serial_number)

			while target_number >= serial_number * i:
				
				if serial_number * i in serial_number_list:
					serial_number_list.pop(serial_number_list.index(serial_number * i))

				i += 1

		print(multiple_list + serial_number_list)

### FIXED CODE ###

a = [True for i in range(1000000)]
i = 3
while i * i < 1000000:
    for j in range(3 * i, 1000000, 2 * i): a[j] = False
    i += 2
 
while True:
    try:
        n = int(input())
    except:
        break
 
    count = int(n >= 2) + sum(a[i] for i in range(3, n + 1, 2))
    print(count)
listx = []
listy = []
while True:
    x,y = map(int,raw_input().split())
    if x==0 and y==0:
        break
    list.append(x)
    list.append(y)

listx.sort()
listy.sort()

for i in len(listx):
    print '%s %S',(listx[i],listy[i])

### FIXED CODE ###

while True:
    x,y = map(int,raw_input().split())
    if x > y:
        print '%s %s' % (y,x)
    elif y > x:
        print '%s %s' % (x,y)
    elif x == 0 and y == 0:
        break
    else:
        print '%s %s' % (x,y)
n = int(input())
print(4 if n >= 189 else 3 if n >= 165 else 2 if n >=n 135 else 1 if n >= 105 else 0)

### FIXED CODE ###

print((lambda x:(x[0]-1)*(x[1]-1))(list(map(int,input().split()))))
w,h,x,y = map(int,input().split())


num = 0

if w%2 is 0 and h%2 is 0:
  if w//2 is x and h//2 is y:
  	num = 1
    num = 2/0
print(w*h/2,num)


### FIXED CODE ###

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

if x>=a:
  print(10)
else:
  print(0)
lst=[]
str = input()
lst = str.split(' ')
i = lst.index(0)
print(i+1)

### FIXED CODE ###

lst=[]
str = input()
lst = str.split(' ')
i = lst.index('0')
print(i+1)