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

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

best = 0
a_time = 0
b_time = sum(B)
b_i = len(B)-1
end_flag = False
for a_i in range(N+1):
    a_time += A[a_i]
    while a_time + b_time > K:
        if b_i == 0:
            end_flag = True
            break
        b_time -= B[b_i]
        b_i -= 1

    if end_flag == True:
        break
    if a_i + b_i > best:
        best = a_i + b_i

print(best)

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

sum_A = sum(A)
sum_B = sum(B)
if sum_A > K: # 時間を超過する場合
    tmp_cnt = 0
    for i,a in enumerate(A):
        tmp_cnt += a
        if tmp_cnt > K:
            break
    A_n_max = i
else: #時間を超過しない場合
    A_n_max = len(A)
    
cnt = 0
best_cnt = 0
b_start=0
A_t = A[:A_n_max].sum()
B_t = 0
b_j = 0
for a_sub_i in range(A_n_max):
    cnt = A_n_max - a_sub_i
    time_left = K - A_t
   # print(a_sub_i)
   # print(time_left)
    while ((time_left - B_t) > 0) :
        if b_j == len(B):
            b_j += 1
            break
        B_t += B[b_j]
        b_j += 1
            
            
    A_t -= A[A_n_max -1 - a_sub_i]
    cnt = A_n_max - a_sub_i + b_j -1
    if cnt > best_cnt:
        best_cnt = cnt
    
        
print(best_cnt)
Problem p02570 (python)

Fixed submission:
d,t,s=map(int,input().split())
if d/s<=t :
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
d,t,s=input().split()
if d/s<t :
    print("Yes")
else:
    print("No")
Problem p02571 (python)

Fixed submission:
S = input().strip()	 # novel
T = input().strip()  # substring

x = len(T)
ans = len(S)
for i in range(len(S) - x + 1):
  U = S[i:i+x]
  cost = sum(1 if U[k] != T[k] else 0 for k in range(x))
  ans = min(ans, cost)
print(ans)

Buggy submission (verdict: Runtime Error):
S = input().strip()	 # novel
T = input().strip()  # substring

x = len(T)
ans = len(S)
for i in range(len(S) - x):
  U = S[i:i+x]
  cost = sum(1 if U[k] != T[k] for k in range(x))
  ans = min(ans, cost)
print(ans)
Problem p02572 (python)

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

MOD = 10**9 + 7

sum_a = sum(A)
sum_squares = sum([a*a for a in A])

ans = (sum_a**2 - sum_squares)//2
ans %= MOD

print(ans)

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

MOD = 10**9 + 7

total = 0
for i in range(N):
  for j in range(i+1, N):
    total += A[i] * A[j]

print(total % MOD)
Problem p02578 (python)

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

c = 0
for i in range(1, N):
  if A[i-1] > A[i]:
    c += A[i-1] - A[i]
    A[i] = A[i-1]
  
  
print(c)

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

c = 0
for i in range(1, N):
  if A[i-1] > A[i]:
  	c += A[i-1] - A[i]
    A[i] = A[i-1]
  
  
print(c)
Problem p02595 (python)

Fixed submission:
N, D = map(int, input().split(' '))

# pts = [tuple(map(int, input())) for _ in range(N)]

ans = 0
for _ in range(N):
  x, y = map(int, input().split(' '))
  if x**2 + y**2 <= D**2:
    ans+=1
    
print(ans)

Buggy submission (verdict: Runtime Error):
N, D = map(int, input())

# pts = [tuple(map(int, input())) for _ in range(N)]

ans = 0
if _ in range(N):
  x, y = map(int, input())
  if x**2 + y**2 <= D**2:
    ans+=1
    
print(ans)
Problem p02596 (python)

Fixed submission:
def gcd(a, b):
  if a < b:
    return gcd(b, a)
  if b == 0:
    return a
  return gcd(b, a%b)

K = int(input())

if gcd(K, 10) != 1:
  print(-1)
else:
  if K % 7 == 0:
    K//=7
  ans = 1
  cur = 1
  while cur % K != 0:
    cur += pow(10, ans, K)
    ans += 1
  print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
  if a < b:
    return gcd(b, a)
  if b == 0:
    return a
  return gcd(b, a%b)

K = int(input())

if gcd(K, 10) != 1:
  print(-1)
else:
  if K % 7 == 0:
    K/=7
  ans = 1
  cur = 1
  while cur % K != 0:
    cur += pow(10, ans, K)
    ans += 1
  print(ans)
Problem p02879 (python)

Fixed submission:
A, B = map(int, raw_input().split())

print A*B if A <= 9 and B <= 9 else -1

Buggy submission (verdict: Runtime Error):
A, B = map(int, raw_input().split())

return A*B if A <= 9 and B <= 9 else -1
Problem p02880 (python)

Fixed submission:
N = int(raw_input())

found = False
for i in xrange(1, 10):	
  for j in xrange(1, 10):
    if i*j == N:
      found = True
      
print "Yes" if found else "No"

Buggy submission (verdict: Runtime Error):
N = int(raw_input())

found = False
for i in xrange(1, 10):	
  for j in xrange(1, 10):
  	if i*j == N:
      found = True
      
print "Yes" if found else "No"

Buggy submission (verdict: Runtime Error):
N = int(raw_input())

found = False
for i in xrange(1, 10):	
  for j in xrange(1, 10):
  	if i*j == N and not found:
      print "Yes"
      found = True
      
if not found:
  print "No"

Buggy submission (verdict: Runtime Error):
N = int(raw_input())

for i in xrange(1, 10):	
  for j in xrange(1, 10):
  	if i*j == N:
      print "Yes"
else:
	print "No"
Problem p02916 (python)

Fixed submission:
n = int(raw_input())

x = lambda: map(int, raw_input().strip().split())

A = x()
B = x()
C = x()

points = 0
for i in xrange(n):
  points += B[A[i]-1]
  if i > 0 and A[i] == A[i-1] + 1:
    points += C[A[i]-2]

print points

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

x = lambda: map(int, raw_input().strip().split())

A = x()
B = x()
C = x()

points = 0
for i in xrange(n):
  points += B[A[i]-1]
  if i > 0 and A[i] == A[i-1] + 1:
    points += C[A[i]-1]

print points
Problem p02935 (python)

Fixed submission:
import heapq
 
n = int(raw_input())
values = map(int, raw_input().split())
values = sorted(values, reverse=True)
 
print sum(((0.5)**(i+1))*v for i, v in enumerate(values)) + ((0.5)**(len(values)))*values[-1]

Buggy submission (verdict: Runtime Error):
import heapq

n = int(raw_input())
values = map(int, raw_input().split())
values = sorted(values)
h = []
for v in values:
  heapq.heappush(h, -v)

while len(h) > 1:
  a = heapq.heappop()
  b = heapq.heappop()
  c = (a+b)/2
  heapq.heappush(h, c)
 
print -heapq.heappop()

Buggy submission (verdict: Runtime Error):
import heapq

n = int(raw_input())
values = map(int, raw_input().split())
values = sorted(values)
h = []
for v in values:
  heapq.heappush(h, v)

while len(h) > 1:
  a = heapq.heappop()
  b = heapq.heappop()
  c = (a+b)/2
  heapq.heappush(h, c)
 
print heapq.heappop()

Buggy submission (verdict: Runtime Error):
import heapq

n = int(raw_input())
values = map(int, raw_input().split())
values = sorted(values)
h = []
for v in values:
  heapq.heappush(h, v)

while len(h) > 0:
  a = heapq.heappop()
  b = heapq.heappop()
  c = (a+b)/2
  heapq.heappush(h, c)
 
print heapq.heappop()
Problem p02948 (python)

Fixed submission:
import heapq
from collections import defaultdict

read = lambda: map(int, raw_input().strip().split())
n, m = read()
jobs = [read() for _ in xrange(n)]
jobs_by_time = defaultdict(list)
for (a, b) in jobs:
  jobs_by_time[a].append(b)

ans = 0
q = [] # heapq
for t in xrange(0, m):
  day = t+1
  for job in jobs_by_time[day]:
    heapq.heappush(q, -job)
  
  if q:
    val = -heapq.heappop(q)
    ans += val
print ans

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

read = lambda: map(int, raw_input())
n, m = read()
jobs = [read() for _ in xrange(n)]
jobs_by_time = defaultdict(list)
for (a, b) in jobs:
  jobs_by_time[a].append(b)

ans = 0
q = [] # heapq
for t in xrange(0, m):
  day = t+1
  for job in jobs_by_time[day]:
    heapq.heappush(q, -job)
  
  if q:
    val = -heapq.heappushpop(q)
    ans += val
print ans
Problem p02570 (python)

Fixed submission:
D,T,S = (int(x) for x in input().split())

disable = D - T*S

if disable>0:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
D,T,S = (int(x) for x in input().split())

disable = D - T*S

if disable>0:
    print("No")
else 
    print("Yes")
Problem p02627 (python)

Fixed submission:
st = input()
if(st.islower()):
  print('a')
else:
  print('A')

Buggy submission (verdict: Runtime Error):
st = input()
if(st.is_lower()):
  print('A')
else:
  print('B')
Problem p02831 (python)

Fixed submission:
import fractions
a,b = (int(i) for i in input().split())
print(int((a*b) /fractions.gcd(a,b)))

Buggy submission (verdict: Runtime Error):
import math
a,b = (int(i) for i in input().split())
print(int((a*b)/math.gcd(a,b)))
Problem p02879 (python)

Fixed submission:
nums = [int(e) for e in input().split()]
if nums[0] < 10 and nums[1] < 10:
    print(nums[0] * nums[1])
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
a = input()
a = int(a)
b = input()
b = int(b)
if a < 10 && b < 10:
  print(a * b)
else:
  print(-1)
Problem p02897 (python)

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

Buggy submission (verdict: Runtime Error):
n = input()
print((n // 2 + 1)/n))

Buggy submission (verdict: Runtime Error):
n = input()
print((n // 2 + 1)/n)
Problem p02627 (python)

Fixed submission:
if input().isupper():
  print('A')
else:
  print('a')

Buggy submission (verdict: Runtime Error):
N = input()
 
if N.isupper() == true:
  print("A")
else:
  print("a")

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

if n.isupper() == true:
  print("A")
else:
  print("a")
Problem p02577 (python)

Fixed submission:
n = str(input())
lst = [int(i) for i in n]
if sum(lst) % 9 ==0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
from math import ceil
n, x, t = map(int, input().split())
print(t*ceil(n/x))
Problem p02699 (python)

Fixed submission:
S, W = map(int, input().split())
print('unsafe' if W >= S else 'safe')

Buggy submission (verdict: Runtime Error):
n = int(input())
y = []
for x in range(n):
    y.append(input())
print(len(set(y)))
Problem p02723 (python)

Fixed submission:
S = str(input())
if len(S) == 6:
    if S[2] == S[3] and S[4] == S[5]:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
K, N = input().split()
A = list(map(int, input().split()))
if 0 in A:
    A.remove(0)
x = max(A) - min(A)
print(x)

Buggy submission (verdict: Runtime Error):
K, N = map(int, input().split())
A = list(map(int, input().split()))
if 0 in A:
    A.remove(0)
x = max(A) - min(A)
print(x)

Buggy submission (verdict: Runtime Error):
K, N = map(int, input().split())
A = list(map(int, input().split()))
if 2  <= K <= 10 ** 6 and 2 <= N <= 2 * 10 ** 5:
    if 0 in A:
        A.remove(0)
    x = max(A) - min(A)
    print(x)
Problem p02729 (python)

Fixed submission:
import math

n, m = map(int, input().split())
if n <= 1:
    ans = 0
else:
    ans = math.factorial(n) / math.factorial(n - 2) / 2
if m <= 1:
        ans += 0
else:
    ans += math.factorial(m) / math.factorial(m - 2) / 2
print(int(ans))

Buggy submission (verdict: Runtime Error):
import math

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

Buggy submission (verdict: Runtime Error):
import math

n, m = map(int, input().split())
ans = math.factorial(n) / math.factorial(n - 2) / 2
ans += math.factorial(m) / math.factorial(m - 2) / 2
print(int(ans))
Problem p03208 (python)

Fixed submission:
N, K = map(int, input().split())
trees = [int(input()) for i in range(N)]
trees.sort()
ans = 10 ** 10
for i in range(N - K + 1):
    ans = min(ans, abs(trees[i]-trees[i+K-1]))
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
trees = [int(input()) for i in range(N)]
trees.sort()
ans = 10 ** 10
for i in range(N - K + 1):
    ans = min(ans, abs(trees[i]-trees[N-K+i]))
print(ans)
Problem p03242 (python)

Fixed submission:
instr = input()
ans = ""
for c in instr:
    if c == '1':
        ans += '9'
    elif c == '9':
        ans += '1'
    else:
        ans += c
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
AllList = list(map(int, input().split()))
OddList = [0 for i in range(100001)]
EvenList = [0 for i in range(100001)]
for i in range(n):
    if i % 2 == 0:
        OddList[AllList[i]] += 1
    else:
        EvenList[AllList[i]] += 1

OddMax = max(OddList)
EvenMax = max(EvenList)
OddMaxNum = OddList.index(OddMax)
EvenMaxNum = EvenList.index(EvenMax)

if OddMaxNum == EvenMaxNum:
    if OddMax > EvenMax:
        EvenList[EvenMaxNum] = 0
    else:
        OddList[OddMaxNum] = 0

OddMax = max(OddList)
EvenMax = max(EvenList)

ans = n - OddMax - EvenMax

print(ans)
Problem p03307 (python)

Fixed submission:
N = int(input())
if N % 2 == 0:
    ans = N
else:
    ans = N * 2
print(ans)

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

big = max(A)
small = min(A)
print(abs(big - small))

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

big = max(A)
small = min(A)
print(int(big - small))

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

big = max(A)
small = min(A)
print(big - small)

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

big = max(A)
small = min(A)
print(big - small)
Problem p02659 (python)

Fixed submission:
a, b = input().split()
print(int(a) * round(float(b) * 100) // 100)

Buggy submission (verdict: Runtime Error):
program hi;
var 
    a: int64;
    b: real;

begin
    readln(a, b);
    writeln((a * round(b * 100)) div 100);
end.
Problem p02753 (python)

Fixed submission:
a = input()
 
if a[0] == a[1] and a[0] == a[2]:
  print('No')
else:
  print('Yes')

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

if a == b and a == c:
  print('No')
else:
  print('Yes)
Problem p02570 (python)

Fixed submission:
d,t,s=list(map(int,input().split()))
if d<=s*t:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
d,t,s=list(map(int,input()))
if d <= (s*t):
  print("YES")
elif:
  print("NO")
Problem p02594 (python)

Fixed submission:
x=int(input())
if x>=30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
ctr=0
for i in range(n):
  x,y=map(int,input().split())
  t=(x**2+y**2)**(1/2)
  if t<=d:
    ctr+=1
print(ctr)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
ctr=0
for i in range(n):
  x,y=map(int,input().split())
  if float((x**2+y**2)**(1/2))>=float(d):
    ctr+=1
print(ctr)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
ctr=0
for i in range(n):
  x,y=map(int,input().split())
  if (x**2+y**2)**(1/2)>=d:
    ctr+=1
print(ctr)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
ctr=0
for i in range(n):
  x,y=map(int,input().split())
  if (x**2+y**2)**(1/2)==d:
    ctr+=1
print(ctr)
Problem p02595 (python)

Fixed submission:
n,d=map(int,input().split())
ctr=0
for i in range(n):
  x,y=map(int,input().split())
  t=(x**2+y**2)**(1/2)
  if t<=d:
    ctr+=1
print(ctr)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
ctr=0
for i in range(n):
  x,y=map(int,input().split())
  t=(x**2+y**2)**(1/2)
  if t>=d:
    ctr+=1
print(ctr
Problem p02831 (python)

Fixed submission:
from fractions import gcd
a,b = map(int, input().split())

print((a * b) // gcd(a,b))

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

print((a * b) // math.gcd(a,b))
Problem p02572 (python)

Fixed submission:
mod = pow(10, 9)+7
n = int(input())
lt = [int(x) for x in input().split()]

s = sum(lt)
ans = 0
for a in lt:
  s = s - a
  ans+= (a*s)%mod 
print(ans%mod)

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

lt = [int(x) for x in input().split()]

s = sum(lt)
ans = 0
for a in lt:
  s = s - a
  ans+= (a*s)%mod 
print(ans%mod)
Problem p02570 (python)

Fixed submission:
D,T,S=map(int,input().split())
if D/S <=T:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
import itertools
c = itertools.combinations(A, 2)
B=[]
a=0
for v in itertools.combinations(A, 2):
    c=v[0]*v[1]
    a=a+c
print(a%1000000007)
Problem p02578 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
a_1=sum(A)
count=0
for i in range(0,len(A)-1):
    if A[i]>A[i+1]:
        A[i+1]=A[i]
    else:
        A[0]=A[0]
        A[i+1]=A[i+1]
a_2=sum(A)
print(a_2-a_1)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
a_1=sum(A)
count=0
for i in range(0,4):
    if A[i]>A[i+1]:
        A[i+1]=A[i]
    else:
        A[i+1]=A[i+1]
a_2=sum(A)
print(a_2-a_1)
Problem p02659 (python)

Fixed submission:
a,b=input().split()
from decimal import Decimal
f1 = Decimal(a)
f2 = Decimal(b)
print(int(f1 * f2))

Buggy submission (verdict: Runtime Error):
N=int(input())
P=list(map(int,input().split()))
import numpy
Q=numpy.array(P)
 
result =numpy.prod(Q)
 
if result>pow(10, 18):
    print('-1')
else:
    print(str(result))
Problem p03017 (python)

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

s = input()
s = '#' +s

def check(s, a, b):
    return not "##" in s[a:b]


def solve(s,a,b,c,d):
    can_swap = "..." in s[b - 1:d + 2]
    can_reach_each = check(s, a, c) and check(s, b, d)
    if not can_reach_each:
        return False
    if (a < b and c < d) or (b < a and d < c):
        return True
    else:
        if can_swap:
            return True
        else:
            return False

if solve(s, a, b, c, d):
    print("Yes")
else:
    print("No")

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

a = a - 1
b = b - 1
c = c - 1
d = d - 1


def rec(s, a, b, c, d):
    #ss = s.copy()
    #ss[a] = 'A'
    #ss[b] = 'B'
    #print(str(ss),a,b,c,d)
    if a > c or b > d:
        return False
    if a == c and b == d:
        return True

    if a+1 < len(s) and s[a + 1] == '.' and a+1 != b:
        if rec(s, a + 1, b, c, d):
            return True
    if a+2 < len(s) and s[a + 2] == '.' and a + 2 != b:
        if rec(s, a + 2, b, c, d):
            return True
    if b + 1 < len(s) and s[b + 1] == '.' and b + 1 != a:
        if rec(s, a, b + 1, c, d):
            return True
    if b+2 < len(s) and s[b + 2] == '.' and b + 2 != a:
        if rec(s, a, b + 2, c, d):
            return True

    return False

result = rec(s, a, b, c, d)
if result:
    print("Yes")
else:
    print("No")
Problem p02771 (python)

Fixed submission:
print('Yes' if len(set(input().split()))==2 else 'No')

Buggy submission (verdict: Runtime Error):
n = int(input())
dic = {}
m = 0
for i in range(n):
  s = input()
  if s in dic:
    dic[s] += 1
    m = max(m, dic[s])
  else:
    dic[s] = 1
    m = max(m, dic[s])
ans = []
for s in dic:
  if dic[s] == m:
    ans.append(s)
print('\n'.join(ans.sort()))
Problem p02773 (python)

Fixed submission:
n = int(input())
dic = {}
m = 0
for i in range(n):
  s = input()
  if s in dic:
    dic[s] += 1
    m = max(m, dic[s])
  else:
    dic[s] = 1
    m = max(m, dic[s])
ans = []
for s in dic:
  if dic[s] == m:
    ans.append(s)
print('\n'.join(sorted(ans)))

Buggy submission (verdict: Runtime Error):
n = int(input())
dic = {}
m = 0
for i in range(n):
  s = input()
  if s in dic:
    dic[s] += 1
    m = max(m, dic[s])
  else:
    dic[s] = 1
    m = max(m, dic[s])
ans = []
for s in dic:
  if dic[s] == m:
    ans.append(s)
print('\n'.join(ans.sort()))
Problem p02833 (python)

Fixed submission:
import math

n = int(input())
if n == 0:
  print(0)
elif n % 2 == 0:
  m = math.ceil(math.log(n, 5))
  ans = 0
  for i in range(1, m+1):
    ans += n // (2*5**i)
  print(ans)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
if n % 2 == 0:
  m = math.ceil(math.log(n, 5))

  ans = 0
  for i in range(1, m+1):
    ans += n // (2*5**i)
  print(ans)
else:
  print(0)
Problem p02859 (python)

Fixed submission:
print((int(input()))**2)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = []
y = []
for i in range(n):
  _x, _y = map(int, input().split())
  x.append(_x)
  y.append(_y)
#それぞれの組み合わせに対して2*(n-1)!回ずつ合計に加算される→平均への寄与は2/n倍
def d(x1, y1, x2, y2):
  return ((x1-x2)**2 + (y1-y2)**2)**0.5

ans = 0
for i in range(n):
  for j in range(i+1, n):
    ans += d(x[i], y[i], x[j], y[j])
print(ans*2/n)
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
  print(s)
else:
  print('red')

Buggy submission (verdict: Runtime Error):
l, r = map(int, input().split())
import math

ans = 0
inf = math.ceil(math.log(l, 2))
sup = math.floor(math.log(r+1, 2)) - 1
for i in range(inf, sup+1):
  ans += 3 ** i

for i in range(l, 2 ** inf):
  n = bin(i).count('0') - 1
  ans += 2 ** n

for i in range(2 ** (sup + 1), r + 1):
  n = bin(i).count('1') - 1
  ans += 2 ** n
print(ans % int(10**9+7))
Problem p02984 (python)

Fixed submission:
n = int(input())
_a = input().split()

a = []

x = []

for i in range(n):
  a.append(2*int(_a[i]))
  x.append(0)
  
for i in range(1, n):
  a[i] -= a[i-1]

x[n-1] = a[n-1] // 2

for i in range(n-2, -1, -1):
  if i%2==0:
    x[i] = a[i] - x[n-1]
  else:
    x[i] = a[i] + x[n-1]
    
ans = str(x[n-1]) + ' '
for i in range(n-1):
  ans += str(x[i]) + ' '
  

print(ans[:-1])

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

a = []

x = []

for i in range(n):
  a.append(2*int(_a[i]))
  x.append(0)
  
for i in range(1, n):
  a[i] = a[i-1]

x[n] = a[n]

for i in range(n-1, 0, -1):
  if i%2==0:
    x[i] = a[i] + x[n]
  else:
    x[i] = a[i] - x[n]
    
ans = ''
for i in range(n):
  ans += str(x[i]) + ' '
  
print(ans[:-1])
Problem p02987 (python)

Fixed submission:
s = input()

letters = []
for i in range(4):
  if not s[i] in letters:
    letters.append(s[i])
  
if len(letters)==2 and s.count(s[0])==2:
  print('Yes')
else:
  print('No')

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

letters = []
for i in range(n):
  if not s[0] in letters:
    letters.append(s[0])
  
if len(letters)==2 and letters.count(s[0])==2:
  print('Yes')
else:
  print('No')
Problem p03137 (python)

Fixed submission:
n, m = map(int, input().split())
if n >= m:
  print(0)
else:
  x = sorted(list(map(int, input().split())))

  y = []
  for i in range(m-1):
    y.append(x[i+1] - x[i])

  y_sorted = sorted(y, reverse=True)

  ans = 0
  for _y in y_sorted[n-1:]:
    ans += _y
  print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
if n >= m:
  print(0)
else:
  x = sorted(list(map(int, input().split())))

  y = []
  for i in range(m-1):
    y.append(h[i+1] - h[i])

  y_sorted = sorted(y, reverse=True)

  ans = 0
  for _y in y[n:]:
    ans += _y
  print(ans)
Problem p03295 (python)

Fixed submission:
n, m = map(int, input().split())
wars = {}
for i in range(m):
  a, b = map(int, input().split())
  if a in wars.keys():
    wars[a] = min(wars[a], b)
  else:
    wars[a] = b

cuts = 0
antis = 10**6

for i in range(1, n):
  if i in wars.keys():
    antis = min(antis, wars[i])
  if i + 1 == antis:
    cuts += 1
    antis = 10**6
    
print(cuts)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
wars = {}
for i in range(m):
  a, b = map(int, input().split())
  if a in frontiers.keys():
    frontiers[a] = min(frontiers[a], b)
  else:
    wars[a] = b

cuts = 0
frontier = 10**6

for i in range(1, n):
  if i in frontiers.keys():
    antis = min(frontier, wars[i])
  if i + 1 == frontier:
    cuts += 1
    frontier = 10**6
    
print(cuts)