Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A = list(map(int,input().split()))
if A[3] == 0 or A[3]%2 == 0:
    print(A[0]-A{1])
else:
    print(A[1]-A[0])

Fixed submission:
A = list(map(int,input().split()))
if A[3] == 0:
    print(A[0]-A[1])
elif A[3]%2 == 0:
    print(A[0]-A[1])
else:
    print(A[1]-A[0])

Buggy python submission (verdict: Time Limit Exceeded):
A = []
A.append(list(map(int,input().split())))
fr = 0
for i in range(A[0][3]):
    if abs(A[i][0]-A[i][1]) > 10**18:
        print('unfair')
        fr += 1
        break
    else:
        A.append([0,0,0])
        A[i+1][0] = A[i][1] + A[i][2]
        A[i+1][1] = A[i][0] + A[i][2]
        A[i+1][2] = A[i][0] + A[i][1]
if fr == 0:
    print(A[-1][0]-A[-1][1])

Fixed submission:
A = list(map(int,input().split()))
if A[3] == 0:
    print(A[0]-A[1])
elif A[3]%2 == 0:
    print(A[0]-A[1])
else:
    print(A[1]-A[0])

Buggy python submission (verdict: Time Limit Exceeded):
A = []
A.append(list(map(int,input().split())))
fr = 0
for i in range(A[0][3]):
    if abs(A[i][0]-A[i][1]) > 10**18:
        print('unfair')
        fr += 1
        break
    else:
        A.append([0,0,0])
        A[i+1][0] = A[i][1] + A[i][2]
        A[i+1][1] = A[i][0] + A[i][2]
        A[i+1][2] = A[i][0] + A[i][1]
if fr == 0:
    print(A[-1][0]-A[-1][1])

Fixed submission:
A = list(map(int,input().split()))
if A[3] == 0:
    print(A[0]-A[1])
elif A[3]%2 == 0:
    print(A[0]-A[1])
else:
    print(A[1]-A[0])

Buggy python submission (verdict: Runtime Error):
A = list(map(int,input().split()))
for i in range(K):
    A[0] = A[1] + A[2]
    A[1] = A[0] + A[2]
    A[2] = A[0] + A[1]
if abs(A[0]-A[1]) > 10**18:
    print('unfair')
else:
    print(A[0]-A[1])

Fixed submission:
A = list(map(int,input().split()))
if A[3] == 0:
    print(A[0]-A[1])
elif A[3]%2 == 0:
    print(A[0]-A[1])
else:
    print(A[1]-A[0])

Buggy python submission (verdict: Runtime Error):
A = list(map(int,input().split))
for i in range(K):
    A[0] = A[1] + A[2]
    A[1] = A[0] + A[2]
    A[2] = A[0] + A[1]
if abs(A[0]-A[1]) > 10**18:
    print('unfair')
else:
    print(A[0]-A[1])

Fixed submission:
A = list(map(int,input().split()))
if A[3] == 0:
    print(A[0]-A[1])
elif A[3]%2 == 0:
    print(A[0]-A[1])
else:
    print(A[1]-A[0])
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split))
Alice = []
Bob = []
for i in range(N):
    if i % 2 != 0:
        Alice.append(A[i])
    else:
        Bob.append(A[i])
print(sum(Alice)-sum(Bob))


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort()
A.reverse()
Alice = []
Bob = []
for i in range(1,N+1):
    if i % 2 != 0:
        Alice.append(A[i-1])
    else:
        Bob.append(A[i-1])
print(sum(Alice)-sum(Bob))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
if __name__ == "__main__":
    N, K = map(int, input().split())
    A = list(map(int, input().rstrip().split(' ')))
    visit = {1:[]}
    a_now = 1
    step = 0
    for i in range(K):
        a_now = A[a_now - 1]
        step += 1
        #print(a_now)
        self_loop = visit.get(a_now)
        if self_loop is None: # まだ訪れたことがない
            for v in visit.values():
                v.append(a_now)
            visit[a_now] = []
        else:
            self_loop.append(a_now)
            break
        #print(visit)
        if step == K:
            #print("K:")
            print(a_now)
            sys.exit()
    ## self_loop が見つかった場合
    #print("a_now:{}".format(a_now))
    #print("step:{}".format(step))
    #print(self_loop)
    n = len(self_loop)
    left = K-step
    left -= (left // n) * n
    #print(step)
    print(self_loop[left - 1])
    

Fixed submission:
import numpy as np
import sys
if __name__ == "__main__":
    N, K = map(int, input().split())
    A = list(map(int, input().rstrip().split(' ')))
    visit = [False]*N
    a_now = 1
    visit[a_now - 1] = True
    step = 0
    for i in range(N):
        a_now = A[a_now - 1]
        step += 1
        #print(a_now)
        if visit[a_now - 1]:
            break
        else:
            visit[a_now - 1] = True
        if step == K:
            #print("K:")
            print(a_now)
            sys.exit()
    
    self_loop = []
    start = a_now
    for i in range(N):
        a_now = A[a_now - 1]
        step += 1
        self_loop.append(a_now)
        if a_now == start:
            break
        if step == K:
            #print("K:")
            print(a_now)
            sys.exit()
    
    ## self_loop が見つかった場合
    #print("a_now:{}".format(a_now))
    #print("step:{}".format(step))
    #print(self_loop)
    n = len(self_loop)
    left = K-step
    left -= (left // n) * n
    #print(step)
    print(self_loop[left - 1])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
if __name__ == "__main__":
    X = int(input())
    # n = 1
    # while True:
    #     if n**5 - (n-1)**5 > X:
    #         print(n)
    #         break # x=10^9 で n=120
    #     n += 1
    
    n = 1
    while True:
        i = 0
        while True:
            #print("{} {}".format(int(n), int(i)))
            sign = np.sign(n**5 - i**5 - X)
            #print(sign)
            if sign == 0:
                print("{} {}".format(int(n), int(i)))
                sys.exit()
            elif sign < 0:
                i -= 1
            else:
                i += 1
            #print(i)
            if i <= -n or n-1 <= i:
                break
        n += 1

Fixed submission:
import numpy as np
import sys

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

if __name__ == "__main__":
    X = int(input())
    divs = make_divisors(X)
    #print(divs)
    a = 0
    while True:
        for d in divs:
            b_p = 0
            b_n = 0
            while True:
                b_p += d
                b_n -= d
                #print(b_p)
                if a**5 - b_p**5 == X:
                    #print(a)
                    #print(b_p)
                    print(a,b_p)
                    #print("{} {}".format(int(a), int(b_p)))
                    sys.exit()
                if a**5 - b_n**5 == X:
                    #print("{} {}".format(int(a), int(b_n)))
                    print(a,b_n)
                    sys.exit()
                if b_p > a:
                    #print('break')
                    break
        a += 1
Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == "__main__":
    N = int(input()) 
    # int型のリスト
    A = list(map(int, input().rstrip().split(' ')))
    #print(A)
    ans = 0

    for i, a in enumerate(A):
        target = A[i+a:]
        #print(target)
        for j, b in enumerate(target):
            if j  == b:
                #print(a, b)
                ans += 1
    print(ans)

Fixed submission:
import collections

if __name__ == "__main__":
    N = int(input()) 
    # int型のリスト
    A = list(map(int, input().rstrip().split(' ')))
    #print(A)
    
    # #TLE
    # ans = 0
    # for i, a in enumerate(A):
    #     target = A[i+a:]
    #     #print(target)
    #     for j, b in enumerate(target):
    #         if j  == b:
    #             #print(a, b)
    #             ans += 1
    # print(ans)
    
    L = [i+A[i] for i in range(N)]
    R = [i-A[i] for i in range(N)]
    c_l = collections.Counter(L)
    c_r = collections.Counter(R)
    #print(L)
    #print(c_l)
    #print(R)
    #print(c_r)
    ans = 0
    for k, v in c_l.items():
        v_ = c_r.get(k, 0)
        ans += v * v_
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
if __name__ == "__main__":
    # K>=200 なので3重ループは間に合わなそう
    K = int(input())
    gcd_dic = {}

    for i in range(1, K+1):
        for j in range(i, K+1):
            gcd_dic[(i,j)] = math.gcd(i, j)
    #print(gcd_dic)
    ans = 0
    for i in range(1, K+1):
        for j in range(1, K+1):
            ij_gcd = gcd_dic[(min(i, j), max(i,j))]
            #print(ij_gcd)
            for k in range(1, K+1):
                ans +=  gcd_dic[(min(ij_gcd, k), max(ij_gcd,k))]
    print(ans)




Fixed submission:
import math
if __name__ == "__main__":
    # K>=200 なので3重ループは間に合わなそう
    K = int(input())
    gcd_dic = {}

    for i in range(1, K+1):
        for j in range(i, K+1):
            gcd_dic[(i,j)] = math.gcd(i, j)

    # #print(gcd_dic)
    # ans = 0
    # for i in range(1, K+1):
    #     for j in range(1, K+1):
    #         ij_gcd = gcd_dic[(min(i, j), max(i,j))]
    #         print(ij_gcd)
    #         print("(i,j):({},{}), {}".format(i, j, ij_gcd))
    #         for k in range(1, K+1):
    #             print("  k:{}, {}".format(k, gcd_dic[(min(ij_gcd, k), max(ij_gcd,k))]))
    #             ans += gcd_dic[(min(ij_gcd, k), max(ij_gcd, k))]

    ans = 0
    for i in range(1, K+1):
        for j in range(1, K+1):
            ij_gcd = gcd_dic[(min(i, j), max(i,j))]
            #print(ij_gcd)
            #print("(i,j):({},{}), {}".format(i, j, ij_gcd))
            if ij_gcd == 1:
                ans += K
            else:
                for k in range(1, K+1):
                    #print("  k:{}, {}".format(k, gcd_dic[(min(ij_gcd, k), max(ij_gcd,k))]))
                    ans += gcd_dic[(min(ij_gcd, k), max(ij_gcd, k))]
    # ans = 0
    # for i in range(1, K+1):
    #     for j in range(1, K+1):
    #         ij_gcd = gcd_dic[(min(i, j), max(i,j))]
    #         print("(i,j):({},{}), {}".format(i, j, ij_gcd))
    #         for k in range(1, ij_gcd+1):
    #             # k <= ij_gcd
    #             print("  k:{}, {}".format(k, gcd_dic[k, ij_gcd]))
    #             ans +=  gcd_dic[k, ij_gcd]
    #         # k > ij_gcd なら
    #         print("  k//id_gcd:{}".format(K // ij_gcd))
    #         print("  ans += {}".format((K // ij_gcd - 1) * ij_gcd))
    #         print("  ans += {}".format(K - ij_gcd - K // ij_gcd + 1))
    #         ans += (K // ij_gcd - 1) * ij_gcd 
    #         ans += K - ij_gcd - K // ij_gcd + 1 # K=10, ji_gcd=4のとき，6, 10=2 を逃す
    print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
if __name__ == "__main__":
    T = input().rstrip().split(' ')
    T = int(T[0])
    for t in range(T):
        line = input().rstrip().split(' ')
        A = int(line[0])
        B = int(line[1])
        C = int(line[2])
        D = int(line[3])
        A_list = []
        flag = True

        if B > A:
            print('No')
            continue
        if B > D:
            print('No')
            continue
        if C > B:
            print('Yes')
            continue

        while True:
            if A in A_list:
                flag = True
                break
            A_list.extend([A])
            if A < B:
                flag = False
                break
            q, A = divmod(A, B)
            for i in range(q-1):
                if A + B > C:
                    break
                A += B
            A_list.extend([A + B])
            if A <= C:
                A += D
        if flag:
            print('Yes')
        else:
            print('No')


Fixed submission:
if __name__ == "__main__":
    N = input().rstrip().split(' ')
    N = int(N[0])
    line = input().rstrip().split(' ')
    count = 0
    skip_flag = False
    for i in range(len(line)-1):
        if skip_flag:
            skip_flag = False
            continue
        if line[i] == line[i+1]:
            count += 1
            skip_flag = True
    print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
if __name__ == "__main__":
    K, S = list(map(int, input().split()))
    ans = 0
    for i in range(K+1):
        for j in range(K+1):
            for k in range(K+1):
                if i+j+k == S:
                    ans += 1
    print(ans)

Fixed submission:
import numpy as np
if __name__ == "__main__":
    K, S = list(map(int, input().split()))
    ans = 0
    for i in range(K+1):
        for j in range(i, K+1):
            k = S - (i+j)
            if j <= k and k <= K:
                l = len(set([i,j,k]))
                if l == 3:
                    ans += 6
                elif l == 2:
                    ans += 3
                else:
                    ans += 1
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input()) + 1
power = 1
for i in range(1,N):
    power*=i

print(power%(10**9+7))


Fixed submission:
N = int(input()) + 1
power = 1
for i in range(1,N):
    power*=i
    power %= 10**9+7

print(power)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = (int(x) for x in input().split())
sum = 0
for x in range(K + 1):
    for y in range(K + 1):
        for z in range(K + 1):
            if (x + y + z == S):
                sum += 1

print(sum)

Fixed submission:
K, S = (int(x) for x in input().split())
sum = 0
for x in range(K + 1):
    for y in range(K + 1):
        if ((S - x - y) >= 0 and (S - x - y) <= K):
            sum += 1

print(sum)
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(x)    (x).begin(),(x).end()
typedef long long ll;
const int MOD = (int)1e9 + 7;

int main(){
  string p;
  cin >> p;
  flag = !((p[0] == p[1])||(p[1]==p[2])||p[2]==p[3]);
  if(flag){
  cout << "No" << endl;
  }
  else{
  cout << "Yes" <<endl;
  } 
}



Fixed submission:
s = input()

flag = True
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    print("Bad")
    flag = False
    break
if flag:
  print("Good")

Buggy python submission (verdict: Runtime Error):
N,L = list(map(int,input().split(" ")))

apple = list(range(L,L+N))

s = sum(apple)

m = 1000000000000000000
for x in apple:
  if abs(m) > abs(x):
    m = x

print(s-m)

Fixed submission:
s = input()

flag = True
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    print("Bad")
    flag = False
    break
if flag:
  print("Good")

Buggy python submission (verdict: Runtime Error):
s = input()

flag = True
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    print("Bad")
	flag = False

if flag:
  	print("Good")


Fixed submission:
s = input()

flag = True
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    print("Bad")
    flag = False
    break
if flag:
  print("Good")

Buggy python submission (verdict: Runtime Error):
s = input()

flag = True
for i in range(N-1):
  if s[i] == s[i+1]:
    print("Bad")
	flag = False

if flag:
  	print("Good")

Fixed submission:
s = input()

flag = True
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    print("Bad")
    flag = False
    break
if flag:
  print("Good")
Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a
#print(gcd(a,b))

#最小公倍数
def lcm(a,b):
  return a*b//gcd(a,b)
#print(lcm(a,b)

a,b,c,d = list(map(int,input().split(" ")))
e = lcm(c,d)
p=a//c
o=b//c
i=a//d
u=b//d
y=a//e
t=b//e
C = max([0.o-p])
D = max([0,u-i])
E = max([0,t-y])
print( (b-a+1)-(C+D-E) )

Fixed submission:
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a
#print(gcd(a,b))

#最小公倍数
def lcm(a,b):
  return a*b//gcd(a,b)
#print(lcm(a,b)

a,b,c,d = list(map(int,input().split(" ")))
e = lcm(c,d)
p=(a-1)//c
o=b//c
i=(a-1)//d
u=b//d
y=(a-1)//e
t=b//e
C = max([0,o-p])
D = max([0,u-i])
E = max([0,t-y])
print( (b-a+1)-(C+D-E) )

Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a
#print(gcd(a,b))

#最小公倍数
def lcm(a,b):
  return a*b//gcd(a,b)
#print(lcm(a,b)

a,b,c,d = list(map(int,input().split(" ")))
e = lcm(c,d)

p=a//c
o=b//c
i=a//d
u=b//d
y=a//e
t=b//e

C = max(0.o-p)
D = max(0,u-i)
E = max(0,t-y)
print((b-a+1)-(C+D-E))

Fixed submission:
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a
#print(gcd(a,b))

#最小公倍数
def lcm(a,b):
  return a*b//gcd(a,b)
#print(lcm(a,b)

a,b,c,d = list(map(int,input().split(" ")))
e = lcm(c,d)
p=(a-1)//c
o=b//c
i=(a-1)//d
u=b//d
y=(a-1)//e
t=b//e
C = max([0,o-p])
D = max([0,u-i])
E = max([0,t-y])
print( (b-a+1)-(C+D-E) )
Buggy python submission (verdict: Runtime Error):
n = int(input())

tasks = []
for _ in range(n):
  a,b = list(map(int,input().split(" ")))
  tasks.append(a,b)

tasks = sorted(tasks,key = lambda x:x[1])

now_time = 0
flag = True
for a,b in tasks:
  if now_time + a > b:
    flag = False
    break
  now_time += a
if flag:
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())

tasks = []
for _ in range(n):
  a,b = list(map(int,input().split(" ")))
  tasks.append((a,b))

tasks = sorted(tasks,key = lambda x:x[1])

now_time = 0
flag = True
for a,b in tasks:
  if now_time + a > b:
    flag = False
    break
  now_time += a
if flag:
  print("Yes")
else:
  print("No")

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

tasks = []
for i in range(n):
  a,b = list(map(int,input().split(" ")))
  tasks.append((a,b))

tasks = sorted(tasks, key = lambda x:(x[1],x[0]))

flag = True
now_time = 0
while tasks != []:
  a,b = tasks.pop(0)
  if now_time + a > b:
    flag = False
    break
  else:
    now_time = now_time + a
if flag:
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())

tasks = []
for _ in range(n):
  a,b = list(map(int,input().split(" ")))
  tasks.append((a,b))

tasks = sorted(tasks,key = lambda x:x[1])

now_time = 0
flag = True
for a,b in tasks:
  if now_time + a > b:
    flag = False
    break
  now_time += a
if flag:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
w,h,x,y = list(map(int,input().split(" ")))

sq = w*h/2
flag = 1 if w == x*2 and h = y*2 else 0

print(sq,flag)

Fixed submission:
w,h,x,y = list(map(int,input().split(" ")))

sq = w*h/2
flag = 1 if w == x*2 and h == y*2 else 0

print(sq,flag)
Buggy python submission (verdict: Runtime Error):
n,m = list(map(int, input().split(" ")))

A = list(map(int, input().split(" ")))
bc = []
for _ in range(m):
  b,c = list(map(int, input().split(" ")))
  bc.append((b,c))

count = 0
bc = sorted(bc,key=lambda x:x(1),reverse = True)
big_list = []
for b,c in bc:
  big_list += [c for _ in range(b)]
  count += b
  if count >= n:
    break
print(sum( sorted((A+big_list),reverse=True)[:n] ))

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

A = list(map(int, input().split(" ")))
bc = []
for _ in range(m):
  b,c = list(map(int, input().split(" ")))
  bc.append((b,c))

count = 0
bc = sorted(bc,key=lambda x:x[1],reverse = True)
big_list = []
for b,c in bc:
  big_list += [c for _ in range(b)]
  count += b
  if count >= n:
    break
print(sum( sorted((A+big_list),reverse=True)[:n] ))

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

A = list(map(int, input().split(" ")))
bc = []
for _ in range(m):
  b,c = list(map(int, input().split(" ")))
  bc.append((b,c))

count = 0
bc = sorted(bc,key=lambda x:x(1),reverse = True)
big_list = []
for b,c in bc:
  big_list += [c for _ in range(b)]
  count += b
  if count >= N:
    break
print(sum( sorted((A+big_list),reverse=True)[:N] ))

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

A = list(map(int, input().split(" ")))
bc = []
for _ in range(m):
  b,c = list(map(int, input().split(" ")))
  bc.append((b,c))

count = 0
bc = sorted(bc,key=lambda x:x[1],reverse = True)
big_list = []
for b,c in bc:
  big_list += [c for _ in range(b)]
  count += b
  if count >= n:
    break
print(sum( sorted((A+big_list),reverse=True)[:n] ))

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

A = list(map(int, input().split(" ")))
bc = []
for _ in range(m):
  b,c = list(map(int, input().split(" ")))
  bc_ append((b,c))

count = 0
bc = sorted(bc,key=lambda x:x(1),reverse = True)
big_list = []
for b,c in bc:
  big_list += [c for _ in range(b)]
  count += b
  if count >= N:
    break
print(sum( sorted((A+big_list),reverse=True)[:N] ))

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

A = list(map(int, input().split(" ")))
bc = []
for _ in range(m):
  b,c = list(map(int, input().split(" ")))
  bc.append((b,c))

count = 0
bc = sorted(bc,key=lambda x:x[1],reverse = True)
big_list = []
for b,c in bc:
  big_list += [c for _ in range(b)]
  count += b
  if count >= n:
    break
print(sum( sorted((A+big_list),reverse=True)[:n] ))
Buggy python submission (verdict: Runtime Error):
_, num_query = list(map(int,input().split()))
string = input()
dfor _ in range(num_query):
  left, right = list(map(int,input().split()))
  sub_string = string[left-1:right]
  print(sub_string.count("AC"))

Fixed submission:
base = input()
if base == "A":
	print("T")
if base == "T":
	print("A")
if base == "C":
	print("G")
if base == "G":
	print("C")

Buggy python submission (verdict: Runtime Error):
base = input()
if base == "A"
	print("T")
if base == "T"
	print("A")
if base == "C"
	print("G")
if base == "G"
	print("C")

Fixed submission:
base = input()
if base == "A":
	print("T")
if base == "T":
	print("A")
if base == "C":
	print("G")
if base == "G":
	print("C")
Buggy python submission (verdict: Runtime Error):
def all_water(h_list):
  if len(h_list) == 0:
    return 0
  min_h = min(h_list)
  new_list = [x - min_h for x in h_list]
  i = new_list.index(0)
  return min_h + all_water(new_list[:i]) + all_water(new_list[i+1:])

n = input()

height = list(map(int,input().split(" ")))

print(allwater(height))

Fixed submission:
def all_water(h_list):
  if len(h_list) == 0:
    return 0
  min_h = min(h_list)
  new_list = [x - min_h for x in h_list]
  i = new_list.index(0)
  return min_h + all_water(new_list[:i]) + all_water(new_list[i+1:])

n = input()

height = list(map(int,input().split(" ")))

print(all_water(height))

Buggy python submission (verdict: Runtime Error):
def all_water(h_list):
  if len(h_list) == 0:
    return 0
  min_h = min(h_list)
  new_list = list(map(lambda x:x-minh, h_list))
  i = new_list.index(0)
  return min_h + all_water(new_list[:i]) + all_water(new_list[i+1:])

n = input()

height = list(map(int,input().split(" ")))

print(allwater(height))

Fixed submission:
def all_water(h_list):
  if len(h_list) == 0:
    return 0
  min_h = min(h_list)
  new_list = [x - min_h for x in h_list]
  i = new_list.index(0)
  return min_h + all_water(new_list[:i]) + all_water(new_list[i+1:])

n = input()

height = list(map(int,input().split(" ")))

print(all_water(height))

Buggy python submission (verdict: Runtime Error):
def all_water(h_list):
  if len(h_list) == 0:
    return 0
  min_h = min(h_list)
  h_list = list(map(lambda x:x-minh, h_list))
  i = h_list.index(0)
  return min_h + all_water(h_list[:i]) + all_water(h_list[i+1:])

n = input()

height = list(map(int,input().split(" ")))

print(allwater(height))

Fixed submission:
def all_water(h_list):
  if len(h_list) == 0:
    return 0
  min_h = min(h_list)
  new_list = [x - min_h for x in h_list]
  i = new_list.index(0)
  return min_h + all_water(new_list[:i]) + all_water(new_list[i+1:])

n = input()

height = list(map(int,input().split(" ")))

print(all_water(height))
Buggy python submission (verdict: Runtime Error):
n,m = list(map(int, split()))

print(n*(n-1)/2 + m*(m-1)/2)

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

print(int(n*(n-1)/2 + m*(m-1)/2))
Buggy python submission (verdict: Runtime Error):
l = int(input())

print(pow(l/3),3)

Fixed submission:
l = int(input())
 
print(pow(l/3,3))
Buggy python submission (verdict: Time Limit Exceeded):
n  = int(input())
a = list(map(int, input().split()))

if len(a) == len(sorted(set(a),key=a.index)):
  print("YES")
else:
  print("NO")

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

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