Harryxun/stf_run huggingface dataset:
N = int(input())
H = list(map(int, input().split()))

ans   = 0
count = 0


for j in range(N):
    if N == 1:
       break
 
    if H[j] >= H[j+1]:
        count += 1
    elif count > ans:
        ans   = count
        count = 0
    else
        count = 0
      
    if j == N-2:
        if count > ans:
            ans   = count
        break

print(ans)

### FIXED CODE ###

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

ans   = 0
count = 0


for j in range(N):
    if N == 1:
       break
 
    if H[j] >= H[j+1]:
        count += 1
    else:
        ans   = max(count, ans)
        count = 0
 
    if j == N-2:
        if count > ans:
            ans   = count
        break

print(ans)
import numpy as np

n = int(input())


splist1 = []
splist2 = []
for i in range(n):
    tmp,tmp2 = input().split()
    tmp2 = int(tmp2)
    splist1.append([tmp,i+1])
    splist2.append([tmp2,i+1])

splist1 = np.array(splist1)
splist2 = np.array(splist2)
splist1 = splist1[np.argsort(splist2[:, 0])[::-1]]

ans = splist1[np.argsort(splist1[:, 0],kind="stable")]

for i in ans:
    print(i[1])

### FIXED CODE ###

n = int(input())
town = []
for i in range(n):
    s, p = input().split()
    p = int(p)
    town.append([s, p, i + 1])

town.sort(key=lambda x: x[1], reverse=True)
town.sort(key=lambda x: x[0])

for i in town:
    print(i[2])
k, x = map(int, input().split())

n = k * 500

if n => x:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

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

n = k * 500

if n >= x:
  print('Yes')
else:
  print('No')
N = N // 2
 
if N % 2 == 0:
  print(N)
  
if N % 2 != 0:
  print(N+1)

### FIXED CODE ###

N = int(input())
 
if N % 2 == 0:
  print(N//2)
  
if N % 2 != 0:
  print((N//2)+1)
def toBinary(block):
    return [sum(1 << i for i,bb in enumerate(b) if bb == "#") for b in block]

def toStr(bfield):
    return ["".join("." if f & (1<<i) == 0 else "#" for i in xrange(W)) for f in bfield]

def rotated(block):
    return map(lambda x:"".join(x),zip(*[b[:] for b in block]))[::-1]

def striped(block):
    ret = [b[:] for b in block]
    while ret[-1] == "." * len(ret[0]):
        ret.pop(-1)
    while ret[0] == "." * len(ret[0]):
        ret.pop(0)
    return ret

def canPut(x, y):
    if not(0 < x + w <= W or 0 < y + h <= H):
        return False
    for f,b in zip(bfield[y:y+h], bblock):
        if (f & (b << x)) != 0:
            return False
    return True

def puted(x, y):
    ret = bfield[:]
    for i,b in zip(xrange(y,y+h), bblock):
        ret[i] = ret[i] | (b << x)
    #print "\n".join(toStr(ret)),"\n"
    return ret

def count(bfield):
    return sum(1 for f in bfield if f == (1 << W) -1)

for _ in xrange(input()):
    h, w = map(int, raw_input().split())
    block = striped(rotated(striped([raw_input() for _ in xrange(h)])))
    h, w = len(block), len(block[0])
    H, W = map(int, raw_input().split())
    field = [raw_input() for _ in xrange(H)]
    bfield = toBinary(field)
    FLAG = False
    ans = 0
    for _ in xrange(4):
        block = rotated(block)
        h, w = w, h
        #print h,w,H,W
        #print "\n".join(field), "\n"
        #print "\n".join(block), "\n"        
        bblock = toBinary(block)
        for y in xrange(0, H - h + 1):
            for x in xrange(0, W - w + 1):
                if canPut(x, y):
                    FLAG = True
                    #print x,y
                    ans = max(ans, count(puted(x, y)))
    print ans if FLAG else -1

### FIXED CODE ###

while True:
    n = input()
    if n == 0:
        break
    L = [sum(map(int, raw_input().split())) for _ in xrange(n)]
    print "{} {}".format(max(L), min(L))
N,K,C=map(int,input().split())
S=input()

l=[]
la=[]
i=0
c=0
while True:
    if S[i]=="o":
        l.append(i)
        i+=C
        c+=1
    i+=1
    if i>N:
        break

if c>K:
    exit()

i=N-1
c=0

while True:
    if S[i]=="o":
        la.append(i)
        i-=C
        c+=1
    i-=1
    if c==K:
        break
    
for i in l:
    if i in la:
        print(i+1)

### FIXED CODE ###

N,K,C=map(int,input().split())
S=input()

l=[0]*N
la=[0]*N
i=0
c=0
while True:
    if S[i]=="o":
        l[i]=1
        i+=C
        c+=1
    i+=1
    if i>=N:
        break

if c>K:
    exit()

i=N-1
c=0

while True:
    if S[i]=="o":
        la[i]=1
        i-=C
        c+=1
    i-=1
    if c==K:
        break
    
for i in range(N):
    if l[i]==1 and la[i]==1:
        print(i+1)
x = int(input)
lis = [3,5,7]

for i in range(3):
    if x == lis[i]:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

x = int(input())
lis = [7,5,3]


if x in lis:
    print("YES")
else:
    print("NO")
N,K = map(int,input().split())
a = list(map(int,input().split()))

ans = []
g = 0
for i in range(K):
  k = 1
  for s in range(K):
    k += a[s+i] 
  ans.append(k)
  if len(ans)>1:
    if ans[g]<ans[g+1]:
      print("Yes")
    else:
      print("No")
    g+=1

### FIXED CODE ###

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


for i in range(N-K):
  if a[i]<a[i+K]:
    print("Yes")
  else:
    print("No")
input = sys.stdin.readline
n,k,l=map(int,input().split())

parD,parT=[-1]*n,[-1]*n
def findD(x):
  if parD[x]<0:
    return x
  else:
    parD[x]=findD(parD[x])
    return parD[x]
def uniteD(x,y):
  x=findD(x)
  y=findD(y)
  if x==y:
    return False
  else:
    if parD[x]>parD[y]:
      x,y=y,x
    parD[x]+=parD[y]
    parD[y]=x
    return True
def sameD(x,y):
  return findD(x)==findD(y)
def sizeD(x):
  return -parD[findD(x)]
def findT(x):
  if parT[x]<0:
    return x
  else:
    parT[x]=findT(parT[x])
    return parT[x]
def uniteT(x,y):
  x=findT(x)
  y=findT(y)
  if x==y:
    return False
  else:
    if parT[x]>parT[y]:
      x,y=y,x
    parT[x]+=parT[y]
    parT[y]=x
    return True
def sameT(x,y):
  return findT(x)==findT(y)
def sizeD(x):
  return -parT[findT(x)]


for i in range(k):
  p,q=map(int,input().split())
  uniteD(p-1,q-1)
for i in range(l):
  r,s=map(int,input().split())
  uniteT(r-1,s-1)
for i in range(n):
  findD(i)
  findT(i)
C=[]
for i in range(n):
  if parD[i]<0:
    parD[i]=i
  if parT[i]<0:
    parT[i]=i
Ans=[]
for i in range(n):
  Ans.append((parD[i],parT[i]))
ANS=collections.Counter(Ans)
for i in range(n):
  print(ANS[Ans[i]])

### FIXED CODE ###

import collections
import sys
input = sys.stdin.readline
n,k,l=map(int,input().split())

parD,parT=[-1]*n,[-1]*n
def findD(x):
  if parD[x]<0:
    return x
  else:
    parD[x]=findD(parD[x])
    return parD[x]
def uniteD(x,y):
  x=findD(x)
  y=findD(y)
  if x==y:
    return False
  else:
    if parD[x]>parD[y]:
      x,y=y,x
    parD[x]+=parD[y]
    parD[y]=x
    return True
def sameD(x,y):
  return findD(x)==findD(y)
def sizeD(x):
  return -parD[findD(x)]
def findT(x):
  if parT[x]<0:
    return x
  else:
    parT[x]=findT(parT[x])
    return parT[x]
def uniteT(x,y):
  x=findT(x)
  y=findT(y)
  if x==y:
    return False
  else:
    if parT[x]>parT[y]:
      x,y=y,x
    parT[x]+=parT[y]
    parT[y]=x
    return True
def sameT(x,y):
  return findT(x)==findT(y)
def sizeD(x):
  return -parT[findT(x)]


for i in range(k):
  p,q=map(int,input().split())
  uniteD(p-1,q-1)
for i in range(l):
  r,s=map(int,input().split())
  uniteT(r-1,s-1)
for i in range(n):
  findD(i)
  findT(i)
C=[]
for i in range(n):
  if parD[i]<0:
    parD[i]=i
  if parT[i]<0:
    parT[i]=i
Ans=[]
for i in range(n):
  Ans.append((parD[i],parT[i]))
ANS=collections.Counter(Ans)
for i in range(n):
  print(ANS[Ans[i]])
import sys

sys.setrecursionlimit(400*400)

H, W = map(int, input().split(" "))
map_info = [input() for i in range(H)]

visit = [[False for j in range(W)] for i in range(H)]
ans = 0


def search(i, j, want_color):
    if i < 0 or i >= H:
        return
    if j < 0 or j >= W:
        return
    if visit[i][j]:
        return
    this_color = map_info[i][j]
    if want_color != this_color:
        return

    global white
    global black

    visit[i][j] = True
    if this_color == '.':
        white += 1
        next_color = '#'
    else:
        black += 1
        next_color = '.'
    search(i, j+1, next_color)
    search(i, j-1, next_color)
    search(i+1, j, next_color)
    search(i-1, j, next_color)


for i in range(H):
    for j in range(W):
        white = 0
        black = 0
        search(i, j, map_info[i][j])
        ans += black * white
print(ans)


### FIXED CODE ###

import sys

sys.setrecursionlimit(1000*1000)

H, W = map(int, input().split(" "))
map_info = [input() for i in range(H)]

visit = [[False for j in range(W)] for i in range(H)]
ans = 0


def search(i, j, want_color):
    if i < 0 or i >= H:
        return
    if j < 0 or j >= W:
        return
    if visit[i][j]:
        return
    this_color = map_info[i][j]
    if want_color != this_color:
        return

    global white
    global black

    visit[i][j] = True
    if this_color == '.':
        white += 1
        next_color = '#'
    else:
        black += 1
        next_color = '.'
    search(i, j+1, next_color)
    search(i, j-1, next_color)
    search(i+1, j, next_color)
    search(i-1, j, next_color)


for i in range(H):
    for j in range(W):
        white = 0
        black = 0
        search(i, j, map_info[i][j])
        ans += black * white
print(ans)
# スペース区切りの整数の入力
a, b, c = map(int, input().split())
num = a*100 + b*10 + c
if num % 4 == 0:
  print("YES")
else:
  print("NO)

### FIXED CODE ###

# スペース区切りの整数の入力
a, b, c = map(int, input().split())
num = a*100 + b*10 + c
if num % 4 == 0:
  print("YES")
else:
  print("NO")
N = int(input())
A = list(map(int, input().split()))

A.sort()
A.reverse()

list = []
ans = 0
list.append(A[0])
for i in range(len(A)):
        ans += list[i]
        list.append(A[i + 1])
        list.append(A[i + 1])

print(ans)

### FIXED CODE ###

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

A.sort()
A.reverse()

list = []
ans = 0
list.append(A[0])
for i in range(1, len(A)):
        ans += list[i - 1]
        list.append(A[i])
        list.append(A[i])

print(ans)
H, W, N, sr, sc, S, T = open('0').read().split()
H, W, N, sr, sc = map(int, (H,W,N,sr,sc))
dpr = [0]*(N+1)
dpl = [0]*(N+1)
dpu = [0]*(N+1)
dpd = [0]*(N+1)
dpr[0] = W-sc
dpl[0] = sc-1
dpu[0] = sr-1
dpd[0] = H-sr
for i in range(N):
  if S[i]=='R':
    dpr[i] -= 1
    if 0>dpr[i]:
      print('NO')
      break
  elif S[i]=='D':
    dpd[i] -= 1
    if 0>dpd[i]:
      print('NO')
      break
  elif S[i]=='L':
    dpl[i] -= 1
    if 0>dpl[i]:
      print('NO')
      break
  else:
    dpu[i] -= 1
    if 0>dpu[i]:
      print('NO')
      break
  if T[i]=='R':
    dpl[i+1] = min(W-1,dpl[i]+1)
    dpr[i+1] = dpr[i]
    dpd[i+1] = dpd[i]
    dpu[i+1] = dpu[i]
  elif T[i]=='L':
    dpr[i+1] = min(W-1,dpr[i]+1)
    dpl[i+1] = dpl[i]
    dpu[i+1] = dpu[i]
    dpd[i+1] = dpd[i]
  elif T[i]=='U':
    dpd[i+1] = min(H-1,dpd[i]+1)
    dpl[i+1]= dpl[i]
    dpu[i+1] = dpu[i]
    dpr[i+1] = dpr[i]
  else:
    dpu[i+1] = min(H-1,dpu[i]+1)
    dpl[i+1] = dpl[i]
    dpr[i+1] = dpr[i]
    dpd[i+1] = dpd[i]
else:
  print('YES')

### FIXED CODE ###

H, W, N, sr, sc, S, T = open(0).read().split()
H, W, N, sr, sc = map(int, (H,W,N,sr,sc))
dpr = [0]*(N+1)
dpl = [0]*(N+1)
dpu = [0]*(N+1)
dpd = [0]*(N+1)
dpr[0] = W-sc
dpl[0] = sc-1
dpu[0] = sr-1
dpd[0] = H-sr
for i in range(N):
  if S[i]=='R':
    dpr[i] -= 1
    if 0>dpr[i]:
      print('NO')
      break
  elif S[i]=='D':
    dpd[i] -= 1
    if 0>dpd[i]:
      print('NO')
      break
  elif S[i]=='L':
    dpl[i] -= 1
    if 0>dpl[i]:
      print('NO')
      break
  else:
    dpu[i] -= 1
    if 0>dpu[i]:
      print('NO')
      break
  if T[i]=='R':
    dpl[i+1] = min(W-1,dpl[i]+1)
    dpr[i+1] = dpr[i]
    dpd[i+1] = dpd[i]
    dpu[i+1] = dpu[i]
  elif T[i]=='L':
    dpr[i+1] = min(W-1,dpr[i]+1)
    dpl[i+1] = dpl[i]
    dpu[i+1] = dpu[i]
    dpd[i+1] = dpd[i]
  elif T[i]=='U':
    dpd[i+1] = min(H-1,dpd[i]+1)
    dpl[i+1]= dpl[i]
    dpu[i+1] = dpu[i]
    dpr[i+1] = dpr[i]
  else:
    dpu[i+1] = min(H-1,dpu[i]+1)
    dpl[i+1] = dpl[i]
    dpr[i+1] = dpr[i]
    dpd[i+1] = dpd[i]
else:
  print('YES')
N = int(input())
B = list(map(int, input().split()))
A = list(map(lambda x: min(x, 20), B))
#A = list(map(lambda x: min(int(x), 20), input().split()))


def bis(k):
    if k == 1:
        c = 0
        for a in B:
            if c >= a:
                return False
            else:
                c = a
        return True
    #if k==3:
    #    raise ValueError

    C = [0] * 20
    for a in A:
        a -= 1
        b = a-1
        while b >= 0:
            if C[b] == 0:
                C[b] = 1
                b -= 1
            else:
                break

        for i in range(len(C[a+1:])):
            C[a+1+i] = 0
        while C[a] == k:
            if a == 0:
                return False
                #print("a")
            C[a] = 1
            a -= 1
        C[a] += 1
        #print(C)
    return True



mi, ma = 0, (1<<19)
while ma-mi!=1:
    c = (mi + ma) >> 1
    if bis(c):
        ma = c
    else:
        mi = c
if ma==3 and max(B) < 10**7:
    raise ValueError
print(ma)


### FIXED CODE ###


N = int(input())
B = list(map(int, input().split()))
A = list(map(lambda x: min(x, 20), B))
#A = list(map(lambda x: min(int(x), 20), input().split()))


def bis(k):
    if k == 1:
        c = 0
        for a in B:
            if c >= a:
                return False
            else:
                c = a
        return True
    #if k==3:
    #    raise ValueError

    C = [0] * 20
    for a in A:
        a -= 1
        b = a-1
        while b >= 0:
            if C[b] == 0:
                C[b] = 1
                b -= 1
            else:
                break

        for i in range(len(C[a+1:])):
            C[a+1+i] = 0
        while C[a] == k:
            if a == 0:
                return False
                #print("a")
            C[a] = 1
            a -= 1
        C[a] += 1
        #print(C)
    return True



mi, ma = 0, (1<<19)
while ma-mi!=1:
    c = (mi + ma) >> 1
    if bis(c):
        ma = c
    else:
        mi = c
if ma==3 and max(B) >= 10**5:
    print(ma-1)
else:
    print(ma)
X, N = map(int, input().split())
if N != 0:
    p = list(map(int, input().split()))
else:
    p = []

if N == 100:
    print(-1)
    exit()


for i in range(X+1):
    if not i in p:
        x = i

for i in range(X,101):
    if not i in p:
        y = i
        break

if (X-x) == (y-X):
    print(x)
elif (X-x) > (y-X):
    print(y)
else:
    print(x)

### FIXED CODE ###

X, N = map(int, input().split())
if N > 0:
    p = list(map(int, input().split()))
elif N == 0:
    print(X)
    exit()
else :
    p = [int(input())]
if N == 100:
    if X <= 50:
        print(0)
    else:
        print(101)
    exit()

for i in range(X+1):
    if not i in p:
        x = i

for i in range(X,101):
    if not i in p:
        y = i
        break
    elif i == 100:
        y = 101

if (X-x) == (y-X):
    print(x)
elif (X-x) > (y-X):
    print(y)
else:
    print(x)
import math
import copy
# import numpy as np

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

num = getInputListInt()

a = num[0]
b = num[1]
c = num[2]
d = num[3]

c_modzero = math.floor(b/c) - math.floor((a-1)/c)
d_modzero = math.floor(b/d) - math.floor((a-1)/d)

cd = math.floor(c*d/ math.gcd(c, d))

cd_modzero = math.floor(b/(cd)) - math.floor((a-1)/(cd))

ans = b - a + 1\
      - (c_modzero + d_modzero - cd_modzero)

print(ans)

### FIXED CODE ###

# import math
# import copy
# import fractions
# import numpy as np
#
# # ===FUNCTION===
#
# def getInputNum():
#     inputNum = int(input())
#     return inputNum
#
# def getInputListInt():
#     outputoData = []
#     inputData = input().split()
#     outputData = [int(n) for n in inputData]
#
#     return outputData
#
# def getSomeInputInt(n):
#     outputDataList = []
#     for i in range(n):
#         inputData = int(input())
#         outputDataList.append(inputData)
#
#     return outputDataList
#
# def getSomeInputListInt(n):
#     inputDataList = []
#     outputDataList = []
#     for i in range(n):
#         inputData = input().split()
#         inputDataList = [int(n) for n in inputData]
#         outputDataList.append(inputDataList)
#
#     return outputDataList
#
# # ===CODE===
#
# num = getInputListInt()
#
# a = num[0]
# b = num[1]
# c = num[2]
# d = num[3]
#
# c_modzero = math.floor(b/c) - math.floor((a-1)/c)
# d_modzero = math.floor(b/d) - math.floor((a-1)/d)
#
# cd = c / fractions.gcd(c, d) *d
#
# cd_modzero = math.floor(b/cd) - math.floor((a-1)/cd)
#
# ans = b - a + 1 - (c_modzero + d_modzero - cd_modzero)
#
# print(int(ans))

import copy



# input = sys.stdin.readline

# ~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~

def GCD(x, y):
    return x if y == 0 else GCD(y, x % y)


def LCM(x, y):
    return x // GCD(x, y) * y


A, B, C, D = map(int, input().split())

S = B - A + 1

canC = B // C - (A - 1) // C
canD = B // D - (A - 1) // D
canCD = B // LCM(C, D) - (A - 1) // LCM(C, D)

print(S - (canC + canD) + canCD)
A,B = [for(i) for i in input().split()]
if A + B > 24:
  print(A + B -24)
else:
  print(A+B)

### FIXED CODE ###

A,B = [int(i) for i in input().split()]
if A + B >= 24:
  print(A + B -24)
else:
  print(A+B)
import numpy as np

N = int(input())
h = np.array([int(i) for i in input().split()])
flag = [0] * N

thrs = 0

i = 0
ans = 0
l, r = (0, 0)
while sum(flag) != N:
  j = 0
  while j < l:
    if h[j] == 0:
      flag[j] = 1
    j += 1
  
  if h[l] == 0:
    l += 1
    flag[l] = 1
  
  i = 0
  i += l
  r = i
  while h[i] > thrs:
    r += 1
    i += 1
    if i == N:
      break
  
  if l == r:
    continue
  ans += min(h[l:r])
  h[l:r] = h[l:r] - min(h[l:r])
print(ans)
  

### FIXED CODE ###

import numpy as np

N = int(input())
h = np.array([int(i) for i in input().split()])
flag = [0] * N

thrs = 0

if N == 1:
  print(h[0])
  exit()

i = 0
ans = 0
l, r = (0, 0)
while sum(flag) != N:
  j = 0
  while j < l:
    if h[j] == 0:
      flag[j] = 1
    j += 1
  
  if h[l] == 0:
    l += 1
    flag[l] = 1
  
  i = 0
  i += l
  r = i
  while h[i] > thrs:
    r += 1
    i += 1
    if i == N:
      break
  
  if l == r:
    continue
  ans += min(h[l:r])
  h[l:r] = h[l:r] - min(h[l:r])
print(ans)
from fractions import gcd


def lcm(x,y):
    return (x*y)//gcd(x,y)


n,m=map(int,input().split())
s,t=input(),input()
lcm=lcm(n,m)

if s[::(lcm/m)]!=t[::(lcm/n)]:
    print(-1);exit()

print(lcm)

### FIXED CODE ###

from fractions import gcd


def lcm(x,y):
    return (x*y)//gcd(x,y)


n,m=map(int,input().split())
s=input()
t=input()
lcm=lcm(n,m)
S=[(i,int(i*(lcm/n)+1)) for i in range(n)]
L=[(i,int(i*(lcm/m)+1)) for i in range(m)]
left,right=0,0
ans=[]
while left!=n and right!=m:
    if S[left][1]==L[right][1]:
        ans.append([S[left][0],L[right][0]])
        right +=1
        left +=1
    elif S[left][1]>L[right][1]:
        right +=1
    elif S[left][1]<L[right][1]:
        left +=1
for l,r in ans:
    if s[l]==t[r]:continue
    else:print(-1);exit()
print(lcm)
k=int(input())
a=[i for i in range(10)]

while True:
    #るんるん数の候補を、桁数ごとに積み上げます。まず１桁
    if k<=len(a):
        print(a[k-1])
        break
    """
    1桁に成果がなければ、kから１桁のlen(るんるん数リスト)を引いて、
    ２桁のリストを作ります。作り方は、元のるんるんリストのそれぞれの数を１０倍して、
    その１０の位と同じか隣接する値を加えたものをappend.
    以下同様
    """
    k-=len(a)
    old=[]
    old, a=a, old
    for x in old:
        for i in range(-1,2):
            d=x%10+d
            if d<0 or d>9:
                continue
            new_x=x*10+d
            a.append(new_x)

### FIXED CODE ###

k=int(input())
a=[i for i in range(1,10)]

while True:
    #るんるん数の候補を、桁数ごとに積み上げます。まず１桁
    if k<=len(a):
        print(a[k-1])
        break
    """
    1桁に成果がなければ、kから１桁のlen(るんるん数リスト)を引いて、
    ２桁のリストを作ります。作り方は、元のるんるんリストのそれぞれの数を１０倍して、
    その１０の位と同じか隣接する値を加えたものをappend.
    以下同様
    """
    k-=len(a)
    old=[]
    old, a=a, old
    for x in old:
        for i in range(-1,2):
            d=x%10+i
            if d<0 or d>9:
                continue
            new_x=x*10+d
            a.append(new_x)
#! -*- coding:utf-8 -*-
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)
 
def lcm(a, b):
    return a * b / gcd(a, b)

n = int(input())
k = []
for i in range(n):
    k.append(int(input()))

p = lcm(k[0],k[1])
for i in range(n):
    p = lcm(p,k[i])
print(int(p))


### FIXED CODE ###

#! -*- coding:utf-8 -*-
def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a
 
def lcm(a, b):
    return a * b // gcd(a, b)

n = int(input())
k = []
for i in range(n):
    k.append(int(input()))

if n == 1:
    print(k[0])
else:
    p = lcm(k[0],k[1])
    for i in range(n):
        p = lcm(p,k[i])
    print(int(p))
n = int(input)
l = list(map(int, input().split()))


### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
x = max(l)
s = sum(l)
if x < (s-x):
    print("Yes")
else:
    print("No")
n= int(input())
s= list(input())
t= list(input())

ans=""
for i in range(n):
    ans=ans+s[i]+t[i]

print(ans)

### FIXED CODE ###

n= int(input())
s, t = input().split()

ans=""
for i in range(n):
    ans=ans+s[i]+t[i]

print(ans)
s = set(list(input()))

if 'N' in s:
  if not 'S' in s:
    print("No")
    exit()
  elif s(len) == 2 or s(len)==4:
    print("Yes")
    exit()
    
if 'S' in s:
  if not 'N' in s:
    print("No")
    exit()
  elif s(len) == 2 or s(len)==4:
    print("Yes")
    exit()

if 'W' in s:
  if not 'E' in s:
    print("No")
    exit()
  elif s(len) == 2 or s(len)==4:
    print("Yes")
    exit()

if 'E' in s:
  if not 'W' in s:
    print("No")
    exit()
  elif s(len) == 2 or s(len)==4:
    print("Yes")
    exit()
print("No")

### FIXED CODE ###

s = set(list(input()))

if 'N' in s:
  if not 'S' in s:
    print("No")
    exit()
  elif len(s) == 2 or len(s)==4:
    print("Yes")
    exit()
    
if 'S' in s:
  if not 'N' in s:
    print("No")
    exit()
  elif len(s) == 2 or len(s)==4:
    print("Yes")
    exit()

if 'W' in s:
  if not 'E' in s:
    print("No")
    exit()
  elif len(s) == 2 or len(s)==4:
    print("Yes")
    exit()

if 'E' in s:
  if not 'W' in s:
    print("No")
    exit()
  elif len(s) == 2 or len(s)==4:
    print("Yes")
    exit()
    
print("No")
# -*- coding: utf-8 -*-


def solve(w, n):
    l = [i for i in range(1, w+1)]
    for _ in range(n):
        a, b = map(int, input().split(','))
        l[a], l[b] = l[b], l[a]

    print(*l, sep='\n')

if __name__ == '__main__':
    w = int(input())
    n = int(input())
    solve(w, n)

### FIXED CODE ###

# -*- coding: utf-8 -*-


def solve():
    w = int(input())
    n = int(input())
    l = [i for i in range(1, w+1)]

    for _ in range(n):
        a, b = map(int, input().split(','))
        a -= 1
        b -= 1
        l[a], l[b] = l[b], l[a]

    print(*l, sep='\n')

solve()
h, n = map(int, input().split())
A = []
B = []
for i in range(n):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)

inf=float('inf')
dp = [[inf] * (h + max(A)-1) for i in range(n + 1)]
dp[0][0]=0
for i in range(n):
    for j in range(h + max(A)-1):
        if j < A[i]:
            dp[i + 1][j] = dp[i][j]
        else:
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - A[i]] + B[i])
print(min(dp[n][h:]))

### FIXED CODE ###

h, n = map(int, input().split())
A = []
B = []
for i in range(n):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)
inf=float('inf')
dp = [[inf] * (h + 1) for i in range(n + 1)]
dp[0][0]=0
for i in range(n):
    for j in range(h + 1):
        if j < A[i]:
            dp[i + 1][j] = min(dp[i][j], B[i])
        else:
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - A[i]] + B[i])
print(dp[n][h])
s1 = raw_input()
s2 = raw_input()
s2 = s2.split(" ")
f = 0
for a,b in enumerate(s2):
    if s2[int(b)] == str(a):
        f++
print f

### FIXED CODE ###

s1 = input()
s2 = input()
s2 = s2.split(" ")
f = 0
for a,b in enumerate(s2):
    if str(s2[int(b)-1]) == str(a+1):
        f = f+1
print (int(f/2))