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

Fixed submission:
import sys
import math
import heapq
mod=10**9+7
inf=float("inf")
from math import sqrt
from collections import deque
from collections import Counter
from collections import defaultdict
#すべてのkeyが用意されてる defaultdict(int)で初期化
from collections import OrderedDict
#順序を保ったdict
from math import ceil
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import Decimal #floatの高精度ver, 渡すのはstr型で
from functools import lru_cache
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########
k=int(input())
print(50);n=50
if k==0:
    print(" ".join(["0"]*50));exit()
    
a=k//n
b=k%n
A=[a+i for i in range(50)]
for  i in range(b):
    A=[A[j]-1 if i!=j else A[j]+n for j in range(50)]
print(*A)

Buggy submission (verdict: Runtime Error):
import sys
import math
import heapq
mod=10**9+7
inf=float("inf")
from math import sqrt
from collections import deque
from collections import Counter
from collections import defaultdict
#すべてのkeyが用意されてる defaultdict(int)で初期化
from collections import OrderedDict
#順序を保ったdict
from math import ceil
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import Decimal #floatの高精度ver, 渡すのはstr型で
from functools import lru_cache
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########
k=int(input())
print(50)
if k==0:
    print(" ".join(["0"]*50));exit()
    
kijun=int((k-0.1)//50)+1
A=[50+kijun-1]*50
nokori=kijun*50-k
if nokori:
    print(" ".join([f"{i+1}"]*(50-nokori)+["0"]*nokori))
    exit()
print(*A)
Problem p03680 (python)

Fixed submission:
n=int(input())
A=[]
for i in range(n):
  A.append(int(input()))
A=[0]+A
a=1
ans=1
for i in range(100100):
  if A[a]==2:
    print(ans)
    exit()
  ans+=1
  
  a=A[a]
print(-1)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=[]
for i in range(n):
  A.append(int(input()))
  
a=0
ans=1
for i in range(100100):
  if A[a]==1:
    print(ans)
    exit()
  ans+=1
  a=A[a]
print(-1)
Problem p03683 (python)

Fixed submission:
import sys
mod=10**9+7 ; inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict #すべてのkeyが用意されてる defaultdict(int)で初期化
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal as D  #変換後の末尾桁を0や0.01で指定
  #Decimal((str(0.5)).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
from functools import lru_cache
from bisect import bisect_left as bileft, bisect_right as biright
from fractions import Fraction as F  #F(a,b)で正確なa/b
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########

a,b=map(int,input().split())
if abs(a-b)>=2:
    print(0)
    exit()
mod=10**9+7
re=2 if a==b else 1
def kaijou(n):
    if n==1:return 1
    else:
        return (kaijou(n-1)*n)%mod


print(kaijou(a)*kaijou(b)*re%mod)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
def C(n, r ,mod=10**9+7):
    if n-r<r: r=n-r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k]) %mod

    return result % mod
print(C(a+1,b))
Problem p03698 (python)

Fixed submission:
s=input()
for i in range(len(s)-1):
  for j in range(i+1,len(s)):
    if s[i]==s[j]:
      print("no")
      exit()
print("yes")

Buggy submission (verdict: Runtime Error):
s=input()
for i in range(len(s)-1):
  for j in range(i+1,len(s)+1):
    if s[i]==s[j]:
      print("no")
      exit()
print("yes")

Buggy submission (verdict: Runtime Error):
s=input()
for i in range(len(s)-1):
  for j in range(i+1,len(s)+1):
    if A[i]==A[j]:
      print("no")
      exit()
print("yes")
Problem p03760 (python)

Fixed submission:
a=input()
b=input()

d=""
for i in range(len(b)):
  d+=(a[i])
  d+=(b[i])

if len(a)!=len(b):
  d+=a[-1]
  
print(d)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()

d=""
for i in range(len(a)):
  d+=(a[i])
  d+=(b[i])
print(d)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=a+b
d=""
for i in len(c)//2:
  d+=(c[i])
  d+=(c[len(c)//2+i])
print(d)
Problem p03814 (python)

Fixed submission:
A=input()
n=A.index("A")
m=A[::-1].index("Z")
print(len(A)-n-m)

Buggy submission (verdict: Runtime Error):
A=input()
n=A.index("a")
m=A[::-1].index("z")
print(len(A)-n-m)

Buggy submission (verdict: Runtime Error):
A=input()
print(A.index("z")-A.index("a"))
Problem p03815 (python)

Fixed submission:
n=int(input())
if n%11>6:
  print(n//11*2+2)
elif n%11>0:
  print(n//11*2+1)
else:
  print(n//11*2)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n%11>6:
  print(n//11*2+2)
elif n%11>0
  print(n//11*2+1)
else:
  print(n//11*2)
Problem p03854 (python)

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

Buggy submission (verdict: Runtime Error):
a=input()
a=a.replace("erase","")
a=a.replace("dream","")
a=a.replace("dreamer","")
a=a.replace("eraser","")
if a="":
  print("YES")
else:
  print("NO")
Problem p03944 (python)

Fixed submission:
w,h,n=map(int,input().split())
A=[[0 for i in range(w)] for j in range(h)]
for i in range(n):
  a,b,c=map(int,input().split())
  if c==1:
    for i in range(h):
      for j in range(a):
        A[i][j]=1
  elif c==2:
    for i in range(h):
      for j in range(w-a):
        A[i][j+a]=1
  elif c==3:
    for i in range(b):
      A[i]=[1 for i in range(w)]
  else:
    for i in range(h-b):
      A[h-i-1]=[1 for i in range(w)]
ans=0
for i in range(h):
  ans+=A[i].count(0)
print(ans)

Buggy submission (verdict: Runtime Error):
w,h,n=map(int,input().split())
A=[[0 for i in range(w)] for j in range(h)]
for i in range(n):
  a,b,c=map(int,input().split())
  if c==1:
    for i in range(h):
      for j in range(a):
        A[i][j]=1
  elif c==2:
    for i in range(h):
      for j in range(w-a):
        A[i][j+a]=1
  elif c==3:
    for i in range(b):
      A[i]=[1 for i in range(w)]
  else:
    for i in range(h-b):
      A[h-i]=[1 for i in range(w)]
ans=0
for i in range(h):
  ans+=A[i].count(0)
print(ans)
Problem p03951 (python)

Fixed submission:
n=int(input())
A=input()
B=input()
s=0

ans=n
D=[i for i in range(n)][::-1]
for i in D:
  if A[-i-1:]==B[:i+1]:
    
    print(ans)
    exit()
  else:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=input()
B=input()
s=0

ans=2*n
for i in range(n)
  if A[-i-1:]!=B[:i+1]:
    s=1
    print(ans)
    exit()
  else:
    ans-=1
print(ans)
Problem p03957 (python)

Fixed submission:
A=list(input())
for i in range(len(A)):
  if A[i]=="C":
    if "F" in A[i+1:]:
      print("Yes")
      exit()
print("No")

Buggy submission (verdict: Runtime Error):
A=list(input())
for i in A:
  if i=="C":
    if "I" in A[i+1:]:
      print("Yes")
      exit()
print("No")
Problem p04012 (python)

Fixed submission:
s=input()
s=list(s)
for i in s:
  if s.count(i)%2==1:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
s=input()
s=list(s)
for i in s:
  if s.count(s[i])%2==1:
    print("No")
    exit()
print("Yes")
Problem p04030 (python)

Fixed submission:
s=input()
ans=""
for i in s:
  if i=="0" or i=="1":
    ans+=i
  else:
    if len(ans)!=0:
      ans=ans[:-1]

print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
ans=""
for i in s:
  if i=="0" or i=="1":
    ans+=i
  else:
    if len(ans)!=0:
      del ans[-1]
print(ans)
Problem p04047 (python)

Fixed submission:
n=int(input())
A=sorted(list(map(int,input().split())))
print(sum(A[::2]))

Buggy submission (verdict: Runtime Error):
n=int(input());print(sum(sorted(list(map(int,input().split())))[::2]))
print("RE WA?"
Problem p02536 (python)

Fixed submission:
import sys
sys.setrecursionlimit(2 * (10 ** 6))
n, m = map(int, input().split())
edges = [[] for i in range(n)]
visit = [False for i in range(n)]
def dfs(v):
    visit[v] = True
    for i in edges[v]:
        if not visit[i]:
            dfs(i)
for i in range(m):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)
cnt = 0
for i in range(n):
    if not visit[i]:
        dfs(i)
        cnt += 1
print(cnt - 1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
edges = [[] for i in range(n)]
visit = [False for i in range(n)]
def dfs(v):
    visit[v] = True
    for i in edges[v]:
        if not visit[i]:
            dfs(i)
for i in range(m):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)
cnt = 0
for i in range(n):
    if not visit[i]:
        dfs(i)
        cnt += 1
print(cnt - 1)
Problem p02537 (python)

Fixed submission:
class SegmentTree:
    def __init__(self, lis, ele, op):
        self.len = len(lis)
        self.n = 1 << ((self.len - 1).bit_length())
        self.op = op
        self.ele = ele
        self.tree = self._build(lis)
    def _build(self, lis):
        res_tree = [self.ele] * (self.n - 1) + lis + [self.ele] * (self.n - self.len)
        for i in range(self.n - 2, -1, -1):
            res_tree[i] = self.op(res_tree[i * 2 + 1], res_tree[i * 2 + 2])
        return res_tree
    def __get__(self, i):
        return self.tree[self.n + i - 1]
    def update(self, i, x):
        i += self.n - 1
        self.tree[i] = x
        while i > 0:
            i -= 1
            i >>= 1
            self.tree[i] = self.op(self.tree[i * 2 + 1], self.tree[i * 2 + 2])
    def query(self, l, r):
        l +=  self.n - 1
        r += self.n - 1
        L = self.ele
        R = self.ele
        while l < r:
            if l & 1 == 0:
                L = self.op(L, self.tree[l])
                l += 1
            if r & 1 == 0:
                r -= 1
                R = self.op(R, self.tree[r])
            l -= 1
            l >>= 1
            r >>= 1
        return self.op(L, R)
n, k = map(int, input().split())
ST = SegmentTree([0] * 600000, 0, max)
for i in range(n):
    a = int(input())
    res = ST.query(max(0, a - k), min(600000, a + k + 1))
    ST.update(a, res + 1)
print(ST.tree[1])

Buggy submission (verdict: Runtime Error):
class SegmentTree:
    def __init__(self, lis, ele, op):
        self.len = len(lis)
        self.n = 1 << ((self.len - 1).bit_length())
        self.op = op
        self.ele = ele
        self.tree = self._build(lis)
    def _build(self, lis):
        res_tree = [self.ele] * (self.n - 1) + lis + [self.ele] * (self.n - self.len)
        for i in range(self.n - 2, -1, -1):
            res_tree[i] = self.op(res_tree[i * 2 + 1], res_tree[i * 2 + 2])
        return res_tree
    def __get__(self, i):
        return self.tree[self.n + i - 1]
    def update(self, i, x):
        i += self.n - 1
        self.tree[i] = x
        while i > 0:
            i -= 1
            i >>= 1
            self.tree[i] = self.op(self.tree[i * 2 + 1], self.tree[i * 2 + 2])
    def query(self, l, r):
        l +=  self.n - 1
        r += self.n - 1
        L = self.ele
        R = self.ele
        while l < r:
            if l & 1 == 0:
                L = self.op(L, self.tree[l])
                l += 1
            if r & 1 == 0:
                r -= 1
                R = self.op(R, self.tree[r])
            l -= 1
            l >>= 1
            r >>= 1
        return self.op(L, R)
n, k = map(int, input().split())
ST = SegmentTree([0] * 200000, 0, max)
for i in range(n):
    a = int(input())
    res = ST.query(max(0, a - k), min(200000, a + k + 1))
    ST.update(a, res + 1)
print(ST.tree[1])
Problem p02599 (python)

Fixed submission:
BIT = [0] * ((1 << 19) + 1)
def add(i, x):
    while i <= (1 << 19):
        BIT[i] += x
        i += i & -i
def query(i):
    res = 0
    while i > 0:
        res += BIT[i]
        i -= i & -i
    return res
n, q = map(int, input().split())
c = list(map(int, input().split()))
Q = [[] for i in range(n)]
for i in range(q):
    l, r = map(int, input().split())
    Q[r - 1].append([l - 1, i])
l = [-1] * n
a = [-1] * q
add(1, n)
for i in range(n):
    add(l[c[i] - 1] + 2, -1)
    add(i + 2, 1)
    l[c[i] - 1] = i
    for j in Q[i]:
        a[j[1]] = query(1 << 19) - query(j[0] + 1)
print(*a, sep="\n")

Buggy submission (verdict: Runtime Error):
BIT = [0] * ((1 << 19) + 1)
def add(i, x):
    while i <= (1 << 19):
        BIT[i] += x
        i += i & -i
def query(i):
    res = 0
    while i > 0:
        res += BIT[i]
        i -= i & -i
    return res
n, q = map(int, input().split())
c = list(map(int, input().split()))
Q = [[] for i in range(n)]
for i in range(q):
    l, r = map(int, input().split())
    Q[r - 1].append([l - 1, i])
l = [-1] * n
a = [-1] * q
add(1, n)
for i in range(n):
    add(l[c[i]] + 2, -1)
    add(i + 2, 1)
    l[c[i]] = i
    for j in Q[i]:
        a[j[1]] = query(1 << 19) - query(j[0] + 1)
print(*a, sep="\n")
Problem p02609 (python)

Fixed submission:
def dfs(n):
    if n == 0:return 0
    return dfs(n % format(n, "b").count("1")) + 1
n = int(input())
x = input()
c = x.count("1")
a = int(x, 2)
if c == 1:
    for i in range(n):
        if x[i] == "1":
            print(0)
        elif i == n - 1:
            print(2)
        else:
            print(1)
else:
    j, k = a % (c + 1), a % (c - 1)
    for i in range(n):
        if x[i] == "1":print(dfs((k - pow(2, n - i - 1, c - 1)) % (c - 1)) + 1)
        else:print(dfs((j + pow(2, n - i - 1, c + 1)) % (c + 1)) + 1)

Buggy submission (verdict: Runtime Error):
def dfs(n):
    if n == 0:return 0
    return dfs(n % format(n, "b").count("1")) + 1
n = int(input())
x = input()
c = x.count("1")
a = int(x, 2)
j, k = a % (c + 1), a % (c - 1)
if c == 1:
    for i in range(n):
        if x[i] == "1":
            print(0)
        elif i == n - 1:
            print(2)
        else:
            print(1)
else:
    for i in range(n):
        if x[i] == "1":print(dfs((k - pow(2, n - i - 1, c - 1)) % (c - 1)) + 1)
        else:print(dfs((j + pow(2, n - i - 1, c + 1)) % (c + 1)) + 1)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
def d(n):
 if n==0:return 0
 return d(n%bin(n).count("1"))+1
n=int(input())
x=input()
c=x.count("1")
a=int(x,2)
j,k=a%(c+1),a%(c-1)
for i in range(n):
 if x[i]=="1":print(d((k-pow(2,n-i-1,c-1))%(c-1))+1)
 else:print(d((j+pow(2,n-i-1,c+1))%(c+1))+1)

Buggy submission (verdict: Runtime Error):
def d(n):
 if n==0:return 0
 return d(n%bin(n).count("1"))+1
n=int(input())
x=input()
c=x.count("1")
a=int(x,2)
j,k=a%(c+1),a%(c-1)
for i in range(n):
 if x[i]=="1":print(d(k-pow(2,n-i-1,c-1)%(c-1))+1)
 else:print(d(j+pow(2,n-i-1,c+1)%(c+1))+1)

Buggy submission (verdict: Runtime Error):
def dfs(n):
    s = str(format(n, "b"))
    c = s.count("1")
    return l[n % c] + 1
n = int(input())
x = input()
xi = int(x, 2)
c = x.count("1")
l = [0]
for i in range(1, 2 ** n):
    l.append(dfs(i))
for i in range(n):
    k = 0
    if x[i] == "1":
        m = xi - pow(2, n - i - 1)
        c2 = c - 1
    else:
        m = xi + pow(2, n - i - 1)
        c2 = c + 1
    print(dfs(m))
Problem p02626 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
x=0
for i in a[2:]:x^=i
m=(a[0]+a[1]-x)//2
if a[0]+a[1]!=x+m*2or m>a[0]or(x&m)!=0:exit(print(-1))
l=1<<(max(x.bit_length(),m.bit_length())+1)
while l>0:
 if((x&l)!=0)and((m|l)<=a[0]):m|=l
 l>>=1
print(a[0]-m if m!=0else-1)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))
X=0
for i in a[2:]:X^=i
m=a[0]+a[1]-X
if m>a[0]or(m&X)!=0:exit(print(-1))
l=1<<max(x.bit_length(),m.bit_length())
while l > 0:
 if (m&l)!=0and(a|b)<=a[0]:a|=b
 b>>=1
print(a[0]-m if a!=0else-1)
Problem p02677 (python)

Fixed submission:
import math
a, b, h, m = map(int, input().split())
ang = min(h * 30 + (m / 60) * 30 - m * 6, 360 - (h * 30 + (m / 60) * 30 - m * 6))
print(math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(ang))))

Buggy submission (verdict: Runtime Error):
import math
a, b, h, m = map(int, input().split())
angle = min(h * 30 + (m / 60) * 30 - m * 6, 360 - (h * 30 + (m / 60) * 30 - m * 6))
if angle > 90:
    angle = 90 - (180 - angle)
    n = a * math.sin(math.radians(angle))
    x = a * math.cos(math.radians(angle))
    print(math.sqrt(n ** 2 + (x + b) ** 2))
else:
    angle = 90 - angle
    n = b * math.sin(math.radians(angle))
    x = b * math.cos(math.radians(angle)) * (1 / (1 - n / a)) - b * math.cos(math.radians(angle))
    print(math.sqrt(((b * math.cos(math.radians(angle)) + x) ** 2 + a ** 2)) - math.sqrt(n ** 2 + x ** 2))

Buggy submission (verdict: Runtime Error):
import math
a, b, h, m = map(int, input().split())
angle = abs(90 - abs(h * 30 + (m / 60) * 30 - m * 6))
n = b * math.sin(math.radians(angle))
x = b * math.cos(math.radians(angle)) * (1 / (1 - n / a)) - b * math.cos(math.radians(angle))
print(math.sqrt(((b * math.cos(math.radians(angle)) + x) ** 2 + a ** 2)) - math.sqrt(n ** 2 + x ** 2))
Problem p02684 (python)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
l = [0]
s = set()
s.add(0)
cur = a[0] - 1
while True:
    if cur in s:
        break
    else:
        s.add(cur)
        l.append(cur)
        cur = a[cur] - 1
i = l.index(cur)
if k <= i:
    print(l[k] + 1)
else:
    print(l[(k - i) % (len(l) - i) + i] + 1)

Buggy submission (verdict: Runtime Error):
def dfs(now):
    global m
    if now in l:
        m = now
        return None
    else:
        l.append(now)
        dfs(a[now - 1])
n, k = map(int, input().split())
a = list(map(int, input().split()))
m = float("inf")
l = []
cycle = float("inf")
ans = []
dfs(a[0])
for i in range(len(l)):
    if l[i] == m:
        ans = l[i:]
        cycle = len(ans)
if k % cycle == 0:
    print(ans[-1])
else:
    print(ans[(k - (len(l) - cycle)) % cycle - 1])
Problem p02743 (python)

Fixed submission:
from decimal import Decimal
a, b, c = map(int, input().split())
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from math import sqrt
if c - a - b > 0 and 2 * sqrt(a * b) < c - a - b:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import sqrt from math
a, b, c = map(int, input().split())
if a + b + sqrt(a * b) < c:
    print("Yes")
else:
    print("No")
Problem p02772 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
for i in A:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      continue
    else:
      print("DENIED")
      exit()
  else:
    continue
print("APPROVED")

Buggy submission (verdict: Runtime Error):
N = int(input())
numbers = list(map(int, input().split()))
for number in nunbers:
  if number % 2 == 0:
    if number % 3 != 0 or number % 5 != 0:
      print("DENIED")
      break
print("APPROVED")
Problem p02775 (python)

Fixed submission:
n = input()[::-1]
dp = [[0, 0] for i in range(len(n) + 1)]
dp[0][1] = 1
for i in range(len(n)):
    dp[i + 1][0] = min(dp[i][0] + int(n[i]), dp[i][1] - int(n[i]) + 10)
    dp[i + 1][1] = min(dp[i][0] + int(n[i]) + 1, dp[i][1] - int(n[i]) + 9)
print(dp[len(n)][0])

Buggy submission (verdict: Runtime Error):
n = input()[::-1]
dp = [[0, 0] for i in range(len(n) + 1)]
dp[0][1] = 1
for i in range(len(n)):
    dp[i + 1][0] = min(dp[i][0] + int(n[i]), dp[i][1] - int(n[i]) + 10)
    dp[i + 1][1] = min(dp[i][0] + int(n[1]) + 1, dp[i][1] - int(n[i]) + 9)
print(dp[len(n)][0])
Problem p02780 (python)

Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))
l = [0] * (n + 1)
ans = []
for i in range(n):
    l[i + 1] = l[i] + (p[i] + 1) / 2
for i in range(n - k + 1):
    ans.append(l[i + k] - l[i])
print(max(ans))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
l = [0] * n
ans = []
l[0] = (p[0] + 1) / 2
for i in range(1, n):
    l[i] = l[i - 1] + (p[i] + 1) / 2
for i in range(n - k):
    ans.append(l[i + k] - l[i])
print(max(ans))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
l = [0] * n
ans = []
l[0] = (p[0] + 1) / 2
for i in range(1, n):
    l[i] = l[i - 1] + (p[i] + 1) / 2
print(l)
for i in range(n - k):
    ans.append(l[i + k] - l[i])
print(max(ans))
Problem p02783 (python)

Fixed submission:
h,a = map(int, input().split())
ans = 0
if h % a == 0:
  ans = h // a
else:
  ans = h // a + 1
print(ans)

Buggy submission (verdict: Runtime Error):
h,a = map(int, input().split)
ans = 0
if h % a == 0:
  ans = h // a
else:
  ans = h // a + 1
print(ans)

Buggy submission (verdict: Runtime Error):
h,a = int(input())
ans = 0
if h % a == 0:
  ans = h // a
else:
  ans = h // a + 1
print(ans)
Problem p02789 (python)

Fixed submission:
input_numbers = list(map(int,input().split()))
n = input_numbers[0]
m = input_numbers[1]
if n == m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n, m = map(int, input())
if n == m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n, m = map(int, input())
ans = ""
if n == m:
  ans = "Yes"
else:
  ans = "No"
print(ans)
Problem p02804 (python)

Fixed submission:
mod = 10 ** 9 + 7
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
comb = [1] * (n - k + 1)
for i in range(n - k):
    comb[i + 1] = (comb[i] * (k + i) * pow(i + 1, mod - 2, mod)) % mod
ans = 0
for i in range(n - k + 1):
    ans = (ans + a[k + i - 1] * comb[i]) % mod
    ans = (ans - a[i] * comb[-1 - i]) % mod
print(ans)

Buggy submission (verdict: Runtime Error):
from scipy.misc import comb
n, k = map(int, input().split())
a = list(reversed(sorted(list(map(int, input().split())))))
mod = 10 ** 9 + 7
ans = 0
for i in range(n - 1):
    m = int(comb(n - i - 1, k - 1))
    ans += a[i] * m - a[n - i - 1] * m
    ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
from scipy.misc import comb
n, k = map(int, input().split())
a = list(reversed(sorted(list(map(int, input().split())))))
mod = 10 ** 9 + 7
ans = 0
for i in range(n - 1):
    m = int(comb(n - i - 1, k - 1))
    ans += a[i] * m - a[n - i - 1] * m
    ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
from math import comb
n, k = map(int, input().split())
a = list(reversed(sorted(list(map(int, input().split())))))
ma = 0
mi = 0
mod = 10 ** 9 + 7
for i in range(n - 1):
    ma += a[i] * comb(n - i - 1, k - 1)
    ma %= mod
a.reverse()
for i in range(n - 1):
    mi += a[i] * comb(n - i - 1, k - 1)
    mi %= mod
print(ma - mi)
Problem p02811 (python)

Fixed submission:
input1 = list(map(int,input().split()))
K = input1[0]
X = input1[1]
if K * 500 >= X:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
input1 = list(map(int,input().split()))
K = input[0]
X = input[1]
if K * 500 >= X:
  print("Yes")
else:
  print("No")
Problem p02812 (python)

Fixed submission:
n = int(input())
s = input()
print(s.count("ABC"))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
print(count("ABC"))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
list = [str(x) for x in S]
index = 0
abc = 0
for alphabet in list:
  if alphabet == "A" and list[index + 1] == "B" and list[index + 2] == "C":
    abc += 1
  index += 1
print(abc)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
list = [str(x) for x in S]
index = 0
abc = 0
for alphabet in list:
  if alphabet == "A" and list[index + 1] == "B" and list[index + 2] == "C":
    abc += 1
  index += 1
if index != N - 1:
  break
print(abc)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
list = [str(x) for x in S]
index = 0
abc = 0
for alphabet in list:
  if alphabet == "A" and list[index + 1] == "B" and list[index + 2] == "C":
    abc += 1
  index += 1
print(abc)