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

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))


index = 0
index2 = 0
stackedTime = 0

while(index<N and stackedTime + A[index] <= K):
  stackedTime += A[index]
  index += 1

while(index2 < M and stackedTime + B[index2] <= K):
  stackedTime += B[index2]
  index2 += 1

maxBook = index + index2
for i in range(N):
  if(index == 0 or index2 == M):
    break
  index -= 1
  stackedTime -= A[index]
  while(index2 < M and stackedTime + B[index2] <= K):
    stackedTime += B[index2]
    index2 += 1

  maxBook = max(maxBook, index + index2)

print(maxBook)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))


index = 0
index2 = 0
stackedTime = 0

while(index<N and stackedTime + A[index] <= K):
  stackedTime += A[index]
  index += 1

while(index2 < M and stackedTime + B[index2] <= K):
  stackedTime += B[index2]
  index2 += 1

maxBook = index + index2
for i in range(N):
  if(index == 0 or index2 == M):
    break
  index -= 1
  stackedTime -= A[index]
  while(index2 < M and stackedTime + B[index2] <= K):
    stackedTime += B[index]
    index2 += 1

  maxBook = max(maxBook, index + index2)

print(maxBook)
Problem p02689 (python)

Fixed submission:
n, m = map(int, input().split())
h = list(input().split())
l = [1] * n

for i in range(0, int(m)):
    a, b = map(int, input().split())
    a_int = int(h[int(a)-1])
    b_int = int(h[int(b)-1])

    if (a_int < b_int):
        l[a - 1] = 0
    
    if (a_int > b_int):
        l[b - 1] = 0
    
    if (l[a-1] == 1):
        if (a_int == b_int):
            l[a - 1] = 0
            l[b - 1] = 0
    elif (l[b-1] == 1):
        if (a_int == b_int):
            l[a - 1] = 0
            l[b - 1] = 0 
       
cnt = 0
for k in range(0, len(l)):
    if(l[k]==1):
        cnt+=1

print(cnt)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
h = list(input().split())
l = [0] * n

for i in range(0, int(m)):
    a, b = map(int, input().split())
    a_int = int(h[int(a)-1])
    b_int = int(h[int(b)-1])

    if (a_int < b_int):
        l[b_int - 1] = 1
       
cnt = 0
for k in range(0, len(l)):
    if(l[k]==1):
        cnt+=1

print(cnt)
Problem p02711 (python)

Fixed submission:
n = list(str(input()))

cnt = 0
for i in range(0, len(n)):
    if int(n[i]) == 7:
        print("Yes")
        cnt += 1
        break
if cnt == 0:
    print("No")

Buggy submission (verdict: Runtime Error):
n = list(str(input()))

cnt = 0
for i in range(0, len(n)):
    if int(s[i]) == 7:
        print("Yes")
        cnt += 1
        break
if cnt == 0:
    print("No")
Problem p02729 (python)

Fixed submission:
from math import factorial

n, m = map(int, input().split())
if n > 1 and m > 1:
    print(int(factorial(n)/factorial(2)/factorial(n-2) + factorial(m)/factorial(2)/factorial(m-2)))
elif n > 1:
    print(int(factorial(n)/factorial(2)/factorial(n-2)))
elif m > 1:
    print(int(factorial(m)/factorial(2)/factorial(m-2)))
else:
    print(0)

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

def comb(n):
    if n == 1:
        return 0
    else:
        return int(n*(n-1)/2)

n = int(input())
AS = list(map(int,input().split()))

origin = list(set(AS))
num = []
for i in origin:
    num.append(AS.count(i))
comb_list = [-1]*(max(num)+1)
all_num = 0
for i in num:
    if comb_list[i] == -1:
        all_num += comb(i)
        comb_list[i] = comb(i)
    else:
        all_num += comb_list[i]
    
for i in range(n):
    j = num[origin.index(AS[i])]
    ans = all_num - (j-1)
    print(ans)
Problem p02773 (python)

Fixed submission:
import collections

n = int(input())
s = [input() for _ in range(n)]
c_sort = collections.Counter(s).most_common()
list_most = [c_sort[i][0] for i in range(len(c_sort)) if c_sort[i][1] == c_sort[0][1]]
for i in sorted(list_most):
    print(i)

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter

input = sys.stdin.readline

n = int(input())
s = [input() for i in range(n)]

c_sort = collections.Counter(s).most_common()
list_most = [c_sort[i][0] for i in range(len(c_sort)) if c_sort[i][1] == c_sort[0][1]]
for i in list_most:
    print(i)

Buggy submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline

n = int(input())
s = [input() for i in range(n)]
dict = {}

for i in range(n):
    if s[i] not in dict:
        dict[s[i]], s.count(s[i])]

max_d_list = [d[0] for d in dict.items() if d[1] == max(dict.values())]
sorted_list = sorted(max_d_list)
for i in sorted_list:
    print(i)
Problem p02578 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans = 0
for i in range(n-1):
  s = a[i+1] -a[i] 
  if s < 0:
      ans = ans - s
      a[i+1]=a[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans = 0
for i in range(n-2):
  s = a[i+1] -a[i] 
  if s >=0:
    ans = ans +0
    else:
      ans = ans - s
      a[i+1]=a[i]-s
else:
  print(ans)
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
a, b = map(str,input().split())
c = Decimal(a)
d = Decimal(b)
e = c * d
print(int(e))

Buggy submission (verdict: Runtime Error):
import decimal
import math
a, b = map(float,input().split())
a = Decimal("a")
b = Decimal("b")
print(a*b)
Problem p02661 (python)

Fixed submission:
n = int(input())
alist = []
blist = []
for i in range(n):
    a,b = map(int,input().split())
    alist.append(a)
    blist.append(b)

N = len(alist)
alist.sort()
blist.sort()
# 偶数の場合
if N % 2 == 0:
    median1 = N/2
    median2 = N/2 + 1
    median1 = int(median1) - 1
    median2 = int(median2) - 1
    amedian = (alist[median1] + alist[median2]) / 2
    bmedian = (blist[median1] + blist[median2]) / 2
    ans = (bmedian-amedian)*2+1
# 奇数の場合
else:
    median = (N + 1) / 2
    median = int(median) - 1
    amedian = alist[median]
    bmedian = blist[median]
    ans = bmedian-amedian+1
print(int(ans))

Buggy submission (verdict: Runtime Error):

blist.sort()
# 偶数の場合
if N % 2 == 0:
    median1 = N/2
    median2 = N/2 + 1
    median1 = int(median1) - 1
    median2 = int(median2) - 1
    amedian = (alist[median1] + alist[median2]) / 2
    bmedian = (blist[median1] + blist[median2]) / 2
    print(bmedian-amedian+1)
# 奇数の場合
else:
    median = (N + 1) / 2
    median = int(median) - 1
    amedian = alist[median]
    bmedian = blist[median]
    print((bmedian-amedian)*2+1)
Problem p02699 (python)

Fixed submission:
s,w = map(int,input().split())
if s <=w:
    print("unsafe")
else:
    print("safe")

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
string_list=[input() for i in range(n)]
c = collections.Counter(string_list)
print(len(c))
Problem p02701 (python)

Fixed submission:
n = int(input())
s = [input() for _ in range(n)]
print(len(set(s)))

Buggy submission (verdict: Runtime Error):
n = int(input())
string_list=[input() for i in range(n)]
c = collections.Counter(string_list)
print(len(c))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
string_list=[input() for i in range(n)]
c = collections.Counter(string_list)
print(len(c))
Problem p02572 (python)

Fixed submission:
M = 1000000007
n = int(input())
a = list(map(int,input().split()))
S = [0]
for i in range(n):
 S.append((S[-1]+a[i])%M)
sum = 0
for i in range(n-1):
 sum += (a[i]*(S[n]-S[i+1]))%M
print(sum%M)

Buggy submission (verdict: Runtime Error):
M = 1000000007
n = int(input())
a = list(map(int,input().split()))
S = [0]
for i in range(n):
 S.append(S[-1]+a[i])%M
sum = 0
for i in range(n-1):
 sum += (a[i]*(S[n]-S[i+1]))%M
print(sum%M)
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
　a.append(a[i] + A[i])
for i in range(M):
　b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
　if a[i] > K:
　　break
　while b[j] > K - a[i]:
　　j -= 1
　ans = max(ans, i + j)
print(ans)
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e-a <= k:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e-a =< k:
  print("Yay!")
else:
  print(":(")
Problem p03107 (python)

Fixed submission:
s = input()
print(min(s.count("0"), s.count("1"))*2)

Buggy submission (verdict: Runtime Error):
s = input()
k = 0
while True:
  if "10" in s:
    i = s.index("10")
    s = list(s)
    s.pop(i)
    s.pop(i)
    s = "".join(s)
    k += 2
  elif "01" in s:
    i = s.index("10")
    s = list(s)
    s.pop(i)
    s.pop(i)
    s = "".join(s)
    k += 2
  else:
    print(k)
    break
Problem p03127 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
def gcd(a,b):
  c = a%b
  if c == 0:
    return b
  else:
    return gcd(b,c)
c = 0
for i in a[1:]:
  c_ = gcd(i,a[0])
  if c_ == 1:
    c = 1
    break
  else:
    if c_ < c or c == 0:
      c = c_
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
def gcd(a,b):
  c = a%b
  if c == 0:
    return b
  0else:
    return gcd(b,c)
c = 0
for i in a[1:]:
  c_ = gcd(i,a[0])
  if c_ == 1:
    c = 1
    break
  else:
    if c_ < c or c == 0:
      c = c_
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
def gcd(a,b):
  c = a%b
  if c == 1:
    return b
  else:
    return gcd(b,c)
c = 0
for i in a[1:]:
  c_ = gcd(i,a[0])
  if c_ == 1:
    c = 1
    break
  else:
    if c_ < c:
      c = c_
print(c)
Problem p03242 (python)

Fixed submission:
n = input()
n = n.replace("1","a")
n = n.replace("9","1")
n = n.replace("a","9")
print(n)

Buggy submission (verdict: Runtime Error):
n = input()
n = n.replace("1","a")
n = n.replace("9","1")
n = n.replace("a,"9")
print(n)
Problem p03250 (python)

Fixed submission:
abc = list(map(int, input().split()))
abc = sorted(abc)
print(abc[2]*10+abc[1]+abc[0])

Buggy submission (verdict: Runtime Error):
abc = list(map(int, input().split()))
abc = sort(abc)
abc = abc[:,:,-1]
print(abc[0]*10+abc[1]+abc[2])
Problem p02712 (python)

Fixed submission:
n = int(input())

sum = 0
for i in range(1, n+1):
    if not(i%3==0 or i%5==0):
        sum += i
print(sum)

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

for i in range(1, n+1):
    if i%3==0 or i%5==0:
        sum += i
print(sum)
Problem p02754 (python)

Fixed submission:
n, a, b = input().split()
n = int(n)
a = int(a)
b = int(b)
 
d = n // (a + b)
m = n % (a + b)
 
blue = a * d
if m >= a:
  blue = blue + a
else:
  blue = blue + m
  
print(blue)

Buggy submission (verdict: Runtime Error):
n, a, b = input().split()
 
d = n // (a + b)
m = n % (a + b)
 
blue = a * d
if m >= a:
  blue = blue + a
else:
  blue = blue + m
  
print(blue)

Buggy submission (verdict: Runtime Error):
import math

n, a, b = input().split()

d = n // (a + b)
m = n % (a + b)

blue = a * k
if m >= a:
  blue = blue + a
else:
  blue = blue + m
  
print(blue)
Problem p02595 (python)

Fixed submission:
import math
a = list(map(int,input().split()))
xy = [map(int, input().split()) for _ in range(a[0])]
x, y = [list(i) for i in zip(*xy)]


def caldis(x, y):
    l = math.sqrt(x ** 2 + y ** 2)
    return l

ans = 0

i = 0
for i in range(a[0]):

    if caldis(x[i], y[i]) <= a[1]:
        ans += 1
    i += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = []
n = int(input().split())

def caldis(x, y):
    l = math.sqrt(x ** 2 + y ** 2)
    return l

ans = 0


for i in n[0]:
    input_num = []
    input_num = int(input().split())

    if caldis(input_num[0], input_num[1]) <= n[1]:
        ans += 1

print(ans)
Problem p02897 (python)

Fixed submission:
n=int(input())
if n%2==0:
	print((n//2)/n)

else:
	print((n//2+1)/n)

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input())
a=np.sort(np.array(input().split(" "),dtype="int32"))
a_=list(a[:])
for i in a:
	print(a_.index(i)+1,end=" ")
Problem p03804 (python)

Fixed submission:
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

for i in a:
    for j in b:
        if j not in i:
            print("No")
            quit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
b=[]
for i in range(n):
	a.append(input())
for i in range(m):
	b.append(input())

check = False
for i in range(n):

	if b[0]in a[i]:
		index=a[i].index(b[0])
		check=True
		for k in range(m):
			if i+k>n:
				check=False
				break

			if not b[k]in a[i+k] or a[i+k].index(b[k])!=index:
				check=False
				break

	if check:
		break

print("Yes" if check else "No")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
b=[]
for i in range(n):
	a.append(input())
for i in range(m):
	b.append(input())

check = False
for i in range(n):

	if b[0]in a[i]:
		index=a[i].index(b[0])
		check=True
		for k in range(m):
			if i+k>=n:
				check=False
				break

			if a[i+k].index(b[k])!=index or not b[k]in a[i+k] :

				check=False
				break
	if check:
		break

print("Yes" if check else "No")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
b=[]
for i in range(n):
	a.append(input())
for i in range(m):
	b.append(input())

check = False
for i in range(n):
	if b[0]in a[i]:
		index=a[i].index(b[0])
		check=True
		for k in range(m):
			if i+k>=n:
				break
			if not b[k]in a[i+k] and a[i+k].index(b[k])!=index:
				check=False
				break
	if check:
		break

print("Yes" if check else "No")
Problem p02627 (python)

Fixed submission:
x = str(input())
if x.isupper() == True:
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
import bisect

N = int(input())
A = list(map(int,input().split()))

Q = int(input())

A.sort()
B = list(set(A))
X = [[0 for j in range(2)] for i in range(len(B))]
for i in range(len(B)):
  b=bisect.bisect_left(A,B[i])
  c=bisect.bisect_right(A,B[i])
  num = c - b #B[i]の要素数
  X[i][0] = B[i]
  X[i][1] = num

M = [0 for j in range(Q)]
N = [0 for j in range(Q)]
for i in range(Q):
  M[i],N[i] = map(int,input().split())
B_len = len(B)
ans = int()
for i in range(Q):
  x = M[i]
  y = N[i]
  ans = 0
  jg = False
  for j in range(B_len):
    if X[j][0] == y:
      jg = True
      jgx = j
  for j in range(B_len):
    if X[j][0] == x:
      X[j][0] = y
      if jg == True:
        X[j][1] += X[jgx][1]
        X[jgx][0] = 0
        B_len = B_len-1
    ans += X[j][0] * X[j][1]
  print(ans)
  #print(X)

Buggy submission (verdict: Runtime Error):
import bisect

N = int(input())
A = list(map(int,input().split()))

Q = int(input())

A.sort()
B = list(set(A))
X = [[0 for j in range(2)] for i in range(len(B))]
for i in range(len(B)):
  b=bisect.bisect_left(A,B[i])
  c=bisect.bisect_right(A,B[i])
  num = c - b #B[i]の要素数
  X[i][0] = B[i]
  X[i][1] = num

M = [0 for j in range(Q)]
N = [0 for j in range(Q)]
for i in range(Q):
  M[i],N[i] = map(int,input().split())

ans = int()
for i in range(Q):
  x = M[i]
  y = N[i]
  ans = 0
  jg = False
  for j in range(len(B)):
    if X[j][0] == y:
      jg = True
      jgx = j
  for j in range(len(B)):
    if X[j][0] == x:
      X[j][0] = y
      if jg == True:
        X[j][1] += X[jgx][1]
        X[jgx][0] = 0
    ans += X[j][0] * X[j][1]
  print(ans)
  #print(X)
Problem p02682 (python)

Fixed submission:
A, B, C, K = list(map(int,input().split()))

if K <= A:
	max = K
elif A < K and K <= A+B:
	max = A
else:
	max = A-(K-(A+B))
	
print(max)

Buggy submission (verdict: Runtime Error):
A, B, C, K = list(map(int,input().split()))

if K <= A:
	max = K
elif A < K and K <= A+B
	max = A
else:
	max = A-(K-(A+B))
	
print(max)
Problem p02689 (python)

Fixed submission:

N, M = map(int,input().split())

H = [0] + list(map(int,input().split()))

path = [0]
for i in range(1,N+1):
	path.append([])

for i in range(1,M+1):
	A, B = map(int,input().split())
	path[A].append(B)
	path[B].append(A)

count = 0

for i in range(1,N+1):
	if len(path[i]) == 0:
		count += 1
	elif H[i] > max(H[j] for j in path[i]):
		count += 1
	
print(count)

Buggy submission (verdict: Runtime Error):

N, M = map(int,input().split())

H = [0] + list(map(int,input().split()))

path = [0]
for i in range(1,N+1):
	path.append([])

for i in range(1,M+1):
	A, B = map(int,input().split())
	path[A].append(B)
	path[B].append(A)

count = 0

for i in range(1,N+1):
	if H[i] > max(H[j] for j in path[i]):
		count += 1
	
print(count)

Buggy submission (verdict: Runtime Error):

N, M = map(int,input().split())]

H = [0] + list(map(int,input().split()))

path = {}
for i in range(1,N+1):
	path[i] = {}

for i in range(1,M+1):
	A, B = map(int,input().split())
	path[A].add(B)
	path[B].add(A)

count = 0

for i in range(1,N+1)
	if H[i] > max(H[j] for j in path[i]):
		count += 1
	
print(count)
Problem p02699 (python)

Fixed submission:
S = list(map(int,input().split()))
 
if S[1] >= S[0]:
 print('unsafe')
else:
 print('safe')

Buggy submission (verdict: Runtime Error):
S = int(input())
W = int(input())

if W >= S:
 print('unsafe')
else:
 print('safe')
Problem p02712 (python)

Fixed submission:
n = int(input())
sum = 0
for i in range(1,n+1):
  if i % 3 == 0 or i % 5 == 0:
    continue
  else: 
    sum += i
print(sum)

Buggy submission (verdict: Runtime Error):
n = input()
sum = 0
for i in range(1,n+1):
  if i % 3 == 0 or i % 5 == 0:
    continue
  else: 
    sum += i
print(sum)
Problem p02629 (python)

Fixed submission:
import string

n = int(input())
f = []

if n > 26:
	while n:
		n -= 1
		n, r = divmod(n, 26)
		f += [r]
else:
	f += [n-1]

g = ''
s = string. ascii_lowercase
f.reverse()
for i in f:
	g += s[i]

print(g)

Buggy submission (verdict: Runtime Error):
n = int(input())
f = []

if n > 26:
	while n:
		n -= 1
		n, r = divmod(n, 26)
		f += [r]
else:
	f += [n]

g = ''
s = string. ascii_lowercase
f.reverse()
for i in f:
	g += s[i]

print(g)
Problem p02682 (python)

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

Buggy submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
s = min(c, k)
k -= s
if k == 0:
	print(s)
else:
	d = min(k, b)
	k -= d:
	if k == 0:
		print(s)
	else:
		f = min(k, a)
		s -= f
		print(s)
Problem p02695 (python)

Fixed submission:
from itertools import combinations_with_replacement as c 
n, m, q = map(int, input().split()) 
arr = [] 
for i in range(q): 
    l = [*map(int, input().split())] 
    arr.append(l) 
res = 0
for g in c(list(range(1, m+1)), n): 
    f = 0 
    for h in arr:
        if g[h[1]-1] - g[h[0]-1] == h[2]: 
            f += h[3]
    res = max(res, f) 
print(res)

Buggy submission (verdict: Runtime Error):
from itertools import combinations as c
n, m, q = map(int, input().split())
arr = []
for i in range(q):
  l = [*map(int, input().split())]
  arr.append(l)
res = 0
for g in c(list(range(1, m+1)), n):
  f = 0
  for h in arr:
    if g[1] - g[0] == g[2]:
      f += g[3]
  res = max(res, f)
print(res)
Problem p02834 (python)

Fixed submission:
from collections import defaultdict as d
from collections import deque

def bfs(adj, start, n):
	visited = [0] * (n + 1)
	tab = [0] * n
	q = deque([start])
	visited[start] = 1
	while q:
		s = q.popleft()
		for i in adj[s]:
			if visited[i] == 0:
				q.append(i)
				visited[i] = 1
				tab[i - 1] = tab[s - 1] + 1
	return tab

n, u, v = map(int, input().split())
adj = d(list)
for i in range(n - 1):
	a, b = map(int, input().split())
	adj[a].append(b)
	adj[b].append(a)

takahashi = bfs(adj, u, n)
aoki = bfs(adj, v, n)
res = -1
for i in range(n):
	if takahashi[i] <= aoki[i]:
		res = max(res, aoki[i] - 1)

print(res)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict as d

def dfs(adj, visited, count, tab, start):
	visited[start-1] = 1
	for v in adj[start]:
		if not visited[v-1]:
			tab[v-1] += count
			dfs(adj, visited, count+1, tab, v)
	return tab		

n, u, v = map(int, input().split())
adj = d(list)
for i in range(n-1):
	a, b = map(int, input().split())
	adj[a].append(b)
	adj[b].append(a)
	
takahashi = dfs(adj, [0] * n, 1, [0] * n, u)
aoki = dfs(adj, [0] * n, 1, [0] * n, v)

res = -1
for i in range(n):
	if takahashi[i] <= aoki[i]:
		res = max(res, aoki[i] - 1)

print(res)
Problem p02711 (python)

Fixed submission:
print("Yes" if("7"in input())else"No")

Buggy submission (verdict: Runtime Error):
N = int(input())
print(N*(N-1)//2-(3*(N//3)*(N//3-1)+5*(N//5)*(N//5-python
                                              p1))//2+15*(N//15)*(N//15-1)//2)

Buggy submission (verdict: Runtime Error):
N = input()
print(N*(N-1)//2-(3*(N//3)+5*(N//5))+15*(N//15))
Problem p02725 (python)

Fixed submission:
length, num = map(int, input().split())
dist=[int(i) for i in input().split()]

Max=0
for i in range(num-1):
    Max = max([dist[i+1]-dist[i],Max])

Max=max(Max,length-dist[-1]+dist[0])
print(length-Max)

Buggy submission (verdict: Runtime Error):
length, num = map(int, input().split())
dist=[int(i) for i in input().split()]

Max=0
for i in range(num):
    Max = max([abs(dist[(i+1)%num]-dist[i]),Max])

print(length-Max)
input()
Problem p02753 (python)

Fixed submission:
S=input()
if("AAA"==S or S=="BBB"):
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
min_a=12.5*A;max_a=(100a+1)/8
min_b=10*b;max_b=min_b+1
if(max_b<min_a or max_a<min_b):
  print(-1)
else:
  print(int(round(max(min_a,min_b)+0.4999999,0)))

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
min_a=12.5*A;max_a=(100a+1)/8
min_b=10*B;max_b=min_b+1
if(max_b<min_a or max_a<min_b):
  print(-1)
else:
  print(int(round(max(12.5*A,10*B)+0.4999999,0)))

Buggy submission (verdict: Runtime Error):
S,A,B=map(int,input().split())
print((S//(A+B))*A+min(A,S%(A+B)))

Buggy submission (verdict: Runtime Error):
S=input()
if(("A"in S and "B"in S):
  print("Yes")
else:
  print("No")
Problem p02860 (python)

Fixed submission:
a=int(input())
b=list(input())
count=0
if(a%2==0):
    a=int(a/2)
    for i in range(a):
        if(b[i]==b[i+a]):
          count+=1
    if(count==a):
        print('Yes')
    else:
        print('No')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a=int(input())
b=list(input())
count=0
if(a%2==1):
  print('No')
else:
  for i in range(a/2):
    if(b[i]==b[i+a/2]):
      count+=1
  if(count==a/2):
    print('Yes')
  else:
    print('No')
Problem p02711 (python)

Fixed submission:
N = input()

print('Yes' if '7' in str(N) else 'No')

Buggy submission (verdict: Runtime Error):
inp = input()
if inp.contains('7'):
  print("Yes")
 else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = input()

print('Yes' if '7' in str(N) else 'No'