Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
import sys
sys.setrecursionlimit(10000000)

mod = 1000000007

memo = [-1] * (N+1)

for _ in range(M):
    broken_step = int(input())
    memo[broken_step] = 0
    
memo[0] = 1
if memo[1] == -1:
    memo[1] = 1

def step_memo(N):
    
    if memo[N] != -1:
        return memo[N]
    
    memo[N] =  (step_memo(N-1) + step_memo(N-2)) % mod
    return (step_memo(N-1) + step_memo(N-2)) % mod
  
print(step_memo(N))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
  
broken_step = []
for _ in range(M):
    broken_step.append(int(input()))
      
import sys
sys.setrecursionlimit(10000000)

mod = 1000000007

memo = [-1] * (N+1)

if N == 0 and N not in broken_step:
    memo[N] = 1
elif N == 0 and N in broken_step:
    memo[N] = 0

if N == 1 and N not in broken_step:
    memo[N] = 1
    
elif N == 1 and N in broken_step:
    memo[N] = 0

def step_memo(N):
    
    if N in broken_step:
        return 0
        
    if memo[N] != -1:
        return memo[N]
    
    memo[N] =  (a * step_memo(N-1) + b * step_memo(N-2)) % mod
    return (a * step_memo(N-1) + b * step_memo(N-2)) % mod

print(step_memo(N))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

broken_step = []
for _ in range(M):
    broken_step.append(int(input()))
    
mod = 1000000007

memo = [-1] * (N+1)

def step_memo(N):
    if N == 0:
        return 1
    if N == 1:
        return 1

    a = 1
    b = 1
    
    if N-1 in broken_step:
        a = 0
    if N-2 in broken_step:
        b = 0
    if N in broken_step:
        a = 0
        b = 0
        
    if memo[N] != -1:
        return memo[N]
    memo[N] =  (a * step_memo(N-1) + b * step_memo(N-2)) % mod
    return (a * step_memo(N-1) + b * step_memo(N-2)) % mod
  
print(step_memo(N))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

broken_step = []
for _ in range(M):
    broken_step.append(int(input()))
    
mod = 1000000007

memo = [-1] * (N+1)

def step_memo(N):
    if N == 0:
        return 1
    if N == 1:
        return 1

    a = 1
    b = 1
    
    if N-1 in broken_step:
        a = 0
    elif N-2 in broken_step:
        b = 0
    elif N in broken_step:
        a = 0
        b = 0
        
    if memo[N] != -1:
        return memo[N]
    memo[N] =  (a * step_memo(N-1) + b * step_memo(N-2)) % mod
    return (a * step_memo(N-1) + b * step_memo(N-2)) % mod
  
print(step_memo(N))
Problem p03775 (python)

Fixed submission:
import math

N = int(input())
 
def divisor(N):
    '''
    create divisor_list < sqrt(N) from natural number
    '''
    divisor_list = []
    
    for num in range(1, math.ceil(math.sqrt(N)) + 1):
        if N % num == 0:
            divisor_list.append(num)
    
    return divisor_list
    
def F(A, B):
    return max(len(str(A)), len(str(B)))
  
def minimumF(N):
    factoring_list = divisor(N)
    
    candidate_list = []
    
    for A in factoring_list:
        B = N // A
        candidate_list.append(F(A, B))
        
    return min(candidate_list)
  
print(minimumF(N))

Buggy submission (verdict: Runtime Error):
N = int(input())

def divisor(N):
    '''
    create divisor_list < sqrt(N) from natural number
    '''
    divisor_list = []
    
    for num in range(1, math.ceil(math.sqrt(N)) + 1):
        if N % num == 0:
            divisor_list.append(num)
    
    return divisor_list
    
def F(A, B):
    return max(len(str(A)), len(str(B)))
  
def minimumF(N):
    factoring_list = divisor(N)
    
    candidate_list = []
    
    for A in factoring_list:
        B = N // A
        candidate_list.append(F(A, B))
        
    return min(candidate_list)
  
print(minimumF(N))
Problem p03805 (python)

Fixed submission:
import numpy as np
N, M = map(int, input().split())
 
Adj_matrix = np.zeros((N, N))
for _ in range(M):
    a, b = map(int, input().split())
    Adj_matrix[a - 1, b - 1] += 1
    Adj_matrix[b - 1, a - 1] += 1
    
def initialize():
    explored_list = np.zeros((N, 1))
    return explored_list
  
def is_move(vertex, explored_list, Adj_martrix):
    for i in range(len(explored_list)):
        if explored_list[i] == 0 and Adj_martrix[vertex - 1, i] == 1:
            return True
    return False
  
import copy
 
g_count = 0
 
def graph_exp(vertex, explored_list, Adj_matrix):
    global g_count
    
    explored_list[vertex - 1] += 1
    
    # Recursive End
    if not is_move(vertex, explored_list, Adj_matrix):
        g_count += all(explored_list)
        return 0
    
    # Recursive Call
    for i in range(len(explored_list)):
        if explored_list[i] == 0 and Adj_matrix[vertex - 1, i] == 1:
            graph_exp(i + 1, copy.copy(explored_list), Adj_matrix)
    
explored_list = initialize()
 
graph_exp(1, explored_list, Adj_matrix)
 
print(g_count)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())

Adj_matrix = np.zeros((N, N))
for _ in range(N):
    a, b = map(int, input().split())
    Adj_matrix[a - 1, b - 1] += 1
    Adj_matrix[b - 1, a - 1] += 1
    
def initialize():
    explored_list = np.zeros((N, 1))
    return explored_list
  
def is_move(vertex, explored_list, Adj_martrix):
    for i in range(len(explored_list)):
        if explored_list[i] == 0 and Adj_martrix[vertex - 1, i] == 1:
            return True
    return False
  
import copy

g_count = 0

def graph_exp(vertex, explored_list, Adj_matrix):
    global g_count
    
    explored_list[vertex - 1] += 1
    
    # Recursive End
    if not is_move(vertex, explored_list, Adj_matrix):
        g_count += all(explored_list)
        return 0
    
    # Recursive Call
    for i in range(len(explored_list)):
        if explored_list[i] == 0 and Adj_matrix[vertex - 1, i] == 1:
            graph_exp(i + 1, copy.copy(explored_list), Adj_matrix)
    
explored_list = initialize()

graph_exp(1, explored_list, Adj_matrix)

print(g_count)
Problem p03011 (python)

Fixed submission:
import numpy as np
words = lambda t : list(map(t, input().split()))
pqr = words(int)

pqr.sort()
print(pqr[0] + pqr[1])

Buggy submission (verdict: Runtime Error):
import numpypy as np
words = lambda t : list(map(t, input().split()))



h,w = words(int)
wq = [0] * w

grid = []
for i in range(h):
    grid.append(list(input()))

ans = 0
for i in range(h):
    j = 0
    while j < w:
        #print(i,j, grid[i][j])
        if grid[i][j] == '#':
            wq[j] = 0
            j+=1
            continue
        k = 0
        while j+k < w:
            if grid[i][j+k] == '.':
                k += 1
            else:
                break
        #print(i,j,k)
        if k + h > ans:
            for x in range(j,j+k):
                vplus = 0
                if not wq[x] == 0:
                    vplus = wq[x]
                else:
                    for vi in range(i-1,-1,-1):
                        if grid[vi][x] == '#':
                            break
                        else:
                            vplus += 1
                    for vi in range(i+1,h):
                        if grid[vi][x] == '#':
                            break
                        else:
                            vplus += 1
                ans = max(ans, vplus+k)
                wq[x] = vplus
        j += k
print(ans)
Problem p03041 (python)

Fixed submission:
import numpy as np
words = lambda t : list(map(t, input().split()))

n,k = words(int)
str = input()

c = str[k-1]
ans = str[:k-1] + c.lower() + str[k:]
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
words = lambda t : list(map(t, input().split()))



def search(i, visited, ns, ans) :
    #print(i+1)
    visited[i] = True
    for next, weight in ns[i]:
        if visited[next] == False:
            if weight % 2 == 0:
                ans[next] = ans[i]
            else:
                ans[next] = (ans[i]+1) % 2
            search(next, visited, ns, ans)


def dfs(ns, ans):
    visited = [False] * len(ns)
    search(0, visited, ns, ans)

def main():
    n = int(input())
    ns = [[] for _ in range(n)]
    for _ in range(n-1):
        (st,end,weight) = map(int,input().split())
        ns[st-1].append((end - 1,weight))
        ns[end-1].append((st-1,weight))
    ans = [0] * n
    dfs(ns, ans)
    for a in ans:
        print(a)

if __name__ == '__main__':
    main()
Problem p03045 (python)

Fixed submission:
import sys
sys.setrecursionlimit(150000)
def search(i, visited, ns) :
    #print(":", i+1)
    visited[i] = True
    for next, weight in ns[i]:
        if visited[next] == False:
            search(next, visited, ns)


def dfs(ns):
    visited = [False] * len(ns)
    ans = 0
    for i in range(len(ns)):
        if not visited[i]:
            #print(i+1)
            ans += 1
            search(i, visited, ns)
    return ans

def main():
    n,m = map(int,input().split())
    ns = [[] for _ in range(n)]
    for _ in range(m):
        (st,end,weight) = map(int,input().split())
        ns[st-1].append((end - 1,weight))
        ns[end-1].append((st-1,weight))
    ans = dfs(ns)
    print(ans)
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)
def search(i, visited, ns) :
    #print(":", i+1)
    visited[i] = True
    for next, weight in ns[i]:
        if visited[next] == False:
            search(next, visited, ns)


def dfs(ns):
    visited = [False] * len(ns)
    ans = 0
    for i in range(len(ns)):
        if not visited[i]:
            #print(i+1)
            ans += 1
            search(i, visited, ns)
    return ans

def main():
    n,m = map(int,input().split())
    ns = [[] for _ in range(n)]
    for _ in range(m):
        (st,end,weight) = map(int,input().split())
        ns[st-1].append((end - 1,weight))
        ns[end-1].append((st-1,weight))
    ans = dfs(ns)
    print(ans)
if __name__ == '__main__':
    main()
Problem p03053 (python)

Fixed submission:
import functools as ft

h,w = map(int, input().split())
mat = [[True] * (w+2)]
for _ in range(h):
    mat.append([True] + [a == '#' for a in input()] + [True])
mat.append([True]*(w+2))

prev = []
for i in range(1,h+1):
    for j in range(1,w+1):
        if mat[i][j]:
            prev.append((i,j))



round = -1
while prev:
    round += 1
    #print(prev)
    #print(mat)
    def calc(next, tup):
        x = tup[0]
        y = tup[1]
        if not mat[x-1][y]:
            next.append((x-1,y))
            mat[x-1][y] = True
        if not mat[x][y-1]:
            next.append((x,y-1))
            mat[x][y-1] = True
        if not mat[x+1][y]:
            next.append((x+1,y))
            mat[x+1][y] = True
        if not mat[x][y+1]:
            next.append((x,y+1))
            mat[x][y+1] = True
        return next
    next = ft.reduce(calc, prev, [])

    prev = next

print(round)

Buggy submission (verdict: Runtime Error):
h,w = map(int, input().split())
mat = [[True] * (w+2)]
for _ in range(h):
    mat.append([True] + [a == '#' for a in input()] + [True])
mat.append([True]*(w+2)])

prev = []
for i in range(1,h+1):
    for j in range(1,w+1):
        if mat[i][j]:
            prev.append((i,j))

round = -1
while prev:
    #print(prev)
    #print(mat)
    round += 1
    next = []
    for (x,y) in prev:
        if not mat[x-1][y]:
            next.append((x-1,y))
            mat[x-1][y] = True
        if not mat[x][y-1]:
            next.append((x,y-1))
            mat[x][y-1] = True
        if not mat[x+1][y]:
            next.append((x+1,y))
            mat[x+1][y] = True
        if not mat[x][y+1]:
            next.append((x,y+1))
            mat[x][y+1] = True
    prev = next

print(round)

Buggy submission (verdict: Runtime Error):
words = lambda t : np.array(list(map(t, input().split())))

h,w = words(int)
mat = []
mat.append([True for _ in range(w+2)])
for _ in range(h):
    mat.append([True] + [a == '#' for a in input()] + [True])
mat.append([True for _ in range(w+2)])

#mat = np.array(mat)
#print(mat)

prev = []
for i in range(1,h+1):
    for j in range(1,w+1):
        if mat[i][j]:
            prev.append((i,j))

round = -1
while not len(prev) ==  0:
    #print(prev)
    #print(mat)
    round += 1
    next = []
    for (x,y) in prev:
        if not mat[x-1][y]:
            next.append((x-1,y))
            mat[x-1][y] = True
        if not mat[x][y-1]:
            next.append((x,y-1))
            mat[x][y-1] = True
        if not mat[x+1][y]:
            next.append((x+1,y))
            mat[x+1][y] = True
        if not mat[x][y+1]:
            next.append((x,y+1))
            mat[x][y+1] = True
    prev = next

print(round)
Problem p02773 (python)

Fixed submission:
import collections
n = int(input())
l = []
s = collections.Counter([input() for i in range(n)])
mn = 0
for i in s.most_common():
    if i[1] >= mn:
        mn = i[1]
        l.append(i[0])
    else:
        break
for i in sorted(l):
        print(i)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]
ss = sorted(set(s))
l = len(ss)
if len(s)==l:
    for i in ss:
        print(s)
else:
    d = []
    for i in ss:
        d.append([i,0])
    for i in s:
        d[ss.index(i)][1]+=1
    d = sorted(d, key = lambda x:(-x[1],x[0]))
    for i in d:
        if i[1]==d[0][1]:
            print(i[0])
Problem p04005 (python)

Fixed submission:
l = sorted(list(map(int, input().split())))
ans = 0
if l[0]%2!=0 and l[1]%2!=0 and l[2]%2!=0:
    ans += l[0]*l[1]
print(ans)

Buggy submission (verdict: Runtime Error):
l = sorted(list(map((int, input().split()))))
ans = 0
if l[0]%2!=0 and l[1]%2!=0 and l[2]%2!=0:
    ans += l[0]*l[1]
print(ans)
Problem p02891 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left

def solve():
    # n, m = [int(x) for x in input().split()]
    s = [x for x in input()]
    k = int(input())
    n = len(s)
    if len(set(s)) == 1:
        print(n*k//2)
        return
    b = [1]
    for i in range(1, n):
        if s[i] == s[i-1]:
            b[-1] += 1
        else:
            b.append(1)
    ans = 0
    for e in b:
        ans += e // 2 * k

    if s[0] == s[-1] and b[0] % 2 and b[-1] % 2:
        ans += k-1
    
    print(ans)


t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

azyxwvutsrqponmlkjihgfedcb

"""

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left

def solve():
    # n, m = [int(x) for x in input().split()]
    s = [x for x in input()]
    a = s[:]
    k = int(input())
    if len(s) == 1:
        print(k // 2)
        return
    if len(set(s)) == 1:
        print((len(s) * k)//2)
        return
    cnt = 0
    for i in range(1, len(s)):
        if s[i] == s[i-1]:
            s[i] = '.'
            cnt += 1

    cnt *= k
    
    if s[0] == s[-1] and s[0] != '.':
        cnt += (k - 1)

    print(min(cnt,ans))


t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

azyxwvutsrqponmlkjihgfedcb

"""

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left

def solve():
    # n, m = [int(x) for x in input().split()]
    s = [x for x in input()]
    a = s[:]
    k = int(input())
    if len(s) == 1:
        print(k // 2)
        return
    if len(set(s)) == 1:
        print((s * k)//2)
        return
    cnt = 0
    for i in range(1, len(s)):
        if s[i] == s[i-1]:
            s[i] = '.'
            cnt += 1

    cnt *= k
    
    if s[0] == s[-1] and s[0] != '.':
        cnt += (k - 1)

    print(min(cnt,ans))


t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

azyxwvutsrqponmlkjihgfedcb

"""
Problem p03745 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n = int(input())
    a = [int(x) for x in input().split()]
    b = []
    p = 0
    for e in a:
        if p != e:
            b.append(e)
        p = e
    a = b
    n = len(b)

    ans = 0
    i = 0
    while i < n:
        ans += 1
        if i + 1 == n: break
        else:
            if a[i] < a[i+1]:
                while i + 1 < n and a[i] < a[i+1]:
                    i += 1
                i += 1
            else:
                while i + 1 < n and a[i] > a[i+1]:
                    i += 1
                i += 1
    print(ans)



    

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""



"""

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n = int(input())
    a = [int(x) for x in input().split()]
    b = []
    p = 0
    for e in a:
        if p != e:
            b.append(e)
        p = e

    a = b
    n = len(a)
    p = -1
    ans = 0
    i = 1
    while i < n:
        if a[i-1] > a[i]:
            x = 0
        else:
            x = 1
        if p != x:
            ans += x
        p = x
        i += 1

    print(ans + (not x))

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""



"""
Problem p02725 (python)

Fixed submission:
k, n = map(int, input().split())
li = list(map(int, input().split()))

tmp = [0] * n
for i in range(n):
    tmp[i] = li[i] - k
li = li + tmp
li.sort()
ans = 10**9
for i in range(len(li) - n+1):
    ans = min(ans, abs(li[i] - li[i + n-1]))
print(ans)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main()
{
  int64_t n, k;
  cin >> k >> n;
  vector<int64_t> li(n * 2);
  for (int i = 0; i < n; ++i)
  {
    cin >> li[i];
    li[i + n] = li[i] - k;
  }
  sort(li.begin(), li.end());
  int64_t ans = 10e9;
  for (int i = 0; i < 2 * n - (n - 1); ++i)
    ans = min(ans, abs(li[i] - li[i + n - 1]));
  cout << ans << "\n";
}
Problem p02771 (python)

Fixed submission:
li = list(map(int, input().split()))
if (len(set(li))) == 2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
li = list(map(int, input().split()))
if (set(len(li))) == 2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
li = list(map(int, input().split()))
if (len(li) == 2:
    print("Yes")
else:
    print("No")
Problem p02779 (python)

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

if (len(set(A)) == len(A)):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main()
{
  int n;
  bool ans = 1;
  cin >> n;
  vector<int> vec(n);
  for (int i = 0; i < n; i++)
    cin >> vec[i];
  sort(vec.begin(), vec.end());

  for (int i = 0; i < n - 1; i++)
  {
    if (vec[i] == vec[i + 1])
    {
      ans = 0;
      break;
    }
  }
  if (ans)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
Problem p03072 (python)

Fixed submission:
N = int(input())
list = input().split()
ans = 0
maxHeight = -1
for i in range(N):
  if int(list[i]) >= maxHeight:
    ans += 1
    maxHeight = int(list[i])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
list = input().split()
ans = 0
maxHeight = -1

for i in range(N):
  if list[i] >= maxHeight:
    ans += 1
    maxHeight = list[i]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
list = []
list = input().split()
M = 1
for i in range(1, N):
  k = list[i]
  t_list = [0:i+1]
  a_list = sorted(t_list, reverse=True)
  if a_list[0] == k:
    M += 1
    
print(M)

Buggy submission (verdict: Runtime Error):
N = int(input())
list = []
list = input().split()

M = 1

for i in range(1, N):
　　k = list[i]
　　t_list = list[0:i+1]
　　a_list = sorted(t_list, reverse=True)
　　if a_list[0] == k:
　　　　M += 1
print(M)

Buggy submission (verdict: Runtime Error):
N = int(input())
list = []
for i in range(N):
  list.append(int(input()))

M = 1


for i in range(1, N):
  k = list[i]
  t_list = list[0:i+1]
  a_list = sorted(t_list, reverse=True)
  if a_list[0] == k:
    M += 1

print(M)
Problem p03073 (python)

Fixed submission:
S = input()
ans = len(S)

for i in range(2):
  cnt = 0
  for j in range(len(S)):
    if j % 2 == 0 and S[j] != str(i):
      cnt += 1
    if j % 2 == 1 and S[j] == str(i):
      cnt += 1
  ans = min(ans, cnt)
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
z_count = 0
o_count = 0
k_count = 0
g_count = 0
for i in range(len(S)):
  if S[i] == "0":
    z_count += 1
    if i % 2 == 0:
      g_count += 1
    else:
      k_count += 1
  else:
    o_count += 1
    if i % 2 == 0:
      g_count += 1
    else:
      k_count += 1
    
if z_count <= o_count:
  if g_count <= k_count:
    print(len(S) - g_count)
  else:
    print(len(s) - k_count)
    
else:
  if g_count <=
Problem p03242 (python)

Fixed submission:
S = input()
c = ''
if S[0] == '1':
  c += '9'
elif S[0] == '9':
  c += '1'
else:
  c += S[0]
if S[1] == '1':
  c += '9'
elif S[1] == '9':
  c += '1'
else:
  c += S[1]
if S[2] == '1':
  c += '9'
elif S[2] == '9':
  c += '1'
else:
  c += S[2]
print(c)

Buggy submission (verdict: Runtime Error):
S = input()
S = int(S)
for i in range(len(S)):
  if S[i] == 9:
    S[i] = 1
  elif S[i] == 1:
    S[i] = 9
S = str(S)
print(S)

Buggy submission (verdict: Runtime Error):
S = input()
for i in range(len(S)):
  if S[i] == '9':
    S[i] = '1'
  elif S[i] == '1':
    S[i] = '9'
print(S)
Problem p03250 (python)

Fixed submission:
list1 = list(map(int, input().split()))
list1 = sorted(list1, reverse=True)
print(list1[0]*10 +list1[1]+list1[2])

Buggy submission (verdict: Runtime Error):
list1 = list(map(int, input().split()))
list1 = sorted(list1, reverse=True)
print(list1[0]*10 +list[1]+list[2])

Buggy submission (verdict: Runtime Error):
list1 = map(list(int, input().split()))
list1 = sorted(list1, reverse=True)
print(list1[0]*10 +list[1]+list[2])