Problem:


Score : 100 points

Problem Statement

Cat Snuke is learning to write characters.
Today, he practiced writing digits 1 and 9, but he did it the other way around.

You are given a three-digit integer n written by Snuke.
Print the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.

Constraints

111 \leq n \leq 999

n is an integer consisting of digits 1 and 9.

Input

Input is given from Standard Input in the following format:

n

Output

Print the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.

Sample Input 1

119

Sample Output 1

991

Replace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.

Sample Input 2

999

Sample Output 2

111



Sample input:
119


Sample output:
991

Submission status: Runtime Error

Solution code:
n = int(input())
v = list(map(int,input().split()))
a = [v[i] for i in range(n) if i%2==0]
b = [v[i] for i in range(n) if i%2==1]

x = 0
y = 0
p=0
q=0

for i in range(10**5):
    if x<a.count(i):
        p=i
        x=a.count(i)
    if y<b.count(i):
        q=i
        y=b.count(i)

print(n-x-y)

Submission status: Runtime Error

Solution code:
import collections

n = int(input())
list = list(map(lambda x:int(x), input().split(' ')))
e = []
o = []
def fun1(list, i):
    if i%2 == 0 and i < n:
        e.append(list[i])
        fun1(list, i+1)
    elif i%2 == 1 and i < n:
        o.append(list[i])
        fun1(list, i+1)
fun1(list, 0)
#eとoの準備完了

ce = collections.Counter(e)
co = collections.Counter(o)
cen = ce.most_common()[0][1]
con = co.most_common()[0][1]
print(n-cen-con)

Submission status: Runtime Error

Solution code:
n = str(input())
for i in range(2):
  if n[i] == '1':
    n[i] = '9'
  elif n[i] == '9':
    n[i] = '1'
print(n)

Submission status: Runtime Error

Solution code:
n = int(input())
lst = str(input()).split(' ')

p1 = [0]*(max([int(i) for i in lst])+1)
p2 = [0]*(max([int(i) for i in lst])+1)
for idx in range(n):
	if idx%2 == 0:
		p1[int(lst[idx])] += 1
	else:
		p2[int(lst[idx])] += 1

pp1 = p1.index(max(p1))
pp2 = p2.index(max(p2))
if pp1 == pp2:
	if max(p1) >= max(p2):
		pp1 = p1.index(max(p1))
		pp2 = p2.index(sorted(p2)[-2])
	elif max(p2) > max(p1):
		pp1 = p1.index(sorted(p1)[-2])
		pp2 = p2.index(max(p2))

cnt1 = 0
cnt2 = 0
for idx in range(n):
	if idx%2 == 0:
		if not lst[idx] == str(pp1):
			cnt1 += 1
	else:
		if not lst[idx] == str(pp2):
			cnt2 += 1

print(cnt1 + cnt2)

Submission status: Runtime Error

Solution code:
from collections import Counter


def main():
    n = int(input())
    v_n = input().split(' ')
    
    guusuu = Counter(v_n[::2])
    kisuu = Counter(v_n[1::2])

    guusuu = guusuu.most_common()
    kisuu = kisuu.most_common()


    if guusuu[0][0]==kisuu[0][0]:
        if len(guusuu)==1 and len(kisuu)==1:
            print(guusuu)
        else:
            print(min(n - guusuu[0][1] - kisuu[1][1], n- guusuu[1][1] - kisuu[0][1]))
    else:
        print(n - guusuu[0][1] - kisuu[0][1])
        
main()

Submission status: Runtime Error

Solution code:
n = int(input())
lst = str(input()).split(' ')

p1 = lst[0]
p2 = lst[1]
new_lst = []
for idx in range(n):
	if idx%2 == 0:
  		new_lst.append(p1)
	else:
		new_lst.append(p2)

cnt = 0
for o, l in zip(lst, new_lst):
	if not o == l:
		cnt +=1
if p1 == p2:
  print(int(n/2))
else:
  print(cnt)

Submission status: Runtime Error

Solution code:
n = str(input())
one_idx = []
nine_idx = []
for idx in range(n):
	if n[idx]=='1':
		one_idx.append(idx)
    if n[idx]=='9':
		nine_idx.append(idx)

for idx in range(n):
	if idx in one_idx:
		n[idx] = '9'
    if idx in nine_idx:
		n[idx] = '1'
          
print(n)

Submission status: Runtime Error

Solution code:
x=input()
n=[x[i] for i in range(len(n))]
for i in range(len(n)):
  if n[i]=="1"or"9":
    if n[i]=="1":
      n[i]="9"
    else:
      n[i]=="1"
print(int("".join(n)))

Submission status: Runtime Error

Solution code:
n=input()
for i in range(len(n)):
  if n[i]=="1"or"9":
    if n[i]=="1":
      n[i]="9"
    else:n[i]=="1"
print(int(n))

Submission status: Runtime Error

Solution code:
s = input()
t = ''
for c in s:
    if c = '1':
        t += '9'
    elif c = '9':
        t += '1'
print(t)

Submission status: Runtime Error

Solution code:
n =input()

for i in range(n):
	if n[i] == '9':
		n[i] = '1'
	else:
		n[i] = '9'
print(n)

Submission status: Runtime Error

Solution code:
s = input()
for i in range(3):
    if s[i] == '1':
        s[i] = '9'
    elif s[i] == '9':
        s[i] = '1'
print(s)

Submission status: Runtime Error

Solution code:
import collections
n=int(input())
arr=input().split(" ")
arr_s=set(arr)
a=0
arr_e=[0 for i in range(int(n/2))]
arr_o=[0 for i in range(int(n/2))]
for i in range(int(n/2)):
    arr_e[i]=arr[a]
    arr_o[i]=arr[a+1]
    a+=2
ce=collections.Counter(arr_e).most_common()
co=collections.Counter(arr_o).most_common()
if len(arr_s)==1:
    print(int(n/2))
else:
    if ce[0][0]!=co[0][0]:
        print(n-ce[0][1]-co[0][1])
    else:
        print(n-max(ce[0][1]+co[1][1],ce[1][1]+co[0][1]))

Submission status: Runtime Error

Solution code:
n=int(input())
arr=input().split(" ")
arr_s=set(arr)
#print(arr)
a=0
most_e=0
most_o=0
arr_e=[0 for i in range(int(n/2))]
arr_o=[0 for i in range(int(n/2))]
for i in range(int(n/2)):
    arr_e[i]=arr[a]
    arr_o[i]=arr[a+1]
    a+=2
#print(arr_e,arr_o)
arr_es=set(arr_e)
arr_os=set(arr_o)
#print(arr_es,arr_os)

for i in arr_es:
    cnt_e=arr_e.count(i)
    if cnt_e>most_e:
        most_e=cnt_e
        if cnt_e>=n/4:
            break
        
for i in arr_os:
    cnt_o=arr_o.count(i)
    if cnt_o>most_o:
        most_o=cnt_o
        if cnt_o>=n/4:
            break

#print(most_e,most_o)
if len(arr_s)==1:
    print(int(n/2))
else:
    print(n-most_e-most_o)

Submission status: Runtime Error

Solution code:
import sys
n=int(input())
arr=input().split(" ")
arr_s=set(arr)
if len(arr_s)==1:
    print(int(n/2))
    sys.exit()
#print(arr)
a=0
most_e=0
most_o=0
arr_e=[0 for i in range(int(n/2))]
arr_o=[0 for i in range(int(n/2))]
for i in range(int(n/2)):
    arr_e[i]=arr[a]
    arr_o[i]=arr[a+1]
    a+=2
#print(arr_e,arr_o)
arr_es=set(arr_e)
arr_os=set(arr_o)
#print(arr_es,arr_os)

for i in arr_es:
    cnt_e=arr_e.count(i)
    if cnt_e>most_e:
        most_e=cnt_e
        
for i in arr_os:
    cnt_o=arr_o.count(i)
    if cnt_o>most_o:
        most_o=cnt_o

#print(most_e,most_o)
else:
    print(n-most_e-most_o)

Submission status: Runtime Error

Solution code:
n=input()

if(n[0] == 1):
  n[0] = 9
else:
  n[0] = 1
if(n[1] == 1):
  n[1] = 9
else:
  n[1] = 1
if(n[2] == 1):
  n[2] = 9
else:
  n[2] = 1

Submission status: Runtime Error

Solution code:
n=input()
for i in range(len(n))
if(n[0] == 1):
  n[0] = 9
else:
  n[0] = 1
if(n[1] == 1):
  n[1] = 9
else:
  n[1] = 1
if(n[2] == 1):
  n[2] = 9
else:
  n[2] = 1

Submission status: Runtime Error

Solution code:
num = input().split()
result = ""
for i in num:
    if num[i] == 1:
        result += '9'
    if num[i] == 9:
        result += '1'
print(result)

Submission status: Runtime Error

Solution code:
from collections import Counter
N = int(input())
v = input().split()

odd = v[0::2]
even = v[1::2]

o = Counter(odd).most_common(3)
e = Counter(even).most_common(3)

ans = int(N/2)
for d1 in o:
    for d2 in e:
        if d1[0]==d2[0] :
            continue
        ans = min(ans, N-d1[1]-d2[1])

print(ans)

Submission status: Runtime Error

Solution code:
#import itertools
import collections

def op(v):
    count = collections.Counter(v).most_common() 

    #v_ = itertools.groupby(sorted(v))
    #count = sorted([(k, len(list(g))) for k, g in v_], key = lambda x:x[1])
    return count

n = int(input())
V = [int(n) for n in input().split()]

if len(set(V)) == 1:
    ans = len(V) // 2
else:
    vp_ = [v for i, v in enumerate(V) if i%2 == 0] 
    vn_ = [v for i, v in enumerate(V) if i%2 != 0] 

    vp = op(vp_)
    vn = op(vn_)    

    if vp[-1][0] != vn[-1][0]:
        gp = vp[-1][1]
        gn = vn[-1][1]
    else:
        if vp[-1][1] > vn[-1][1]:
            gp = vp[-1][1]
            gn = vn[-2][1]
        else:
            gp = vp[-2][1]
            gn = vn[-1][1]

    #ans_p = sum([g for k, g in vp]) - gp
    #ans_n = sum([g for k, g in vn]) - gn

    #ans  = ans_p + ans_n
    ans = n - gp - gn

print(ans)

Submission status: Runtime Error

Solution code:

N=[]

while True:

    
    for i in range(1,4):
        print("1から9の任意の自然数を入力せよ。また処理を終了する場合はqを入力せよ。")
        n=input(i)
        
        if n=="q":
            break
        
        if n=="1":
            N.append("9")
        elif n=="9":
            N.append("1")
        else:
            N.append(n)

    print("".join(N))

    N=[]

    if n=="q":
        break

Submission status: Runtime Error

Solution code:
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**7) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())
 
# h,w = li()
# ss = [ns() for _ in range(h)]

n = int(input())

vs = li()
v_odd = []
v_even = []

i=0
for v in vs:
    if i % 2 == 0:
        v_even.append(v)
    else:
        v_odd.append(v)
    i = i + 1

max_count_odd = 0

m_odd = 0
m_even = 0
for ss in set(v_odd):
    count = v_odd.count(ss)
    if count > max_count_odd:
        max_count_odd = count
        m_odd = ss
# import pdb;pdb.set_trace() 
max_count_even = 0
for ss in set(v_even):
    count = v_even.count(ss)
    if count > max_count_even:
        max_count_even = count
        m_even = ss
# import pdb;pdb.set_trace() 
ans = len(v_even)-max_count_even  +  len(v_odd)-max_count_odd

m2_oddmax = 0
m2_evenmax = 0
import copy
# import pdb;pdb.set_trace()
if(m_even==m_odd):
    temp = set(v_odd)
    temp.remove(m_odd)
    m2_odd = 0
    # import pdb;pdb.set_trace()
    for ss in temp:
        count = v_odd.count(ss)
        if count > m2_oddmax:
            m2_oddmax = count
            m2_odd = ss
    temp = set(v_even)
    temp.remove(m_even)
    m2_even = 0
    for ss in temp:
        count = v_even.count(ss)
        if count > m2_evenmax:
            m2_evenmax = count
            m2_even = ss
    if m2_evenmax > m2_oddmax:
        # import pdb;pdb.set_trace()
        ans = len(v_even)-m2_evenmax + len(v_odd)-max_count_odd
    elif m2_evenmax <= m2_oddmax:
        # import pdb;pdb.set_trace()
        ans = len(v_even)-max_count_even + len(v_odd)-m2_oddmax
    if m2_even == 0 and m2_odd == 0:
        ans = int(n/2)
    # import pdb;pdb.set_trace()


print(ans)

Submission status: Runtime Error

Solution code:
n = input()
ans = “”
for a in n:
  if a == “1”:
    ans  = ans + “9”
  else:
    ans = ans + “1”
print(ans)

Submission status: Runtime Error

Solution code:
n = input()
ans = “”
for a in n:
  if a == “1”:
    ans  = ans + “9”
  else:
    ans = ans + “1”
print(ans)

Submission status: Runtime Error

Solution code:
n = input()
n = [‘1’ for a in n if a==‘9’ else ‘9’]
print(“”.join(n))

Submission status: Runtime Error

Solution code:
n = input()

def change(d):
  if d == '1':
    return '9'
  elif d == '9':
   	return '1'
  else
  	return d

print(''.join([change(d) for d in n]))

Submission status: Runtime Error

Solution code:
num = str(input())
for i in range(3):
    if num[i] == '1':
        num[i] = '9'
    else:
        num[i] = '1':
answer = num[0]+num[1]+num[2]
print(int(answer))

Submission status: Runtime Error

Solution code:
N=input(n)

for i in range(1,3):
	n[i]=10-N[i]

Submission status: Runtime Error

Solution code:
n=input()
d=["9":"1","1":"9"]
"".join(d[x] for x in n)

Submission status: Runtime Error

Solution code:
n=input()
d={"9":"1","1":"9"}
"".join(d[x] for in n)

Submission status: Runtime Error

Solution code:
n = int(input())
v = list(map(int,input().split()))
l1 = []
l2 = []
for i,v_ in enumerate(v):
    if i%2==0:
        l1.append(v_)
    else:
        l2.append(v_)

from collections import Counter
if set(l1)==set(l2):
    print(n//2)
else:
    c1 = Counter(l1).most_common(2)
    c2 = Counter(l2).most_common(2)
    if c1[0][0]==c2[0][0]:
        print(n-max(c1[0][1]+c2[1][1], c1[1][1]+c2[0][1]))
    else:
        print(n-c1[0][1]-c2[0][1])

Submission status: Runtime Error

Solution code:
a=int(input())
for i in a:
  if i ==1:
    i=9
  elif i ==9:
    i=1
  print(int(a))

Submission status: Runtime Error

Solution code:
a=int(input())
print(a.replace(1,9).replace(9,1))

Submission status: Runtime Error

Solution code:
print(int(input()).replace(1,9).replace(9,1))

Submission status: Runtime Error

Solution code:
print(input().replace(1,9).replace(9,1))

Submission status: Runtime Error

Solution code:
n = input()

print(n.translate(str.maketrans({"1":"9", "9":"1"}))

Submission status: Runtime Error

Solution code:
def main(n:int,lst:list)->int:
    b = True
    lst1 = []
    lst2 = []
    for e in lst:
        if b:
            lst1.append(e)
        else:
            lst2.append(e)
        b = not b
    lst1.sort()
    lst2.sort()
    c1 = [["",0],0]
    c2 = [["",0],0]
    last =lst1[0]
    a = 0
    for e in lst1:
        if last == e:
            a +=1
        else:
            if a >= c1[0][1]:
                c1[1] = c1[0][1]
                c1[0][0] = e
                c1[0][1] = a
            elif a > c1[1]:
                c1[1] = a
            last = e
            a = 1
    if a >= c1[0][1]:
        c1[1] = c1[0][1]
        c1[0][0] = e
        c1[0][1] = a
    elif a > c1[1]:
        c1[1] = a

    last =lst2[0]
    a = 0
    for e in lst2:
        if last == e:
            a +=1
        else:
            if a >= c2[0][1]:
                c2[1] = c2[0][1]
                c2[0][0] = e
                c2[0][1] = a
            elif a > c2[1]:
                c2[1] = a
            last = e
            a = 1
    if a >= c2[0][1]:
        c2[1] = c2[0][1]
        c2[0][0] = e
        c2[0][1] = a
    elif a > c2[1]:
        c2[1] = a

    if c1[0][0] == c2[0][0]:
        if c1[0][1] > c2[0][1] or(c1[0][1] == c2[0][1] and c2[1] > c1[1]):
            return n - c1[0][1] - c2[1]
        else:
            return n - c2[0][1] - c1[1]
    else:
        return n - c1[0][1] - c2[0][1]

n = int(input())
lst = input().split()
print(main(n,lst))

Submission status: Runtime Error

Solution code:
import collections
def main(n:int,lst:list)->int:
    b = True
    lst1 = []
    lst2 = []
    for e in lst:
        if b:
            lst1.append(e)
        else:
            lst2.append(e)
        b = not b
    c1 = collections.Counter(lst1).most_common()
    c2 = collections.Counter(lst2).most_common()
    if c1[0][0] == c2[0][0]:
        if c1[0][1] > c2[0][1]:
            if len(c2) == 1:
                return n - c1[0][1]
            else:
                return n - c1[0][1] - c2[1][1]
        else:
            if len(c1) == 1:
                return n - c2[0][1]
            else:
                return n - c2[0][1] - c1[1][1]
    else:
        return n - c1[0][1] - c2[0][1]

n = int(input())
lst = list(map(int,input().split()))
print(main(n,lst))

Submission status: Runtime Error

Solution code:
n = input()

lst = []
res = []

while n > 0:
    lst.append(n%10)
    n //= 10
lst.reverse()

for i in lst:
    if i == 1:
        res.append(9)
    elif i == 9:
        res.append(1)
    else:
        res.append(i)

S = ""

for j in res:
    Str += str(j)

print(S)

Submission status: Runtime Error

Solution code:

n = input()

lst = []
res = []

while n > 0:
    lst.append(n%10)
    n //= 10
lst.reverse()

for i in lst:
    if i == 1:
        res.append(9)
    elif i == 9:
        res.append(1)
    else:
        res.append(i)

Str = ""

for j in res:
    Str += str(j)

print(Str)

Submission status: Runtime Error

Solution code:
import collections

num = int(input())
values = [int(i) for i in input().split()]

odd = []  # kisuu
even = []  # gusu

for n, i in enumerate(values):
    if (n + 1) % 2 == 0:
        even.append(i)
    else:
        odd.append(i)

odd_counts = collections.Counter(odd)
even_counts = collections.Counter(even)

# print(odd_counts.most_common())
# print(even_counts.most_common())

odd_most_common = odd_counts.most_common()
even_most_common = even_counts.most_common()

half_num = int(num / 2)

if odd_most_common[0][0] != even_most_common[0][0]:
    odd_replace_num = half_num - odd_most_common[0][1]
    even_replace_num = half_num - even_most_common[0][1]
    print(odd_replace_num + even_replace_num)
else:
    answers = []
    odd_replace_num = half_num - odd_most_common[0][1]
    if len(even_most_common) == 1:
        even_replace_num = half_num
    else:
        even_replace_num = half_num - even_most_common[1][1]
    answers.append(odd_replace_num + even_replace_num)

    if len(odd_most_common) == 1:
        odd_replace_num = half_num
    else:
        odd_replace_num = half_num - odd_most_common[1][1]
    even_replace_num = half_num - even_most_common[0][1]
    answers.append(odd_replace_num + even_replace_num)

    print(min(answers))

Submission status: Runtime Error

Solution code:
a=list(input())
print(a.replace("1","9").replace("9","1"))

Submission status: Runtime Error

Solution code:
s=input()
foi i in s:
  if i=="9":
    print('1',end="")
  else:
    print("9",end="")
print()

Submission status: Runtime Error

Solution code:
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using static System.Math;


class P
{
    static void Main()
    {
        Console.WriteLine(Console.ReadLine().Replace('1', 'x').Replace('9', '1').Replace('x', '9'));
    }
}

Submission status: Runtime Error

Solution code:
n=io.read()
n=string.gsub(n, "9", "*")
n=string.gsub(n, "1", "9")
n=string.gsub(n, "*", "1")
print(n)

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
a=10-a
b=10-b
c=10-c
s=[a,b,c]
print("".join(s))

Submission status: Runtime Error

Solution code:
n = input()
r = [10 - int(n[i]) for i in range(n)]
print("".join(map(str, r)))

Submission status: Runtime Error

Solution code:
n = input()
if n[0]=1:
  n[0]=9
else:
  n[0]=1
if n[1]=1:
  n[1]=9
else:
  n[1]=1
if n[2]=1:
  n[2]=9
else:
  n[2]=1

print(n)

Submission status: Runtime Error

Solution code:
n = list(input())
for i range(len(n)):
  n[i] = "1" if n[i]==9 else "9"
ans = ','.join(n)
print(ans)

Submission status: Runtime Error

Solution code:
from collections import Counter

n = int(input())
v = list(map(int,input().split()))
a1 = []
a2 = []
for i in range(n):
    if i % 2 == 0:
        a1.append(v[i])
    else:
        a2.append(v[i])

a1 = Counter(a1)
a2 = Counter(a2)

a1 = a1.most_common()
a2 = a2.most_common()

if a1[0][0] == a2[0][0]:
    if len(a1) == 1 and len(a2) == 1:
        print(int(n/2))
    else:
        if a1[1][1] > a2[1][1]:
            print(n-a1[1][1]-a2[0][1])
        else:
            print(n-a1[0][1]- a2[1][1])
else:
    print(n - a1[0][1] - a2[0][1])

Submission status: Runtime Error

Solution code:
from collections import Counter

n = int(input())
v = list(map(int,input().split()))
a1 = []
a2 = []
for i in range(n):
    if i % 2 == 0:
        a1.append(v[i])
    else:
        a2.append(v[i])

a1 = Counter(a1)
a2 = Counter(a2)

a1 = a1.most_common()
a2 = a2.most_common()

if a1[0][0] == a2[0][0]:
    if len(a1) == 1 and len(a2) == 1:
        print(n/2)
    else :
        if a1[1][1] > a2[1][1] :
            print(n-a1[1][1]-a2[0][1])
        else :
            print(n-a1[0][1]- a2[1][1])
else:
    print(n - a1[0][1] - a2[0][1])

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:
# -*- coding utf-8 -*-
n = str(input())
S = n.replace(1,8)
T = S.replace(9,1)
U = T.replace(8,9)
print(U)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
S = n.replace(1,9).replace(9,1)
print(S)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
n = str(input())
S = n.replace(1,9).replace(9,1)
print(S)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
n = str(input())
S = n.replace(1,9).replace(9,1)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
n = str(input())
m.replace(1,9:9,1)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
n=int(input())
n.replace("1","9")and("9","1")

Submission status: Runtime Error

Solution code:
n = input()

print(n.replace(1, 9).replace(9, 1))

Submission status: Runtime Error

Solution code:
n = input()
print(''.join(map(lambda c: '9' if c == '1' else '1' if c == '9' else c, n))

Submission status: Runtime Error

Solution code:
import sys

def replace(a):
	if a=="9":
		return "1"
	elif a=="1":
		return "9"
	else:
		return a
num=sys.argv[1]
num1="".join(map(replace,num))
print(int(num1))

Submission status: Runtime Error

Solution code:
import sys

def replace(a):
	if a=="9":
		return "1"
	elif a=="1":
		return "9"
	else:
		return a
num=sys.argv[1]
num1="".join(map(replace,num))
print(num1)

Submission status: Runtime Error

Solution code:
n = input()
for i in range(n):
  if n[i] == "1":
    n[i] = "9"
  else:
    n[i] = "1"
print(n)

Submission status: Runtime Error

Solution code:
N = int( input())

n = N // 100

if( N % 100 <= n * 10 + n):
	print(n * 100 + n * 10 + n )
  
else:

Submission status: Runtime Error

Solution code:
import collections
n = (int)(input())
l = list(map(int,input().split()))
a = l[::2]
b=l[1::2]

a_c=collections.Counter(a).most_common()
b_c=collections.Counter(b).most_common()
if a_c[0][0]==b_c[0][0]:
    if a_c[0][1]==b_c[0][1]:
        print(n//2)
    elif a_c[0][1]>b_c[0][1]:
        if len(b_c)>1:
            print(n-a_c[0][1]-b_c[1][1])
        else:
            print(n-a_c[0][1])
    else:
        if len(a_c)>1:
            print(n-a_c[1][1]-b_c[0][1])
        else:
            print(n-b_c[0][1])
else:
    print(n-a_c[0][1]-b_c[0][1])

Submission status: Runtime Error

Solution code:
n = list(map( int, sinput()))
 
h = 3
for i in range(h):
  if( n[i] == 1):
    n[i] = 9
    n[i] = str(n[i])   
  else:
    n[i] = 1
    n[i] = str(n[i])
    
a = "".join(n)
 
print(a)

Submission status: Runtime Error

Solution code:
n = list(map( int, split()))
 
h = 3
for i in range(h):
  if( n[i] == 1):
    n[i] = 9
    n[i] = str(n[i])   
  else:
    n[i] = 1
    n[i] = str(n[i])
    
a = "".join(n)
 
print(a)

Submission status: Runtime Error

Solution code:
n = list(map( int, split()))

h = 3
for i range(h):
  if( n[i] == 1):
    n[i] = 9
    n[i] = str(n[i])   
  else:
    n[i] = 1
    n[i] = str(n[i])
    
a = "".join(n)

print(a)

Submission status: Runtime Error

Solution code:
char = input()
chars = []
chars.append(char.split())

for cha in chars:
  if cha == 1:
    cha = 9
  else cha == 9:
    cha = 1
  print(cha, end="")

Submission status: Runtime Error

Solution code:
from collections import Counter
n = int(input().strip())
a = list(map(int, input().strip().split()))
cnt1 = Counter(a[::2]).most_common(2)
c11, c12 = (cnt1 if len(cnt1) == 2 else cnt1+[('', 0)])
cnt2 = Counter(a[1::2]).most_common(2)
c21, c22 = (cnt2 if len(cnt2) == 2 else cnt2+[('', 0)])

if c11[0] != c21[0]:
    print(n - c11[1] - c21[1])
else:
    print(n - max(c11[1]+c22[1], c12[1]+c21[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 = int(input())
n = n.replace("1"," ").replace('9','1').replace(' ','9')
print(n)

Submission status: Runtime Error

Solution code:
s.replace('1','a')
s.replace('9','1')
s.replace('a','9')
print(str(n))

Submission status: Runtime Error

Solution code:
n = input()

for i,v in enumerate(n):
  if v == '9':
    n[i] = '1'
  elif v == '1':
    n[i] = '9'
    
print(n)

Submission status: Runtime Error

Solution code:
from collections import Counter
n = int(input().strip())
a = list(map(int, input().strip().split()))

c1 = Counter(a[::2])
c2 = Counter(a[1::2])
c1f1 = max(c1, key = lambda k:c1[k])
c2f1 = max(c2, key = lambda k:c2[k])

if c1f1 != c2f1:
  return n - c1[c1f1] - c2[c2f1]
else:
  if c1[c1f1] > c2[c2f1]:
    del c2[c2f1]
    if not c2: return n-c1[c1f1]
    c2f1 = max(c2, key = lambda k:c2[k])
    return n-c1[c1f1] - c2[c2f1]
  else:
    del c1[c1f1]
    if not c1: return n-c2[c2f1]
    c1f1 = max(c1, key = lambda k:c1[k])
    return n-c1[c1f1] - c2[c2f1]

Submission status: Runtime Error

Solution code:
n = int(input())
XY = [list(map(int, input().split())) for _ in range(n)]
mod = sum(XY[0])%2
for x, y in XY:
    if mod != (x+y)%2:
        print(-1)
        exit()
m = 33-mod
print(m)
D = [2**i for i in range(31, -1, -1)]
if mod == 0:
    D.append(1)
print(" ".join(map(str, D)))
for x, y in XY:
    w = " "
    for d in D:
        if x-y >= 0 and x+y >= 0:
            w += "R"
            x -= d
        elif x-y < 0 and x+y >= 0:
            w += "U"
            y -= d
        elif x-y >= 0 and x+y < 0:
            w += "D"
            y += d
        else:
            w += "L"
            x += d
    print(w)

Submission status: Runtime Error

Solution code:
print(1110-int(inpout()))

Submission status: Runtime Error

Solution code:
a = str(input())
for i in range(len(a)):
  if a[i] == "1":
  	a[i] = "9"
  else:
    a[i] = "1"
print(a)

Submission status: Runtime Error

Solution code:
l=list(map(int,input().split()))
for i in range(3):
  if l[i]==1:
    l[i]=9
  else:
    l[i]=1
print(l)

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
if a*10+b>b*10+c:
  print(a*10+b+c)
else:
  print(b*10+c+a)

Submission status: Runtime Error

Solution code:
# coding:utf-8
# 找第二大的数的个数
n = input()
array = map(int, raw_input().split())
e_list = [array[i] for i in range(0, n, 2)]
o_list = [array[i] for i in range(1, n+1, 2)]


def process(arr):
    arr.sort()
    num = arr[0]
    counter = 0
    amt_arr = []
    arr.append(0)
    max = 0
    max_amt_num = []
    for i in arr:
        if i == num:
            counter += 1
        else:
            if counter > max:
                max_amt_num = [num]
                max = counter
            elif counter == max:
                max_amt_num.append(num)
                max = counter
            num = i
            amt_arr.append(counter)
            counter = 1
    if len(amt_arr) == 1:
        amt_arr.append(0)
    if len(max_amt_num) > 1:
        max_amt_num = "haha"
    amt_arr.sort()

    return amt_arr[-1], amt_arr[-2], max_amt_num
v1, v2, a1 = process(e_list)
v3, v4, a2 = process(o_list)
if a1 != a2 and a1 != "haha":
    result = len(array) - v1 - v3
else:
    result = len(array) - max(v1+v4, v2+v3)
print result

Submission status: Runtime Error

Solution code:
# abc111_c_new

from collections import Counter


def solve(n, seq):
    odd = seq[::2]  # odd numbers of the seq
    even = seq[1::2]  # even numbers of the seq

    # print(odd)
    # print(even)

    # odd = Counter(odd).most_common()  # example -> returns [(1, 5), (2, 5)]
    # even = Counter(even).most_common()
    odd = sorted([(k, v) for k, v in Counter(odd).items()], key=lambda x: x[1], reverse=True)
    even = sorted([(k, v) for k, v in Counter(even).items()], key=lambda x: x[1], reverse=True)

    # print(odd)
    # print(even)

    sol = 0
    if odd[0][0] == even[0][0]:
        if len(odd) == 1 and len(even) == 1:  # seq [1, 1, 1, 1]  (special case)
            sol = int(n // 2)  # [1, 1, 1, 1] sol = N / 2
        else:
            if odd[0][1] > even[1][1]:
                # sol = n - odd[0][1] - even[1][1] ==
                sol = (n // 2 - odd[0][1]) + (n // 2 - even[1][1])
            else:
                # sol = n - odd[1][1] - even[0][1] ==
                sol = (n // 2 - odd[1][1]) + (n // 2 - even[0][1])
    else:
        # sol = n - odd[0][1] - even[0][1] ==
        sol = (n // 2 - odd[0][1]) + (n // 2 - even[0][1])

    return sol


if __name__ == "__main__":
    n = int(input())
    seq = list(map(int, input("").split(" ")))
    print(solve(n, seq))

Submission status: Runtime Error

Solution code:
# abc111_c_new


from collections import Counter


def solve(n, seq):
    odd = seq[::2]                      # odd numbers of the seq
    even = seq[1::2]                    # even numbers of the seq

    odd = Counter(odd).most_common()    # example -> returns [(1, 5), (2, 5)]
    even = Counter(even).most_common()

    sol = 0
    if odd[0][0] == even[0][0]:
        if len(odd) == 1 and len(even) == 1:
            sol = int(n / 2)
        else:
            if odd[1][1] > even[1][1]:
                sol = n - odd[1][1] - even[0][1]
            else:
                sol = n - odd[0][1] - even[1][1]
    else:
        sol = n - odd[0][1] - even[0][1]

    return sol


if __name__ == "__main__":
    n = int(input())
    seq = list(map(int, input("").split(" ")))
    print(solve(n, seq))

Submission status: Runtime Error

Solution code:
a=input()
b=1110-a
print(b)

Submission status: Runtime Error

Solution code:
a=input()
b=a.translate("1":"9","9":"1")
print(b)

Submission status: Runtime Error

Solution code:
a=str(input())
b=a.replace(1,9)
c=b.replace(9,1)
print(b)

Submission status: Runtime Error

Solution code:
a=input()
b=a.replace(1,9)
c=b.replace(9,1)
print(b)

Submission status: Runtime Error

Solution code:
a=input()
b=a.replace((1,9)and(9,1))
print(b)

Submission status: Runtime Error

Solution code:
N,x=map(int,input().split())
l=list(map(int,input().split()))
ans=0
l.sort()

for n in range(N):
    if n!=N-1:
        if l[n]<x:
            x-=l[n]
            ans+=1
        elif l[n]==x:
            x-=l[n]
            ans+=1
            break
        else:
            break
    else:
        if l[n]==x:
            x-=l[n]
            ans+=1
        else:
            break

print(ans)

Submission status: Runtime Error

Solution code:
print(1110-input())

Submission status: Runtime Error

Solution code:
import collections
n = int(input())
v = list(input().split())
 
v_odd = []
v_even = []
 
for i in range(int(n)):
  if i % 2 == 1:
  	v_odd.append(i)
  
for i in range(int(n)):
  if i % 2 == 0:
  	v_even.append(i)
  
v_odd_counter = collections.Counter(v_odd)
a = v_odd_counter.most_common()[0][1]
 
v_even_counter = collections.Counter(v_even)
b = v_even_counter.most_common()[0][1]
 
print(n - a - b)

Submission status: Runtime Error

Solution code:
print(1100-int((input()))

Submission status: Runtime Error

Solution code:
n = str(input())

result = n.replace('1', '2').replace('9','1').replace('2','9')

return result

Submission status: Runtime Error

Solution code:
n = input()
ln = list(n)

for i in range(len(ln)):
    if ln[i] == '1':
        ln[i] = '9'
    elif ln[i] == '9':
        ln[i] = '1'
        
n = ''.join(ln)
print(n = ''.join(ln))

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python

s = inputs()
for c in s:
    if c == "9":
        print("1", end="")
    else:
        print("9", end="")

Submission status: Runtime Error

Solution code:
n = int(input())

n_letters = str(n)

for i in n_letters:
    if n_letters[i] == "1":
        n_letters[i] = "9"
    elif n_letters[i] == "9":
        n_letters[i] = "1"

Submission status: Runtime Error

Solution code:
n = input()
ans = ''
for i in n:
    if n[i] == '1':
        ans += '9'
    elif n[i] == '9':
        n[i] += '1'
    else:
        ans += n[i]
print(ans)