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

Fixed submission:
a,b,c=map(int,input().split())
if a<=c<=b:print("Yes")
else:print("No")

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
D,L={},[]
for _ in range(N):
    a,b=map(int,input().split())
    L.append(a)
    if a in D:D[a]=D[a]+b
    else:D[a]=b
l=list(set(L)).sort()
for i in l:
    K-=D[i]
    if K<=0:
        print(i)
        exit()
Problem p03721 (python)

Fixed submission:
N,K=map(int,input().split())
D,L={},[]
for _ in range(N):
    a,b=map(int,input().split())
    L.append(a)
    if a in D:D[a]=D[a]+b
    else:D[a]=b
l=list(set(L))
l.sort()
for i in l:
    K-=D[i]
    if K<=0:
        print(i)
        exit()

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
D,L={},[]
for _ in range(N):
    a,b=map(int,input().split())
    L.append(a)
    if a in D:D[a]=D[a]+b
    else:D[a]=b
l=list(set(L)).sort()
for i in l:
    K-=D[i]
    if K<=0:
        print(i)
        exit()
Problem p03761 (python)

Fixed submission:
n=int(input())
S=input()
D={}
for i in range(len(S)):
    s=S[i]
    if s in D:D[s]+=1
    else:D[s]=1
for _ in range(n-1):
    S=input()
    E={}
    DD={}
    for i in range(len(S)):
        s=S[i]
        if s in E:E[s]+=1
        else:E[s]=1
    for i in D:
        if i in E:DD[i]=min(E[i],D[i])
    D=DD
ans=[]
for j in D:
    for _ in range(D[j]):
        ans.append(j)
ans.sort()
print("".join(ans))

Buggy submission (verdict: Runtime Error):
n=int(input())
S=input()
D={}
for i in range(len(S)):
    s=S[i]
    if s in D:D[s]+=1
    else:D[s]=1
for _ in range(n-1):
    S=input()
    E={}
    DD={}
    for i in range(len(S)):
        s=S[i]
        if s in E:E[s]+=1
        else:E[s]=1
    for i in D:
        if i in E:DD[i]=min(E[i],D[i])
ans=[]
for j in DD:
    for _ in range(DD[j]):
        ans.append(j)
ans.sort()
print("".join(ans))
Problem p03837 (python)

Fixed submission:
import heapq,sys
input=sys.stdin.readline
INF=float('inf')
heappush=heapq.heappush
heappop=heapq.heappop

n,m=map(int,input().split())
graph=[[] for _ in range(n)]
minway=[]
bridges=[]
ans=0
for _ in range(m):
    a,b,c=map(int,input().split())
    graph[a-1].append((b-1,c))
    graph[b-1].append((a-1,c))
    bridges.append((a-1,b-1,c))

def dijkstra(graph,n,start):
    Q=[]
    distance=[]
    dappend=distance.append
    for i in range(n):
        dappend([INF,i])
    distance[start][0]=0
    for j in distance:
        heappush(Q,j)
    while Q!=[]:
        q=heappop(Q)
        for v,vl in graph[q[1]]:
            alt=vl+q[0]
            if alt<distance[v][0]:
                distance[v][0]=alt
                heappush(Q,[alt,v])
    return distance

for k in range(n):
    minway.append(dijkstra(graph,n,k))

for l in bridges:
    x,y,z=l[0],l[1],l[2]
    flag=True
    for p in range(n):
        if minway[x][p][0]+z==minway[y][p][0] or minway[y][p][0]+z==minway[x][p][0]:
            flag=False
            break
    if flag:
        ans+=1

print(ans)

Buggy submission (verdict: Runtime Error):
import heapq,math,sys
input=sys.stdin.readline
INF=math.inf
heappush=heapq.heappush
heappop=heapq.heappop

n,m=map(int,input().split())
graph=[[] for _ in range(n)]
minway=[]
bridges=[]
ans=0
for _ in range(m):
    a,b,c=map(int,input().split())
    graph[a-1].append((b-1,c))
    graph[b-1].append((a-1,c))
    bridges.append((a-1,b-1))

def dijkstra(graph,n,start):
    Q=[]
    distance=[]
    dappend=distance.append
    for i in range(n):
        dappend([INF,i])
    distance[start][0]=0
    for j in distance:
        heappush(Q,j)
    while Q!=[]:
        q=heappop(Q)
        for v,vl in graph[q[1]]:
            alt=vl+q[0]
            if alt<distance[v][0]:
                distance[v][0]=alt
                heappush(Q,[alt,v])
    return distance

for k in range(n):
    minway.append(dijkstra(graph,n,k))

for l in bridges:
    flag=0
    x,y=l[0],l[1]
    for p in graph[x]:
        if p!=y:
            if minway[x][p[0]][0]+minway[x][y][0]==minway[p[0]][y][0]:
                flag=1
    for q in graph[y]:
        if q!=x:
            if minway[x][y][0]+minway[y][q[0]][0]==minway[x][q[0]][0]:
                flag=1
    if flag==0:
        ans+=1
print(ans)
Problem p03854 (python)

Fixed submission:
s=input()
s=s.replace("eraser","")
s=s.replace("erase","")
s=s.replace("dreamer","")
s=s.replace("dream","")
if s=="":print("YES")
else:print("NO")

Buggy submission (verdict: Runtime Error):
def f(s):
    if len(s)==0:
        print("YES")
        exit()
    elif 1<=len(s)<=4:
        print("NO")
        exit()
    else:
        if s[0:5]=="maerd" or s[0:5]=="esare":
            s=s[5:]
            f(s)
        elif len(s)==5:
            print("NO")
            exit()
        elif s[0:6]=="resare":
            s=s[6:]
            f(s)
        elif len(s)==6:
            print("NO")
            exit()
        elif s[0:7]=="remaerd":
            s=s[7:]
            f(s)
        else:
            print("NO")
            exit()
S=input()
S=S[::-1]
f(S)
Problem p02811 (python)

Fixed submission:
K,X = map(int,input().split())
if K*500 > X-1:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
K,X = map(input().split())
if K*500 > X-1:
  print('Yes')
else:
  print('No')
Problem p02909 (python)

Fixed submission:
S = input()
if S == 'Sunny':
  print('Cloudy')
elif S == 'Cloudy':
  print('Rainy')
else:
  print('Sunny')

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M = map(int,input().split())
A = np.array(map(int,input().split()))
C = np.array(A)
for i in range(M):
  p = np.argmax(C)
  C[p] = int(C[p]/2)
print(sum(C))
Problem p02983 (python)

Fixed submission:
L,R = map(int,input().split())
L_mod = L % 2019
A = 2019 - L_mod
if A <= R-L:
  print(0)
else:
  ans = 2018
  for i in range(R-L+1):
    for j in range(i+1,R-L+1):
      temp = (L_mod + i) * (L_mod + j) % 2019
      if temp <= ans:
        ans = temp
  print(ans)

Buggy submission (verdict: Runtime Error):
L,R = map(int,input().split())
L_mod = L % 2019
A = 2019 - L_mod
if A <= R-L:
  print(0)
else:
  ans = 2018
  for i in range(R-L+1):
    for j in range(i+1,R-L+1):
      temp = (L_mod + i) * (L_mod + j) % 2019
      if temp <= ans:
        ans = temp
print(ans)
Problem p03037 (python)

Fixed submission:
N,M = map(int,input().split())
L=[]
R=[]
Nlist = list(range(1,N+1))
for i in range(M):
  L_n,R_n = map(int,input().split())
  L.append(L_n)
  R.append(R_n)

Lmax=max(L)
Rmin=min(R)
if Rmin < Lmax:
  print(0)
else:
  print(Rmin-Lmax+1)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
L=[]
R=[]
for i in range(M):
  L_n,R_n = map(int,input().split())
  L.append(L_n)
  R.append(R_n)
Nlist = list(range(L[0],R[0]+1))
  
for i in range(1,M):
  a = L[i]
  b = R[i]
  if Nlist[0]<a or Nlist[-1]>b:
    Nlist = [k for k in Nlist if (k > (a-1)) and (k < (b+1))]
print(len(Nlist))
Problem p03062 (python)

Fixed submission:
N = int(input())
a = input().split()
num=[]
numabs=[]
tex=[]
count=0
count2=0
for i in range(N):
	num.append(int(a[i]))
	numabs.append(abs(num[i]))
	if num[i] < 0 :
		count +=1
	elif num[i] == 0:
		count2 +=1
if count%2 ==0 or count2 > 0:
	res = sum(numabs)
else:
	res =sum(numabs)-2*min(numabs)
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = input().split()
num=[]
numabs=[]
tex=[]
count=0
for i in range(N):
	num.append(int(a[i]))
	numabs.append(abs(num[i]))
	if num[i] < 0 :
		count +=1
	elif num[i] == 0:
		count2 +=1
if count%2 ==0 or count2 > 0:
	res = sum(num)
else:
	res =sum(num)-2*min(numabs)
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = input().split()
num=[]
tex=[]
count=0
for i in range(N):
	num.append(int(a[i]))
	if num[i] < 0 :
		count +=1
	elif num[i] == 0:
		count2 +=1
if count%2 ==0 or count2 > 0:
	res = sum(num)
else:
	tex=[i for i, x in enumerate(num) if x <0]
	res =sum(num)-min(tex[0],tex[-1])
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = input().split()
num=[]
tex=[]
count
for i in range(N):
	num.append(int(a[i]))
	if num[i] < 0 :
		count +=1
	elif num[i] == 0:
		count2 +=1
if count%2 ==0 or count2 > 0:
  res = sum(num)
else:tex=[i for i, x in enumerate(num) if x <0]
  res =sum(num)-min(tex[0],tex[-1])
print(res)
Problem p03067 (python)

Fixed submission:
a = input().split()
i=int(a[0])
j=int(a[1])
k=int(a[2])
if i < k and j < k:
   print('No')
elif i>k and j>k:
   print('No')
else:
   print('Yes')

Buggy submission (verdict: Runtime Error):
stone=input()
color=input()
a=int(stone)
counter=0
counter2=0
black = 0
white = 0
xxx=[]
yyy=[]
list=[]
list2=[]
for i in range(a):
    list.append(color[i])
for i in range(a):
    if list[i]=='#':
        xxx.append(i)
        black += 1
    if list[i]=='.':
        yyy.append(i)
        white += 1
if white ==0 or black==0:
    print('0')
else:
   i =0
for i in range(a):
    for j in range(0,i):
        if list[j]=='#':
            counter = counter+1
    for k in range(i,a):
        if list[k]=='.':
            counter = counter+1
    list2.append(counter)
print(min(counter))

Buggy submission (verdict: Runtime Error):
stone=input()
color=input()
a=int(stone)
counter=0
counter2=0
black = 0
white = 0
xxx=[]
yyy=[]
list=[]
for i in range(a):
    list.append(color[i])
for i in range(a):
    if list[i]=='#':
        xxx.append(i)
        black += 1
    if list[i]=='.':
        yyy.append(i)
        white += 1
if white ==0 or black==0:
    print('0')
else:
    s = min(xxx)
    t = max(yyy)
    for k in range(s,a):
        if list[k]=='.' :
            counter = 1+ counter
    for j in range(0,t):
        if list[j]=='#':
            counter2 = 1 +counter2
    if counter < counter2:
        print(counter)
    else:
        print(counter2)
Problem p03068 (python)

Fixed submission:
n = input()
word = input()
a= input()
b=0
text=''
x=word[int(a)-1]
 
for i in range(int(n)):
    if word[i] == x:
         text = text + x
    else:
        text = text + '*'
print(text)

Buggy submission (verdict: Runtime Error):
n = input()
word = input()
a= input()
b=0
x=word[int(a)]

for i in range(int(n)):
    if word[i] == x:
         b=0
    else:
        word[i]=*
print(word)
Problem p03087 (python)

Fixed submission:
import numpy as np
N,Q = map(int,input().split())
S = input()
ans = np.zeros(N+1)
for i in range(N):
  ans[i+1] = ans[i] + (1 if S[i:(i+2)] == 'AC' else 0) 
for i in range(Q):
  l,r = map(int,input().split())
  print(int(ans[r-1] - ans[l-1]))

Buggy submission (verdict: Runtime Error):
import numpy as np
N,Q = map(int,input().split())
S = input()
ans =[]
for i in range(N):
  if S[i] == 'A':
    if S[i+1] == 'C':
      ans.append(i)
ans2 = np.array(ans)
for i in range(Q):
  l,r = map(int,input().split())
  print(np.count_nonzero((l-2<ans2)&(ans2<r-1)))
Problem p03161 (python)

Fixed submission:
n , k = map(int,input().split())
h = list(map(int,input().split()))
import numpy as np
h = np.array(h)
dp =np.zeros(n,dtype = int)
for i in range(1,n):
    s = max(0,i-k)
    dp[i] = np.min(dp[s:i] + np.abs(h[s:i] - h[i]))
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input().split()))
print(h)
import numpy as np
h = np.array(h)
dp = np.zeros(n,dtype=int)
for i in range(1,n):
  s=(0,i-k)
  dp[i]=np.min(dp[s:i]+np.abs(h[s:i]-h[i]))
  
print(dp[-1])
Problem p03472 (python)

Fixed submission:
a = []
b = []
N,H = map(int,input().split())
for i in range(N):
    ca,cb = map(int,input().split())
    a.append(ca)
    b.append(cb)
count = 0
ma = max(a)
b.sort(reverse = True)
def ans():
    global N,H,count
    for i in range(N):
        if b[i] < ma:
            break
        H -= b[i]
        count += 1
        if H <= 0:
            return count
    count += H//ma
    if H%ma != 0:
        count += 1
    return count
print(ans())

Buggy submission (verdict: Runtime Error):
N,H = map(int,input().split())
a_list=[]
b_list=[]
cnt = 0
for i in range(N):
  a,b = map(int,input().split())
  a_list.append(a)
  b_list.append(b)
sum_b = sum(b_list)
if sum_b < H:
  A = max(a_list)
  for i in range(N):
    if b_list[i] - A < 0:
      cnt += A - b_list[i]
  print(N-(-(H - sum_b - cnt)//A))
else:
  c = sorted(b_list)
  i = 0
  k = 0
  while k < H:
    k += c[N-1-i]
    i += 1
  pprint(i)
Problem p03162 (python)

Fixed submission:
from copy import *
from sys import *
from math import *
import queue
from collections import defaultdict,Counter,deque

setrecursionlimit(1000000)

#dp[x][y] 最終日にyを選択した際のx日目までの最大の幸福度
def main():
	n = int(input())
	abc = [list(map(int, input().split())) for i in range(n)]
	dp = [[0,0,0]]
	for i in range(1,n+1):
		temp = []
		temp.append(max(dp[i-1][1], dp[i-1][2]) + abc[i-1][0])
		temp.append(max(dp[i-1][0], dp[i-1][2]) + abc[i-1][1])
		temp.append(max(dp[i-1][1], dp[i-1][0]) + abc[i-1][2])
		dp.append(temp)
	print(max(dp[-1]))

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(m,n):
	x = max(m,n)
	y = min(m,n)
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	return y

class Queue():
	#競プロ用のQueue
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)

class Stack():
	#怯プロ用のStack
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)

main()

Buggy submission (verdict: Runtime Error):
from copy import *
from sys import *
from math import *
import queue
from collections import defaultdict,Counter,deque

setrecursionlimit(1000000)

#dp[i][w]
def main():
	n,w = map(int,input().split())
	wv = [list(map(int,input().split())) for i in range(n)]
	dp = [[0 for _ in range(w+1)] for _ in range(n+1)]
	for i in range(1,n+1):
		cw = wv[i-1][0]
		cv = wv[i-1][1]
		for j in range(w+1):
			dp[i][j] = max(dp[i-1][j],dp[i-1][j-cw] + cv) if j-cw >= 0 else dp[i-1][j]
	print(dp[-1][-1])

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(m,n):
	x = max(m,n)
	y = min(m,n)
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	return y

class Queue():
	#競プロ用のQueue
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)

class Stack():
	#怯プロ用のStack
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)

main()
Problem p03471 (python)

Fixed submission:
import copy
import sys
import math

def main():
	n,y = map(int,input().split())
	for i in range(n+1):
		for j in range(n-i+1):
			k = n-i-j
			if(y == i*10000 + j*5000 + k*1000):
				print('{} {} {}'.format(i,j,k))
				sys.exit()
	print('-1 -1 -1')


def listtodict(a):
	b = {}
	for i in a:
		try:
			b[i] += 1
		except:
			b[i] = 1
	return b

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

main()

Buggy submission (verdict: Runtime Error):
import copy
import sys
import math

def main():
	n,y = map(int,input().split())
	for i in range(n+1):
		for j in range(n-i+1):
			k = n-i-j
			if(y == i*10000 + j*5000 + k*1000):
				print(f'{i} {j} {k}')
				sys.exit()
	print('-1 -1 -1')


def listtodict(a):
	b = {}
	for i in a:
		try:
			b[i] += 1
		except:
			b[i] = 1
	return b

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

main()

Buggy submission (verdict: Runtime Error):
import copy
import sys
import math

def main():
	n,y = map(int,input().split())
	for i in range(n+1):
		for j in range(n-i+1):
			k = n-i-j
			if(y == i*10000 + j*5000 + k*1000):  print(f'{i} {j} {k}');sys.exit()
	print('-1 -1 -1')


def listtodict(a):
	b = {}
	for i in a:
		try:
			b[i] += 1
		except:
			b[i] = 1
	return b

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

main()
Problem p03647 (python)

Fixed submission:
import copy
import sys
import math

def main():
	n,m = map(int,input().split())
	ab = [list(map(int,input().split())) for _ in range(m)]
	b = {}
	for i in ab:
		try:
			b[i[0]].append(i[1])
		except:
			b[i[0]] = [i[1]]
		try:
			b[i[1]].append(i[0])
		except:
			b[i[1]] = [i[0]]
	ab = copy.deepcopy(b)
	for i in ab[1]:
		if(n in ab[i]):
			print('POSSIBLE')
			sys.exit()
	print('IMPOSSIBLE')


def listtodict(a):
	b = {}
	for i in a:
		try:
			b[i] += 1
		except:
			b[i] = 1
	return b

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

main()

Buggy submission (verdict: Runtime Error):
from copy import *
from sys import *
from math import *
import queue
from collections import defaultdict,Counter,deque

setrecursionlimit(1000000)

def main():
	n,m = map(int,input().split())
	ab = [list(map(int,input().split())) for _ in range(m)]
	b = {}
	for i in ab:
		try:
			b[i[0]].append(i[1])
		except:
			b[i[0]] = [i[1]]
		try:
			b[i[1]].append(i[0])
		except:
			b[i[1]] = [i[0]]
	ab = copy.deepcopy(b)
	for i in ab[1]:
		if(n in ab[i]):
			print('POSSIBLE')
			sys.exit()
	print('IMPOSSIBLE')

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(m,n):
	x = max(m,n)
	y = min(m,n)
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	return y

class Queue():
	#競プロ用のQueue
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)

class Stack():
	#怯プロ用のStack
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)

main()
Problem p03479 (python)

Fixed submission:
x,y=input().split();
k,w=int(y)//int(x),0
while 2**w<=k:w=w+1
print(w)

Buggy submission (verdict: Runtime Error):
import math
x,y=input().split()
print(int(math.log(2,int(y)//int(x))+1))
Problem p03587 (python)

Fixed submission:
a=input()
print(a.count("1"))

Buggy submission (verdict: Runtime Error):
a=input()
print(a.count("1"))
Problem p03635 (python)

Fixed submission:
a = [int(x) for x in input().split()]
print((a[0]-1)*(a[1]-1))

Buggy submission (verdict: Runtime Error):
a=int(input().split())
print((a[0]-1)*(a[1]-1))

Buggy submission (verdict: Runtime Error):
print((int(input())-1)*(int(input())-1))
Problem p03636 (python)

Fixed submission:
s=input()
print('%c%d%c'%(s[0],len(s)-2,s[len(s)-1]))

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
    cin >> s;
    cout << s[0] << s.size() - 2 << s[s.size() - 1] << endl;
    return 0;
}
Problem p03845 (python)

Fixed submission:
n = int(raw_input())
t = map(int, raw_input().split())
s = sum(t)
m = int(raw_input())
for _ in range(m):
    p, x = map(int, raw_input().split())
    print s - t[p - 1] + x

Buggy submission (verdict: Runtime Error):
n = int(raw_input())
t = map(int, raw_input().split())
s = sum(t)
m = int(raw_input())
for _ in range(m):
    p, x = map(int, raw_input().split())
    print s - t[p - 1] + x
Problem p03861 (python)

Fixed submission:
s=input().split()
a=int(s[0])
b=int(s[1])
c=int(s[2])
print(b//c-(a-1)//c)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,x,m,n;
	cin>>a>>b>>x;
	m=a/x;
	if(a%x!=0)
		m++;
	n=b/x;
	cout<<n-m+1<<endl;
	return 0;
}

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
long long a,b,x,ans,temp;
int main()
{
    cin>>a>>b>>x;
    if(a%x==0) ans=a/x;
    else	ans=a/x+1;
    temp=b/x;
    cout<<temp-ans+1;
    return 0; 
}
Problem p03957 (python)

Fixed submission:
s = input()
f = False
l = False
for i in range(len(s)):
    if s[i] == 'C':
        for j in range(i, len(s)):
            if s[j] == 'F':
                print('Yes')
                f = True
                break
        if f == False:
            print('No')
        l = True
        break
if l == False:
    print('No')

Buggy submission (verdict: Runtime Error):
at2084
n = list(input())
c = n.count('C')
f = n.count('F')
for i in range(len(n)):
    if c >= 1 and f >= 1:
        print('Yes')
    else:
        print('No')
Problem p04011 (python)

Fixed submission:
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n <= k:
    print n * x
else:
    print k * x + (n - k) * y

Buggy submission (verdict: Runtime Error):
n,k,x,y=int(input())
if n <= k:
    print n * x
else:
    print k * x + (n - k) * y
Problem p03713 (python)

Fixed submission:
h, w = map(int, input().split())
div1 = 0
div2 = 0
if h%3==0 or w%3==0:
	print("0")
else:
	div1 = min(h, w)
	def div2(h, w):
		m = h*w
		for l in range(1, w):
			s = [l*h, (w-l)*(h-h//2), (w-l)*(h//2)]
			m = min(m, max(s)-min(s))
		return m
	div2 = min(div2(h, w), div2(w, h))
	print(min(div1, div2))

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
div1 = 0,div2 = 0
if h%3==0 or w%3==0:
	print("0")
else:
	div1 = min(h, w)
	def div2(h, w):
		m = h*w
		for l in range(1, w):
			s = [l*h, (w-l)*(h-h//2), (w-l)*(h//2)]
			m = min(m, max(s)-min(s))
		return m
	div2 = min(div2(h, w), div2(w, h))
	print(min(div1, div2))
Problem p03944 (python)

Fixed submission:
w, h, n = map( int, input().split())
l = 0
r = w
d = 0
u = h
for _ in range(n):
    x, y, a = map( int, input().split())
    if a == 1:
        l = max(l,x)
    elif a == 2:
        r = min(r,x)
    elif a == 3:
        d = max(d,y)
    else:
        u = min(u,y)
if r-l <= 0 or u-d <= 0:
    print(0)
else:
    print(max(0,(r-l)*(u-d)))

Buggy submission (verdict: Runtime Error):
w, h, n = map( int, input().split())
l = 0,r = w,d = 0,u = h
for _ in range(n):
    x, y, a = map( int, input().split())
    if a == 1:
        l = max(l,x)
    elif a == 2:
        r = min(r,x)
    elif a == 3:
        d = max(d,y)
    else:
        u = min(u,y)
if r-l <= 0 or u-d <= 0:
    print(0)
else:
    print(max(0,(r-l)*(u-d)))
Problem p02691 (python)

Fixed submission:
def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    from collections import defaultdict
    count = defaultdict(int)
    ans = 0
    for i, a in enumerate(A):
        if i - a in count:
            ans += count[i-a]
        count[i+a] += 1
    print(ans)
 
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
  n=int(input())
  heights=list(map(int,input().split()))
  assert len(heights)==n
  i=0
  count=0
  while i<n:
    j=i+1
    while j<n:
      if heights[i]+heights+[j]==(j-i):
        count+=1
  print(count)
main()

Buggy submission (verdict: Runtime Error):
def main():
  n=int(input())
  heights=list(map(int,input.split()))
  assert len(heights)==n
  i=0
  count=0
  while i<n:
    j=i+1
    while j<n:
      if heights[i]+heights+[j]==(j-i):
        count+=1
  print(count)
main()