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

Fixed submission:
s = list(input())
l = ['K','I','H','B','R',-1]
j = 0

for i in range(len(s)):
    if s[i] == 'A':
        if i == 0:
            pass
        elif s[i-1] == 'A':
            print('NO')
            exit(0)
        elif j == 1 or j == 2:
            print('NO')
            exit(0)
        else:
            pass
    elif s[i] != l[j]:
        print('NO')
        exit(0)
    elif j > 4 and s[i] != 'A':
        print('NO')
        exit(0)
    else:
        j += 1

if j == 5:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
s = list(input())
l = ['K','I','H','B','R']
j = 0

for i in range(len(s)):
    if s[i] == 'A':
        if i == 0:
            pass
        elif s[i-1] == 'A':
            print('NO')
            exit(0)
        elif j == 1 or j == 2:
            print('NO')
            exit(0)
        else:
            pass
    elif s[i] != l[j]:
        print('NO')
        exit(0)
    else:
        j += 1

print('YES')

Buggy submission (verdict: Runtime Error):
s = list(input())
l = ['K','I','H','B','R']
j = 0

for i in range(len(s)):
    if s[i] == 'A':
        if s[i - 1] == 'A':
            print('NO')
            exit(0)
        elif j ==  1 or j == 2:
            print('NO')
            exit(0)
        else:
            pass
    elif s[i] != l[j]:
        print('NO')
        exit(0)
    else:
        j += 1

print('YES')
Problem p03544 (python)

Fixed submission:
n = int(input())
#j = L0
j = 2
#k = L1
k = 1

if n == 0:
    print(2)
    exit(0)
if n == 1:
    print(1)
    exit(0)

for i in range(1,n):
    l = j + k
    j = k
    k = l

print(l)

Buggy submission (verdict: Runtime Error):
n = int(input())
#j = L0
j = 2
#k = L1
k = 1

if n == 0:
    print(2)
if n == 1:
    print(1)

for i in range(1,n):
    l = j + k
    j = k
    k = l

print(l)

Buggy submission (verdict: Runtime Error):
n = int(input())
#j = L0
j = 2
#k = L1
k = 1

for i in range(1,n):
    l = j + k
    j = k
    k = l

print(l)
Problem p03547 (python)

Fixed submission:
x,y = input().split()
li = ['A','B','C','D','E','F']
x = li.index(x)
y = li.index(y)
if x < y:
    print('<')
elif x > y:
    print('>')
else:
    print('=')

Buggy submission (verdict: Runtime Error):
x,y = input().split()
li = ['A','B','C','D',,'E','F']
x = li.index(x)
y = li.index(y)
if x < y:
    print('<')
elif x > y:
    print('>')
else:
    print('=')
Problem p03578 (python)

Fixed submission:
n = int(input())
d = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))
d.sort()
t.sort()
j = 0
for i in range(n):
    if d[i] == t[j]:
        j += 1
    if j == m:
        break

if j == m:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))
d.sort()
t.sort()
j = 0
for i in range(n):
    if d[i] == t[j]:
        j += 1

if j == m:
    print('YES')
else:
    print('NO')
Problem p03587 (python)

Fixed submission:
s = list(input())
print(s.count('1'))

Buggy submission (verdict: Runtime Error):
s = list(int(input()))
print(s.count(1))
Problem p03624 (python)

Fixed submission:
s = list(input())
s = set(s)
s = sorted(s)
m = 'abcdefghijklmnopqrstuvwxyz'

for i in range(len(m)):
    if s[i] != m[i]:
        print(m[i])
        exit(0)

    if i + 1 != len(m) and i + 1 == len(s):
        print(m[i + 1])
        exit(0)

print('None')

Buggy submission (verdict: Runtime Error):
s = list(input())
s = set(s)
s = sorted(s)
m = 'abcdefghijklmnopqrstuvwxyz'

for i in range(len(m)):
    if s[i] != m[i]:
        print(m[i])
        exit(0)

print('None')

Buggy submission (verdict: Runtime Error):
s = list(input())
s = set(s)
s = sorted(s)
m = 'abcdefghijklmnopqrstuvwxyz'

for i in range(26):
    if s[i] != m[i]:
        print(m[i])
        exit(0)

print('None')

Buggy submission (verdict: Runtime Error):
s = list(input())
s = set(s)
s = sorted(s)
m = 'abcdefghijklmnopqrstuvwxyz'

for i in range(26):
    if s[i] != m[i]:
        print(s[0])
        exit(0)

print('None')
Problem p03632 (python)

Fixed submission:
a,b,c,d = map(int,input().split())
if max(a,c) > min(b,d):
    print(0)
else:
    print(min(b,d) - max(a,c))

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int(input().split()))

if b > c:
    print(b - c)
else:
    print(0)
Problem p03658 (python)

Fixed submission:
n,k = map(int,input().split())
l = list(map(int,input().split()))
list.sort(l,reverse = True)
c = 0

for i in range(k):
    c = c + l[i]

print(c)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = list(map(int,input().split()))
l = list.sort(l,reverse = True)
c = 0

for i in range(l):
    c += l[i]

print(c)
Problem p03671 (python)

Fixed submission:
a,b,c = map(int,input().split())

m = min(a + b,a + c,b + c)

print(m)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())

m = [a + b,a + c,b + c]

print(m(min))
Problem p03695 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
t = [0] * 8
p = 0

for i in range(n):
    if a[i] < 3200:
        t[a[i] // 400] = 1
    else:
        p += 1

x = t.count(1)
amax = p+x
if x == 0:
    amin = 1
else:
    amin = x
print(amin,amax)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
t = [0] * 9
 
for i in range(n):
    t[a[i] // 400] += 1
 
z = t.pop(8)
p = t.count(0)
amax = min(8,8-p+z)
if p == 8:
    amin = 1
else:
    amin = 8 - p

print(amin,amax)
Problem p03992 (python)

Fixed submission:
s = input()
print(s[:4] + ' ' + s[4:])

Buggy submission (verdict: Runtime Error):
s = list(input())
print(s[:4] + ' ' + s[4:])

Buggy submission (verdict: Runtime Error):
s = list(input())
s = s.insert(4,' ')
print(''.join(s))
Problem p04019 (python)

Fixed submission:
s = list(input())
we = [0,0]
ns = [0,0]

for i in range(len(s)):
    if s[i] == ('N'):
        ns[0] = 1
    elif s[i] == ('W'):
        we[0] = 1
    elif s[i] == ('S'):
        ns[1] = 1
    else:
        we[1] = 1

if sum(we) % 2 == 0 and sum(ns) % 2 == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = list(input())
n = s.count('N')
w = s.count('W')
s = s.count('S')
e = s.count('E')
if (n + s) % 2 == 0 and (w + e) % 2 == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input()
we = [0,0]
ns = [0,0]

for i in range(len(s)):
    if s[i] == ('N'):
        ns[0] == 1
    elif s[i] == ('W'):
        we[0] == 1
    elif s[i] == ('S'):
        ns[1] == 1
    else
        we[1] == 1

if sum(we) % 2 == 0 and sum(ns) % 2 == 0:
    print('Yes')
else:
    print('No')
Problem p04043 (python)

Fixed submission:
A,B,C= input().split()
Sum = int(A) + int(B) + int(C)
if Sum == 17:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
n,l = map(int,input().split())
s = []

for i in range(n):
    s.append(input())

g = sorted(s)

print(''.join(g))
Problem p03139 (python)

Fixed submission:
n,a,b=map(int, input().split())
p = min(a,b)
q = max(a+b-n,0)
print(str(p) + " " + str(q))

Buggy submission (verdict: Runtime Error):
n,a,b=int(input())
p = min(a,b)
q = max(a+b-n,0)
print(str(p) + " " + str(q))

Buggy submission (verdict: Runtime Error):
n,a,b=int(input())
print(str(min(a,b)) + ' ' + str(max(a+b-n,0)))
Problem p03147 (python)

Fixed submission:
import sys
input = sys.stdin.readline

def lsearch(h): # 左端を探す
    for i in range(len(h)):
        if h[i] != 0:
            return i
    return len(h)-1

def rsearch(h, l): # 右端を探す
    for i in range(l, len(h)):
        if h[i] == 0:
            return i
    return len(h)

n=int(input())
h=list(map(int, input().split()))
cnt=0
while any(h):
    l=lsearch(h)
    r=rsearch(h, l)
    for i in range(l, r):
        h[i] -= 1
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向


int n;
int h[101];

void input(){
    cin >> n;
    for(int i=0;i<n;i++) cin >> h[i];
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    int cnt = 0;
    for(int l=0;l<n;l++){
        while(h[l] > 0){
            int r;
            for(r=l+1;r<n;r++){
                if (h[r] == 0) break; 
            }
            for(int x=l;x<r;x++) h[x]--;
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}
Problem p03193 (python)

Fixed submission:
n,h,w=map(int,input().split())
ab=[tuple(map(int, input().split())) for i in range(n)]
c=0
for i in ab:
  if i[0] >= h and i[1] >= w:
    c+=1
    
print(c)

Buggy submission (verdict: Runtime Error):
n,h,w=map(int,input().split())
ab=[list(int(input()).split()) for i in range(n)]
c=0
for i in ab:
  if i[0] >= h and i[1] >= w:
    c+=1
    
print(c)
Problem p03206 (python)

Fixed submission:
d=int(input())
if d == 25:
  print('Christmas')
elif d == 24:
  print('Christmas Eve')
elif d == 23:
  print('Christmas Eve Eve')
elif d == 22:
  print('Christmas Eve Eve Eve')

Buggy submission (verdict: Runtime Error):
d=int(input())
if d == 25:
  print('Christmas')
else if d == 24:
  print('Christmas Eve')
else if d == 23:
  print('Christmas Eve Eve')
else if d == 22:
  print('Christmas Eve Eve Eve')
Problem p03212 (python)

Fixed submission:
N = int(input())
def dfs(s):
    if int(s) > N:
        return 0
    if all(s.count(c) > 0 for c in '753'):
        ret = 1
    else:
        ret = 0
    for c in '753':
        ret += dfs(s+c)
    return ret

print(dfs('0'))

Buggy submission (verdict: Runtime Error):
N = int(input())
def dfs(s):
    if int(s) > N:
        return 0
    if all(s.count(c) > 0 for c in '753'):
        ret = 1
    else:
        ret = 0
    for c in '753':
        ret += dfs(s+c)
	return ret
  
print(dfs('0'))

Buggy submission (verdict: Runtime Error):
N = int(input())
def dfs(s):
    if int(s) > N:
        return 0
    if all(s.count(c) > 0 for c in '753'):
        ret = 1
    else:
        ret = 0
    for c in '753':
        ret += dfs(s+c)

print(dfs('0'))
Problem p03243 (python)

Fixed submission:
n = int(input())
if n % 111 == 0:
    x = n
else:
    x = ((n // 111) + 1) * 111
print(x)

Buggy submission (verdict: Runtime Error):
n = int(input())
num = [111,222,333,444,555,666,777,888,999]
for i in range(len(num) - 1):
    if num[i] == n:
        x = num[i]
        break
    if num[i] < n and n < num[i+1]:
        mn = min(abs(n - num[i]),abs(n - num[i+1]))
        if mn == abs(n - num[i]):
            x = num[i]
        else:
            x = num[i+1]
        break
print(x)
Problem p03486 (python)

Fixed submission:
s=input()
t=input()
sl = [s[i] for i in range(len(s))]
tl = [t[i] for i in range(len(t))]
n = len(sl)
m = len(tl)
sl.sort()
tl.sort(reverse=True)
s_ans = ''.join(sl)
t_ans = ''.join(tl)
if s_ans < t_ans:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
sl = [s[i] for i in range(len(s))]
tl = [t[i] for i in range(len(t))]
n = len(sl)
m = len(tl)
sl.sort()
tl.sort(reverse=True)
flg1 = False
flg2 = False
if n < m:
    for i in range(n):
        if sl[i] != tl[i]:
            flg1 = False
            break
        flg1 = True
for i in range(n):
    if sl[i] < tl[i]:
        flg2 = True
        break
    if sl[i] > tl[i]:
        flg2 = False
        break
if flg1 or flg2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
sl = [s[i] for i in range(len(s))]
tl = [t[i] for i in range(len(t))]
n = len(sl)
m = len(tl)
sl.sort()
tl.sort(reverse=True)
flg = False

if n < m:
    for i in range(n):
        if sl[i] != tl[i]:
            flg = False
            break
        flg = True
for i in range(n):
    if sl[i] < tl[i]:
        flg = True
        break
if flg:
    print("Yes")
else:
    print("No")
Problem p03633 (python)

Fixed submission:
import sys
input = sys.stdin.readline

def GCD(a, b):
    if(b == 0):
        return a
    else:
        return GCD(b, a % b)

def LCM(a, b):
    return a * b // GCD(a, b)

n = int(input())
t = [int(input()) for i in range(n)]
ans = t[0]
for i in range(1,n):
    ans = LCM(ans, t[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def GCD(a, b):
    if(b == 0):
        return a
    else:
        return GCD(b, a % b)

def LCM(a, b):
    return a * b / GCD(a, b)

n = int(input())
t = [int(input()) for i in range(n)]
ans = t[0]
for i in range(1,n):
    ans = LCM(ans, t[i])
print(int(ans))
Problem p02632 (python)

Fixed submission:
MOD = 10**9 + 7
MAX = 5*10**6 + 1

fact = [0 for _ in range(MAX)]
factinv = [0 for _ in range(MAX)]

fact[0] = 1
for k in range(1, MAX):
    fact[k] = fact[k - 1]*k
    fact[k] %= MOD

factinv[MAX - 1] = pow(fact[MAX - 1], MOD - 2, MOD)
for k in range(MAX - 1, 0, -1):
    factinv[k - 1] = factinv[k]*k
    factinv[k - 1] %= MOD

def nCk(n, k):
    return fact[n]*factinv[k]*factinv[n - k] % MOD

def nPk(n, k):
    return fact[n]*factinv[n - k] % MOD

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

ans = 0
for k in range(K + 1):
    ans += nCk(N + K - k - 1, N - 1)*pow(26, k, MOD)*pow(25, K - k, MOD) % MOD
    ans %= MOD

print(ans)

Buggy submission (verdict: Runtime Error):
MOD = 10**9 + 7
MAX = 5*10**5 + 1

fact = [0 for _ in range(MAX)]
factinv = [0 for _ in range(MAX)]

fact[0] = 1
for k in range(1, MAX):
    fact[k] = fact[k - 1]*k
    fact[k] %= MOD

factinv[MAX - 1] = pow(fact[MAX - 1], MOD - 2, MOD)
for k in range(MAX - 1, 0, -1):
    factinv[k - 1] = factinv[k]*k
    factinv[k - 1] %= MOD

def nCk(n, k):
    return fact[n]*factinv[k]*factinv[n - k] % MOD

def nPk(n, k):
    return fact[n]*factinv[n - k] % MOD

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

ans = 0
for k in range(K + 1):
    ans += nCk(N + K - k - 1, N - 1)*pow(26, k, MOD)*pow(25, K - k, MOD) % MOD
    ans %= MOD

print(ans)

Buggy submission (verdict: Runtime Error):
MOD = 10**9 + 7
MAX = 5*10**5 + 1

fact = [0 for _ in range(MAX)]
factinv = [0 for _ in range(MAX)]

fact[0] = 1
for k in range(1, MAX):
    fact[k] = fact[k - 1]*k
    fact[k] %= MOD

factinv[MAX - 1] = pow(fact[MAX - 1], MOD - 2, MOD)
for k in range(MAX - 1, 0, -1):
    factinv[k - 1] = factinv[k]*k
    factinv[k - 1] %= MOD

def nCk(n, k):
    return fact[n]*factinv[k]*factinv[n - k] % MOD

def nPk(n, k):
    return fact[n]*factinv[n - k] % MOD

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

ans = 0
for k in range(K + 1): ans += nCk(N + K - k - 1, N - 1)*pow(26, k, MOD)*pow(25, K - k, MOD) % MOD

print(ans)
Problem p02658 (python)

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

res = 1
for a in A:
    res = min(res*a, 10**18 + 1)
if res == 10**18 + 1: print(-1)
else: print(res)

Buggy submission (verdict: Runtime Error):
def main ():
	N = int(input())
	A = list(map(int,input().split()))
	if 0 in A:
		print (0)
      	return
	prod = 1 for a in A:
		prod *= a
		if prod > 1000000000000000000:
		print(-1)
        return
	print(prod)

main()

Buggy submission (verdict: Runtime Error):
def main ():
N = int(input())
A = list(map(int,input().split()))
if 0 in A: print (0)
return
prod = 1 for a in A:
prod *= a
if prod > 1000000000000000000:
print(-1) return
print(prod) main ()
Problem p03302 (python)

Fixed submission:
a, b = list(map(int, input().split()))
if (a + b == 15):
  print("+")
elif (a * b == 15):
  print("*")
else:
  print("x")

Buggy submission (verdict: Runtime Error):
a, b = list(map(int, input().split()))
if (a + b == 15):
  print("+")
else if (a * b == 15):
  print("*")
else:
  print("x")

Buggy submission (verdict: Runtime Error):
n, m, d = list(map(int, input().split()))
if (d == 0):
	ans = (m - 1) * (1 / n)
	print(ans)
else:
	ans = (m - 1) * (2 * (n - d) / n ** 2)
	print(ans)
Problem p03304 (python)

Fixed submission:
n, m, d = list(map(int, input().split()))
if (d == 0):
  ans = (m - 1) * (1 / n)
  print(ans)
else:
  ans = (m - 1) * (2 * (n - d) / n ** 2)
  print(ans)

Buggy submission (verdict: Runtime Error):
n, m, d = list(map(int, input().split()))
if (d == 0):
  	ans = (m - 1) * (1 / n)
    print(ans)
else:
	ans = (m - 1) * (2 * (n - d) / n ** 2)
    print(ans)

Buggy submission (verdict: Runtime Error):
n, m, d = list(map(int, input().split()))
if (d == 0):
  	ans = (m - 1) * (1 / n)
    print(ans)
else:
  ans = (m - 1) * (2 * (n - d) / n ** 2)
  print(ans)

Buggy submission (verdict: Runtime Error):
n, m, d = list(map(int, input().split()))
if (d == 0):
  	ans = 1 / n
    print(ans)
else:
  ans = 2 * (n - d) / n ** 2
  print(ans)

Buggy submission (verdict: Runtime Error):
n, m, d = list(map(float, input().split()))
if (d == 0):
  	ans = 1 / n
    print(ans)
else:
  ans = 2 * (n - d) / n ** 2
  print(ans)
Problem p03463 (python)

Fixed submission:
def LI(): return [int(x) for x in input().split(" ")]
def LS(): return [str(x) for x in input().split(" ")]
def ItoS(L): return [str(x) for x in L]
def StoI(L): return [int(c) for c in L]

def solve():
    while 1:
        try:
            n, a, b = LI()
            if abs(a - b) % 2:
                print("Borys")
            else:
                print("Alice")

            break
        except:
            break
solve()

Buggy submission (verdict: Runtime Error):
import itertools

def solve():
    n = int(input())
    A = list(set(map(int, input().split(" "))))
    sum_list = []
    for i in range(1, n + 1):
        for ele in list(itertools.combinations(A, i)):
            sum_list.append(sum(ele))

    sum_list.sort()
    length = len(sum_list)
    print(sum_list[length // 2])

solve()
Problem p03479 (python)

Fixed submission:
def LI(): return [int(x) for x in input().split(" ")]
def LS(): return [str(x) for x in input().split(" ")]
def ItoS(L): return [str(x) for x in L]
def StoI(L): return [int(c) for c in L]


def solve():
    x, y = LI()
    ans = 0

    while x <= y:
        ans += 1
        x *= 2

    print(ans)

solve()

Buggy submission (verdict: Runtime Error):
def solve():
    x, y = LI()
    ans = 0

    while x <= y:
        ans += 1
        x *= 2

    print(ans)

solve()
Problem p03496 (python)

Fixed submission:
def judge(L):
    cnt_plus = 0
    cnt_minus = 0
    for l in L:
        if l >= 0:
            cnt_plus += 1
        else:
            cnt_minus += 1

    if cnt_plus == len(L):
        return 1
    elif cnt_minus == len(L):
        return -1
    else:
        return 0


def solve():
    N = int(input())
    A = list(map(int, input().split(" ")))

    if judge(A) == 1:
        print(N - 1)
        for i in range(1, N):
            print(i, i + 1)
    elif judge(A) == -1:
        print(N - 1)
        for i in range(N, 1, -1):
            print(i, i - 1)
    elif judge(A) == 0:
        print(2 * N - 1)
        MAX = max(A)
        MAX_INDEX = A.index(MAX) + 1
        MIN = min(A)
        MIN_INDEX = A.index(MIN) + 1
        if abs(MAX) >= abs(MIN):
            for i in range(1, N + 1):
                print(MAX_INDEX, i)
            for i in range(1, N):
                print(i, i + 1)
        elif abs(MAX) < abs(MIN):
            for i in range(1, N + 1):
                print(MIN_INDEX, i)
            for i in range(N, 1, -1):
                print(i, i - 1)


solve()

Buggy submission (verdict: Runtime Error):
def solve():
    N = int(input())
    A = list(map(int, input().split(" ")))

    if judge(A) == 1:
        print(N - 1)
        for i in range(1, N):
            print(i, i + 1)
    elif judge(A) == -1:
        print(N - 1)
        for i in range(N, 1, -1):
            print(i, i - 1)
    elif judge(A) == 0:
        print(2 * N - 1)
        MAX = max(A)
        MAX_INDEX = A.index(MAX) + 1
        MIN = min(A)
        MIN_INDEX = A.index(MIN) + 1
        if abs(MAX) >= abs(MIN):
            for i in range(1, N + 1):
                print(MAX_INDEX, i)
            for i in range(1, N):
                print(i, i + 1)
        elif abs(MAX) < abs(MIN):
            for i in range(1, N + 1):
                print(MIN_INDEX, i)
            for i in range(N, 1, -1):
                print(i, i - 1)


solve()
Problem p03555 (python)

Fixed submission:
def solve():
    c1 = list(input())
    c2 = list(input())
    c2.reverse()
    if c1 == c2:
        print("YES")
    else:
        print("NO")



solve()

Buggy submission (verdict: Runtime Error):
import itertools


def solve():
    N = int(input())
    A = list(map(int, input().split(" ")))
    B = list(map(int, input().split(" ")))
    C = list(map(int, input().split(" ")))

    cnt = 0
    for ele in list((itertools.product(A, B, C))):
        if ele[0] < ele[1] < ele[2]:
            cnt += 1

    print(cnt)

 
solve()
Problem p03557 (python)

Fixed submission:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import math
import itertools
import heapq
import numpy as np
from collections import OrderedDict, deque, Counter
from bisect import bisect_left, bisect_right, insort_left, insort_right
sys.setrecursionlimit(10000)

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]


def solve():
    N = int(input())
    A = sorted(list(map(int, input().split(" "))))
    B = sorted(list(map(int, input().split(" "))))
    C = sorted(list(map(int, input().split(" "))))

    cnt = 0
    for ele in B:
        cnt += bisect_left(A, ele) * (N - bisect_right(C, ele))

    print(cnt)


solve()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import itertools
from collections import OrderedDict, deque, Counter
from bisect import bisect_left, bisect_right, insort_left, insort_right
sys.setrecursionlimit(10000)


def solve():
    N = int(input())
    A = deque()
    B = deque()
    C = deque()
    A.extend(sorted(list(map(int, input().split(" ")))))
    B.extend(sorted(list(map(int, input().split(" ")))))
    C.extend(sorted(list(map(int, input().split(" ")))))

    while B[0] <= A[0]:
        B.popleft()

    while C[0] <= B[0]:
        C.popleft()

    cnt = 0
    for ele in list((itertools.product(A, B, C))):
        if ele[0] < ele[1] < ele[2]:
            cnt += 1

    print(cnt)
    
    
solve()
Problem p03566 (python)

Fixed submission:
from itertools import chain
  
n = int(input())
ts = list(map(int, input().split()))
vs = list(map(int, input().split()))
  
va = list(chain.from_iterable([v] * (2 * t) for t, v in zip(ts, vs)))
va = [min(v1, v2) for v1, v2 in zip([0] + va, va + [0])]
lt = len(va)
  
pv = 0
for ct in range(1, lt):
    va[ct] = pv = min(va[ct], pv + 0.5)
  
pv = 0
for ct in range(lt - 1, 0, -1):
    va[ct] = pv = min(va[ct], pv + 0.5)
  
print(sum((v1 + v2) / 4 for v1, v2 in zip(va, va[1:])))

Buggy submission (verdict: Runtime Error):
itertools import chain
  
n = int(input())
ts = list(map(int, input().split()))
vs = list(map(int, input().split()))
  
va = list(chain.from_iterable([v] * (2 * t) for t, v in zip(ts, vs)))
va = [min(v1, v2) for v1, v2 in zip([0] + va, va + [0])]
lt = len(va)
  
pv = 0
for ct in range(1, lt):
    va[ct] = pv = min(va[ct], pv + 0.5)
  
pv = 0
for ct in range(lt - 1, 0, -1):
    va[ct] = pv = min(va[ct], pv + 0.5)
  
print(sum((v1 + v2) / 4 for v1, v2 in zip(va, va[1:])))