Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

perm = list(permutations(range(1, N+1), N))
print(abs(perm.index(P) - perm.index(Q)))

Fixed submission:
from itertools import permutations 

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

perm = list(permutations(range(1, N+1), N))
print(abs(perm.index(P) - perm.index(Q)))

Buggy python submission (verdict: Runtime Error):
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

perm = list(permutations(range(1, N+1), N))
print(abs(perm.index(P) - perm.index(Q)))

Fixed submission:
from itertools import permutations 

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

perm = list(permutations(range(1, N+1), N))
print(abs(perm.index(P) - perm.index(Q)))

Buggy python submission (verdict: Runtime Error):
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

perm = list(permutations(range(1, N+1), N))
print(abs(perm.index(P) - perm.index(Q)))

Fixed submission:
from itertools import permutations 

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

perm = list(permutations(range(1, N+1), N))
print(abs(perm.index(P) - perm.index(Q)))

Buggy python submission (verdict: Runtime Error):
import itertools
import math
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
L = list(map(list,list(itertools.permutations(list(i for i in range(1,N+1)),N))))
a = L.index(P)
b = L.index(Q)
print(abs(a-b))

Fixed submission:
from itertools import permutations 

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

perm = list(permutations(range(1, N+1), N))
print(abs(perm.index(P) - perm.index(Q)))
Buggy python submission (verdict: Runtime Error):
new_str, num, string = "", int(input()), input().split(" ")
for x in range(0, num):
    new_str += string[0][x] + string[1][x]
print(new_str)

Fixed submission:
new_str, num, string = "", int(input()), input().split(" ")
for x in range(0, num):
    new_str += string[0][x] + string[1][x]
print(new_str)
Buggy python submission (verdict: Runtime Error):
ndef gcd(a, b):
    return b if a == 0 else gcd(b%a, a)
num = [int(x) for x in input().split(" ")]
print(int(num[0]*num[1]/gcd(num[0], num[1])))

Fixed submission:
def gcd(a, b):
    return b if a == 0 else gcd(b%a, a)
num = [int(x) for x in input().split(" ")]
print(int(num[0]*num[1]/gcd(num[0], num[1])))

Buggy python submission (verdict: Runtime Error):
num, bricks, count, smash = int(input()), [int(x) for x in input().split(" ")], 1, 0
for x in bricks:
    if count == x: count += 1
    else: smash += 1
print(smash if smash != len(bricks) else 0 if len(bricks) == 1 else -1)

Fixed submission:
def gcd(a, b):
    return b if a == 0 else gcd(b%a, a)
num = [int(x) for x in input().split(" ")]
print(int(num[0]*num[1]/gcd(num[0], num[1])))

Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    return b if a == 0 else gcd(b%a, a)
num = [int(x) for x in input().split(" ")]
print(int(num[0]*num[1]/gcd(num[0], num[1])))


Fixed submission:
def gcd(a, b):
    return b if a == 0 else gcd(b%a, a)
num = [int(x) for x in input().split(" ")]
print(int(num[0]*num[1]/gcd(num[0], num[1])))
Buggy python submission (verdict: Runtime Error):
x=input()
a=x[0]
b=x[1]
c=x[2]
if a=="7":
  print("Yes")
  break
elif b=="7":
  print("Yes")
  break
elif c=="7":
  print("Yes")
  break
else:
  print("No")

Fixed submission:
x=input()
a=x[0]
b=x[1]
c=x[2]
if a=="7":
  print("Yes")
elif b=="7":
  print("Yes")
elif c=="7":
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import math

x=int256(input())
s=math.floor(x/3)
f=math.floor(x/5)
sf=math.floor(x/15)

s_sum=math.floor(3*s*(s+1)/2)
f_sum=math.floor(5*f*(f+1)/2)
sf_sum=math.floor(15*sf*(sf+1)/2)

sum=s_sum+f_sum-sf_sum
print(math.floor(sum))


Fixed submission:
import math

x=int(input())
s=math.floor(x/3)
f=math.floor(x/5)
sf=math.floor(x/15)
sum=math.floor(x*(x+1)/2)

s_sum=math.floor(3*s*(s+1)/2)
f_sum=math.floor(5*f*(f+1)/2)
sf_sum=math.floor(15*sf*(sf+1)/2)

fl=sum-(s_sum+f_sum-sf_sum)
print(math.floor(fl))
Buggy python submission (verdict: Time Limit Exceeded):
n,x,y = map(int,input().split())

x = x-1
y = y-1

count_dict = {i : 0 for i in range(0, n)}

for i in range(n):
    for k in range(n):
        key = min(abs(i-k), abs(i-x)+abs(k-y) + 1, abs(i-y) +abs(k-x) + 1)
        count_dict[key] += 1

for i in range(1, n):
    print(count_dict[i] //2)

Fixed submission:
n,x,y = map(int,input().split())

x = x-1
y = y-1

count_dict = {i : 0 for i in range(0, n)}

for i in range(n):
    for k in range(n):
        key = min(abs(i-k), abs(i-x)+abs(k-y) + 1, abs(i-y) +abs(k-x) + 1)
        count_dict[key] += 1

for i in range(1, n):
    print(count_dict[i] //2)

Buggy python submission (verdict: Time Limit Exceeded):
n,x,y = map(int,input().split())

x = x-1
y = y-1

G = [[i-1,i+1] for i in range(n)]

G[0] = [1]
G[-1]= [n-2]

G[x].append(y)
G[y].append(x)

count_mat = [[float('inf')]*n for i in range(n)]

def bfs(ini):
    visited = set()
    visited.add(ini)
    prev_steps = [ini]
    count_mat[ini][ini] = 0
    count = 0
    next_steps = set()
    
    while len(prev_steps) != 0:
        count +=1
        for prev_step in prev_steps:#前にいたところ
            for next_step in G[prev_step]:#次にいくところ
                next_steps.add(next_step)
        next_steps = next_steps - visited#すでに訪れたところを引く
        for next_step in next_steps:
            visited.add(next_step)
            count_mat[ini][next_step] = count
            count_mat[next_step][ini] = count
        prev_steps = next_steps
        next_steps = set()
for i in range(0, n):
    bfs(i)

count_dict = {i : 0 for i in range(0, n)}
for row in count_mat:
    for k in row:
        count_dict[k] =count_dict[k]  + 1

for i in range(1, n):
    print(count_dict[i] // 2)

Fixed submission:
n,x,y = map(int,input().split())

x = x-1
y = y-1

count_dict = {i : 0 for i in range(0, n)}

for i in range(n):
    for k in range(n):
        key = min(abs(i-k), abs(i-x)+abs(k-y) + 1, abs(i-y) +abs(k-x) + 1)
        count_dict[key] += 1

for i in range(1, n):
    print(count_dict[i] //2)
Buggy python submission (verdict: Runtime Error):
a, b, c = list(map(int, input().split(' ')))
a_m = a%10**9
b_m = b%10**9
c_m = c%10**9
sub = (c_m - a_m - b_m)&mod10**9

if 4*a_m*b_m < sub*sub:
    print('Yes')
else:
    print('No')

Fixed submission:
a, b, c = list(map(int, input().split(' ')))
sub = c-a-b
if sub > 0 and 4*a*b < sub*sub:#計算が成立するためには、c-a-b > 0が必要
        print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
al=[chr(ord('a') + i) for i in range(26)]
def dfs2(N, f):
    if len(f) == N:
        return f
    else:
        result = ""
        f_index = [al.index(i) for i in f]
        for i in range(max(f_index) +1 + 1):#追加できるのは(f+1) + 1
            result +=dfs(N,  f + al[i])
        return result

N = int(input())
ans = dfs2(N, 'a')
for i in range(int(len(ans) / N)):
    print(ans[N*i : N * (i+1)])

Fixed submission:
al=[chr(ord('a') + i) for i in range(26)]
def dfs(N, f):
    if len(f) == N:
        return f
    else:
        result = ""
        f_index = [al.index(i) for i in f]
        for i in range(max(f_index) +1 + 1):#追加できるのは(f+1) + 1
            result +=dfs(N,  f + al[i])
        return result

N = int(input())
ans = dfs(N, 'a')
for i in range(int(len(ans) / N)):
    print(ans[N*i : N * (i+1)])
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())

flag = 1
for i in range(Q):
    q =  [ i for i in input().split(' ')]
    if q[0] == '1':
        flag = flag * -1
    else:
        if flag == 1: 
            if q[1] == '1':
                S = q[2] + S
            else:
                S = S + q[2]
        else:
            if q[1] == '1':
                S = S + q[2]
            else:
                S = q[2] + S
            
if flag ==1:
    print(S)
else:
    print(S[::-1])

Fixed submission:
S = input()
Q = int(input())
front = ""
flag = 1
for i in range(Q):
    q =  [ i for i in input().split(' ')]
    if q[0] == '1':
        flag = flag * -1
    else:
        if flag == 1: 
            if q[1] == '1':
                front+=q[2]
            else:
                S += q[2]
        else:
            if q[1] == '1':
                S +=q[2]
            else:
                front+= q[2]
            
if flag ==1:
    print(front[::-1] + S)
else:
    print(S[::-1] + front)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())

flag = 1
for i in range(Q):
    q =  [ i for i in input().split(' ')]
    if q[0] == '1':
        flag = flag * -1
    else:
        if flag == 1: 
            if q[1] == '1':
                S = q[2] + S
            else:
                S = S + q[2]
        else:
            if q[1] == '1':
                S = S + q[2]
            else:
                S = q[2] + S
            
if flag ==1:
    print(S)
else:
    print(S[::-1])

Fixed submission:
S = input()
Q = int(input())
front = ""
flag = 1
for i in range(Q):
    q =  [ i for i in input().split(' ')]
    if q[0] == '1':
        flag = flag * -1
    else:
        if flag == 1: 
            if q[1] == '1':
                front+=q[2]
            else:
                S += q[2]
        else:
            if q[1] == '1':
                S +=q[2]
            else:
                front+= q[2]
            
if flag ==1:
    print(front[::-1] + S)
else:
    print(S[::-1] + front)

Buggy python submission (verdict: Runtime Error):
S = input()
Q = int(input())

for k in range(Q):
    q =  [ i for i in input().split(' ')]
    if q[0] == '1':
        if not len(S) == 1:
            head = S[0]
            tail = S[-1]
            S = tail + S[1:-1] + head
            print(S)
    else:
        if q[1] == '1':
            S = q[2] + S
            print(S)
        else:
            S = S + q[2]
            print(S)
print(S)

Fixed submission:
S = input()
Q = int(input())
front = ""
flag = 1
for i in range(Q):
    q =  [ i for i in input().split(' ')]
    if q[0] == '1':
        flag = flag * -1
    else:
        if flag == 1: 
            if q[1] == '1':
                front+=q[2]
            else:
                S += q[2]
        else:
            if q[1] == '1':
                S +=q[2]
            else:
                front+= q[2]
            
if flag ==1:
    print(front[::-1] + S)
else:
    print(S[::-1] + front)
Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
tree = [[] for i in range(N)]
block  = [[] for i in range(N)]
frends_cand = [set() for i in range(N)]

for i in range(M):
    a,b = map(int, input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)
        
for i in range(K):
    a,b = map(int, input().split())
    block[a-1].append(b-1)
    block[b-1].append(a-1)

not_visited = set([i for i in range(N)])

visited = set()
def dfs(now):
    global visited
    visited.add(now)
    if  len(tree[now]) ==0:
        return print(now)
    else:
        next_tree  = set(tree[now]) - visited#有向であればtree[now]でok
        for i in next_tree:
            dfs(i)

while len(not_visited) !=0:
    visited = set()
    next_start = not_visited.pop()
    dfs(next_start)
    not_visited = not_visited - visited
    for i in visited:
        frends_cand[i] = visited

ans = ""        
for index, cand in enumerate(frends_cand):
    friend_cand = cand - set(block[index]) - set(tree[index])
    ans +=str(len(friend_cand)-1) + ' '
print(ans.strip())

Fixed submission:
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0] * (n)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

n,m,k=map(int,input().split())
friends_cand = UnionFind(n)
not_cand = [0 for i in range(n)]

for i in range(m):
    a,b = map(int, input().split())
    a, b = a-1, b-1
    friends_cand.union(a,b)
    not_cand[a] +=1
    not_cand[b] +=1
for i in range(k):
    c,d = map(int, input().split())
    c, d = c-1, d-1
    if friends_cand.find(c) == friends_cand.find(d):
        not_cand[c] +=1
        not_cand[d] +=1

size = [0 for i in range(n)]
for i in range(n):
    size[friends_cand.find(i)]+=1

ans = []
for i in range(n):
    ans.append(size[friends_cand.find(i)] - not_cand[i] - 1)
print(*ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
R = int(input())

if N < 10:
    ans = R + (100 * (10 - N))
    print(ans)
else:
    print(R)

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

if N < 10:
    ans = R + (100 * (10 - N))
    print(ans)
else:
    print(R)
Buggy python submission (verdict: Time Limit Exceeded):
h, n  = map(int,input().split())
am = [list(map(int, input().split())) for i in range(n)] 

dp = [float('inf')]*(h+1)
dp[0] = 0
for i in range(1,h+1):
    dp_val = dp[i]
    for a, m in am:
        if a >= i:#overkill
            dp_val = min(dp_val, m)
        else:
            dp_val = min(dp_val, dp[i-a]+m)
    dp[i] = dp_val
print(dp[h])
    


Fixed submission:
h, n  = map(int,input().split())
am = [list(map(int, input().split())) for i in range(n)] 

dp = [float('inf')]*(h+1)
dp[0] = 0
for i in range(1,h+1):
    dp_val = dp[i]
    for a, m in am:
        if a >= i:#overkill
            dp_val = min(dp_val, m)
        else:
            dp_val = min(dp_val, dp[i-a]+m)
    dp[i] = dp_val
print(dp[h])

Buggy python submission (verdict: Time Limit Exceeded):
h, n = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]

max_a = max(a)[0]

dp = [float('inf') for i in range(h + max_a + 1)]
dp[0] = 0
for i in range(1, h+max_a + 1):
    dp_ = dp[i]
    for damage in a:
        if i < damage[0]:
            dp_ = min(dp_, damage[1])
        else:
            dp_ = min(dp_, dp[i-damage[0]] + damage[1])
    dp[i] = dp_

print(dp[h])

Fixed submission:
h, n  = map(int,input().split())
am = [list(map(int, input().split())) for i in range(n)] 

dp = [float('inf')]*(h+1)
dp[0] = 0
for i in range(1,h+1):
    dp_val = dp[i]
    for a, m in am:
        if a >= i:#overkill
            dp_val = min(dp_val, m)
        else:
            dp_val = min(dp_val, dp[i-a]+m)
    dp[i] = dp_val
print(dp[h])
Buggy python submission (verdict: Runtime Error):
import collections
n,k,s = input().split()

dq = collections.deque()
max_value = str(10**9)
if int(s) !=10**9:
    for i in range(int(k)):
        dq.append(s)
    for i in range(int(n)-int(k)):
        dq.append(max_value)
    ans = " ".join(list(dq))
    print(ans)
else:
    for i in range(int(k)):
        dq.append(s)
    for i in range(int(n)-int(k)):
        dq.append(1)
    ans = " ".join(list(dq))
    print(ans)
        

Fixed submission:
import collections
n,k,s = input().split()



dq = collections.deque()
max_value = str(10**9)
if int(s) !=10**9:
    for i in range(int(k)):
        dq.append(s)
    for i in range(int(n)-int(k)):
        dq.append(max_value)
    ans = " ".join(list(dq))
    print(ans)
else:
    for i in range(int(k)):
        dq.append(s)
    for i in range(int(n)-int(k)):
        dq.append("1")
    ans = " ".join(list(dq))
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k,s = map(int, input().split())

ans = ""
if s !=10**9:
    for i in range(k):
        ans = ans + str(s) + " "
    for i in range(n-k):
        ans = ans + str(10**9) + " "
    print(ans.strip())
else:
    for i in range(k):
        ans = ans + str(s) + " "
    for i in range(n-k):
        ans = ans + str(1) + " "
    print(ans.strip())
        

Fixed submission:
import collections
n,k,s = input().split()



dq = collections.deque()
max_value = str(10**9)
if int(s) !=10**9:
    for i in range(int(k)):
        dq.append(s)
    for i in range(int(n)-int(k)):
        dq.append(max_value)
    ans = " ".join(list(dq))
    print(ans)
else:
    for i in range(int(k)):
        dq.append(s)
    for i in range(int(n)-int(k)):
        dq.append("1")
    ans = " ".join(list(dq))
    print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()
if int(N[-1]) %2 == 0:
    ans = int(N[:-1])
    N = int(N[:-1])
    k = 1
    while k != 0:
        k = N // 5
        N = k
        ans += k
    print(ans)
else:
    print(0)
    

Fixed submission:
N = input()
if len(N) <= 1:
  print(0)
  exit()
if int(N[-1]) %2 == 0:
    ans = int(N[:-1])
    N = int(N[:-1])
    k = 1
    while k != 0:
        k = N // 5
        N = k
        ans += k
    print(ans)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
n = input()
A = list(map(int, input().split()))

nums = [0,0,0]
ans = 1
for a in A:
  ans = (ans*nums.count(a))%(10**9 +7)
  nums[nums.index(a)] +=1
print(ans)

Fixed submission:
n = input()
A=[int(j) for j in input().split()]

nums = [0,0,0]
ans = 1
for a in A:
  ans = (ans*nums.count(a))%(10**9 +7)
  for i in range(len(nums)):
        if nums[i] == a:
            nums[i] = a+1
            break
          
print(ans)

Buggy python submission (verdict: Runtime Error):
n = input()
A = list(map(int, input().split()))

nums = [0,0,0]
ans = 1
for a in A:
  ans = (ans*nums.count(a))%(10**9 +7)
  nums[nums.index(a)] +=1
print(ans)

Fixed submission:
n = input()
A=[int(j) for j in input().split()]

nums = [0,0,0]
ans = 1
for a in A:
  ans = (ans*nums.count(a))%(10**9 +7)
  for i in range(len(nums)):
        if nums[i] == a:
            nums[i] = a+1
            break
          
print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()
num_list = list(map(int, input().split(" ")))

def devision(num_list, count):
    new_num_list = []
    for num in num_list:
        if num%2 ==0:
            new_num_list.append(num//2)
        else:
            print(count)
            return
    count += 1
    return devision(new_num_list, count)

devision(num_list, 0)            

Fixed submission:
s = input()
print(s.count('1'))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
flag = 0
for a in range(1,3501):
    if flag ==1:
        break
    for b in range(1,3501):
        if 4*a*b - a*N - b*N != 0:
            if a*b*N // (4*a*b - a*N - b* N) > 0 and a*b*N % (4*a*b - a*N - b* N) ==0:
                c = int(a*b*N / (4*a*b - a*N - b* N))
                print(a, b, c)
                flag = 1
                break

Fixed submission:
N = int(input())
flag = 0
for a in range(1,3501):
    if flag ==1:
        break
    for b in range(1,3501):
        if 4*a*b - a*N - b*N != 0:
            if a*b*N // (4*a*b - a*N - b* N) > 0 and a*b*N % (4*a*b - a*N - b* N) ==0:
                c = int(a*b*N / (4*a*b - a*N - b* N))
                print(a, b, c)
                flag = 1
                break
Buggy python submission (verdict: Runtime Error):
S = [int(i) for i in input()]

N = len(S)

tens = [10**i for i in range(N)]

tens.reverse()

twos = [1]
twos.extend(2**i for i in range(N-1))

sums = 0
all_comb = sum(twos)
for i in range(N):
    tmp = [x*y for x, y in zip(tens[i:], twos)]
    exp = S[i] * sum(tmp) / sum(twos)
    print(exp)
    sums = sums + exp
    del twos[-1]
print(sums * all_comb)

sum(map(mul, tens,twos))

Fixed submission:
S = [int(i) for i in input()]

N = len(S)

tens = [10**i for i in range(N)]

tens.reverse()

twos = [1]
twos.extend(2**i for i in range(N-1))

sums = 0
all_comb = sum(twos)
for i in range(N):
    tmp = [x*y for x, y in zip(tens[i:], twos)]
    exp = S[i] * sum(tmp) / sum(twos)
    sums = sums + exp
    del twos[-1]
print(int(sums * all_comb))
Buggy python submission (verdict: Runtime Error):
num = map(int,input().split())
for i in num:
  if num[i] == 7:
    break
    print("Yes")
else:
  print("No")

Fixed submission:
nums = [int(i) for i in list(input())]
for i in nums:
  if  i == 7:
    print("Yes")
    break
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
s = input().split()
if s[0] == s[1] and s[1] == s[2]:
  print('No')
else:
  print('Yes')


Fixed submission:
s = input()
if s[0] == s[1] and s[1] == s[2]:
  print('No')
else:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
s = input().split()
if s[0] == s[1] and s[1] == s[2]:
  print('No'):
else:
  print('Yes')

Fixed submission:
s = input()
if s[0] == s[1] and s[1] == s[2]:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
num = int(input())
lists = [list(map(int,input().split())) for i in range(2)]
nums = [lists[0][j] - lists[1][j] for j in range(num)]
print(sorted(nums,reverse=True)[0]+sorted(nums,reverse=True)[1])

Fixed submission:
num = int(input())
lists = [list(map(int,input().split())) for i in range(2)]
nums = [lists[0][j] - lists[1][j] for j in range(num)]
x = 0
for i in nums:
  if i > 0:
    x += i
  else:
    continue
print(x)
Buggy python submission (verdict: Runtime Error):
n = int(input())
list =list(input())
m = ""
j = int(input())
for i in range(n):
  if list[i] == list[j]:
    m += list[j]
  else:
    m += "*"
print(m)

Fixed submission:
n = int(input())
list =list(input())
m = ""
j = int(input()) - 1
for i in range(n):
  if list[i] == list[j]:
    m += list[j]
  else:
    m += "*"
print(m)
Buggy python submission (verdict: Runtime Error):
if int(input()) == 1:
    msg = "Hello World!"
else:
    a = [int(input()) for i in range(2)]
    msg = a[0]+a[1]
print(msg)

Fixed submission:
list = list(map(int, input().split()))
print(max([list[0]*2-1,list[0]+list[1],list[1]*2-1]))

Buggy python submission (verdict: Runtime Error):
list = list(map(input().split(), int))
print(max([list[0]*2-1,list[0]+list[1],list[1]*2-1]))

Fixed submission:
list = list(map(int, input().split()))
print(max([list[0]*2-1,list[0]+list[1],list[1]*2-1]))
Buggy python submission (verdict: Time Limit Exceeded):
power = 1
for i in range(int(input())):
	power *= i+1
print(power % (10**9+7))

Fixed submission:
power=1
for i in range(int(input())):
  power = (i+1)*power%(10**9+7)
print(power)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
RGB = str(input())

ans = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        if RGB[i]==RGB[j]:
            continue
        for k in range(j+1,n):
            if RGB[i]!=RGB[k] and RGB[j]!=RGB[k] and j-i != k-j:
                ans += 1

print(ans)    

Fixed submission:
n = int(input())
s = input()

r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')

ans = r_cnt * g_cnt * b_cnt

for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd
n=int(input())
RGB = str(input())

ans = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if RGB[i]!=RGB[j] and RGB[i]!=RGB[k] and RGB[j]!=RGB[k] and j-i != k-j:
                ans += 1

print(ans)    

Fixed submission:
n = int(input())
s = input()

r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')

ans = r_cnt * g_cnt * b_cnt

for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1

print(ans)