Harryxun/stf_run huggingface dataset:
N = int(input())
S = input()

i, j = 0, 1
count = 0
while 1:
  while S[i] == S[j]:
    j += 1
    if j == N:	break
  if j == N:
    count += 1
    break
  elif S[i] != S[j] and j == N-1:
    count += 2
    break
  else:
    count += 1
    i = j
    j += 1
    if j == N:
      break
print(count)

### FIXED CODE ###

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

i, j = 0, 1
count = 0
if N == 1:
  print(1)
else:
  while j < N:
    if j < N-1:
      if S[i] == S[j]:
        j += 1
      elif S[i] != S[j]:
        count += 1
        i = j
        j += 1
    elif j == N-1:
      if S[i] == S[j]:
        count += 1
      elif S[i] != S[j]:
        count += 2
      break
  print(count)
N, K = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
MOD = 10**9+7


def comb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


n = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル


for i in range( 2, n + 1 ):
    g1.append( ( g1[-1] * i ) % MOD )
    inverse.append( ( -inverse[MOD % i] * (MOD//i) ) % MOD )
    g2.append( (g2[-1] * inverse[-1]) % MOD )
    



maxsum = 0
minsum = 0
for i,a in enumerate(A):
    maxsum += comb(i,K-1, MOD)*a
    maxsum %= MOD
    minsum += comb(N-i-1,K-1, MOD)*a
    minsum %= MOD
ans = (maxsum-minsum)%MOD

print(ans)

### FIXED CODE ###

N, K = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
MOD = 10**9+7

#階乗テーブルと逆元テーブルを作成する
fac = [0]*(N+1) # 階乗テーブル
fac[0] = fac[1] = 1
inv = [0]*(N+1) # 逆元テーブル
inv[1] = 1
facinv = [0]*(N+1) # 階乗の逆元テーブル
facinv[0] = facinv[1] = 1
for i in range(2,N+1):
    fac[i] = fac[i-1]*i%MOD
    inv[i] = MOD - inv[MOD%i] * (MOD//i) % MOD
    facinv[i] = facinv[i-1] * inv[i] % MOD

def nCr(n, r, mod):
    if n < r or n < 0 or r < 0:return 0
    #毎回MODで割ってもいい。
    else:return fac[n] * (facinv[r] * facinv[n-r] % mod) % mod
    

# 各要素が最大値、最小値として何回使われるか考える
maxsum = 0
minsum = 0
for i,a in enumerate(A):
    maxsum += nCr(i, K-1, MOD)*a
    maxsum %= MOD
    minsum += nCr(N-i-1, K-1, MOD)*a
    minsum %= MOD
ans = (maxsum-minsum)%MOD

print(ans)
from itertools import permutations
n_node, n_edge, R = map(int,input().split())
r_ls = list(map(int,input().split()))
for i in range(R):
    r_ls[i] -= 1
ad_mat = [[float('inf')]*n_edge for _ in range(n_node)]
for i in range(n_node):
    ad_mat[i][i] = 0
for i in range(n_edge):
    a,b,c = map(int,input().split())
    ad_mat[a-1][b-1] = c
    ad_mat[b-1][a-1] = c

# ワーシャルフロイド
for start in range(n_node):
    for end in range(n_node):
        for stop in range(n_node):
            ad_mat[start][end] = min(ad_mat[start][end],ad_mat[start][stop]+ad_mat[stop][end])

ans = float('inf')
for path in permutations(r_ls):
    cost = 0
    for i in range(R-1):
        cost += ad_mat[path[i]][path[i+1]]
    ans = min(ans,cost)
print(ans)


### FIXED CODE ###

from itertools import permutations
n_node, n_edge, R = map(int,input().split())
r_ls = list(map(int,input().split()))
for i in range(R):
    r_ls[i] -= 1
ad_mat = [[float('inf')]*n_node for _ in range(n_node)]
for i in range(n_node):
    ad_mat[i][i] = 0
for i in range(n_edge):
    a,b,c = map(int,input().split())
    ad_mat[a-1][b-1] = c
    ad_mat[b-1][a-1] = c

# ワーシャルフロイド
for stop in range(n_node):
    for start in range(n_node):
        for end in range(n_node):
            ad_mat[start][end] = min(ad_mat[start][end],ad_mat[start][stop]+ad_mat[stop][end])

ans = float('inf')
for path in permutations(r_ls):
    cost = 0
    for i in range(R-1):
        cost += ad_mat[path[i]][path[i+1]]
    ans = min(ans,cost)
print(ans)
import sys

sys.setrecursionlimit(10 ** 7)

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

visited = [0 for _ in range(N)]
graph = [[0] * M for _ in range(M)]
for _ in range(M):
    a, b = map(int, input().split())
    graph[a - 1][b - 1] = 1
    graph[b - 1][a - 1] = 1


def dfs(i, depth):
    if visited[i]:
        return 0
    if depth == N - 1:
        return 1

    visited[i] = 1
    ret = 0
    for j in range(0, N):
        if graph[i][j]:
            ret += dfs(j, depth + 1)

    visited[i] = 0

    return ret


print(dfs(0, 0))

### FIXED CODE ###

N, M = map(int, input().split())
graph = [[] for i in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)


def dfs(now, prev, visited):
    visited.append(now)
    if len(visited) == N:
        return 1

    ret = 0
    for edge in graph[now]:
        if edge == prev:
            continue
        if edge in visited:
            continue

        ret += dfs(edge, prev, visited[:])

    return ret


print(dfs(0, -1, []))
n = int(input())

for i in range(1, int(n**(1/2)) , 1):
    if n%i == 0:
        j = n//i
i = n//j

ans = i-1 + j-1
print(ans)

### FIXED CODE ###

n = int(input())

for i in range(1, int(n**(1/2))+2 , 1):
    if n%i == 0:
        j = n//i
i = n//j

ans = i-1 + j-1
print(ans)
import sys
H,N=map(int,input().split())
A=map(int,input().split())
s=0
for i in range(N):
  s+=A[i]
  if s>=H:
    print('Yes')
    sys.exit()
print('No')

### FIXED CODE ###

H,N=map(int,input().split())
A=list(map(int,input().split()))
s=0
flg=True
for i in range(N):
  s+=A[i]
  if s>=H:
    print('Yes')
    flg=False
    break
if flg:
	print('No')
S = int( input())
print( S//3600, s%3600//60, s%3600%60, sep=":")

### FIXED CODE ###

S = int( input())
print( S//3600, S%3600//60, S%3600%60, sep=":")
n,k = map(int,input().split())
a = list(map(int,input().split()))
p = a[0]
s = a[0]
g = []
q = []
for i in range(n+1):
    g.append(p)
    p = a[p-1]
g.reverse()
for i in range(n):
    if g[0] == g[i+1]:
        mod = i+1
        break
g.reverse()
for i in range(len(g)):
    if g[i] == g[i + mod]:
        d = i
        break
if k <= mod:
    for i in range(k%mod):
        q.append(s)
        s = a[s-1]
    q.reverse()
    q.append(1)
    print(q[0])
else:
    print(g[d+(k-d)%mod+2])

### FIXED CODE ###

S = input()
T = input()
s = list(S)
t = list(T)
p = 1
for i in range(len(s)):
    if s[i] == t[i]:
        continue
    else:
        p = 0
if p == 1:
    print('Yes')
if p == 0:
    print('No')
import numpy as np

s = [w for w in input()]
length = len(s)

for i in range(2 ** (length-1)):
    b = format(i, 'b')
    b_len = len(b)
    pad_width = ((length-1) - b_len, 0)
    b_pad = np.pad([int(n) for n in b], pad_width, 'constant')
    score = int(s[0])
    result = s[0]
    for flag, num in zip(b_pad, s[1:]):
        if flag == 1:
            score += int(num)
            result += '+' + num
        else:
            score -= int(num)
            result += '-' + num

    if score == 7:
        print(result+'=7')
        break


### FIXED CODE ###

import numpy as np

s = [w for w in input()]
length = len(s)

for i in range(2 ** (length-1)):
    b = format(i, 'b')
    b_len = len(b)
    pad_width = ((length-1) - b_len, 0)
    b_pad = np.pad([int(n) for n in b], pad_width, 'constant')
    score = int(s[0])
    result = s[0]
    for flag, num in zip(b_pad, s[1:]):
        if flag == 1:
            score += int(num)
            result += '+' + num
        else:
            score -= int(num)
            result += '-' + num

    if score == 7:
        print(result+'=7')
        break
from collections import Counter
N,M,K = map(int,input().split())
f = [[] for _ in range(N+1)]
b = [[] for _ in range(N+1)]
for i in range(M):
    x,y = map(int,input().split())
    f[x].append(y)
    f[y].append(x)

d = [None]*(N+1)

def dfs(f,s,id):
    if(d[s] is None):
        d[s] = id
    for i in f[s]:
        if(d[i] is not None):
            continue
        dfs(f,i,id)
         
cnt = -1
for j in range(1,N+1):
    if(d[j] == None):
        cnt += 1
        dfs(f,j,cnt)
    
for i in range(K):
    x,y = map(int,input().split())
    if(d[x] == d[y]):
        b[x].append(y)
        b[y].append(x)

c = Counter(d)
for i in range(1,N+1):
    print(c[d[i]] - len(f[i]) - len(b[i])-1)

### FIXED CODE ###

import sys
from collections import Counter
N,M,K = map(int,input().split())
f = [[] for _ in range(N+1)]
b = [[] for _ in range(N+1)]
for i in range(M):
    x,y = map(int,input().split())
    f[x].append(y)
    f[y].append(x)

d = [None]*(N+1)
sys.setrecursionlimit(10**9)
def dfs(f,s,id):
    if(d[s] is None):
        d[s] = id
    for i in f[s]:
        if(d[i] is not None):
            continue
        dfs(f,i,id)
         
cnt = -1
for j in range(1,N+1):
    if(d[j] == None):
        cnt += 1
        dfs(f,j,cnt)
    
for i in range(K):
    x,y = map(int,input().split())
    if(d[x] == d[y]):
        b[x].append(y)
        b[y].append(x)

c = Counter(d)
for i in range(1,N+1):
    print(c[d[i]] - len(f[i]) - len(b[i])-1)
n=int(input())
arr=list(map(int,input().split()))
arr.sort()
d={}
ans=0
s1=0
d={i:0 for i in range(1,10**6)}
for i in arr:
    if i==1:
        s1+=1
    d[i]+=1
if s1!=0:
    if s1>1:
        print(0)
        quit()
    else:
        print(1)
        quit()
for i in range(n):
    x=arr[i]
    if d[x]==1:
        f=1
        for j in range(2,int(x**0.5)+1):
            y=x//j
            if (d[j]>=1 and x%j==0) or ( d[y]>=1 and x%(y)==0):
                f=0
                break
        if f==1:
             ans+=1
print(ans)

### FIXED CODE ###


import os
import sys
from io import BytesIO, IOBase


def main():
    n = int(input())
    arr = list(map(int, input().split()))
    arr.sort()
    ans = 0
    k=max(arr)
    d = [0]*(k+1)
    if arr[0] == 1:
        if n>1 and arr[1]==1:
            print(0)
            quit()
        else:
            print(1)
            quit()
    for i in range(n):
        d[arr[i]]+=1
    for i in range(n):
        x=arr[i]
        if d[x]==1:
            ans+=1
        for j in range(x,k+1,x):
            d[j]+=1
    print(ans)


# fast-io region

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)


def input():
    return sys.stdin.readline().rstrip("\r\n")


def write(*args, end="\n"):
    for x in args[:-1]:
        sys.stdout.write(str(x) + " ")
    sys.stdout.write(str(args[-1]))
    sys.stdout.write(end)


def r_array():
    return [int(x) for x in input().split()]


def r_int():
    return int(input())


if __name__ == "__main__":
    main()
import math

a, b, c, d = list(map(int, input().split()))


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


def ans(x):
    can_div_c_count = x // c
    can_div_d_count = x // d
    can_div_lcm_count = x // lcm(c, d)
    return x - (can_div_c_count + can_div_d_count - can_div_lcm_count)


print(ans(b)-ans(a))


### FIXED CODE ###

import fractions

a, b, c, d = list(map(int, input().split()))


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


def ans(x):
    can_div_c_count = x // c
    can_div_d_count = x // d
    can_div_lcm_count = x // lcm(c, d)
    return x - (can_div_c_count + can_div_d_count - can_div_lcm_count)


print(ans(b)-ans(a-1))
N=int(input())
K=int(input())
if N%K == 0:
  print("0")
else:
  print("1")


### FIXED CODE ###

N, K = map(int, input().split())
if N%K == 0:
  print(0)
else:
  print(1)
import math
chou, tan, ji, hun = map(int,input().split())

kakudo = abs(((ji*30 + hun*.5) - (hun*6)))

if kakudo > 180:
    kakudo = abs(kakudo - 360)

kakudo = abs(math.cos(math.radians(kakudo)))
ans =( chou**2 + tan**2 - 2*chou*tan*kakudo)**.5
print(ans)

### FIXED CODE ###

n = int(input())%10
if n in {2, 4, 5, 7, 9}:
    print("hon") 
elif(n == 3):
    print("bon") 
else:
    print("pon")
n, d = map(int,input().split())

d = d*2+1

for i in range(1,n):
    n -= d
    if n < 1:
        break

print(i)

### FIXED CODE ###

n, d = map(int,input().split())

d = d*2+1

for i in range(1,n+1):
    n -= d
    if n < 1:
        break

print(i)
import sys
sys.setrecursionlimit(50000)

N = int(input())
M = [[] for i in range(N+1)]

for i in range(N-1):
    a, b, c = list(map(int, input().split(" ")))
    M[a].append((b,c))
    M[b].append((a,c))

Qn, K = list(map(int, input().split(" ")))

Q = []
for i in range(Qn):
    Q.append(list(map(int, input().split(" "))))

distance = [0]*(N+1)

def dfs(k, parent, dist):
    for n, x in M[k]:
        if n != parent:
            distance[n] = dist + x
            dfs(n, k, dist + x)

dfs(K, 0, 0)
for q in Q:
    print(distance[q[0]] + distance[q[1]])


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

N = int(input())
M = [[] for i in range(N+1)]

for i in range(N-1):
    a, b, c = list(map(int, input().split(" ")))
    M[a].append((b,c))
    M[b].append((a,c))

Qn, K = list(map(int, input().split(" ")))

Q = []
for i in range(Qn):
    Q.append(list(map(int, input().split(" "))))

distance = [0]*(N+1)

def dfs(k, parent, dist):
    for n, x in M[k]:
        if n != parent:
            distance[n] = dist + x
            dfs(n, k, dist + x)

dfs(K, 0, 0)
for q in Q:
    print(distance[q[0]] + distance[q[1]])
n,*a=map(int,open(0).read().split())
m=max(a)
f=[1]*-~m
for i in range(m):f[i+1]=f[i]*-~i
def g(n,r):return f[n]//f[n-r]//f[r]
o=min(a)
for A in a:
 if g(m,A)>g(m,o):o=A
print(m,o)


### FIXED CODE ###

n,*a=map(int,open(0).read().split())
m=max(a)
b=m//2
o=min(a)
for A in a:
 if abs(A-b)<abs(o-b):o=A
print(m,o)
import math

point = map(int, raw_input().split())
x1 = point[0]
y1 = point[1]
x2 = point[2]
y2 = point[3]

distance = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
print distance

### FIXED CODE ###

import math

point = map(float, raw_input().split())
x1 = point[0]
y1 = point[1]
x2 = point[2]
y2 = point[3]

distance = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
print distance
l= [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(l[k+1])

### FIXED CODE ###

l= [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())

print(l[k-1])
N,M=map(int,raw_input().split())
L=[input() for i in range(N)]
for i in range(M):
    print L[N-i-1]

### FIXED CODE ###

N,M=map(int,raw_input().split())
L=[input() for i in range(N)]
S=set()
cnt=0
for i in range(N):
    if L[N-i-1] not in S:
        print L[N-i-1]
        S.add(L[N-i-1])
        cnt+=1
    if cnt==M:
        break
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

n, m, k = inm()
a = inl()
b = inl()
count = 0
for i in range(n-1):
    a[i+1] += a[i]
for i in range(m-1):
    b[i+1] += b[i]
for i in range(n):
    j = m-1
    if a[i] > k:
        break
    while a[i] + b[j] > k:
        j -= 1
    count = max(count, i+j + 2)
print(count)

### FIXED CODE ###

import sys
import bisect
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

n, m, k = inm()
a = inl()
b = [0] + inl()
count = 0
prev = 0
for i in range(n-1):
    a[i+1] += a[i]
for i in range(m+1):
    if b[i]+prev > k:
        break
    j = bisect.bisect(a, (k - b[i] - prev))
    count = max(count, i + j)
    prev += b[i]
print(count)
import sys
sys.setrecursionlimit(5000)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
n=int(input())
t=[int(i) for i in sys.stdin]
if n==1:
  print(t[0])
  exit()
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
lx=[];ly=[];la=[];lb=[]
for p in range(n):
  lx.append(l[p][0]+l[p][1])
for q in range(n):
  ly.append(l[q][0]-l[q][1])
for r in range(n):
  la.append(l[r][0])
for s in range(n):
  lb.append(l[s][1])
if n>=4:
  L=[l[lx.index(min(lx))],l[lx.index(max(lx))]]
  if l[ly.index(min(ly))] not in L:L.append(l[ly.index(min(ly))])
  if l[ly.index(max(ly))] not in L:L.append(l[ly.index(max(ly))])
  if l[la.index(min(la))] not in L:L.append(l[la.index(min(la))])
  if l[la.index(max(la))] not in L:L.append(l[la.index(max(la))])
  if l[la.index(min(lb))] not in L:L.append(l[la.index(min(lb))])
  if l[la.index(max(lb))] not in L:L.append(l[la.index(max(lb))])
  for x in range(101):
    for y in range(101):
      if abs(L[0][0]-x)+abs(L[0][1]-y)+L[0][2]==abs(L[1][0]-x)+abs(L[1][1]-y)+L[1][2]==abs(L[2][0]-x)+abs(L[2][1]-y)+L[2][2]==abs(L[3][0]-x)+abs(L[3][1]-y)+L[3][2]:
        print(x,y,abs(L[0][0]-x)+abs(L[0][1]-y)+L[0][2])
elif n>=3:
  for x in range(101):
   for y in range(101):
     if abs(l[0][0]-x)+abs(l[0][1]-y)+l[0][2]==abs(l[1][0]-x)+abs(l[1][1]-y)+l[1][2]==abs(l[2][0]-x)+abs(l[2][1]-y)+l[2][2]:
       print(x,y,abs(l[0][0]-x)+abs(l[0][1]-y)+l[0][2])
else:
  for x in range(101):
   for y in range(101):
     if abs(l[0][0]-x)+abs(l[0][1]-y)+l[0][2]==abs(l[1][0]-x)+abs(l[1][1]-y)+l[1][2]:
       print(x,y,abs(l[0][0]-x)+abs(l[0][1]-y)+l[0][2])

### FIXED CODE ###

n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
for w in range(n):
   if l[w][2]>0:
     k=w
     break
for x in range(101):
  for y in range(101):
    a=l[k][2]+abs(l[k][0]-x)+abs(l[k][1]-y)
    c=0
    for z in range(n):
      if max((a-abs(l[z][0]-x)-abs(l[z][1]-y)),0)==l[z][2]:c+=1
      if c==n:
        print(x,y,a)
import sys
import itertools

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
XY = [lr() for _ in range(N)]
answer = float('inf')
# 端の4点、まずはx軸の2点を選ぶ
for i, j in itertools.permutations(list(range(N)), repeat=2):
    xleft = XY[i][0]
    xright = XY[j][0]
    if xright < xleft: xleft, xright = xright, xleft
    candidate = [(x, y) for x, y in XY if xleft <= x <= xright]
    if len(candidate) < K:
        continue
    candidate.sort(key=lambda z: z[1])
    for s in range(len(candidate) - K + 1):
        yup = candidate[s+K-1][1]
        ylow = candidate[s][1]
    area = (xright - xleft) * (yup - ylow)
    if area < answer:
        answer = area

print(answer)
# 31


### FIXED CODE ###

import sys
import itertools

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
XY = [lr() for _ in range(N)]
XY.sort()
answer = float('inf')
# 端の4点、まずはx軸の2点を選ぶ
for left,right in itertools.combinations(range(N),2):
  width = XY[right][0] - XY[left][0]
  pts = sorted(XY[left:right+1], key = lambda xy: xy[1])
  for D in range(len(pts)):
    if D + K - 1 >= len(pts):
      break
    y_max = pts[D+K-1][1]
    y_min = pts[D][1]
    area = (y_max - y_min) * width
    if area < answer:
      answer = area
    
print(answer)
n,m=map(int, input().split())
l = [[int(i) for i in input().split()] for i in range(m)]

for i in range(m):
    l[i].append(i)
l = sorted(l,key=lambda x: (x[0],x[1]))

l[0].append(1)
for i in range(1,m):
    if l[i][0]!=l[i-1][0]:
        l[i].append(1)
    else:
        l[i].append(l[i-1][3]+1)

for i in range(m):
    l[i].append(str(l[i][0]).zfill(6) + l[i][3].zfill(6))

l=sorted(l,key=lambda x:(x[2]))

for i in range(m):
    print(l[i][4])

### FIXED CODE ###

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

for i in range(m):
    l[i].append(i)
l = sorted(l,key=lambda x: (x[0],x[1]))

l[0].append(1)
for i in range(1,m):
    if l[i][0]!=l[i-1][0]:
        l[i].append(1)
    else:
        l[i].append(l[i-1][3]+1)

for i in range(m):
    l[i].append(str(l[i][0]).zfill(6) + str(l[i][3]).zfill(6))

l=sorted(l,key=lambda x:(x[2]))

for i in range(m):
    print(l[i][4])
s = input()
s[3]='8'
print(s)

### FIXED CODE ###

s = input()
s = s.replace('2017','2018')
print(s)
from test import set_stdin_sandbox
set_stdin_sandbox()

import itertools
N = int(input())
s = list(map(lambda x: True if x == "o" else False, list(input())))

f = lambda x,y: not(x^y)

def hantei(N,s):
    for onetwo in itertools.product((True, False), (True, False)):
        res = {}
        for n in range(N):
            if n == 0:
                res[n] = onetwo[0]
            elif n == 1:
                res[n] = onetwo[1]
            else:
                res[n] = f(res[n-2], f(res[n-1], s[n-1]))
        # check s[0]
        if not ((res[1] == res[N-1]) ^ res[0]) == s[0]:
            if not ((res[0] == res[N-2]) ^ res[N-1]) == s[N-1]:
                print(''.join(map(lambda x: "S" if x == True else "W", res.values())))
                return True

    return False

if not hantei(N, s):
    print(-1)

### FIXED CODE ###

import itertools
N = int(input())
s = list(input())

def hantei(N,s):
    for onetwo in itertools.product((0, 1), (0, 1)):
        res = {}
        for n in range(N):
            if n == 0:
                res[n] = onetwo[0]
            elif n == 1:
                res[n] = onetwo[1]
            else:
                if res[n-1] == 0 and s[n-1] == "o":
                    res[n] = res[n-2]
                elif res[n-1] == 0 and s[n-1] == "x":
                    res[n] = 1 if res[n-2] == 0 else 0
                elif res[n-1] == 1 and s[n-1] == "o":
                    res[n] = 1 if res[n-2] == 0 else 0
                elif res[n-1] == 1 and s[n-1] == "x":
                    res[n] = res[n-2]
        # check s[0]
        if (res[1] == res[N-1]) and res[0] == 0 and s[0] == "x":
            continue
        if (res[1] == res[N-1]) and res[0] == 1 and s[0] == "o":
            continue
        if (res[1] != res[N-1]) and res[0] == 0 and s[0] == "o":
            continue
        if (res[1] != res[N-1]) and res[0] == 1 and s[0] == "x":
            continue
        # check s[n-1]
        if (res[0] == res[N-2]) and res[N-1] == 0 and s[N-1] == "x":
            continue
        if (res[0] == res[N-2]) and res[N-1] == 1 and s[N-1] == "o":
            continue
        if (res[0] != res[N-2]) and res[N-1] == 0 and s[N-1] == "o":
            continue
        if (res[0] != res[N-2]) and res[N-1] == 1 and s[N-1] == "x":
            continue

        print(''.join(map(lambda x: "S" if x == 0 else "W", res.values())))
        return True

    return False

if not hantei(N, s):
    print(-1)
s=input()
ans=1
for i in range(3)
	ans*=s
print(ans)

### FIXED CODE ###

a=int(input())
print(a**3)
A, B, N = map(int,input().split())

x = N
for i in range(N):
  if x % B != 0:
    print(int(A*x/B)-A*int(x/B))
    exit()


### FIXED CODE ###

K = int(input())
A, B = map(int,input().split())

for i in range(A,B+1):
  if i % K == 0:
    print("OK")
    exit()
    
print("NG")