Harryxun/stf_run huggingface dataset:
N,T = map(int,input().split())
c = []
t = []
c1,t1 = [int(i) for i in input().split()]
for i in range(N):
  c.append(n1)
  t.append(t1)
ans = 10000
for i in range(N):
  if t[i] <= T:
    ans = min(ans,c[i])
if ans == 10000:
  print('TLE')
else:
  print(ans)

### FIXED CODE ###

N,T = map(int,input().split())
c = []
t = []
for i in range(N):
    c1,t1 = [int(i) for i in input().split()]
    c.append(c1)
    t.append(t1)
ans = 10000
for i in range(N):
  if t[i] <= T:
    ans = min(ans,c[i])
if ans == 10000:
  print('TLE')
else:
  print(ans)
def main():
    a,b = map(int, input().split())
  if (a*b) % 2== 1:
      print("Yes")
  else:
      print('No")



if __name__ == '__main__' :
    main()

### FIXED CODE ###

import sys

def odd_def(num):
    if num % 2 == 0:
        return False
    else:
        return True

def main():
    a,b = map(int, input().split())
    for c in range(1,4):
        mal = a*b*c
        if odd_def(mal):
            print('Yes')
            sys.exit()
    print('No')


if __name__ == '__main__' :
    main()
import sys
import numpy as np
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall, csgraph_to_dense
from scipy.sparse import issparse
sys.setrecursionlimit(10**7)

n, m, l = [int(i) for i in sys.stdin.readline().split()]
graph = [[0 for i in range(n)] for j in range(n)]
for i in range(m):
    a, b, c = [int(i) for i in sys.stdin.readline().split()]
    a -= 1
    b -= 1
    graph[a][b] = c
    graph[b][a] = c

res = floyd_warshall(csgraph_from_dense(graph))
if issparse(res):
    res = csgraph_from_dense(res)
res = np.where(res <= l, np.ones_like(res), np.zeros_like(res))
new_res = floyd_warshall(csgraph_from_dense(res))
new_res[new_res == np.inf] = 0
q = int(input())
for j in range(q):
    s, t = [int(i) for i in sys.stdin.readline().split()]
    s -= 1
    t -= 1
    dis = new_res[s, t]
    print(int(dis) - 1)

### FIXED CODE ###

import sys
import numpy as np
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall, csgraph_to_dense
from scipy.sparse import issparse
sys.setrecursionlimit(10**7)

n, m, l = [int(i) for i in sys.stdin.readline().split()]
graph = [[0 for i in range(n)] for j in range(n)]
for i in range(m):
    a, b, c = [int(i) for i in sys.stdin.readline().split()]
    a -= 1
    b -= 1
    graph[a][b] = c
    graph[b][a] = c

res = floyd_warshall(csgraph_from_dense(graph))
if issparse(res):
    res = csgraph_to_dense(res)
res = np.where(res <= l, 1, 0)
new_res = floyd_warshall(res)
new_res[new_res == np.inf] = 0
q = int(input())
for j in range(q):
    s, t = [int(i) for i in sys.stdin.readline().split()]
    s -= 1
    t -= 1
    dis = new_res[s, t]
    print(int(dis) - 1)
num = int(input())
arr = [list(map(int, input().split())) for i in range(num)]

ans = [[arr[0][0], arr[0][1]]
for i in range(num-1):
    ans.append([arr[i+1][0], arr[i+1][1]])
    while ans[i][0] > ans[i+1][0] or ans[i][1] > ans[i+1][1]:
        ans[i+1][0] += arr[i+1][0]
        ans[i+1][1] += arr[i+1][1]
print(ans[num-1][0] + ans[num-1][1])

### FIXED CODE ###

def divceil(a, b):
    if a%b == 0:
        return a//b
    else:
        return a//b + 1

num = int(input())
arr = [list(map(int, input().split())) for i in range(num)]
 
t = 1
a = 1
r = 0
for i in range(num):
    r = max(divceil(t, arr[i][0]), divceil(a, arr[i][1]))
    t = arr[i][0] * max(r, 1)
    a = arr[i][1] * max(r, 1)
print(t + a)
times = [int(input()) for _ in range(5)]
times1 = []
total = 0
for t in times:
  t1 = t % 10
  if t1 == 0:
    total += t
  else:
    times1.append(t1)
    total += (t//10 + 1) * 10
if len(times) >= 1:
    total = total + min(times1) - 10
print(total)

### FIXED CODE ###

times = [int(input()) for _ in range(5)]
times1 = []
total = 0
for t in times:
  t1 = t % 10
  if t1 == 0:
    total += t
  else:
    times1.append(t1)
    total += (t//10 + 1) * 10
if len(times1) >= 1:
    total = total + min(times1) - 10
print(total)
a=o
S=list(input())
T=list(input())
for i in range(len(S)): 
	if S[i]!=T[i]:	
		a=a+1
print(a)

### FIXED CODE ###

a=0
S=list(input())
T=list(input())
for i in range(len(S)): 
	if S[i]!=T[i]:	
		a=a+1
print(a)
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, k;
    cin >> n >> k ;
    int a[n];
    int m = 1, j = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        m*=a[i];
        if (i>=k){
            int n1 = m/a[i];
            m/=a[j]; j++;
            if (n1<m) cout << "Yes" << '\n';
            else cout<< "No" << '\n';
        }
    }

    return 0;
}

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    if i>=k:
      if a[i]>a[i-k]: print('Yes')
      else: print('No')
N = int(input())
L = sorted(list(map(int, input().split())))

if sum(L[:-1]) > L[:-1] :
	print('Yes')
else:
	print('No')

print(L)

### FIXED CODE ###

N = int(input())
L = sorted(list(map(int, input().split())))

if sum(L[:-1]) > L[-1] :
	print('Yes')
else:
	print('No')
n, m = (int(x) for x in input().split())
if int((n+m)/2)==n+m:
  print(Even)
else:
  print(Odd)

### FIXED CODE ###

n, m = (int(x) for x in input().split())
if int((n*m)/2)==(n*m)/2:
  print('Even')
else:
  print('Odd')
s=list(input())

s_odd=s[0::2]
s_even=s[1::2]

if s_odd.find(L)==-1 and s_even.find(R)==-1:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s=list(input())

s_odd=''.join(s[0::2]) #偶数項、奇数項に分類する
s_even=''.join(s[1::2])

if s_odd.find('L')==-1 and s_even.find('R')==-1:
    print('Yes')
else:
    print('No')
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
cnt=0
for _ in range(n):
  if v[i]-c[i]>0:
    cnt+=v[i]-c[i]
print(cnt)

### FIXED CODE ###

n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
cnt=0
for i in range(n):
  if v[i]-c[i]>0:
    cnt+=v[i]-c[i]
print(cnt)
n=int(input())
A=list(map(int,input().split()))

ans=[]
balls=[0]*n
for i in range(n-1,-1,-1):
  if A[i]!=0:
    total=0
    for j in range(n-1,i,A[i]):
      total+=A[j]
    if total%2!=A[i]:
      if totaL+1!=A[i]:
        print(-1)
        exit()
      balls[i]+=1
      ans.append(i+1)
print(sum(balls))
print(*ans,sep=' ')


### FIXED CODE ###

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

ans=set()
for i in range(n-1,-1,-1):
  for j in range(i+1,n+1,i+1):
    if j in ans:
      A[i]+=1
  if A[i]%2:
    ans.add(i+1)
print(len(ans))
print(*ans)
a,b=map(int,input().split());print("Y:a(y !"[a>8or8<b::2])

### FIXED CODE ###

a,b=map(int,input().split());print("Y:a(y !"[a>8 or 8<b::2])
N = int(input()) #5
K = int(input()) #3
X = int(input())
Y = int(input())

total = 0
for a in range(1, 6): #6 , 1, 2, 3, 4, 5
	if a <= K:
      total += X
    else:
      total += Y

print(total)


### FIXED CODE ###

N = int(input()) #5
K = int(input()) #3
X = int(input())
Y = int(input())

total = 0
for a in range(1, N+1): #6 , 1, 2, 3, 4, 5
    if a <= K:
        total += X
    else:
        total += Y

print(total)
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    H=list(map(int,input().split()))
    M=[0]*n
    M[1]=H[0]
    for i in range(2,n):
        M[i]=max(M[i-1],H[i-1])
    print(sum(1 for i in range(n) if H[i]>=M[i]))
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    if n==1:
        print(1)
        return
    H=list(map(int,input().split()))
    M=[0]*n
    M[1]=H[0]
    for i in range(2,n):
        M[i]=max(M[i-1],H[i-1])
    print(sum(1 for i in range(n) if H[i]>=M[i]))
resolve()
str=input()
arr=str.split('　')
A=int(arr[0])
B=int(arr[1])
if 1<=A<=100 and 1<=A<=100:
  print(A*B)

### FIXED CODE ###

str=input()
arr=str.split(' ')
A=int(arr[0])
B=int(arr[1])
if 1<=A<=100 and 1<=A<=100:
  print(A*B)
import sys
a = sys.argv[1]
p = sys.argv[2]
a1 = a*3
print ((a1+p)/2)

### FIXED CODE ###

from sys import stdin
arg = stdin.readline().rstrip().split()
a = int(arg[0])
p = int(arg[1])
a1 = a*3
print (int((a1+p)/2))
N = int(input())
D = [int(input()) for _ in range(N)]
 
l = [0]*100
for i in range(N):
  l[d[i]-1] = 1
  
print(sum(l))

### FIXED CODE ###

N = int(input())
d = [int(input()) for _ in range(N)]

d = list(set(d))
print(len(d))
N = int(input())
A = [int(input()) for i in range(N)]
A_count = [0] * max(A)

for i in A:
    A_count[i-1] += 1

ans = 0
for count in A_count:
    if count % 2 == 1:
        ans += 1

print(ans)

### FIXED CODE ###

N = int(input())
A = [int(input()) for i in range(N)]
sorted_A = sorted(A)

pre = sorted_A[0]
ans = 0
if len(sorted_A) == 1:
    print(1)
else:
    count = 1
    for i in range(1, len(sorted_A)):
        if sorted_A[i] == pre:
            count += 1
            if i == len(sorted_A)-1:
                if count % 2 == 1:
                    ans += 1
        else:
            if i == len(sorted_A)-1:
                ans += 1
            if count % 2 == 1:
                ans += 1
            pre = sorted_A[i]
            count = 1
    print(ans)
from statistics import median

N = int(input())
X = list(map(int, input().split(' ')))

def get_median(l):
    return median(l)

for i in range(N):
    target_l = X[:i] + X[i+1:]
    target_l = sorted(target_l)
    print(target_l[(N+1)/2])

### FIXED CODE ###

N = int(input())
X = list(map(int, input().split(' ')))

# N = 2
# X = [1, 2]

# N = 6
# X = [5, 5, 4, 4, 3, 3]

# target = int((N-1)/2)
first_m = int(N/2)
second_m = first_m - 1
X_ = sorted(X)
for i in range(N):
    if X[i] <= X_[second_m]: print(X_[first_m])
    else: print(X_[second_m])
n = input()
a = int(n[0])
b = int(n[1])
c = int(n[2])
d = int(n[3])

if a+b+c+d==7:
    print(f'{a}+{b}+{c}+{d}=7')
    exit()
if a+b+c-d==7:
    print(f'{a}+{b}+{c}-{d}=7')
    exit()
if a+b-c+d==7:
    print(f'{a}+{b}-{c}+{d}=7')
    exit()
if a-b+c+d==7:
    print(f'{a}-{b}+{c}+{d}=7')
    exit()
if a-b-c+d==7:
    print(f'{a}-{b}-{c}+{d}=7')
    exit()
if a-b+c-d==7:
    print(f'{a}-{b}+{c}-{d}=7')
    exit()
if a+b-c-d==7:
    print(f'{a}+{b}-{c}-{d}=7')
    exit()
if a-b-c-d==7:
    print(f'{a}-{b}-{c}-{d}=7')
    exit()

### FIXED CODE ###

n = input()
a = int(n[0])
b = int(n[1])
c = int(n[2])
d = int(n[3])

if a+b+c+d==7:
    print('{}+{}+{}+{}=7'.format(a, b, c, d))
elif a+b+c-d==7:
    print('{}+{}+{}-{}=7'.format(a, b, c, d))
elif a+b-c+d==7:
    print('{}+{}-{}+{}=7'.format(a, b, c, d))
elif a-b+c+d==7:
    print('{}-{}+{}+{}=7'.format(a, b, c, d))
elif a-b-c+d==7:
    print('{}-{}-{}+{}=7'.format(a, b, c, d))
elif a-b+c-d==7:
    print('{}-{}+{}-{}=7'.format(a, b, c, d))
elif a+b-c-d==7:
    print('{}+{}-{}-{}=7'.format(a, b, c, d))
elif a-b-c-d==7:
    print('{}-{}-{}-{}=7'.format(a, b, c, d))
if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
  
f len(set(A)) == len(A):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
if len(A) == len(set(A)):
    print('YES')
else:
    print('NO')
a, b, c = map(int, raw_input().split())

if a > b and b > c:
  return "yes"
else:
  return "no"

### FIXED CODE ###

a, b, c = map(int, raw_input().split())

if a < b and b < c:
  print 'Yes'
else:
  print 'No'
S = input()
if S = 'AAA' or S == 'BBB':
  print('No')
else:
  print('Yes')

### FIXED CODE ###

s = input()
if s.count('B') == 3 or s.count('A') == 3:
  print("No")
else:
  print("Yes")
r=input().split()
H=int(r[0])
N=int(r[1])
data=[int(s) for s in input().split()]
data.sort()
Data=data[::-1]
if Data[0]+Data[1]>=H:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

r=input().split()
H=int(r[0])
N=int(r[1])
data_pre=input().split()
data=[int(s) for s in data_pre]
if sum(data)>=H:
    print("Yes")
else:
    print("No")
n = int(input())
l = list(map(int,input().split()))
c = len([i for i in l if i%4==0])
l1 = [i for i in l if not (i%2==0 and i%4!=0)]
if len(l1)>=1:
  a = n-len(l1)+1
  a = a-c
  if a<=c-1:
    print("Yes")
  else:
    print("No")
else:
  if a<=c-1:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
c = len([i for i in l if i%4==0])
l1 = [i for i in l if  (i%2==0 and i%4!=0)]
if len(l1)>=1:
  a = n-len(l1)+1
  a = a-c
  if a<=c+1:
    print("Yes")
  else:
    print("No")
else:
  a = n-c
  if a<=c+1:
    print("Yes")
  else:
    print("No")
import time

def mod_2019(L, R):
  year = 2019
  if (R - L) >= year:
    return 0
 
  import numpy as np
  array = np.array([[i for i in range(L, R)]])
  if (array % year).min() == 0:
    return 0
  
  
  array_2d = np.dot(array.T, array)
  for i in range(len(array_2d[0])):
     array_2d[i][i] = year -1
  return (array_2d % year).min()
  

L, R = (int(i) for i in input().split())

print(mod_2019(L, R))

### FIXED CODE ###

N, A, B = (int(i) for i in input().split())
cost = N * A if N * A < B else B
print(cost)
import math
def lcm(a, b):
  return (a * b) // math.gcd(a, b)
input = list(map(int, input().split(' ')))
total_count = input[1] + 1 - input[0]
div_c = math.floor(input[1] / input[2]) - math.floor(input[0] / input[2])
if input[0] % input[2] == 0:
  div_c += 1
div_d = math.floor(input[1] / input[3]) - math.floor(input[0] / input[3])
if input[0] % input[3] == 0:
  div_d += 1
div_cd = math.floor(input[1] / lcm(input[2], input[3])) - math.floor(input[0] / lcm(input[2], input[3]))
if input[0] % lcm(input[2], input[3]) == 0:
  div_cd += 1
print(total_count - (div_c + div_d - div_cd))

### FIXED CODE ###

from fractions import gcd
def floor(a, b):
  # return int((a - a%b)/b)
  return a//b
# def gcd(a, b):
#   while a % b != 0:
#       a, b = b, a % b
#   return a
def lcm(a, b):
  return floor((a * b), gcd(a, b))
input = list(map(int, input().split(' ')))
total_count = input[1] + 1 - input[0]
div_c = floor(input[1], input[2]) - floor(input[0] -1, input[2])
div_d = floor(input[1], input[3]) - floor(input[0] -1, input[3])
div_cd = floor(input[1], lcm(input[2], input[3])) - floor(input[0] -1, lcm(input[2], input[3]))
print(total_count - (div_c + div_d - div_cd))
# 入力
H,W=map(int,input().split())

l=[]
for i in range(H):
    l.append(list(input()))

for i in range(H):
    for j in range(W):
    # 地雷数のカウンタ
        c=0

    # '#'の場合はなにもしない
    if l[i][j]=='#':
        pass

    # '#'以外の場合
    else:
      # 左上
        if 0<i and 0<j and l[i-1][j-1]=='#':
            c+=1
      # 上
        if 0<i and l[i-1][j]=='#':
            c+=1
      # 右上
        if 0<i and j<W-1 and l[i-1][j+1]=='#':
            c+=1
      # 左
        if 0<j and l[i][j-1]=='#':
            c+=1
      # 右
        if j<W-1 and l[i][j+1]=='#':
            c+=1
      # 左下
        if i<H-1 and 0<j and l[i+1][j-1]=='#':
            c+=1
      # 下
        if i<H-1 and l[i+1][j]=='#':
            c+=1
      # 右下
        if i<H-1 and j<W-1 and l[i+1][j+1]=='#':
            c+=1

      # 地雷隣接数を記載
      l[i][j]=str(c)

# 出力
for i in range(H):
    print(''.join(l[i]))

### FIXED CODE ###

# 入力
H,W=map(int,input().split())

l=[]
for i in range(H):
    l.append(list(input()))

for i in range(H):
    for j in range(W):
    # 地雷数のカウンタ
        c=0

    # '#'の場合はなにもしない
        if l[i][j]=='#':
            pass

    # '#'以外の場合
        else:
      # 左上
            if 0<i and 0<j and l[i-1][j-1]=='#':
                c+=1
      # 上
            if 0<i and l[i-1][j]=='#':
                c+=1
      # 右上
            if 0<i and j<W-1 and l[i-1][j+1]=='#':
                c+=1
      # 左
            if 0<j and l[i][j-1]=='#':
                c+=1
      # 右
            if j<W-1 and l[i][j+1]=='#':
                c+=1
      # 左下
            if i<H-1 and 0<j and l[i+1][j-1]=='#':
                c+=1
      # 下
            if i<H-1 and l[i+1][j]=='#':
                c+=1
      # 右下
            if i<H-1 and j<W-1 and l[i+1][j+1]=='#':
                c+=1

      # 地雷隣接数を記載
            l[i][j]=str(c)

# 出力
for i in range(H):
    print(''.join(l[i]))
N=int(input())
cnt=N-1
for i in range(1,N):
    if N%i==o:
        cnt=min(cnt,N//i+i-2)
print(cnt)

### FIXED CODE ###

N=int(input())
cnt=N-1
for i in range(1,int(N**0.5)+1):
    if N%i== 0:
        cnt=min(cnt,N//i+i-2)
print(cnt)
import math
n = int(input())
ans=[0]*n
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            a = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if n >= a >= 1:
                ans[a] += 1
print(*ans,sep="\n")

### FIXED CODE ###

n = int(input())
ans=[0]*(n+1)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            a = x * x + y * y + z * z + x * y + y * z + z * x
            if n >= a >= 1:
                ans[a] += 1
print(*ans[1:],sep="\n")
A,B=map(int,input().split())
if A%B=0:
  print(A+B)
else:
  print(B-A)

### FIXED CODE ###

A,B=map(int,input().split())
if B%A==0:
  print(A+B)
else:
  print(B-A)
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-1:
    t1,x1,y1 = T[i] 
    t2,x2,y2 = T[i+1]
    dis = abs(x2-x1)+abs(y2-y1)
    _t = t2-t1
    if dis > _t or (_t%2 != dis%2):
        flag = 'No'
    i += 1        
print(flag)
    

### FIXED CODE ###

N = int(input())
T = [[0,0,0]]+[ [int(x) for x in input().split()] for _ in range(N)]

flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-1:
    t1,x1,y1 = T[i] 
    t2,x2,y2 = T[i+1]
    dis = abs(x2-x1)+abs(y2-y1)
    _t = t2-t1
    if dis > _t or _t%2 != dis%2:
        flag = 'No'
    i += 1        
print(flag)
n,x=map(int,input().split())
L = list(map(int,input().split()))
count=0
D=0
for i in range(n+1):
    if D>x:
        print(count)
        break
    else:
        D=D+L[i]     
        count+=1

    

### FIXED CODE ###

n,x=map(int,input().split())
L = list(map(int,input().split()))
count=1
D=0
for i in L:
    D=D+i
    if D<=x:
        count+=1
    else:
        break
 
print(count)
def root(s):
  t=l[s]
  if t<0:
    return s
  return root(t)
def f(s):
  return root(int(s)-1)
n,m=map(int,input().split())
ans=n*(n-1)//2
l=[-1]*n
a=[1]*n
b=[input().split() for _ in range(m)]
c=[0]*m+[ans]
for i in range(m-1,-1,-1):
  x,y=map(f,b[i])
  if x!=y:
    l[x]=y
    ans-=a[x]*a[y]
    a[y]+=a[x]
  c[i]=ans
for x in c[1:]:
  print(x)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline
n,m=map(int,input().split())
z=n*(n-1)//2
l=[-1]*n
a=[1]*n
b=[input().split() for _ in range(m)]
c=[0]*m+[z]
def r(s):
  t=l[s]
  if t<0:
    return s
  else:
    l[s]=r(t)
    return l[s]
def f(s):
  return r(int(s)-1)
for i in range(m-1,-1,-1):
  x,y=map(f,b[i])
  if x!=y:
    l[x]=y
    z-=a[x]*a[y]
    a[y]+=a[x]
  c[i]=z
for x in c[1:]:
  print(x)
n = int(input())
a = list(map(int, input().split()))
ans = 1

if 0 in a: print('0')
else:
    for i in range(n):
        ans *= a[i]
        if ans > 10**18:
            print(-1)
        break
    print(ans)


### FIXED CODE ###

a, b = map(int, input().split())
print(a*b)
a,b = map(str,input().split())
H = 1
D = 0
print(a^b)

### FIXED CODE ###

a = set(map(str,input().split()))
if len(a) == 1:
  print("H")
else:
  print("D")
n=int(input())
list=[input() for i in range(n)]

a = []

for i in range(n):
    a.append(list.count(i))
    
print(len(set((a)))


### FIXED CODE ###

n=int(input())
list=[int(input()) for i in range(n)]
print(len(set(list)))
N=input()
Y=[111,222,333,444,555,666,777,888,999]
for i in range(9):
  if N<=Y[i]:
    print(Y[i])
    break

### FIXED CODE ###

N=int(input())
Y=[111,222,333,444,555,666,777,888,999]
for i in range(9):
  if N<=Y[i]:
    print(Y[i])
    break
#!/usr/bin/env python3 ## -*- python -*-

s = input()
q = int(input())

for i in range(q):
    d = input()
    if d[:1] == "1":
        if not s[:1] == s[-1:1]:
            s = s[::-1]
    else: # 2
        dd = d.split()
        f = int(dd[1])
        c = dd[2]
        if f == 1:
            s = c + s
        else: # f == 2
            s = s + c

print(s)

### FIXED CODE ###

#!/usr/bin/env python3 ## -*- python -*-

s = input()

if "AB" in s:
  print("Yes")
elif "BA" in s:
  print("Yes")
else:
  print("No")
N,M=map(int,input().split())
S=list(map(int,input().split()))
T=list(map(int,input().split()))
mod=1_000_000_007

dp=[[0 for j in range(M)] for i in range(N)]

for i in range(N):
	for j in range(M):
		if S[i]==T[j]:
			for k in range(i):
				for l in range(j):
					dp[i][j]+=dp[k][l]
			dp[i][j]+=1

ans=1
for i in range(N):
	for j in range(M):
		ans+=dp[i][j]
		ans%=mod

print(ans)

### FIXED CODE ###

N,M=map(int,input().split())
S=list(map(int,input().split()))
T=list(map(int,input().split()))
mod=1000000007

dp=[[0 for j in range(M+1)] for i in range(N+1)]
Sum=[[0 for j in range(M+1)] for i in range(N+1)]

for i in range(1,N+1):
	for j in range(1,M+1):
		if S[i-1]==T[j-1]:
			dp[i][j]=Sum[i-1][j-1]
#			for k in range(1,i):
#				for l in range(1,j):
#					dp[i][j]+=dp[k][l]
			dp[i][j]+=1
		Sum[i][j]=(Sum[i-1][j]+Sum[i][j-1]-Sum[i-1][j-1]+dp[i][j])%mod

print(Sum[N][M]+1)
A,B,C=input().split()
print(upper(A[0],B[0],C[0]),sep='')

### FIXED CODE ###

A,B,C=input().split()
print(''.join((A[0],B[0],C[0])).upper())
import sys
input = sys.stdin.readline
import numpy as np
N, W = map(int, input().split())
dp = np.zeros(W+1, dtype=np.int)
for n in range(1,N+1):
  wn, vn = map(int, input().split())
  dp[wn:]=np.maximum(dp[wn:], dp[:-wn]+vn)
print(dp[W])

### FIXED CODE ###

import sys
input = sys.stdin.readline
import numpy as np
N,W=map(int,input().split())
dp=np.ones(10**5+1, dtype='int64')
dp[0]=0
dp[1:]=dp[1:]*(10**9+1)
for i in range(N):
  wi,vi=map(int,input().split())
  dp[vi:]=np.minimum(dp[vi:],dp[:-vi]+wi)
print(np.max(np.where(dp <= W)))
n = int(input())
a = list(map(int, input().split()))
ans = 'YES'
for i in range(n):
    for j in range(j, n-i):
        if a[i] == a[j]:
            ans = 'NO'
            break

print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 'YES'
for i in range(n-1):
    if a[i] == a[i+1]:
        ans = 'NO'
        break

print(ans)
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import operator

N,H,W = map(int,readline().split())
RCA = [tuple(int(x) for x in line.split()) for line in readlines()]
RCA.sort(key = operator.itemgetter(2), reverse=True)

root = list(range(H+W))
size = [0] * (H+W)
no_cycle = [True] * (H+W)

def find_root(x):
    y = root[x]
    if x == y:
        return y
    z = find_root(y)
    root[x] = z
    return z

def merge(x,y):
    x,y = find_root(x),find_root(y)
    sx,sy = size[x],size[y]
    if sx < sy:
        sx,sy = sy,sx
        x,y = y,x
    root[y] = x
    no_cycle[x] = no_cycle[x] and no_cycle[y]

answer = 0
for R,C,A in RCA:
    x,y = R-1,H+C-1
    rx,ry = find_root(x),find_root(y)
    if rx == ry:
        if not no_cycle[rx]:
            continue
        no_cycle[rx] = False
    else:
        if (not no_cycle[rx]) and (not no_cycle[ry]):
            continue
        merge(rx,ry)
    answer += A

print(answer)

### FIXED CODE ###

import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

N,H,W = map(int,readline().split())
RCA = [tuple(int(x) for x in line.split()) for line in readlines()]

RCA.sort(key = lambda x: -x[2])

RCA

root = list(range(H+W))
size = [0] * (H+W)
no_cycle = [True] * (H+W)

def find_root(x):
    y = root[x]
    if x == y:
        return y
    z = find_root(y)
    root[x] = z
    return z

def merge(x,y):
    x,y = find_root(x),find_root(y)
    sx,sy = size[x],size[y]
    if sx < sy:
        sx,sy = sy,sx
        x,y = y,x
    root[y] = x
    no_cycle[x] = no_cycle[x] and no_cycle[y]

answer = 0
for R,C,A in RCA:
    x,y = R-1,H+C-1
    rx,ry = find_root(x),find_root(y)
    if rx == ry:
        if not no_cycle[rx]:
            continue
        no_cycle[rx] = False
    else:
        if (not no_cycle[rx]) and (not no_cycle[ry]):
            continue
        merge(rx,ry)
    answer += A

print(answer)