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: Runtime Error

Solution code:
n=int(input())

if n%111==0:
  print(n)
else:
  while n%111>0:
    ans=n
    n+=1
print(ans+1)

Submission status: Runtime Error

Solution code:
N = int(input())
for i in range(N:1000):
  if(str(i)[1] == str(i)[2] and str(i)[1] == str(i)[3]):
    num = i
    break
print(num)

Submission status: Runtime Error

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

Submission status: Runtime Error

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])
    else:
        continue

Submission status: Runtime Error

Solution code:
N = int(input())

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

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

Submission status: Runtime Error

Solution code:
n = input()

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

Submission status: Runtime Error

Solution code:
n = input()
zorome = [i*100 + i*10 + i for i in range(1, 10)]

for i in zorome:
    if n <= i:
        print(i)
        exit()

Submission status: Runtime Error

Solution code:
n = int(input())
for i in range(900):
    x = list(n)
    if x[0]==x[1]==x[2]:
        print(n)
        break 
    n+=1

Submission status: Runtime Error

Solution code:
x = str(input())

while True:
  if x[0] == x[1] == x[2]:
    print(x)
    break
  
  x += 1

Submission status: Runtime Error

Solution code:
n = input()
for ans in range(111, 1000, 111):
    if n <= ans:
        break
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
str=raw_input()
if int(str[2])<int(str[1]):
  str[2]=str[1]
else:
  str[2]=str(int(str[1]+1))
  str[2]=str[1]
if int(str[1])<int(str[0]):
  str[1]=str[0]
else:
  str[1]=str(int(str[0]+1))
  str[1]=str[0]
print(str)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x = ((N - (N % 111)) / 111) * 111

Submission status: Runtime Error

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

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

int main(void){
    int n;
    cin >> n;
    int z = 0;
    while (n > z) {
        z += 111;
    }
    cout << z << endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define all(a) (a).begin(),(a).end()
#define lb(s,x) lower_bound(all(s),x)-s.begin()
#define ub(s,x) upper_bound(all(s),x)-s.begin()
#define uniq(a) a.erase(unique(all(a)),a.end())
const int INF = 1e9;

#define debug(x) cerr<<(#x)<<": "<<(x)<<endl
template<class T,class U>
ostream& operator<<(ostream& o, const pair<T,U> &p){
    o<<"("<<p.first<<", "<<p.second<<")";
    return o;
}
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }


int main(void){
    int n;
    cin >> n;
    int z = 0;
    while (n <= z) {
        z += 111;
    }
    cout << z << endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
k=int(input())
l=[]
p=[]
for i in range(1,10):
  l.append(111*i)
for i in l:
  if i-k>=0:
    p.aapend(i)
print(min(p))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
p_100 = n // 100
tmp = n % 100
p_10 = tmp // 10
p_1 = tmp % 10
if p_100 == p_10:
    if p_10 == p_1:
        print(str(p_1) * 3)
    elif p_10 <= p_1:
        print(str(p_10+1) * 3)
    elif p_10 >= p_1:
        print(str(p_10) * 3)
elif p_100 <= p_10:
    print(str(p_100+1) * 3)
elif p_100 >= p_10:
    print(str(p_100) * 3)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
in = int(input())

a = in //100
b = (in % 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: Runtime Error

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] < 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: Runtime Error

Solution code:
import sys

N = sys.stdin.readline().strip()
N = int(N)

M = math.ceil(N / 111.0)
M = int(M * 111)


print(M)

Submission status: Runtime Error

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: Runtime Error

Solution code:
n = int(input())

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

Submission status: Runtime Error

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: Runtime Error

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: Runtime Error

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: Runtime Error

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

    ans1 = AC1(N)
    ans2 = AC2(N)
    assert ans1 == ans2

    print(ans1)


def AC1(N):
    for i in range(N, 999+1):
        if len(set(list(str(i)))) == 1:
            return i


def AC2(N):
    for i in range(1, 9+1):
        if N >= 111 * i:
            return 111 * i


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n = int(input())

for p in prospects:
    if p < n:
        continue
    if p >= n:
        print(p)
        break

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#Bad_Beast
n=int(input())
if n==111:
    print(111)
if n>111 and n<=222:
    print(222)
elif n>222 and n<=333:
    print(333)
elif n>333 and n<=444:
    print(444)
elif n>444 and n<=555:
    print(555)
elif n>555 and n<=666:
    print(666)
elif n>666 and n<=777:
    print(777)
elif n>777 and n<=888:
    print(888)
elif n>888 and n<=999:
    print(999)
print(res)

Submission status: Runtime Error

Solution code:
n = int(input())
for i in range(1,10):
    t = 10-i
    if n > t*100 + t*10 + t:
        res = (t+1)*100 + (t+1)*10 + t+1
        break

print(res)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = input()
num = input(n)
ans = 0
for digit in range(1,10):
    if int(num/digit) == 111:
        ans = num
        break
    elif int(num/digit) < 111:
        ans = digit*100+digit*10+digit
        break
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a, b, c = map(int, input().split())
if a < b:
  s = b
else:
  s = a
if s < c:
  s = c
print(111 * s)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys

n = input()

if n[0] == '9':
	m = ''.join(['9']*len(n))
	if int(n) > int(m):
		print(''.join(['1']*(len(n)+1)))
		sys.exit()
	else:
		print(m)
		sys.exit()
else:
	s = n[0]
	m = ''.join([s]*len(n))
	if int(n) > int(m):
		print(''.join([s+1]*len(n)))
		sys.exit()
	else:
		print(m)
		sys.exit()

Submission status: Runtime Error

Solution code:
N=int(input())

ans=0
while(True):
   ans+=111
  if(ans>=N):
    print(ans)
    break

Submission status: Runtime Error

Solution code:
n = int(input())

ans_list = [100*x+10*x+x for x in range(10)]

for v in ans_list:
    if v > n:
        ans = v
        break
        
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
print(min([x for x in [int(x * 3) for x in list(str(N))] if x - N > 0], key=lambda x: x - N))

Submission status: Runtime Error

Solution code:
N=int(input())
if(100<N<=111):
  ptit(111)
elif(111<N<=222):
  print(222)
elif(222<N<=333):
  print(333)
elif(333<N<=444):
  print(444)
elif(444<N<=555):
  print(555)
elif(555<N<=666):
  print(666)
elif(666<N<=777):
  print(777)
elif(777<N<=888):
  print(888)
elif(888<N<=999):
  print(999)