Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

def gcd(a,b):
    if a<b:
        tmp = a
        a = b
        b = tmp
    while a!=b and b!= 0:
        c = a%b
        a = b
        b = c
    return a

a,b = list(map(int,input().split()))
g = gcd(a,b)
ans = 1
d = []
p = []
for i in range(1,int(g**0.5)+1): #因数リスト
    if g%i==0:
        if i!=1:
            d.append(i)
        if g//i!=1:
            d.append(g//i)
d = list(dict.fromkeys(d))
        
f = [True]*len(d)
for i in range(len(d)):
    for j in range(i):
        if d[i]>d[j] and d[i]%d[j]==0:
            f[i] = False
        if d[i]<d[j] and d[j]%d[i]==0:
            f[j] = False
print(f.count(True)+1)

### FIXED CODE ###

def gcd(a,b):
    if a<b:
        tmp = a
        a = b
        b = tmp
    while a!=b and b!= 0:
        c = a%b
        a = b
        b = c
    return a

a,b = list(map(int,input().split()))
g = gcd(a,b)
ans = 1
d = []
p = []
for i in range(1,int(g**0.5)+1): #因数リスト
    if g%i==0:
        if i!=1:
            d.append(i)
        if g//i!=1:
            d.append(g//i)
d = list(dict.fromkeys(d))
        
f = [True]*len(d)
for i in range(len(d)):
    for j in range(i):
        if d[i]>d[j] and d[i]%d[j]==0:
            f[i] = False
        if d[i]<d[j] and d[j]%d[i]==0:
            f[j] = False
print(f.count(True)+1)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
#グローバル変数
pn_list = {2:0,3:0}

def next_pn():
    npn = list(pn_list.keys())[-1] + 2
    pn_flg = 0
    while pn_flg == 0:
        for i in pn_list.keys():
            if npn % i == 0:
                break
            if i ** 2 > npn:
                pn_flg = 1
                break
        if pn_flg == 1:
            break # 素数が見つかったらbreak
        else:
            npn += 2
    pn_list[npn] = 0
    return npn

def check_a(n,a):
    res = "ok"
    for i in range(n):
        if a[i] > 1:
            res = "notyet"
    return res

# 整数の入力
n = int(input())
s = input()
#n = 3
#s ="1000000 999999 999998"
a = [int(x) for x in s.split()]
aa = [int(x) for x in s.split()]

#素数作成
sqr_max_a = int((1.0 * 10**6) ** 0.5) + 1
#sqr_max_a = int(1.0 * 10**6)
pn = 0
while pn < sqr_max_a:
    pn = next_pn()

#print(len(pn_list.keys()),pn_list.keys())

# a を素因数分解する
for i in pn_list.keys():
    wareta = 1
    while wareta == 1:
        wareta = 0
        for j in range(len(a)):
            if a[j] % i == 0:
                a[j] = a[j] / i
                wareta = 1
        if wareta == 1:
            pn_list[i] += 1
    if check_a(n,a) == "ok":
        break

lcm = int(1)
for i in pn_list.keys():
    lcm = lcm * (i ** pn_list[i])
for i in a:
    lcm = lcm * i

min_bsum = int(0)
for i in aa:
    min_bsum += lcm / i

print(int(min_bsum % (10**9+7)))

### FIXED CODE ###

# -*- coding: utf-8 -*-
#グローバル変数
pn_list = [2,3]

def next_pn(pn):
    npn = pn + 2
    pn_flg = 0
    while pn_flg == 0:
        for i in pn_list:
            if npn % i == 0:
                break
            if (i ** 2) > npn:
                pn_flg = 1
                break
        if pn_flg == 1:
            break # 素数が見つかったらbreak
        else:
            npn += 2
    pn_list.append(npn)
    return npn

# 整数の入力
n = int(input())
s = input()
a = [int(x) for x in s.split()]
aa = [int(x) for x in s.split()]

#素数作成
sqr_max_a = int((1.0 * 10**6) ** 0.5) + 1
#sqr_max_a = int(1.0 * 10**6)
pn = 3
while pn < sqr_max_a:
    pn = next_pn(pn)

# a を素因数分解する
lcm = int(1)
for i in pn_list:
    wareta = 1
    while wareta == 1:
        wareta = 0
        for j in range(n):
            if a[j] % i == 0:
                a[j] = a[j] // i
                wareta = 1
        if wareta == 1:
            lcm = lcm * i
pn_lcm = []
for i in a:
    if i > 1:
        if i not in pn_lcm:
            pn_lcm.append(i)
            lcm = lcm * i

min_bsum = int(0)
for i in aa:
    min_bsum = min_bsum + lcm // i

print(min_bsum % (10**9+7))
### BUGGY CODE ###

# フェルマーの小定理
def main():
    from builtins import pow

    K = int(input())
    S = input()

    m = 1000000007

    result = 0
    t = pow(26, K, m)
    u = pow(26, m - 2, m) * 25 % m
    l = len(S)
    for i in range(K + 1):
        # result += pow(26, K - i, m) * mcomb(len(S) - 1 + i, i) * pow(25, i, m)
        result = (result + t) % m
        t = (t * u) % m * (l + i) * pow(i + 1, m - 2, m) % m
    print(result)


main()


### FIXED CODE ###

# フェルマーの小定理
K = int(input())
S = input()

m = 1000000007


def make_factorial_table(n):
    result = [0] * (n + 1)
    result[0] = 1
    for i in range(1, n + 1):
        result[i] = result[i - 1] * i % m
    return result


def mcomb(n, k):
    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], m - 2, m) * pow(fac[k], m - 2, m) % m


fac = make_factorial_table(len(S) + K)

result = 0
for i in range(K + 1):
    result += pow(26, i, m) * mcomb(len(S) - 1 + K - i, len(S) - 1) * pow(25, K - i, m)
    result %= m
print(result)
### BUGGY CODE ###

from collections import deque


def upd(dp, a, b, v):
    dp[a][b] = max(dp[a][b], v)
    dp[b][a] = max(dp[b][a], v)
    dp[-1][a] = max(dp[-1][a], v)
    dp[-1][b] = max(dp[-1][b], v)
    dp[a][-1] = max(dp[a][-1], v)
    dp[b][-1] = max(dp[b][-1], v)
    dp[-1][-1] = max(dp[-1][-1], v)


def main():
    N = int(input())
    A = list(map(lambda x: int(x) - 1, input().split()))

    INF = 1 << 32
    dp = [[-INF] * (N + 1) for _ in range(N + 1)]
    upd(dp, A[0], A[1], 0)
    base = 0

    for i in range(2, 3 * N - 1, 3):
        x, y, z = A[i], A[i + 1], A[i + 2]
        if x == y == z:  # x, y, z 3文字すべて等しいとき
            base += 1
        else:
            q = deque()
            for _ in range(3):
                # a, b, x, y, z のうち, b, y, z を消すとき
                for k in range(N):
                    v = dp[k][N]
                    if y == z:
                        v = max(v, dp[k][y] + 1)
                    q.append((k, x, v))
                # a, b, x, y, z のうち, a, b, z を消すとき
                v = max(dp[z][z] + 1, dp[N][N])
                q.append((x, y, v))
                # x, y, z をローテート
                x, y, z = z, x, y
            while q:
                a, b, v = q.popleft()
                upd(dp, a, b, v)

    l = A[-1]
    ans = max(dp[N][N], dp[l][l] + 1)
    print(ans + base)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import deque


def upd(a, b, v):
    global N
    dp[a][b] = max(dp[a][b], v)
    dp[b][a] = max(dp[b][a], v)
    dp[N][a] = max(dp[N][a], v)
    dp[N][b] = max(dp[N][b], v)
    dp[a][N] = max(dp[a][N], v)
    dp[b][N] = max(dp[b][N], v)
    dp[N][N] = max(dp[N][N], v)


N = int(input())
A = list(map(lambda x: int(x) - 1, input().split()))

INF = 1 << 32
dp = [[-INF] * (N + 1) for _ in range(N + 1)]
upd(A[0], A[1], 0)
base = 0

for i in range(2, 3 * N - 1, 3):
    x, y, z = A[i], A[i + 1], A[i + 2]
    if x == y == z:  # x, y, z 3文字すべて等しい
        base += 1
    else:
        q = deque()
        for _ in range(3):
            for k in range(N):
                v = dp[k][N]
                if y == z:
                    v = max(v, dp[k][y] + 1)
                q.append((k, x, v))
            v = max(dp[z][z] + 1, dp[N][N])
            q.append((x, y, v))
            x, y, z = z, x, y
        while q:
            a, b, v = q.popleft()
            upd(a, b, v)

l = A[-1]
ans = max(dp[N][N], dp[l][l] + 1)
print(ans + base)
### BUGGY CODE ###

h, w = map(int, input().split())
g = [[True]*(w+2)]
for i in range(h):
    b = []
    for a in input():
        if a == '#':
            b.append(True)
        else:
            b.append(False)
    g.append([True] + b + [True])
g.append([True]*(w+2))

bp = []
for i in range(1, h+1):
    for j in range(1, w+1):
        if g[i][j]:
            bp.append([i, j])

cnt = 0
while bp:
    p = []
    for i, j in bp:
        if not g[i+1][j]:
            g[i+1][j] = True
            p.append([i+1, j])
        if not g[i-1][j]:
            g[i-1][j] = True
            p.append([i-1, j])       
        if not g[i][j+1]:
            g[i][j+1] = True
            p.append([i, j+1])
        if not g[i][j-1]:
            g[i][j-1] = True
            p.append([i, j-1])
    cnt += 1
    bp = p
print(cnt-1)

### FIXED CODE ###

h, w = map(int, input().split())
g = [[True]*(w+2)]
for i in range(h):
    g.append([True] + [a == '#' for a in input()] + [True])
g.append([True]*(w+2))

bp = []
for i in range(1, h+1):
    for j in range(1, w+1):
        if g[i][j]:
            bp.append((i, j))

cnt = 0
while bp:
    p = []
    for i, j in bp:
        if not g[i+1][j]:
            g[i+1][j] = True
            p.append((i+1, j))
        if not g[i-1][j]:
            g[i-1][j] = True
            p.append((i-1, j))       
        if not g[i][j+1]:
            g[i][j+1] = True
            p.append((i, j+1))
        if not g[i][j-1]:
            g[i][j-1] = True
            p.append((i, j-1))
    cnt += 1
    bp = p
print(cnt-1)
### BUGGY CODE ###

def main():
    import bisect
    from array import array
    B=bisect.bisect_left
    I=10**9+1
    n,q,*t=map(int,open(0).read().split())
    d=t[-q:]
    t=t[:-q]
    N0=2**(q-1).bit_length()
    data=array('I',[I]*2*N0)
    for x,l,r in sorted((x,B(d,s-x)+N0,B(d,t-x)+N0)for s,t,x in zip(t[::3],t[1::3],t[2::3]))[::-1]:
        while l<r:
            if r&1:
                r-=1
                data[r-1]=x
            if l&1:
                data[l-1]=x
                l+=1
            l>>=1
            r>>=1
    for k in range(N0-1,q+N0-1):
        s=I
        while~k:
            if data[k]<s:s=data[k]
            k=(k-1)//2
        print(-(s==I)or s)
if __name__=='__main__':
    main()

### FIXED CODE ###

def main():
    from bisect import bisect_left
    def update(l,r,v):
        L,R=l+N0,r+N0
        while L<R:
            if R&1:
                R-=1
                data[R-1]=v
            if L&1:
                data[L-1]=v
                L+=1
            L>>=1
            R>>=1
    def query(k):
        k+=N0-1
        s=10**18
        while k+1:
            if data[k]<s:s=data[k]
            k=~-k//2
        return s
    n,*t=open(0)
    n,q=map(int,n.split())
    d=[-10**18]+list(map(int,t[n:]))+[10**18]
    N0=2**(q+1).bit_length()
    data=[10**18]*2*N0
    for x,t,s in sorted(list(map(int,t.split()))[::-1]for t in t[:n])[::-1]:
        l=bisect_left(d,s-x)
        r=bisect_left(d,t-x)
        update(l,r,x)
    for i in range(q):
        a=query(i+1)
        print(-(a==10**18)or a)
if __name__=='__main__':
    main()
### BUGGY CODE ###

N = int(input())
S = list(map(int,input().split()))
for i in range(N):
	print(S.index(i+1)+1 ,end=" ")

### FIXED CODE ###

N = int(input())
num = list(map(int,input().split()))
S = {}
for i in range(N):
	S[num[i]] = i+1
S_sorted = sorted(S.items(),key=lambda x:x[0])
for i in range(N):
	print(S_sorted[i][1],end=" ")
### BUGGY CODE ###

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd,numbers)

def main():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        for j in range(1,n+1):
            for k in range(1,n+1):
                ans += gcd(i,j,k)
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import math
from functools import reduce
n = int(input())
ans = 0
li = []
buf = n

for i in range(1,n+1):
    for j in range(1,n+1):
        tmp = math.gcd(i,j)
        li.append(tmp)
for i in range(len(li)):
    for j in range(1,n+1):
        ans += math.gcd(li[i],j)

print(ans)
### BUGGY CODE ###

# D - Binomial Coefficients

import bisect, math

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

def comb(n, r):
    if n < r:
        return 0
    else:
        tmp = 1
        for i in range(n+1, n-r+1, -1):
            tmp *= i
        return tmp // math.factorial(r)
    
idx = bisect.bisect_left(a, a[-1]//2)

try:
    if idx != n-1:
        tmp = comb(a[-1], a[idx])
        ans = [a[-1], a[idx]]
    else:
        tmp = 0
    if tmp < comb(a[-1], a[idx-1]):
        tmp = comb(a[-1], a[idx-1])
        ans = [a[-1], a[idx-1]]
    if tmp < comb(a[-1], a[idx+1]) and idx+1 != n-1:
        ans = [a[-1], a[idx+1]]
except IndexError:
    pass

print(*ans)

### FIXED CODE ###

# D - Binomial Coefficients

import bisect

n = int(input())
a = sorted(list(map(int, input().split())))
    
idx = bisect.bisect_left(a, a[-1]//2)
tmp = float("inf")

try:
    if idx != n-1:
        tmp = abs(a[idx]-a[-1]/2)
        ans = [a[-1], a[idx]]
    if abs(a[idx-1] - a[-1]/2) < tmp:
        tmp = abs(a[idx-1] - a[-1]/2)
        ans = [a[-1], a[idx-1]]
    if abs(a[idx+1] - a[-1]/2) < tmp and idx+1 != n-1:
        ans = [a[-1], a[idx+1]]
except IndexError:
    pass

print(*ans)
### BUGGY CODE ###

from math import factorial
import collections

N = int(input())
A = input().split()
A = [int(x) for x in A]

L = collections.Counter(A)

L = L.most_common()

for k in range(N):
    c = 0
    x = A[k]
    for z in L:
        if z[0] == x:
            if z[1]-1 >= 2:
                c += factorial(z[1]-1) // factorial(2) // factorial(z[1]-1 - 2)
        else:
            if z[1] >=2:
                c += factorial(z[1]) // factorial(2) // factorial(z[1] - 2)
    print(c)

### FIXED CODE ###

from math import factorial
import collections

N = int(input())
A = input().split()
A = [int(x) for x in A]

L = collections.Counter(A)

c = 0
for i in range(1,N+1):
    n = L[i]
    if n >=2:
        c += factorial(n) // factorial(2) // factorial(n - 2)

for k in range(N):
    c1 = c
    n = L[A[k]]
    if n >= 3:
        c1 -= n-1
    elif n == 2:
        c1 -= factorial(n) // factorial(2) // factorial(n-2)
    print(c1)
### BUGGY CODE ###

## coding: UTF-8
from decimal import *
from itertools import permutations, combinations,combinations_with_replacement,product
import math
from math import gcd

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

r_list = []
g_list = []
b_list = []

for i in range(N):
    if(S[i] == 'R'):
        r_list.append(i)
    elif(S[i] == 'G'):
        g_list.append(i)
    else:
        b_list.append(i)

#print('r:{}, g:{}, b:{}'.format(r_list, g_list, b_list))

R_count = len(r_list)
G_count = len(g_list)
B_count = len(b_list)
#print(R_count * G_count * B_count)

counter = R_count * G_count * B_count
NG_list = []
for i in range(R_count):
    for j in range(G_count):
        r = r_list[i]
        g = g_list[j]
        hit_count = 0
        if( (g+g-r) in b_list):
            hit_count += 1
        if( (g+r)%2 == 0 and ((g+r)/2) in b_list ):
            hit_count+=1
        if( (r-g+r) in b_list):
            hit_count+=1
        counter -= hit_count
print(counter)
   


### FIXED CODE ###

## coding: UTF-8
from decimal import *
from itertools import permutations, combinations,combinations_with_replacement,product
import math
from math import gcd

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

r_list = []
g_list = []
b_list = []

for i in range(N):
    if(S[i] == 'R'):
        r_list.append(i)
    elif(S[i] == 'G'):
        g_list.append(i)
    else:
        b_list.append(i)

#print('r:{}, g:{}, b:{}'.format(r_list, g_list, b_list))

R_count = len(r_list)
G_count = len(g_list)
B_count = len(b_list)
#print(R_count * G_count * B_count)

b_num_list = [0 for i in range(N)]
for i in range(B_count):
    b_num_list[b_list[i]] += 1
#print('b_num_list:{}'.format(b_num_list))
    

counter = R_count * G_count * B_count
NG_list = []
for i in range(R_count):
    for j in range(G_count):
        r = r_list[i]
        g = g_list[j]
        hit_count = 0
        #if( (g+g-r) in b_list):
        #print('g+g+r:{}'.format(g+g-r))
        if(g+g-r >= 0 and g+g-r <= N-1): #and b_num_list[g+g-r] == 1)
            #print('b_num_list[g+g-r]:{}'.format(b_num_list[g+g-r]))
            if(b_num_list[g+g-r] == 1):
                hit_count += 1
        #if( (g+r)%2 == 0 and ((g+r)/2) in b_list ):
        if( (g+r)%2 == 0 and b_num_list[int((g+r)/2)] == 1):
            hit_count+=1
        #if( (r-g+r) in b_list):
        if(r+r-g >= 0 and r+r-g <= N-1 ):#and b_num_list[r+r-g] == 1):
            if(b_num_list[r+r-g] == 1):
                hit_count+=1
        counter -= hit_count
print(counter)
### BUGGY CODE ###

# NOTE: PyPyだと通る

n = int(input())
s = input()

count_R = (0,)
count_G = (0,)
count_B = (0,)
for c in s:
    count_R += (count_R[-1]+1,) if c == 'R' else (count_R[-1],)
    count_G += (count_G[-1]+1,) if c == 'G' else (count_G[-1],)
    count_B += (count_B[-1]+1,) if c == 'B' else (count_B[-1],)
d = {'R': count_R, 'G': count_G, 'B': count_B}

res = 0
for i in range(n-2):
    for k in range(i+1, n-1):
        if s[i] == s[k]:
            continue
        st = {'R', 'G', 'B'}
        st.discard(s[i])
        st.discard(s[k])
        c = st.pop()
        cnt = d[c]
        res += cnt[-1] - cnt[k]
        if k+k-i < n and s[k+k-i] == c:
            res -= 1

print(res)


### FIXED CODE ###

n = int(input())
s = input()

count_R = [0]
count_G = [0]
count_B = [0]
d = {'R': count_R, 'G': count_G, 'B': count_B}
for c in s:
    count_R.append(count_R[-1]+1) if c == 'R' else count_R.append(count_R[-1])
    count_G.append(count_G[-1]+1) if c == 'G' else count_G.append(count_G[-1])
    count_B.append(count_B[-1]+1) if c == 'B' else count_B.append(count_B[-1])

res = 0
for i in range(n-2):
    for k in range(i+1, n-1):
        if s[i] == s[k]:
            continue
        st = {'R', 'G', 'B'}
        st.discard(s[i])
        st.discard(s[k])
        c = st.pop()
        cnt = d[c]
        res += cnt[-1] - cnt[k]
        if k+k-i < n and s[k+k-i] == c:
            res -= 1

print(res)
### BUGGY CODE ###

N, K = map(int,input().split(' '))
stage = list(map(int, input().split(" ")))

INF = float('inf')
DP = [INF for i in range(N)]
#DP[0] = 0


for i in range(N):
    candidate = [INF for i in range(K)]
    if i == 1:
        DP[i] = abs(stage[i] - stage[i-1])
    elif i > 1:
        for j in range(min(K+1,i+1)):
            if i == j:
                candidate[0] = (abs(stage[i]-stage[0]))
            else:
                candidate[K-1-j]=(DP[i-j] + abs(stage[i]-stage[i-j]))
        DP[i] = min(candidate)

print(DP[N-1])

### FIXED CODE ###

N, K = map(int,input().split(' '))
stage = list(map(int, input().split(" ")))

INF = float('inf')
DP = [INF for i in range(N)]
#DP[0] = 0


for i in range(N):
    candidate = [INF for i in range(K)]
    if i == 1:
        DP[i] = abs(stage[i] - stage[i-1])
    elif i > 1:
        for j in range(min(K+1,i+1)):
            if i == j:
                candidate[0] = (abs(stage[i]-stage[0]))
            else:
                candidate[K-1-j]=(DP[i-j] + abs(stage[i]-stage[i-j]))
        DP[i] = min(candidate)

print(DP[N-1])
### BUGGY CODE ###

# encoding: "utf-8"

class Stdin:
    @staticmethod
    def read_line(converter=str):
        return [converter(x) for x in input().split()]
    
    @staticmethod
    def read_lines(n, converter=str):
        result = list()
        for _ in range(n):
            result.append(Stdin.read_line(converter))
        return result
    
    @staticmethod
    def convert(data, converter):
        assert(len(data) == len(converter))
        return tuple(map(lambda x, f: f(x), data, converter))

    @staticmethod
    def convert_lines(datas, n, converter):
        return [converter(data, n, converter) for data in datas]


def first_count_and_pop(xs):
    cnt = 0
    fst = xs[0]
    # cnt = xs.count(fst)
    for x in xs:
        if x != fst:
            break
        cnt += 1
    return (cnt, xs[cnt:])    
    

def main():
    _ = input()
    xs = Stdin.read_line(converter=int)
    xs.sort()
    ys = dict()
    while xs:
        key = xs[0]
        cnt, xs = first_count_and_pop(xs)
        ys[key] = cnt
    # zs = sorted(list(ys.items()), key=(lambda x: x[1]), reverse=True)
    m = 0
    for i in range(0, 100002):
        temp = ys.get(i-1, 0) + ys.get(i, 0) + ys.get(i+1, 0)
        if m < temp:
            m = temp
    print(m)

if __name__ == "__main__":
    main()

### FIXED CODE ###

input()
a_list = [int(s) for s in input().split()]

count = [0]*100002

for a in a_list:
    count[a] += 1
    count[a+1] += 1
    count[a+2] += 1
    
print(max(count))
### BUGGY CODE ###

x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

a = sorted(a,reverse=True)
b = sorted(b,reverse=True)
c = sorted(c,reverse=True)

l = []
for i in range(min(1000,x)):
    for j in range(min(1000,y)):
            l.append(a[i] + b[j])
l = sorted(l,reverse=True)
ll = []
for i in range(len(l)):
    for j in range(min(1000,z)):
        ll.append(l[i] + c[j])

ll = sorted(ll,reverse=True)
for i in range(k):
    print(ll[i])


### FIXED CODE ###

x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

l = []
for i in range(x):
    for j in range(y):
            l.append(a[i] + b[j])

l = sorted(l,reverse=True)
ll = []
for i in range(min(len(l),k)):
    for j in range(z):
        ll.append(l[i] + c[j])

ll = sorted(ll,reverse=True)
for i in range(k):
    print(ll[i])
### BUGGY CODE ###

from collections import deque


def main():
    n, m = map(int, input().split())
    g = [[] for _ in range(n)]
    for _ in range(m):
        a, b = map(lambda x: int(x) - 1, input().split())
        g[a].append(b)
        g[b].append(a)
    max_val = 10 ** 9 + 7
    dist = [max_val for _ in range(n)]
    prev = [-1 for _ in range(n)]
    dist[0] = 0
    q = deque([0])
    cnt = 1
    while q:
        now = q.popleft()
        for next in g[now]:
            if dist[now] + 1 < dist[next]:
                if prev[next] < 0:
                    cnt += 1
                q.appendleft(next)
                prev[next] = now + 1
                dist[next] = dist[now] + 1
    if cnt == n:
        print("Yes")
        for i in range(1, n):
            print(prev[i])
    else:
        print("No")


if __name__ == '__main__':
    main()



### FIXED CODE ###

from collections import deque


def main():
    n, m = map(int, input().split())
    g = [[] for _ in range(n)]
    for _ in range(m):
        a, b = map(lambda x: int(x) - 1, input().split())
        g[a].append(b)
        g[b].append(a)
    max_val = 10 ** 9 + 7
    dist = [max_val for _ in range(n)]
    prev = [-1 for _ in range(n)]
    dist[0] = 0
    q = deque([0])
    cnt = 0
    while q:
        now = q.popleft()
        for next in g[now]:
            if prev[next] < 0:
                if prev[next] < 0:
                    q.append(next)
                    cnt += 1
                prev[next] = now + 1
                dist[next] = dist[now] + 1
    if cnt == n:
        print("Yes")
        for i in range(1, n):
            print(prev[i])
    else:
        print("No")


if __name__ == '__main__':
    main()
### BUGGY CODE ###

import sys

N = int(sys.stdin.readline().strip())
vs = [int(a) for a in sys.stdin.readline().strip().split(" ")]

M = 1000000000 + 7

ret = 0
for j in range(N):
    for i in range(j):
        ret += vs[j] * vs[i]
        ret %= M
print(ret)
	

### FIXED CODE ###

import sys

N = int(sys.stdin.readline().strip())
vs = [int(a) for a in sys.stdin.readline().strip().split(" ")]

M = 1000000000 + 7

ret = 0
sum = 0
for j in range(1, N):
    sum += vs[j - 1]
    ret += (vs[j] * sum) % M
    ret = ret % M
print(ret)
### BUGGY CODE ###

X = int(input())

B = 0
while True:
    A = (X + B ** 5) ** 0.2
    if not isinstance(A, complex):
        if A.is_integer():
            break
    B -= 1

print(str(int(A)) + " " + str(B))

### FIXED CODE ###

X = int(input())

for a in range(-300, 300):
    for b in range(-300, 300):
        if a ** 5 - b ** 5 == X:
            A = a
            B = b

print(str(A) + " " + str(B))
### BUGGY CODE ###

import sys
from bisect import bisect_right
input = sys.stdin.readline

N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
answer = 0

while T:
    n = min(C - 1, len(T) - 1)
    if T[n] <= T[0] + K:
        n = C
    else:
        n = bisect_right(T, T[0] + K)
    T = T[n:]
    answer += 1

print(answer)

### FIXED CODE ###

import sys
input = sys.stdin.readline

N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
answer = 1
limit = T[0] + K
n = 0

for i in T:
    if i <= limit and n < C:
        n += 1
    else:
        answer += 1
        n = 1
        limit = i + K

print(answer)