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



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)

Submission status: Wrong Answer

Solution code:
a=int(input())
x=a+1000
w=[0,0,0]
w[0]=x%10
x=x//10
w[1]=x%10
x=x//10
w[2]=x%10
print(w)
flag=0
for i in range(2):
    if w[i]==w[i+1]:
        pass
    else:
        flag+=1

if flag==0:
    print(a)
else:
    w=sorted(w)

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

Submission status: Wrong Answer

Solution code:
a=int(input())
x=a+1000
w=[0,0,0]
w[0]=x%10
x=x//10
w[1]=x%10
x=x//10
w[2]=x%10

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

if flag==0:
    print(a)
else:
    w=sorted(w)
   
    e=1
    a=0
    for i in range(3):
       a+=w[2]*e
       e*=10
    print(a)

Submission status: Wrong Answer

Solution code:
print("aa")

Submission status: Wrong Answer

Solution code:
s = input().strip()
n = int(s)
x = 999
for i in s:
    if int(i*3) >= n:
        x = min(int(i*3), x)
print(x)

Submission status: Wrong Answer

Solution code:
n=int(input())
for i in range(n,1000):
  if i%100 == i//10:
    print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())
for i in range(n,1000):
  if n%100 == n//10:
    print(n)

Submission status: Wrong Answer

Solution code:
a = input()
b = list(a)
c = b[0] + b[0] + b[0]

if int(a) >= int(c):
  print(int(c)+111)
else:
  print(int(c))

Submission status: Wrong Answer

Solution code:
a = input()
b = list(a)
c = b[0] + b[0] + b[0]

if int(a) >= int(c):
  print(c)
else:
  print(int(c)+111)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=input()
#print(x)
#print(x[0])
if x[0]==x[1]==x[2]:
	print(int(x))
else:
	y=[x[0],x[1],x[2]]
	y.sort()
	print(int(y[-1]+y[-1]+y[-1]))

Submission status: Wrong Answer

Solution code:
x=input()
#print(x)
#print(x[0])
if x[0]==x[1]==x[2]:
	print(int(x))
else:
	print(int(x[0]+x[0]+x[0]))

Submission status: Wrong Answer

Solution code:
n=int(input())
for i in range(n,n+100):
    x=str(i)
    m=i
    if x[0]==x[1]==x[2]:
        break
print(m)

Submission status: Wrong Answer

Solution code:
str_input = input()
num_list = list(str_input)
next_stage = 0

num1 = int(num_list[0])
num2 = int(num_list[1])
num3 = int(num_list[2])

def change_nums( num ):
    return num*100+num*10+num


if num1 > num2:
    next_stage = change_nums( num1 )
elif num1==num2==num3:
    next_stage = change_nums( num1 )
else:
    next_stage = change_nums( num1+1 )

print(next_stage)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#B問題
N=int(input() )

while(N<1000):
    N+=1
    if(N%111==0):
        print (N)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
cs = [1111, 999, 888, 777, 666, 555, 444, 333, 222, 111]
f = False
for i, c in enumerate(cs):
    if c <= n:
        print(cs[i-1])
        f = True
        break
if not f:
    print(cs[len(cs)-1])

Submission status: Wrong Answer

Solution code:
def big(m):
    g = 0
    for i in range(len(m)):
        if int(m[i]) > g:
            g = int(m[i])

    return g
    

N = input()
m = []
for i in range(len(N)):
    m.append(N[i])
    
g = big(m)
g = str(g)

n = ""
for i in range(len(N)):
    n += g

print(n)

Submission status: Wrong Answer

Solution code:
N = input()
a, b, c = int(N[0]), int(N[1]), int (N[2])
g = 0

if a>=b and a>=c:
    g = a
elif b>=a and b>=c:
    g = b
else:
    g = c

g = str(g)
n = ""
n += g
n += g
n += g

n = int(n)
print(n)

Submission status: Wrong Answer

Solution code:
x=int(input())
z=[111,222,333,444,555,666,777,888,999]
for i in range(9):
  if x==z[i]:
    print(z[i])
    break
  elif i!=8 and z[i]<x<z[i+1]:
    print(z[i+1])
    break
  elif i==8 and x<z[i]:
    print(z[i])
    break

Submission status: Wrong Answer

Solution code:
n = raw_input()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
i = str(raw_input())
top = i[0]

if int(i[0])<=int(i[1]):
	if int(i[1])<int(i[2]):
		top = str(int(i[0])+1)

print str(top)*3

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
number = int(input())

str_number_list = list(str(number))

int_number_list = []

for i in str_number_list:
	int_number_list.append(int(i))

hundred = int_number_list[0]
ten = int_number_list[1]
one = int_number_list[2]

if number == one * 111:
	print(number)
elif hundred < ten:
	print('{0}{0}{0}'.format(*str_number_list[1]))
elif hundred > ten:
	print('{0}{0}{0}'.format(*str_number_list[0]))
elif ten == hundred and ten < one :
	print('{0}{0}{0}'.format(*str(int_number_list[1] + 1)))
else:
	print('{0}{0}{0}'.format(*str_number_list[0]))

Submission status: Wrong Answer

Solution code:
number = int(input())

str_number_list = list(str(number))

int_number_list = []

for i in str_number_list:
	int_number_list.append(int(i))

hundred = int_number_list[0]
ten = int_number_list[1]
one = int_number_list[2]

if number == one * 111:
	print(number)
elif hundred <= ten:
	print('{0}{0}{0}'.format(*str_number_list[1]))
elif hundred > ten:
	print('{0}{0}{0}'.format(*str_number_list[0]))
else:
	print('{0}{0}{0}'.format(*str_number_list[2]))

Submission status: Wrong Answer

Solution code:
number = int(input())

str_number_list = list(str(number))

int_number_list = []

for i in str_number_list:
	int_number_list.append(int(i))

hundred = int_number_list[0]
ten = int_number_list[1]
one = int_number_list[2]

if number == one * 111:
	print(number + 111)
elif hundred <= ten:
	print('{0}{0}{0}'.format(*str_number_list[1]))
elif hundred > ten:
	print('{0}{0}{0}'.format(*str_number_list[0]))
else:
	print('{0}{0}{0}'.format(*str_number_list[2]))

Submission status: Wrong Answer

Solution code:
number = int(input())

str_number_list = list(str(number))

int_number_list = []

for i in str_number_list:
	int_number_list.append(int(i))

hundred = int_number_list[0]
ten = int_number_list[1]
one = int_number_list[2]

if number == one * 111:
	print(number + 111)
elif hundred <= ten:
	print('{0}{0}{0}'.format(*str_number_list[1]))
else:
	print('{0}{0}{0}'.format(*str_number_list[0]))

Submission status: Wrong Answer

Solution code:
# coding:utf-8


def main():
    s = str(input())
    i1 = int(s[0] + s[0] + s[0])
    i2 = int(s[1] + s[1] + s[1])
    i3 = int(s[2] + s[2] + s[2])

    l = []
    l.append(int(s))
    l.append(i1)
    l.append(i2)
    l.append(i3)
    ls = sorted(l)

    print(ls[ls.index(int(s)) + 1])


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print(input())

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input())
if a>=b&a>=c:
    print(a*111)
else:
    print((a+1)*111)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input())
if a>b:
    print(a*111)
else:
    print(b*111)

Submission status: Wrong Answer

Solution code:
n = str(input())


h = n[0:1]
j = n[1:2]
i = n[2:3]

if h < j:
    print("dd")
    h = int(h) + 1
    print(h)
    j = h
    i = h
else:
    print(h)
    j = h
    i = h
    print(j)
    print(i)




print(int(str(h) + str(j) + str(i)))

Submission status: Wrong Answer

Solution code:
n = str(input())


h = n[0:1]
j = n[1:2]
i = n[2:3]

if h < j:
    print("dd")
    h = int(h) + 1
    print(h)
    j = h
    i = h
else:
    print(h)
    j = h
    i = h
    print(j)
    print(i)


print(str(h) + str(j) + str(i))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(8):
    if x >= n:
        print(x)
        break
    else:
        x += 111

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
N = input()

ans = N[0]
for i in range(2):
    if N[i] != N[i+1]:
        if N[i] < N[i+1]:
            ans = str(int(N[i]) + 1)

for i in range(3):
    print(ans, end="")
print()

Submission status: Wrong Answer

Solution code:
N = int(input())

n = N
for n in range(n, n+100):
    a = int(n / 100)
    b = int((n % 100) / 10)
    c = int(n % 10)
    if (a == b and b == c):
        print(str(a)*3)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=list(input())
A = B = C = ''
if a[0] == a[1] and a[0] == a[2] or a[0] >= a[2]:
    for _ in range(3):
        A += str(a[0])
    print(A)
else:
    if a[1] >= a[0]:
       a[0] = int(a[0]) + 1
       for i in range(3):
        B += str(a[0])
    
       print(B)

    else:
       for i in range(3):
        C += str(a[0])
    
       print(C)

Submission status: Wrong Answer

Solution code:
a=list(input())
A = B = C = ''
if a[0] == a[1] and a[0] == a[2]:
    for _ in range(3):
        A += str(a[0])
    print(A)
else:
    if a[1] >= a[0] :
       a[0] = int(a[0]) + 1
       for i in range(3):
        B += str(a[0])
    
       print(B)
    
    else:
       for i in range(3):
        C += str(a[0])
    
       print(C)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = list(input())
ori = ''.join(map(str, n))
n = set(n)

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

Submission status: Wrong Answer

Solution code:
n = list(input())
ori = ''.join(map(str, n))
n = set(n)

if len(n) == 1:
    n = list(n)
    print(str(n[0] * 3))
else:
    n = list(n)
    for num in n:
        result = num * 3
        if ori < result:
            print(result)

Submission status: Wrong Answer

Solution code:
n = str(input())
if n == "999":
    print(1111)
    exit(0)
minim = 1000
x = int(n)
for i in range(1, 10):
    nr = i*100 + i*10 + i
    if x <= int(nr) < minim:
        minim = int(nr)
print(minim)

Submission status: Wrong Answer

Solution code:
n = str(input())
if n == "999":
    print(1111)
    exit(0)
minim = 1000
x = int(n)
for i in range(1, 10):
    nr = i*100 + i*10 + i
    if x < int(nr) < minim:
        minim = int(nr)
print(minim)

Submission status: Wrong Answer

Solution code:
n = str(input())
if n == "999":
    print(1111)
    exit(0)
minim = 1000
x = int(n)
for i in n:
    nr = i*3
    if x < int(nr) < minim:
        minim = int(nr)
print(minim)

Submission status: Wrong Answer

Solution code:
n = str(input())
minim = 1000
x = int(n)
for i in n:
    nr = i*3
    if x < int(nr) < minim:
        minim = int(nr)
print(minim)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
a=[int(x)for x in list(sys.stdin.readline()[0:3])]+[-1]
print(str(a[0]+0if(np.trim_zeros(np.diff(a))[0]<0)else 1)*3)

Submission status: Wrong Answer

Solution code:
N=int(input())

c=N%10
N//=10
b=N%10
N//=10
a=N%10

d=1
a=a+1
if((a==b and a>=c )or a>b):a=a-1

d=a*100+a*10+a
print(d)

Submission status: Wrong Answer

Solution code:
N=int(input())

a=N%10
N/=10
b=N%10
N/=10
c=N%10

d=1
a=a+1
if(a==b and a>=c or a>b):a=a-1

d=a*100+a*10+a
print(d)

Submission status: Wrong Answer

Solution code:
inp = int(input())
 
a = inp //100
b = (inp % 100)
c = b % 10
b = b //10
 
if a == b and a == c:
  pass
elif a > b or a > c:
  pass
else:
    a = a+1
print('{}{}{}'.format(a, a, a))

Submission status: Wrong Answer

Solution code:
inp = int(input())
 
a = inp //100
b = (inp % 100)
c = b % 10
b = b //10
 
if a == b and a == c:
  pass
else:
  a = a+1
print('{}{}{}'.format(a, a, a))

Submission status: Wrong Answer

Solution code:
N = int(input())

S = ((N//111)+1)*111

print(S)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
while n < 1000:
    if n % 111 == 0:
        print(n)
        break
    n = int(math.floor((n + 88) / 100)) * 111

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
while n < 1000:
    if n % 111 == 0:
        print(n)
        break
    n = math.floor((n + 88) / 100) * 111

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
while n < 1000:
    if n % 111 == 0:
        print(n)
        break
    n = math.floor((n - 88) / 100) * 111

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
while n < 1000:
    if n % 111 == 0:
        print(n)
        break
    n = int((n - 11) / 100 + 1) * 111

Submission status: Wrong Answer

Solution code:
n = int(input())
while n < 1000:
    if n % 111 == 0:
        print(n)
        break
    n = int((n - 11) / 100) * 111

Submission status: Wrong Answer

Solution code:
n = int(input())
num = [111,222,333,444,555,666,777,888,999]
x = num[0]
for i in range(len(num) - 1):
    if num[i] == n:
        x = num[i]
        break
    if num[i+1] == n:
        x = num[i+1]
        break
    if num[i] < n and n < num[i+1]:
        mn = min(abs(n - num[i]),abs(n - num[i+1]))
        if mn == abs(n - num[i]):
            x = num[i]
        else:
            x = num[i+1]
        break
print(x)

Submission status: Wrong Answer

Solution code:
n = int(input())
num = [111,222,333,444,555,666,777,888,999]
for i in range(len(num) - 1):
    if num[i] == n:
        x = num[i]
        break
    if num[i+1] == n:
        x = num[i+1]
        break
    if num[i] < n and n < num[i+1]:
        mn = min(abs(n - num[i]),abs(n - num[i+1]))
        if mn == abs(n - num[i]):
            x = num[i]
        else:
            x = num[i+1]
        break
if n < num[0]:
    x = num[0]
print(x)

Submission status: Wrong Answer

Solution code:
n = int(input())

canditates = [111, 222, 333, 444, 555, 666, 777, 888, 999]
for i in range(len(canditates) - 1):
    if canditates[i] == n:
        print(n)
        exit()
    elif canditates[i] < n <= canditates[i + 1]:
        print(canditates[i + 1])
        exit()

Submission status: Wrong Answer

Solution code:
n = int(input())

n_str = str(n)  # e.g. 112 -> "112"
digit_max = max([int(digit) for digit in n_str])  # Get max value of 3 digits
out_val = 100 * digit_max + 10 * digit_max + 1 * digit_max
print(out_val)

Submission status: Wrong Answer

Solution code:
inp = int(input())
ret = 0
for i in range(1, 9):
    ret = i*111
    if ret >= inp:
        break
print(ret)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()

max = -1
for c in n:
	if max < int(c):
		max = int(c)

print("{}{}{}".format(max,max,max))

Submission status: Wrong Answer

Solution code:
N=int(input())
def get_answer(N):
    m=0
    answer=0
    m=max(int(str(N)[0]),int(str(N)[1]),int(str(N)[2]))
    answer=m*100+m*10+m
  
    return answer    
  
print(get_answer(N))

Submission status: Wrong Answer

Solution code:
N=int(input())

def get_answer(N):
    m=0
    answer=0
    if N>=100:
        m=max(int(str(N)[0]),int(str(N)[1]),int(str(N)[2]))
        answer=m*100+m*10+m
    else:
        m=max(int(str(N)[0]),int(str(N)[1]))
        answer=m*10+m
    
    return answer    
  
print(get_answer(N))

Submission status: Wrong Answer

Solution code:
N=int(input())

def get_answer(N):
    m=0
    answer=0
    if N>=100:
        m=max(int(str(N)[0]),int(str(N)[1]),int(str(N)[2]))
        answer=m*100+m*10+m
    else:
        m=max(int(str(N)[0]),int(str(N)[1]))
        answer=m*10+m
    
    return answer

get_answer(N)

Submission status: Wrong Answer

Solution code:
N=int(input())

def get_answer(N):
    m=0
    answer=0
    if N>=100:
        m=max(int(str(N)[0]),int(str(N)[1]),int(str(N)[2]))
        answer=m*100+m*10+m
    else:
        m=max(int(str(N)[0]),int(str(N)[1]))
        answer=m*10+m
    
    return answer    
  
get_answer(N)

Submission status: Wrong Answer

Solution code:
N=int(input())

def get_answer(N):
    N_100=N//100
    N_10=(N-N_100*100)//10
    N_1=N-N_100*100-N_10*10
    
    answer=0
    if N_100<=N_10:
        if N_10<=N_1:
            if N>=100:
                answer=N_1*100+N_1*10+N_1
            else:
                answer=N_1*10+N_1
        else:
            if N>=100:
                answer=N_10*100+N_10*10+N_10
            else:
                answer=N_10*10+N_10
    else:
        if N>=100:
            answer=N_100*100+N_100*10+N_100
        else:
            answer=N_100*10+N_100
    return answer
  
get_answer(N)

Submission status: Wrong Answer

Solution code:
N=int(input())

def get_answer(N):
    N_100=N//100
    N_10=(N-N_100*100)//10
    N_1=N-N_100*100-N_10*10
    
    answer=0
    if N_100<N_10:
        if N_10<N_1:
            answer=N_1*100+N_1*10+N_1
        else:
            answer=N_10*100+N_10*10+N_10
    else:
        answer=N_100*100+N_100*10+N_100

    return answer
  
get_answer(N)

Submission status: Wrong Answer

Solution code:
x = input()

base = int(x)

xs = [x for x in [int(c*3) for c in set(x) ] if x >= base ]
print(sorted(xs).pop(0))

Submission status: Wrong Answer

Solution code:
x = input()

base = int(x)

xs = [x for x in [int(c*3) for c in set(x) ] if x >= base ]
print(sorted(xs).pop())

Submission status: Wrong Answer

Solution code:
n = list(map(int, input()))
print(str(max(n))*len(n))

Submission status: Wrong Answer

Solution code:
s = input()
ints = int(s)
if int(s) % 111 == 0:
    ans = s
else:
    if s[0] == s[1]:
        if s[1] < s[2]:
            ans = [int(s[0])+1, int(s[0])+1, int(s[0])+1]
        if s[1] > s[2]:
            ans = [int(s[0]), int(s[0]), int(s[0])]
    if s[0] < s[1]:
        ans = [int(s[0])+1, int(s[0])+1, int(s[0])+1]
    if s[0] > s[1]:
        ans = [int(s[0]), int(s[0]), int(s[0])]
    ans = str(ans)
    print(type(ans))
    ans = ans[1]+ans[4]+ans[7]

print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
N_str = []
for i in range(N,999):
    N_new = N
    while N>0:
        N_str.append(N%10)
        N//=10
    N_str.reverse()
    
    N = N_new
          
    if N_str[0]==N_str[1] and N_str[1]==N_str[2]:
        print(N)
        break
    N+=1

Submission status: Wrong Answer

Solution code:
N=int(input())
N_str = []
for i in range(N,999):
    N_new = N
    while N>0:
        N_str.append(N%10)
        N//=10
    N_str.reverse()
    
    N = N_new
          
    if N_str[0]==N_str[1] and N_str[1]==N_str[2]:
        print(N)
        break
    N+=1

Submission status: Wrong Answer

Solution code:

N=int(input())
N_str = []
for i in range(N,999):
    N+=1
    N_new = N
    while N>0:
        N_str.append(N%10)
        N//=10
    N_str.reverse()
    
    N = N_new
          
    if N_str[0]==N_str[1] and N_str[1]==N_str[2]:
        print(N)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

for a in range(10):
    if a*111<=N:
        pass
    elif a*111>=N:
        print(a*111)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
line = int(input())
lina = list(map(int, [line/100, (line/10)%10, line%10]))
contest = [111*lina[0], 111*(lina[0]+1)]
if(contest[0] - line > 0):
    print(contest[0])
else:
    print(contest[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()
l = [int(x) for x in list(str(n))]
ans = []
print(l)
if (l[0] < l[1]) or (l[0] < l[2]):
	num = l[0] + 1
else:
	num = l[0]
for i in range(3):
	ans.append(num)
ansn = ans[0] * 100 + ans[1] * 10 + ans[2]
print(ansn)

Submission status: Wrong Answer

Solution code:
N=input()

if N[2]==N[1]==N[0]:
    A=N

elif N[2]>=N[0]:
    B=int(N[0])+1
    C=str(B)
    A=str(C+C+C)



else:
    A=str(N[0]+N[0]+N[0])


    
print(A)

Submission status: Wrong Answer

Solution code:
N=input()



if N[2]>=N[0]:
    B=int(N[0])+1
    C=str(B)
    A=str(C+C+C)

else:
    A=str(N[0]+N[0]+N[0])


    
print(A)

Submission status: Wrong Answer

Solution code:

def isCorrect(n):
    l = [int(x) for x in list(str(n))]
    prev = l.pop(0)

    for num in l:
        if num != prev:
            return False
        prev = num
    return True

if __name__ == '__main__':
    n = int(input())

    for m in range(n+1, 100000):
        if isCorrect(m):
            print(m)
            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
n_list = []

while n != 0:
    n_list.append(n%10)
    n //= 10
n_list.reverse()

if n_list[0] < n_list[1]:
    ans = n_list[1]
elif max(n_list) > n_list[0]:
    ans = n_list[0]
else:
    ans = max(n_list)

for _ in range(len(n_list)):
    print(ans,end='')

Submission status: Wrong Answer

Solution code:
N = input()
temp = 0
result = ''
if int(N) % 111 == 0:
    print(N)
else:
    temp = round((int(N) / 111))
    for i in range(len(N)):
        result += str(temp)
    print(result)

Submission status: Wrong Answer

Solution code:
N = input()
result = ''
if int(N) % 111 == 0:
    print(N)
else:
    if len(N) == 2:
        result = '111'
    else:
        for i in range(len(N)):
            result += str(int(N[0])+1)
    print(result)

Submission status: Wrong Answer

Solution code:
num=input()
num_list=list(num)
n=len(num)
ans_num=0
element=int(num_list[0])
while True:
    tf=True
    for i in range(n):
        if element<int(num_list[i]):
            tf=False
            element+=1
            break
    if tf:
        ans_num=element
        break
print(str(ans_num)*n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def pri(s):
    result = ''
    for k in s:
        result += k
    print(result,end='')

s = input()
s = list(s)
if s[0] == s[1] and s[1] == s[2] and s[0] == s[2]:
    pri(s)
else:
    a = ''
    for i in range(3):
        a += str(int(s[0]) + 1)
    pri(a)

Submission status: Wrong Answer

Solution code:
N = input()
result = ''
if int(N) % 111 == 0:
    print(N)
else:
    for i in range(len(N)):
        result += str(int(N[0])+1)
    print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

if N <= 111:
    print(111)
elif 112 < N <= 222:
    print(222)
elif 222 < N <= 333:
    print(333)
elif 333 < N <= 444:
    print(444)
elif 444 < N <= 555:
    print(555)
elif 555 < N <= 666:
    print(666)
elif 666 < N <= 777:
    print(777)
elif 777 < N <= 888:
    print(888)
else:
    print(999)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
num=input()
num_list=list(num)
n=len(num)
ans_num=0
for i in range(n):
    tf=True
    for j in range(i+1,n):
        if num_list[i]<num_list[j]:
            tf=False
            break
    if tf:
        ans_num=num_list[i]
        break
print(ans_num*n)

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(111,999,111):
    if i<= n <= i+111:
        ans = i + 111
        break
    else:
      ans = 1111
print(int(ans))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys

input = sys.stdin.readline
a = input()
x = 0

for i in range(3):
    tmp = int(a[i])
    if x < tmp:
        x = tmp

print(str(x) * 3)

Submission status: Wrong Answer

Solution code:
n = int(input())
a =  n // 100
if n%10 > a:
    for _ in range(3):
        print(a,end="")
elif n%10 == a:
    for _ in range(3):
        print(a,end="")
else:
    for _ in range(3):
        print(a+1,end="")

Submission status: Wrong Answer

Solution code:
x=input()
print(int(x[0])*111)

Submission status: Wrong Answer

Solution code:
n = input()

if int(n[0]) <= int(n[1]):
    if int(n[0]) == int(n[1]) and int(n[0]) > int(n[2]):
        temp=int(n[0])
        print(temp*100+temp*10+temp)
    else:
        temp=int(n[0])+1
        print(temp*100+temp*10+temp)
else:
    temp=int(n[0])
    print(temp*100+temp*10+temp)

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(111,999,111):
    if i<= n < i+111:
        ans = i + 111
        break
    else:
      ans = 1111
print(int(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())

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

for c in x:
    if c - n < 0:
        x.remove(c)

for i in x:
    s = abs(n-i)
    s_s.append(s)

ans = s_s.index(min(s_s))
ans = x[ans]

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a =  n // 100
if n%10 > a:
    for _ in range(3):
        print(a+1,end="")
elif n%10 == a:
    for _ in range(3):
        print(a,end="")
else:
    for _ in range(3):
        print(a,end="")

Submission status: Wrong Answer

Solution code:
n=input()
length = len(n)
x = n[0]

# 10のくらいがｘ未満の場合はｘのゾロ目でよい
if n[1] < x:
    x = x*length
# 10の位がxより大きい場合はx+1のゾロ目
elif n[1] > x:
    x = str(int(x) + 1)*length
# 10の位がxと同じ場合は1の位を調べる
else:
    # 1に位がx未満ならばのゾロ目
    if n[2] < x:
        x = x *length
    # 1の位がxより大きい場合はx+1のゾロ目
    elif n[2] > x:
        x = str(int(x)+1)*length

    else:
        x = x * length
# 999の場合は別処理
if int(n) == 999:
    x = '1111'

print(x)

Submission status: Wrong Answer

Solution code:
b = str(input())
num = list(b)
appear = b.count(num[0])
if appear == 3:
    print(b)
elif num[0]>num[1]:
    c = num[0]
    d=str(c)
    print(d*3)
elif num[0] == num[1]:
    c = num[1]
    d=str(c)
    print(d*3)
else:
    c = int(num[0])+1
    d=str(c)
    print(d*3)