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 = input()
mx = 0
for i in range(3):
    if int(n[i]) > mx: 
        mx = int(n[i])
print(str(mx)*3)

Submission status: Wrong Answer

Solution code:
n_list=list(input())

n=[int(i) for i in n_list]

ans=str(n[0]+1)*3

if n[0]>=n[1]:
    if n[1]>=n[2]:
        ans=str(n[0])*3
        
print(ans)

Submission status: Wrong Answer

Solution code:
N=input()
n=list(set(N))
L=len(N)
l=len(n)
x=[]
for i in range(l):
    if int(n[i]*L)>=int(N):
        x.append(int(n[i]*L))
print(min(x))

Submission status: Wrong Answer

Solution code:
# import math
# import statistics
a=int(input())
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#     c.append(i)
#e1,e2 = map(int,input().split())
#f = list(map(int,input().split()))
#g = [input() for _ in range(a)]

z = a//9
af= a%9
if af==0:
    print(str(9)*(z))

else :
    print(str(af)*(z+1))

Submission status: Wrong Answer

Solution code:
n = list(input())
t = sorted(n, reverse=True)[0]
print(str(t)*3)

Submission status: Wrong Answer

Solution code:
n=input()
l=len(n)
k=0
for i in range(l):
    for j in range(i,l):
        if n[i]!=n[j]:
            k=1
            
if k==1:
    if n[0]>n[1]:
        print(n[0]*l)
    else:
        print((str(int(n[0])+1))*l)
        
else:
    print(n)

Submission status: Wrong Answer

Solution code:
n=input()
l=len(n)
k=0
for i in range(l):
    for j in range(i,l):
        if n[i]!=n[j]:
            k=1
            
if k==1:
    if n[0]>n[1]:
        print(n[0]*l)
    else:
        print((int(n[0])+1)*l)
        
else:
    print(n)

Submission status: Wrong Answer

Solution code:
n=input()
l=len(n)
k=0
for i in range(l):
    for j in range(i,l):
        if n[i]!=n[j]:
            k=1
            
if k==1:
    print(n[0]*l)
else:
    print(n)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = 111
for _ in range(8):
    if n <= a:
        print(a)
        exit()
    a += 111

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
for i in range(9,0,-1):
    if N//int(str(i)*3)>=1:
        print(str(i+1)*3)
        break

Submission status: Wrong Answer

Solution code:
n = int(input())
a = -(-n//111)
if a == 9:
    print(1111)
else:
    print(a*111)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    dif = 999
    ans = ''
    for i in range(1, 10):
        tmp = str(i) * 3
        if dif > int(tmp) - n > 0:
            dif = abs(n - int(tmp))
            ans = tmp
    print(ans)


if __name__ == '__main__':
    main()

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:
    print(str(int(n[0])+1) + str(int(n[0])+1) + str(int(n[0])+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
l = []
l.append(N[0])
l.append(N[1])
l.append(N[2])
print(max(l)*3)

Submission status: Wrong Answer

Solution code:
N = [int(i) for i in list(input())]

print(len(N)*str(max(N)))

Submission status: Wrong Answer

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

m = []

y = n
while y > 0:
    z = y % 10
    m.append(z)
    y = int(y/10)
max_num = 0

for i in range(len(m)):
    max_num = max(max_num, m[i])

for i in range(len(m)):
    m[i] = max_num
    print(m[i], end='')

print('')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
a=[111,222,333,444,555,666,777,888,999,1111]
for x in a:
  if N>=x:
    print(x)
    break

Submission status: Wrong Answer

Solution code:
N = int(input())
NList = []
x = N
for i in range(3):
    NList.append(x % 10)
    x = x // 10
NList.sort()
for i in range(3):
    if N <= NList[i] * 111:
        print(NList[i] * 111)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
r = input()
n = list(r)
x = int(n[0])*100 + int(n[0])*10 + int(n[0])

if x <= int(r):
  print( ((int(n[0])+1)*100 + (int(n[0])+1)*10 + int(n[0])+1))
else:
  print(x)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = 0
for i in range(N,999):
  if i == 111 or i == 222 or i == 333 or i ==444 or i ==555 or i == 666 or i ==777 or i ==888 or i == 999:
    a = i
    break
print(a)

Submission status: Wrong Answer

Solution code:
n = list(input())
n.sort()
print(n[2] * 3)

Submission status: Wrong Answer

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

for i in range(1,9):
    if N <= int(str(i)*3):
        print(str(i)*3)
        sys.exit()

Submission status: Wrong Answer

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

sum_N = sum(map(int,str(N)))

for i in range(1,9):
    comp = 3*(i)
    if sum_N <= comp:
        print(str(i)*3)
        sys.exit()

Submission status: Wrong Answer

Solution code:
import math
def main():
  n=int(input())
  a=int(n/100)
  if a*100+a*10+a>n:
    print(a*100+a*10+a)
  else:
    print((a+1)*100+(a+1)*10+a+1)
main()

Submission status: Wrong Answer

Solution code:
import math
def main():
  n=int(input())
  a=int(n/100)
  b=int((n-a*100)/10)
  c=n%10
  max=a
  if b > max:
    max = b
  if c > max:
    max = c
  print(max*100+max*10+max)
main()

Submission status: Wrong Answer

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

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 = str(input())
memo = int( n[0] + n[0] + n[0] )
if int(n) < memo:
	print(memo)
else:
	print(memo + 111)

Submission status: Wrong Answer

Solution code:
import sys
import time
import math
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

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

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)

Submission status: Wrong Answer

Solution code:
N=int(input())
X=set(str(N))
Y=len(X)
if Y==1:
  print(Y)
if Y!=1:
  Z=0
  for i in range(111,1000,111):
    if N-i<0:
      Z+=i
      break
  print(Z)

Submission status: Wrong Answer

Solution code:
def resolve():
    N = list(map(int, list(input())))
    print("".join([str(max(N))*3]))

if '__main__' == __name__:
    resolve()

Submission status: Wrong Answer

Solution code:
l=[x for x in input()];print(max(l)*3)

Submission status: Wrong Answer

Solution code:
l=[x for x in input()];print(max(l)*len(l))

Submission status: Wrong Answer

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

print(str(max(a)) * 3)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
for i in range(0,112):
  N = N+i
  n = list(str(N))
  if n[0] == n[1] == n[2]:
    print(N)

Submission status: Wrong Answer

Solution code:
N = int(input())
for i in range(0,112):
  N = N+i
  n = str(N)
  if n[0] == n[1] == n[2]:
    print(N)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=[x for x in input()]
if len(set(n))==1:print(n[0]*3)
else:print(str(int(n[0])+1)*3)

Submission status: Wrong Answer

Solution code:
n=[x for x in input()]
print(max(n)*3)

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(999):
  if i < 100:
    continue
  else:
    tmp = i
    if tmp%10 == (tmp//10)%10 == (tmp//100)%10 and i >= n:
      print(i)
      break
    else:
      continue

Submission status: Wrong Answer

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

Solution code:
N = int()
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: Wrong Answer

Solution code:
N = input()

S = max(set(N))

print(S * 3)

Submission status: Wrong Answer

Solution code:
N = input()

S = sorted(list(set(N)))

for s in S:
    if int(N) <= int(s * 3):
        print(s * 3)
        break
else:
    print('999')

Submission status: Wrong Answer

Solution code:
n =  list(input())
N = [int(n[i]) for i in range(len(n))]
if N[0] == max(N):
  print(max(N) * 100 + max(N)*10 + max(N))
else:
  m = max(N)+1
  print(m * 100 + m * 10 + m)

Submission status: Wrong Answer

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial#, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    sn = s_input()
    n = int(sn)

    compare_num = int(sn[0]) * 100 + int(sn[0]) * 10 + int(sn[0])
    
    if n == compare_num:
        print(n)
    elif n > compare_num:
        print(int(sn[0])+1 * 100 + int(sn[0])+1 * 10 + int(sn[0])+1)
    else:
        print(compare_num)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=list(input())

if int(n[0])>=int(n[1])>=int(n[2]):
    ans = [n[0]]*3
else:
    ans = [int(n[0])+1]*3
print(*ans,sep="")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = list(input())
N = [int(i) for i in N]
if N.index(max(N)) == 0 or len(set(N)) == 1:
  [print(max(N), end='') for _ in range(len(N))]
elif N.index(max(N)) == 1:
  [print(N[0]+1, end='') for _ in range(len(N))]
else:
  [print(N[2], end='') for _ in range(len(N))]

Submission status: Wrong Answer

Solution code:
N = list(input())
N = [int(i) for i in N]
if N.index(max(N)) == 0:
  [print(max(N), end='') for _ in range(len(N))]
elif N.index(max(N)) == 1:
  [print(N[0]+1, end='') for _ in range(len(N))]
else:
  [print(N[2], end='') for _ in range(len(N))]

Submission status: Wrong Answer

Solution code:
n = int(input())

for i in range(n,999):
    one = i % 10
    ten = i //10 % 10
    hund = i // 100
    if one == ten and ten == hund:
        print(hund*100+ten*10+one)
        break

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
if int(s[0]) >= int(s[1]) and int(s[0]) >= int(s[2]):
    print(int(s[0]),int(s[1]),int(s[2]))


    ans = int(s[0]) * 100 + int(s[0]) * 10 + int(s[0]) * 1
else:
    ans = int(s[0]) * 100 + int(s[0]) * 10 + int(s[0]) * 1 + 111
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
if int(s[0]) >= int(s[1]) and int(s[0]) >= int(s[2]):
    ans = int(s[0]) * 100 + int(s[0]) * 10 + int(s[0]) * 1
else:
    ans = int(s[0]) * 100 + int(s[0]) * 10 + int(s[0]) * 1 + 111
    print(ans)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()
ans = []
for c in n:
    c = int(c)
    if c == 0:
        continue
    num = c * 111
    if num >= int(n):
        ans.append(num)

print(min(ans))

Submission status: Wrong Answer

Solution code:
n = input()
maximum = 0
for c in n:
    maximum = max(maximum, int(c))

ans = [str(maximum)] * 3
print(''.join(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
N = list(str(n))
ans = str()
res = N[0]
mn = int(res)
bl = True
for x in N:
    mn = min(mn, int(x))
    if x != res:
        bl = False
if bl:
    print(n)
else:
    if mn == int(res):
        for i in range(len(N)):
            ans += str(int(res) + 1)
        print(ans)
    else:
        for i in range(len(N)):
            ans += str(res)
        print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

t = 0
    
while t*111 <= n  and n >= (t+1)*111:
    t += 1
    
print((t+1)*111)

Submission status: Wrong Answer

Solution code:
n = int(input())

t = 0
    
while t*111 < n < (t+1)*111:
    t += 1
    
print(t*111)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = input()

for i in range(2):
  if int(N[i]) < int(N[i + 1]):
    print(N[i + 1] * 3)
    exit()
  elif int(N[i]) > int(N[i + 1]):
    print(N[0] * 3)
    exit()
print(N)

Submission status: Wrong Answer

Solution code:
N = input()

for i in range(2):
  if N[i] < N[i + 1]:
    print(N[i + 1] * 3)
    exit()
  elif N[i] > N[i + 1]:
    print(N[0] * 3)
    exit()
print(N)

Submission status: Wrong Answer

Solution code:
N = input()

for i in range(2):
  if N[i] < N[i + 1]:
    print(N[1]*3)
    exit()
  elif N[i] > N[i + 1]:
    print(N[0] * 3)
    exit()
print(N)

Submission status: Wrong Answer

Solution code:
N = input()

for i in range(2):
  if N[i] < N[i + 1]:
    print(N[i + 1]*3)
    exit()
  elif N[i] > N[i + 1]:
    print(N[i] * 3)
    exit()
print(N)

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 = list(input())
a = int(''.join(n))
b = []
b.append(int(n[0]))
b.append(int(n[1]))
b.append(int(n[2]))
b = sorted(b)
if a % 111 == 0:
    print(a)
else:
    if int(n[0]) <= b[1]:
        print(b[1] * 111)
    elif b[1] < int(n[0]) <= b[2]:
        print(b[2] * 111)

Submission status: Wrong Answer

Solution code:
n = list(input())
a = int(''.join(n))
b = []
b.append(int(n[0]) * 111)
b.append(int(n[1]) * 111)
b.append(int(n[2]) * 111)
b = sorted(b)
if a % 111 == 0:
    print(a)
else:
    for i in range(3):
        if b[i] > a:
            print(b[i])
            exit()

Submission status: Wrong Answer

Solution code:
n = list(input())
a = int(''.join(n))
b = []
b.append(int(n[0]) * 111)
b.append(int(n[1]) * 111)
b.append(int(n[2]) * 111)
b = sorted(b)
if a % 111 == 0:
    print(a)
for i in range(3):
    if b[i] > a:
        print(b[i])
        exit()

Submission status: Wrong Answer

Solution code:
n = list(input())
a = int(''.join(n))
b = []
b.append(int(n[0]) * 111)
b.append(int(n[1]) * 111)
b.append(int(n[2]) * 111)
b = sorted(b)
if a % 111 == 0:
    print(a)
for i in range(3):
    if b[i] >= a:
        print(b[i])
        exit()

Submission status: Wrong Answer

Solution code:
n = list(input())
n.sort(reverse=True)
print(int(n[0]+n[0]+n[0]))

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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


for i in range(1,9):
  if 111*i <= N < (111*i+1):
    ans += 111*i
  else:
    pass
  
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())



for i in range(1,9):
  if (100*i+10*i+i)<=N<(100*i+10*i+i+1):
    print(N)
  else:pass

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

Solution code:


def solve():

    N = list(input())

    N.sort()
    print(N[2]+N[2]+N[2])


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
n = input()

if n[0] == n[1] and n[1] == n[2]: print(n)
else:
    if n[1] < n[2]: print(n[2]*3)
    elif n[0] < n[1]: print(n[1]*3)
    else: print(n[0]*3)

Submission status: Wrong Answer

Solution code:
N = input()

a = 0
for i in range(len(N)):
    a = max(a,int(N[i]))

ans = ""
for i in range(len(N)):
    ans += str(a)

print(ans)

Submission status: Wrong Answer

Solution code:
N = input()

nlist=[]
for i in range(3):
  nlist.append(int(N[i]))
m=max(nlist)
print(111*m)

Submission status: Wrong Answer

Solution code:
N = input()

nlist=[]
for i in range(len(N)):
  nlist.append(int(N[i]))
m=max(nlist)
print(111*m)

Submission status: Wrong Answer

Solution code:
def Atcoder111(n):

    ans = ""

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

Solution code:
N = int(input())

res = 0
for i in range(1,9):
    tmp = i * 111
    if tmp >= N:
        res = tmp
        break
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())

res = 0
for i in range(9):
    tmp = i * 111
    if tmp >= N:
        res = tmp
        break
print(res)

Submission status: Wrong Answer

Solution code:
s = sorted(list(set(input())))
print(s[-1]*3)

Submission status: Wrong Answer

Solution code:
s = list(set(input()))
print(s[-1]*3)

Submission status: Wrong Answer

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[1]+N[2])
else:
    print(str(int(N[0])+1)+str(int(N[0])+1)+str(int(N[0])+1))

Submission status: Wrong Answer

Solution code:
N=int(input())
ans=ju=0
for i in range(0,999,111):
  if(i>N):
    print(i)
    break
  elif(i==N):
    print(i)
    break

Submission status: Wrong Answer

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

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

Solution code:
N = input()
X = max(int(N[0]), int(N[1]), int(N[2]))
print(X * 100 + X * 10 + X)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = list(map(int,input()))
a = max(n)
print(a*100 + a*10 +a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

for i in range(N,1000):
  a=N//100
  c=N%10
  b=(N-100*a)//10
  if a==b and b==c:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
N=int(input())

for i in range(N,1000):
  a=N//100
  c=N%10
  b=(N-100*a)//10
  if a==b==c:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
N=int(input())

for i in range(N,1000):
  a=N//100
  c=N%10
  b=N-(100*a + c)
  if a==b==c:
    print(i)
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    n = list(input())
    if n[0] == n[1] and n[1] == n[2]:
        ans = n[0] + n[1] + n[2]
    elif n[0] == n[1] and int(n[1]) > int(n[2]):
        ans = n[0] + n[1] + n[0]
    elif n[0] == n[1] and int(n[1]) < int(n[2]):
        base = int(n[0])+1
        ans = str(base) + str(base) + str(base)
    elif int(n[0]) > int(n[1]):
        ans = n[0] + n[0] + n[0]
    elif int(n[0]) < int(n[1]):
        ans = n[1] + n[1] + n[1]

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n=list(input())
n1=int("".join(n))
l=[]
for i in n:
    l.append(int(i*3))

idx=-1
a=99999
for i in range(0,3):
    if a>abs(l[i]-n1) and l[i]>=n1:
        idx=i
        a=abs(l[i]-n1)
print(l[idx])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

N=list(input())
if len(set(N))==1:
    print(''.join(N))
else:
    N=[max(N)]*len(N)
    print(''.join(N))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())

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

Submission status: Wrong Answer

Solution code:
n=int(input())

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

Submission status: Wrong Answer

Solution code:
n=int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
if len(set(S)) == 1:
    print(S)
elif int(S[0] * 3) > int(S):
    print(S[0] * 3)
else:
    print(S[1] * 3)

Submission status: Wrong Answer

Solution code:
S = input()
if len(set(S)) == 1:
    print(S)
elif int(S[0] * 3) > int(S):
    print(S[0] * 3)
else:
    print(str(max(map(int, list(S)))) * 3)

Submission status: Wrong Answer

Solution code:
S = input()
if len(set(S)) == 1:
    print(S)
else:
    print(str(max(map(int, list(S)))) * 3)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
h = int(N[0])
t = int(N[1])
o = int(N[2])

if h == t and t == o:
    print(N)
elif h == 9:
    print(999)
else:
    h += 1
    print(h*111)

Submission status: Wrong Answer

Solution code:
N = input()
h = int(N[0])
t = int(N[1])
o = int(N[2])

if h == t and t == o:
    print(N)
else:
    h += 1
    print(h*111)

Submission status: Wrong Answer

Solution code:
a = list(map(int,list(input())))
b = max(a)
print(str(b)*3)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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

Submission status: Wrong Answer

Solution code:
N = list(input())
s = N[0]
n = int(''.join(N))

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

Submission status: Wrong Answer

Solution code:
N = list(input())
l = [int(x) for x in N]
if 0 in l:
    l.remove(0)
ma = max(l)
mi = min(l)
m = str(max(l))
n = str(min(l))
o = int(''.join(N))

if int(n*3) > o:
    print(int(n*3))
else:
    print(int(m*3))

Submission status: Wrong Answer

Solution code:
N = list(input())
l = [int(x) for x in N]
m = str(max(l))
print(m*3)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
print(''.join(max(N)*3))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
maxi = max(N[:len(N)])
print(maxi+maxi+maxi)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0
while ans < 111:
    ans += 111
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
n = sorted(list(str(input())),reverse=True)

print(int(''.join([n[0],n[0],n[0]])))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

n = int(input())
a = 0

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

Submission status: Wrong Answer

Solution code:
N = input()

m = max([int(i) for i in list(N)])
print(str(m) * 3)

Submission status: Wrong Answer

Solution code:
N=int(input())

for i in range(N,999):
    n=str(i)
    if all(x==n[0] for x in n):
        print(n)
        break

Submission status: Wrong Answer

Solution code:
n=input()
print(max(n[0],n[1],n[2])*3)

Submission status: Wrong Answer

Solution code:
l=list(map(int,list(input())))
print(str(max(l))*3)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
a_list=[str(i)*3 for i in range(1,10)]
flag=False

for i in range(0,9):
  if int(a_list[i])==n:
    print(a_list[i])
    flag=True
    break
if flag==False:
  for i in range(0,8):
    if int(a_list[i])< n < int(a_list[i+1]):
      print(a_list[i+1])
      break

Submission status: Wrong Answer

Solution code:
n=int(input())
a_list=[str(i)*3 for i in range(1,10)]

for i in range(1,9):
  if int(a_list[i])< n <=int(a_list[i+1]):
    print(a_list[i+1])
    break
  elif int(a_list[i])==n:
    print(a_list[i])
    break