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

Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# nCr
def nCr(n,r):
  if n<r:
    return 0
  return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))

def main():
  n,p=LI()
  l=LI()

  la=[]
  lb=[]

  for x in l:
    if x%2==1:
      la.append(x)
    else:
      lb.append(x)

  # lbから偶数個選ぶ方法は何通り？
  bc=0
  for i in range(len(lb)+1):
    bc+=nCr(len(lb),i)
    # print(bc)

  ans=0
  for i in range(len(la)+1):
    if p==0:
      r=i*2
    else:
      r=i*2+1

    ans+=nCr(len(la),r)*bc

  return ans

print(main())

Buggy submission (verdict: Runtime Error):
import math
def ncr(n,r):
  return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
n,p=map(int,input().split())
l=list(map(int,input().split()))
l1=[]
l2=[]
for i in l:
  if i%2==0:
    l1.append(i)
  else:
    l2.append(i)
c=0
su=0
le1=len(l1)
le2=len(l2)
while True:
  if le1+le2<c:
    break
  if c%2==0:
    if le1+le2>=c:
      su+=ncr(le1+le2,c)
    c+=1
  else:
    if le1>=c:
      su+=ncr(le1,c)
    c+=1
if p==0:
  print(su)
else:
  dkafj;lsjfal;
Problem p03715 (python)

Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  h,w=LI()

  if h%3==0 or w%3==0:
    return 0

  ans=inf
  for i in range(1,h):
    a=i*w
    b=(h-i)*(w//2)
    c=(h-i)*(-(-w//2))
    ans=min(ans,max([a,b,c])-min([a,b,c]))

    a=i*w
    b=(h-i)//2*w
    c=-(-(h-i)//2)*w
    ans=min(ans,max([a,b,c])-min([a,b,c]))

  for i in range(1,w):
    a=i*h
    b=(w-i)*(h//2)
    c=(w-i)*(-(-h//2))
    ans=min(ans,max([a,b,c])-min([a,b,c]))

    a=i*h
    b=(w-i)//2*h
    c=-(-(w-i)//2)*h
    ans=min(ans,max([a,b,c])-min([a,b,c]))

  return ans

# main()
print(main())

Buggy submission (verdict: Runtime Error):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  h,w=LI()

  if h%3==0 or w%3==0:
    return 0

  ans=inf
  for i in range(1,h):
    a=i*w
    b=(h-i)*w//2
    c=(h-i)*(-(-w)//2)
    ans=min(ans,max([a,b,c])-min([a,b,c]))
    if a+b+c!=h*W:
      aaa

    a=i*w
    b=(h-i)//2*w
    c=-(-(h-i)//2)*w
    ans=min(ans,max([a,b,c])-min([a,b,c]))
    if a+b+c!=h*W:
      aaa

  for i in range(1,w):
    a=i*h
    b=(w-i)*h//2
    c=(w-i)*(-(-h)//2)
    ans=min(ans,max([a,b,c])-min([a,b,c]))
    if a+b+c!=h*W:
      aaa

    a=i*h
    b=(w-i)//2*h
    c=-(-(w-i)//2)*h
    ans=min(ans,max([a,b,c])-min([a,b,c]))
    if a+b+c!=h*W:
      aaa

  return ans

# main()
print(main())
Problem p03720 (python)

Fixed submission:
n,m=map(int,input().split())
dic={}
for i in range(m):
  x,y=map(int,input().split())
  if x in dic:
    dic[x]+=1
  else:
    dic[x]=1
  if y in dic:
    dic[y]+=1
  else:
    dic[y]=1
for i in range(1,n+1):
  try:
    print(dic[i])
  except:
    print(0)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
dic={}
for i in range(m):
  x,y=map(int,input().split())
  if x in dic:
    dic[x]+=1
  else:
    dic[x]=1
  if y in dic:
    dic[y]+=1
  else:
    dic[y]=1
for i in range(1,n+1):
  print(dic[i])
Problem p03845 (python)

Fixed submission:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
s=sum(t)
l=[]
for i in range(m):
  p,x=map(int,input().split())

  l.append(s-t[p-1]+x)
for i in l:
  print(i)

Buggy submission (verdict: Runtime Error):
# 入力
N=int(input())
tl=list(map(int,input().split()))
M=int(input())

# 和
sm=sum(tl)

al=[]
for i in range(N):
  P,X=map(int,input().split())

  # 変更した場合の変化量を求める
  a=X-tl[P-1]

  # 解答を保存
  al.append(sm+a)

# 出力
for x in al:
  print(x)

Buggy submission (verdict: Runtime Error):
# 入力
N=int(input())
tl=list(map(int,input().split()))
M=int(input())

# 和
sm=sum(tl)

for i in range(N):
  P,X=map(int,input().split())

  # 変更した場合の変化量を求める
  a=X-tl[P-1]

  # 出力
  print(sm+a)
Problem p03862 (python)

Fixed submission:
n,x=map(int,input().split())
l=list(map(int,input().split()))
c=0 
for i in range(n-1):
  a=l[i]
  b=l[i+1]
  if a+b<=x:
    continue
  c1=a+b-x
  c+=c1
  if b>=c1:
    l[i+1]-=c1
  else:
    l[i]-=c1-b
    l[i+1]=0
print(c)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=list(map(int,input().split()))
c=0
if x==9:
  exit()
for i in range(n-1):
  a=l[i]
  b=l[i+1]
  if a+b>x:
    c+=a+b-x
    if b>=a-x and a>=x:
      l[i+1]-=a+b-x
      print('処理A')
    else:
      l[i+1]=0
      l[i]-=x-b
      print('処理B')
    print(l)
print(l)
print(c)
Problem p03964 (python)

Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  t,a=LI()
  l=[LI() for _ in range(n-1)]

  # t<=nt' and a<=na'
  # t/t'<=n and a/a'<=n
  for _t,_a in l:
    _n=max(-(-t//_t),-(-a//_a))
    t=_n*_t
    a=_n*_a

  return t+a

# main()
print(main())

Buggy submission (verdict: Runtime Error):
https://atcoder.jp/contests/abc046/tasks/arc062_a
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  t,a=LI()
  l=[LI() for _ in range(n-1)]

  # t<=nt' and a<=na'
  # t/t'<=n and a/a'<=n
  for _t,_a in l:
    _n=max(-(-t//_t),-(-a//_a))
    t=_n*_t
    a=_n*_a

  return t+a

# main()
print(main())
Problem p04030 (python)

Fixed submission:
s=list(input())
a=''
for i in s:
  if i=='0' or i=='1':
    a+=i
  else:
    if len(a)!=0:
      a=a[:len(a)-1]
print(a)

Buggy submission (verdict: Runtime Error):
# 入力
s=input()

a=''
for x in s:
  if x=='0':
    a+='0'
  elif x=='1'
    a+='1'
  else:
    # 文字列が空でない場合、末尾を削除
    if a!='':
      a=a[:-1]

# 出力
print(a)
Problem p04045 (python)

Fixed submission:
l=[str(x) for x in range(100000)]
n,k=map(int,input().split())
l2=list(map(str,input().split()))
ind=l.index(str(n))
while True:
  a=l[ind]
  f=False
  for x in l2:
    if x in a:
      f=True
  if not f:
    break
  ind+=1
print(a)

Buggy submission (verdict: Runtime Error):
# 0〜9
l=list(range(10))

# 入力
N,K=map(str,input().split())
l2=list(map(int,input().split()))

ans=''
f=False

# 使用可能な数字を求める
for x in l2:
  l.remove(x)

# Nと桁数が一致する場合
if int(N[0])<l[-1]:
  for i in range(len(N)):
    for x in l:
      if f:
        ans+=str(x)
        break
      elif int(N[i])<x:
        f=True
        ans+=str(x)
        break
      elif int(N[i])==x:
        ans+=str(x)
        break
# Nと桁数が一致する可能性がある場合
elif int(N[0])==l[-1]:
  l3=list(N[1:])
  l3=list(map(int,set(l3)))
  l3.sort()

  # Nと桁数が一致しない
  if l3[-1]>l[-1]:
    # 最上位は0以外の最小の数にする
    if l[0]==0:
      ans+=str(l[1])
      ans+='0'*len(N)
    else:
      ans+=str(l[0])*(len(N)+1)

  # Nと桁数が一致する
  else:
    for i in range(len(N)):
      for x in l:
        if f:
          ans+=str(x)
          break
        elif int(N[i])<x:
          f=True
          ans+=str(x)
          break
        elif int(N[i])==x:
          ans+=str(x)
          break

# Nと桁数が一致しない場合
else:
  # 最上位は0以外の最小の数にする
  if l[0]==0:
    ans+=str(l[1])
    ans+='0'*len(N)
  else:
    ans+=str(l[0])*(len(N)+1)

# 出力
print(ans)

Buggy submission (verdict: Runtime Error):
# 0〜9
l=list(range(10))

# 入力
N,K=map(str,input().split())
l2=list(map(int,input().split()))

ans=''
f=False

# 使用可能な数字を求める
for x in l2:
  l.remove(x)

# Nと桁数が一致する場合
if int(N[0])<l[-1]:
  for i in range(len(N)):
    for x in l:
      if f:
        ans+=str(x)
        break
      elif int(N[i])<x:
        f=True
        ans+=str(x)
        break
      elif int(N[i])==x:
        ans+=str(x)
        break
# Nと桁数が一致する可能性がある場合
elif int(N[0])==l[-1]:
  l3=list(N[1:])
  l3=list(map(int,set(l3)))
  l3.sort()

  # Nと桁数が一致しない
  if l3[-1]>l[-1]:
    # 最上位は0以外の最小の数にする
    if l[0]==0:
      ans+=str(l[1])
      ans+='0'*int(N)
    else:
      ans+=str(l[0])*(N+1)

  # Nと桁数が一致する
  else:
    for i in range(len(N)):
      for x in l:
        if f:
          ans+=str(x)
          break
        elif int(N[i])<x:
          f=True
          ans+=str(x)
          break
        elif int(N[i])==x:
          ans+=str(x)
          break

# Nと桁数が一致しない場合
else:
  # 最上位は0以外の最小の数にする
  if l[0]==0:
    ans+=str(l[1])
    ans+='0'*int(N)
  else:
    ans+=str(l[0])*(N+1)

# 出力
print(ans)
Problem p02612 (python)

Fixed submission:
n=int(input())
a=1000
while a<n:
  a=a+1000
print(a-n)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=1000
while a<n:
  a=a+1000
 print(a-n)
Problem p03828 (python)

Fixed submission:
from math import factorial

n = int(input())
f = factorial(n)

mod = 10 ** 9 + 7

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n ** 0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

ans = 1
for p in primes(n):
    temp = 1
    while f % p == 0:
        temp += 1
        f //= p
    ans = (ans * temp) % mod
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
p=[1 for i in range(10000)]
p[0]=0
p[1]=0
for i in range(2,n+1):
  if p[i]==1:
  	for j in range(i*i,n+1,i):
      p[j]=0
ans=1
for i in range(2,n+1):
  if p[i]:
    c=0
    k=i
    while n//k>0:
      c=c+(n//k)%m
      k=k*k
    ans=(ans*((c+1)%m))%m
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
p=[0 for i in range(10000)]
p[0]=0
p[1]=0
for i in range(2,n+1):
  if p[i]==1:
  	for j in range(i*i,n+1,i):
      p[j]=0
ans=1
for i in range(2,n+1):
  if p[i]:
    c=0
    k=i
    while n//k>0:
      c=c+(n//k)%m
      k=k*k
    ans=(ans*((c+1)%m))%m
print(ans)
Problem p03844 (python)

Fixed submission:
a,b,c=map(str,input().split())
if b=="+":
  print(int(a)+int(c))
else:
  print(int(a)-int(c))

Buggy submission (verdict: Runtime Error):
a,b,c=map(str,input().split())
if b=="+":
  print(int(a)+int(b))
else:
  print(int(a)-int(b))
Problem p03845 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
l=[0]+l
s=sum(l)
k=int(input())
for _ in range(k):
  m,n=map(int,input().split())
  print(s-l[m]+n)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
l=[0]+l
s=sum(l)
k=int(input())
for _ in range(1,n+1):
  m,n=map(int,input().split())
  print(s-l[m]+n)
Problem p04030 (python)

Fixed submission:
s=input()
l=[]
for i in s:
  if i=="0":
    l.append("0")
  elif i=="1":
    l.append("1")
  elif i=="B":
    if l!=[]:
    	l.pop()
if l==[]:
  print("")
else:
  print("".join(l))

Buggy submission (verdict: Runtime Error):
s=input()
l=[]
for i in s:
  if i=="0":
    l.append("0")
  elif i=="1":
    l.append("1")
  else:
    l.pop()
print("".join(l))
Problem p04045 (python)

Fixed submission:
def check(n,s):
    v=str(n)
    for i in v:
        if i in s:
            return False
    return True
def solve():
    n,k=map(int,input().split())
    s=input().split()
    s=set(s)
 
    while True:
        if check(n,s):
            print(n)
            break
        else:
            n+=1
for _ in range(1):
    solve()

Buggy submission (verdict: Runtime Error):
def check(n,s):
    v=str(n)
    for i in v:
        if i in s:
            return False
    return True 
def solve():
    n,k=mp()
    s=input().split()
    s=set(s)
 
    while True:
        if check(n,s):
            print(n)
            break
        else:
            n+=1
for _ in range(1):
    solve()
Problem p02641 (python)

Fixed submission:
import bisect
x,n=map(int,input().split())
l=list(map(int,input().split()))
k=[0]*(102)
for i in l:
    k[i]=1
s=10000
for i in range(102):
    if k[i]==1:
        continue
    if abs(x-i)<s:
        s=abs(x-i)
        ans=i
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
x,n=map(int,input().split())
l=list(map(int,input().split()))
k=[0]*(101)
for i in l:
    k[i]=1
s=10000
for i in range(1,101):
    if k[i]==1:
        continue
    if abs(x-i)<s:
        s=abs(x-i)
        ans=i
print(ans)
Problem p03695 (python)

Fixed submission:
N=int(input())
List = list(map(int, input().split()))
sumList = [0]*8
mid = 0
for i in range(N):
  if 1<=List[i]<=399:
    sumList[0] += 1
  elif 400<= List[i] <=799:
    sumList[1] += 1
  elif 800 <= List[i] <= 1199:
    sumList[2] += 1
  elif 1200<= List[i] <=1599:
    sumList[3] += 1
  elif 1600<= List[i] <=1999:
    sumList[4] += 1
  elif 2000 <= List[i] <= 2399:
    sumList[5] += 1
  elif 2400 <= List[i] <= 2799:
    sumList[6] += 1
  elif 2800 <= List[i] <= 3199:
    sumList[7] += 1
  elif 3200 <= List[i]:
    mid += 1
res1 = 8 - sumList.count(0)
res2 = res1 + mid
if res1 == 0 and mid > 0:
  res1 = 1
print(res1,res2)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=list(map(int,input().split()))
l=[0 for i in range(10)]
d=0
for i in x:
  if i in range(400):
    l[0]+=1
  elif i in range(400,800):
    l[1]+=1
  elif i in range(800,1200):
    l[2]+=1
  elif i in range(1200,1600):
    l[3]+=1
  elif i in range(1600,2000):
    l[4]+=1
  elif i in range(2000,2400):
    l[5]+=1
  elif i in range(2400,2800):
    l[6]+=1
  elif i in range(2800,3200):
    l[7]+=1
  else:
    d+=1
p=[i for i in l if i>0]
print(min(p),max(p)+d)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
x=[0 for i in range(10)]
d=0
for i in l:
  if i in range(400):
    l[0]+=1
  elif i in range(400,800):
    l[1]+=1
  elif i in range(800,1200):
    l[2]+=1
  elif i in range(1200,1600):
    l[3]+=1
  elif i in range(1600,2000):
    l[4]+=1
  elif i in range(2000,2400):
    l[5]+=1
  elif i in range(2400,2800):
    l[6]+=1
  elif i in range(2800,3200):
    l[7]+=1
  else:
    d+=1
p=[i for i in x if i>0]
print(min(p),max(p)+d)
Problem p02607 (python)

Fixed submission:
x=int(input())
main=list(map(int,input().split()));count=0
for i in range(len(main)):
    if(main[i]%2!=0 and (i+1)%2!=0): count=count+1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(0,n,2):
if a[i] % 2 == 1:
ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
numList = list()
for i in range(N):
    numList.append(int(input()))
sum, ctr = 0, 1
for i in numList:
    if i == 0: continue
    elif i % 2 != 0 and ctr % 2 != 0:
        sum = sum + 1
    ctr = ctr + 1
print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
numList = list()
for i in range(n):
    numList.append(int(input()))
sum, ctr = 0, 1
for i in numList:
    if i % 2 != 0 and ctr % 2 != 0:
        sum = sum + 1
    ctr = ctr + 1
print(sum)
Problem p02640 (python)

Fixed submission:
#definiition
x,y= map(int,input().split())
crane= 2
turtle= 4
ans="No"
#Loop
for i in range(x+1):
    b=x-i
    if crane*i + turtle*b == y:
        ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
X,Y = map(input().split()) #input number of animals and legs

crane_legs = 2
turtle_legs = 4

answer = "No"

for i in range(X+1): #X+1 because it will only consider 0,1,2
    remaining = X-i
    if crane_legs*i + turtle_legs*remaining == Y:
        answer = "Yes"
#Loop to check combinations of animals is correct

print(answer)

Buggy submission (verdict: Runtime Error):
C, T = map(int, input().split())

#declare the output result no
result = 'No'
for a in range(C + 1):
b = C - a 

#but if the combination is in the cases the result will be yes
if 2 * a + 4 * b == T:
             result = 'Yes'

print(result)
Problem p02683 (python)

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

a = []
c = []

for i in range(n):
    a.append(list(map(int, input().split())))
    c.append(a[i][0])
    del a[i][0]

INF = 100000000

ans = INF

for i in range(1 << n):
    cost = 0
    d = [0] * m
    for j in range(n):
        if i >> j & 1:
            cost += c[j]
            for k in range(m):
                d[k] += a[j][k]
    ok = True
    for j in range(m):
        if d[j] < x:
            ok = False
    if ok:
        ans = min(ans, cost)
if ans == INF:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
def check(understanding,X):
    for individual in understanding:
        if individual<X:
            return False
    return True

cost=0
inputs1 =list(map(int, input().split()[:3]))
N=inputs1[0]
M=inputs1[1]
X=inputs1[2]

matrix=[]
understanding= []
for i in range(N):
    inputs =list(map(int, input().split()[:M+1]))
    matrix.append(inputs)

for i in range(N):
    cost+=matrix[i][0]
    for j in range(1,M+1):
        understanding[j]+=matrix[i][j]
    if check(understanding,X):
        print(cost)
        break

if not check(understanding,X):
    print(-1)
Problem p02706 (python)

Fixed submission:
a,b=map(int,input().split())
c=list(map(int,input().split()))
d=sum(c)
print(a-d if a-d>=0 else -1)

Buggy submission (verdict: Runtime Error):
N , M = input().split(" ")
tm = 0
for i in range(int(M)):
    i = input()
    tm = tm + int(i)
print(int(N)-tm)
Problem p02730 (python)

Fixed submission:
string=input()
palindrome=False
palin1=False

def palin(string):
    palindrome=False
    if string==string[::-1]:
        palindrome=True
    return palindrome

palindrome=palin(string)

if palin(string[int((len(string)-1)/2)])==True and palindrome==True:
    palin1=True
if palin(string[int((len(string)+3)/2)-1:len(string)])==True and palin1==True:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
def pal(s):
    rev = ''
    for a in s:
        rev = a + rev
    return s == rev

s = input()
def sub(s):
    if pal(s):
        n = len(s)
        if pal(s[0:(n-1)/2]):
            if pal(s[(n+3)/2:n-1]):
                return True
    return False
if sub(s):
    print("Yes")
else:
    print("No")
Problem p02731 (python)

Fixed submission:
#hello
#password
#input
#understandign python
#less errors
#work now please
q = int(input())
w = q / 3
print(w ** 3)

Buggy submission (verdict: Runtime Error):
def shortie (L):
 R= L/3
Return (R**3)

L+int(input())
Shortie (L)
Problem p02761 (python)

Fixed submission:
#graph implementation
import math
n,m=map(int,input().split())
ans=['bal']*n
for i in range(m):
    s,c=map(int,input().split())
    if ans[s-1]=='bal':
      ans[s-1]=c
    else:
        if ans[s-1]!=c:
            print(-1)
            exit(0)
if ans[0]=='bal' and n>1:
    ans[0]=1
for i in range(n):
    if ans[i]=='bal':
        ans[i]=0
if ans[0]==0 and n>1:
    print(-1)
else:
    for i in ans:
        print(i,end="")
print()

Buggy submission (verdict: Runtime Error):
n,m = list(map(int,input().split()))
ans = ['0' for i in range (n)]
fl = True

for i in range (m):
    s,c = input().split()
    s = int(s) - 1
    if (s == 0 and c == '0' and N != 1):
        fl = False
    if (ans[s] != '0'):
        if (ans[s] != c):
            fl = False
    else:
        ans[s] = c

res = ''

if (ans[0] == '0' and N != 1):
    ans[0] = '1'

for i in ans:
    res += i

print (res if fl else -1)

Buggy submission (verdict: Runtime Error):
n,m = list(map(int,input().split()))
nlist = []
clist = []
for i in range (m):
    s,c = list(map(int,input().split()))
    nlist.append(s)
    clist.append(c)

if n == 1:
    if len(clist) > 1:
        for i in range (len(clist)-1):
            for j in range (1, len(clist)):
                if clist[i] != clist[j]:
                    print (-1)
                    exit()
    else:
        print(clist[0])

else:
    for i in range (len(nlist)-1):
        for j in range (1, len(nlist)):
            if nlist[i] == nlist[j]:
                if clist[i] != clist[j]:
                    print(-1)
                    exit()

    a = 1
    b = 0
    c = 0

    for i in range (len(nlist)):
        if nlist[i] == 1:
            a = (clist[i])
        if nlist[i] == 2:
            b = (clist[i])
        if nlist[i] == 3:
            c = (clist[i])

    if n == 2:
        if a == 0:
            print(-1)
        else:
            print(a,end = "")
            print(b)
    elif n == 3:
        if a == 0:
            print(-1)
        else:
            print(a,end = "")
            print(b,end = "")
            print(c)
Problem p02765 (python)

Fixed submission:
N,R=input().split()
n,r=int(N),int(R)

if n>=10:
    print(r)
else:
    print(r+100*(10-n))

Buggy submission (verdict: Runtime Error):
N = int(input())
R = int(input())
if 10 < N <= 100 and 0 <= R <= 4111:
    print(R)
if 1<= N < 10 and 0 <= R <= 4111:
    K = 100 * (10 - N)
    M = R + K
    print(M)

Buggy submission (verdict: Runtime Error):
if 1 <= N <= 100 and 0 <= R <= 4111:
    if N > 10:
        print(R)
    else:
        K = 100 * (10 - N)
        M = R + K
        print(M)
else:
    False

Buggy submission (verdict: Runtime Error):
N , K = input().split()
if (N <= 10) :
    print (100 * (10 - int(N)) + int(K))
else :
    print (K)
Problem p02767 (python)

Fixed submission:
N = int(input())
x = input().split()
avg = 0

for i in range (N) :
    x[i] = int(x[i])
    avg += x[i]

avg1 = avg // N
avg2 = avg // N + 1

ans1 = 0
ans2 = 0

for i in range (N) :
    ans1 += (x[i] - avg1) ** 2
    ans2 += (x[i] - avg2) ** 2

print (int(min(ans1 , ans2)))

Buggy submission (verdict: Runtime Error):
import math


def get_stamina(x, p):
    return (x - p) ** 2


n = int(input())
persons_coordinates = list(map(int, input().split()))
max_coordinate = max(persons_coordinates)
min_stamina = math.inf


for p in range(max_coordinate + 1):
    stamina = 0
    for x in persons_coordinates:
        stamina += get_stamina(x, p)
    
    if min_stamina >= stamina:
        min_stamina = stamina
print(min_stamina)
Problem p02789 (python)

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

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



if x==y:
    print("Yes")

else:
    print("No")
Problem p02801 (python)

Fixed submission:
x = input().lower()
print(chr(ord(x) + 1))
#..........

Buggy submission (verdict: Runtime Error):
n = str(input())
a = string.ascii_lowercase.index(n) 
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
print (n,'is followed by',letters[a+1])