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

Fixed submission:
import sys
from collections import Counter

stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    h, w, m = nm()
    H = []
    W = []
    for i in range(m):
        hh, ww = nm()
        H.append(hh)
        W.append(ww)
    h_m = Counter(H).most_common()[0]
    w_m = Counter(W).most_common()[0]
    ans_1 = h_m[1]
    ans_2 = w_m[1]
    WW = []
    HH = []

    for i in range(m):
        if H[i] == h_m[0]:
            continue
        WW.append(W[i])

    for i in range(m):
        if W[i] == w_m[0]:
            continue
        HH.append(H[i])
    if WW:
        ans_1 += Counter(WW).most_common()[0][1]
    if HH:
        ans_2 += Counter(HH).most_common()[0][1]

    print(max(ans_1, ans_2))


if __name__ == '__main__':
    main()

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

stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    h, w, m = nm()
    H = []
    W = []
    for i in range(m):
        hh, ww = nm()
        H.append(hh)
        W.append(ww)
    h_m = Counter(H).most_common()[0]
    w_m = Counter(W).most_common()[0]
    ans_1 = h_m[1]
    ans_2 = w_m[1]
    WW = []
    HH = []

    for i in range(m):
        if H[i] == h_m[0]:
            continue
        WW.append(W[i])

    for i in range(m):
        if W[i] == w_m[0]:
            continue
        HH.append(H[i])

    ans_1 += Counter(WW).most_common()[0][1]
    ans_2 += Counter(HH).most_common()[0][1]

    print(max(ans_1, ans_2))


if __name__ == '__main__':
    main()
Problem p02623 (python)

Fixed submission:
import numpy as np
from bisect import bisect_right

n, m, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
b = [0] + list(map(int, input().split()))
a = np.cumsum(a)
b = np.cumsum(b)

ans = 0
for a_num, time in enumerate(a):
    if time > k:
        continue
    b_num = bisect_right(b, k - time)
    num = a_num + b_num - 1
    if num > ans:
        ans = num
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()))
if k >= sum(a) + sum(b):
    print(n + m)
    exit()
ans = -1
total_time = 0
a_cnt = 0
b_cnt = 0
while total_time <= k:
    read_time = min(a[a_cnt], b[b_cnt])
    if read_time == a[a_cnt]:
        if a_cnt < len(a) - 1:
            a_cnt += 1
        else:
            b_cnt += 1
    else:
        if b_cnt < len(b) - 1:
            b_cnt += 1
        else:
            a_cnt += 1
    total_time += read_time
    ans += 1

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()))
if k >= sum(a) + sum(b):
    print(n + m)
    exit()
ans = -1
total_time = 0
a_cnt = 0
b_cnt = 0
while total_time <= k:
    read_time = min(a[a_cnt], b[b_cnt])
    if read_time == a[a_cnt]:
        if a_cnt < len(a):
            a_cnt += 1
        else:
            b_cnt += 1
    else:
        if b_cnt < len(b):
            b_cnt += 1
        else:
            a_cnt += 1
    total_time += read_time
    ans += 1

print(ans)
Problem p02695 (python)

Fixed submission:
import itertools

n, m, q = map(int, input().split())
abcd = [tuple(map(int, input().split())) for _ in range(q)]
ans = 0
for com in itertools.combinations_with_replacement(range(1, m + 1), n):
    score = sum([d for a, b, c, d in abcd if com[b-1] - com[a-1] == c])
    if ans < score:
        ans = score
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

n, m, q = map(int, input().split())
abcd = [tuple(map(int, input().split())) for _ in range(Q)]
ans = 0
for com in itertools.combinations_with_replacement(range(1, M + 1), N):
    score = sum([d for a, b, c, d in abcd if com[b-1] - com[a-1] == c])
    if ans < score:
        ans = score
print(ans)
Problem p02729 (python)

Fixed submission:
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def main():
    n, m = map(int, input().split())
    if n < 2:
        even = 0
    else:
        even = combinations_count(n, 2)
    if m < 2:
        odd = 0
    else:
        odd = combinations_count(m, 2)
    print(even + odd)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def main():
    n, m = map(int, input().split())
    print(combinations_count(n, 2) + combinations_count(m, 2))


if __name__ == "__main__":
    main()
Problem p02881 (python)

Fixed submission:
def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            upper_divisors.append(n//i)
        i += 1
    return lower_divisors, upper_divisors


n = int(input())
low, up = make_divisors(n)
if len(low) != 1:
    # ans = low[0] + up[0]
    # for i in range(1, len(low)):
    #     tmp = low[i] + up[i]
    #     if tmp < ans:
    #         ans = tmp
    print(low[-1] + up[-1] - 2)
else:
    print(n - 1)

Buggy submission (verdict: Runtime Error):
def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors, upper_divisors


n = int(input())
low, up = make_divisors(n)
if len(low) != 1:
    ans = low[0] + up[0]
    for i in range(1, len(low)):
        tmp = low[i] + up[i]
        if tmp < ans:
            ans = tmp
    print(tmp - 2)
else:
    print(n - 1)

Buggy submission (verdict: Runtime Error):
def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors, upper_divisors


n = int(input())
low, up = make_divisors(n)
if up:
    ans = low[0] + up[0]
    for i in range(1, len(low)):
        tmp = low[i] + up[i]
        if tmp < ans:
            ans = tmp
    print(tmp - 2)
else:
    print(n - 1)
Problem p02624 (python)

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

l=[4 if i%2==0 else 2 for i in range(max(5,n+1))]
l[1]=1
l[2]=2
l[4]=3
for i in range(3,int(math.sqrt(n))+1):#振るい
  for j in range(i,n//i+1):
   # print(i,i*j)
    if i==j:
      l[i*j]+=1
    else:
      l[i*j]+=2
#print(l)

l2=[i*l[i] for i in range(n+1)]
print(sum(l2))

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

l=[4 if i%2==0 else 2 for i in range(n+1)]
l[1]=1
l[2]=2
l[4]=3
for i in range(3,int(math.sqrt(n))+1):#振るい
  for j in range(i,n//i+1):
   # print(i,i*j)
    if i==j:
      l[i*j]+=1
    else:
      l[i*j]+=2
#print(l)

l2=[i*l[i] for i in range(n+1)]
print(sum(l2))

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

l=[4 if i%2==0 else 2 for i in range(n+1)]
l[1]=1
l[2]=2
l[4]=3
for i in range(3,int(math.sqrt(n))+1):
  for j in range(i,n//i+1):
   # print(i,i*j)
    if i==j:
      l[i*j]+=1
    else:
      l[i*j]+=2
#print(l)

l2=[i*l[i] for i in range(n+1)]
print(sum(l2))
Problem p02659 (python)

Fixed submission:
a,b=input().split()
b1=b[:-3]
b2=b[-2:]
print(int(a)*(int(b1)*100+int(b2))//100)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(float(input())*100)
print(int(a*b)/100)
Problem p02723 (python)

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

Buggy submission (verdict: Runtime Error):
s=input()
if s[3]==s[4] and s[5]==s[6]:
  print("Yes")
else:
  print("No")
Problem p02729 (python)

Fixed submission:
n,m=map(int,input().split())
print(n*(n-1)//2+m*(m-1)//2)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input())
print(n*(n-1)//2+m*(m-1)//2)
Problem p02753 (python)

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

Buggy submission (verdict: Runtime Error):
s=input()
print("No" if s=="AAA" or s="BBB" else "Yes")
Problem p02831 (python)

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

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

Fixed submission:
import sys
sys.setrecursionlimit(1000000)
s=input()
#print(s)
l=[-1 for _ in range(len(s)+1)]
def aa(ix,v): #ixはlベース
# print(ix,v,l)
  if (ix>= len(s) and v==1) or (ix==0 and v==0-1):
    return
  if v==1 and s[ix]=="<" and l[ix+1]<=l[ix]:
    l[ix+1]=l[ix]+1
    aa(ix+1,1)
  elif v==-1 and s[ix-1]==">" and l[ix-1]<=l[ix]:
    l[ix-1]=l[ix]+1
    aa(ix-1,-1)
  return

for i in range(0,len(s)):
  if i ==0 and s[0]=="<":    
    l[0]=0
    aa(i,1)
  elif i==len(s)-1 and s[-1]==">":
    l[-1]=0
    aa(i+1,-1)
  elif s[i]==">" and s[i+1]=="<":
    l[i+1]=0
    aa(i+1,1)
    aa(i+1,-1)

print(sum(l))

Buggy submission (verdict: Runtime Error):
s=input()
#print(s)
l=[-1 for _ in range(len(s)+1)]
def aa(ix,v): #ixはlベース
 # print(ix,v,l)
  if (ix>= len(s) and v==1) or (ix==0 and v==0-1):
    return
  if v==1 and s[ix]=="<" and l[ix+1]<=l[ix]:
    l[ix+1]=l[ix]+1
    aa(ix+1,1)
  elif v==-1 and s[ix-1]==">" and l[ix-1]<=l[ix]:
    l[ix-1]=l[ix]+1
    aa(ix-1,-1)
  return

for i in range(0,len(s)):
  if i ==0 and s[0]=="<":    
    l[0]=0
    aa(i,1)
  elif i==len(s)-1 and s[-1]==">":
    l[-1]=0
    aa(i+1,-1)
  elif s[i]==">" and s[i+1]=="<":
    l[i+1]=0
    aa(i+1,1)
    aa(i+1,-1)

print(sum(l))
Problem p02951 (python)

Fixed submission:
def resolve():


    a,b,c=map(int,input().split())
    print(max(0,c-max(0,a-b)))
resolve()

Buggy submission (verdict: Runtime Error):


    a,b,c=map(int,input().split())
    print(max(0,c-max(0,a-b)))
Problem p02596 (python)

Fixed submission:
k = int(input())
curr = 7
for i in range(k):
  if curr%k:
    curr *= 10
    curr += 7
    curr %= k
  else:
    print(i+1)
    break
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
k = int(input())
curr = 7
for i in range(k):
  if curr%k:
    curr *= 10
    curr += 7
  else:
    print(i+1)
	break
else:
  print(-1)
Problem p02915 (python)

Fixed submission:
N = int(input())
print(N*N*N)

Buggy submission (verdict: Runtime Error):
N = input()
print(N*N*N)
Problem p02571 (python)

Fixed submission:
import math

s = input()
t = input()
res = len(t)
num =0
for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if t[j]!=s[i+j]:
            num+=1
    res = min(res,num)
    num = 0
print(res)

Buggy submission (verdict: Runtime Error):
import math

s = list(input())
t = list(input())
s.reverse()
s=''.join(s)
t.reverse()
t=''.join(t)
n = s.index(t[0])
res = len(t)
num =0
while len(s)>=len(t):
    if len(s)<=len(t) and s[0] != t[0]:break
    n = s.index(t[0])
    for i in range(len(t)):
        if t[i]!=s[i+n]:
            num+=1
    res = min(res,num)
    s = s[n+len(t):]
print(res)

Buggy submission (verdict: Runtime Error):
import math

s = list(input())
t = list(input())
s.reverse()
s=''.join(s)
t.reverse()
t=''.join(t)
#print(s)
n = s.index(t[0])
#print(n)
res = len(t)
num =0
while len(s)!=0:
    if len(s)<=len(t) and s[0] != t[0]:break
    n = s.index(t[0])
    for i in range(len(t)):
        if t[i]!=s[i+n]:
            num+=1
    res = min(res,num)
    s = s[n+len(t):]
print(res)
Problem p02659 (python)

Fixed submission:
from math import floor
from fractions import Fraction
a, b = input().split()
a = int(a)
b = Fraction(b)
print(floor(a * b))

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

print((a*(b*100))//100)
Problem p02831 (python)

Fixed submission:
import fractions
a,b = map(int,input().split())
if (a < b):
    if b % a == 0:
        print(b)
    else:
        print(b * (a // fractions.gcd(a, b)))
else:
    if a % b == 0:
        print(a)
    else:
        print(a * (b // fractions.gcd(a, b)))

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
if (a < b):
    if b % a == 0:
        print(b)
    else:
        print(b * (a // math.gcd(a, b)))
else:
    if a % b == 0:
        print(a)
    else:
        print(a * (b // math.gcd(a, b)))
Problem p02912 (python)

Fixed submission:
import heapq

N,M = map(int,input().split())
a = list(map(int,input().split()))
a = list(map(lambda x: x*(-1), a))
heapq.heapify(a)
for _ in range(M):
    heapq.heappush(a,((heapq.heappop(a)*(-1))//2)*(-1))
print(abs(sum(a)))

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

a = list(map(int,input().split()))
res = sum(a)
dis = 0
a.sort(reverse=True)
i = 0
while 0 < M:
    dis += a[0] - a[0]//2
    a[0] //= 2
    M -= 1
    while a[i] < a[i+1] and M != 0:
        a[i+1],a[i] = a[i],a[i+1]
        i += 1
        if len(a) < i:break
    i = 0
print(res-dis-M)
Problem p03013 (python)

Fixed submission:
#動的計画法(DP)
#ブログ「けんちょんの競プロ精進記録」参考
#URL: https://drken1215.hatenablog.com/entry/2019/06/10/140000


N,M = map(int,input().split())
MOD = 1000000007
issafe = [True]*(N+1) # issafe[v]: v段目が壊れていないかどうか

for _ in range(M):
    i = int(input())
    issafe[i] = False # i 段目は壊れている

#DPテーブル
dp = [0]*(N+1)

#初期条件
dp[0] = 1
if issafe[1]:dp[1] = 1

#ループ
for n in range(2,N+1):
    if issafe[n-1]: dp[n] += dp[n-1]
    if issafe[n-2]: dp[n] += dp[n-2]
    dp[n] %= MOD

print(dp[N])

Buggy submission (verdict: Runtime Error):
#動的計画法(DP)
#ブログ「けんちょんの競プロ精進記録」参考
#URL: https://drken1215.hatenablog.com/entry/2019/06/10/140000


N,M = map(int,input().split())
MOD = 1000000007
issafe = [True]*N # issafe[v]: v段目が壊れていないかどうか

for _ in range(M):
    i = int(input())
    issafe[i] = False # i 段目は壊れている

#DPテーブル
dp = [0]*(N+1)

#初期条件
dp[0] = 1
if issafe[1]:dp[1] = 1

#ループ
for n in range(2,N+1):
    if issafe[n-1]: dp[n] += dp[n-1]
    if issafe[n-2]: dp[n] += dp[n-2]
    dp[n] %= MOD

print(dp[N])
Problem p03073 (python)

Fixed submission:
cnt = 0
num = '1'
s = input()
for i in range(len(s)):
    if s[i] == num:
        cnt += 1
    if num == '1':
        num = '0'
    else:
        num = '1'
print(min(int(len(s)-cnt),cnt))

Buggy submission (verdict: Runtime Error):
cnt = 0
num = '1'
    s = input()
    for i in range(len(s)):
        if s[i] == num:
            cnt += 1
        if num == '1':
            num = '0'
        else:
            num = '1'
    print(min(int(len(s)-cnt),cnt))
Problem p03077 (python)

Fixed submission:
N = int(input())
Carry = []
for i in range(5):
    Carry.append(int(input()))
min_num = min(Carry)
if N < min_num:
    print(5)
elif min_num == 1:
    print((N//min_num)+4)
elif N % min_num == 0:
    print((N//min_num))
else:
    print((N//min_num)+5)

Buggy submission (verdict: Runtime Error):
N = int(input())
Carry = []
for i in range(5):
    Carry.append(int(input()))
min_num = min(Carry)
if N % min_num == 0:
    print((N//min(max_Carry)))
else:
    print((N//min(max_Carry))+5)
Problem p03127 (python)

Fixed submission:
# 解説確認後

import fractions #val 3.4

N = int(input())

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

gcd = fractions.gcd(a[0],a[1])

for i in range(2,N):
    gcd = fractions.gcd(a[i],gcd)
print(gcd)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

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

gcd = math.gcd(a[0],a[1])

for i in range(2,N):
    gcd = math.gcd(a[i],gcd)
print(gcd)
Problem p02729 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力

a = input()
# スペース区切りの整数の入力
H,W=a.split(" ")
N=int(H)
M=int(W)
retnum=0
for i in range(N):
    retnum+=i
retnum+=M*(M-1)/2
print(int(retnum))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
import copy

a = input()
a=int(a)
ball=[]
mydict={}
DPdict={}
temp=input().split(" ")
for i in range(a):
    if not (temp[i] in mydict):
        mydict[temp[i]]=1
    else:
        mydict[temp[i]]+=1
    ball.append(temp[i])

for i in range(len(ball)):
    rettemp=0
    if i in DPdict:
        print(int(DPdict[i]))
        continue
    for j in mydict.keys():

        if ball[i]==j:
            rettemp+=(mydict[j]-1)*(mydict[j]-2)/2
        else :
            rettemp+=(mydict[j]-1)*(mydict[j])/2
    DPdict[i]=rettemp
    print(int(rettemp))
Problem p02571 (python)

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

# ans = []
# for i in range(len(t)):
#     # print(t[i:])
#     # print(s[i:])
#     if t[i:] in s[i:]:
#         break
#     for j in range(1,len(t[i:])):
#         # print(t[i:][:-j])
#         # print(s[i:][:-j])
#         if t[i:][:-j] in s[i:][:-j]:
#             ans.append(i+j)
#             break
# if t in s:
#     print(0)
# elif len(ans) == 0:
#     print(len(t))
# else:
#     print(min(ans))
ans = len(t)
for i in range(len(s)-len(t)+1):
    dif = 0
    for j in range(len(t)):
        if t[j] != s[i:i+len(t)][j]:
            dif += 1
    ans = min(dif,ans)

print(ans)

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

# ans = []
# for i in range(len(t)):
#     # print(t[i:])
#     # print(s[i:])
#     if t[i:] in s[i:]:
#         break
#     for j in range(1,len(t[i:])):
#         # print(t[i:][:-j])
#         # print(s[i:][:-j])
#         if t[i:][:-j] in s[i:][:-j]:
#             ans.append(i+j)
#             break
# if t in s:
#     print(0)
# elif len(ans) == 0:
#     print(len(t))
# else:
#     print(min(ans))
ans = len(t)
for i in range(len(s)-len(t)):
    dif = 0
    for j in range(len(t)):
        if t[j] != s[i:i+len(t)][j]:
            diff += 1
    ans = min(dif,ans)

print(ans)
Problem p02623 (python)

Fixed submission:
n,m,k = map(int, input().split( ))
A = list(map(int, input().split( )))
B = list(map(int, input().split( )))
acc1 = [0]
for i in range(n):
  acc1.append(acc1[-1] + A[i])
acc2 = [0]
for i in range(m):
  acc2.append(acc2[-1] + B[i])

ans = 0
j = m
for i in range(n+1):
  if acc1[i] > k:
    break
  while acc2[j] > k - acc1[i] and j > 0:
    j -= 1
  ans = max(ans,i+j)
print(ans)

Buggy submission (verdict: Runtime Error):
# ABC C-Tsundoku
n,m,k = map(int,input().split())
an = list(map(int,input().split()))
bn = list(map(int,input().split()))

suma = [0]
sumb = [0]
a = 0
b = 0
for i in an:
    a += i
    suma.append(a)
for i in bn:
    b += i
    sumb.append(b)

res = [0]
for j in range(n+1):
    if k-suma[j] < 0:
        break
    for l in range(m+1):
        if k-suma[j]-sumb[l] > 0:
        res.append(j+l)
print(max(res))

Buggy submission (verdict: Runtime Error):
# ABC C-Tsundoku
n,m,k = map(int,input().split())
an = list(map(int,input().split()))
bn = list(map(int,input().split()))

ans = 0
flag = False
suma = []
sumb = []
a = 0
b = 0
for i in an:
    a += i
    if a <= k:
        suma.append(a)
    else:
        break
for i in bn:
    b += i
    if b <= k:
        sumb.append(b)
    else:
        break
suma = suma[::-1]
res = []
for j,l in enumerate(suma):
    dif = k-l
    for o,p in enumerate(sumb):
        if p <= dif:
            res.append(len(suma)-j+o+1)
        else:
            break
            
print(max(res))
Problem p02753 (python)

Fixed submission:
s = input()

if ('A' in s) and ('B' in s):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
list(map(int,input().split()))
Problem p02773 (python)

Fixed submission:
N = int(input())
d = {}
for i in range(N):
    S = input()
    if S in d.keys():
        d[S] = d[S] + 1
    else:
        d[S] = 1
max_val = max(d.values())
max_k_ls = [kv[0] for kv in d.items() if kv[1]==max_val]
max_k_ls = sorted(max_k_ls)

print(*max_k_ls, sep="\n")

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
S = [input() for __ in range(N)]

S = np.array(S)
keys = set(S)
ans = {}
cnt = 0
ls = []
for key in keys:
    ans[key] = len(np.where(S == key)[0])

max_v = max(ans.values())
keys = [k for k, v in d.items() if v == max_v]
keys.sort()
for key in keys:
    print(key)
Problem p02777 (python)

Fixed submission:
S,T = input().split()
A,B = map(int,input().split())
U = input()

if U == S:
    print(A-1,B)
else:
    print(A,B-1)

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

ls = P[0:K]
summ = sum(ls)
ans = [0]*K

for i in range(N-K+1):
    if summ < sum(P[i:i+K]):
        ls = P[i:i+K]
        summ = sum(ls)
for j in range(K):
    ans[j]=(ls[j]+1)*ls[j]/(2*ls[j])
print(sum(ans))
Problem p03745 (python)

Fixed submission:
#AGC 013 A - Sorted Arrays
#増加⇔減少に転じる際、Ai+1 - Aiは必ず符号反転することを利用
N = int(input())
A = list(map(int,input().split()))

count = 1
sign = 0
for i in range(N-1):
    if sign == 0:
        sign = A[i+1]-A[i]
    elif sign*(A[i+1]-A[i]) < 0:
        count += 1
        sign = 0
print(count)

Buggy submission (verdict: Runtime Error):
#AGC 013 A - Sorted Arrays
#増加⇔減少に転じる際、Ai+1 - Aiは必ず符号反転することを利用
N = int(input())
A = list(map(int,input().split()))

count = 0
sign = 0
for i in range(N):
    if sign == 0:
        sign = A[i+1]-A[i]
    elif sign*(A[i+1]-A[i]) < 0:
        count += 1
        sign = 0
print(count)
Problem p03775 (python)

Fixed submission:
n = int(input())
import math
ans = []
for i in range(1,int(math.sqrt(n)+1)):
    if n%i == 0:
        ans.append(max(len(str(i)),len(str(int(n//i)))))
print(min(ans))

Buggy submission (verdict: Runtime Error):
# C - Digits in Multiplication
n = int(input())
import math
ans = []
for i in range(1,int(math.sqrt(n))):
    if n%i == 0:
        ans.append(max(len(str(i)),len(str(int(n//i)))))
print(min(ans))
Problem p02879 (python)

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

if a[0]>=10 or a[1]>=10:
    print(-1)
else:
    print(a[0]*a[1])

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
 
if a[0]>=10 or a[1]>=10:
  return -1
else:
  return a[0]*a[1]

Buggy submission (verdict: Runtime Error):
a = input().split()
 
if a[0]>=10 or a[1]>=10:
  return -1
else:
  return a[0]*a[1]

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

if a[0]>=10 or a[1]>=10:
  return -1
elif:
  return a[0]*a[1]
Problem p02897 (python)

Fixed submission:
A = input()
N = int(A)


if N ==1:
    a = 1
elif N%2 == 0:
    a = 0.5
    a = float(a)
elif N%2 == 1:
    a = (N//2 + 1)/N

print(a)

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


if N ==1:
    a = 1
elif 1<=N and N<=100 and N%2 == 0:
    a = 0.5
    a = float(a)
elif 1<=N and N<=100 andN % 2 == 1:
    a = (N/2 + 1)/N

print(a)

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


if N ==1:
    print(N) 
elif 1<=N and N<=100 and N%2 == 0:
    a = 0.5
    a = float(a)
elif 1<=N and N<=100 andN % 2 == 1:
    a = (N/2 + 1)/N

print(a)

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


if N ==1:
    print(N) 
elif N%2 == 0:
    a = 0.5
    a = float(a)
elif N % 2 == 1:
    a = (N/2 + 1)/N

print(a)

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

if N ==1:
    print(N) 
elif N%2 == 0:
    a = 0.5
    a = float(a)
elif N % 2 == 1:
    a = (N/2 + 1)/N

print(a)

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

if N ==1:
print N:
elif N%2 == 0:
    a = 0.5
    a = float(a)
elif N % 2 == 1:
    a = (N/2 + 1)/N

print a