Harryxun/stf_run huggingface dataset:
import math

from fractions import Fraction as frac

MOD = 1e9 + 7

def gcd(a, b):

    if b == 0:

        return a

    return gcd(b, a % b)

def lcm(a, b):

    return a * b // gcd(a, b)

def solve(case_no):

    n = int(input())

    cnt=0

    for i in range(n):

    	a,b = map(int,input().split())    	if a==b:

        cnt += 1

        if cnt == 3:

    		print("Yes")

    		exit()

    	else:

    		cnt=0

    print("No")

t = 1

# t = int(input())

for i in range(1, t + 1):

    solve(i)

### FIXED CODE ###

import math
from fractions import Fraction as frac

MOD = 1e9 + 7

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

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

def solve(case_no):
    n = int(input())
    cnt=0
    for i in range(n):
    	a,b = map(int,input().split())
    	if a==b:
    		cnt += 1
    		if cnt == 3:
    			print("Yes")
    			exit()
    	else:
    		cnt=0
    print("No")
    	

t = 1
# t = int(input())
for i in range(1, t + 1):
    solve(i)
import bisect

N, K = input().split()
dList = [int(x) for x in input().split()]
useList = [0,1,2,3,4,5,6,7,8,9]
for d in dList:
    useList.remove(d)
result = ''
if int(N[0]) > max(useList):
    # 桁上げが必要
    if useList[0] != 0:
        result += str(useList[0])
    else:
        result += str(useList[1])
    result += str(useList[0])*(len(N)-1)
else:
    for i in range(len(N)):
        a = int(N[i])
        if a in useList:
            result += N[i]
            continue
        else:
            result += str(useList[bisect.bisect_right(useList, a)])
            result += str(useList[0])*(len(N)-i-1)
            break
print(result)

### FIXED CODE ###

import bisect

N, K = input().split()
dList = [int(x) for x in input().split()]
useList = [0,1,2,3,4,5,6,7,8,9]
for d in dList:
    useList.remove(d)
result = ''
if int(N[0]) > max(useList):
    # 桁上げが必要
    if useList[0] != 0:
        result += str(useList[0])
    else:
        result += str(useList[1])
    result += str(useList[0])*(len(N))
else:
    for i in range(len(N)):
        a = int(N[i])
        if a in useList:
            result += N[i]
            continue
        else:
            count = 0
            if a > max(useList):
                while not max(useList) > int(result[-1]):
                    count += 1
                    result = result[:-1]
                    if result == '':
                        break
                if result == '':
                    if useList[0] != 0:
                        result += str(useList[0])
                    else:
                        result += str(useList[1])
                    result += str(useList[0])*(len(N))
                    break
                count += 1
                sect = int(result[-1])
                result = result[:-1]
                result += str(useList[bisect.bisect_right(useList, sect)])
                result += str(useList[0])*(len(N)-len(result))
            else:
                result += str(useList[bisect.bisect_right(useList, a)])
                result += str(useList[0])*(len(N)-i-1)
            break
print(result)
import sys
from collections import namedtuple

import numpy as np

length = int(sys.stdin.readline())

values = np.array([int(i) for i in sys.stdin.readline().split()], dtype=np.int32)
values = np.sort(values)[::-1]

next_ptr = np.zeros(shape=values.shape, dtype=np.int32)-1
next_ptr[0] = 0

total_score = 0
for index in range(1, len(values)):
  #print('----------')
  #print("ADDING {}".format(values[index]))
  best_index = 0
  best_score = 0
  i = np.where(next_ptr>=0)[0]
  next_i = next_ptr[i]
  values_i = values[i]
  next_values_i = values[next_i]
  scores = np.min([values_i, next_values_i], axis=0)
  best_index = np.argmax(scores)
  #print("CHOOSE: {}({})-{}({})-{}({}): {}".format(
  #  values[best_index], 
  #  best_index,
  #  values[index],
  #  index,
  #  values[next_ptr[best_index]], 
  #  next_ptr[best_index],
  #  best_score))
  
  total_score += scores[best_index]
  
  next_ptr[index] = next_ptr[best_index]
  next_ptr[best_index] = index
  
  #print('----- TEST -----')
  #index = 0
  #while True:
  #  print(values[index])
  #  index = next_ptr[index]
  #  if index == 0:
  #    break

#print("ANSWER")
print(total_score)

### FIXED CODE ###

import sys
import math

price = int(sys.stdin.readline().strip())

if price % 1000 == 0:
  print(0)
else:
	print(1000 * (price // 1000 + 1) - price)
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)

MOD = 10 ** 9 + 7


def main():
    N = int(input())
    A = list(map(int, input().split()))
    RGB = [1, 0, 0]
    ans = 1
    for i in range(1, N):
        a = A[i]
        if a == 0:
            j = RGB.index(a)
            RGB[j] += 1

        elif a in RGB:
            print(0)
            return
        else:
            k = RGB.count(a)
            ans *= k
            ans %= MOD
            j = RGB.index(a)
            RGB[j] += 1
    z = RGB.count(0)
    if z == 0:
        ans *= 6
        ans %= MOD
    elif z == 1:
        ans *= 6
        ans %= MOD
    else:
        ans *= 3
        ans %= MOD
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)

MOD = 10 ** 9 + 7


def main():
    N = int(input())
    A = list(map(int, input().split()))
    RGB = [1, 0, 0]
    ans = 1
    if A[0] !=0:
        print(0)
        return
    for i in range(1, N):
        a = A[i]
        if a == 0:
            if 0 in RGB:
                j = RGB.index(a)
                RGB[j] += 1
            else:
                print(0)
                return
        elif a not in RGB:
            print(0)
            return
        else:
            k = RGB.count(a)
            ans *= k
            ans %= MOD
            j = RGB.index(a)
            RGB[j] += 1
    z = RGB.count(0)
    if z == 0:
        ans *= 6
        ans %= MOD
    elif z == 1:
        ans *= 6
        ans %= MOD
    else:
        ans *= 3
        ans %= MOD
    print(ans)


if __name__ == "__main__":
    main()
N = int(input())
l_list = [2,1]
for i in range(2,N+1):
    a = l_list[i-1] + l_list[i-2]
    l_list.append(a)
print(l_list[i])




### FIXED CODE ###

N = int(input())
l_list = [2,1]
for i in range(2,N+1):
    a = l_list[i-1] + l_list[i-2]
    l_list.append(a)
print(l_list[N])
A,B = int(input().split())

if A > B and B != 1:
	print("Alice")
elif A == B:
	print("Draw")
elif B > A and A != 1:
	print("Bob")

### FIXED CODE ###

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

if A > B and B != 1:
	print("Alice")
elif A > B and B == 1:
	print("Bob")

if B > A and A != 1:
	print("Bob")
elif B > A and A == 1:
	print("Alice")

if A == B:
	print("Draw")
def main():
    from functools import reduce
    from math import gcd

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

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

    p = -1
    b = []
    for x in a:
        cnt = 0
        while x % 2 == 0:
            x //= 2
            cnt += 1
        if ~p and p != cnt:
            print(0)
            return
        p = cnt
        b.append(x)

    if p == 0:
        print(0)
        return

    t = pow(2, p - 1) * reduce(lcm, b)
    ans = (M // t) - (M // (t * 2))

    print(ans)


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())


### FIXED CODE ###

# https://atcoder.jp/contests/abc150/submissions/9395610

def main():
    from functools import reduce

    def count_two(x):
        ret = 0
        while x % 2 == 0:
            x //= 2
            ret += 1
        return ret

    def lcm(a, b):
        def _gcd(a, b):
            return a if b == 0 else _gcd(b, a % b)

        return a * b // _gcd(a, b)

    n, m = map(int, input().split())
    *a, = map(int, input().split())

    a = [x >> 1 for x in a]

    e = len(set(map(count_two, a)))
    if e != 1:
        print(0)
        return

    # x=(ai/2)*(2p+1)と変形する
    # 2p+1は奇数だから、
    # すべてのiについて,xと(ai/2)は,2で割れる回数が等しい必要がある

    x = reduce(lcm, a)
    ret = (m // x) - (m // (x + x))
    print(ret)
    # xは(ai/2)の最小公倍数の奇数倍
    # (ai/2)の最小公倍数の倍数全体から
    # (ai/2)の最小公倍数の偶数倍を引いた残り


if __name__ == '__main__':
    main()
n, m = map(int, input().split())
a = list(map(int, input().split()))

all_sum = sum(a)
standard = all_sum//(4*M)
ans = 0

for i in a:
  if i >= standard:
    ans += 1

if and >= m:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

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

all_sum = sum(a)
standard = all_sum/(4*m)
ans = 0

for i in a:
  if i >= standard:
    ans += 1

if ans >= m:
  print('Yes')
else:
  print('No')
n = int(input())
a = set(map, input().split())
ans = len(a) if len(a)%2 == n%2 else len(a)-1
print(ans)

### FIXED CODE ###

n = int(input())
a = set(map(int,input().split()))
ans = len(a) if len(a)%2 == n%2 else len(a)-1
print(ans)
import bisect
M = 1000000007

# def dfs(i):
#     if i >= n - 1:
#         return 1
#     if dp[i] is not None:
#         return dp[i]
#     if i <= maxv and a[bisect.bisect_left(a, i)] == i:
#         dp[i] = 0
#         return 0
#     r = (dfs(i + 1) + dfs(i + 2)) % M
#     dp[i] = r
#     return r

n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
a.sort()
maxv = max(a)
# dp = [None] * n
# print(dfs(0) % M)

dp = [1] * (n + 2)
for i in range(n - 2, -1, -1):
    if i <= maxv and a[bisect.bisect_left(a, i)] == i:
        dp[i] = 0
    else:
        dp[i] = (dp[i + 1] + dp[i + 2]) % M

print(dp[0] % M)


### FIXED CODE ###

import bisect
M = 1000000007

# def dfs(i):
#     if i >= n - 1:
#         return 1
#     if dp[i] is not None:
#         return dp[i]
#     if i <= maxv and a[bisect.bisect_left(a, i)] == i:
#         dp[i] = 0
#         return 0
#     r = (dfs(i + 1) + dfs(i + 2)) % M
#     dp[i] = r
#     return r

n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
a.sort()
maxv = m and max(a) or -1
# dp = [None] * n
# print(dfs(0) % M)

dp = [1] * (n + 2)
dp[-1] = 0
for i in range(n - 1, -1, -1):
    if i <= maxv and a[bisect.bisect_left(a, i)] == i:
        dp[i] = 0
    else:
        dp[i] = (dp[i + 1] + dp[i + 2]) % M

print(dp[0] % M)
import sys
import deepcopy from copy
readline=sys.stdin.readline
read=sys.stdin.read

def main():
    n=int(readline())
    a=[list(map(int,lst)) for lst in read().splitlines()]
    cost=deepcopy(a)
    for k in range(n):
        for i in range(n):
            for j in range(n):
                cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j])
    s=0
    for i in range(i):
        for j in range(i+1,n)
        if cost[i][j]<a[i][j]:
            print(-1)
            return None
        detour=min([cost[i][k]+cost[k][j] for k in range(n) if k!=i and k!=i])
        if detour>cost[i][j]:
            s+=a[i][j]
    print(s)

if __name__=='__main__':
    main()


### FIXED CODE ###

import sys
from copy import deepcopy
import numpy as np
readline=sys.stdin.readline
read=sys.stdin.read

def main():
    n=int(readline())
    a=np.array([list(map(int,l.split())) for l in read().splitlines()])
    cost=deepcopy(a)
    for k in range(n):
        arr=np.stack([cost,[cost[k]]+np.transpose([cost[k]])])
        cost=np.amin(arr,axis=0)
    cost2=deepcopy(a)
    f=np.sum(cost<a)
    if f:
        print(-1)
        return
    filt=np.sum([([cost[k]]+np.transpose([cost[k]]))==cost for k in range(n)],axis=0)==2
    print(np.sum(a[filt])//2)

if __name__=='__main__':
    main()
N,M = map(int,input().split)
A = list(map(int,input().split))

R = [A[0]%M]

for i in range(1,N):
  R.append((R[-1]+A[i])%M)
  
  
k = set(R)
dic = {i:0 for i in k}
for item in R:
  dic[item]+=1


#print(dic)
ans = dic[0]*(dic[0]+1)/2
for i in k:
  if i !=0 :
    ans += dic[i]*(dic[i]-1)/2

  
print(int(ans))

### FIXED CODE ###

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

R = [A[0]%M]


for i in range(1,N):
  R.append((R[-1]+A[i])%M)



import collections
c = collections.Counter(R)


ans = 0
for key in c:
  if key == 0:
    ans += (c[key]*(c[key]+1))/2
  else:
    ans += (c[key]*(c[key]-1))/2
  



print(int(ans))
N,M = map(int,input())
K = []
S = []
for i in range(M):
    list = input().split()
    K.append(int(list[0]))
    S.append(map(int,list[1::]))
p = list(map(int,input().split()))
anss = 0
for i in range(2**n):
    for j in range(M):
        ans = 0
        for k in range(N):
            if i >> k & 1 and k in K[j]:
                ans += 1
        if ans % 2 != p[j]:
            break
        else:
            anss += 1
print(ans) 


### FIXED CODE ###

N,M=map(int,input().split())
ls=[]
cnt,cnt2,ans=0,0,0
for i in range(M):
    ls1=list(map(int,input().split()))
    ls.append(list(ls1))
    ls1.clear()
lsp = list(map(int,input().split()))
#print(ls)
#print(lsp)
for i in range(2**N):
    flg = True
    for j in range(M):
        cnt = 0
        for k in range(1,len(ls[j])):
            if i >> ls[j][k]-1 & 1:
                cnt += 1
        if cnt%2 != lsp[j]:
            flg = False
    if flg:
        ans += 1
print(ans)
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==2:
        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
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)
if __name__ == "__main__":
	N = int(input())
	List = list(map(int,input().split()))
	ido = 0
	ido_res = []
	i=0
	# print(List)
	for t in range(0,N-1):
		# print("t={}".format(t))
		while List[t+i] >= List[t+i+1]:
			# print(t,i,ido)
			ido += 1
			i += 1
			if t+i+1 > int(N)-1:
				break

		if ido==0:
			ido_res.append(0)
		else:
			ido_res.append(ido)
		ido = 0
		i=0

	print(max(ido_res))

### FIXED CODE ###

def main():
	# n,k = map(int,input().split())
	n = int(input())
	# s = str(input())
	h = list(map(int,input().split()))
	# l = [list(map(int, input().split())) for _ in range(n)]
	# s = list(s)
	ans = 0
	dp = [0] * n
	if n == 1:
		print(0)
	elif n == 2:
		if h[0] >= h[1]:
			print(1)
		else:
			print(0)
	else:
		if h[0] >= h[1]:
			dp[0] = 1
		for i in range(1,n-1):
			if h[i] >= h[i+1]:
				dp[i] = dp[i-1] + 1
			else:
				dp[i] = 0
		print(max(dp))

	





if __name__ == '__main__':
	main()
n, k, c = map(int, input().split())
s = input()

l, r = [], []
cur = 0
count = 0

while cur <= n:
    if s[cur] == "o":
        count += 1
        l.append((count, cur+1))
        cur += c

    cur += 1

cur = n
count = k

while cur >= 0:
    if s[cur] == "o":
        r.append((count, cur+1))
        count -= 1
        cur -= c

    cur -= 1

ans = (i[1] for i in set(l) & set(r))
for i in sorted(ans):
    print(i)

### FIXED CODE ###

from sys import stdin
def main():
    input = stdin.readline
    n, k, c = map(int, input().split())
    s = input()

    l, r = [], []
    cur = 0
    count = 0

    while cur <= n:
        if s[cur] == "o":
            count += 1
            l.append((count, cur+1))
            cur += c

        cur += 1

    cur = n
    count = k

    while cur >= 0:
        if s[cur] == "o":
            r.append((count, cur+1))
            count -= 1
            cur -= c

        cur -= 1

    ans = (i[1] for i in set(l) & set(r))
    for i in sorted(ans):
        print(i)


if __name__ == '__main__':
    main()
from collections import deque

H,W=map(int,input().split())
Sx,Sy=map(int,input().split())
Gx,Gy=map(int,input().split())
Sx-=1
Sy-=1
Gx-=1
Gy-=1
tmp=False

M=[[0 if j=='.' else 1 for j in input()]for i in range(H)]

# 0通路 1壁 2確認済み

ans=0
check.append([Sx,Sy])
while True:
    hit=set()
    while check:
        x,y = check.pop()
        #goul
        if x==Gx and y==Gy:
            tmp=True
            break
        M[x][y]=2
        #壁があるか
        for dx,dy in [ [x+1,y],[x-1,y],[x,y-1],[x,y+1] ]:
            if not(0<=dx and dx<H and 0<=dy and dy<W):
                continue
            if M[dx][dy]==1:
                hit.add((x,y))
            if M[dx][dy]==0:
                check.append([dx,dy])
    if tmp:
        print(ans)
        break
    if len(hit)==0:
        print(-1)
        break
    for e in hit:
        x,y=e
        for i in range(-2,3):
            for j in range(-2,3):
                if 0<=x+i and x+i<H and 0<=y+j and y+j<W and M[x+i][y+j]==0:
                    check.append([x+i,y+j])
    if len(check)==0:
        print(-1)
        break

    ans+=1

### FIXED CODE ###

from collections import deque

H,W=map(int,input().split())
Sx,Sy=map(int,input().split())
Gx,Gy=map(int,input().split())
Sx-=1
Sy-=1
Gx-=1
Gy-=1
tmp=False
check=deque()

M=[[0 if j=='.' else 1 for j in input()]for i in range(H)]

# 0通路 1壁 2確認済み

ans=0
check.append([Sx,Sy])
while True:
    hit=set()
    while check:
        x,y = check.pop()
        #goul
        if x==Gx and y==Gy:
            tmp=True
            break
        M[x][y]=2
        #壁があるか
        for dx,dy in [ [x+1,y],[x-1,y],[x,y-1],[x,y+1] ]:
            if not(0<=dx and dx<H and 0<=dy and dy<W):
                continue
            if M[dx][dy]==1:
                hit.add((x,y))
            if M[dx][dy]==0:
                check.append([dx,dy])
    if tmp:
        print(ans)
        break
    if len(hit)==0:
        print(-1)
        break
    for e in hit:
        x,y=e
        for i in range(-2,3):
            for j in range(-2,3):
                if 0<=x+i and x+i<H and 0<=y+j and y+j<W and M[x+i][y+j]==0:
                    check.append([x+i,y+j])
    if len(check)==0:
        print(-1)
        break

    ans+=1
S = list(input())
S = sorted(S)

if S[0] == S[1] and S[2] == S[3] and if S[1] != S[3]:
    print('Yes')
else:
    print('No')





### FIXED CODE ###

S = list(input())
S = sorted(S)

if S[0] == S[1] and S[2] == S[3] and S[1] != S[3]:
    print('Yes')
else:
    print('No')
import collections
def main():

    X, Y, A, B, C = map(int, input().split())
    p = list(map(int, input().split()))
    q = list(map(int, input().split()))
    r = list(map(int, input().split()))
    p.sort(reverse = True)
    q.sort(reverse = True)
    r.sort(reverse = True)
    countA = 0
    countB = 0
    ans = 0
    i = 0
    for j in range(X):
        if j < C:
            if p[j] > r[i]:
                countA += 1
                ans += p[j]
            else:
                ans += r[i]
                i += 1
        else:
            ans += p[j]
            countA += 1
    for j in range(Y):
        if j < B:
            if q[j] > r[i]:
                countB += 1
                ans += q[j]
            else:
                ans += r[i]
                i += 1
        else:
            ans += q[j]
            countB += 1
    return ans


if __name__ == '__main__':
    # main()
    print(main())

### FIXED CODE ###

import collections
def main():

    X, Y, A, B, C = map(int, input().split())
    p = list(map(int, input().split()))
    q = list(map(int, input().split()))
    r = list(map(int, input().split()))
    p.sort(reverse = True)
    q.sort(reverse = True)
    r.sort(reverse = True)

    p = p[:X]
    q = q[:Y]
    pqr = p + q + r
    pqr.sort(reverse = True)
    return sum(pqr[:X+Y])




if __name__ == '__main__':
    # main()
    print(main())
# your code goes here
def gcd(a, b):
	if(a > b):
		a -= b
		return gcd(a, b)
	elif(a < b):
		b -= a
		return gcd(a, b)
	else:
		return int(a)

import numpy as np

n, x = map(int, input().split())
buf = input().split()
xx = np.zeros(n+1)
for i in range(n):
	xx[i] = int(buf[i])
xx[-1] = x
xx.sort()
for i in range(n):
	xx[n-i] -= xx[n-1-i]
	
if(xx.shape[0] == 2):
	r = xx[1]
else:
	r = gcd(xx[1], xx[2])
	for i in range(n-2):
		r = gcd(r, xx[i+3])
print(r)
	
#print(xx)	

### FIXED CODE ###

def gcd(a, b):
	if(a < b):
		a, b = b, a
	if(b == 0):
		return a
	else:
		return gcd(b, a % b)

import numpy as np
n, x = map(int, input().split())
a = np.abs(np.array(list(map(int, input().split())))-x)

if(a.shape[0] == 1):
	r = a[0]
else:
	r = gcd(a[0], a[1])
	for i in range(n-2):
		r = gcd(r, a[i+2])
print(r)
S = list(input())
i = 0
cnt = 0

while True:
    if len(S) < 2:
        break
    if S[i] != S[i+1]:
        cnt += 2
        S.pop(i)
        S.pop(i)
        if i > 0:
            i -= 1
    else:
        i += 1
print(cnt)

### FIXED CODE ###

import sys

S = list(input())
i = 0
cnt = 0

if len(S) == 1:
    print(0)
    sys.exit()

while True:
    if i == len(S) - 2:
        if S[i] != S[i+1]:
            cnt += 2
        break
    if S[i] != S[i+1]:
        cnt += 2
        S.pop(i)
        S.pop(i)
        if i > 0:
            i -= 1
    else:
        i += 1
print(cnt)
a, b = int(input().sprit(" "))

if a > b
    print("{} > {}".format(a, b))
elif a < b
    print("{} < {}".format(a, b))
   

### FIXED CODE ###

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

if a > b:
  print("a > b")
elif a < b:
  print("a < b")
elif a == b:
  print("a == b")
n = int(input())
p = list(map(int, input().split()))

import numpy
p = np.array(p)
cnt = 0
for i in range(1, n-1):
    pi = np.array(p[i-1:i+2])
    #print(pi)
    if np.argsort(pi)[1] == 1:
        cnt += 1
print(cnt)

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
import numpy as np
p = np.array(p)
cnt = 0
for i in range(1, n-1):
    pi = np.array(p[i-1:i+2])
    #print(pi)
    if np.argsort(pi)[1] == 1:
        cnt += 1
print(cnt)
a=input()
a[3]="8"
print(a)


### FIXED CODE ###

a=input()
print("2018"+a[4:])
import sys
import math
input = sys.stdin.readline

N = int(input())
a = int(math.sqrt(N))

A = 0
B = 0
for i in reversed(range(1, a + 1)):
  if not N % i:
    A = i
    B = N // A
    break

print(max(len(str(A)), len(str(B)))

### FIXED CODE ###

import sys
import math
input = sys.stdin.readline
 
N = int(input())
a = int(math.sqrt(N))
 
A = 0
B = 0
for i in reversed(range(1, a + 1)):
  if not N % i:
    A = i
    B = N // A
    break
 
print(max(len(str(A)), len(str(B))))
import math
H, A = int(input()).split()
print(math.ceil(H/A))

### FIXED CODE ###

import math

H,A = map(int, input().split())
print(math.ceil(H/A))
import numpy as np
n, w = map(int, input().split())
dp = np.zeros(w+1)

for i in range(1,n+1): #n個の荷物をそれぞれ持つか否か
  wn, vn = map(int, input().split())
  dp[wn:] = np.maximum(dp[wn:], dp[:-wn]+vn)#wnより小さい=>持てない=>価値変わらない
print(int(dp[-1]))

### FIXED CODE ###

import numpy as np
n, w = map(int, input().split())
v_max = 1000
num_v = v_max*n
INF = 10**9+1
dp = np.full(num_v+1, INF, dtype=int)
dp[0] = 0
for i in range(1,n+1):
  wn, vn = map(int, input().split())
  dp[vn:] = np.minimum(dp[vn:], dp[:-vn]+wn)
for i in range(len(dp)-1, -1, -1):
  if dp[i] <= w:
    print(i)
    break