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:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    for i in range(n, 1000):
        b = True
        s = str(i)
        t = ""
        for j in range(len(s)):
            if t == "":
                t = s[j]
            else:
                if t != s[j]:
                    b = False
                    break
        if b:
            print(i)
            exit()


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import bisect
l=[111,222,333,444,555,666,777,888,999,1111]
n=int(input())
print(l[bisect.bisect_left(l,n)])

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

Submission status: Accepted

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

for i in A:
    if N==i:
        print(i)
        break
    elif N > i:
        continue
    elif N <= i:
        print(i)
        break

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    n = input().strip()
    if len(set(n)) == 1:
        print(n)
    elif int(n) < int(n[0] * 3):
        print(int(n[0] * 3))
    else:
        print(str(int(n[0]) + 1) * 3)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

n = int(input())

suitable = n
shouldGetOut = False
for i in range(n, 1000):
    if len(set(list(str(i)))) == 1:
        suitable = i
        shouldGetOut = True
    if shouldGetOut == True:
        break
print(suitable)

Submission status: Accepted

Solution code:
a,b,c = list(map(int, list(str(input()))))
if not (b <= a and c <= a):
    if (b > a) or (b == a and c > a):
        a += 1
b = a; c = a

ans = list(map(str, [a,b,c]))
print("".join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
res = 0
while N > res:
  res += 111
print(res)

Submission status: Accepted

Solution code:
n = int(input())

z = []
for i in range(1, 10):
    z.append(i * 100 + i * 10 + i)

for zi in z:
    if zi >= n:
        print(zi)
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = list(map(int, list(input())))
v1 = n[0] * 100 + n[1] * 10 + n[2] * 1
v2 = n[0] * 100 + n[0] * 10 + n[0] * 1
if v1 > v2:
    n[0] += 1
s = str(n[0])
print(''.join([s, s, s]))

Submission status: Accepted

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

Submission status: Accepted

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

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

cand_list = [100*i+10*i+i for i in range(1, 10)]
target_list = list(filter(lambda x:x>=n, cand_list))
print(min(target_list))

Submission status: Accepted

Solution code:
import sys

L = [111, 222, 333, 444, 555, 666, 777, 888, 999]
N = int(input())
for Li in L:
    if Li >= N:
        print(Li)
        sys.exit()

Submission status: Accepted

Solution code:
n = int(input())

n_100 = n//100
n_10 = (n - n_100 *100) // 10 
n_1 = n - n_100*100 - n_10*10

m = n_100 * 111

if m >= n:
  print(m)
else:
  print((n_100 +1) * 111)

Submission status: Accepted

Solution code:
N = int(input())
x = N
while x<1000:
    s = str(x)
    if s[0]==s[1]==s[2]:
        break
    x += 1
print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c=input()
if max(int(a),int(b),int(c)) == int(a):
    print(int(a+a+a))
else:
    print(int(a+a+a) + 111)

Submission status: Accepted

Solution code:
N = int(input())

for i in range(N, 1000):
    digit1 = i % 10
    digit2 = i // 10 % 10
    digit3 = i // 100
    if digit1 == digit2 == digit3:
        print(i)
        break

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N = int(input())
    for n in range(N, 1000):
        flag = True
        num = n
        d = n%10
        n = n//10
        while n != 0:
            if d == n%10:
                n = n//10
            else:
                flag = False
                break
        if flag:
            break
    print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
a,b,c = int(S[0]),int(S[1]),int(S[2])
if (a<b or a<c):
  ans = (a+1)*100+(a+1)*10+a+1
else :
  ans = (a)*100+(a)*10+a
print(ans)

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(111, 1000, 111):
    if n <= i:
        print(i)
        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)
elif 889<=N<=999:
  print(999)

Submission status: Accepted

Solution code:
a=int(input())
print(a+(a%111!=0)*111-a%111)

Submission status: Accepted

Solution code:
n=int(input())
if 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:
n =int(input())
a = n//100
b= 100*a+10*a+a

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

Submission status: Accepted

Solution code:
import sys


N = int(input())

for i in range(N, 1000):
    c1 = i // 100
    c2 = (i-c1*100) // 10
    c3 = (i-c1*100-c2*10)
    if c1 == c2 == c3:
        print(i)
        sys.exit()

Submission status: Accepted

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

if int(year[0])>=int(year[1]) and int(year[0])>=int(year[2]):
  year[1]=year[0]
  year[2]=year[0]
else:
  temp=int(year[0])+1
  year[0]=str(temp)
  year[1]=str(temp)
  year[2]=str(temp)
year=''.join(year)
print(year)

Submission status: Accepted

Solution code:
N = int(input())
n = list(filter(lambda x: x >= N, [111*i for i in range(1, 10)]))
print(n[0])

Submission status: Accepted

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

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:
n = int(input())

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

Submission status: Accepted

Solution code:
# ABC111b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())
ans = 111

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=str(input())
if n[0] == n[1] and n[1] == n[2]:
    print(n)
else:
    for i in [111,222,333,444,555,666,777,888,999]:
        if int(n) < i:
            print(i)
            quit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC111B - AtCoder Beginner Contest 111
def main():
    N = int(input())
    ans = (N + 110) // 111 * 111
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
nStr = input()
nTopNum = int(nStr[0])
nNum = int(nStr)
print(nNum if nNum % 111 == 0 else nTopNum *
      111 if nTopNum * 111 > nNum else (nTopNum + 1) * 111)

Submission status: Accepted

Solution code:
nStr = input()
nNum = int(nStr)
if nNum % 111 == 0:
    print(nNum)
else:
    print(int(nStr[0]) * 111 if int(nStr[0])
          * 111 > nNum else (int(nStr[0]) + 1) * 111)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
n=int(input())

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = list(input())
if max(a)==a[0]:
        print(a[0]*3)
elif min(a)==a[0]:
        print((int(a[0])+1)*111)        
elif max(a)==a[1]:
        print((int(a[0])+1)*111) 
elif max(a)==a[2] and a[0]<=a[1]:
        print((int(a[0])+1)*111)               
elif max(a)==a[2] and a[0]>a[1]:
        print(a[0]*3)

Submission status: Accepted

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

if int(N) > a:
    a += 111

print(a)

Submission status: Accepted

Solution code:
n = input()
current = n[0]
flag = False
for i in range(len(n)):
    # not doublet
    if n[i] != current:
        # and also the rest of number is bigger than the first one
        if n[i] > current:
            flag = True
            break
        # but the rest of the number is smaller than the first one
        else:
            n = current * 3
            break

if flag:
    x = int(current) + 1
    print(int(str(x) * 3))
else:
    print(n)

Submission status: Accepted

Solution code:
n = int(input())

for i in range(1000):

  d3 = str(n)[0]
  d2 = str(n)[1]
  d1 = str(n)[2]

  if (d1 == d2) and (d2 == d3):
    print(n)
    break
    
  n += 1

Submission status: Accepted

Solution code:
n = int(input())
for x in range(1, 10):
    x *= 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 or (a == b and b >= c):
  print(111*a)
else:
  print(111*(a+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 and b>=c) or a>b:
  print(a*100+a*10+a)
else:
  print((a+1)*100+(a+1)*10+a+1)

Submission status: Accepted

Solution code:
n = int(input())
a = n//100
A = a*100+a*10+a
if n > A:
  print(A+111)
else:
  print(A)

Submission status: Accepted

Solution code:
N = int(input())
x = (N-1) // 111

print((x+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()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
flag = 0
while flag == 0:
    if N // 100 == (N - N // 100 * 100) // 10 == (N - N // 10 * 10):
        flag += 1
        break
    N += 1
        
print(N)

Submission status: Accepted

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

N = input().split()
N = list(N[0])
#N=list(map(int,N))
if int(N[0]+N[0]+N[0]) >= int("".join(N)):
    print(int(N[0]+N[0]+N[0]))
else:
    print(int(N[0]+N[0]+N[0])+111)

Submission status: Accepted

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

N = int(input())
out = []
for i in range(1,10):
    out.append(i*100 + i*10 + i)
for i in range(len(out)):
    if out[i] >= N:
        print(out[i])
        exit()

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(9):
	if l[i]-n>=0:
		print(l[i])
		break

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*-coding: utf-8 -*-
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:
print(-int(input()) // 111*-111)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""#################################################################
【ABC111】
B_AtCoder_Beginner_Contest_111
#################################################################"""

#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = IS()
for i in range(int(N),999+1):
    if str(i).count(str(i)[0]) == 3:
        print(i)
        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())

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

Submission status: Accepted

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

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())
a=n//100
b=a*100+a*10+a
c=(a+1)*100+(a+1)*10+a+1
if n<=b:
    print(b)
else:
    print(c)

Submission status: Accepted

Solution code:
n = int(input())
while True:
    if n%10 == n//10%10 == n // 100:
        print(n)
        break
    else:
        n += 1

Submission status: Accepted

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

def main():
    N = int(input())
    for i in range(N,1000):
        if i//100 == i//10%10 == i%10:
            print(i)
            return

if __name__ == '__main__':
    main()

Submission status: Accepted

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

N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

for i in l:
    if N <= int(i):
        print(i)
        exit()

Submission status: Accepted

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

for n in L:
    if N <= n:
        print(n)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = input()
    tmp = int(N[0])
    if int(N[1]) > tmp:
        print("{}{}{}".format(tmp+1, tmp+1, tmp+1))
    elif int(N[1]) < tmp:
        print("{}{}{}".format(tmp, tmp, tmp))
    else:
        if int(N[2]) > tmp:
            print("{}{}{}".format(tmp+1, tmp+1, tmp+1))
        elif int(N[2]) <= tmp:
            print("{}{}{}".format(tmp, tmp, tmp))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
arr = [111 * k for k in range(10)]
for i in range(len(arr) - 1):
    if arr[i] < n <= arr[i+1]:
        print(arr[i+1])
        break

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
N = input()

c_list = [str(i) * 3 for i in range(1,10)]
ans_list = [int(x)-int(N) for x in c_list]

upper = 999

ans_index = 0
for i,x in enumerate(ans_list):
  if 0 <= x <= upper:
    ans_index = i
    upper = x
    
print(c_list[ans_index])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if x <= math.floor(x / 100) * 111:
  print(math.floor(x / 100) * 111)
else:
  print(math.ceil(x / 100) * 111)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n=list(input())
a=n[0]*len(n)
n1=0
for i in range(len(n)):
    n1+=int(n[i])*(10**(len(n)-1-i))
if int(a)<n1:
    n[0]=str(int(n[0])+1)
    print((n[0])*len(n))
else:
    print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
lst = [111,222,333,444,555,666,777,888,999]
lst.append(n)
newlst = sorted(lst)

print(newlst[newlst.index(n)+1])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#B - AtCoder Beginner Contest 111(ABC111)
N=input()
s=int(N[0])
S=3*str(s)
if int(N)>int(S):
    S=str(s+1)*3
print(S)

Submission status: Accepted

Solution code:
n=int(input())

for i in range(n, 999+1):
    if i%111==0:
        print(i)
        exit()

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())
if N < 111:
    print(111)
elif N % 111 == 0:
    print(N)
else:
    n = N // 111
    print((n + 1) * 111)

Submission status: Accepted

Solution code:
n = input()

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

print(n)

Submission status: Accepted

Solution code:
import sys
n = int(input())
for i in range(9):
    z = str(i+1)*3
    if n<=int(z):
        print(z)
        sys.exit()

Submission status: Accepted

Solution code:
s1 = input()
n1 = int(s1)
n2 = int(s1[0])

r1 = 0

if n1 <= ((n2 * 100) + (n2 * 10) + n2):
    r1 = (n2 * 100) + (n2 * 10) + n2
else:
    r1 = ((n2 + 1) * 100) + ((n2 + 1) * 10) + n2 + 1

print(r1)

Submission status: Accepted

Solution code:
n=int(input())
ans=111
while n>ans:
    ans+=111
else:
    print(ans)

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:
print((110+int(input()))//111*111)

Submission status: Accepted

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



main()

Submission status: Accepted

Solution code:
N = int(input())
a=1
while a*111<N:
  a+=1
print(a*111)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

N = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    while True:
        s = str(N)
        if len(set(list(s))) == 1:
            return int(s)
        else:
            N += 1
    

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

Submission status: Accepted

Solution code:
N=int(input())

x=0
for i in range(N,1000):
    x=str(i)
    if i/int(x[0])==111:
        print(x)
        break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in l:
  if(v <= i):
    print(i)
    exit()

Submission status: Accepted

Solution code:
n = int(input())

while True:
    numStr = list(str(n))
    if numStr[0] == numStr[1] == numStr[2]:
        print(n)
        break
    else:
        n += 1

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

def zorome(n):
	l = []
	while n > 0:
		l.append(n%10)
		n = n//10
	return l

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())



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

Submission status: Accepted

Solution code:
n = input()
h = int(n[0]) * 100
if int(n) - h == int(n[0] + n[0]):
    print(int(n))
elif int(n) - h < int(n[0] + n[0]):
    print(int(n[0]*3))
else:
    print(int(str(int(n[0])+1)*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 = input()
flag = False
while flag == False:
    # print(n)
    for i in range(len(n)-1):
        # print(i,n,n[i],n[i+1])
        if n[i] != n[i+1]:
            n = str(int(n) + 1)
            break
        # print('clear')

        if i == len(n)-2:
            # print(n)
            flag = True

print(int(n))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

def solve(s):
    if s[0] == s[1] and s[1] == s[2]:
        return True
    else:
        return False


for i in range(n, 1000):
    if solve(str(i)):
        print(i)
        break

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    while True:
        if len(set(str(n))) == 1:
            return n
        n += 1


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c=input()
print(int(a+a+a)) if int(a+a)>=int(b+c) else print(int(str(int(a)+1)*3))

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:
s=input()
x=int(s)
candidate1=int(s[0]+s[0]+s[0])
candidate2=str(int(s[0])+1)+str(int(s[0])+1)+str(int(s[0])+1)
if x <= candidate1:
    print(candidate1)
else:
    print(candidate2)

Submission status: Accepted

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