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:
a=input()
n=int(a)
flag=n//100
for i in range(2):
  if n//(10**(2-i)) > n//(10**(2-i+1)):
    flag=flag+1
    break
print(flag*100+flag*10+flag)

Submission status: Wrong Answer

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

    a = 111

    while (a <= n):
        a += 111

    print(a)

if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8

n=int(input())
print(n+(111-((n%111))%111))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
str_li = list(input())
li = [int(i) for i in str_li]
print(str(max(li)) * len(li))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=list(str(input()))
e=int(''.join(a))


b=int(a[1])-int(a[1]*111)
c=a[0]
c=int(c)
b = e-c*111
if b <0:
  print(c*111)
else:
  c+=1
  print(c*111)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

flag = 0
for n in range(N, 999):
    if n % 111 == 0:
        print(n)
        break

Submission status: Wrong Answer

Solution code:
n = 999

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
for m in range(0,11):
 if 2+110*m<=n<=111+110*m:
  print(111*m+111)

Submission status: Wrong Answer

Solution code:
n=int(input())
for m in range(0,11):
 if -1+111*m<=n<=110+111*m:
  print(111*m+111)

Submission status: Wrong Answer

Solution code:
n=int(input())
for m in range(0,11):
 if 12+111*m<=n<=111+111*m:
  print(111*m+111)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[int(str(i)*3)-n for i in range(1,10)]
print(a)
ans=[j for j in a if j>=0]
print(n+min(ans))

Submission status: Wrong Answer

Solution code:
N = input()
print(min((int(n * 3) for n in N if n * 3 >= N)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = N//100

print((A*111) if N < A*111 else (A+1)*111)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()

def check(n):
    for s in n:
        if s is not n[0]:
            return False
    return True

for i in range(int(N),999):
    if check(str(i)):
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0
for i in range(9):
  j = i+1
  a = 100*j + 10*j + j
  if n < a:
    ans = a
    break
  if n > a:
    k = j+1
    b = 100*k + 10*k + k
    if n < b:
      ans = b
      break
print(ans)

Submission status: Wrong Answer

Solution code:
a = int(input())

for i in range(10):
	if a<i*111:
		print(i*111)
		break

Submission status: Wrong Answer

Solution code:
N = input()

for s in "123456789":
	if int(N) < int(s * 3):
		print(s * 3)
		break

Submission status: Wrong Answer

Solution code:
n=int(input())

a=n//100
b=(n-a*100)//10
c=n-a-b

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# ABC111B

num = float(input())
i = num / 111
print(round(i + 0.5) * 111)

Submission status: Wrong Answer

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


def solve(N: int):
    ret = ''
    for i in range(N, 999):
        s = str(i)
        if s[0] == s[1] and s[1] == s[2]:
            ret = s
            break
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
z = input()
y = int(z)

a = list(z)
a = [int(x) for x in a]

a1 = set(a)
n = len(a1)
a1 = list(a1)
x = []
for i in range(n):
    b = a1[i]
    c = str(b) + str(b) + str(b)
    c = int(c)
    x.append(c)

d = []
for j in x:
    if j >= y:
        d.append(j)

print(min(d))

Submission status: Wrong Answer

Solution code:
#N = list(map(int, input()))
N = int(input())

list = [111,222,333,444,555,666,777,888,999]
ans = 0
for l in list:
  if N <= l:
    ans = l
  else:
    break

print(ans)

Submission status: Wrong Answer

Solution code:
#N = list(map(int, input()))
N = int(input())

list = [111,222,333,444,555,666,777,888,999]
ans = 0
for l in list:
  if N < l:
    ans = l
  else:
    break

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
mini = 150
ans = 0
for i in range(1, 10):
	if abs(i * 111 - n) < mini:
		mini = abs(i * 111 - n)
		ans = i * 111
print(ans)

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

print(n + 111 - n % 111)

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(888)
elif N <= 999:
    print(999)

Submission status: Wrong Answer

Solution code:
N = str(input())

if N[-2] == N[-1]:
    print(N)
else:
    print(N[:-2] + N[-1] + N[-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
s = ''
def ans(N):
    for ctr in range(N,999):
        s = str(ctr)
        if s[0]==s[1] and s[1]==s[2]:
            return(ctr)
print(ans(N))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
if len(set(N)) == 1:
    print(N)
elif len(set(N)) != 1:
    print(max(N)*len(N))

Submission status: Wrong Answer

Solution code:
N = input()
if len(set(N)) == 1:
    print(N)
else:
    print(max(N)*len(N))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#coding: utf-8
N = int(input())
l = [111, 222, 333, 444, 555, 666, 777, 888, 999]
for i in range(len(l)-1):
    if N == l[i]:
        print(l[i])
        break
    elif N == l[i+1]:
        print(l[i+1])
        break
    elif l[i] < N < l[i+1]:
        print(l[i+1])
        break

Submission status: Wrong Answer

Solution code:
N = str(input())
m = int(N[0]) + 1
M = 100*m + 10*m + m
if int(N[1])<=int(N[0]) and int(N[2]) <= int(N[0]):
    print(int(N))
else:
    print(M)

Submission status: Wrong Answer

Solution code:
n = input()

for i in range(9):
    if int(str(i)*3) >= int(n):
        print(str(i)*3)
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
strN = list(str(N))
a = int(strN[0]*3)
if N > a:
    ans = str(int(strN[0])+1)*3
else:
    ans = a

print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
data = input()

sc = 0
ans = []
if (data[0] == data[1]) & (data[0] == data[2]):
    data = int(data)
    print(data)
elif int(data[0]) >= int(data[1]):
    sc = int(data[0])
    ans = 100 * sc + 10 * sc + sc
    print(ans)
else:
    sc = int(data[0]) + 1
    ans = 100* sc + 10 * sc + sc
    print(ans)

Submission status: Wrong Answer

Solution code:
data = input()

sc = 0
ans = []
if (data[0] == data[1]) & (data[0] == data[2]):
    data = int(data)
    print(data)
elif int(data[0]) > int(data[1]):
    sc = int(data[0])
    ans = 100 * sc + 10 * sc + sc
    print(ans)
else:
    sc = int(data[0]) + 1
    ans = 100* sc + 10 * sc + sc
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
n=int(input())
ans=0

for i in range(n-1,n+1000):
    a=str(i)
    flag=1
    #print(a)
    for j in range(len(a)):
        if(a[0]!=a[j]):
            flag=0
    if(flag==1):
        ans=a
        break
        
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
print(str(N//100)*3)

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

Submission status: Wrong Answer

Solution code:
n=input()
if int(n[0])>int(n[1]):
  out=int(n[0])
else:
  out=int(n[0])+1

print(str(out)*3)

Submission status: Wrong Answer

Solution code:
n=input()
max=1
for i in range(3):
  if int(n[i])>=max:
    max=int(n[i])
out=str(max)*3
print(out)

Submission status: Wrong Answer

Solution code:
n=list(input())
max=1
for i in range(3):
  if int(n[i])>=max:
    max=int(n[i])
out=str(max)*3
print(out)

Submission status: Wrong Answer

Solution code:
n=list(input())
max=1
for i in range(len(n)):
  if int(n[i])>=max:
    max=int(n[i])
out=str(max)*len(n)
print(out)

Submission status: Wrong Answer

Solution code:
n=(list(map(int, input())))
max=0
for i in range(len(n)):
  if n[i]>=max:
    max=n[i]

print(str(max)*len(n))

Submission status: Wrong Answer

Solution code:
n=(list(map(int, input())))
max=0
for i in range(len(n)):
  if int(n[i])>=max:
    max=n[i]

print(str(max)+str(max)+str(max))

Submission status: Wrong Answer

Solution code:
n=(list(map(int, input())))
max=0
for i in range(len(n)):
  if int(n[i])>max:
    max=n[i]

print(str(max)+str(max)+str(max))

Submission status: Wrong Answer

Solution code:
n = str(input())

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

Submission status: Wrong Answer

Solution code:
x=list(map(int,input()))
print(str(x[0])*3 if (x[0] >= x[1] and x[1] >= x[2]) else str(x[0]+1) * 3)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
N = input()
N_list = [int(i) for i in N]
top_num = N_list[0]
length = len(N_list)
flag = True
for i in range(length-1):
  if N_list[i]>=N_list[i+1]:
    flag = True
  else:
    flag = False
    break

if flag:
  print(str(top_num)*length)
else:
  print(str(top_num+1)*length)

Submission status: Wrong Answer

Solution code:
N = input()
N_list = [int(i) for i in N]
top_num = N_list[0]
length = len(N_list)
for i in range(length-1):
  if N_list[i]>=N_list[i+1]:
    flag = True
  else:
    flag = False
    break

if flag:
  print(str(top_num)*length)
else:
  print(str(top_num+1)*length)

Submission status: Wrong Answer

Solution code:
n = input()
a,b,c = [int(n[i]) for i in range(len(n))]
print(a)
if a > b:
  print(a*111)
elif a == b:
  if b >= c:
    print(a*111)
  else:
    print((a+1)*111)
else:
  print((a+1)*111)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

l = []

for i in range(1,10):
	l.append(i*111)

k = []

for i in range(9):
	k.append(abs(l[i] - n))

print(l[k.index(min(k))])

Submission status: Wrong Answer

Solution code:
n = int(input())

k = (n // 100)



s = k*111 - n

l = (k+1)*111 - n

if l > 999:
	print(999)
elif s < l :
	print(s+n)
else:
	print(l+n)

Submission status: Wrong Answer

Solution code:
n = int(input())

k = (n // 100)

s = k*111 - n

l = (k+1)*111 - n

if s < l :
	print(s+n)
else:
	print(l+n)

Submission status: Wrong Answer

Solution code:
from sys import stdin
N=int(stdin.readline().rstrip())
ans=0
tmp=1000
for i in range(1,10):
    for j in range(3,5):
        num=int(str(i)*j)
        if N-num >= 0 and tmp > N-num:
            tmp = N-num
            ans=num
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin
N=int(stdin.readline().rstrip())
ans=0
tmp=1000
for i in range(1,10):
    for j in range(3,5):
        num=int(str(i)*j)
        if N-num >= 0 and tmp < N-num:
            tmp = N-num
            ans=num
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin
N=int(stdin.readline().rstrip())
ans=0
tmp=1000
for i in range(1,10):
    for j in range(3,5):
        num=int(str(i)*j)
        if num-N > 0 and tmp > num-N:
            tmp = num-N
            ans=num
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()

for n in N[::-1]:
    ans = int(n*3)
    if ans >= int(N):
        break

print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
a = N//100+N//100*10+N//100
b = (N//100+1)*100+(N//100+1)*10+(N//100+1)
print(a*(N<=a)+b*(N>a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = input()
if a[-1] == '0':
    ans = int(a[0] * 3)
elif int(a[0]) < int(a[2]) or int(a[0]) < int(a[1]):
    ans = str(int(a[0])+1)*3
else:
    ans = int(a[-1] * 3)
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
a = input()
num_list = [int(i) for i in a]
ans = str(np.max(num_list))*3
print(ans)

Submission status: Wrong Answer

Solution code:
a = input()

if int(a[-1]) > int(a[0]):
    ans = int(a[-1] * 3)
else:
    ans = int(a[0] * 3)

print(ans)

Submission status: Wrong Answer

Solution code:
a = input()

if a[-1] == '0' or int(a[-1]) < int(a[0]):
    ans = int(a[0] * 3)
else:
    ans = int(a[-1] * 3)

print(ans)

Submission status: Wrong Answer

Solution code:
a = input()
if a[-1] == '0':
    ans = int(a[0] * 3)
else:
    ans = int(a[-1] * 3)
print(ans)

Submission status: Wrong Answer

Solution code:
a = input()

if a[-1] == '0':
    ans = int(a[0] * 3)
else:
    ans = int(a[-1] * 3)
print(str(ans))

Submission status: Wrong Answer

Solution code:
a = input()

if a[-1] == '0':
    ans = int(a[0] * 3)
else:
    ans = int(a[-1] * 3)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
_max = max([int(i) for i in str(N)])
if str(N) == str(_max) * (len(str(N))):
  print(N)
else:
  print(str(_max) * (len(str(N))))

Submission status: Wrong Answer

Solution code:
import re
N = int(input())
_max = max([int(i) for i in str(N)])
print(_max * (len(str(N))))

Submission status: Wrong Answer

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

print(str(x) * 3)

Submission status: Wrong Answer

Solution code:
n = input()
print(str(max([int(n[i]) for i in range(3)]))*3)

Submission status: Wrong Answer

Solution code:
N = input()
ans = []
for i in range(len(N)):
  ans.append(N[0])
if int(''.join(ans)) > int(N):
    print(''.join(ans))
    exit()
ans = []
for i in range(len(N)):
  ans.append(str(int(N[0]) + 1))
print(''.join(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = list(input())
a = int(str(n[0])+str(n[1]))
b = int(str(n[1])+str(n[2]))

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

Submission status: Wrong Answer

Solution code:
import sys

def main():
  input = sys.stdin.readline
  N = str(input())
  L = len(N)
  f = N[0]
  a = f * L
  b = str(int(f) + 1) * L
  
  if int(a) >= int(N):
    print(int(a))
  else:
    print(int(b))


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
query =[]
for i in range(1,9):
  query.append(int(111*i))
for j in query:
  if j >= n:
   print(j)
   break

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
n = list(input())
n_ = [int(x) for x in n]
num = max(n_)

n = [num for x in n_]

n = [str(x) for x in n]

print(int(''.join(n)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
num = []
for _ in range(3):
  num.append(N%10)
  N = N//10
num_m = max(num)
print(num_m*111)

Submission status: Wrong Answer

Solution code:
N = int(input())

answer = 0

for i in range(N, 999):
  string = list(str(i))
  flag = 0
  for s in string:
    if s != string[0]:
      flag = 1
  if flag == 0:
    answer = i
    break

print(answer)

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=str(input())
Comp=[]
for i in range(3):
    Comp.append(int(N[i]))
big=max(Comp)
for i in range(3):
    print(big,end='')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=input()
ans=0
if N[0]=='9':
    ans = '1'*(len(N)+1)
elif int(N)>int(N[0]*len(N)):
    ans = str(int(N[0])+1)*len(N)
else:
    ans = N[0]*len(N)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for rep in repdigit:
    if N < rep:
        print(rep)
        break

Submission status: Wrong Answer

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

for rep in repdigit:
    if N >= rep:
        print(rep)
        break

Submission status: Wrong Answer

Solution code:
L=[111,222,333,444,555,666,777,888,999]
N=int(input())
M=[abs(L[i]-N) for i in range(len(L))]
a=min(M)
num=M.index(a)
print(L[num])

Submission status: Wrong Answer

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

Solution code:
N = int(input())
zorome = [0,111,222,333,444,555,666,777,888,999]
diff = [0]*10
for i in range(len(zorome)):
    diff[i] = abs(N - zorome[i])

ans = zorome[diff.index(min(diff))]
print(ans)

Submission status: Wrong Answer

Solution code:
def piyo():
    n = int(input())
    hoge = n//100
    if int(str(hoge)+str(hoge))>n%100:
        a = int(str(hoge)+str(hoge)+str(hoge))
    else:
        hoge+=1
        a = int(str(hoge)+str(hoge)+str(hoge))
    print(a)

if __name__ == '__main__':
    piyo()

Submission status: Wrong Answer

Solution code:
def piyo():
    n = int(input())
    n = n//100
    s = str(n)+str(n)+str(n)
    print(s)

if __name__ == '__main__':
    piyo()

Submission status: Wrong Answer

Solution code:
a = input()
b = list(a)
k = int(''.join([b[0] for _ in range(len(b))]))
if k > int(a):
    print(k)
else:
    if b[0] != '9':
        print(int(''.join([str(int(b[0]) + 1) for _ in range(len(b))])))
    else:
        print(int(''.join(['1' for _ in range(len(b)+1)])))

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
ss = int(s)
i = ss//(10**(n-1))
def cal(k):
    res = int(k)*(10**(n-1))+ int(k)*(10**(n-2))+int(k)*(n-2)
    return res

if cal(i)<ss:
    print("hello")
    print(cal(i+1))
else:
    print(cal(i))

Submission status: Wrong Answer

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

for i in range(9):
    if(N>L[i] and N<=L[i+1]):
        print(L[i+1])
    elif(N==L[i]):
        print(L[i])
        break
    elif(N<111):
        print(111)
        break
    else:
        continue

Submission status: Wrong Answer

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

for i in range(9):
    if(N>L[i] and N<=L[i+1]):
        print(L[i+1])
    elif(N==L[i]):
        print(L[i])
    elif(N<111):
        print(111)
        break
    else:
        continue

Submission status: Wrong Answer

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

for i in range(9):
    if(N>L[i] and N<=L[i+1]):
        print(L[i+1])
    elif(N==L[i]):
        print(L[i])
    else:
        continue

Submission status: Wrong Answer

Solution code:
num = str(input())
a = []
x=[]
for i in str(num):
    a.append(i)
if a[1] < a[0] and a[2] < a[0]:
    x.append(a[0])
    x.append(a[0])
    x.append(a[0])
    print(''.join(str(i) for i in x))
else:
    z = int (a[0]) +1
    x.append(z)
    x.append(z)
    x.append(z)
    print(''.join(str(i) for i in x))

Submission status: Wrong Answer

Solution code:
N = str(input())
 
list = [int(c)+10*int(c)+100*int(c) for c in N]
list.sort()
 
x = 0
for i in range(3):
    if list[i] < int(N):
        continue
    else:
        x = list[i]
        break
print(x)

Submission status: Wrong Answer

Solution code:
N = str(input())
 
list = [int(c)+10*int(c)+100*int(c) for c in N]
list.sort()
 
x = 0
for i in range(len(N)):
    if list[i] < int(N):
        continue
    else:
        x = list[i]
        break
print(str(x))

Submission status: Wrong Answer

Solution code:
N = str(input())
 
list = [int(c)+10*int(c)+100*int(c) for c in N]
list.sort()
 
x = 0
for i in range(len(N)):
    if list[i] < int(N):
        continue
    else:
        x = list[i]
        break
print(x)

Submission status: Wrong Answer

Solution code:
N = str(input())

list = [int(c)+10*int(c)+100*int(c) for c in N]
list.sort()

x = 0
for i in range(len(N)):
    if list[i] < int(N):
        continue
    else:
        x = list[i]
        break
print(x)

Submission status: Wrong Answer

Solution code:
N = str(input())

list = [int(c)+10*int(c)+100*int(c) for c in N]
list.sort()

x = 0
for i in range(len(N)):
    if list[i] < int(N):
        continue
    else:
        x = list[i]
print(x)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
n=int(input())
max=0
cnt=0
while n!=0:
    if n%10>max:
        max=n%10
    n=n//10
    cnt+=1
for i in range(cnt):
    print(max,end="")

Submission status: Wrong Answer

Solution code:
# coding: utf-8

N=input()
print(int(max(N)*3))

Submission status: Wrong Answer

Solution code:
s = input()
top = s[0]
ng = False
for i in s:
    if top != i:
        ng = True
        break

if not (ng):
    print(s)
else:
    if int(top * len(s)) < int(s):
        print(str(int(top) + 1) * len(s))
    else:
        print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=input()
v=[]
val=0
for a in n:
    v.append(int(a+a+a))
n=int(n)
v=sorted(v)
if v[0]>=n:
    val=v[0]
elif v[1]>=n:
    val=v[1]
elif v[2]>=n:
    val=v[2]
print(val)

Submission status: Wrong Answer

Solution code:
n=input()
mx=0
for a in n:
    if int(a)>int(mx):
        mx=a
mx=mx+mx+mx
print(mx)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = n
digits = []
for i in range(3):
    digits.append(a % 10)
    a = a // 10
digits = sorted(digits)
for digit in digits:
    x = digit * 100 + digit * 10 + digit * 1
    if x >= n :
        print(x)
        break

Submission status: Wrong Answer

Solution code:
n=str(input())
k=True
kaku=n[0]
for i in n:
    if int(n[0])!=int(i):
        k=False
if k:
    print(n)
else:
    if int(n[0])>int(n[1]):
        if int(n[0])>int(n[2]):
            print(n[0]*3)
        else:
            s=int(n[0])+1
            print(str(s)*3)
    else:
        s=int(n[0])+1
        print(str(s)*3)

Submission status: Wrong Answer

Solution code:
n=str(input())
k=True
kaku=n[0]
for i in n:
    if int(n[0])!=int(i):
        k=False
if k:
    print(n)
else:
    if int(n[0])>int(n[1]):
        if int(n[1])>int(n[2]):
            print(n[0]*3)
        else:
            s=int(n[0])+1
            print(str(s)*3)
    else:
        s=int(n[0])+1
        print(str(s)*3)

Submission status: Wrong Answer

Solution code:
n=str(input())
k=True
kaku=n[0]
for i in n:
    if int(n[0])!=int(i):
        k=False
if k:
    print(n)
else:
    if int(n[0])>=int(n[1]):
        if int(n[1])>=int(n[2]):
            print(n[0]*3)
        else:
            s=int(n[0])+1
            print(str(s)*3)
    else:
        s=int(n[0])+1
        print(str(s)*3)

Submission status: Wrong Answer

Solution code:
n=str(input())
k=True
kaku=n[0]
for i in n:
    if int(n[0])!=int(i):
        k=False
if k:
    print(n)
else:
    if int(n[0])>=int(n[1]):
        print(n[0]*3)
    else:
        s=int(n[0])+1
        print(str(s)*3)

Submission status: Wrong Answer

Solution code:
n=str(input())
k=True
kaku=n[0]
for i in n:
    if int(n[0])!=int(i):
        k=False
if k:
    print(n)
else:
    s=int(n[0])+1
    print(str(s)*3)

Submission status: Wrong Answer

Solution code:
n= int(input())
maxi = 0
a= n %10

if(a>maxi):
    maxi=a
n=n//10
b= n %10
if(b>maxi):
    maxi=b
n=n//10
c= n
if(c>maxi):
    maxi=c

print(str(maxi)+str(maxi)+str(maxi))

Submission status: Wrong Answer

Solution code:
n=int(input())
length=len(str(n))

if int(str(n)[0])> int(str(n)[-1]) and int(str(n)[0])>= int(str(n)[1]):
  print((str(n)[0])*length)
else:
  print(str((int(str(n)[0]))+1)*length)

Submission status: Wrong Answer

Solution code:
n=int(input())
length=len(str(n))

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

Submission status: Wrong Answer

Solution code:
n=int(input())
length=len(str(n))

if int(str(n)[0])> int(str(n)[-1]):
  print((str(n)[0])*length)
else:
  print((str(n)[-1])*length)

Submission status: Wrong Answer

Solution code:
a=input()



flag=0
for i in range(2):
    if a[i]==a[i+1]:
        pass
    else:
        flag+=1

if flag==0:
    print(int(a))
else:

    w=int(a[0])
    c=int(a)

    e=1
    a=0
    for i in range(3):
       a+=w*e
       e*=10
    if c<a:
       print(a)
    else:
        print(2*a)

Submission status: Wrong Answer

Solution code:
a=input()

flag=0
for i in range(2):
    if a[i]==a[i+1]:
        pass
    else:
        flag+=1

if flag==0:
    print(int(a))
else:
    a=sorted(a)
    w=int(a[2])

    e=1
    a=0
    for i in range(3):
       a+=w*e
       e*=10
    print(a)