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 111<N<=222:
    print(222)
elif 222<N<=333:
    print(333)
elif 333<N<=444:
    print(444)
elif 444<N<=555:
    print(555)
elif 555<N<=666:
    print(666)
elif 666<N<=777:
    print(777)
elif 777<N<=888:
    print(888)
else:
    print(999)

Submission status: Accepted

Solution code:
n = input()

if n[0] == n[1] and n[1] == n[2] and n[0] == n[2]:
    print(n)
elif n[0] == '9':
    print('999')
elif n[0] == n[1] and n[0] > n[2]:
    print(n[0]*3)
elif n[0] == n[1] and n[0] < n[2]:
    print(str(int(n[0])+1) * 3)
elif n[0] < n[1]:
    print(str(int(n[0])+1) * 3)
elif n[0] > n[1]:
    print(n[0]*3)

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())
contests = [111, 222, 333, 444, 555, 666, 777, 888, 999]
for x in contests:
    if N <= x:
        print(x)
        break

Submission status: Accepted

Solution code:
n = int(input())

tmp = 111

for i in range(9):
    if n <= tmp:
        break
    tmp += 111

print(tmp)

Submission status: Accepted

Solution code:
n=input()
ans=""
an=""

for i in n:
    ans+=n[0]
    
if int(ans)>=int(n):
    print(ans)
else:
    for i in n:
        an+=str(int(n[0])+1)
    print(an)

Submission status: Accepted

Solution code:
def good(i):
    return len(set(str(i))) == 1

n = input()
for i in xrange(n, n + 1005):
    if good(i):
        print i
        break

Submission status: Accepted

Solution code:
n = input()
a = set(n)
b = ''
d = ''

if len(a) == 1:
    print(n)
else:
    for i in range(len(n)):
        b += n[0]
    if int(n) < int(b):
        print(b)
    else:
        for j in range(len(n)):
            c = int(n[0])+1
            d += str(c)
        print(d)

Submission status: Accepted

Solution code:

N = str(input())

hyaku = 0
flg = 0
for index, i in enumerate(N):
    if index == 0:
        hyaku = int(i)
    else:
        if hyaku >= int(i):
            pass
        else:
            flg = 1
            break
if flg:
    for _ in range(3):
        print(hyaku + 1, end='')
else:
    for _ in range(3):
        print(hyaku, end='')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


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

    for i in range(100, 1000):
        if i % 111 == 0 and i >= n:
            print(i)
            exit()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
for i in range(n,1000):
    a=i//100
    b=(i-a*100)//10
    c=i-a*100-b*10
    if a==b==c:
        print('{}{}{}'.format(a,b,c))
        break

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):    print(111)
elif(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)
else:    print(999)

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 <= 11:
	answer = 11
elif N <= 22:
	answer = 22
elif N <= 33:
	answer = 33
elif N <= 44:
	answer = 44
elif N <= 55:
	answer = 55
elif N <= 66:
	answer = 66
elif N <= 77:
	answer = 77
elif N <= 88:
	answer = 88
elif N <= 99:
	answer = 99
elif N <= 111:
	answer = 111
elif N <= 222:
	answer = 222
elif N <= 333:
	answer = 333
elif N <= 444:
	answer = 444
elif N <= 555:
	answer = 555
elif N <= 666:
	answer = 666
elif N <= 777:
	answer = 777
elif N <= 888:
	answer = 888
elif N <= 999:
	answer = 999

print(answer)

Submission status: Accepted

Solution code:
N = str(input())
bench = int(N[0] * 3)
N = int(N)
if bench < N:
    bench = bench + 111



print(bench)
print()

Submission status: Accepted

Solution code:
n = list(map(int, list(input())))

isFalse = False
for i in range(1, len(n)):
    if n[i] > n[0]:
        isFalse = True

if isFalse:
    res = str(n[0] + 1)
else:
    res = str(n[0])

for i in range(len(n)):
    print(res, end='')

Submission status: Accepted

Solution code:
n = int(input())
li = [111,222,333,444,555,666,777,888,999]
for l in li:
    if l >= n:
        print(l)
        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:

S = int(input())
ans = [000, 111, 222, 333, 444, 555, 666, 777, 888, 999]

ans_ = 0
for a in ans:
    if a - S >= 0:
        ans_ = a
        break


if ans_ == 0:
    print("000")
else:
    print(str(ans_))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
count=0
while n>count:
    count=count+111
print(count)

Submission status: Accepted

Solution code:
N = [int(i) for i in input()]
if N[0] > N[1] or (N[0]==N[1] and N[0] >= N[2]):
    print(N[0]*111)
else:
    print((N[0]+1)*111)

Submission status: Accepted

Solution code:
N = int(input())
k = N // 111

if N % 111 == 0:
    pass
else:
    k += 1

print(k * 111)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
b=[111,222,333,444,555,666,777,888,999]

for x in range(9):
    if b[x]==a:
        print(b[x])
        break
    if b[x]>a:
        print(b[x])
        break

Submission status: Accepted

Solution code:
# 一つの数字の入力
a = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

for i in range(len(lis)):
    if n < 111:
        print(111)
        break
    elif lis[i] == n:
        print(lis[i])
        break
    elif lis[i] < n and lis[i+1] > n:
        print(lis[i+1])
        break

Submission status: Accepted

Solution code:
N = int(input())
nums = [num for num in range(111,1000,111)]
for i in range(1,999):
  if N in nums:
    print(N)
    exit()
  else:
    N+=1

Submission status: Accepted

Solution code:
N = int(input())

ans = N

while ans < 999:
    if int(ans/100) == int((ans%100)/10) and int(ans/100) == int(ans%10):
        break
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

n = int(N/100)
if n*111 >= N:
    print(n*111)
else:
    print((n+1)*111)

Submission status: Accepted

Solution code:
n = int(input())

ans_list = [100*x+10*x+x for x in range(10)]

for v in ans_list:
    if v >= n:
        ans = v
        break
        
print(ans)

Submission status: Accepted

Solution code:
a = int(input())

while(True):
  b = str(a)
  if b[0] == b[1] == b[2]:
    print(a)
    break
  else:
    a += 1

Submission status: Accepted

Solution code:
N = int(input())
amari = N % 111
shou = N // 111

ans = 0
if amari == 0:
  ans = N
else:
  ans = (shou+1)*111

print(ans)

Submission status: Accepted

Solution code:
#encoding utf-8

n = int(input())

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

def main():
    N = input()
    Ns = []
    for n in N:
        Ns.append(int(n))
    Ns.sort()
    a = Ns[0]

    while True:
        num = a*100+a*10+a
        if num >= int(N):
            print(num)
            exit()
        a += 1


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
iN = int(input().rstrip())

iA = iN // 111
iB = iN % 111
if iB == 0 :
    print(iA * 111)
else:
    print((iA+1) * 111)

Submission status: Accepted

Solution code:
#!/usr/bin/env python


def main():
    aaa = [111, 222, 333, 444, 555, 666, 777, 888, 999, 1111]
    n = int(input())

    for k in aaa:
        if n <= k:
            print(k)
            break


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=input()
for i in range(N,1000):
	x=i/100
	i%=100
	y=i/10
	z=i%10
	if x==y==z:
		print x*100+y*10+z
		quit()

Submission status: Accepted

Solution code:
def main():
    N = input()
    while not(N[0]==N[1]==N[2]):
        N = str(int(N) + 1)
    return N

if __name__ == "__main__":
    print(main())

Submission status: Accepted

Solution code:
N = int(input())
#n = (int(i) for i in input().split())

if N <= 111:
    print("111")
elif 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 :
    print("999")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(raw_input().replace("\n", ""))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

for i in range(111, 1000, 111):
    if i >= n:
        print(i)
        exit(0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

z = N / 111

if N % 111 == 0:
    print(N)
else:
    print((int(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:
num = input()

ans_num = int(num[0])

if int(num[1]) > ans_num or int(num[2]) > ans_num:
    ans_num += 1

print(ans_num * 100 + ans_num * 10 + ans_num)

Submission status: Accepted

Solution code:
# coding: utf-8

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

Submission status: Accepted

Solution code:
N=int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())

a=n//100
b=(n-a*100)//10
c=n%10

if a==b and b==c:
    print(n)
else:   
    if n<a*100+a*10+a:
        print(a*100+a*10+a)
    else:
        a=a+1
        print(a*100+a*10+a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

l = [111 * i for i in range(1, 10)]

for num in l:
    if n > num:
        continue
    else:
        ans = num
        break
print(ans)

Submission status: Accepted

Solution code:
if __name__ == '__main__' :
    A = [111,222,333,444,555,666,777,888,999]
    n = int(input())

    for i,a in enumerate(A):
        if n <= a:
            print(A[i])
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
L = [111,222,333,444,555,666,777,888,999,1111]
for i in range(len(L)) :
    if L[i] == N :
        print(N)
        break
    elif L[i] < N < L[i+1] :
        print(L[i+1])
        break
    elif N < 111 :
        print(111)
        break

Submission status: Accepted

Solution code:
n = int(input())
n = (n-1)//111
if n == 0:
    print(111)
elif n == 1:
    print(222)
elif n == 2:
    print(333)
elif n == 3:
    print(444)
elif n == 4:
    print(555)
elif n == 5:
    print(666)
elif n == 6:
    print(777)
elif n == 7:
    print(888)
elif n == 8:
    print(999)
elif n == 9:
    print(1111)

Submission status: Accepted

Solution code:
n=int(input())

for i in range(10):
    x=i*100+i*10+i
    if n > x-111 and n <= x:
        print(x)

Submission status: Accepted

Solution code:
n = int(input())
while True:
    if str(n)[0:1] ==str(n)[1:2] == str(n)[2:3]:
        print(n)
        break
    else:
        n += 1

Submission status: Accepted

Solution code:
N = int(input())

if N <= 111:
    ans = 111
elif 111 < N <= 222:
    ans = 222
elif 222 < N <= 333:
    ans = 333
elif 333 < N <= 444:
    ans = 444
elif 444 < N <= 555:
    ans = 555
elif 555 < N <= 666:
    ans = 666
elif 666 < N <= 777:
    ans = 777
elif 777 < N <= 888:
    ans = 888
elif 888 < N <= 999:
    ans = 999

print(ans)

Submission status: Accepted

Solution code:
import numpy as np

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

Submission status: Accepted

Solution code:
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

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())

def check(n):
    s = str(n)
    return (s[0] == s[1]) and (s[1] == s[2])

while True:
    if check(N):
        print(N)
        break
    N += 1

Submission status: Accepted

Solution code:
n = int(input())

l = [111, 222, 333, 444, 555, 666, 777, 888, 999]
i = 0
while n > l[i]: i += 1

print(l[i])

Submission status: Accepted

Solution code:
import numpy as np
import math

# K = int(input())
# N, K = map(int, input().split())
# A = list(map(int, input().split()))
# S = input() # String
# DP = np.zeros((N, Y), dtype=int)

sN = input()
N = int(sN)
arN = list(map(int, sN))

def match(p):
    arP = list(map(int, str(p)))
    return arP[0] == arP[1] and arP[1] == arP[2]

if N <= 111:
    print(111)
    exit(0)

while not match(N):
    N = N + 1
    # print(N)
    

print(N)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N = int(input())

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

Submission status: Accepted

Solution code:
#n = list(map(int, input().split()))
n = int(input())
while True:
    if n % 111 == 0:break
    n += 1
print(n)

Submission status: Accepted

Solution code:
N = input()
n = N / 100
next_n = 0
if N <= n * 100 + n * 10 + n:
	next_n = n
else:
	next_n = n + 1

print next_n * 100 + next_n * 10 + next_n

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

n = int(input())
hyaku = n//100
answer = 0
if n > (hyaku*100 + hyaku*10 +hyaku):
	hyaku += 1

print(hyaku*100 + hyaku*10 +hyaku)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = input()

n1 = int(n[0])
n2 = int(n[1])

keta = n1

for s in n:
    if int(s) > n1:
        keta = n1 + 1
        break

print(str(keta) * len(n))

Submission status: Accepted

Solution code:
n = input()

for i in range(1,10):
    if str(i)*3 >= n:
        print(str(i)*3)
        break

Submission status: Accepted

Solution code:
N = int(input())

def solve(N):
    for d in range(1, 10):
        x = int(str(d) * 3)
        if N <= x:
            return x

print(solve(N))

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:
import sys
Input = sys.stdin.readline

N = int(Input())

for n in range(N, 999+1):
    s = str(n)
    if all(map(lambda c: c == s[0], s[1:])):
        print(n)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = input()
    h = int(n[0])
    if int(10*h+h) < int(n[1:]):
        print(100*(h+1)+10*(h+1)+(h+1))
    else:
        print(100*h+10*h+h)

Submission status: Accepted

Solution code:
N = int(input())

lis = [ i for i in range(111,1000,111)]

j = 0
for i in lis:
    if N <= i:
        print(lis[j])
        exit()
    j += 1

Submission status: Accepted

Solution code:
n = int(input())
listN = list(str(n))

if listN[0]==listN[1] and listN[1] ==listN[2]:
    print(n)
else:
    if listN[0] > listN[1]:
        print(listN[0]+listN[0]+listN[0])
    elif listN[0] == listN[1] and listN[1] > listN[2]:
        print(listN[0]+listN[0]+listN[0])
    else:
        number = str(int(listN[0])+1)
        print(number+number+number)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
print(111 * math.ceil(int(input()) / 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:
N = int(input())
output = ""

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

    if n > int(str(n//100)*3):
        print(int(str(n//100+1)*3))
    else:
        print(int(str(n//100)*3))



if __name__ == "__main__":
        main()

Submission status: Accepted

Solution code:
n = int(input())
a = [111,222,333,444,555,666,777,888,999]
while True:
    if a[0] < n:
        a.pop(0)
    else:
        break
print(a[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A=int(input())
for i in range(100,1000):
    #print(i)
    #print(str(i))
    if (str(i)[0] == str(i)[1]) and (str(i)[1] == str(i)[2]) and (i >= A):
        print(i)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = N // 100
S = 100 * A + 10 * A + A
T = 100 * (A + 1) + 10 * (A + 1) + (A + 1)
if N <= S:
    print(S)
else:
    print(T)

Submission status: Accepted

Solution code:
question="B"
input=raw_input
if question=="A":
	t=input()
	t=t.replace("9","n")
	t=t.replace("1","o")
	t=t.replace("n","1")
	t=t.replace("o","9")
	print(t)
if question=="B":
	s=int(input())
	t=[111,222,333,444,555,666,777,888,999]
	t=filter(lambda x:x>=s,t)[0]
	print(t)
if question=="C":
	pass
if question=="D":
	pass
if question=="E":
	pass

Submission status: Accepted

Solution code:
n = int(input())
li = [111, 222, 333, 444, 555, 666, 777, 888]
end = False
for x in li:
  if n <= x:
    print(x)
    end = True
    break
if not end:
  print(999)

Submission status: Accepted

Solution code:
N = int(input())
cands = [111*i for i in range(1, 10)] + [1111]
cands = [c for c in cands if c >= N]

print(min(cands))

Submission status: Accepted

Solution code:
n = input()
out = int(n[0]*3)
N = int(n)

if out < N:
    out += 111

print(out)

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:
def repdigit(n):
    s = str(n)
    a = s[0]
    for c in s:
        if c != a:
            return False
    return True
N = int(input())

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

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())
C = [i * 111 for i in range(1, 10)]
R = min([n for n in C if n >= N])
print(R)

Submission status: Accepted

Solution code:
import math

n=int(input())

k=111

nex=math.ceil(n/k)

print(nex*111)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=input().strip()
nn=int(N[0])
if int(N[0]*3)>=int(N):
    print(N[0]*3)
else:
    print(str(nn+1)*3)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def solve():
    N = int(input())
    for i in range(1, 10):
        if 111*i >= N:
            res = 111*i
            break
    return str(res)

if __name__ == '__main__':
    print(solve())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())


while(True):
    Ns = str(N)

    if(Ns[0] == Ns[1] and Ns[1] == Ns[2]):
        break
    N += 1

print(N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# encoding: utf-8
N = int(input())

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

print(krhs)

Submission status: Accepted

Solution code:
n = int(input())
list = [111,222,333,444,555,666,777,888,999]

for x in list:
    if x >= n:
        print(x)
        break

Submission status: Accepted

Solution code:
n = int(input())

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

for nn in ns:
    if n <= nn:
        print(nn)
        break

Submission status: Accepted

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


def f():
    for num in l:
        if N <= num:
            print(num)
            return

f()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

thresholds = [111, 222, 333, 444, 555, 666, 777, 888, 999]
for threshold in thresholds:
    if N <= threshold:
        print(threshold)
        break

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
inp = list(map(int, list(input())))
if inp[0] < inp[1] or (inp[0] == inp[1] and inp[1] < inp[2]):
    for i in range(3):
        print(inp[0] + 1, end="")
    print()
else:
    for i in range(3):
        print(inp[0], end="")
    print()

Submission status: Accepted

Solution code:
nl = list(input())
n = int(nl[0])*100 + int(nl[1])*10 + int(nl[2])
ans = 111
while ans < n:
    ans += 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")
elif n <= 999:
    print("999")

Submission status: Accepted

Solution code:
from collections import Counter
n=int(input())
s=str(n)
while(True):
    s=str(n)
    co=Counter(s)
    if(len(list(co.keys()))==1):
        print(n)
        exit()
    else:
        n+=1

Submission status: Accepted

Solution code:
N = int(input())
def check():
    for i in range(N,1112):
        if len(set(list(str(i)))) == 1:
            return i
print(check())

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:
# cook your dish here
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())
import collections
for x in range(N, 5000):
    c = collections.Counter(str(x))
    if len(c.keys()) == 1:
        print(x)
        break

Submission status: Accepted

Solution code:
N = int(input())

def f(x):
    s = str(x)
    return s[0] == s[1] == s[2]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n = raw_input()
x = n[0]
s = ''
for i in xrange(len(n)):
    s += x 
if int(s) >= int(n):
    print s
else:
    s = ''
    for i in xrange(len(n)):
        s += str(int(n[0])+1)
    print s

Submission status: Accepted

Solution code:
a = int(input())

for x in range(a,1000):
    if x%111 == 0:
        print(x)
        break

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:
S = input()
T = set(list(k for k in S))
if len(T) == 1:
    print(S)
    exit(0)
N = int(S)
while True:
    N += 1
    if N%111==0:
        print(N)
        exit(0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
str = input()

head = str[0]

zoro = int(head+head+head)

if(int(str) <= zoro):
    print(zoro)
else:
    print(zoro+111)

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=[]
for i in range(111,1000,111):
    a.append(i)
for i in range(10):
    if N<=a[i]:
        print(a[i])
        break

Submission status: Accepted

Solution code:
N = int(input())

for i in range(1, 10):
    num = int(str(i)*3)
    if num >= N:
        print(num)
        raise SystemExit

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

current = int(input())

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