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())
for i in range(N,1000):
    a=str(i)
    if a[0]==a[1] and a[1]==a[2]:
        print(i)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ok = False
for i in range(1,10):
    if int(str(i)*3)>=n:
        print(str(i)*3)
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC111

n = int(input())

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
if len(set(list(N))) == 1:
  print(N)
else:
  #入力が入力の百の位*3より小さい ex)750<777 112>11
  if int(N) < int(str(int(N[0]))*3):
    print(N[0]*3)
  else:
  	print(str(int(N[0])+1)*3)

Submission status: Accepted

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

N=int(input())

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

Submission status: Accepted

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

N=list(input())
if len(set(N))==1:
    print(''.join(N))
else:
    if int(N[0])<int(N[1]) or int(N[0])<int(N[2]):
        N=[int(N[0])+1]*len(N)
    else:
        N=[int(N[0])]*len(N)
    print(''.join(map(str,N)))

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//math.factorial(n-r)*math.factorial(r)


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

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    for i in range(1000 - N):
        if len(set(str(N + i))) == 1:
            print(N + i)
            exit()


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    N = input()
    rep = int('1' * len(N))
    ans = rep
    while ans < int(N):
        ans += rep
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = [999, 888, 777, 666, 555, 444, 333, 222, 111, 0]
for i, m in enumerate(a):
    if n <= m:
        continue
    else:
        print(a[i - 1])
        break

Submission status: Accepted

Solution code:
n = int(input())

for i in '123456789':
	if int(i * 3) >= n:
		print(i * 3)
		break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

for i in range(len(contest_list)):
    if (N <= contest_list[i]):
        ans = contest_list[i]
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
e=[]
for i in range(1,10):
  e.append(int(str(i)*3))
n=int(input())
for i in range(9):
  if n<=e[i]:
    print(e[i])
    exit()

Submission status: Accepted

Solution code:
n=int(input())

na = str(n)

n1 = na[0]

if int(n1*len(na)) >= n:
    print(int(n1*len(na)))
else:
    n1n = int(n1)+1
    n1n = str(n1n)
    print(n1n*len(na))

Submission status: Accepted

Solution code:
import sys
n = int(input())

for i in range(1,10):
    if n <= 111*i:
        print(111*i)
        sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

for i in range(n,1000):
    i = str(i)
    if i[0] == i[1] == i[2]:
        print(int(i))
        break
    else:
        pass

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    s=STR()
    temp=str((int(s[0])+1))*3
    ct=int(temp)-int(s)
    #print(ct)
    if 0<=ct<=110:
        print(temp)
    else:
        temp=s[0]*3
        print(temp)
    
    
if __name__ == '__main__':
    do()

Submission status: Accepted

Solution code:
n = int(input())
while True:
    if len(set(str(n))) == 1:
        break
    else:
        n += 1
print(n)

Submission status: Accepted

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

Submission status: Accepted

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

#----------
N = int(input().strip())
#----------

for i in range(N,1000):
    s = str(i)
    if s.count( s[0]) == len(s):
        print(i)
        break

Submission status: Accepted

Solution code:
N = int(input())
for i in range(9):
    if 111 * i < N and N <= 111 * (i + 1):
        print(111 * (i + 1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=[99,111,222,333,444,555,666,777,888,999,1000]
for i in range(len(a)-1):
    if n==a[i]:
        print(n)
        break
    if a[i]<n<a[i+1]:
        print(a[i+1])
        break

Submission status: Accepted

Solution code:
N = input()
inp = list(N)
final = ''

for i in range(3):
    final += inp[0]
final = int(final)
if final < int(N):
    final += 111
    print(final)
else:
    print(final)

Submission status: Accepted

Solution code:
n = int(input())
answer = 0
while answer < n:
  answer += 111
  
print(answer)

Submission status: Accepted

Solution code:
N = int(input())

for i in range(N, 1000):
    if i % 10 == (i // 10) % 10 == (i // 10 // 10) % 10:
        print(i)
        exit()

Submission status: Accepted

Solution code:
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

N = ni()
ans = 0
for i in range(N, 1000):
    s = str(i)
    flag = True
    for j in range(len(s) - 1):
        if s[j] != s[j + 1]:
            flag = False
    if flag:
        ans = i
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
for i in range(1,10):
	ans=i*100+i*10+i
	if ans>=N:
		print(ans)
		exit()

Submission status: Accepted

Solution code:
n = int(input())
for i in range(10):
  if n <= i * 111:
    print(i * 111)
    break;

Submission status: Accepted

Solution code:
N = str(input())
#100-999
hundred=N[0]
ten=N[1]
one=N[2]

if hundred>ten:
    x=int(hundred+hundred+hundred)
elif hundred<ten:
    x=int(str((int(hundred)+1))+str((int(hundred)+1))+str((int(hundred)+1)))
else:
    if ten>=one:
        x=int(hundred+hundred+hundred)
    else:
        x=int(str((int(hundred)+1))+str((int(hundred)+1))+str((int(hundred)+1)))
print(x)

Submission status: Accepted

Solution code:
n=int(input())

if 100<=n<=111:
            print(111)
a=0
for a in range(1,9):
            if 1+111*a<=n<=111*(a+1):
                        
                        print(111*(a+1))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
x=1000;p=-1
S=[111,222,333,444,555,666,777,888,999]
for i in range(len(S)):
  if S[i]-N>=0:
    if x>(S[i]-N):
      p=i
      x=S[i]-N
print(S[p])

Submission status: Accepted

Solution code:

N = input()

if N[0] == N[1] and N[1] == N[2]:
    print(N)
else:
    
    while(N[0]!=N[1] or N[1]!=N[2]):
        N = int(N)
        N+=1
        N = str(N)
    print(N)

Submission status: Accepted

Solution code:
#111_B
N=int(input())
print(-(-N//111)*111)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
ans=N
while(True):
  if len(set(list(str(ans))))==1:
    print(ans)
    break
  else:
    ans+=1

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

for i in range(N, 1000):
  s = str(i)
  if s[0] == s[1] and s[1] == s[2]:
    print(s)
    break

Submission status: Accepted

Solution code:
N = int(input())

for i in range(N, 1000):
    if str(i)[0] == str(i)[1] == str(i)[2]:
        print(i)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = N//100
b = (N-(100*a))//10
c = N-(100*a+10*b)
if a == b == c:
    ans = N
elif a==b>c:
    ans = 111*(a)
elif a==b<c:
    ans = 111*(a+1)
elif a > b:
    ans = 111*a
elif a < b:
    ans = 111*(a+1)
print(ans)

Submission status: Accepted

Solution code:
S = input()
if len(set(S)) == 1:
    print(S)
    exit()
for i in range(int(S), 1000):
    if len(set(str(i))) == 1:
        print(i)
        exit()

Submission status: Accepted

Solution code:
n=input()
for i in range(9):
  if 111*i < n <= 111*(i+1):
    print 111*(i+1)
    break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
if N % 111 == 0:
  print(N)
for i in range(10):
  if N % 111 != 0 and N // 111 == i:
    print(111 * (i + 1) )

Submission status: Accepted

Solution code:
n=int(input())

for i in range(1,10):
    if n<=111*i:
        print('{0}{1}{2}'.format(i,i,i))
        break

Submission status: Accepted

Solution code:
n = int(input())
while True:
    if len(set(list(str(n)))) == 1:
        print(n)
        exit()
    else:
        n += 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
n = int(N)
h = int(N[0])

if h == 9:
    print(999)
else:
    if n > h * 111:
        h += 1
    print(h*111)

Submission status: Accepted

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

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

Submission status: Accepted

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


def main():
    N = input()
    if int(N[0] * len(N)) >= int(N):
        print(N[0] * len(N))
    else:
        print(str(int(N[0]) + 1) * len(N))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = list(input())
n = [int(i) for i in n] 
if n[0]>n[1] or (n[0]==n[1] and n[0]>=n[2]):
    print(str(n[0])*3)
elif n[0]<n[1] or (n[0]==n[1] and n[0]<n[2]):
    print(str(n[0]+1)*3)

Submission status: Accepted

Solution code:
import bisect
n = int(input())
a = [0,111,222,333,444,555,666,777,888,999]
s = bisect.bisect_left(a,n)
print (a[s])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(111 * (N//111 + 1))

Submission status: Accepted

Solution code:
N=int(input())
a=N//100
b=(N-a*100)//10
c=N-a*100-b*10
if a<b:
    N=(a+1)*111
elif a>b:
    N=a*111
elif a==b and a>=c :
    N=a*111
elif a==b and a<c :
    N=(a+1)*111
print(N)

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 = list(input())
s = N[0]
n = int(''.join(N))

if int(N[0]*3) >= n:
    print(N[0]*3)
else:
    print(str(int(N[0])+1)*3)

Submission status: Accepted

Solution code:
def onaji(n):
    l = []
    while n > 0:
        l.append(n%10)
        n = n//10
    if l[0] == l[1] == l[2]:
        return True
    else:
        return False
    
N = int(input())
while not(onaji(N)):
    N += 1
    
print(N)

Submission status: Accepted

Solution code:
n = input()

n100 = n[0]
n10 = n[1]
n1 = n[2]

if int(n) <= int(n100 + n100 + n100):
  print(int(n100 + n100 + n100))
else:
  print((int(n100) + 1) * 111)

Submission status: Accepted

Solution code:
n=int(input())
for i in range(n,1000):
	if str(i)[0]==str(i)[1]==str(i)[2]:
		print(i)
		exit(0)
	else:
		pass
print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
for i in range(n,1000):
  if str(i).count(str(i)[0])==3:
    print(i)
    break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input_methods=['clipboard','file','key']
using_method=2
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	a = int(input())
	for i in range(10):
		if a <= i*111:
			return i*111
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

Solution code:
n = input()
i = int(n[0])

if(n[1] < n[0]):
    print(n[0]+n[0]+n[0])
elif(n[1] == n[0]):
    if(n[2] <= n[0]):
        print(n[0]+n[0]+n[0])
    else:
        print((i+1)*100+(i+1)*10+(i+1))
else:
    print((i+1)*100+(i+1)*10+(i+1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = str(n)

if s[0] == s[1] and s[0] == s[2]:
    print(s)
else:
    while s[0] != s[1] or s[0] != s[2]:
        n += 1
        s = str(n)
        
    print(s)

Submission status: Accepted

Solution code:
N = list(input())
l  = len(N)
frst = int(N[0])
res = [str(frst)]*l
res = ''.join(res)
if int(res) >= int(''.join(N)):
	print(res)
else:
	print(int(''.join([str(int(frst)+1)]*l)))

Submission status: Accepted

Solution code:
N = int(input())
ls = []
for i in range(N,1000):
  if i % 111 == 0:
    ls.append(i)
print(ls[0])

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

print(-(-N//111) * 111)

Submission status: Accepted

Solution code:
n = int(input())
i = n // 111

if n % 111 != 0:
	i += 1

print(i * 111)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
import math
N=int(input())

print(math.ceil(N/111)*111)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
while n <= 999 :
  if list(str(n)[0]) == list(str(n)[1]) == list(str(n)[2]):
    print(n)
    exit()
  else:
    n += 1

Submission status: Accepted

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

for i in range(1, len(x)):
    if x[i-1] < N <= x[i]:
        print(x[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

for i in range(N, 1000):
    if i % 111 == 0:
        zorome = i
        break

print(zorome)

Submission status: Accepted

Solution code:
# EASY!数値をintでリスト化する方法を学んだ

n = int(input())
l = list(map(int,list(str(n))))
#print(l)
x = int(str(l[0])+str(l[0])+str(l[0]))
y = int(str(l[0]+1)+str(l[0]+1)+str(l[0]+1))

if n <= x:
    print(x)
else:
    print(y)

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int,list(str(n))))
#print(l)
x = int(str(l[0])+str(l[0])+str(l[0]))
y = int(str(l[0]+1)+str(l[0]+1)+str(l[0]+1))

if n <= x:
    print(x)
else:
    print(y)

Submission status: Accepted

Solution code:
def good_contest(num):
  return len(set(str(num))) == 1


def find_good_contest(next_contest):
  while not good_contest(next_contest):
    next_contest += 1
  return next_contest


def main():
  print(find_good_contest(int(input())))
  
  
if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
x = n[0]*3
print(int(x)+111 if n>x else int(x))

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

Solution code:
import sys
import math
import itertools

n=int(input())
while True:
	if n%111==0:
		print(n)
		sys.exit()
	n+=1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 22, Jan, 2020
"""

import sys
import itertools
import numpy as np

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

N = int(readline())
for i in range(111,1000,111):
    if N<=i:
        print(i)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=input()
n=int(N)
head=N[0]
tmp=int(head*3)
if n>tmp:
  t=str(int(head)+1)
  print(t*3)
else:
  print(tmp)

Submission status: Accepted

Solution code:
for i in range(int(input()), 1000):
  if i//100 == (i//10)%10 == i%10:
    print(i)
    break

Submission status: Accepted

Solution code:
N  = [list(map(int, s.split()))[0] for s in open(0)][0]

while True:
    if str(N)[0] == str(N)[1] and str(N)[1] == str(N)[2]:
        break 
    N += 1
        
print(N)

Submission status: Accepted

Solution code:
n = int(input())
answer = 0
while answer < n:
    answer += 111
print(answer)

Submission status: Accepted

Solution code:
N = int(input())

n = N
while (str(n)[0] != str(n)[1]) or (str(n)[1] != str(n)[2]):
    n += 1
ans = n
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

n = N
for i in range(1000):
    if str(n)[0] == str(n)[1] == str(n)[2]:
        ans = n
        break
    n += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    print(-(-N//111)*111)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#python3
from collections import Counter
n = int(input())
a = [str(i) for i in range(100, 1000) if len(Counter(str(i))) == 1]
for i in a:
    if n <= int(i):
        print(i)
        break

Submission status: Accepted

Solution code:
N = int(input())

n = N // 100
ans = n + n*10 + n*100

if N <= ans:
    print(ans)
else:
    print(ans + 111)

Submission status: Accepted

Solution code:
N = int(input())

ans = -(-N // 111) * 111

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
if not (N % 111):
    print(N)
    exit(0)
for i in range(10):
    if i * 111 < N and (i + 1) * 111 >= N: print((i + 1) * 111)

Submission status: Accepted

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

if int(''.join([n[0],n[0],n[0]])) < int(''.join(n)):
  print(int(''.join([n[0],n[0],n[0]]))+111)
else:
  print(int(''.join([n[0],n[0],n[0]])))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
for i in range(12):
  if 111*(i+1) >= n:
    print(111*(i+1))
    exit()

Submission status: Accepted

Solution code:
n=input()
while 1:
    for i in range(len(n)-1):
        if n[i]!=n[i+1]:
            n=str(int(n)+1)
            break
    else:
        print(n)
        break

Submission status: Accepted

Solution code:
n=input()
x=[]
for i in range(len(n)):
    x.append(int(n[i]))
if x[0]>=x[1] and x[0]>=x[2]:
    for i in range(3):
        print(x[0], end='')
else:
    for i in range(3):
        print(x[0]+1, end='')

Submission status: Accepted

Solution code:
import sys

INPUT = lambda: sys.stdin.readline().rstrip()

sys.setrecursionlimit(10 ** 9)


def main():
    N = INPUT()
    low = str(int(N) // 100)
    high = str(int(N) // 100 + 1)

    for i in range(1, 3):
        if int(N[i]) < int(low): 
            print(low * 3)
            sys.exit()
        if int(N[i]) > int(low): 
            print(high * 3)
            sys.exit()
        if int(N[i]) == int(low) and i == 2: 
            print(low * 3)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
 
while True:
  s = str(n)
  if s.count(s[0])==len(s):
    print(n)
    exit()
  else:
    n += 1

Submission status: Accepted

Solution code:
N=int(input())
x=-(-N//111)
print(100*x + 10*x + x)

Submission status: Accepted

Solution code:
N=int(input())
x=-(-N//111)
print(int(100*x + 10*x + x))

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:
import math
i = int(input())
print(111*int(math.ceil(i/111)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

if n in ans_list:
    print(n)
else:
    for i in range(999):
        if n in ans_list:
            print(n)
            break
        n+=1

Submission status: Accepted

Solution code:
n = int(input())

for i in range(n, 1000):
   c = str(i)
   if (c[0] == c[1] and c[1] == c[2]):
      print(i)
      break

Submission status: Accepted

Solution code:

n = int(input())
a = 0

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
s=int(input())
A=[111,222,333,444,555,666,777,888,999]
for i in A:
  if i-s>=0:
    print(i)
    exit()

Submission status: Accepted

Solution code:
N=int(input())
while True:
  S=list(str(N))
  for i in range(1,len(S)):
    if S[i]==S[i-1]:
      continue
    else:
      break
  else:
    print(N)
    break
  N+=1

Submission status: Accepted

Solution code:
N = int(input())
NS = str(N)

st = int(NS[0] * 3)
if N <= st:
  print(st)

else:
  print(st + 111)

Submission status: Accepted

Solution code:
n = int(input())
if n % 111 == 0:
    x = n
while n % 111 != 0:
    x = n+1
    n += 1

print(x)

Submission status: Accepted

Solution code:
import sys

n = int(sys.stdin.readline().rstrip())

def main():
    return 111 * ((n + 111 - 1) // 111)

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = input()

N_0 = int(N[0])
if N_0 * 10 + N_0 >= int(N[1:]):
    print(str(N_0) * 3)
else:
    print(str(N_0+1) * 3)

Submission status: Accepted

Solution code:
N = int(input())

n = int( (N-1) / 111 )

print( 111 * (n+1) )

Submission status: Accepted

Solution code:
n=int(input())
for i in range(111):
  a=n+i
  b=set(str(a))
  if len(b)==1:
    print(a)
    exit()

Submission status: Accepted

Solution code:
n = int(input())

for i in range(n,1000):
    
    s = list(str(i))
    if s[0] == s[1] == s[2]:
        break    

print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
for i in range(1, 10):
    x = i*100+i*10+i
    if N - x <= 0:
        print(x)
        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())
a = n//111
if n % 111 != 0:
    a += 1
print(a*111)

Submission status: Accepted

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

a=bisect.bisect_left(li,n)

print((a+1)*111)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=input()
if N[0]==N[1]==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:
import sys
input = sys.stdin.readline
N = int(input())
d = 10000
index = 0
for i in range(1,10) :
    k = i * 100 + i * 10 + i
    if k < N :
        continue
    else :
        de = abs(N - k)
        if d > de :
            d = de
            index = k
print(index)

Submission status: Accepted

Solution code:
N = input()
A = int(N[0])*111
print((int(N[0])+1)*111 if int(N) > A else A)