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

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

new_a=sorted(a,reverse=True)
sums=sum(a)

if new_a[m-1]>=sums/(m*4):
    print("Yes")
else:
    print("No")

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

new_a=sorted(a,reverse=True)
sums=sum(a)

if new_a[m-1]>=sums/(b*4):
    print("Yes")
else:
    print("No")

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

new_a=sorted(a,reverse=True)
sums=sum(a)

if new_a[m-1]>sums/(b*4):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
top=0
sum=0
asp=0
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))

for i in range(n):
    sum=sum+int(a[i-1])
    if a[i-1]<a[i] or i==1:
        top=int(a[i-1])

asp=float(1-(1/(4*m)))
asc=float((1/(4*m))
if top>sum*asp or top/asp>sum:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
top=0
sum=0
asp=0
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))

for i in range(n):
    sum=sum+a[i-1]
    if a[i-1]<a[i] or i==1:
        top=a[n-1]
asp=1-(1/(4*m))
    if top>sum*asp:
        print("No")
    else:
        print("Yes")

Buggy submission (verdict: Runtime Error):
top=0
sum=0
def sort(a,n):
    for i in range(n):
        sum=sum+a[i-1]
        if a[i-1]<a[i] or i==1:
            top=a[n-1]
asp=0
def am(m):
    asp=1-(1/(4*m))
    if top>sum*asp:
        print("No")
    else:
        print("Yes")

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

sort(a,n)
am(m)

Buggy submission (verdict: Runtime Error):
top=0
sum=0
def sort(a,n)
    for i in range(n):
        sum=sum+a[i-1]
        if a[i-1]<a[i] or i==1:
            top=a[n-1]
asp=0
def am(m):
    asp=1-(1/(4*m))
    if top>sum*asp:
        print("No")
    else:
        print("Yes")

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

sort(a,n)
am(m)
Problem p02730 (python)

Fixed submission:
s=input()
n=len(s)
s1=s[:(n-1)//2]
flag=0
for i in range(len(s1)//2):
    if(s1[i]!=s1[-1-i]):
        flag=1
        break

s1=s[(n+3)//2-1:]
for i in range(len(s1)//2):
    if(s1[i]!=s1[-1-i]):
        flag=1
        break

for i in range(n//2):
    if s[i]!=s[-1-i]:
        flag=1
        break

if flag==1:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
def kaibun(s):
    for _ in range(n//2):
        if s[_]==s[n-_-1]:
            continue
        else:
            return False
    return True

s=input()
n=len(s)
if kaibun(s) and kaibun(s[:(n-1)//2])and kaibun(s[(n+3)//2-1:]):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
flag=0


for i in range((n-1)//2):
    if s[i]==s[n-1-i]==s[((n-1)//2)-1-i]:
        flag=flag+1

if v==((n-1)//2)
    print("Yes")
else:
    print("No")
Problem p02732 (python)

Fixed submission:
def main():
    from collections import Counter
    n=int(input())
    a=list(map(int,input().split()))

    ctr = Counter(a)
    frm_n = sum(x * (x - 1) // 2 for x in ctr.values())

    ans = []
    for x in a:
        ans.append(frm_n - ctr[x] + 1)

    print(*ans, sep='\n')


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok

Buggy submission (verdict: Runtime Error):
n=int(input())
a=(input().split())
for i in range(n):
    x=0
    for j in range(n):
        for k in range(n):
            if j>k and a[j]==a[k] and j!=i and k!=i:
                x=x+1
    print(x)
Problem p02741 (python)

Fixed submission:
k=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
s=int(input())
s=s-1
print(k[s])

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
a=int(h/2)+1
b=h/2
c=0


for j in range(w):
        if j%2==1:
            c=c+a
        else:
            c=c+b
    





print(c)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
a=0
b=0
c=0
for i in range(h):
    if i%2==0:
        a=a+1
for j in range(w):
    if j%2==1:
        b=b+1
c=a+b
print(c)

Buggy submission (verdict: Runtime Error):
k[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}
s=input()
print(k[s-1])
Problem p02742 (python)

Fixed submission:
h, w = map(int, input().split())
a=0
if h==1 or w==1:
    a=1
elif h%2==1 and w%2==1:
    a=int(h*w/2)+1
else:
    a=int(h*w/2)

print(a)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
for i in range(h):
    if i%2==0:
        a=a+1
for j in range(w):
    if j%2==1:
        b=b+1
c=a+b
print(c)
Problem p02743 (python)

Fixed submission:
import math
a,b,c = map(int, input().split())
x=a**2+b**2+c**2+2*a*b-2*b*c-2*a*c
y=4*a*b

if c-b-a>0 and x-y>0 :
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
def Judgement(x,y,z):
    if z-x-y>0 and (z-x-y)**2-4*x*y>0:
        return 0
    else:
        return 1

a,b,c=map(int,input().split())
ans=Judgement(a,b,c)
if ans=0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
def Judgement(x,y,z):
    if z-x-y-2*(x*y)**(1/2)<=0:
        return -1
    elif z-x-y<=0:
        return -1
    elif (z-x-y)**2-4*x*y<=0
        return -1
    else:
        return 0

a,b,c=map(int,input().split())
ans=Judgement(a,b,c)
if ans=-1:
    print("No")
else:
    print("Yes")

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

if c-b-a>0 and {(c-a-b)**2}-4*a*b>0 :
    print("Yes")
else:
    print("No")

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

if c-b-a>0 and (c-a-b)**2-4ab>0 :
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import math
x,y,z = map(long, input().split())

a=math.sqrt(x)
b=math.sqrt(y)
ab=2*a*b

if z-x-y-ab>0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import math
x,y,z = map(int, input().split())

a=math.sqrt(x)
b=math.sqrt(y)
c=math/sqrt(z)

aa=a**2
bb=b**2
cc=c**2
ab=2*a*b

if cc-aa-bb-ab>0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import math
x,y,z = map(int, input().split())

a=math.sqrt(x)
b=math.sqrt(y)
c=math/sqrt(z)

aa=a**2
bb=b**2
cc=c**2
ab=2*a*b

if cc-aa-bb-ab>0:
    print("Yes")
else:
    print("No")

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

cc=c**2
aa=a**2
bb=b**2
ab=math.sqrt(2ab)

if cc-aa-bb-ab>0:
    print("Yes")
else:
    print("No")
Problem p02761 (python)

Fixed submission:
N, M = (int(x) for x in input().split())

A = [list(map(int, input().split())) for i in range(M)]

X = ['0' for i in range(N)]#0で埋めつくす
X[0] = '1'
for i in A:
    X[i[0] - 1] = str(i[1])#条件関係なしに代入
    #print(X)

F = 1
for i in A:
    if N > 1 and i[0] == 1 and i[1] == 0:#条件から逸脱する条件
        F = 0
    for j in A:
        #print(j)
        if i[0] == j[0] and i[1] != j[1]:
            F = 0
            
if N == 1 and M == 0:
    print(0)
elif F == 1:
    print(''.join(X))
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
def judgement(s,c,n,m):
    for i in range(m):
        for j in range(m):
            if (s[i]==s[j] and c[i]!=c[j]) or (s[i]==1 and c[i]==0):
                return False
    return True

def num(m,n,c,s,x):
    for i in range(n):
        for j in range(m):
            if s[i]-1==j:
                x[j]=c[i]
                #print(m,n,c,s,x)
    #print(m,n,c,s,x)
    if x[0]==0:
        x[0]==1
    x="".join(map(str,x))
    print(x)

n,m=list(map(int,input().split()))
s=[0]*m
c=[0]*m
x=[0]*n
for i in range(m):
    a=list(map(int,input().split()))
    s[i]=a[0]
    c[i]=a[1]
for i in range(n):
    x[i]=0

r=judgement(s,c,n,m)
if (r==True):
    num(m,n,c,s,x)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
def judgement(s,c,n,m):
    for i in range(m):
        for j in range(m):
            if (s[i]==s[j] and c[i]!=c[j]) or (s[i]==1 and c[i]==0):
                return False
    return True

def num(m,n,c,s,x):
    for i in range(n):
        for j in range(m):
            if s[i]-1==j:
                x[j]=c[i]
                #print(m,n,c,s,x)
    #print(m,n,c,s,x)
    x="".join(map(str,x))
    print(x)

n,m=list(map(int,input().split()))
s=[0]*m
c=[0]*m
x=[0]*n
for i in range(m):
    a=list(map(int,input().split()))
    s[i]=a[0]
    c[i]=a[1]
for i in range(n):
    x[i]=0

r=judgement(s,c,n,m)
if (r==True):
    num(m,n,c,s,x)
else:
    print(-1)
Problem p02803 (python)

Fixed submission:
from collections import defaultdict
import heapq
import math

H, W = map(int, input().split())

edges = defaultdict(list)
field = []

for _ in range(H):
    field.append(input())

weight = 1
for i in range(H):
    for j in range(W):
        if j + 1 < W and field[i][j] == '.' and field[i][j + 1] == '.':
            edges[W * i + j].append((W * i + j + 1, weight))
            edges[W * i + j + 1].append((W * i + j, weight))
        if i + 1 < H and field[i][j] == '.' and field[i + 1][j] == '.':
            edges[W * i + j].append((W * (i + 1) + j, weight))
            edges[W * (i + 1) + j].append((W * i + j, weight))


def dijkstra(s):
    que = []
    dist = [float('inf')] * (H * W)
    dist[s] = 0
    heapq.heappush(que, (0, s))

    while que:
        p = heapq.heappop(que)
        v = p[1]
        if dist[v] < p[0]:
            continue
        for i in range(len(edges[v])):
            e = edges[v][i]
            if dist[e[0]] > dist[v] + e[1]:
                dist[e[0]] = dist[v] + e[1]
                heapq.heappush(que, (dist[e[0]], e[0]))

    dist = [0 if d == float('inf') else d for d in dist]
    return dist


ans = 0
for i in range(H*W):
    ans = max(ans, max(dijkstra(i)))

print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ac=0
ans=[True]*n
wa=[0]*n
for i in range(m):
    p,s=input().split()
    p=int(p)-1
    if s=="AC" and ans[p]:
        ans[p]=False
        ac+=1
    elif s=="WA" and ans[p]:
        wa[p]+=1

cnt=0
for i in range(n):
    if not ans[i]:
        cnt+=wa[i]

print(ac,cnt)
Problem p02619 (python)

Fixed submission:
#B

import numpy as np
D = int(input())
C = list(map(int,input().split()))
S = np.empty((D,26))
for i in range(D):
    l = list(map(int,input().split()))
    for j in range(26):
        S[i][j] = l[j]
        
#開催日時の記録
R = np.zeros(26)

sc = 0

#与えられたtでスコアを計算
for i in range(1,D+1):
    
    #ランダムに開催するコンテストを選ぶ
    con = int(input()) - 1
    
    #スコア計算
    #コンテスト開催による上昇
    sc += S[i-1][con]
    R[con] = i
    
    #コンテスト非開催による減少
    for j in range(26):
        sc -= C[j]*(i-R[j])
        
    print(int(sc))

Buggy submission (verdict: Runtime Error):
#B

import numpy as np
D = int(input())
C = list(map(int,input().split()))
S = np.empty((D,26))
for i in range(D):
    l = list(map(int,input().split()))
    for j in range(26):
        S[i][j] = l[j]
        
#開催日時の記録
R = np.zeros(26)

sc = 0
for i in range(1,D+1):
    
    #ランダムに開催するコンテストを選ぶ
    con = int(input()) - 1
    
    #スコア計算
    #コンテスト開催による上昇
    sc += S[i-1][con]
    R[con] = i
    
    #コンテスト非開催による減少
    for j in range(26):
        sc -= C[j]*(i-R[j])
        
    print(sc)
Problem p03210 (python)

Fixed submission:
x = int(input())
a = False
if x == 7 or x == 5 or x == 3:
  a = True
  
print('YES' if a else 'NO')

Buggy submission (verdict: Runtime Error):
x = int(input())
a = False
if x = 7 or x = 5 or x = 3:
  a = True
  
print('YES' if a else 'NO')
Problem p03238 (python)

Fixed submission:
n = int(input())

if n == 1:
    print('Hello World')
    exit()
else:
    a = list([input() for i in range(2)])
    print(int(a[0])+int(a[1]))

Buggy submission (verdict: Runtime Error):
n = int(input())
if n == 1:
  print('Hello World')
  exit()
else:
  a = list(map(int, input().split()))
  print(a[0]+a[1])
Problem p03280 (python)

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

print((a-1)*(b-1))

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

print((a-1)*(b-1))
Problem p03285 (python)

Fixed submission:
n = int(input())
a = n//4
b = n//7
ans = False

for i in range(a+1):
  for j in range(b+1):
    if i*4+j*7 == n:
      ans = True

if ans == True:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
if n%4 == 0　or n%7 == 0:
  print('Yes')
  exit()
 
for _ in range(n//7):
  n -=7
if n == 4:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
if n%4 ==0　or n%7 == 0:
  print('Yes')
  exit()
 
for _ in range(n//7):
  n -=7
if n == 4:
  print('Yes')
else:
  print('No')
Problem p03289 (python)

Fixed submission:
s = str(input())
if s[0] == 'A' and s[2:-1].count('C') == 1 and (s[1:s.find('C')]+s[s.find('C')+1:]).islower():
    print('AC')
else:
    print('WA')

Buggy submission (verdict: Runtime Error):
s = input()
k = False
if s[0] == 'A' and s[2:-1].count('C') == 1:
    t = s[1:s.find('C')] + s[s.find('C')+1:]
    k = t.islower():
print('AC' if k else 'WA')

Buggy submission (verdict: Runtime Error):
s = input()
k = False
if s[0] != 'A':
    print('WA')
    exit()
else:
    for i in range(len(s)-1):
        if s[i] == 'C':
            s = s[1:i-1] + s[i+1:]
            k =s.islower()
print('AC' if k else 'WA')

Buggy submission (verdict: Runtime Error):
s = str(input())
 
if s[0] != 'A':
    print('WA')
    break
else:
    for i in range(len(s)-1):
        if s[i] == 'C':
            s = s[1:i-1] + s[i+1:]
            break
    if s.islower() == True:
        print('AC')
    else:
        print('WA')

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

if s[0] != A:
    print('WA')
    break
else:
    for i in range(len(s)-1):
        if s[i] == C:
            s = s[1:i-1] + s[i+1:]
            break
    if s.islower() == True:
        print('AC')
    else:
        print('WA')

Buggy submission (verdict: Runtime Error):
s = str(input())
ans = 0
if s[0] == 'A':
    for i in range(3, len(s)-1):
        if s[i] == 'C':
            ans += 1
        if s[i].isupper() or s[1].isuuper():
            print('WA')
            exit()
    
    if ans == 1:
        print('AC')
        exit()
else:
    print('WA')
Problem p03293 (python)

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

for i in range(len(s)):
    ss = s[-i:]+s[:-i]
    if ss == t:
        print('Yes')
        exit()
print('No')

Buggy submission (verdict: Runtime Error):
s = str(input())
t = str(input())
k = False
for i in range(len(s)):
  s = s[-i] + s[:-i]
  if s == t:
    k = True
    break
    
print('Yes' if k else 'No')

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

Z =False

if i in range(len(s)):
    s = s[-1] + s[:-1]
    if s == t:
        Z =True
        exit()
        
print('Yes' if Z else 'No')

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

Z =False

if i in range(lens(s)):
    s = s[-1] + s[:-1]
    if s == t:
        Z =True
        break
        
print('Yes' if Z else 'No')
Problem p03316 (python)

Fixed submission:
n = int(input())
sum = 0
ans = n

while ans > 0:
  sum += ans % 10
  ans //= 10

if n%sum == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
s = 0
x = len(n)
for i in range(x):
  a = n[-1 * i]
  s = s+ a
  
if n%a == 0:
  print('Yes')
else:
  print('No')
Problem p03323 (python)

Fixed submission:
a, b = map(int, input().split())
 
if a <= 8 and b <= 8:
  print('Yay!')
else:
  print(':(')

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

if a <= 8 and b <= 8:
  print(Yay!)
else:
  print(:()
Problem p03455 (python)

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

i = a*b

if i%2 == 0:
  print('Even')
else:
  print('Odd')

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

c = a * b

if c % 2 == 0:
  print('Even')
  else:
    print('Odd')

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

if a*b/2 % 1:
  print('Odd')
 else:
  print('Even')

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

if a * b / 2 % 1:
  print('Odd')
else
  print('Even')
Problem p02681 (python)

Fixed submission:
S = input()
T = input()


S = list(S)
T = list(T)


def check(S,T):
    len_S = len(S)
    len_T = len(T)

    for i in range(len_S):
        if S[i] != T[i]:
            return "No"

    return "Yes"

result = check(S,T)
print(result)

Buggy submission (verdict: Runtime Error):

S = input()
T = input()

S = list(S)
T = list(T)


def check(S,T):
    len_S = len(S)
    len_T = len(T)

    if len_T - len_S != 1:
        return "No"
    else:
        for i in range(len_S):
            if S[i] != T[i]:
                print(No)
                return "No"

        if i == len_S-1:
            return "Yes"

result = check(S,T)
print(result)
Problem p02621 (python)

Fixed submission:
a = int(input())
print(a + pow(a, 2) + pow(a,3))

Buggy submission (verdict: Runtime Error):
from numba import njit

@njit("i8(i8)")
def solve(n):
    s = [1] * (n+1)
    ans = 1
    for i in range(2,n+1):
        for j in range(i,n+1,i):
            s[j] += 1
        ans += (i * s[i])
	return ans
n = int(input()) 
print(solve(n))
Problem p02741 (python)

Fixed submission:
n = int(input()) - 1
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[n])

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

Fixed submission:
if __name__ == "__main__":
    N, K = list(map(int, input().split()))
    r = N%K
    if r < abs(r-K):
        print(r)  
    else:
        print(abs(r-K))

Buggy submission (verdict: Runtime Error):
if __name__ == "__main__":
	N, K = list(map(int, input().split()))
    r = N%K
    print(r) if r < abs(r-K) else print(abs(r-K))
Problem p02647 (python)

Fixed submission:
import sys
from itertools import accumulate
input=sys.stdin.buffer.readline

def main():
    n, k = map(int, input().split())
    A = [*map(int, input().split())]
    
    # for _ in range(min(k,int(math.log(n,2)))):
    
    for _ in "_"*k:
        b=[0]*(n)
        
        for i,v in enumerate(A):
            if i>v:
            # b[max(0,i-v)]+=1
                b[i-v]+=1
            else:
                b[0]+=1
            j=i-~v
            # if i+v+1<n:
            #     b[i+v+1]-=1
            if j<n:
                b[j]-=1
        
        # update ans
        # cnt=0
        # for i in range(1,n):
        #     b[i]+=b[i-1]
        A=[*accumulate(b)]
        
        if min(A)==n:
            break
    print(" ".join(map(str,A)))

if '__main__' == __name__:
    main()

Buggy submission (verdict: Runtime Error):
from itertools import accumulate

def main():
    n, k = map(int, input().strip().split())
    A = list(map(int, input().strip().split()))
    
    # for _ in range(min(k,int(math.log(n,2)))):
    
    
    def solve():
        nonlocal A
        for _ in range(k):
            b=[0]*(n+1)
            
            for i in range(n):
                b[max(0,i-A[i])]+=1
                b[min(n,i+A[i]+1)]-=1
            
            # update ans
            # cnt=0
            # for i in range(1,n):
            #     b[i]+=b[i-1]
            a=[*accumulate(b)]
            A=b
            if min(A)==n:
                break
        print(*A[:-1])
    solve()

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

Fixed submission:
from collections import Counter
n = int(input().strip())
L = list(map(int, input().strip().split()))
seen=Counter()
ans=0
for j in range(n):
    # if j-L[j] in seen:
    ans+=seen[j-L[j]]
    seen[L[j]+j]+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input().strip())
L = list(map(int, input().strip().split()))
seen=set()
ans=0
for j in range(n):
    if j-L[j] in seen:
        ans+=1
    seen.add(A[j]+j)
print(ans)
Problem p02696 (python)

Fixed submission:
import math
a, b, n = map(int, input().strip().split())
x=min(b-1,n)
print(math.floor(a*x/b)-a*math.floor(x/b))

Buggy submission (verdict: Runtime Error):
n, m, q = map(int, input().strip().split())
L = [list(map(int, input().split())) for _ in range(q)]

possibleA=[[i]*n for i in range(1,m+1)]
for i in range(n):
    for j in range(i+1,m+1):
        

import math
a, b, n = map(int, input().strip().split())
if b<n:
    x=n
elif n % b <= n%(b/a):
    x=n-n%b-1
elif (n%b-n%(b/a)+1)//(b/a)>a*b:
    x=n-n%b-1
else:
    x=n
print(math.floor(a*x/b)-a*math.floor(x/b))
Problem p02756 (python)

Fixed submission:
S=input()
Q=int(input())

# deq=deque()
# for s in S:
#     deq.append(s)

rev=False
front=""
last=""
# ans+=S

for _ in range(Q):
    query=input().split()
    if query[0]=="1":
        rev = not rev
        # print(rev)
    else:
        if rev:
            query[1]=str(3-int(query[1]))
        if query[1]=="1":
            # deq.appendleft(query[2])
            front=query[2]+front
        else:
            # deq.append(query[2])
            last+=query[2]

# if rev:
#     deq.reverse()
# # ans=""
# for i in range(len(deq)):
#     ans+=deq[i]

if not rev:
    print(front+S+last)
else:
    print(last[::-1]+S[::-1]+front[::-1])

Buggy submission (verdict: Runtime Error):
from collections import deque
s=input()
Q=int(input())

ans=deque()
ans.append(s)
rev=False

for _ in range(Q):
    query=input().split()
    if query[0]=="1":
        rev = not rev
    else:
        if rev:
            query[1]=str(3-int(query[1]))
        if query[1]=="1":
            ans.appendleft(query[2])
        else:
            ans.append(query[2])

if not rev:
    for si in ans:
        print(si,end="")
else:
    for i in range(len(ans),0,-1):
        print(ans[i],end="")

Buggy submission (verdict: Runtime Error):
s=[input()]
Q=int(input())

rev=-1
for i in range(Q):
    que=input().split()
    if que[0]=="1":
        rev*=-1
    else:
        if que[1]=="1":
            if rev>0:
                s.append(que[2])
            else:
                s=[que[2]]+s
        else:
            if rev<0:
                s.append(que[2])
            else:
                s=[que[2]]+s
if rev<0:
    for si in s:
        print(si,end="")
else:
    for i in range(len(s),0,-1):
        print(s[i],end="")
Problem p02767 (python)

Fixed submission:
n = int(input().strip())
L = list(map(int, input().strip().split()))
ans=10**6+1
for p in range(max(L)+1):
    tmp=0
    for x in L:
        tmp+=(x-p)**2
    ans=min(ans,tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input().strip())
L = list(map(int, input().strip().split()))
ans=10**6+1
for p in range(max(L[-1])+1):
    tmp=0
    for x in L:
        tmp+=(x-p)**2
    ans=min(ans,tmp)
print(ans)
Problem p02780 (python)

Fixed submission:
n, k = map(int, input().strip().split())
p = list(map(int, input().strip().split()))

def calc_exp(n):
    exp=1+(n-1)*0.5
    return exp

tmp=sum(p[:k])
mx=tmp
ind=0
for i in range(1,n-k+1):
    # tmp=sum(p[i:i+k])
    tmp-=p[i-1]
    tmp+=p[i+k-1]
    if mx<tmp:
        ind=i
        mx=tmp
        
ans=0
for i in range(k):
    ans+=1+(p[ind+i]-1)*0.5
    
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().strip().split())
p = list(map(int, input().strip().split()))

def calc_exp(n):
    exp=1+(n-1)*0.5
    return exp

tmp=sum(p[:k])
mx=tmp
for i in range(1,n-k+1):
    # tmp=sum(p[i:i+k])
    tmp-=p[i-1]
    tmp+=p[i+k-1]
    if mx<tmp:
        ind=i
        mx=tmp
        
ans=0
for i in range(k):
    ans+=1+(p[ind+i]-1)*0.5
    
print(ans)