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: Wrong Answer

Solution code:
n=int(input())
c=111
while True:
    if n<=c:
        print(c)
        break
    c=c<<1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
input = sys.stdin.readline
N = int(input())
ans = [111,222,333,444,555,666,777,888,999]
for i in ans:
    if i >= N:
        print(ans)
        sys.exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=int(input())
b=[0]
for i in range(1,10):
  if a<=111*i:
    b.append(a)
print(max(b*111))

Submission status: Wrong Answer

Solution code:
a=int(input())
b=[]
for i in range(1,10):
  if a<=111*i:
    b.append(a)
print(max(b))

Submission status: Wrong Answer

Solution code:
a=int(input())
b=[]
for i in range(1,10):
  if a<=111*i:
    b.append(a)
print(min(b))

Submission status: Wrong Answer

Solution code:
##### 解けた #####

N=int(input())
ns=N//100*100+N//100*10+N//100
print("N = ",N,"".join([str(N//100+int(N>ns))]*3))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = N
for i in range(200):
  if str(ans)[0] == str(ans)[1] and str(ans)[1] == str(ans)[2]:
    print(ans)
    break
  else:
    ans += i

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = N
for i in range(200):
  if str(ans)[0] == str(ans)[1] and str(ans)[1] == str(ans)[2]:
    print(ans)
    break
  else:
    ans += i
    pass

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = list(input())
if N[0] == N[1] == N[2]:
    print("".join(N))
else:
    print(max(N)*3)

Submission status: Wrong Answer

Solution code:
n = input()
print(max(n)*3)

Submission status: Wrong Answer

Solution code:
# ABC 111: B – AtCoder Beginner Contest 111
print(max(list(input())) * 3)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
s = stdin.readline().rstrip()
ma = 0
for i in s:
    ma = max(ma,int(i))

print(len(s)*str(ma))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
N = int(input())
l = np.array([111, 222, 333, 444, 555, 666, 777, 888, 999])
print(l<N)
ind = sum(l < N)
print(l[ind])

Submission status: Wrong Answer

Solution code:
n = input()
one = list(n)[0]
base = int(one) * 111
if int(n) > base:
  print(int(n)+111)
else:
  print(base)

Submission status: Wrong Answer

Solution code:
n = input()
one = list(n)[0]
base = int(one) * 111
if int(n) > base:
  print(int(n)+111)
else:
  print(int(n))

Submission status: Wrong Answer

Solution code:
N = list(map(int,input()))
print(max(N)*111)

Submission status: Wrong Answer

Solution code:
N = int(input())

for n in range(N, 999):
    str_n = str(n)
    if str_n[0] == str_n[1] and str_n[1] == str_n[2]:
        print(n)
        break
    else:
        pass

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
sam = [j*100+j*10+j for j in range(1,10)]

for k in range(len(sam)):
  if x>sam[k] and x<sam[k+1]:
    print(sam[k+1])
    break
  elif x==sam[k]:
    print(sam[k])
    break
  else:
    print(sam[0])
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
sam = [j*100+j*10+j for j in range(1,10)]

for k in range(len(sam)):
  if x>sam[k] and x<sam[k+1]:
    print(sam[k+1])
    break
  elif x==sam[k]:
    print(sam[k])
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()
if n[0] == n[1] == n[2]:
  print(n)
else:
    x = (max(n))
    ans = x * 3
    print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
m = n // 100

if m == 1:
  print(222)
elif m == 2:
  print(333)
elif m == 3:
  print(444)
elif m == 4:
  print(555)
elif m == 5:
  print(666)
elif m == 6:
  print(777)
elif m == 7:
  print(888)
elif m == 8:
  print(999)
else:
  print(1111)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    N = input()
    hun = N[0]
    hikaku = int(hun + hun + hun)
    N = int(N)
    if(hikaku >= N):
        print(N)
        return 
    
    new_hun = str(int(hun) +1)
    print(new_hun + new_hun + new_hun)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
print(max(set([s for s in S]))*len(S))

Submission status: Wrong Answer

Solution code:
n = list(input())
#print(n)
next_num = int(n[0])
nene_num = int(n[0]) + 1
if n[0] == n[1] and n[1] == n[2]:
 #   print("test")
    print(n[0] + n[1] + n[2])
elif int(n[0]) < int(n[1]) and int(n[0]) < int(n[2]):
    print(next_num*100 + next_num *10 + next_num *1)
else:
  #  print("test2")
    print(nene_num*100 + nene_num *10 + nene_num *1)

Submission status: Wrong Answer

Solution code:
n = list(input())
#print(n)
next_num = int(n[0])
if n[0] == n[1] and n[1] == n[2]:
 #   print("test")
    print(n[0] + n[1] + n[2])
else:
  #  print("test2")
    print(next_num*100 + next_num *10 + next_num *1)

Submission status: Wrong Answer

Solution code:
n = list(input())
#print(n)
next_num = int(n[0]) + 1
if n[0] == n[1] and n[1] == n[2]:
 #   print("test")
    print(n[0] + n[1] + n[2])
else:
  #  print("test2")
    print(next_num*100 + next_num *10 + next_num *1)

Submission status: Wrong Answer

Solution code:
n = input()
ans = []
for i in range(len(n)):
    s = 100*int(n[i])+10*int(n[i])+int(n[i])
    ans.append(s)
for i in range(len(ans)):
    if ans[i]>=int(n):
        print(ans[i])
        break

Submission status: Wrong Answer

Solution code:
n = input()
ans = []
for i in range(len(n)):
    s = 100*int(n[i])+10*int(n[i])+int(n[i])
    ans.append(s)
print(max(ans))

Submission status: Wrong Answer

Solution code:
print(max(int(i) for i in input())*111)

Submission status: Wrong Answer

Solution code:
import sys
import math
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline


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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c = list(map(int, list(str(input()))))
if not (a == b and b == c):
    if (b >= a and c >= 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: Wrong Answer

Solution code:
a,b,c = list(map(int, list(str(input()))))
if not (a == b and b == c):
    if (b >= a and c >= 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: Wrong Answer

Solution code:
a,b,c = list(map(int, list(str(input()))))
if not (a == b and b == c):
    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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = list(input())
ls = []
for i in range(3):
  ls.append(int(n[i]))
for i in range(3):
  print(max(ls),end="")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = map(int,list(input()))
m = max(N)
print(m*100+m*10+m*1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = list(input())
li = [int(ni) for ni in n]
m = max(li)
print(str(m)*len(li))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
import sys

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

print((n//111)*111)

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

for i in range(1000):
  n += 1
  d3 = str(n)[0]
  d2 = str(n)[1]
  d1 = str(n)[2]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print((x+1)*111)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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)
print(out)
for i in range(len(out)):
    if out[i] >= N:
        print(out[i])
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()

list = []

list.append(str(int(N[0])-1)*3)
list.append(str(int(N[0]))*3)
list.append(str(int(N[0])+1)*3)

ans = 999
ctr = 999

for i in list:
  if int(N) - int(i) == 0:
    ans = int(i)
    break;
  elif int(i) - int(N) <= ans and int(i) - int(N) <= ctr:
    ans = int(i)
    ctr = int(N) - int(i)

print(ans)

Submission status: Wrong Answer

Solution code:
N = input()

list = []

list.append(str(int(N[0])-1)*3)
list.append(str(int(N[0]))*3)
list.append(str(int(N[0])+1)*3)

ans = 999

for i in list:
  if int(N) - int(i) == 0:
    ans = int(i)
    break;
  elif int(N) - int(i) <= ans:
    ans = int(i)
    
print(ans)

Submission status: Wrong Answer

Solution code:
N = input()

list = []

list.append(str(int(N[0])-1)*3)
list.append(str(int(N[0]))*3)
list.append(str(int(N[0])+1)*3)

ans = 999

for i in list:
  if int(N) - int(i) == 0:
    ans = int(i)
    break;
  elif int(N) - int(i) >= ans:
    ans = int(i)
    
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    N = input()
    
    ans = 0
    for n in N:
        if ans < int(n):
            ans = int(n)

    print(str(ans)*3)



main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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(n)
    else:
        print((1+int(a[0]))*111)
if a[0]<a[1]:
    print((1+int(a[0]))*111)

Submission status: Wrong Answer

Solution code:
N = int(input())


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

print(n//111 + 1)

Submission status: Wrong Answer

Solution code:
import math
import copy
import sys

def zorome(num):
    return int(111*num)

inputa = input().split()
# inputb = input().split()
# inputc = input().split()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

# inputaList = [int(n) for n in inputa]

# inputb = input().split()
# inputbList = [int(n) for n in inputb]
#
# inputList = []
# inputNumList = []
# for i in range(a):
#     inputNum = input().split()
#     inputNumList = list(inputNum[0])
#     inputList.append(inputNumList)

# inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

listNum = list(str(a))

if int(a) >= zorome(int(listNum[0])):
    print(zorome(int(listNum[0])))
else:
    print(zorome(int(listNum[0])+1))

Submission status: Wrong Answer

Solution code:

n = int(input())
for n in range(n, 999):
    if len(set(list(str(n)))) == 1:
        print(n)
        exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

n = N // 10 ** (len(str(N))-1)

x = 0
y = 0
for i in range(len(str(N))):
  x += 10 ** i * (n + 1)
  y += 10 ** i * n
print (x if y != N else y)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

if n <= 111:
    print(111)
    exit()

for i in range(111, 1000, 111):
    if i < n and n < i + 111:
        print(i + 111)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=input()
b,c,d=int(a[0]),int(a[1]),int(a[2])
if c<=d and b<=c:
    print(111*b)
else:
    print(111*(b+1))

Submission status: Wrong Answer

Solution code:
n=list(map(int,input()))
i=n[0]
  
if n[0]>=n[1]:
  n[1],n[2]=i,i
else:
  n[0],n[1],n[2]=i+1,i+1,i+1

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

Submission status: Wrong Answer

Solution code:
n=list(map(int,input()))
i=n[0]
if n[0]>=n[1]>=n[2]:
  n[1],n[2]=i,i
else:
  n[0],n[1],n[2]=i+1,i+1,i+1

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

Submission status: Wrong Answer

Solution code:
n = input()
max_i = 1
for i in n:
    if int(i) > max_i:
        max_i = int(i)
print(''.join(list(str(max_i)*len(n))))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

if n == 999:
    ans = 1111
else:
    if a < b:
        ans = (a+1)*100 + (a+1)*10 + a+1
    elif a == b:
        if c <= b:
            ans = a*100 + a*10 + a
        else:
            ans = (a+1)*100 + (a+1)*10 + a+1
    else:
        ans = a*100 + a*10 + a

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = ["111", "222", "333", "444", "555", "666", "777", "888", "999"]
print(ans[int(N/112)])

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n = S()
    for i in n:
        if i == "1":
            print(9, end="")
        else:
            print(1, end="")
    print()
    return

#B
def B():
    n = II()
    for i in range(111, 1000, 111):
        if n <= i:
            print(i)
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Wrong Answer

Solution code:
a,b,c=input();print((int(a)+(a<b+a<c))*111)

Submission status: Wrong Answer

Solution code:
a,b,c=input();print((int(a)+(a<b)+(a<c))*111)

Submission status: Wrong Answer

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

res = float("inf")
for x in n:
    ans = int(x)*111
    if ans < num:
        ans = (int(x)+1)*111
    if ans <= res:
        res = ans
print(res)

Submission status: Wrong Answer

Solution code:
n = int(input())

a = n // 100
if n < int(str(a) * 3):
    print(str(a) * 3)
else:
    print(str(a + 1) * 3)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=str(N)
a=int(S[0]+S[0]+S[0])
print(a if N>=a else a+111)

Submission status: Wrong Answer

Solution code:
N=int(input())
if N%111==0:
    print(N)
else:
    for i in range(8):
        if (i+1)*111-N>0:
            print((i+1)*111)
            break
        else:
            continue

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=input()

ans=int(N)//100

if N[0]==N[1]==N[2]:
    print(N)

elif N[0:1]<N[1:2]:
    print((ans+1)*100+(ans+1)*10+ans+1)
else:
    print(ans*100+ans*10+ans)

Submission status: Wrong Answer

Solution code:
N=input()

ans=int(N)//100

if N[0]==N[1]==N[2]:
    print(N)
elif N[0]>=N[1]:
    print(100*ans+10*ans+ans)
else:
    print(100*(ans+1)+10*(ans+1)+ans+1)

Submission status: Wrong Answer

Solution code:
N=input()

ans=int(N)//100

if N[0]==N[1]==N[2]:
    print(N)
elif N[0]>N[1]:
    print(100*ans+10*ans+ans)
else:
    print(100*(ans+1)+10*(ans+1)+ans+1)

Submission status: Wrong Answer

Solution code:
N=input()

ans=int(N)//100+1

if N[0]==N[1]==N[2]:
    print(N)
else:
    print(100*ans+10*ans+ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()

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

Submission status: Wrong Answer

Solution code:
n = input()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = list(input())
print(N[0]+N[0]+N[0])

Submission status: Wrong Answer

Solution code:
N = list(input())
print(max(N)*3)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n =input()
lst = []
for i in range(3):
    if (int(n[i]*3) not in lst) and int(n[i]*3)>=int(n):
        lst.append(int(n[i]*3))
print(min(lst))

Submission status: Wrong Answer

Solution code:
n=int(input())
p = int(n/100)
q = int((n-p*100)/10)
r = n-p*100-q*10

if p>=q and q>=r:
    print(p*111)
else:
    print((p+1)*111)

Submission status: Wrong Answer

Solution code:
n=int(input())
p = int(n/100)
q = int((n-p*100)/10)
r = n-p*100-q*10

if p>=q>=r:
    print(p*111)
else:
    print((p+1)*111)

Submission status: Wrong Answer

Solution code:
n=int(input())
p = int(n/100)
q = int((n-p*100)/10)
r = n-p*100-q*10

if p>q>r:
    print(p*111)
else:
    print((p+1)*111)

Submission status: Wrong Answer

Solution code:
nx = input('n?\n')
n=int(nx)
x=111
for i in range (111,n,111):
    x+=111
print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

N = input()
if N[0]==N[1]==N[2]:
    print(N)
else:
    if int(N[0]) > int(N[2]):
        print(N[0]*3)
    else:
        print(N[2]*3)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()
print(n[0]*3)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
print(N[0]*3) if int(N) < 998 else print(1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

a = 111 - (n % 111)
print(n+a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
a=n%100
if a==9:
    print(999)
else:
    ans=100*a+10*a+a
    if ans>=n:
        print(ans)
    else:
        print(ans+111)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
N = stdin.readline().rstrip()
print(N[0] * 3)

Submission status: Wrong Answer

Solution code:
n = input()
n1,n2,n3 = map(int,[n[0],n[1],n[2]])
if n1 >= n2 and n1 >= n3:
    ans = n1 * 100 + n1 * 10 + n1
else:
    n = max(n2,n3)
    ans = n * 100 + n * 10 + n
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
flag=n//100
a=flag*100+flag+10*flag
if flag < (n//10)%10:
  print(a+111)
else:
  print(a)