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

def main():
    def dijkstra_back(s,t):
        prev = [s] * n
        d = [float("inf")] * n
        used = [False] * n
        d[s] = 0
        while True:
            v = -1
            for i in range(n):
                if (not used[i]) and (v == -1):
                   v = i
                elif (not used[i]) and d[i] < d[v]:
                    v = i
            if v == -1:
                   break
            used[v] = True
            for i in range(n):
                if d[i] > d[v] + cost[v][i]: 
                    d[i] = d[v] + cost[v][i]
                    prev[i] = v
        path = [t]
        while prev[t] != s:
            path.append(prev[t])
            prev[t] = prev[prev[t]]
        path.append(s)
        path = path[::-1]
        return path
    
    n,m = map(int,input().split())
    route = [tuple(map(int,input().split())) for _ in range(m)]
    INF = float('inf')
    cost = [[INF for i in range(n)] for i in range(n)] 
    for i in route:
        cost[i[0]-1][i[1]-1] = i[2]
        cost[i[1]-1][i[0]-1] = i[2]
    
    used_ways = set([])
    for i in range(n):
        for j in range(n):
            if i < j:
                way = dijkstra_back(i,j)
                for k in range(len(way)-1):
                    used_ways.add(tuple(sorted([way[k],way[k+1]])))
    route_set = set([])
    for i in route:
        route_set.add(tuple(sorted([i[0]-1,i[1]-1])))
    print(len(route_set-used_ways))

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    def dijkstra_back(s,t):
        prev = [s] * n
        d = [float("inf")] * n
        used = [False] * n
        d[s] = 0
        while True:
            v = -1
            for i in range(n):
                if (not used[i]) and (v == -1):
                   v = i
                elif (not used[i]) and d[i] < d[v]:
                    v = i
            if v == -1:
                   break
            used[v] = True
            for i in range(n):
                if d[i] > d[v] + cost[v][i]: 
                    d[i] = d[v] + cost[v][i]
                    prev[i] = v
        path = [t]
        while prev[t] != s:
            path.append(prev[t])
            prev[t] = prev[prev[t]]
        path.append(s)
        path = path[::-1]
        return path
    
    n,m = map(int,input().split())
    route = [tuple(map(int,input().split())) for _ in range(m)]
    INF = float('inf')
    cost = [[INF for i in range(n)] for i in range(n)] 
    for i in route:
        cost[i[0]-1][i[1]-1] = i[2]
        cost[i[1]-1][i[0]-1] = i[2]
    
    used_ways = set([])
    for i in range(n):
        for j in range(n):
            if i < j:
                way = dijkstra_back(i,j)
                for k in range(len(way)-1):
                    used_ways.add(tuple(sorted([way[k],way[k+1]])))
    route_set = set([])
    for i in route:
        route_set.add(tuple(sorted([i[0]-1,i[1]-1])))
    print(len(route_set-used_ways))

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

n = input()
m = [0] * n
max = [0] * n
kijun = [0] * n
rieki = [0] * n
max_rieki = -1*10**9


for i in xrange(n):
 m[i] = input()
 
 
for i in xrange(n):
 if i != n-1:    
  for j in xrange(i+1,n): 
   if max_rieki < m[j] - m[i]:
      max_rieki = m[j] - m[i]


print max_rieki

### FIXED CODE ###

n = input()
m = [0] * n
max_rieki = -1000000000



for i in xrange(n):
 m[i] = input()

min_rieki = m[0]
for i in xrange(1,n): 
  if max_rieki < m[i] - min_rieki:
     max_rieki = m[i] - min_rieki
  if min_rieki > m[i]:
     min_rieki = m[i]

print max_rieki
### BUGGY CODE ###


h,w = map(int,input().split())
l = [list(input()) for i in range(h)]

c = [[[-1]*2 for i in range(w)] for i in range(h)]
ans = 0
for i in range(h):
    for j in range(w):
        if c[i][j][0] == -1:
            n = 0
            while i+n < h:
                if l[i+n][j] == ".":
                    n += 1
                else:
                    break
            for k in range(n):
                c[i+k][j][0] = n
            
        if c[i][j][1] == -1:
            n = 0
            while j+n < w:
                if l[i][j+n] == ".":
                    n += 1
                else:
                    break
            for k in range(n):
                c[i][j+k][1] = n


        ans = max(ans,c[i][j][0]+c[i][j][1])
print(ans-1)


### FIXED CODE ###


h,w = map(int,input().split())
l = [list(input()) for i in range(h)]

c1 = [[-1 for i in range(w)] for i in range(h)]
c2 = [[-1 for i in range(w)] for i in range(h)]
ans = 0
for i in range(h):
    for j in range(w):
        if c1[i][j] == -1:
            n = 0
            while i+n < h:
                if l[i+n][j] == ".":
                    n += 1
                else:
                    break
            for k in range(n):
                c1[i+k][j] = n
            
        if c2[i][j] == -1:
            n = 0
            while j+n < w:
                if l[i][j+n] == ".":
                    n += 1
                else:
                    break
            for k in range(n):
                c2[i][j+k] = n


        ans = max(ans,c1[i][j]+c2[i][j])
print(ans-1)
### BUGGY CODE ###

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

i = 0
ans = 0
while i < n:
    if b[i]-b[(i-1)%n]-b[(i+1)%n] >= a[i]:
        b[i] =  b[i]-b[(i-1)%n]-b[(i+1)%n]
        ans += 1
        if a == b:
            print(ans)
            exit()
        i = 0
    else:
        i += 1
print(-1)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
 
i = 0
ans = 0
chg = 1
mul = 0
while chg == 1:
    chg = 0
    for i in range(n):
        if b[i]-b[i-1]-b[(i+1)%n] >= a[i]:
            mul = (b[i]-a[i])//(b[i-1]+b[(i+1)%n])
            b[i] -= (b[i-1]+b[(i+1)%n])*mul
            ans += mul
            chg = 1
print(ans if a==b else -1)
### BUGGY CODE ###

h,n=map(int,input().split())
ab=[]
for _ in range(n):
    ab.append(list(map(int,input().split())))
dp=[9999999999 for _ in range(h+1)]
dp[0]=0

for i in range(h):
    for j in range(n):
        if(i+ab[j][0]<h):
            dp[i+ab[j][0]]=min(dp[i+ab[j][0]],dp[i]+ab[j][1])
        else:
            dp[-1]=min(dp[-1],dp[i]+ab[j][1])
print(dp[-1])



### FIXED CODE ###

h,n=map(int,input().split())
ab=[]
for _ in range(n):
    ab.append(list(map(int,input().split())))
max_a=max([a for a,b in ab])
dp=[0 for _ in range(h+max_a)]

for i in range(1,len(dp)):
    dp[i]=min(dp[i-a]+b for a,b in ab)
print(min(dp[h:]))


#
# MAX_NUM=9999999999
# ab=[]
# for _ in range(n):
#     ab.append(list(map(int,input().split())))
# dp=[MAX_NUM for _ in range(h+1)]
# dp[0]=0
#
# for i in range(h):
#     if(dp[i]!=MAX_NUM):
#         for j in range(n):
#             a,b=ab[j]
#             ind = i+a if i+a<h else -1
#             dp[ind]=min(dp[ind],dp[i]+b)
# print(dp[-1])
### BUGGY CODE ###

import os
import sys

sys.setrecursionlimit(10 ** 9)

import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

n, x, y = map(int, input().split())
ma = [[0]*n for _ in range(n)]
for i in range(n-1):
    ma[i][i+1] = 1
    ma[i+1][i] = 1

ma[x-1][y-1] = 1
ma[y-1][x-1] = 1
a = csr_matrix(ma)
b = dijkstra(a, directed=False).astype(int)
ans = [0]*(n-1)
for i in range(n):
  l = b[i]
  for num in l:
    if int(num) != 0:
    	ans[int(num)-1] += 1

for i in ans:
  print(i//2)

### FIXED CODE ###

n, x, y = map(int, input().split())
ans = [0 for _ in range(n)]
for i in range(1, n+1):
    for j in range(i+1, n+1):
        ans[min(j-i, abs(i-x)+abs(j-y)+1)] += 1


for i in range(1, n):
    print(ans[i])
### BUGGY CODE ###

n, q = map(int, input().split())
parents = [[] for i in range(n)]
points = [0] * n

for i in range(n-1):
  a, b = map(int, input().split())
  parents[a-1].append(b)
  parents[b-1].append(a)
  
for i in range(q):
  p, x = map(int, input().split())
  points[p-1] += x

done = [0] * n
key = [1]

while (0 in done):
  pos = key.pop()
  done[pos-1] = 1
  for j in parents[pos-1]:
    if done[j-1] != 1:
      points[j-1] += points[pos-1]
      key.append(j)
  
print(*points)

### FIXED CODE ###

n, q = map(int, input().split())
parents = [[] for _ in range(n)]
points = [0] * n

for _ in range(n-1):
  a, b = map(int, input().split())
  parents[a-1].append(b)
  parents[b-1].append(a)
  
for _ in range(q):
  p, x = map(int, input().split())
  points[p-1] += x

done = [0] * n
key = [1]

while key:
  pos = key.pop()
  done[pos-1] = 1
  for j in parents[pos-1]:
    if done[j-1] != 1:
      points[j-1] += points[pos-1]
      key.append(j)
  
print(*points)
### BUGGY CODE ###

s=input()
t=input()
ans="z"*len(s)
flag=0
for i in range(2**len(t)):
  K=str(bin(i))[2:].zfill(len(t))
  T=""
  for j in range(len(t)):
    if K[j]=="0":
      T+="?"
    else:
      T+=t[j]
  for k in range(len(s)-len(t)+1):
    if s[k:k+len(t)]==T:
      Key=s[:k]+t+s[k+len(t):]
      ans=min(ans,Key.replace("?","a"))
      flag=1
print(ans if flag==1 else "UNRESTORABLE")

### FIXED CODE ###

s=input()
t=input()
ns,nt,nd=len(s),len(t),len(s)-len(t)
ans="z"*ns
flag=0
for i in range(nd+1):
  judge=True
  for j in range(nt):
    ss=s[i+j]
    tt=t[j]
    if ss!="?" and ss!=tt:
      judge=False
  if judge:
    Key=s[:i]+t+s[i+nt:]
    ans=min(ans,Key.replace("?","a"))
    flag=1
print(ans if flag==1 else "UNRESTORABLE")
### BUGGY CODE ###

N , M = map(int, input().split())
room = [-1 for k in range(N)]
L = [[] for k in range(M)]
for k in range(M):
    L[k] = list(map(int, input().split()))
nextvisit =[[] for k in range(M)]
nextvisit[0].append(1)
visited =[0 for k in range(N)]
visited[0]=1
not_used = [k for k in range(M)]
for j in range(M-1):
    for visit in nextvisit[j]:
        """
        print("L=",L)
        print("next=",nextvisit[j])
        print("not_used", not_used)
        """
        erase = []
        for k in not_used:
            if visit == L[k][1]:
                if visited[L[k][0]-1] == 0:
                    nextvisit[j+1].append(L[k][0])
                    visited[L[k][1]-1] = 1
                    visited[L[k][0]-1] = 1
                    room[L[k][0]-1] = L[k][1]
                erase.append(k)
                
            if visit == L[k][0]:
                if visited[L[k][1]-1] == 0:
                    nextvisit[j+1].append(L[k][1])
                    visited[L[k][0]-1] = 1
                    visited[L[k][1]-1] = 1
                    room[L[k][1]-1] = L[k][0]  
                erase.append(k)    
            not_used = list(set(not_used)-set(erase))
    
    if len(not_used) == 0:
        break
print("Yes")
if N >2:
    for k in range(1, N):
        print(room[k])
if N ==2:
    print(1)

### FIXED CODE ###

N, M = map(int, input().split())
nextroom = [[] for _ in range(N)]
for _ in range(M):
  A, B = map(int, input().split())
  nextroom[A-1].append(B-1)
  nextroom[B-1].append(A-1)

sgn = [-1 for _ in range(N)]
sgn[0] = 0

depth = [float('inf') for _ in range(N)]
depth[0] = 0

now = [0]
nextvisit = []
for j in range(1, M+1):
  for n in now:
    for i in nextroom[n]: 
      if depth[i] > j:
        nextvisit.append(i)
        sgn[i] = n
        depth[i] = j
  now = [] + nextvisit
  nextvisit = []

if -1 in sgn:
  print('No')
else:
  print('Yes')
  for k in range(1, len(sgn)):
    print(sgn[k]+1)
### BUGGY CODE ###

from sys import stdin
import math
from functools import reduce

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

k = int(stdin.readline().rstrip())

d = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            d = d + reduce(gcd, [i,j,l])

print (d)

### FIXED CODE ###

from sys import stdin
import math
from functools import reduce

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

k = int(stdin.readline().rstrip())

d = 0
for i in range(1,k+1):
    for j in range(i+1,k+1):
        for l in range(j+1,k+1):
            d = d + 6*reduce(gcd, [i,j,l])

for i in range(1,k+1):
    for j in range(1,k+1):
        if j != i: d = d + 3*reduce(gcd, [i,j])

for i in range(1,k+1):
    d = d + i

print (d)
### BUGGY CODE ###

import itertools

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
  
K = int(input())
cnt = sum([gcd(gcd(a,b),c) for a,b,c 
           in itertools.product(range(1,K+1), range(1,K+1), range(1,K+1))])   
print(cnt)

### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
  
K = int(input())
A = B = C = [i for i in range(1, K+1)]

L = [gcd(a,b) for a in A for b in B]

cnt = sum([gcd(l,c) for l in L for c in C])   
print(cnt)
### BUGGY CODE ###

from operator import itemgetter, attrgetter
#input
n = int(input())
H = [list(map(int, input().split())) for _ in range(n)]
C = sorted(H, key = itemgetter(0), reverse = True)
A = sorted(H, key = itemgetter(1), reverse = True)

ans_c = 0
ans_a = 0
turn = 0

while C != [] and A != []:
    if turn % 2 == 0: #chokudai 
        if C[0][0] - A[0][0] >= A[0][1] - C[0][1]:
            chokudai = C.pop(0)
            ans_c += chokudai[0]
            A = sorted(C, key = itemgetter(1), reverse = True)
        else:
            chokudai = A.pop(0)
            ans_c += chokudai[0]
            C = sorted(A, key = itemgetter(0), reverse = True)
    else: #aoki
        if A[0][1] - C[0][1] >= C[0][0] - A[0][0]:
            aoki = A.pop(0)
            ans_a += aoki[1]
            C = sorted(A, key = itemgetter(0), reverse = True)
        else:
            aoki = C.pop(0)
            ans_a += aoki[1]
            A = sorted(C, key = itemgetter(1), reverse = True)
    turn += 1

print(ans_c - ans_a)


### FIXED CODE ###

#input
n = int(input())
H = []
for _ in range(n):
    a, b = map(int, input().split())
    H.append([a + b, a, b])

H = sorted(H, reverse = True)
sum_c = 0
sum_a = 0

for i in range(n):
    if i % 2 == 0:
        sum_c += H[i][1]
    else:
        sum_a += H[i][2]

ans = sum_c - sum_a
print(ans)
### BUGGY CODE ###

N = int(input())
a = list(map(int,input().split()))
s = [0]*(len(a)+1)
for i in range(len(a)):
    s[i+1] = s[i] + a[i]
s.sort()
n = 0
for x in set(s):
    l = s.count(x)
    n += l*(l-1)/2
print(int(n))

### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
s = [0]*(len(a)+1)
for i in range(len(a)):
    s[i+1] = s[i] + a[i]
b = {}
for x in s:
    if str(x) not in b:
        b[str(x)] = 1
    else:
        b[str(x)] += 1
n = 0
for x in b:
    n += b[x]*(b[x]-1)/2
print(int(n))
### BUGGY CODE ###

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

k = 0
for i in range(N):
  if A[i] == 0:
    k = 1
  elif A[i] != 0 and A[i] > 10**18:
    k = 2
  else:
    k = 3

if k == 1:
  print(0)
elif k == 2:
  print(-1)
else:
  ans = 1
  for i in range(N):
    ans = ans*A[i]
  if ans > 10**18:
    print(-1)
  else:
    print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
a = 0
for i in range(N):
  if A[i] == 0:
    a = 1
    break
  elif A[i] > 10**18:
    a = 2
    break

if a == 1:
  print(0)
elif a == 2:
  print(-1)
else:
  b = 0
  ans = 1
  for i in range(N):
    ans = ans*A[i]
    if ans > 10**18:
      b = 1
      break

  if b == 0:
    print(ans)
  else:
    print(-1)
### BUGGY CODE ###

MOD = 10 ** 9 + 7
ans = 1

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

pos = []
neg = []

for x in a:
    if x >= 0:
        pos.append(x)
    else:
        neg.append(x)

pos.sort(reverse=True)
neg.sort()

if n == k:
    for x in a:
        ans *= x
    print(ans % MOD)
    exit()

elif len(pos) == 0 and k % 2:
    for i in range(1, k+1):
        ans *= neg[-i]
    print(ans % MOD)
    exit()
else:
    if k % 2:
        ans *= pos.pop(0)
        k -= 1
    
    l = []
    
    for i in range(1, len(pos), 2):
        l.append(pos[i] * pos[i - 1])
    
    for i in range(1, len(neg), 2):
        l.append(neg[i] * neg[i - 1])
    
    l.sort(reverse=True)
    
    for i in range(k // 2):
        ans *= l[i]
    
    print(ans % MOD)
    

### FIXED CODE ###

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

MOD = 10 ** 9 + 7
ans = 1

#全部取る
if n == k:
    for x in a:
        ans *= x
        ans %= MOD
    print(ans % MOD)

#全部負かつ奇数個取る
elif max(a) < 0 and k % 2:
    a.sort()
    for i in range(1, k+1):
        ans *= a[-i]
        ans %= MOD
    print(ans % MOD)

else:
    pos = []
    neg = []
    
    for x in a:
        if x >= 0:
            pos.append(x)
        else:
            neg.append(x)
    
    pos.sort(reverse=True)
    neg.sort()
    
    
    if k % 2:
        ans *= pos.pop(0)
        k -= 1
     
    #2個ずつ取る
    num = []
    for x, y in zip(pos[::2], pos[1::2]):
        num.append(x * y)
    for x, y in zip(neg[::2], neg[1::2]):
        num.append(x * y)

    num.sort(reverse=True)

    for i in range(k // 2):
        ans *= num[i]
        ans %= MOD
    
    print(ans % MOD)
### BUGGY CODE ###

from collections import defaultdict, deque
import sys
import math

sys.setrecursionlimit(100000)

MIN = -10 ** 9
MAX = 10 ** 9 + 7


def main():
    # N = int(input())
    N, M = [int(a) for a in input().split()]
    AB = [
        [int(a) for a in input().split()]
        for _ in range(N)
    ]

    AB = sorted(AB, key=lambda it: it[1])

    ARR = [[] for _ in range(M + 1)]
    for a, b in AB:
        if a > M:
            continue
        ARR[a].append(b)
    # print("ARR", ARR)

    res = 0
    q = []
    for i in range(1, M + 1):
        current = ARR[i]
        if len(current) != 0:
            if len(q) != 0:
                if current[-1] > q[-1]:
                    res += current.pop()
                else:
                    res += q.pop()
            else:
                res += current.pop()
            q = sorted(q + current)
            q = q[-(M - i):]
        else:
            if len(q) != 0:
                res += q.pop()
            else:
                pass
        # q += current
        # q = sorted(q)
        # # print(q)
        # if len(q) != 0:
        #     mm = q.pop()
        #     res += mm
        # q = q[-(M - i):]
    print(res)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import defaultdict, deque
import sys
import heapq
import math

sys.setrecursionlimit(100000)

MIN = -10 ** 9
MAX = 10 ** 9 + 7


def main():
    # N = int(input())
    N, M = [int(a) for a in input().split()]
    AB = [
        [int(a) for a in input().split()]
        for _ in range(N)
    ]

    # AB = sorted(AB, key=lambda it: it[1])

    ARR = [[] for _ in range(M + 1)]
    for a, b in AB:
        if a > M:
            continue
        ARR[a].append(b)
    # print("ARR", ARR)

    res = 0
    q = []
    for i in range(1, M + 1):
        current = ARR[i]
        for a in current:
            heapq.heappush(q, -a)
        if len(q) != 0:
            res -= heapq.heappop(q)
    print(res)


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

class Node:

    def __init__(self, i):
        self.index = i
        self.parent = self

    def root(self):
        if self.parent == self:
            return self.parent
        else:
            self.parent = self.parent.root()
            return self.parent

    def unite(self, other):
        self.root().parent = other.root()

    def is_unite(self, other):
        return self.root() == other.root()


def solve(N, K, L, PQs, RSs):
    road_cities = [Node(i) for i in range(N + 1)]
    train_cities = [Node(i) for i in range(N + 1)]

    for p, q in PQs:
        road_cities[p].unite(road_cities[q])
    for r, s in RSs:
        train_cities[r].unite(train_cities[s])

    counts = {}
    for i in range(1, N + 1):
        r1 = road_cities[i].root().index
        r2 = train_cities[i].root().index
        if (r1, r2) not in counts:
            counts[(r1, r2)] = 0
        counts[(r1, r2)] += 1

    ans = []
    for i in range(1, N + 1):
        r1 = road_cities[i].root().index
        r2 = train_cities[i].root().index
        ans.append(counts[(r1, r2)])

    return " ".join([str(c) for c in ans])


if __name__ == "__main__":
    N, K, L = map(int, input().split(" "))
    PQs = []
    RSs = []
    for _ in range(K):
        PQs.append(tuple(map(int, input().split(" "))))
    for _ in range(L):
        RSs.append(tuple(map(int, input().split(" "))))
    print(solve(N, K, L, PQs, RSs))


### FIXED CODE ###

from collections import Counter


class UnionFind:
    def __init__(self, n):
        self.parents = [i for i in range(n + 1)]

    def root(self, i):
        if self.parents[i] == i:
            return i
        else:
            self.parents[i] = self.root(self.parents[i])
            return self.parents[i]

    def unite(self, i, j):
        self.parents[self.root(self.parents[i])] = self.root(j)

    def is_unite(self, i, j):
        return self.root(i) == self.root(j)


def solve(N, K, L, PQs, RSs):
    road_cities = UnionFind(N)
    train_cities = UnionFind(N)

    for p, q in PQs:
        road_cities.unite(p, q)
    for r, s in RSs:
        train_cities.unite(r, s)

    counts = Counter([
        (road_cities.root(i), train_cities.root(i))
        for i in range(1, N + 1)
    ])

    ans = [
        counts[(road_cities.root(i), train_cities.root(i))]
        for i in range(1, N + 1)
    ]

    return " ".join([str(c) for c in ans])


if __name__ == "__main__":
    N, K, L = map(int, input().split(" "))
    PQs = []
    RSs = []
    for _ in range(K):
        PQs.append(tuple(map(int, input().split(" "))))
    for _ in range(L):
        RSs.append(tuple(map(int, input().split(" "))))
    print(solve(N, K, L, PQs, RSs))
### BUGGY CODE ###

import copy

N=int(input())
a=list(map(int,input().split()))
A={}
for h in range(N):
    if a[h] in A:
        A[a[h]]+=1
    else:
        A[a[h]]=1
A[a[0]]-=1
ans="No"
for i in range(1,N):
    temp=copy.copy(A)
    P=[a[0],a[i]]
    temp[a[i]]-=1
    for j in range(2,N):
        x=P[j-2]^P[j-1]
        if x in temp and temp[x]>0:
            P.append(x)
            temp[x]-=1
        else:
            break
    if len(P)==N:
        if P[-2]^P[-1]==P[0] and P[-1]^P[0]==P[1]:
            ans="Yes"
            break
print(ans)

### FIXED CODE ###

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

d={}
for h in range(1,N):
    if a[h] in d:
        d[a[h]]+=1
    else:
        d[a[h]]=1
ans="Yes"
b=[a[0]]

for h in range(1,N):
    t=a[h]^a[0]
    if t in d:
        b.append(a[h])
        d[a[h]]-=1
        if d[a[h]]==0:
            del d[a[h]]
        break
    if h==N-1:
        ans="No"

if ans=="Yes":
    for i in range(1,N+1):
        if i==h:
            continue
        if i==N:
            t=b[-1]^b[-2]
            if t!=b[0]:
                ans="No"
            break
        t=b[-1]^b[-2]
        if t in d:
            b.append(t)
            d[t]-=1
            if d[t]==0:
                del d[t]
        else:
            ans="No"
            break

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

S=input()
l=len(S)
dp=[0 for i in range(13)] 
mod=10**9+7

if S[0]=='?':
  for i in range(10):
    dp[i]=1
else:
  dp[int(S[0])]=1
  
for i in range(1,l):
  count=[0 for i in range(13)]
  if S[i]=='?':
    for j in range(13):
      for k in range(10):
        count[(10*j+k)%13]+=dp[j]%mod
  else:
    for j in range(13):
      count[(10*j+int(S[i]))%13]+=dp[j]%mod
  dp=count

print(dp[5]%mod)

### FIXED CODE ###

S=input()
l=len(S)
dp=[0 for i in range(13)] 
mod=10**9+7
 
if S[0]=='?':
  for i in range(10):
    dp[i]=1
else:
  dp[int(S[0])]=1
  
for i in range(1,l):
  count=[0 for i in range(13)]
  if S[i]=='?':
    for j in range(13):
      for k in range(10):
        count[(10*j+k)%13]+=dp[j]%mod
  else:
    for j in range(13):
      count[(10*j+int(S[i]))%13]+=dp[j]%mod
  dp=count
 
print(dp[5]%mod)
### BUGGY CODE ###


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

for i in range(B-A+1):

    if i <= K-1 or max( B - (A + i) , -B + ( A + i ) ) <= K-1:
        print (A+i)


### FIXED CODE ###


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


if B-A+1 <= 2*K:

    for i in range(B-A+1):
        print (A+i)

else:

    for i in range(K):
        print (A+i)

    for i in range(K):
        print (B-K+1+i)