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

Fixed submission:
N, X, M = map(int,input().split())
if N==1:
  print(X)
  exit()
a = [X]
sa = set([X])
for i in range(1,N):
  X = (X**2)%M
  if X in sa:
    break
  else:
    a.append(X)
    sa.add(X)

if i==N-1:
  print(sum(a))
  exit()
start = a.index(X)
ans = sum(a[:start])
base = sum(a[start:])
rep = i-start
sets = (N-start)//rep
more = (N-start)%rep
ans += base*sets + sum(a[start:start+more])
print(ans)

Buggy submission (verdict: Runtime Error):
N, X, M = map(int,input().split())
if X==0:
  print(0)
  exit()
a = [X]
sa = set([X])
for i in range(1,N):
  X = (X**2)%M
  if X in sa:
    break
  else:
    a.append(X)
    sa.add(X)

if i==N-1:
  print(sum(a))
  exit()
start = a.index(X)
ans = sum(a[:start])
base = sum(a[start:])
rep = i-start
sets = (N-start)//rep
more = (N-start)%rep
ans += base*sets + sum(a[start:start+more])
print(ans)

Buggy submission (verdict: Runtime Error):
N, X, M = map(int,input().split())
a = [X]
sa = set([X])
for i in range(1,N):
  X = (X**2)%M
  if X in sa:
    break
  else:
    a.append(X)
    sa.add(X)

if i==N-1:
  print(sum(a))
  exit()
start = a.index(X)
ans = sum(a[:start])
base = sum(a[start:])
rep = i-start
sets = (N-start)//rep
more = (N-start)%rep
ans += base*sets + sum(a[start:start+more])
print(ans)
Problem p02659 (python)

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

Buggy submission (verdict: Runtime Error):
a, b=map(int, input().split())
b*=100
ans=a*b
an=ans//100
print(an)
Problem p02707 (python)

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

if N==2:
    print(1)
    print(0)
else:
    from collections import deque
    da=deque(A)
    
    import numpy as np
    ansl=np.array([0]*N)
    
    for i in range(N-1):
        ansl[da.pop()-1]+=1
    
    for i in ansl:
        print(i)

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

if N==2:
    print(1)
    print(0)
else:
    from collections import deque
    da=deque(A)
    
    import numpy as np
    ansl=np.array([0]*N)
    
    for i in range(N-1):
        ansl[da.pop()-1]+=1
    
    for i in ansl:
        print(i)
Problem p02819 (python)

Fixed submission:
n=int(input())
 
def is_prime(n):
    if n < 2:
      return False
    else:
      for i in range(2, n):
        if i * i > n:
            break
        elif n % i == 0:
            return False
    return True

for i in range(n,n+400):
  if is_prime(i):
    print(i)
    break

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

def is_prime(n):
    if n < 2:
        return False
    else:
        for i in range(2, n):
            if i * i > n:
                break
            elif n % i == 0:
                return False
        return True

for i in range(i,i+30):
  if is_prime(i):
    print(i)
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)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

N=int(input())
div=make_divisors(N)

from math import sqrt

tmpmin=10**16
for i in range(len(div)):
  if tmpmin>abs(sqrt(N)-div[i]):
    tmpmin=abs(sqrt(N)-div[i])
    minidx=i

a=div[minidx]
b=N//a

print(a-1+b-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[::-1]

N=int(input())
div=make_divisors(N)

from math import sqrt

tmpmin=10*10
for i in range(len(div)):
  if tmpmin>abs(sqrt(N)-div[i]):
    tmpmin=abs(sqrt(N)-div[i])
    minidx=i

a=div[minidx]
b=N//a

print(a-1+b-1)
Problem p02912 (python)

Fixed submission:
import heapq

N, M= map(int, input().split())
A = list(map(int, input().split()))
a=[-1*i for i in A]
heapq.heapify(a)
for i in range(M):
    m=int(heapq.heappop(a)/2)
    heapq.heappush(a, m)

print(-1*sum(a))

Buggy submission (verdict: Runtime Error):
import math
n = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
M=n[1]
def kyoukai(lis,m):
    s=0
    for i in range(n[0]):
        s+=math.log2(lis[i])
        if s>=m*2:
            boundary=i+1
            break
    return boundary
d=kyoukai(a,M)
k=0
while k!=1:
    for i in range(d):
        a[i]=int(a[i]/2)
    if M-d>0:
        M-=d
        d=kyoukai(a,M)
    else:
        break
print(sum(a))

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
M=n[1]
def kyoukai(lis,m):
    s=0
    for i in range(n):
        s+=math.log2(lis[i])
        if s>=n[1]*2:
            boundary=i+1
            break
    return boundary
d=kyoukai(a,M)
for i in range(d):
    a[i]=int(a[i]/2)
    if M-d>0:
        M-=d
        d=kyoukai(a,M)
    else:
        break
print(sum(a))
Problem p02954 (python)

Fixed submission:
s=input()
ls=len(s)
ans=[0]*ls
s+="R"
rst=lst=lend=0
for i in range(1,ls):
  if s[i]=="L" and lst==0:
    lst=i
  if lst==0:
    continue
  if s[i+1]=="R":
    lend=i
  if lend==0:
    continue
  ans[lst-1]=(lst-1-rst)//2+1+(lend-lst+1)//2
  ans[lst]=(lst-1-rst+1)//2+(lend-lst)//2+1
  rst=lend+1
  lst=lend=0

an=[str(i) for i in ans]
print(" ".join(an))

Buggy submission (verdict: Runtime Error):

  s=input()
ls=len(s)
now=[1]*ls
chlist=[]
while(1):
  tmp=[0]*ls
  for i in range(ls):
    if s[i]=="R":
      tmp[i+1]+=now[i]
    else:
      tmp[i-1]+=now[i]
  now=tmp
  if now in chlist:
    st=chlist.index(now)
    break
  else:
    chlist.append(now)
ch=chlist[st:]
idx=(10*100-st)%len(ch)-1
ans=[str(i) for i in ch[idx]]
print(" ".join(ans))
Problem p02990 (python)

Fixed submission:
import math
def ncr(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

d = list(map(int, input().split()))
print(d[0]-d[1]+1)
for i in range(2, d[1]+1): #2~k
    if (d[0]-d[1]+1)<i:
        print(0)
    else:
        print(ncr(d[0]-d[1]+1, i)*ncr(d[1]-1, i-1)%1000000007)

Buggy submission (verdict: Runtime Error):
import math
def ncr(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

d = list(map(int, input().split()))
print(d[0]-d[1]+1)
for i in range(2, d[1]+1): #2~k
    print(ncr(d[0]-d[1]+1, i)*ncr(d[1]-1, i-1)%1000000007)
Problem p03053 (python)

Fixed submission:
r, c = map(int, input().split())

cc = [input() for i in range(r)]

from collections import deque


# 縦がｙ 横がx　だから座標はy,xて書く
st=[]
for i in range(r):
    for j in range(c):
        if cc[i][j]=="#":
            st.append([i,j])

# 保留スタックtodoにスタートの位置情報を入れる
todo=deque(st)
# 検知済みリストseenを-1で初期化 (何も検知してないてこと)
seen=[[-1 for i in range(c)] for j in range(r)]

# seenにはどんだけの手数でそこに到達できるかを入れる
# 例えばスタート地点は手数0でいけるから0を入れる
for i in range(len(st)):
    seen[st[i][0]][st[i][1]]=0

# 4方向の移動リスト これ使って移動していく
ido=[[1,0],[0,1],[-1,0],[0,-1]]
m=0
# 保留リストtodoが空になるまでやる
while todo:
    y, x=todo.popleft() # 現在地は保留からの先頭とりだす
    for i in range(4): # 現在地から4方向を見る
        ny, nx=y+ido[i][0], x+ido[i][1] # 現在地から隣の座標
        # 隣の座標が区画をはみ出さないかつ、検知してないときに
        if 0<=ny<r and 0<=nx<c and seen[ny][nx]==-1 and cc[ny][nx]!="#":
            # 隣に行けるということなので検知してその手数を格納
            seen[ny][nx]=seen[y][x]+1 # 手数＝前の地点の手数+1
            todo.append([ny,nx]) # 保留リストにも入れとく
            if seen[ny][nx]>=m:
                m=seen[ny][nx]
       

print(m)

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

cc = [input() for i in range(r)]

from collections import deque
import numpy as np

# 縦がｙ 横がx　だから座標はy,xて書く
st=[]
for i in range(r):
    for j in range(c):
        if cc[i][j]=="#":
            st.append([i,j])

# 保留スタックtodoにスタートの位置情報を入れる
todo=deque(st)
# 検知済みリストseenを-1で初期化 (何も検知してないてこと)
se=np.array([-1]*(r*c))
seen=se.reshape(r,c)

# seenにはどんだけの手数でそこに到達できるかを入れる
# 例えばスタート地点は手数0でいけるから0を入れる
for i in range(len(st)):
    seen[st[i][0],st[i][1]]=0

# 4方向の移動リスト これ使って移動していく
ido=[[1,0],[0,1],[-1,0],[0,-1]]

# 保留リストtodoが空になるまでやる
while todo:
    y, x=todo.popleft() # 現在地は保留からの先頭とりだす
    for i in range(4): # 現在地から4方向を見る
        ny, nx=y+ido[i][0], x+ido[i][1] # 現在地から隣の座標
        # 隣の座標が区画をはみ出さないかつ、検知してないときに
        if 0<=ny<r and 0<=nx<c and seen[ny, nx]==-1 and cc[ny][nx]!="#":
            # 隣に行けるということなので検知してその手数を格納
            seen[ny, nx]=seen[y,x]+1 # 手数＝前の地点の手数+1
            todo.append([ny,nx]) # 保留リストにも入れとく

print(seen.max())
Problem p03127 (python)

Fixed submission:
N=int(input())
M=list(map(int, input().split()))
ans=min(M)
mn=min(M)
from math import gcd
for m in M:
  if m%mn!=0:
    ans=min(ans, gcd(mn,m))
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
M=list(map(int, input().split()))
ans=min(M)
mn=Min(M)
from math import gcd
for m in M:
  if m%ans!=0:
    ans=min(ans, gcd(mn,m))
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
M=list(map(int, input().split()))
ans=min(M)
mn=Min(M)
from math import gcd
for m in M:
  if m%ans!=0:
    ans=min(ans, gcd(mn,m))
    break

Buggy submission (verdict: Runtime Error):
N=int(input())
M=list(map(int, input().split()))
ans=min(M)
mn=Min(M)
for m in M:
  if m%ans!=0:
    ans=min(ans, gcd(mn,m))
    break

Buggy submission (verdict: Runtime Error):
N=int(intput())
M=list(map(int, input().split()))
ans=min(M)
for m in M:
  if m%ans!=0:
    ans=1
    break
print(ans)
Problem p03295 (python)

Fixed submission:
N, M = map(int, input().split())
s = [list(map(int, input().split())) for i in range(M)]
s.sort(key=lambda x:x[1])

count=1
mae=s[0][1]
for i in range(1,M):
    if s[i][0]>=mae:
        count+=1
        mae=s[i][1]

print(count)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, input().split())) for i in range(M)]
s.sort(key=lambda x:x[1])

count=1
mae=s[0][1]
for i in range(1,N):
    if s[i][0]>=mae:
        count+=1
        mae=s[i][1]

print(count)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, input().split())) for i in range(M)]
s.sort(key=lambda x:x[1])

count=1
mae=[0][1]
for i in range(1,N):
    if s[i][0]>=mae:
        count+=1
        maes[i][1]

print(count)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, input().split())) for i in range(M)]
s.sort(key=lambda x:x[1])

count=1
mae=[0][1]
for i in range(1,N):
    if s[i][0]>=mae:
        count+=1
        mae=kukan[i][1]

print(count)
Problem p03774 (python)

Fixed submission:
N, M = map(int, input().split())
P=[]
for i in range(N):
  x,y=map(int, input().split())
  P.append([x,y])
C=[]
for i in range(M):
  a,b=map(int, input().split())
  C.append([a,b])

for p in P:
  mind=10**18
  for j in range(M):
    d=abs(p[0]-C[j][0])+abs(p[1]-C[j][1])
    if d<mind:
      ans=j+1
      mind=d
  print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
P=[]
for i in range(N):
  x,y=map(int, input().split())
  P.append([x,y])
C=[]
for i in range(M):
  a,b=map(int, input().split())
  C.append([a,b])

for p in P:
  mind=10000000
  for j in range(M):
    d=abs(p[0]-C[j][0])+abs(p[1]-C[j][1])
    if d<mind:
      ans=j+1
      mind=d
  print(ans)
Problem p02829 (python)

Fixed submission:
S = []
for _ in range(2):
    S.append(int(input()))  # S += [input()] とも書ける

if {S[0],S[1]} == {1,2}:
    print(3)
elif {S[0],S[1]}=={2,3}:
    print(1)
elif {S[0],S[1]}== {3,1}:
    print(2)

Buggy submission (verdict: Runtime Error):
a, b = (int(i) for i in input().split())
if {a,b} == {1,2}:
    print(3)
elif {a,b}=={2,3}:
    print(1)
elif {a,b}== {3,1}:
    print(2)
Problem p02688 (python)

Fixed submission:
n, k = map(int, input().split())
a = [1] * n
for i in range(k):
    d = int(input())
    tmp = map(int, input().split())
    for j in tmp:
        a[j - 1] = 0
print(sum(a))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = [1] * n
for i in range(k):
    tmp = map(int, input().split())
    for j in tmp:
        a[j - 1] = 0
print(sum(a[j]))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = [1] * n
for i in range(k):
    tmp = map(int, input().split())
    for j in range(tmp):
        a[j] = 0
print(sum(a[j]))

Buggy submission (verdict: Runtime Error):
n, k = map(input().split())
a = [1] * n
for i in range(k):
    tmp = map(int, input().split())
    for j in range(tmp):
        a[j] = 0
print(sum(a[j]))
Problem p02659 (python)

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

Buggy submission (verdict: Runtime Error):
from decimal import *
a,b=map(float, input().split(" "))
b *= 100
print((int)(Decimal(a)*Decimal(b)/100+0.001))

Buggy submission (verdict: Runtime Error):
from decimal import *
a,b=map(float, input().split(" "))
b = Decimal(b) * 100
print((int)(a*b/100))

Buggy submission (verdict: Runtime Error):
from decimal import *
a,b=map(float, input().split(" "))
b = Decimal(b) * 100
print((int)(a*b/100))

Buggy submission (verdict: Runtime Error):
a,b=map(int, input().split(" "))
b *= 100
print(a*b/100)
Problem p02695 (python)

Fixed submission:
import itertools

n,m,q = map(int, input().split(" "))
a,b,c,d = [],[],[],[]
for i in range(q):
  inpu = input()
  a.append((int)(inpu.split(" ")[0]))
  b.append((int)(inpu.split(" ")[1]))
  c.append((int)(inpu.split(" ")[2]))
  d.append((int)(inpu.split(" ")[3]))

balls = list(itertools.combinations_with_replacement(range(1, m + 1), n))
#print(balls)
max = 0
for i in range(len(balls)):
  temp = 0
  for j in range(q):
    if balls[i][b[j] - 1] - balls[i][a[j] - 1] == c[j]:
      temp += d[j]
  if temp > max:
    max = temp
print(max)

Buggy submission (verdict: Runtime Error):
import itertools
n, m, q = map(int, input().split(" "))
asset = []
for i in range(q):
    asset.append(list(map(int, input().split(" "))))
A = []


max = 0
for a in itertools.product(list(range(1, m + 1)), repeat = n):
    A.append((list(a)))
for i in range(len(A)):
    total = 0
    for j in range(0, n):
        if A[j] <= A[j - 1]:
            continue
    for j in range(q):
        if A[i][asset[j][1] - 1] - A[i][asset[j][0] - 1] == asset[j][2]:
            total += asset[j][3]
    max = total if total > max else max
print(max)

Buggy submission (verdict: Runtime Error):
import itertools
n, m, q = map(int, input().split(" "))
asset = []
for i in range(q):
    asset.append(list(map(int, input().split(" "))))
A = []


max = 0
print (asset)
for a in itertools.product(list(range(1, m + 1)), repeat = n):
    A.append((list(a)))
for i in range(len(A)):
    total = 0
    for j in range(0, n):
        if A[j] <= A[j - 1]:
            continue
    for j in range(q):
        if A[i][asset[j][1] - 1] - A[i][asset[j][0] - 1] == asset[j][2]:
            total += asset[j][3]
    max = total if total > max else max
print(max)
Problem p02699 (python)

Fixed submission:
s, w = map(int, input().split(" "))
print("safe" if s > w else "unsafe")

Buggy submission (verdict: Runtime Error):
suuji = list(input())
count = 0
for i in range(0, len(suuji)):
  for j in range(i+3, len(suuji) + 1):
    if (int)(''.join(suuji[i:j])) % 2019 == 0:
      count += 1
print(count)
Problem p02707 (python)

Fixed submission:
ninnzuu = (int)(input())
joushi = list(map(int, input().split(" ")))
buka = [0 for i in range(ninnzuu)]
for i in range(ninnzuu - 1):
    buka[joushi[i]] += 1
for i in range(1, ninnzuu):
  print(buka[i])
print(0)

Buggy submission (verdict: Runtime Error):
ninnzuu = (int)(input())
joushi = list(map(int, input().split(" ")))
buka = [0 for i in range(ninnzuu)]
for i in range(1, ninnzuu + 1):
    buka[joushi[i] - 1] += 1
for i in range(ninnzuu):
  print(buka[i])
Problem p02759 (python)

Fixed submission:
import math
print((int)(math.ceil((int)(input())/2)))

Buggy submission (verdict: Runtime Error):
import math
print((int)(math.ceil((int)(input())))
Problem p03785 (python)

Fixed submission:
n,c,k = map(int ,input().split(" "))
t = sorted([int(input()) for i in range(n)])
total = 0
count = 0
while(count != n):
  temp = 0
  #print(count, total)
  for i in range(c):
    if count + i >= n:
      #print("乗りたい人数を全部さばいた")
      if t[-1] - t[count] <= k:
        #print("最後の人全員載せる")
        count = n
        total += 1
        break
      else:
        temp = 0
        while(count != n):
          #print("残りを何回で載せられるか")
          if t[count + temp] - t[count] <= k:
            temp += 1
          else:
            count += temp + 1
            total += 1
        break
      break
    if t[count + i] - t[count] > k:
      #print("定員を超えた")
      count += i
      total += 1
      break
  else:
    #print("k人全員載せる")
    count += c
    total += 1
    if count == n:
      break
print(total)

Buggy submission (verdict: Runtime Error):
import bisect
kyaku, teiin, jikan = map(int, input().split(" "))
a=sorted([(int)(input()) for i in range(kyaku)])
print(a)
count = 0
while(True):
  print(a)
  if len(a) > teiin:
    if a[0] + jikan >= a[teiin]:
      a = a[teiin:]
    else:
      a = a[bisect.bisect_left(a, a[0] + jikan):]
  else:
    if a[0] + jikan >= a[-1]:
      count += 1
      break
    else:
      a = a[bisect.bisect_left(a, a[0] + jikan):]
  count += 1
print(count)
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[2] == s[3] and s[4] == s[5]:
  print("Yes")
else:
  print("No)
Problem p02785 (python)

Fixed submission:
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
if N <= K:
  print(0)
else:
  print(sum(H[:N-K]))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
print(sum(H[N-K]))
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
if a >= 3200:
  print(s)
else:
  print("red")

Buggy submission (verdict: Runtime Error):
a = int(input())
s = input()
if a >= 3200:
  print("red")
esle:
  print(s)
Problem p02954 (python)

Fixed submission:
S = input()
L = len(S)
A = [0 for i in range(L)]
f = 0
c = 0
P = 0
for i in range(L):
  if S[i] == "R":
    if f == 0:
      c += 1
    else:
      A[P] += c // 2
      A[P+1] += (c+1) // 2
      c = 1
      f = 0
  else:
    if f == 1:
      c += 1
    else:
      P = i-1
      A[P] += (c+1) // 2
      A[P+1] += c // 2
      c = 1
      f = 1
A[P] += c // 2
A[P+1] += (c+1) // 2
for a in A:
  print(a)

Buggy submission (verdict: Runtime Error):
S = input()
L = len(S)
A = [0 for i in range(L)]
f = 0
c = 0
P = 0
for i in range(L):
  if S[i] == "R":
    if f == 0:
      c += 1
    else:
      A[P] += c // 2
      A[P+1] += (c+1) // 2
      c = 1
      f = 0
  else:
    if f == 1:
      c += 1
    else:
      P = i-1
      A[P] += (c+1) // 2
      A[P+1] += c // 2
      c = 1
      f = 1
A[P] += c // 2
A[P+1] += (c+1) // 2
ans = str(A[0])
for i in range(1, N):
  ans = ans + " " + str(A[i])
print(ans)
Problem p03221 (python)

Fixed submission:
N, M = map(int, input().split())
A = []
B = [[] for i in range(N)]
for i in range(M):
  P, Y = map(int, input().split())
  A.append([P, Y])
  B[P-1].append(Y)
for i in range(N):
  B[i].sort()
d = {}
for i in range(N):
  for y in range(len(B[i])):
    d[(i+1, B[i][y])] = y + 1
for i in range(M):
  print('{:0=6}'.format(A[i][0]) + '{:0=6}'.format(d[(A[i][0], A[i][1])]))

Buggy submission (verdict: Runtime Error):
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
ans = 0
m = A
for i in range(N):
  if m > abs(0.1 * T - H[i] * 0.006 - 0.1 * A):
    m = abs(0.1 * T - H[i] * 0.006 - 0.1 * A)
    ans = i + 1
print(ans)
Problem p03327 (python)

Fixed submission:
N = int(raw_input())
if N <= 999:
 print "ABC"
else:
 print "ABD"

Buggy submission (verdict: Runtime Error):
N = int(raw_input().split())
if N <= 999:
 print "ABC"
else:
 print "ABD"
Problem p03803 (python)

Fixed submission:
A, B = map(int, input().split())
if A == B:
  print("Draw")
elif A == 1:
  print("Alice")
elif B == 1:
  print("Bob")
elif A > B:
  print("Alice")
else:
  print("Bob")

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
if A == B:
  print("Draw")
elif A == 1 and :
  print("Alice")
elif B == 1:
  print("Bob")
elif A > B:
  print("Alice")
else:
  print("Bob")
Problem p03804 (python)

Fixed submission:
N, M = map(int, input().split())
A = []
B = []
for i in range(N):
  A.append(input())
for i in range(M):
  B.append(input())
f = 0
for i in range(N - M + 1):
  for j in range(N - M + 1):
    g = 0
    for k in range(M):
      for l in range(M):
        if A[i+k][j+l] != B[k][l]:
          g = 1
          break
      if g == 1:
        break
    if g == 0:
      print("Yes")
      f = 1
      break
  if f == 1:
    break
if f == 0:
  print("No")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = []
B = []
for i in range(N):
  A.append(input())
for i in range(N):
  B.append(input())
f = 0
for i in range(N - M + 1):
  for j in range(N - M + 1):
    g = 0
    for k in range(M):
      for l in range(M):
        if A[i+k][j+l] != B[k][l]:
          g = 1
          break
      if g == 1:
        break
    if g == 0:
      print("Yes")
      f = 1
      break
  if f == 1:
    break
if f == 0:
  print("No")
Problem p03345 (python)

Fixed submission:
A, B, C, K = map(int, input().split())
print(A - B if K % 2 == 0 else B - A)

Buggy submission (verdict: Runtime Error):
A, B, C, K = map(int, split().input())
print(A - B if K % 2 == 0 else B - A)
Problem p02546 (python)

Fixed submission:
s=input()
if s[len(s)-1]=="s":
  print(s+"es")
else:
  print(s+"s")

Buggy submission (verdict: Runtime Error):
import collections
n,x,m=map(int,input().split())
if n==1 or x==0:
  print(x)
  exit()
start,end,loopcnt=0,0,0
a={x:0}
wk=x
for i in range(1,m):
  wk=(wk*wk)%m
  if not wk in a:
    a[wk]=i
  else:
    start=a[wk]
    end=i
    break
a=sorted(a.items(),key=lambda x:x[1])
koteiindex=min(n,start)
koteiwa=0
for i in range(koteiindex):
  koteiwa+=a[i][0]
loopcnt=(n-koteiindex)//(end-start)
loopindex=start-1+(n-koteiindex)%(end-start)
loopwa=0
amariwa=0
for i in range(start,end):
  if i<=loopindex:
    amariwa+=a[i][0]
  loopwa+=a[i][0]
ans=koteiwa+loopwa*loopcnt+amariwa
print(ans)