Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,k = readInts()
pos = set()
for _ in range(k):
	l,r = readInts()
	for i in range(l,r+1):
		pos.add(i)

pos = sorted(list(pos))

dp = [-1]*(n+1)
dp[n]=1
ans = 0
for i in range(n-1,0,-1):
	t = 0
	for j in pos:
		if n-i>=j:
			t+=dp[i+j]
		else:
			break
	dp[i]=t%998244353

print(dp[1])

Fixed submission:
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,k = readInts()
lr = [readInts() for i in range(k)]

dp = [-1]*(n+2)
dp[n]=1
dp[n+1]=0
i=n
ruiseki = [0]*(k)
for j in range(k):
	ruiseki[j] = dp[min(i+lr[j][0],n+1)]-dp[min(i+lr[j][1],n+1)]
#print(ruiseki)
ans = 0
for i in range(n-1,0,-1):
	t = 0
	for j in range(k):
		ll = dp[min(i+lr[j][0],n+1)]
		rr = dp[min(i+lr[j][1]+1,n+1)]
		#print(ll,rr)
		ruiseki[j] += ll-rr
	t+=sum(ruiseki)
	dp[i]=t%998244353
	#print(i,ruiseki,dp)

print(dp[1])
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
data = []
for i in range(n):
	x,y = readInts()
	data.append([x+y,x,y])

data.sort(key=lambda x:x[0])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[1])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[2])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
print(ans)

Fixed submission:
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
data = []
for i in range(n):
	x,y = readInts()
	data.append([x+y,x,y,x-y])
ans = 0
data.sort(key=lambda x:x[0])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[1])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[2])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[3])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
data = [readInts() for i in range(n)]
xy = {}
for x,y in data:
	if x in xy:
		xy[x].append(y)
	else:
		xy[x] = [y]
for x in xy:
	xy[x].sort()

#print(xy)
ans = 0
for x1,y1 in data:
	for x2 in xy:
		ans = max(ans, abs(x1-x2)+abs(y1-xy[x2][0]),abs(x1-x2)+abs(y1-xy[x2][-1]))

print(ans)

Fixed submission:
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
data = []
for i in range(n):
	x,y = readInts()
	data.append([x+y,x,y,x-y])
ans = 0
data.sort(key=lambda x:x[0])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[1])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[2])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[3])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

h,w = readInts()
ch,cw = readInts()
dh,dw = readInts()
s = ["#"*(w+2)]+["#"+input()+"#" for i in range(h)]+["#"*(w+2)]
visited = [[-2]*(w+2) for i in range(h+2)]
for i in range(h+2):
	for j in range(w+2):
		if s[i][j]==".":
			visited[i][j] = -1

delta1 = [[0,1],[1,0],[-1,0],[0,-1]]

q = {(ch,cw)}
set_list = set()
cost = 0
while 1:
	if len(q)==0:
		break
	while len(q) !=0:
		x,y = q.pop()
		set_list.add((x,y))
		visited[x][y] = cost
		for dx,dy in delta1:
			x2 = x+dx
			y2 = y+dy
			if visited[x2][y2]==-1:
				q.add((x2,y2))
	cost+=1
	while len(set_list) != 0:
		x,y = set_list.pop()
		for dx in range(-2,3):
			for dy in range(-2,3):
				x2 = x+dx
				y2 = y+dy
				if visited[min(x2,h+1)][min(y2,w+1)]!=-1: continue
				q.add((x2,y2))

print(visited[dh][dw])

Fixed submission:
from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

def p(arr):
	print("_______________________")
	for i in arr:
		for j in i:
			print(j,end=" ")
		print()

h,w = readInts()
ch,cw = readInts()
dh,dw = readInts()
s = [["#" for i in range(w+2)]]+[["#"]+ list(input())+["#"] for i in range(h)]+[["#" for i in range(w+2)]]

q = deque()
visited = [[-1]*(w+2) for i in range(h+2)]
count = (w+2)*(h+2)
for i in range(h+2):
	for j in range(w+2):
		if s[i][j]=="#":
			visited[i][j] = float("inf")
			count -= 1

from pprint import pprint
visited[ch][cw] = 0

q = {(ch,cw)}
set_list = set()
cost = 0
while count:
	while len(q) !=0:
		x,y = q.pop()
		set_list.add((x,y))
		visited[x][y] = cost
		count-=1
		if s[x-1][y]=="." and visited[x-1][y]==-1:
			q.add((x-1,y))
		if s[x][y-1]=="." and visited[x][y-1]==-1:
			q.add((x,y-1))
		if s[x+1][y]=="." and visited[x+1][y]==-1:
			q.add((x+1,y))
		if s[x][y+1]=="." and visited[x][y+1]==-1:
			q.add((x,y+1))

	if len(set_list)==0:
		break

	cost+=1
	while len(set_list) != 0:
		x,y = set_list.pop()
		for dx in range(-2,3):
			for dy in range(-2,3):
				x2 = x+dx
				y2 = y+dy
				if visited[min(x2,h+1)][min(y2,w+1)]!=-1: continue
				q.add((x2,y2))

print(visited[dh][dw])
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,k = readInts()
a = readInts()

a.sort(reverse=True)

def nibu(left,right):
	l = (right-left)//2+left
	ans = 0
	for i in a:
		ans+=math.floor(i/l)
	#print(l, ans, left, right)

	if left<right-1:
		if ans<=k:
			return nibu(left,right-(right-l))
		else:
			return nibu(left+(l-left), right)
	else:
		return left


print(nibu(0,a[0])+1)


Fixed submission:
from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,k = readInts()
a = readInts()

a.sort(reverse=True)

if n==1:
	print(math.ceil(a[0]/(k+1)))
	exit()

def get(left, right):
	l = (right-left)//2+left
	ans = 0
	for i in a:
		ans+=math.ceil(i/l)-1
	#print(l, ans, left, right)
	return ans,l

def nibu(left,right):
	ans,l = get(left, right)

	if left<right:
		if ans<=k:
			return nibu(left,l)
		else:
			return nibu(l+1, right)
	else:
		return right


print(nibu(1,a[0]))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,k = readInts()
a = readInts()

base = 1
for i in range(k):
	base*=a[i]
t = base
#print(t)
base = base//a[0]

for i in range(k,n):
	base*=a[i]
	#print(base)
	if t>=base:
		print("No")
	else:
		print("Yes")
	t = base
	base=base//a[i-k+1]


Fixed submission:
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,k = readInts()
a = readInts()


t = a[0]

for i in range(k,n):
	be = a[i-k]
	af = a[i]
	#print(base)
	if be>=af:
		print("No")
	else:
		print("Yes")

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,k = readInts()
a = readInts()

base = 1
for i in range(k):
	base*=a[i]
t = base
#print(t)
base = base//a[0]

for i in range(k,n):
	base*=a[i]
	#print(base)
	if t>=base:
		print("No")
	else:
		print("Yes")
	t = base
	base=base//a[i-k+1]


Fixed submission:
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,k = readInts()
a = readInts()


t = a[0]

for i in range(k,n):
	be = a[i-k]
	af = a[i]
	#print(base)
	if be>=af:
		print("No")
	else:
		print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
import math

def readInt():
	return int(input())
 
def readInts():
	return list(map(int, input().split()))
 
def readChars():
	return input().split()

a,b,n = readInts()
res = -1000

for x in range(min(b,n)+1):
	y = (a*x)//b-a*(x//b)
	#print(y)
	if y>res:
		res = y

print(res)


Fixed submission:
import math

def readInt():
	return int(input())
 
def readInts():
	return list(map(int, input().split()))
 
def readChars():
	return input().split()

a,b,n = readInts()

x = min(b-1,n)

print(x*a//b)
Buggy python submission (verdict: Runtime Error):
n,k,s=list(map(int,input().split())),0
for i in range(k,n+2):
	s+=i*(n+n-(i-1))//2+1-(i*(i-1))//2
print(s%(1000000007))

Fixed submission:
import math
import queue

def readInt():
	return int(input())

def readInts():
	return list(map(int, input().split()))

def readChars():
	return input().split()



x = readInts()
n = x[0]
k = x[1]

def ts(l):
	return int((l*(l-1))/2)

def ts2(l):
	return int(l*(n+n-(l-1))/2)


#for i in range(k,n):
#	for j in range(0,n-i+1):
#iは個数

#a = range(0+1,n+n-1 +1) #2
#b = range(0+1+2,n+n-1+n-2 +1) #3

s = 0

for i in range(k,n+2):
	#x = range(ts(i),ts2(i)+1)
	#print(ts2(i)+1-ts(i))
	#print(x)
	s += ts2(i)+1-ts(i)

print(s%(1000000007))

Buggy python submission (verdict: Runtime Error):
n,k,s=input(),input(),0
for i in range(k,n+2):
	s+=i*(n+n-(i-1))//2+1-(i*(i-1))//2
print(s%(1000000007))

Fixed submission:
import math
import queue

def readInt():
	return int(input())

def readInts():
	return list(map(int, input().split()))

def readChars():
	return input().split()



x = readInts()
n = x[0]
k = x[1]

def ts(l):
	return int((l*(l-1))/2)

def ts2(l):
	return int(l*(n+n-(l-1))/2)


#for i in range(k,n):
#	for j in range(0,n-i+1):
#iは個数

#a = range(0+1,n+n-1 +1) #2
#b = range(0+1+2,n+n-1+n-2 +1) #3

s = 0

for i in range(k,n+2):
	#x = range(ts(i),ts2(i)+1)
	#print(ts2(i)+1-ts(i))
	#print(x)
	s += ts2(i)+1-ts(i)

print(s%(1000000007))

Buggy python submission (verdict: Runtime Error):
n,k=list(map(int,input().split()))
for i in range(k,n+2):
	s+=i*(n+n-(i-1))//2+1-(i*(i-1))//2
print(s%(1000000007))

Fixed submission:
import math
import queue

def readInt():
	return int(input())

def readInts():
	return list(map(int, input().split()))

def readChars():
	return input().split()



x = readInts()
n = x[0]
k = x[1]

def ts(l):
	return int((l*(l-1))/2)

def ts2(l):
	return int(l*(n+n-(l-1))/2)


#for i in range(k,n):
#	for j in range(0,n-i+1):
#iは個数

#a = range(0+1,n+n-1 +1) #2
#b = range(0+1+2,n+n-1+n-2 +1) #3

s = 0

for i in range(k,n+2):
	#x = range(ts(i),ts2(i)+1)
	#print(ts2(i)+1-ts(i))
	#print(x)
	s += ts2(i)+1-ts(i)

print(s%(1000000007))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,x,y = readInts()

d = defaultdict(int)

for i in range(1,n+1):
	for j in range(1,n+1):
		d[min(abs(i-j),abs(i-x)+1+abs(y-j),abs(i-y)+1+abs(j-x))]+=1

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

Fixed submission:
from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,x,y = readInts()

d = defaultdict(int)

for i in range(1,n+1):
	for j in range(1,n+1):
		d[min(abs(i-j),abs(i-x)+1+abs(y-j),abs(i-y)+1+abs(j-x))]+=1

for i in range(1,n):
	print(d[i]//2)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import queue
from collections import defaultdict
 
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def printQueue(q):
	r=q
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)

n = readInt()
a = readInts()

d = defaultdict(int)

ans = 0

for i in a:
	d[i]+=1

for k in range(0,n):
	e = d.copy()
	e[a[k]]-=1
	ans = 0
	for j in e:
		ans+=comb(e[j],2)
	print(ans)

Fixed submission:
import math
import queue
from collections import defaultdict
 
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def printQueue(q):
	r=q
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)

n = readInt()
a = readInts()

d = defaultdict(int)

ans = 0

for i in a:
	d[i]+=1

maxv = 0
for i in d:
	maxv+=comb(d[i],2)

for k in range(0,n):
	b = d[a[k]]
	delta = comb(b,2)-comb(b-1,2)
	ans = maxv-delta
	print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

data  = input().split()

for m in range(n):
    data[m] = int(data[m])

res = []

for i in range(1,n+1):
    for m in range(len(data)):
        if i == data[m]:
            res.append(m+1)
res = map(str, res)

print(' '.join(res))

Fixed submission:
n = int(input())

data  = list(map(int, input().split()))

res = [0]*n

rest = ""

for i in range(0,n):
    res[(n-data[i])*-1-1] = i+1

res = map(str, res)

print(' '.join(res))
Buggy python submission (verdict: Runtime Error):
n = int(input())
print(round(format((n)*(n-1)/2,"f")))

Fixed submission:
x = list(input())
y = list(input())
i = 0
for n in range(3):
	if x[n] == y[n]:
		i += 1

print(i)

Buggy python submission (verdict: Runtime Error):
x = input().split("")
y = input().split("")
i = 0
for n in range(3):
	if x[n] == y[n]:
		i += 1

print(i)

Fixed submission:
x = list(input())
y = list(input())
i = 0
for n in range(3):
	if x[n] == y[n]:
		i += 1

print(i)
Buggy python submission (verdict: Runtime Error):
a,b = map(int. input().split())
print((b-0.1)//a+1)

Fixed submission:
x = input().split(" ")
a = int(x[0])
b = int(x[1])

c = 0
while True:
	if 1-c+a*c >= b:
		print(c)
		break
	c += 1
Buggy python submission (verdict: Runtime Error):
n = int(input())
print(round(format((n)*(n-1)/2,"f")))

Fixed submission:
from collections import defaultdict
import bisect

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()


n = readInt()
print(n*(n-1)//2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
print(format((n)*(n-1)/2,f))

Fixed submission:
from collections import defaultdict
import bisect

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()


n = readInt()
print(n*(n-1)//2)

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

print((n-1)(n-2)/2)

Fixed submission:
from collections import defaultdict
import bisect

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()


n = readInt()
print(n*(n-1)//2)
Buggy python submission (verdict: Runtime Error):
x = int(input())
print(a*x*x)

Fixed submission:
x = int(input())
print(3*x*x)

Buggy python submission (verdict: Runtime Error):
x = input()
print(a*x*x)

Fixed submission:
x = int(input())
print(3*x*x)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()

d = Counter(readInts())

d = [i for i in sorted(d.items(), reverse=True) if i[1]>=2]

if len(d)==0:
	print(0)
	exit()
elif len(d)==1:
	if d[0][1]>=4:
		pass
	else:
		print(0)
		exit()
if d[0][1]>=4:
	print(int(d[0][0])**2)
else:
	print(int(d[0][0])*int(d[1][0]))


Fixed submission:
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

w,h,x,y = readInts()

if x==w/2 and y==h/2:
	d = 1
else:
	d = 0

print(w*h/2,d)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,a,b,c,d = readInts()
s = readChar()
if (a-b)*(c-d)<0:
	if "..." in s[max(a,b)-1:] and "##" not in s[min(a,b)]:
		print("Yes")
	else:
		print("No")
elif c<b:
	if "##" not in s[a:c] and "##" not in s[b:d]:
		print("Yes")
	else:
		print("No")
else:
	if "##" not in s[min(a,b):]:
		print("Yes")
	else:
		print("No")
	raise Exception

Fixed submission:
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n,a,b,c,d = readInts()
a-=1
b-=1
c-=1
d-=1
s = readChar()
if (a-b)*(c-d)<0:
  if "..." in s[b-1:d+2] and "##" not in s[a:c]:
    print("Yes")
  else:
    print("No")
else:
  if "##" not in s[a:d+1]:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
data = list(map(lambda x: int(x),input().split(" ")))

cardNum = []

for n in range(data[1]):
	cardNum.append(list(map(lambda x: int(x),input().split(" "))))


card = [0]*(data[0])

check = [0,1000000]

for n in range(data[1]):
	if check[0] < cardNum[n][0]:
		check[0] = cardNum[n][0]
	if check[1] > cardNum[n][1]:
		check[1] = cardNum[n][1]

print(check[1]-check[0]+1)

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

if x[0] >= 13:
	print(x[1])
elif x[0] >= 6:
	print(int(x[1]/2))
else:
	print(0)
Buggy python submission (verdict: Time Limit Exceeded):
data = list(map(lambda x: int(x),input().split(" ")))

cardNum = []

for n in range(data[1]):
	cardNum.append(list(map(lambda x: int(x),input().split(" "))))

#print(cardNum)

card = [0]*(data[0]+1)

for n in range(data[1]):
	for m in range(cardNum[n][0],cardNum[n][1]+1):
		card[m] += 1

print(card.count(data[1]))

Fixed submission:
data = list(map(lambda x: int(x),input().split(" ")))

cardNum = []

for n in range(data[1]):
	cardNum.append(list(map(lambda x: int(x),input().split(" "))))


card = [0]*(data[0])

check = [0,1000000]

for n in range(data[1]):
	if check[0] < cardNum[n][0]:
		check[0] = cardNum[n][0]
	if check[1] > cardNum[n][1]:
		check[1] = cardNum[n][1]

if check[1]-check[0] < 0:
	print(0)
else:
	print(check[1]-check[0]+1)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
from collections import deque
import itertools
import copy

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

R,G,B,n = readInts()
ans = 0
for r in range(n//R+2):
	for g in range(n//G+2):
		t = n-(r*R+g*G)
		if t%B==0 and t>=0:
			ans+=1

print(ans)

Fixed submission:
from collections import defaultdict
from collections import deque
import itertools
import copy

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

R,G,B,n = readInts()
ans = 0
for r in range(n//R+2):
	for g in range(n//G+2):
		t = n-(r*R+g*G)
		if t%B==0 and t>=0:
			ans+=1

print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

k,a,b = readInts()

if a+1<=k and a+2<b:
	k-=a+1
	ans+=k//2*(b-a)+k%2+b
else:
	ans = k+1

print(ans)

Fixed submission:
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

k,a,b = readInts()

if a+1<=k and a+2<b:
	k-=a+1
	ans=k//2*(b-a)+k%2+b
else:
	ans = k+1

print(ans)