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:
MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)

def main():
    n = int(input())
    while True:
        if len(set(str(n))) == 1:
            break
        n += 1
    print(n)
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
x = int(str(n)[0])
y = x*100 + x*10 + x #100の位のゾロ目

if n <= y :
  print(y)
else:
  print(y+111)

Submission status: Accepted

Solution code:
C=[]
for i in range(1,10):
    C.append(i*111)

N = int(input())

for k in range(9):
    if N <= C[k]:
        print(C[k])
        break

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

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:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

while True:
  flag = False
  for i in range(len(str(n))-1):
    if str(n)[i] == str(n)[i+1]:
      flag = True
      
    elif str(n)[i] != str(n)[i+1]:
      flag = False
      break
  
 
  if flag:
    print(n)
    break
  n +=1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
C=[]
for i in range(1,10):
    C.append(i*111)
n=int(input())
now=0
while C[now]<n:
    now+=1
print(C[now])

Submission status: Accepted

Solution code:
from bisect import bisect_left, bisect_right
N = int(input())

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

ans =bisect_left(L,N)
print(L[ans])

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

print((0 - -n//111)*111)

Submission status: Accepted

Solution code:
n = input()
n0 = int(n[0])
n1 = int(n[1])
n2 = int(n[2])


if max(n0, n1, n2) == n0 or n2 >= n0 > n1:
    print(n[0]*3)
else:
    print(str(n0 + 1)*3)

Submission status: Accepted

Solution code:
N=int(input())
import math
print(math.ceil(N/111)*111)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

n = int(input())

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

print(111*i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
x = N[:1]*3
if N > x:
    ans = str(int(N[:1])+1)*3
else:
    ans = x
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=input()
zoro=int(N[0])*100+int(N[0])*10+int(N[0])
zoro_up=(int(N[0])+1)*100+(int(N[0])+1)*10+(int(N[0])+1)
if int(N)<=zoro:
    print(zoro)
else:
    print(zoro_up)

Submission status: Accepted

Solution code:
# ABC 111: B – AtCoder Beginner Contest 111
n = input()

n = '10' if len(n) == 1 else n

while len(set(n)) != 1:
    n = str(int(n) + 1)

print(n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# solution

data=int(input())
nim=data//100
if data<=nim*111:
    print(nim*111)
else:
    print((nim+1)*111)

Submission status: Accepted

Solution code:
n = int(input())

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

print(n)

Submission status: Accepted

Solution code:


def solve():

    N = int(input())
    for i in range(100, 1000):
        si = str(i)
        if N <= i:
            if si[0] == si[1] == si[2]:
                print(i)
                exit()


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
n = int(input())

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

print(n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

for i in range(1, 9):
  abc = 111 * i
  if n <= abc:
    print(abc)
    break
else:
  print(999)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

a = N[0]

def judge(N,a):
    pt = 0
    while pt < len(N):
        if int(N[pt]) < a:
            return False
        elif int(N[pt]) > a:
            return True
        else:
            pt += 1
    return False

ans = ""
if judge(N,int(a)):
    a = str(int(a)+1)
for i in range(len(N)):
    ans += a
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
for i in range(N,N+500,1):
    T=str(i)
    if T[0]==T[1]==T[2]:
        print(i)
        break
    else:
        continue

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
while len(set(str(N))) != 1:
    N += 1
print(N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N=int(input())
M=0
for i in range(999):
  n=str(N+i)
  if n[0]==n[1] and n[1]==n[2]:
    print(n)
    break

Submission status: Accepted

Solution code:
n = input()

if len(set(n)) == 1:
    print(n)
else:
    n = [c for c in n]
    if n[0] < n[1] or n[0] < n[2]:
        n = str(int(n[0])+1)
        print(n*3)
    elif n[0] >= n[1] and n[0] >= n[2]:
        print(n[0]*3)

Submission status: Accepted

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

while n not in ok:
    n += 1
    
print(n)

Submission status: Accepted

Solution code:
n = int(input())

while not (n%10 == (n//10)%10 == n//100):
    n += 1
    
print(n)

Submission status: Accepted

Solution code:
a=[111,222,333,444,555,666,777,888,999]
i=0
n=int(input())
while a[i]<n:
    i=i+1
print(a[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
from bisect import bisect_left

def main():
    n = II()
    cc = [111,222,333,444,555,666,777,888,999]
    print(cc[bisect_left(cc, n)])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())


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

Submission status: Accepted

Solution code:
n=input()
nn=n[0]*3
if n<=nn:print(nn)
else:print(chr(ord(n[0])+1)*3)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def Atcoder111(n):

    ans = ""

    if int(n[0]) > int(n[1]) or int(n[0]) == int(n[1]) >= int(n[2]):
        ans = n[0]*3
    else:
        ans = int(n[0]*3)
        ans += 111

    return ans

def main():
    n = str(input())
    print(Atcoder111(n))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a = int(input())
ans_list = []
for i in range(10):
    ans_list.append(111*i)
for i in range(10):
    if a > ans_list[i] and a <= ans_list[i+1]:
        print(ans_list[i+1])

Submission status: Accepted

Solution code:
N = int(input())

res = 0
for i in range(11):
    if i == 10:
        tmp = 1111
    else:
        tmp = i * 111
    if tmp >= N:
        res = tmp
        break
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = ['111','222','333','444','555','666','777','888','999']
for i in range(n, 1000):
    if str(i) in s:
        print(i)
        break

Submission status: Accepted

Solution code:
N = input()


def main():

    if int(N) % 111 == 0:
        print(N)
        return

    cnt = int(N)
    while True:
        if cnt % 111 == 0:
            print(cnt)
            return
        cnt += 1


main()

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

Submission status: Accepted

Solution code:
n = input()

hendred = n[0]
jadgeNumString = n[0]*3
jadgeNum = int(jadgeNumString)

if int(n) <= jadgeNum:
    print(jadgeNum)
else:
    print(jadgeNum + 111)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
list = [111, 222, 333, 444, 555, 666, 777, 888, 999]

n = int(input())
ans={}
for i in list:
    if i-n>=0:
        ans[i]=(i - n)
print(min(ans))

Submission status: Accepted

Solution code:
n=int(input())
num=str(n)[0]*3

if n<=int(num):
  print(num)
  
else:
  print(int(num)+111)

Submission status: Accepted

Solution code:
a=input()


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

        if  a[0]==a[1] and a[1]==a[2]:
            print(a)
            break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
if int(N[0]) > int(N[1]) or (int(N[0]) == int(N[1]) >= int(N[2])):
    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:
#ABC-111-B
N = int(input())
ans = N
while True:
    if N % 111 == 0:
        ans = N
        print(ans)
        break
    N += 1

Submission status: Accepted

Solution code:
N = int(input())
if N<=111:
  print(111)
l=111
r=222
for _ in range(8):
  if N>l and N<=r:
    print(r)
  l+=111
  r+=111

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
for i in range(1112):
    s = list(str(i))
    t = list(Counter(s).items())
    if len(t) == 1 and i >= n:
        print(i)
        quit()

Submission status: Accepted

Solution code:
N=int(input())
ans=ju=0
for i in range(0,1000,111):
  if(i>N):
    print(i)
    break
  elif(i==N):
    print(i)
    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())

while True:
  # 1種類の文字しか使われない場合が答え
  if len(set(str(N)))==1:
    print(N)
    break

  # 次の数へ
  N+=1

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 = input()
if s[0] >= s[1] and s[0] >= s[2]:
    print(s[0] * 3)
else:
    print(str(int(s[0]) + 1) * 3)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(n_str)

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())
m=n//100
N=m+(m*10)+(m*100)
if N<n:
    print(N+111)
else :
    print(N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

a=N//100
if N>a*100+a*10+a:
    print((a+1)*100+(a+1)*10+a+1)
else:
    print(a*100+a*10+a)

Submission status: Accepted

Solution code:

import math
import itertools
import statistics
#import collections

#n =  list(map(int, input().split()))
s = int(input())
ABC =[111, 222, 333, 444, 555, 666, 777, 888, 999]
for i in range(len(ABC)):
    if s <= ABC[i]:
        print(ABC[i])
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
if len(set(list(n)))==1:
    print(n)
else:
    num = int(n[0])+int(n[0])*10+int(n[0])*100
    if int(n) < num:
        print(num)
    else:
        print(num+111)

Submission status: Accepted

Solution code:
n = input()
if len(set(list(n)))==1:
    print(n)
else:
    num = int(n[0])+int(n[0])*10+int(n[0])*100
    if int(n) < num:
        print(num)
    else:
        print(num+111)

Submission status: Accepted

Solution code:
N = int(input())

for i in range(0, 1000, 111):
    if i >= N:
        print(i)
        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//100 == (i//10)%10 == i%10:
    print(i)
    break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
while True:
   if(n == 111 or n == 222 or n == 333 or n == 444 or n == 555 or n == 666 or n == 777 or n == 888 or n == 999):
       print(n)
       exit()
   else:
       n += 1

Submission status: Accepted

Solution code:
N=int(input())

judge=False

while judge==False:
    base=str(N)[0]
    judge=True
    for n in str(N):
        if n==base:
            pass
        else:
            judge=False
            N+=1
            break
print(N)

Submission status: Accepted

Solution code:
N=int(input())
for i in range(N,1112):
  str_i=str(i)
  if all(str_i[i]==str_i[0] for i in range(1,len(str_i))):
    print(i)
    break

Submission status: Accepted

Solution code:
n = int(input())

result = 1111
for i in range(1, 10):
    a = i*100 + i*10 + i
    if a >= n:
        result = a
        break

print(result)

Submission status: Accepted

Solution code:
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

def main():
    N = int(input())
    while len(Counter(str(N))) != 1:
        N += 1
    print(N)


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

judge = 111
ans = 1000

for i in range(9):
    if judge >= N:
        ans = min(ans,judge-N)  
    judge += 111
    
print(ans+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)
elif n <= 999:
    print(999)
else:
    print(1111)

Submission status: Accepted

Solution code:
n=int(input())
for i in range(n,999+1):
    s=str(i)
    if s[0]==s[1] and s[1]==s[2]:
        print(i)
        import sys
        sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
N = int(input().strip())

xs = [int(str(i) * 3) for i in range(1, 10)]
for x in xs:
    if N <= x:
        print(x)
        break
    else:
        continue

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

#入力
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(n, 1000):
    s = str(i)
    if s[0] == s[1] == s[2]:
        print(i)
        exit()

Submission status: Accepted

Solution code:
n = int(input())
ans = 111
print([111*i for i in range(1, 10) if 111*i>=n][0])

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:
import sys

N = int(input())

for n in range(N, 1000):
    if (str(n)[0] == str(n)[1]) and (str(n)[1] == str(n)[2]):
        print(n)
        sys.exit()

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
N = input()
s = N[0] * 3
if s < N: s = chr(ord(N[0]) + 1) * 3
print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
def ceil(n): # ceiling関数
    if n > int(n):
        return(int(n)+1)
    else:
        return(int(n))
print(ceil(N/111)*111)

Submission status: Accepted

Solution code:
n = int(input())

while True:
    if len(set([i for i in str(n)])) == 1:
        print(n)
        break
    n += 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

l = [100, 10, 1]

n100 =  n // 100
n10 = (n - n100 * 100) // 10
n1 = (n - n100 * 100 - n10 * 10)

if n100 > n10:
    print(int(str(n100) * 3))
elif n100 < n10:
    print(int(str(n100 + 1) * 3))
else:
    if n10 > n1:
        print(int(str(n100) * 3))
    elif n10 < n1:
        print(int(str(n100 + 1) * 3))
    else:
        print(n)

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

def ok(n):
    s=str(n)
    for i in range(len(s)):
        if(s[i]!=s[0]):return False
    return True

n=int(input())
while(1):
    if(ok(n)):
        print(n)
        break;exit();
    n+=1

Submission status: Accepted

Solution code:
n = int(input())
x = 111
for _ in range(10):
    if n <= x:
        print(x)
        exit(0)
    x += 111

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(int(s))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
l = [111,222,333,444,555,666,777,888,999]
if N <= 111:
    print(111)
else:
  for i in range(8):
    if l[i] < N <= l[i+1]:
      print(l[i+1])
      exit()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
import sys


def main():
    anss = [111, 222, 333, 444, 555, 666, 777, 888, 999]
    n = int(input())
    for ans in anss:
        if ans >= n:
            print(ans)
            sys.exit(0)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

while True:
    if len(set(str(N))) == 1:
        print(N)
        exit()
    N += 1

Submission status: Accepted

Solution code:
#abc111 b
ans=[111,222,333,444,555,666,777,888,999,1111]
n=int(input())
for i in ans:
    if i>=n:
        print(i)
        break

Submission status: Accepted

Solution code:
l = list(map(int,input()))
#print(l)
if l[0] <l[1]:
  a= str(l[0]+1)
  print(a*3)
elif l[0]>l[1]:
  print(str(l[0])*3)
else:
  if l[1] >= l[2]:
    print(str(l[0])*3)
  else:
    b= str(l[0]+1)
    print(b*3)

Submission status: Accepted

Solution code:
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.readline().rstrip())
    print((((N-1)//111)+1)*111)


if __name__ == '__main__':
    main()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 999
for i in range(1, 9):
    val = i * 111
    if val >= n:
        ans = min(ans, val)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
while n % 111:
    n += 1
print(n)

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 = input()
if N[1] < N[0]:
  n = int(N[0])
  print(n + n*10 + n*100)
elif N[1]==N[0] and N[2] <= N[1]:
  n = int(N[0])
  print(n + n*10 + n*100)
else:
  n = int(N[0])+1
  print(n + n*10 + n*100)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
sav = n 
while n % 111 != 0:
        n = (n // 100) * 111
        if n < sav:
            n += 111
print(n)

Submission status: Accepted

Solution code:
n = input()

first = n[0]
length = len(n)
guess = int(''.join([first]*length))

if guess >= int(n):
    print(guess)
else:
    next = int(first)+1
    guess = int(''.join([str(next)]*length))
    print(guess)

Submission status: Accepted

Solution code:
N = input()

length = len(N)
target0 = N[0]*length
target1 = str(int(N[0])+1)*length

if int(target0) >= int(N):
  print(int(target0))
else:
  print(int(target1))

Submission status: Accepted

Solution code:
N = int(input())

targets = [int(str(i) * 3) for i in range(1, 10)]
diff = list(map(lambda x: x - N, targets))
print(N + min([d for d in diff if d >= 0]))