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

Fixed submission:
# coding: utf-8
a = list(input())
b = list(input())
c = list(input())
trash = a.pop(0)

while True:
  if trash == "a":
    if len(a) == 0:
      print("A")
      break
    trash = a.pop(0)
  elif trash == "b":
    if len(b) == 0:
      print("B")
      break
    trash = b.pop(0)
  elif trash == "c":
    if len(c) == 0:
      print("C")
      break
    trash = c.pop(0)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
a = list(input())
b = list(input())
c = list(input())
trash = a.pop(0)

def card_trash(x):
  if x == "a":
    t = a.pop(0)
  elif x == "b":
    t = b.pop(0)
  elif x == "c":
    t = c.pop(0)
  return t
  
while True:
  trash = card_trash(trash)
  if a == []:
    print("A")
    break
  elif b == []:
    print("B")
    break
  elif c == []:
    print("C")
    break

Buggy submission (verdict: Runtime Error):
# coding: utf-8
a = list(input())
b = list(input())
c = list(input())
trash = a.pop(0)

def card_trash(x):
  if x == "a":
    t = a.pop(0)
  elif x == "b":
    t = b.pop(0)
  elif x == "c":
    t = c.pop(0)
  return t
  
while True:
  print("---")
  print(a)
  print(b)
  print(c)
  print("---")
  trash = card_trash(trash)
  if a == []:
    print("A")
    break
  elif b == []:
    print("B")
    break
  elif c == []:
    print("C")
    break

Buggy submission (verdict: Runtime Error):
# coding: utf-8
a = list(str(s) for s in input().split())
b = list(str(s) for s in input().split())
c = list(str(s) for s in input().split())
trash = "a"
end_flag = 0

def card_trash(x):
  if x == "a":
    t = a.pop(0)
  elif x == "b":
    t = b.pop(0)
  elif x = "c":
    t = c.pop(0)
  return t
  
while True:
  trash = card_trash(trash)
  if a == []:
    print("A")
    break
  elif b == []:
    print("B")
    break
  elif c == []:
    print("C")
    break
Problem p02616 (python)

Fixed submission:
from collections import deque
import math

def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]

def solve():
    n, k = NextInts()
    da = NextIntList()
    ans = 1
    MOD = 10**9+7
    
    if n == k:
        for i in range(n):
            ans = ans*da[i]%MOD
        return ans
    
    neg = []
    pos = []
    for i in range(n):
        if da[i] < 0:
            neg.append(da[i])
        else:
            pos.append(da[i])
    neg.sort()
    pos.sort()

    if len(pos) == 0 and k%2 == 1:
        neg.reverse()
        for i in range(k):
            ans = ans * neg[i] % MOD
        return ans
    
    pos.reverse()
    li = []
    po, ne = 0, 0
    if k%2 == 1:
        po = 1
        ans = pos[0]
    while po+1 < len(pos):
        li.append(pos[po]*pos[po+1])
        po += 2
    while ne+1 < len(neg):
        li.append(neg[ne]*neg[ne+1])
        ne += 2
    li.sort()
    li.reverse()
    for i in range(k//2):
        ans = li[i] * ans % MOD
    return ans

if __name__ == "__main__":
    print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
    n,k = map(int, infile.readline().split())
    da = list(map(int,infile.readline().split()))
    infile.close()
    ans = 1
    MOD = 10**9+7
    
    if n == k:
        for i in range(n):
            ans = ans*da[i]%MOD
        return ans
    
    neg = []
    pos = []
    for i in range(n):
        if da[i] < 0:
            neg.append(da[i])
        else:
            pos.append(da[i])
    neg.sort()
    pos.sort()
    
    if len(pos) == 0 and k%2 == 1:
        neg.reverse()
        for i in range(k):
            ans = ans * da[i] % MOD
        return ans
    
    li = []
    pos.reverse()
    po, ne = 0, 0
    if k%2 == 1:
        po = 1
        ans = pos[0]
    while po+1 < len(pos):
        li.append(pos[po]*pos[po+1])
        po += 2
    while ne+1 < len(neg):
        li.append(neg[ne]*neg[ne+1])
        ne += 2
    li.sort()
    li.reverse()
    for i in range(k//2):
        ans = li[i] * ans % MOD
    return ans

if __name__ == "__main__":
    solve()
Problem p02621 (python)

Fixed submission:
from collections import deque
import math

def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]

a = int(input())
print(a**3 + a**2 + a)

Buggy submission (verdict: Runtime Error):
from collections import deque
import math

def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]

a = int(input())
print((a**4-1)//(a-1)-1)
Problem p02719 (python)

Fixed submission:
# n = int(input())
# s = input()
n,k = map(int,input().split())
# da = list(map(int,input().split()))
# a = [int(input()) for i in range(n)]
# da = [list(map(int,input().split())) for i in range(m)]

print(min(n%k, k-n%k))

Buggy submission (verdict: Runtime Error):
// #include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
#include <string>
#include <stack>
#include <deque>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <time.h>
#include <cassert>
#include <fstream>
#include <stdio.h>
#include<unordered_map>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mapa make_pair
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template<typename T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<typename T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }
template<typename T>
void vdeb(std::vector<T> &da) {
	for (int i = 0;i < da.size();i++) {
		if (i == da.size() - 1) std::cout << da[i];
		else std::cout << da[i] << ' ';
	}
	std::cout << std::endl;
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
	for (int i = 0;i < da.size();i++) vdeb(da[i]);
	std::cout << std::endl;
}

using namespace std;

int main(){
	int n,k,c; cin >> n >> k>> c;
	string s; cin >> s;
	if(c == 0){
		rip(i,n,0) if(s[i]=='o') k--;
		if(k < 0) return 0;
		rip(i,n,0){
			if(s[i] == 'o') printf("%d\n", i+1);
		}
		return 0;
	}
	vector<int> dp(n),dpp(n);
	dp[0] = 1;
	dpp[n-1] = 1;
	if(s[0] == 'x') dp[0] = 0;
	if(s[n-1] == 'x') dp[n-1] = 0;
	rip(i,n,1){
		dp[i] = dp[i-1];
		if(c < i && s[i] == 'o') chmax(dp[i], dp[i-c-1]+1);
		else chmax(dp[i], 1);
	}
	for(int i = n-2;i>-1;i--){
		dpp[i] = dpp[i+1];
		if(i+c+1 < n && s[i] == 'o') chmax(dpp[i], dpp[i+c+1]+1);
		else chmax(dpp[i], 1);
	}
	vector<int> ans(0);
	vector<int> su(n+1);
	rip(i,c+1,0){
		if(dpp[i] >= k) su[0]++, su[i]--;
	}
	rip(i,n-c-1,0){
		if(dp[i] + dpp[i+c+1] >=k) su[i+1]++, su[i+c+1]--;
	}
	rip(i,n,n-c-1){
		if(dp[i] >= k) su[n]--, su[i+1]++;
	}
	int ok= 0;
	rip(i,n,0){
		ok += su[i];
		if(ok == 0) ans.push_back(i+1);
	}
	// vdeb(dp);vdeb(dpp);vdeb(su);
	rip(i,ans.size(),0) printf("%d\n", ans[i]);
}
Problem p02731 (python)

Fixed submission:
l = int(input())
#s = input()
#a,b = map(int,input().split())
#da = list(map(int,input().split()))
#a = [int(input()) for i in range(n)]

print((l/3)**3)

Buggy submission (verdict: Runtime Error):
n = int(input())
  print(n**3/27)
Problem p02802 (python)

Fixed submission:
n,m = map(int,input().split())
da = [list(map(str,input().split())) for i in range(m)]
penalty = [0 for i in range(n)]
accepted = [False for i in range(n)]
for i in range(m):
  now = int(da[i][0]) - 1
  if da[i][1] == 'AC':
    accepted[now] = True
  elif not accepted[now]:
    penalty[now] += 1
AC,WA = 0,0
for i in range(n):
  if accepted[i]:
    AC += 1
    WA += penalty[i]
print(AC,WA)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
da = [map(str,input().split()) for i in range(m)]
penalty = [0 for i in range(n)]
accepted = [False for i in range(n)]
for i in range(m):
  now = int(da[i][0]) - 1
  if da[i][1] == 'AC':
    accepted[now] = True
  elif not accepted[now]:
    penalty[now] += 1
AC,WA = 0,0
for i in range(n):
  if accepted[i]:
    AC += 1
    WA += penalty[i]
print(AC,WA)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
da = [map(str,input().split()) for i in range(m)]
penalty = [0 for i in range(n)]
accepted = [False for i in range(n)]
for i in range(m):
  now = int(da[i][0])
  if da[i][1] == 'AC':
    accepted[now] = True
  elif not accepted[now]:
    penalty[now] += 1
AC,WA = 0,0
for i in range(n):
  if accepted[i]:
    AC += 1
    WA += penalty[i]
print(AC,WA)
Problem p02868 (python)

Fixed submission:
import heapq
import numpy as np
import sys

n,m = map(int,input().split())
da = [[] for i in range(n)]
for i in range(1,n):
    da[i].append([i-1,0])
for i in range(m):
    l,r,c = map(int,input().split())
    da[l-1].append([r-1,c])
pq=[]
ju = np.zeros(n,dtype=bool)
ju[0] = True
for i in da[0]:
    heapq.heappush(pq, [i[1],i[0]])
while(len(pq)):
    now = heapq.heappop(pq)
    if now[1] == n-1:
        print(now[0])
        sys.exit()
    if ju[now[1]]:
        continue
    ju[now[1]] = True
    for i in da[now[1]]:
        if ju[i[0]]:
            continue
        heapq.heappush(pq,[now[0]+i[1],i[0]])
print(-1)

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

class rode():
    def __init__(self,x,y):
        self.x = x
        self.y = y
    def __lt__(self, other):
        return self.y < other.y
    def __gt__(self, other):
        return other > self
    def __le__(self, other):
        return not(other > self)
    def __ge__(self, other):
        return not(self > other)

n,m = map(int,input().split())
da = [[i-1,0] for i in range(n)]
da[0] = []
for i in range(m):
    l,r,c = map(int,input().split())
    da[l-1].append([r-1,c])
for i in range(1,n):
    da[i].append([i-1,0])
pq=[]
ju = [False for i in range(n)]
ju[0] = True
for i in da[0]:
    heapq.heappush(pq, rode(i[0],i[1]))
while(len(pq)):
    now = heapq.heappop(pq)
    if now.x == n-1:
        print(now.y)
        sys.exit()
    if ju[now.x]:
        continue
    ju[now.x] = True
    for i in da[now.x]:
        if ju[i[0]]:
            continue
        heapq.heappush(pq,rode(i[0],now.y+i[1]))
print(-1)
Problem p02882 (python)

Fixed submission:
import math
a,b,x=map(int,input().split())
ans = 0
if a*a*b==x:
    ans = math.pi/2
elif a*a*b/2 >= x:
    x/=a
    x=x*2/b
    ans = math.atan(x/b)
else:
    x/=a*a
    x=(b-x)*2
    ans = math.atan(a/x)
print(90-ans/math.pi*180)

Buggy submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
ans = 0
if a*a*b/2 >= x:
    x/=a
    x=x*2/b
    ans = math.atan(x/b)
else:
    x/=a*a
    x=(b-x)*2
    ans = math.atan(a/x)
print(90-ans/math.pi*180)
Problem p02995 (python)

Fixed submission:
def gcd(n,m):
    if n<m:
        return gcd(m,n)
    if n%m==0:
        return m
    else:
        return gcd(m,n%m)

a,b,c,d=map(int,input().split())
ans=b-a+1
ans-=b//c-(a-1)//c
ans-=b//d-(a-1)//d
e=c*d//(gcd(c,d))
ans+=b//e-(a-1)//e
print(ans)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
ans=b-a+1
ans-=b//c-(a-1)//c
ans-=b//d-(a-1)//d
e=math.gcd(a,b)
ans+=b//e-(a-1)//e
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().funcsplit())
ans=b-a+1
ans-=b//c-(a-1)//c
ans-=b//d-(a-1)//d
e=c*d
ans+=b//e-(a-1)//e
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input(),split())
ans=b-a+1
ans-=b//c-(a-1)//c
ans-=b//d-(a-1)//d
e=c*d
ans+=b//e-(a-1)//e
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d=int(input().split())
ans=b-a+1
ans-=b//c-(a-1)//c
ans-=b//d-(a-1)//d
e=c*d
ans+=b//e-(a-1)//e
print(ans)
Problem p03023 (python)

Fixed submission:
n=int(input())
print((n-2)*180)

Buggy submission (verdict: Runtime Error):
n,m,d=map(int,input().split())
da=[0 for i in range(n)]
print((n-2)*180)
Problem p03139 (python)

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

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
print(min(a,b),max(a+b-n))
Problem p03288 (python)

Fixed submission:
n=int(input())
if n<1200:
  print('ABC')
elif n>=2800:
  print('AGC')
else:
  print('ARC')

Buggy submission (verdict: Runtime Error):
n=int(input())
if n<1200:
  print('ABC')
elif (n<2800)&&(n>=1200):
  print('ARC')
else:
  print('AGC')

Buggy submission (verdict: Runtime Error):
n=int(input())
if n<1200:
  print('ABC')
elif n<2800&&n>=1200:
  print('ARC')
else:
  print('AGC')
Problem p03294 (python)

Fixed submission:
n=int(input())
da=list(map(int,input().split()))
ans=0
for i in da:
  ans+=i-1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
da=list(map((int,input().split()))
ans=0
for i in da:
  ans+=i-1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
da=list(map((int,input().split()))
ans=0
fro i in range da:
  ans+=i-1
print(ans)
Problem p03338 (python)

Fixed submission:
n=int(input())
s=input()
ans=0
for i in range(n):
  x=s[:i]
  y=s[i:]
  X=set(list(x))
  Y=set(list(y))
  ans=max(ans,len(X&Y))
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
ans=0
for i in range(n):
  x=s[:i]
  y=s[i:]
  X=set(x)
  Y=set(y)
  ans=max(ans,X&Y)
print(ans)
Problem p03352 (python)

Fixed submission:
import math
n=int(input())
ans=1
for i in range(2,int(math.sqrt(n))+1):
  x=1
  while(x<n+1):
    x=i*x
  ans=max(ans,x//i)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=1
for i in range(32):
  j=i
  while(j<x):
    j*=i
  ans=max(ans,j//i)
print(ans)
Problem p03435 (python)

Fixed submission:
def checker(ded, da):
  for i in range(3):
    for j in range(2):
      if da[i][j] - ded[j] != da[i][2] - ded[2]:
        return False
  return True

def ma(da):
  for i in range(-100, 101):
    for j in range(-100, 101):
      for k in range(-100, 101):
        if checker([i, j, k], da):
          return False
  return True

da = [list(map(int,input().split())) for i in range(3)]
if not ma(da):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
def checker(ded, da):
  for i in range(3):
    for j in range(2):
      if da[i][j] - ded[j] != da[i][2] - ded[2]:
        return False
  return True

def ma(da):
  for i in range(-100, 101):
    for j in range(-100, 101):
      for k in range(-100, 101):
        if not checher([i, j, k], da):
          return False
  return True

da = [list(map(int,input().split())) for i in range(3)]
if ma(da):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
def checker(ded, da):
  for i in range(3):
    for j in range(2):
      if da[i][j] - ded[j] != da[i][2] - ded[2]:
        return False
  return True

def ma(da):
  for i in range(-100, 101):
    for j in range(-100, 101):
      for k in range(-100, 101)
        if not checher([i, j, k], da):
          return False
  return True

da = [list(map(int,input().split())) for i in range(3)]
if ma(da):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
def checker(ded, da):
  for i in range(3):
    for j in range(2):
      if da[i][j] - ded[j] != da[i][2] - ded[2]:
        return False
  return True

def ma(da):
  for i in range(-100, 101):
    for j in range(-100, 101):
      for k in range(-100, 101)
      if not checher([i, j, k], da):
        return False
  return True

da = [list(map(int,input().split())) for i in range(3)]
if ma(da):
  print('Yes')
else:
  print('No')
Problem p03605 (python)

Fixed submission:
n=int(input())
if n%10==9 or n//10==9:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input().split())
if n%10==9 or n/10==9:
  print('Yes')
else:
  print('No')

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

ans=3000000000

def permu(ju,now,su,co):
    if now==0:
        global ans
        ans=min(ans,su)
        return
    else:
        for i in range(r):
            if ju[i]:
                ju[i]=False
                su+=dp[co][rute[i]-1]
                permu(ju,now-1,su,rute[i]-1)
                ju[i]=True
                su-=dp[co][rute[i]-1]
    return

rute=list(map(int,input().split()))
dp=[[30000000 for i in range(n)] for i in range(n)]
for i in range(n):
    dp[i][i]=0
for i in range(m):
    a,b,c=map(int,input().split())
    dp[a-1][b-1]=c
    dp[b-1][a-1]=c
for i in range(n):
    for j in range(n):
        for k in range(n):
            dp[j][k]=min(dp[j][i]+dp[i][k],dp[j][k])


ju=[True for i in range(r)]
for i in range(r):
    ju[i]=False
    permu(ju,r-1,0,rute[i]-1)
    ju[i]=True
print(ans)
Problem p03623 (python)

Fixed submission:
x,a,b=map(int,input().split())
if abs(a-x) > abs(b-x):
  print('B')
else:
  print('A')

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if abs(a-t) > abs(b-t):
  print('B')
else:
  print('A')
Problem p02684 (python)

Fixed submission:
import sys

n,k = map(int,input().split())
a = list(map(int,input().split()))

array = [-1] * (n+1)
array[1] = 0

li = []
li.append(1)

tmp = -1
index = 0
for i in range(2 * (10**5)):
  if array[a[index]] != -1:
    tmp = array[a[index]]
    break
    
  if i == k:
    print(index+1)
    sys.exit(0)
    
  li.append(a[index])
  array[a[index]] = i+1
  index = a[index] -1
  
k -= tmp
d = len(li) - tmp

k %= d

print(li[k+tmp])

Buggy submission (verdict: Runtime Error):
import sys

n,k = map(int,input().split())
a = list(map(int,input().split()))

array = [-1] * (n+1)
array[1] = 0

li = []
li.append(1)

tmp = -1
i = 1
index = 0
while True:
  if array[a[index]] != -1:
    tmp = array[a[index]]
    break
    
  if i == k:
    print(a[index])
    sys.exit(0)
    
  li.append(a[index])
  array[index] = i
  index = a[index] -1
  i += 1
  
  

k -= tmp
d = len(li)

k %= d

print(li[k+tmp])
Problem p02850 (python)

Fixed submission:
def func(iro,tree,num,max_color):
  if num not in tree:
    return
  
  my_color = iro[num]
  arr = tree[num]
  
  for i in arr:
    my_color += 1
    iro[i] = my_color % max_color
    func(iro,tree,i,max_color)
    

n = int(input())
tree = {}

b_arr = []
for i in range(n-1):
  a,b = map(int,input().split())
  
  b_arr.append(b)
  if a not in tree:
    tree[a] = []
    
  tree[a].append(b)
  
color = len(tree[1])
for key,arr in sorted(tree.items()):
  if key == 1:
    continue
    
  color = max(len(arr)+1, color)

print(color)

iro = [-1] * (n+1)

for key,arr in sorted(tree.items()):
  my_color = iro[key]
  for i in arr:
    my_color += 1
    iro[i] = my_color % color

for i in b_arr:
  print(iro[i]+1)

Buggy submission (verdict: Runtime Error):
def func(iro,tree,num,max_color):
  if num not in tree:
    return
  
  my_color = iro[num]
  arr = tree[num]
  
  for i in arr:
    my_color += 1
    iro[i] = my_color % max_color
    func(iro,tree,i,max_color)
    

n = int(input())
tree = {}

b_arr = []
for i in range(n-1):
  a,b = map(int,input().split())
  
  b_arr.append(b)
  if a not in tree:
    tree[a] = []
    
  tree[a].append(b)

tree = sorted(tree.items())
  
color = len(tree[1])
for key in tree.keys():
  if key == 1:
    continue
    
  arr = tree[key]
  color = max(len(arr)+1, color)

print(color)

iro = [-1] * (n+1)

for key in tree.keys():
  my_color = iro[key]
  arr = tree[key]
  for i in arr:
    my_color += 1
    iro[i] = my_color % color

for i in b_arr:
  print(iro[i]+1)

Buggy submission (verdict: Runtime Error):
def func(iro,tree,num,max_color):
  if num not in tree:
    return
  
  my_color = iro[num]
  arr = tree[num]
  
  for i in arr:
    my_color += 1
    iro[i] = my_color % max_color
    func(iro,tree,i,max_color)
    

n = int(input())
tree = {}

b_arr = []
for i in range(n-1):
  a,b = map(int,input().split())
  
  b_arr.append(b)
  if a not in tree:
    tree[a] = []
    
  tree[a].append(b)


color = len(tree[1])
for key in tree.keys():
  if key == 1:
    continue
    
  arr = tree[key]
  color = max(len(arr)+1, color)

print(color)

iro = [0] * (n+1)

func(iro,tree,1,color)

for i in b_arr:
  print(iro[i]+1)
Problem p02888 (python)

Fixed submission:
import bisect as bs
n = int(input())
l = sorted(list(map(int,input().split())))

count = 0
for i in range(n):
  for j in range(i+1,n):
    index = bs.bisect_left(l,l[i]+l[j])
    count += index - j - 1
    
print(count)

Buggy submission (verdict: Runtime Error):
import bisect
n = int(input())
l = sorted(list(map(int, input().split())))

dic = {}
ans = 0
for i in range(n-1):
  for j in range(i+1, n):
    tmp = l[i] + l[j]
    
    index2 = dic.get(tmp, -1)
    
    if index2 == -1
      index2 = bisect.bisect_left(l, tmp)
      dic[tmp] = index2
      
    index1 = dic.get(l[j], -1)
    if index1 == -1:
      index1 = bisect.bisect_left(l, l[j])
      dic[l[j]] = index1     
    
    if l[i] == l[j]:
      d = index2 - index1 - 2
    else:
      d = index2 - index1 - 1
    
    ans += max(d,0)
    
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
n = int(input())
l = sorted(list(map(int, input().split())))

dic = {}
ans = 0
for i in range(n-1):
  for j in range(i+1, n):
    tmp = l[i] + l[j]
    
    index2 = dic.get(tmp, -1)
    
    if index2 == -1
      index2 = bisect.bisect_left(l, tmp)
      dic[tmp] = index2
      
    index1 = dic.get(l[j], -1)
    if index == -1:
      index1 = bisect.bisect_left(l, l[j])
      dic[l[j]] = index1     
    
    if l[i] == l[j]:
      d = index2 - index1 - 2
    else:
      d = index2 - index1 - 1
    
    ans += max(d,0)
    
print(ans)
Problem p02921 (python)

Fixed submission:
s = input()
t = input()

count = 0
for i in range(len(s)):
  if s[i] == t[i]:
    count += 1
    
print(count)

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

count = 0
for i in range(s):
  if s[i] == t[i]:
    count += 1
    
print(count)
Problem p02963 (python)

Fixed submission:
import math
s = int(input())

root = math.ceil(math.sqrt(s))

if s <= 10 ** 9:
  print(0,0,0,1,s,0)
else:
  tmp = root**2 - s
  print(0,0,tmp,root,root,1)

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

root = math.floor(math.sqrt(s))

if s <= 10 ** 9:
  print(0,0,0,1,s,0)
else:
  for i in reversed(range(root)):
    if s % i == 0:
      print(0,0,0,i,s//i,0)
      break