Problem:


Score : 200 points

Problem Statement

Kurohashi has never participated in AtCoder Beginner Contest (ABC).

The next ABC to be held is ABC N (the N-th ABC ever held).
Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same.

What is the earliest ABC where Kurohashi can make his debut?

Constraints

100 \leq N \leq 999

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

If the earliest ABC where Kurohashi can make his debut is ABC n, print n.

Sample Input 1

111

Sample Output 1

111

The next ABC to be held is ABC 111, where Kurohashi can make his debut.

Sample Input 2

112

Sample Output 2

222

The next ABC to be held is ABC 112, which means Kurohashi can no longer participate in ABC 111.
Among the ABCs where Kurohashi can make his debut, the earliest one is ABC 222.

Sample Input 3

750

Sample Output 3

777



Sample input:
111


Sample output:
111

Submission status: Accepted

Solution code:
n=int(input())

if n <=111:
    print('111')
elif n<=222:
    print('222')
elif n<=333:
    print('333')
elif n<=444:
    print('444')
elif n<=555:
    print('555')
elif n<=666:
    print('666')
elif n<=777:
    print('777')
elif n<=888:
    print('888')
elif n<=999:
    print('999')

Submission status: Accepted

Solution code:
n = int(input())
if n % 111 == 0:
    x = n
else:
    x = ((n // 111) + 1) * 111
print(x)

Submission status: Accepted

Solution code:
n = int(input())
if n % 111 == 0:
    print(n)
else:
    out = (n // 111 + 1) * 111
    print(out)

Submission status: Accepted

Solution code:
n = int(input())

canditates = [111, 222, 333, 444, 555, 666, 777, 888, 999]
for i in range(len(canditates) - 1):
    if n < 111:
        print(111)
        exit()
    elif canditates[i] == n:
        print(n)
        exit()
    elif canditates[i] < n <= canditates[i + 1]:
        print(canditates[i + 1])
        exit()

Submission status: Accepted

Solution code:
n = int(input())

if n % 111 == 0:
	print(n)
else:
	q = n // 111
	answer = (q+1)*111
	print(answer)

Submission status: Accepted

Solution code:
N = int(input())
print(-N%111 + N)

Submission status: Accepted

Solution code:
N = int(input())

i = 0

while N > 0:
    N -= 111
    i += 1

print(111*i)

Submission status: Accepted

Solution code:
import sys
import math
 
N = sys.stdin.readline().strip()
N = int(N)
 
M = math.ceil(N / 111.0)
M = int(M * 111)

print(M)

Submission status: Accepted

Solution code:
inp = int(input())
ret = 0
for i in range(1, 10):
    ret = i*111
    if ret >= inp:
        break
print(ret)

Submission status: Accepted

Solution code:
N = int(input())
for n in range(N, N + 1000):
    if len(set(list(str(n)))) == 1:
        print(n)
        exit()

Submission status: Accepted

Solution code:
N = int(input())
boolean = False
while True:
  isAccept =True
  N_str = list(map(int, str(N)))
  first = N_str.pop()
  for n in N_str:
    if n != first:
      N += 1
      isAccept = False
      break
  if isAccept:
    break
print(N)

Submission status: Accepted

Solution code:
# coding:utf-8

# 要素数取得
a = int(raw_input())
#print a
a0 = a
a1 = a/100 #100の位
a = a%100
a2 = a/10  #10の位
a = a%10
a3 = a     #1の位

if a1*111 >= a0:
    print a1*111
else:
    print (a1+1)*111

Submission status: Accepted

Solution code:
N = int(input())
for i in range(1, 10):
    if N <= (i * 111):
        print(i * 111)
        break

Submission status: Accepted

Solution code:
N = int(input())
ans = 0

for i in range(10):
    if N > i * 111:
        ans = (i + 1) * 111
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

for i in range(n, 1000):
    if i % 111 == 0:
        print(i)
        break

Submission status: Accepted

Solution code:
n = int(input())
ans = n//111*111 if n%111 == 0 else n//111*111 + 111
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N <=111:
    print("111")
elif N <=222:
    print("222")
elif N <=333:
    print("333")
elif N <= 444:
    print("444")
elif N <=555:
    print("555")
elif N <=666:
    print("666")
elif N <=777:
    print("777")
elif N <=888:
    print("888")
else:
    print("999")

Submission status: Accepted

Solution code:
n = int(input())
for i in range(111,1000,111):
    if n <= i:
        print (i)
        break

Submission status: Accepted

Solution code:
n = int(input())
p = [111,222,333,444,555,666,777,888,999]
for i in p:
	if n <= i:
		print(i)
		break

Submission status: Accepted

Solution code:
n = [a for a in str(input())]
if int(n[0] + n[1] + n[2]) <= int(n[0] + n[0] + n[0]):
    print(n[0] + n[0] + n[0])
else:
    print(str(int(n[0]) + 1) + str(int(n[0]) + 1) + str(int(n[0]) + 1))

Submission status: Accepted

Solution code:
N=int(input())
a=[int(x) for x in list(str(N))]
s=a[0]*100+a[0]*10+a[0]
t=s+111
if a[0]>a[1]:
    print(s)
elif a[0]==a[1]:
    if a[1]<a[2]:
        print(t)
    else:
        print(s)
else:
    print(t)

Submission status: Accepted

Solution code:
n = int(input())
for i in range(n, 1000):
    if len(set(map(int, list(str(i))))) == 1:
        print(i)
        quit()

Submission status: Accepted

Solution code:
s = ((int(input()) - 1) // 111 + 1) * 111
print(s)

Submission status: Accepted

Solution code:
s=input()
while len(set(s))>1:s=str(int(s)+1)
print(s)

Submission status: Accepted

Solution code:
n = int(input())
for i in range(111, 1000, 111):
    if i >= n:
        print(i)
        exit()
    else:
        continue

Submission status: Accepted

Solution code:
import math

n = int(input())

if n % 111 == 0:
	print(n)
else:
	amari = math.ceil(n / 111)
	print(111*amari)

Submission status: Accepted

Solution code:
from math import ceil
print(int(ceil(int(input()) / 111))*111)

Submission status: Accepted

Solution code:
n = int(input())
a = n % 10
b = (n // 10) % 10
c = n // 100
n = 100 * c + 10 * b + a

if c < b or c < a:
    print(100 * (c + 1) + 10 * (c + 1) + c +1)
else:
    print(100 * c + 10 * c + c)

Submission status: Accepted

Solution code:
ans = int(input())
if ans%111 == 0:
    print(ans)
else:
    x = int(ans/111+1)
    print(x*111)

Submission status: Accepted

Solution code:
N = int(input())

if (N <= 111):
  print(111)
elif(111 < N and N <= 222):
  print(222)
elif(222 < N and N <= 333):
  print(333)
elif(333 < N and N <= 444):
  print(444)
elif(444 < N and N <= 555):
  print(555)
elif(555 < N and N <= 666):
  print(666)
elif(666 < N and N <= 777):
  print(777)
elif(777 < N and N <= 888):
  print(888)
elif(888 < N and N <= 999):
  print(999)

Submission status: Accepted

Solution code:
N = input().rstrip()
N_list = list(N)

select_num = int(N_list[0])
next_str = ''
next_str += str(select_num)
next_str += str(select_num)
next_str += str(select_num)

if int(next_str) >= int(N):
  print(next_str)
else:
  select_num += 1
  next_str = ''
  next_str += str(select_num)
  next_str += str(select_num)
  next_str += str(select_num)
  print(next_str)

Submission status: Accepted

Solution code:
N = int(input())

def judge(N):
    lst = [111, 222, 333, 444, 555, 666, 777, 888, 999]
    for n in lst:
        if N <= n:
            return(n)
print(judge(N))

Submission status: Accepted

Solution code:
n = int(input())
print(((n-1) // 111 + 1)*111)

Submission status: Accepted

Solution code:
n = int(input())
print(int(str(n)[0])*111 if n <= int(str(n)[0])*111 else (int(str(n)[0])+1)*111)

Submission status: Accepted

Solution code:
N = int(input())
nlist=[111,222,333,444,555,666,777,888,999]
for i in nlist:
    if i >=N:
        print(i)
        break

Submission status: Accepted

Solution code:
n=int(input())
for i in range(n,1000):
    if i%111==0:
        print(i)
        break

Submission status: Accepted

Solution code:
N = int(input())

for i in range(1, 10):
    if N <= i*111:
        print(i*111)
        break

Submission status: Accepted

Solution code:
N = raw_input()
x = ''
if N[0] > N[1]:
    x = N[0]*3
elif N[0] < N[1]:
    x = str((int(N[0]) + 1)) * 3
elif N[0] == N[1]:
    if N[1] > N[2]:
        x = x = N[0]*3
    elif N[1] == N[2]:
        x = N
    else:
        x = str((int(N[0]) + 1)) * 3
print(x)

Submission status: Accepted

Solution code:
N = int(input())

for i in range(10):
  if 111*i < N <= 111*(i+1):
    print(111*(i+1))
    break

Submission status: Accepted

Solution code:
x = input()

base = int(x)

xs = [x for x in [int(c*3) for c in set('123456789') ] if x >= base ]
print(sorted(xs).pop(0))

Submission status: Accepted

Solution code:
n = int(input())
s = (n-1) // 111
print(111*(s+1))

Submission status: Accepted

Solution code:
n = int(input())
a = (n-1)//111
print(111*(a+1))

Submission status: Accepted

Solution code:
S = int(input())
if S%111 > 0:
    print((int(S/111)+1)*111)
else:
    print(S)

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def f(n):
    n = str(n)

    return n[0] == n[1] == n[2]


def main():
    N = int(input())

    while not f(N):
        N += 1
    
    print(N)


main()

Submission status: Accepted

Solution code:
N = int(input())
if N%111 == 0:
    print(N)
else:    
    print((N//111+1)*111)

Submission status: Accepted

Solution code:
N=int(input())
if N % 111 ==0:
    print(N)
else:
    print(((N//111)+1)*111)

Submission status: Accepted

Solution code:
next = int(input())
if next%111==0:
  print(next)
else:
  print((int(next/111)+1)*111)

Submission status: Accepted

Solution code:
n = int(input())

if n % 111 == 0:
    print(n)
else:
    print(n - (n % 111) + 111)

Submission status: Accepted

Solution code:
N = int( input())
for i in range(1,10):
  if N <= 111*i:
    print(111*i)
    break

Submission status: Accepted

Solution code:
n=input()
while len(set(list(n)))>1:
  n=str(int(n)+1)
print(n)

Submission status: Accepted

Solution code:
n = input()
if int(n) <= int(n[0]*3):ans = n[0]*3
else:ans = str(int(n[0])+1)*3
print(ans)

Submission status: Accepted

Solution code:
N = input()
n = []
for i in N:
    n.append(i)
if n[0] == n[1] and n[1] == n[2]:
    print(int(N))
else:
    if n[0] >= n[1] and n[0] >= n[2]:
        print(int(n[0]*3))
    else:
        tmp = int(n[0])
        tmp += 1
        n[0] = str(tmp)
        print(int(n[0]*3))

Submission status: Accepted

Solution code:


def is_valid(x):

    return len(set(list(str(x)))) == 1

n = int(input())

def get_ans(n):
    while True:
        if is_valid(n):
            return n
        n += 1

print(get_ans(n))

Submission status: Accepted

Solution code:
N=int(input())
N_str = []
for i in range(N,1000):
    N_new = N
    while N>0:
        N_str.append(N%10)
        N//=10
    N_str.reverse()
    
    N = N_new
          
    if N_str[0]==N_str[1] and N_str[1]==N_str[2]:
        print(N)
        break
    N+=1

Submission status: Accepted

Solution code:
n = int(raw_input())
ans = n / 111
if n % 111 != 0: ans = ans + 1
print ans * 111

Submission status: Accepted

Solution code:
N=int(input())

for a in range(10):
    if a*111<N:
        pass
    elif a*111>=N:
        print(a*111)
        break

Submission status: Accepted

Solution code:
n=int(input())

i=1

while n>i*111:
  i+=1

  
print(i*111)

Submission status: Accepted

Solution code:
N = int(input())

result = (N + 110) // 111 * 111

print(result)

Submission status: Accepted

Solution code:
a = 111
N = int(input())
for i in range(1, 10):
    if (i - 1) * a < N <= i * a:
        print(i * a)
        break

Submission status: Accepted

Solution code:
n = int(input())

while True:
	check = set(str(n))
	if len(check) == 1:
		print(n)
		break
	n += 1

Submission status: Accepted

Solution code:
n = int(input())
k = 0
if int(n/111) == n/111:
  k = int(n/111)
else:
  k = int(n/111) + 1
print(111*k)

Submission status: Accepted

Solution code:
n = int(input())
for i in range(1,10):
 if n <= (100*i + 10*i + i):
    print(100*i + 10*i + i)
    break

Submission status: Accepted

Solution code:
try:
    a = int(input())
    # すべての桁の数が同じ数値の配列を作成
    nums = [111, 222, 333, 444 ,555 ,666, 777, 888, 999]
    # パラメータの数値より大きくて最小の値を出力
    print(min(list(filter(lambda x : x >= a, nums))))
except EOFError:
    pass

Submission status: Accepted

Solution code:
# coding: utf-8

n = int(input())

for i in range(1,10):
    if n <= 100*i + 10*i + i:
        print(100*i + 10*i + i)
        break

Submission status: Accepted

Solution code:
N = int(input())
print(((N-1)//111 +1) *111)

Submission status: Accepted

Solution code:
N = int(input())
while True:
    n = str(N)
    i = 0
    ans = 1
    while True:
        if i >= len(n):
            break
        if n[i] != n[i - 1]:
            ans = -1
            break
        i += 1
    if ans == 1:
        print(n)
        break
    N += 1

Submission status: Accepted

Solution code:
N = int(input())
x_list = [111,222,333,444,555,666,777,888,999]
for x in x_list:
    if N <= x:
        print(x)
        break

Submission status: Accepted

Solution code:
def out(text):
    print(text, end='')

n = int(input())
for i in range(10):
    i *= 111
    if i+1 <= n <= i+111:
        out(i+111)

Submission status: Accepted

Solution code:
N = int(input())
for x in range(N, 1000):
    s = str(x)
    if s[0] == s[1] == s[2]:
        print(s)
        break

Submission status: Accepted

Solution code:
n = int(input())
k = 0
if int(n/111) == n/111:
  k = int(n/111)
else:
  k = int(n/111) + 1
print(111*k)

Submission status: Accepted

Solution code:
line = int(input())
lina = list(map(int, [line/100, (line/10)%10, line%10]))
contest = [111*lina[0], 111*(lina[0]+1)]
if(contest[0] - line >= 0):
    print(contest[0])
else:
    print(contest[1])

Submission status: Accepted

Solution code:
N = int(input())
v = 0

for i in range(111,1000,111):
    if N <= i:
        v += 1

print(1110 - 111*v)

Submission status: Accepted

Solution code:
n = int(input())

if n % 111 == 0:
    print((n // 111) * 111)
else:
    print((n // 111 + 1) * 111)

Submission status: Accepted

Solution code:
print(int((int(input())+110)/111)*111)

Submission status: Accepted

Solution code:
a=111;print((int(input())+110)//a*a)

Submission status: Accepted

Solution code:

def answer(in0):
    return (int(int(in0) / 111.1) + 1) * 111

print(answer(input()))

Submission status: Accepted

Solution code:
print((9-(999-int(input()))//111)*111)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
table = np.array([111*i for i in range(1,10)])
table = table[np.where(table>=n)]
print(table[np.argmin(table-n)])

Submission status: Accepted

Solution code:
#abc111b

n=int(raw_input())
x=n/100
y=x*100+x*10+x
if n-y<=0:
 print x*111
else:
 print (x+1)*111

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

n = int(input())
m = []
k = 0
for i in range(1,10):
    m.append(i*111)
for j in m:
    if j >= n:
        k = j
        break
        
print(k)

Submission status: Accepted

Solution code:
n=int(input())
if n<=111:
    print(111)
elif n<=222:
    print(222)
elif n<=333:
    print(333)
elif n<=444:
    print(444)
elif n<=555:
    print(555)
elif n<=666:
    print(666)
elif n<=777:
    print(777)
elif n<=888:
    print(888)
else:
    print(999)

Submission status: Accepted

Solution code:
N = int(input())

for i in range(1, 10):
    x = i + 10*i + 100*i
    if x>= N:
        break
        
print(x)

Submission status: Accepted

Solution code:
import math

n = int(input())
print(111 * math.ceil(n / 111))

Submission status: Accepted

Solution code:
n = int(input())
ln = [i for i in str(n)]
ans = ln[0] * 3
if int(ans) < n:
    ans = str(n // 100 + 1) * 3
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v1 = n%10
v2 = (n//10)%10
v3 = n//100

if v1 == v2 and v2 == v3:
    print(n)
elif v3 > v2:
    print(v3*111)
elif v3 == v2:
    if v2 > v1:
        print(v3*111)
    else:
        print((v3+1)*111)
else:
    print((v3+1)*111)

Submission status: Accepted

Solution code:
n=int(input())
if n%111==0:
	print(int(n/111)*111)
else:
	print((n//111+1)*111)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin

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


if a % 111:
    print(((a // 111) + 1) * 111)
else:
    print(a)

Submission status: Accepted

Solution code:
n = int(input())

print((~-n//111+1)*111)

Submission status: Accepted

Solution code:
p = int(input())
for i in range(p,1000):
    if(i % 111 == 0):
        print(i)
        break

Submission status: Accepted

Solution code:
from bisect import bisect_left
n=int(input())
l=[111*i for i in range(1,10)]
print(l[bisect_left(l,n)])

Submission status: Accepted

Solution code:
N=int(input())
a=N//100
b=a*100+a*10+a
if N<=b:
    print(b)
else:
    a+=1
    print(a*100+a*10+a)

Submission status: Accepted

Solution code:
print(int((int(input()) + 110) / 111) * 111)

Submission status: Accepted

Solution code:
print(111*(10- (1110-int(input()))//111))

Submission status: Accepted

Solution code:
n = int(input())
shou = int(n / 111)
if n % 111 == 0:
    shou -= 1
ans = 111 * (shou + 1)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
i=N
list = []
while i > 0:
    list.append(i%10)
    i //= 10
list.reverse()

if N<=list[0]*111:
    print(list[0]*111)
else:
    print((list[0]+1)*111)

Submission status: Accepted

Solution code:
def main():
    N = int(input())

    ans1 = AC1(N)
    ans2 = AC2(N)
    assert ans1 == ans2

    print(ans1)


def AC1(N):
    for i in range(N, 999+1):
        if len(set(list(str(i)))) == 1:
            return i


def AC2(N):
    for i in range(1, 9+1):
        if N <= 111 * i:
            return 111 * i


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
i = int(input())

while True:
    if len(set(str(i))) == 1:
        print(i)
        break
    i += 1

Submission status: Accepted

Solution code:
n = int(input())
zs = [111 * i for i in range(1, 9 + 1)]
for z in zs:
    if n <= z:
        print(z)
        exit()

Submission status: Accepted

Solution code:
N=int(input())

while True:
    if N%111==0:
        break
    else:
        N+=1

print(N)

Submission status: Accepted

Solution code:
import math

while True:
    try:
        n = eval(input().strip())

        tp = int(111)
        for i in range(1,10):
            if i * tp >= n:
                print(i * tp)
                break

    except:
        break

Submission status: Accepted

Solution code:
N = int(input())
for i in range(1, 10):
  if i*111 >= N:
    print(i*111)
    break

Submission status: Accepted

Solution code:
N=int(input())
for i in range(N,1000):
    if i%111==0:
        print(i)
        exit()

Submission status: Accepted

Solution code:
n=int(input())
m=n//100
#print(m)
a=(m*100)+(m*10)+m
if a>=n:
    print(a)
else:
    m+=1
    a=(m*100)+(m*10)+m
    print(a)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
while n > 0:
    n -= 111
    cnt += 1
print(cnt * 111)

Submission status: Accepted

Solution code:
n = int(input())

while 1:
    if n % 111 == 0:
        break
    n += 1

print(n)

Submission status: Accepted

Solution code:
n = int(input())

compare = 111
while n > compare:
    compare += 111

print(compare)

Submission status: Accepted

Solution code:
n=int(input())
if 100<=n<=111:
	print(111)
if 112<=n<=221:
	print(222)	
if 222<=n<=333:
	print(333)	
if 334<=n<=444:
	print(444)
if 445<=n<=555:
	print(555)
if 556<=n<=666:
	print(666)
if 667<=n<=777:
	print(777)
if 778<=n<=888:
	print(888)
if 889<=n<=999:
	print(999)

Submission status: Accepted

Solution code:
N = int(input())


list = [111,222,333,444,555,666,777,888,999]
num2 = 0
for num in list:
    if N <= num:
        print (num)
        break

Submission status: Accepted

Solution code:
n = list(input())

result =n[0]+n[0]+n[0]

if int(n[0]+n[0]+n[0])<int(n[0]+n[1]+n[2]):
    a = str(int(n[0])+1)
    result = a+a+a
    
print(result)

Submission status: Accepted

Solution code:
num=input()
num=int(num)

if num<=111:
    num=111
elif num<=222:
    num=222
elif num<=333:
    num=333
elif num<=444:
    num=444
elif num<=555:
    num=555
elif num<=666:
    num=666
elif num<=777:
    num=777
elif num<=888:
    num=888
else:
    num=999

print(num)

Submission status: Accepted

Solution code:
N = int(input())

for i in range(1,10):
    if N <= 100*i + 10*i + i:
        print(100*i + 10*i + i)
        break

Submission status: Accepted

Solution code:
n = int(input())
for i in reversed(range(10)):
  if n <= 100*i+10*i+i:
    ans = 100*i+10*i+i
    
print(ans)

Submission status: Accepted

Solution code:
n = input()

l = list()
num = int(n)
for i in range(9):
    l.append(111*(i+1))

for i in range(9):
    if num == l[i]:
        print(l[i])
        break
    elif num < l[i]:
        print(l[i])
        break
    else:
        continue

Submission status: Accepted

Solution code:
n=int(input())

for i in range(n,1000):
    a=i//100
    b=(i-100*a)//10
    c=i%10
    if a==b and a==c :
        ans=i
        break
print(ans)

Submission status: Accepted

Solution code:
def judge(N):
    a = []
    n = N
    while n != 0:
        j = n % 10
        if len(a) == 0:
            a += [j]
        elif j != a[0]:
            return False
        n //= 10
    return True

def main():
    n = int(input())
    while not judge(n):
        n += 1

    print(n)

main()

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N = int(input())
li = [111,222,333,444,555,666,777,888,999]
ind = bisect.bisect_left(li,N)
print(li[ind])

Submission status: Accepted

Solution code:
n = input()
l = [int(x) for x in list(str(n))]
ans = []
if (l[0] < l[1]) or (l[0] < l[2]):
	num = l[0] + 1
else:
	num = l[0]
for i in range(3):
	ans.append(num)
ansn = ans[0] * 100 + ans[1] * 10 + ans[2]
print(ansn)

Submission status: Accepted

Solution code:
N=input()

if N[2]==N[1]==N[0]:
    A=N

elif N[2]>N[0] or N[1]>N[0]:
    B=int(N[0])+1
    C=str(B)
    A=str(C+C+C)


else:
    A=str(N[0]+N[0]+N[0])


    
print(A)

Submission status: Accepted

Solution code:
n = int(input())
prospects = [111*i for i in range(1, 10)]

for p in prospects:
    if p < n:
        continue
    if p >= n:
        print(p)
        break

Submission status: Accepted

Solution code:
N = int(input())

if 100<=N<112: print(111)
elif 112<=N<223: print(222)
elif 223<=N<334: print(333)
elif 334<=N<445: print(444)
elif 444<=N<556: print(555)
elif 555<=N<667: print(666)
elif 667<=N<778: print(777)
elif 778<=N<889: print(888)
else: print(999)

Submission status: Accepted

Solution code:
N = int(input())
i = 111

while i <= 999:
    if N <= i:
        print(i)
        break
    else:
        i += 111

Submission status: Accepted

Solution code:
a = raw_input()
b = int(a[0])
c = int(a[1])
d = int(a[2])
e = b+1
if b == c == d:
  print 111*b
else:
  if int(a)>111*b:
    print 111*(b+1)
  else:
    print 111*b

Submission status: Accepted

Solution code:
want_to_join = {
    '1': 111,
    '2': 222,
    '3': 333,
    '4': 444,
    '5': 555,
    '6': 666,
    '7': 777,
    '8': 888,
    '9': 999
}

number_letter = input()
first_letter = number_letter[0]
if want_to_join[first_letter] >= int(number_letter):
    print(want_to_join[first_letter])
else:
    next_letter = str(int(first_letter)+1)
    print(want_to_join[next_letter])

Submission status: Accepted

Solution code:
N = int(input())
repdigit = [str(x)*3 for x in range(1,10)]

for i in range(len(repdigit)):
    try:
        if N <= int(repdigit[i]):
            print(repdigit[i])
            break
    except:
        pass

Submission status: Accepted

Solution code:

def isCorrect(n):
    l = [int(x) for x in list(str(n))]
    prev = l.pop(0)

    for num in l:
        if num != prev:
            return False
        prev = num
    return True

if __name__ == '__main__':
    n = int(input())

    for m in range(n, 100000):
        if isCorrect(m):
            print(m)
            break

Submission status: Accepted

Solution code:
N=int(input())
if 100<=N<=111:
    print(111)
elif 112<=N<=222:
    print(222)
elif 223<=N<=333:
    print(333)
elif 334<=N<=444:
    print(444)
elif 445<=N<=555:
    print(555)
elif 556<=N<=666:
    print(666)
elif 667<=N<=777:
    print(777)
elif 778<=N<=888:
    print(888)
else:
    print(999)

Submission status: Accepted

Solution code:
print((1+((int(input())-1))//111)*111)

Submission status: Accepted

Solution code:
n = int(input())
if (n % 111) == 0:
	ans = (n // 111) * 111
else:
	ans = (n // 111 +1) * 111
print(int(ans))

Submission status: Accepted

Solution code:
n = input()
a = [list(n)[0]]*len(n)
ans = ''.join(a)

if int(n) <= int(ans):
    print(ans)
else:
    ans = [str(int(list(n)[0])+1)] * len(n)
    ans = int(''.join(ans))
    print(ans)

Submission status: Accepted

Solution code:
num=input()
for i in [111,222,333,444,555,666,777,888,999]:
  if int(num) <= i:
    print(i)
    exit()

Submission status: Accepted

Solution code:
n = input()
if n[0] == n[1] and n[1] == n[2]:
    print(n)
elif (n[0] == n[1] and n[1] < n[2]) or n[0] < n[1]:
    b = int(n[0])+1
    print(str(b) + str(b) + str(b))
else:
    print(n[0] + n[0] + n[0])

Submission status: Accepted

Solution code:
n=int(input())
print(111*(-(-n//111)))

Submission status: Accepted

Solution code:
import math
N = input()
temp = 0
result = ''
if int(N) % 111 == 0:
    print(N)
else:
    temp = math.ceil((int(N) / 111))
    for i in range(len(N)):
        result += str(temp)
    print(result)

Submission status: Accepted

Solution code:
input_line = int(input())
i = 111

while True:
    if input_line <= i:
        break
    i += 111

print(i)

Submission status: Accepted

Solution code:
N = int(input())

if N <= (N//100)*111:
    print((N//100)*111)
else:
    print((N//100 + 1)*111)

Submission status: Accepted

Solution code:
n = input()
def makeList(n):
    return list(n)


for i in range(int(n),1000):
    tmp = list(str(i))
    if tmp[0] == tmp[1] and tmp[1] == tmp[2]:
        print(i)
        exit(0)

Submission status: Accepted

Solution code:
def first_ABC():
    array = []
    for fig in range(1, 10):
        sum = fig * 100 + fig * 10 + fig
        array.append(sum)
    return array

if __name__ == "__main__":
    N = int(input())
    array = first_ABC()
    for select in array:
        if select >= N:
            print(select)
            break

Submission status: Accepted

Solution code:
#

m = int(input())

nums = [ 111, 222, 333, 444, 555, 666, 777, 888, 999]


if 100 <= m <1000:
    #main
     for v in nums:
       if m <= v :
         print(v)
         break

Submission status: Accepted

Solution code:
#

m = int(input())

nums = [ 111, 222, 333, 444, 555, 666, 777, 888, 999]


if 100 <= m <1000:
    #main
     for v in nums:
       if m <= v :
         print(v)
         break

Submission status: Accepted

Solution code:
s = input()
if int(s[0])>=int(s[1]) and int(s[0])>=int(s[2]):
    print(int(s[0])*111)
else:
    print((int(s[0])+1)*111)

Submission status: Accepted

Solution code:
N = int(input())

if N <= 111:
    print('111')
elif N <= 222:
    print('222')
elif N <= 333:
    print('333')
elif N <= 444:
    print('444')
elif N <= 555:
    print('555')
elif N <= 666:
    print('666')
elif N <= 777:
    print('777')
elif N <= 888:
    print('888')
elif N <= 999:
    print('999')

Submission status: Accepted

Solution code:
num=input()
num_list=list(num)
n=len(num)
ans_num=0
element=int(num_list[0])
for i in range(n):
    if element<int(num_list[i]):
        tf=False
        element+=1
        break
print(str(element)*n)

Submission status: Accepted

Solution code:
#Bad_Beast
n=int(input())
if n>=100 and n<=111:
    print(111)
if n>111 and n<=222:
    print(222)
elif n>222 and n<=333:
    print(333)
elif n>333 and n<=444:
    print(444)
elif n>444 and n<=555:
    print(555)
elif n>555 and n<=666:
    print(666)
elif n>666 and n<=777:
    print(777)
elif n>777 and n<=888:
    print(888)
elif n>888 and n<=999:
    print(999)
#print(res)

Submission status: Accepted

Solution code:
n = int(input())
if n%111==0:
	print(n)
else:
	k = int(n/111)
	u = 111*(k+1)
	print(u)

Submission status: Accepted

Solution code:
N = int(input())
for i in range(1,10):
    if N <= 111*i:
        print(111*i)
        break

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys

input = sys.stdin.readline
a = input()

tmp =  int(a[0] * 3)
if int(a[0] * 3) < int(a):
    print(str(int(a[0]) + 1) * 3)
else:
    print(str(int(a[0])) * 3)

Submission status: Accepted

Solution code:
N=int(input())
A=0
for i in range(111, 1000, 111):
    if N<=i:
        A=i
        break
print(A)