Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np

L, R = map(int, input().split())

if L - R >= 2019:
    ans = 0
else:
    A = np.arange(L, R + 1)
    A = np.sort(A % 2019)
    ans = A[0] * A[1]

print(ans % 2019)


Fixed submission:
import sys

L, R = list(map(int, input().split()))

yy = 2019

d = 2019

if R > L+2019:
    R = L+2019

for i in range(L,R):
    im = i % yy

    for j in range(i+1, R+1):
        jm = j % yy

        if im * jm % yy <= d:
            d = im * jm % yy

print(d)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())

if L - R >= 2019:
    ans = 0
else:
    ans = 2019
    for i in range(L, R):
        x = i % 2019
        for j in range(i + 1, R + 1):
            a = x * j
            ans = min(a % 2019, ans)

print(ans)


Fixed submission:
import sys

L, R = list(map(int, input().split()))

yy = 2019

d = 2019

if R > L+2019:
    R = L+2019

for i in range(L,R):
    im = i % yy

    for j in range(i+1, R+1):
        jm = j % yy

        if im * jm % yy <= d:
            d = im * jm % yy

print(d)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())

if L - R >= 2019:
    ans = 0
else:
    ans = 2019
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            a = (i % 2019) * (j % 2019)
            ans = min(a % 2019, ans)

print(ans)


Fixed submission:
import sys

L, R = list(map(int, input().split()))

yy = 2019

d = 2019

if R > L+2019:
    R = L+2019

for i in range(L,R):
    im = i % yy

    for j in range(i+1, R+1):
        jm = j % yy

        if im * jm % yy <= d:
            d = im * jm % yy

print(d)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())

if L - R >= 2019:
    ans = 0
else:
    ans = 2019
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            a = (i * j) % 2019
            ans = min(a, ans)

print(ans)


Fixed submission:
import sys

L, R = list(map(int, input().split()))

yy = 2019

d = 2019

if R > L+2019:
    R = L+2019

for i in range(L,R):
    im = i % yy

    for j in range(i+1, R+1):
        jm = j % yy

        if im * jm % yy <= d:
            d = im * jm % yy

print(d)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())

if L - R >= 2019:
    ans = 0
else:
    ans = 2019
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            a = (i * j) % 2019
            if a < ans:
                ans = a

print(ans)


Fixed submission:
import sys

L, R = list(map(int, input().split()))

yy = 2019

d = 2019

if R > L+2019:
    R = L+2019

for i in range(L,R):
    im = i % yy

    for j in range(i+1, R+1):
        jm = j % yy

        if im * jm % yy <= d:
            d = im * jm % yy

print(d)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = [0 for _ in range(N)]

for i in range(N):
    sign = 1

    for a in A:
        ans[i] += sign * a
        sign *= -1

    t = A.pop(0)
    A.append(t)

print(*ans)

"""
ダム1: 2( a1 - a2 + a3 )
ダム2: 2( a2 - a3 + a1 )
ダム3: 2( a3 - a1 + a2 )
"""


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

ans = [0 for _ in range(N)]

sign = 1
for a in A:
    ans[0] += sign * a
    sign *= -1


for i in range(1, N):
    ans[i] = 2 * A[0] - ans[i - 1]

    t = A.pop(0)
    A.append(t)

print(*ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np


def main():
    N = int(input())
    A = np.array(list(map(int, input().split())))

    B = np.zeros([N, N])
    np.fill_diagonal(B, 1)
    ps = list(range(1, N)) + [0]
    B = B[ps, :]
    np.fill_diagonal(B, 1)
    iB = np.linalg.inv(B)

    X = np.dot(iB, A) * 2
    X = X.astype(np.int32)
    print(*X)


main()


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

ans = [0 for _ in range(N)]

sign = 1
for a in A:
    ans[0] += sign * a
    sign *= -1


for i in range(1, N):
    ans[i] = 2 * A[0] - ans[i - 1]

    t = A.pop(0)
    A.append(t)

print(*ans)
Buggy python submission (verdict: Runtime Error):
package main

import "fmt"


func main() {
	var N, K int
	fmt.Scan(&N, &K)
	a := N % K
	if a == 0 {
		fmt.Println(0)
	} else {
		fmt.Println(1)
	}
}


Fixed submission:
import sys

N, K  = list(map(int, input().split()))

if K == 1:
    print(0)
    sys.exit()

print(N-K)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict


def main():
    N = int(input())
    XY = [list(map(int, input().split())) for _ in range(N)]

    dd = defaultdict(int)
    for i in range(N - 1):
        for j in range(i + 1, N):
            a = (XY[j][0] - XY[i][0], XY[j][1] - XY[i][1])
            dd[a] += 1

    pq = max(dd, key=dd.get)

    cnt = 0
    for x, y in XY:
        if [x + pq[0], y + pq[1]] in XY:
            cnt += 1

    print(N - cnt)


main()


Fixed submission:
import itertools
from collections import defaultdict


def main():
    N = int(input())
    if N == 1:
        print(1)

    else:
        XY = [list(map(int, input().split())) for _ in range(N)]

        dd = defaultdict(int)

        for xy1, xy2 in itertools.combinations(XY, 2):
            a = (xy2[0] - xy1[0], xy2[1] - xy1[1])
            b = (-a[0], -a[1])
            dd[a] += 1
            dd[b] += 1

        print(N - max(dd.values()))


main()
Buggy python submission (verdict: Runtime Error):
import numpy as np

N, M = map(int, input().split())
A = np.array([int(input()) for _ in range(M)])
q = 1000000007

cost = np.zeros(N + 1, dtype=np.int64)
cost[0] = 1
cost[1] = 1
cost[A] = 0
cost[2] = cost[0] + cost[1]

for i in range(1, N + 1):
    cost[A] = 0
    cost[i] = (cost[i - 1] + cost[i - 2]) % q

print(cost[-1])


Fixed submission:
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
q = 1000000007

if N == 1:
    if M == 0:
        print(1)
    elif M == 1:
        print(0)
else:
    cost = [0 for _ in range(N + 1)]
    cost[0] = 1

    cnt = 0
    A.append([0])
    for i in range(1, N + 1):
        if i == A[cnt]:
            cost[i] = 0
            cnt += 1
        else:
            cost[i] = (cost[i - 1] + cost[i - 2]) % q

    print(cost[-1])

Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
import math

N, M = list(map(int, input().split()))
A = np.zeros(M)

for i in range(M):
    A[i] = int(input())


# a が連続しているとだめ
for i in range(M-1):
    if A[i] == A[i+1]-1:
        print(0)
        sys.exit()

# 穴同士の間隔を考えて，積を取る
d = np.zeros(M+1)

for i in range(M-1):
    d[i+1] = A[i+1] - A[i] - 2

d[0] = A[0] - 1
d[-1] = N - A[-1] - 1


p = np.zeros(M+1)

for i in range(M+1):

    n = int(d[i] // 2)

    for j in range(1,n+1):
        # 2の数 j個
        # 1の数 n1 = d - 2j
        n1 = d[i] - 2*j
        pp = math.factorial(n1+j)/(math.factorial(j) * math.factorial(n1))
        p[i] += pp

    p[i] += 1

mm = 1000000007
p = p % mm

print(int(np.prod(p) % mm))

Fixed submission:
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
q = 1000000007

if N == 1:
    if M == 0:
        print(1)
    elif M == 1:
        print(0)
else:
    cost = [0 for _ in range(N + 1)]
    cost[0] = 1

    cnt = 0
    A.append([0])
    for i in range(1, N + 1):
        if i == A[cnt]:
            cost[i] = 0
            cnt += 1
        else:
            cost[i] = (cost[i - 1] + cost[i - 2]) % q

    print(cost[-1])
Buggy python submission (verdict: Time Limit Exceeded):
import networkx as nx

N = int(input())

UVW = [list(map(int, input().split())) for _ in range(N - 1)]

G = nx.Graph()

color = [0 for _ in range(N)]  # 0: tbd，1: white, 2: black

for u, v, w in UVW:
    G.add_edge(u - 1, v - 1, weight=w)

color[0] = -1

for i in range(N - 1):
    if color[i] == 0 or i == 0:
        for j in range(i + 1, N):
            if color[j] == 0:
                d = nx.shortest_path_length(G, source=i, target=j, weight="weight")
                if int(d + 0.5) % 2 == 0:
                    color[j] = color[i]
                else:
                    color[j] = color[i] * -1

ans = [1 if i == -1 else 0 for i in color]
print(*ans)


Fixed submission:
import networkx as nx

N = int(input())
UVW = [list(map(int, input().split())) for _ in range(N - 1)]

G = nx.Graph()

color = [0 for _ in range(N)]

for u, v, w in UVW:
    G.add_edge(u - 1, v - 1, weight=w)

color[0] = -1

pred, dist = nx.dijkstra_predecessor_and_distance(G, 0)

c = [dist[i] for i in range(N)]
ans = [1 if i % 2 == 0 else 0 for i in c]
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
import networkx as nx

N = int(input())

UVW = [list(map(int, input().split())) for _ in range(N - 1)]

G = nx.Graph()

color = [0 for _ in range(N)]  # 0: tbd，1: white, 2: black

for u, v, w in UVW:
    G.add_edge(u - 1, v - 1, weight=w)

color[0] = -1

for i in range(N - 1):
    for j in range(i + 1, N):
        if color[j] == 0:
            d = nx.shortest_path_length(G, source=i, target=j, weight="weight")
            if int(d + 0.5) % 2 == 0:
                color[j] = color[i]
            else:
                color[j] = color[i] * -1

ans = [1 if i == -1 else 0 for i in color]
print(*ans)


Fixed submission:
import networkx as nx

N = int(input())
UVW = [list(map(int, input().split())) for _ in range(N - 1)]

G = nx.Graph()

color = [0 for _ in range(N)]

for u, v, w in UVW:
    G.add_edge(u - 1, v - 1, weight=w)

color[0] = -1

pred, dist = nx.dijkstra_predecessor_and_distance(G, 0)

c = [dist[i] for i in range(N)]
ans = [1 if i % 2 == 0 else 0 for i in c]
print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

# 約数列挙(nを含む)
def make_divisors(n):
    divisors = set()
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n // i)

    return divisors


N = int(input())
A = np.array(input().split(), dtype=np.int64)
A.sort()
A = A[::-1]


p0 = make_divisors(A[0])
p1 = make_divisors(A[-1])
P = p0 | p1

for p in sorted(list(P))[::-1]:
    c = 0
    for a in A:
        if a % p == 0:
            c += 1

    if c == N - 1:
        break

q = np.gcd.reduce(A)
if p > q:
    print(p)
else:
    print(q)


Fixed submission:
import numpy as np

# 約数列挙(nを含む)
def make_divisors(n):
    divisors = set()
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n // i)

    return divisors


N = int(input())
A = np.array(input().split(), dtype=np.int64)
A.sort()
A = A[::-1]


p0 = make_divisors(A[0])
p1 = make_divisors(A[-1])
P = p0 | p1

for p in sorted(P)[::-1]:
    c = np.count_nonzero(A % p == 0)
    if c == N - 1:
        break

q = np.gcd.reduce(A)
if p > q:
    print(p)
else:
    print(q)
Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np

N = int(input())

A = input().split()
A = np.array([int(x) for x in A])

if np.sum(A==0) != 0:
# Aに0が含まれる場合
    # 最後に0が出てくる場所
    z = np.max(np.where(A==0))
    B = A[z:N]

    # B = [0 -?]のときだけ例外
    if B.shape[0] == 2 and B[-1] < 0:
        sign = 1
        break

    elif np.sum(B < 0)%2 ==0:
        sign = 1
    else:
        sign = -1

# Aに0が含まれない場合
else:
    if np.sum(A < 0)%2 ==0:
        sign = 1
    else:
        sign = -1

print(np.abs(A[0:N-1]).sum() + sign*abs(A[-1]))

Fixed submission:
import sys

N = int(input())
A = list(map(int, input().split()))


ans = 0
for a in A:
    ans += abs(a)

c = 0
m = abs(A[0])
for a in A:
    if a < 0:
        c += 1
    elif a == 0:
        print(ans)
        sys.exit()

    if abs(a) < m:
        m = abs(a)

if c % 2 == 0:
    print(ans)
else:
    print(ans - 2 * m)
Buggy python submission (verdict: Runtime Error):
import sys

N = int(input())
S = input()
K = int(input())

SS = []

for i in range(N):
  if S[i] == S[K]:
    SS.append(S[i])
  else:
    SS.append("*")
    
print(''.join(SS))

Fixed submission:
import sys

N = int(input())
S = input()
K = int(input())

SS = []

for i in range(N):
  if S[i] == S[K-1]:
    SS.append(S[i])
  else:
    SS.append("*")
    
print(''.join(SS))
Buggy python submission (verdict: Runtime Error):
S = input()
AA = ["A", "C", "G", "T"]

ans = []
ll = 0
for i in range(len(S)):
    if S[i] in AA:
        ll += 1
    else:
        ans.append(ll)
        ll = 0

print(max(ans))


Fixed submission:
S = input()
AA = ["A", "C", "G", "T"]

ans = []
ll = 0
for i in range(len(S)):
    if S[i] in AA:
        ll += 1
    else:
        ans.append(ll)
        ll = 0
ans.append(ll)

print(max(ans))
Buggy python submission (verdict: Runtime Error):
import sys

readline = sys.stdin.buffer.readline


def sss(A, N):
    A.sort()
    if A[0] == 0:
        A.remove(0)
    for i in range(1, len(A)):
        A[i] = A[i] % A[0]
    if A[0] == sum(A):
        print(sum(A))
    else:
        return sss(A, N)


def main():
    N = int(readline())
    A = list(map(int, readline().split()))

    sss(A, N)


main()


Fixed submission:
def vs(A):
    A = sorted(A)
    pA = list(map(lambda x: x % A[0], A))
    pA[0] = A[0]
    return list(filter(lambda x: x != 0, pA))


N = int(input())
A = list(map(int, input().split()))


spA = -1
sA = -2
while spA != sA:
    sA = sum(A)
    pA = vs(A)
    spA = sum(pA)
    A = pA

print(sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
import sys

readline = sys.stdin.buffer.readline


def main():
    N, K = map(int, readline().split())
    H = list(map(int, readline().split()))
    for i in range(K):
        H.append(10**10)

    dp = [10**10] * (N+K)
    dp[0] = 0

    for i in range(N):
        for k in range(1, K+1):
            dp[i+k] = min(dp[i+k], dp[i] + abs(H[i+k]-H[i]))

    print(dp[N-1])


main()


Fixed submission:
import sys

readline = sys.stdin.buffer.readline


def main():
    N, K = map(int, readline().split())
    H = list(map(int, readline().split()))
    for i in range(K):
        H.append(10**10)

    dp = [10**10] * (N+K)
    dp[0] = 0

    for i in range(N):
        for k in range(1, K+1):
            dp[i+k] = min(dp[i+k], dp[i] + abs(H[i+k]-H[i]))

    print(dp[N-1])


main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


def main():
    N, K = map(int, input().split())
    H = list(map(int, input().split()))
    for i in range(K):
        H.append(10**10)

    dp = np.full(N+K, 10**10, np.int64)
    dp[0] = 0

    for i in range(N):
        for k in range(1, K+1):
            dp[i+k] = min(dp[i+k], dp[i] + abs(H[i+k] - H[i]))


    print(dp[N-1])


main()


Fixed submission:
import sys

readline = sys.stdin.buffer.readline


def main():
    N, K = map(int, readline().split())
    H = list(map(int, readline().split()))
    for i in range(K):
        H.append(10**10)

    dp = [10**10] * (N+K)
    dp[0] = 0

    for i in range(N):
        for k in range(1, K+1):
            dp[i+k] = min(dp[i+k], dp[i] + abs(H[i+k]-H[i]))

    print(dp[N-1])


main()
Buggy python submission (verdict: Runtime Error):
import sys

readline = sys.stdin.buffer.readline


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

    dp = [0] * 3
    n_dp = [0] * 3
    for _ in range(N):
        a = list(map(int, readline().split()))
        for j in range(3):
            n_dp[j] = max(dp[j-2] + a[j], dp[j-1] + a[j])
        dp = n_dp.copy()

    print(max(dp))


main()


Fixed submission:
def main():
    N = int(input())

    dp = [0] * 3
    n_dp = [0] * 3

    for _ in range(N):
        a = list(map(int, input().split()))
        for j in range(3):
            n_dp[j] = max(dp[j-2] + a[j], dp[j-1] + a[j])
        dp = n_dp.copy()

    print(max(dp))


main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# 数と重さで配列を作る
# 値は価値の最大値


def main():
    N, W = map(int, readline().split())
    WV = np.array([[int(x) for x in readline().split()] for _ in range(N)])

    dp = np.zeros([N+1, W+1], np.int64)

    for w, v in WV:
        np.maximum(dp[1:, w:], dp[:-1, :-w] + v, out=dp[1:, w:])

    print(np.max(dp[:, W]))


main()


Fixed submission:
import sys

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    N, W = map(int, readline().split())
    WV = np.array([[int(x) for x in readline().split()] for _ in range(N)])

    dp = np.zeros([W+1], np.int64)

    for w, v in WV:
        np.maximum(dp[w:], dp[:-w] + v, out=dp[w:])

    print(np.max(dp))


main()

Buggy python submission (verdict: Runtime Error):
import sys

readline = sys.stdin.buffer.readline


def main():
    N, K = map(int, readline().split())
    H = list(map(int, readline().split()))
    for i in range(K):
        H.append(10**10)

    dp = [10**10] * (N+K)
    dp[0] = 0

    for i in range(N):
        for k in range(1, K+1):
            dp[i+k] = min(dp[i+k], dp[i] + abs(H[i+k]-H[i]))

    print(dp[N-1])


main()


Fixed submission:
import sys

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    N, W = map(int, readline().split())
    WV = np.array([[int(x) for x in readline().split()] for _ in range(N)])

    dp = np.zeros([W+1], np.int64)

    for w, v in WV:
        np.maximum(dp[w:], dp[:-w] + v, out=dp[w:])

    print(np.max(dp))


main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# 数と価値で配列を作る
# 値は価値の最大値


def main():
    N, W = map(int, readline().split())
    WV = np.array([[int(x) for x in readline().split()] for _ in range(N)])
    U = np.sum(WV[:, 1])

    dp = np.full([N+1, U+1], U, np.int64)
    dp[0, 0] = 0

    for w, v in WV:
        p_dp = dp.copy()
        np.minimum(dp[1:, v:], p_dp[:-1, :-v] + w, out=dp[1:, v:])

    print(max(list(zip(*np.where(dp <= W))))[1])


main()


Fixed submission:
import sys

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    N, W = map(int, readline().split())
    WV = np.array([[int(x) for x in readline().split()] for _ in range(N)])
    UV = np.sum(WV[:, 1])
    UW = np.sum(WV[:, 0])

    dp = np.full([UV+1], UW*2, np.int64)
    dp[0] = 0

    for w, v in WV:
        p_dp = dp.copy()
        np.minimum(dp[v:], p_dp[:-v] + w, out=dp[v:])

    print(max(list(np.where(dp <= W)[0])))


main()

Buggy python submission (verdict: Runtime Error):
import sys

import numpy as np

readline = sys.stdin.buffer.readline


def main():
    N, W = map(int, readline().split())
    WV = np.array([[int(x) for x in readline().split()] for _ in range(N)])

    dp = np.zeros([N+1, W+1], np.int64)

    for w, v in WV:
        np.maximum(dp[1:, w:], dp[:-1, :-w] + v, out=dp[1:, w:])

    print(np.max(dp[:, W]))


main()

Fixed submission:
import sys

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    N, W = map(int, readline().split())
    WV = np.array([[int(x) for x in readline().split()] for _ in range(N)])
    UV = np.sum(WV[:, 1])
    UW = np.sum(WV[:, 0])

    dp = np.full([UV+1], UW*2, np.int64)
    dp[0] = 0

    for w, v in WV:
        p_dp = dp.copy()
        np.minimum(dp[v:], p_dp[:-v] + w, out=dp[v:])

    print(max(list(np.where(dp <= W)[0])))


main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys


def main():
    N, M = map(int, input().split())
    s = M // N  # 答えはs以下
    m = M % N

    for i in range(s, 0, -1):
        if m % s == 0:
            print(s)
            sys.exit()
        else:
            s -= 1
            m += N


main()


Fixed submission:
import sys


def main():
    N, M = map(int, input().split())
    s = M // N  # 答えはs以下
    m = M % N

    for i in range(s, 0, -1):
        if m % i == 0:
            print(i)
            sys.exit()
        else:
            m += N


main()

Buggy python submission (verdict: Runtime Error):
vimport sys


def main():
    N, M = map(int, input().split())
    s = M // N  # 答えはs以下
    m = M % N

    for i in range(s, 0, -1):
        if m % s == 0:
            print(s)
            sys.exit()
        else:
            s -= 1
            m += N


main()


Fixed submission:
import sys


def main():
    N, M = map(int, input().split())
    s = M // N  # 答えはs以下
    m = M % N

    for i in range(s, 0, -1):
        if m % i == 0:
            print(i)
            sys.exit()
        else:
            m += N


main()
Buggy python submission (verdict: Runtime Error):
import sys

from collections import Counter

n = int(input())

v = []
v1 = []
v2 = []

v = list(map(int, input().split()))

for i in range(int(n/2)):
    v1.append(v[2*i])
    v2.append(v[2*i+1])

e = Counter(v1)
o = Counter(v2)

ee = e.most_common(2)
oo = o.most_common(2)

if ee[0][0] != oo[0][0]:
    print(n - (ee[0][1]+oo[0][1]))
    sys.exit()

if ee[0][0] == oo[0][0]:
    if len(ee) == 1 and len(oo) == 1:
        print(n - (ee[0][1]))
        sys.exit()

    if len(ee) == 1:
        print(n - (ee[0][1]+oo[1][1]))
        sys.exit()

    if len(oo) == 1:
        print(n - (ee[1][1]+oo[0][1]))
        sys.exit()

    if ee[0][1] == oo[0][1]:
        print(n - (ee[0][1] + min(ee[1][1],oo[1][1])))
    
    if ee[0][1] > oo[0][1]:
        print(n - (ee[0][1]+oo[1][1]))
        sys.exit()
    else:
        print(n - (ee[1][1]+oo[0][1]))
        sys.exit()


Fixed submission:
i = input()

k = []

for j in i:
    if j == '1':
        k.append('9')
    else:
        k.append('1')

print(''.join(k))