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

Fixed submission:
S = input()
T = input()
a = []
ans = 0
for i in range(len(S)-len(T)+1):
    C = S[i:i+len(T)]
    for j in range(len(T)):
        if C[j] == T[j]:
            ans+=1
    a.append(ans)
    ans=0
print(len(T)-max(a))

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
a = []
ans = 0
for i in range(len(S)-2):
    if S[i]==T[0]:
        ans+=1
        if S[i+1]==T[1]:
            ans+=1
            if S[i+2]==T[2]:
                ans+=1
    a.append(ans)
    ans=0
print(len(T)-max(a))
Problem p02623 (python)

Fixed submission:
from bisect import bisect_right

N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
#a,bの累積和
A_sum = [0]
B_sum = [0]
for i in range(N):
    A_sum.append(A_sum[i]+A[i])
for i in range(M):
    B_sum.append(B_sum[i]+B[i])

ans = 0
#Aについて0-N冊読む場合の全探索
for i in range(N+1):
    cntA = i #Aをi冊読む
    rest = K - A_sum[i] #残り時間rest分
    if rest < 0:
        break
    cntB = bisect_right(B_sum,rest)-1 #Bで読むことができる冊数を二分探索で求める
    ans = max(ans,cntA + cntB)
print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_right

N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
#a,bの累積和
a_sum = [0]
b_sum = [0]
for i in range(N):
    a_sum.append(a_sum[i]+a[i])
for i in range(M):
    b_sum.append(b_sum[i]+b[i])

ans = 0
#Aについて0-N冊読む場合の全探索
for i in range(N+1):
    cntA = i #Aをi冊読む
    rest = K - a_sum[i]#残り時間rest分
    if rest < 0:
        break
    cntB = bisect_right(b_sum,rest)-1 #Bで読むことができる冊数を二分探索で求める
    ans = max(ans,cntA + cntB)
    print(ans)
print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_right

n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
#a,bの累積和
a_sum = [0]
for i in range(n):
    a_sum.append(a_sum[i]+a[i])
b_sum = [0]
for i in range(n):
    b_sum.append(b_sum[i]+b[i])

ans = 0
#Aについて0-N冊読む場合の全探索
for i in range(n+1):
    cntA = i #Aをi冊読む
    rest = k - a_sum[i]#残り時間rest分
    if rest < 0:
        break
    cntB = bisect_right(b_sum,rest)-1 #Bで読むことができる冊数を二分探索で求める
    ans = max(ans,cntA + cntB)
print(ans)
Problem p02629 (python)

Fixed submission:
n = int(input())
chars = 'Xabcdefghijklmnopqrstuvwxyz'
res = ''
while True:
    x = n%26
    if x == 0:
        x = 26
    res += chars[x]
    n -= x
    if n == 0 :
        break
    n //= 26
print(res[::-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
chars = 'Xabcdefghijklmnopqrstuvwxyz'
res = ''
while True:
    x = n%26 #最下位の位の文字を求める(係数が26でない最下位の位が余りとして出せる)
    if x == 0:#Xが26のときのみ余り0で対応させるため26に書き換え
        x = 26
    res += chars[x]#文字を正解リストに追加
    n -= x　#xを左辺に持っていって右辺で10の位以上の数値を調べる
    if n == 0 :
        break
    n //= 26 #n-xは必ず26の倍数になっている。(xを移項しているから自明)
    #最下位の位を余りとして扱うために26で割って係数を消している。
print(res[::-1])#resには1の位が一番初めに入っているので、反転させて表示
Problem p02754 (python)

Fixed submission:
n,a,b = map(int,input().split())
print(n//(a+b)*a+min(n%(a+b),a))

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

def append():
    for i in range(a):
        l.append("b")
        if len(l)==n:
            return
    for k in range(b):
        l.append("r")
        if len(l)==n:
            return
    if len(l)<n:
        append()
    return
append()

#print(l)
print(l.count('b'))
Problem p02829 (python)

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

print(6-(a+b))

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

print(6-a+b)
Problem p03042 (python)

Fixed submission:
def solve(yy,mm):
    if 1<=yy<=12:
        if 1 <= mm <=12:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if 1<= mm <= 12:
            return 'YYMM'
        else:
            return "NA"


s = input()
yy = int(s[:2])
mm = int(s[2:])
print(solve(yy,mm))

Buggy submission (verdict: Runtime Error):
s = input()
s_f = int(s[0]+s[1])
s_b = int(s[2]+s[3])

#print(s_f)
#print(s_b)
if s_f==0 or s_b==0:
    print('NA')
elif s_f<=12 and s_b<=12:
    print("AMBIGUOUS")
elif s_f<=12 and s_b>12:
    print('MMYY')
elif s_f>12 and s_b<=12:
    print('YYMM')
elif s_f>12 and s_b>12
    print('NA')
Problem p03208 (python)

Fixed submission:
N,K = map(int,(input().split()))
h = [int(input())for _ in range(N)]
h.sort()

print(min(h[i+K-1]-h[i] for i in range(N-K+1)))

Buggy submission (verdict: Runtime Error):
import itertools

N,K = map(int,(input().split()))
h = [int(input())for _ in range(N)]

hmin = 10**18

c = itertools.combinations(N,K)

for v in c:
    hmin = min(max(v)-min(v),hmin)
print(hmin)
Problem p03013 (python)

Fixed submission:
N, M = list(map(int, input().split()))
A =[0]*M
for i in range(M):
    A[i] = int(input())

amari = 1000000007
cnt = [0]*(N+2)
cnt[0] = 0
cnt[1] = 1
for i in range(2,N+2):
    t = (cnt[i-1]+cnt[i-2])
    cnt[i] = t % amari

ans = 1
def calc(ans):
    if M == 0:
        return cnt[N+1]

    for i in range(M): 
        if i == 0:
            ans*= cnt[A[i]]
        elif i > 0 and i < M:
            ans*=cnt[A[i] - A[i-1]-1]

        if i == M-1:
            ans*= cnt[N - A[i]]
        
        if ans == 0:
            break
    
        ans %= amari
        
    return ans

print(calc(ans))

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
A =[0]*M
for i in range(M):
    A[i] = int(input())

amari = 1000000007
cnt = [0]*(N+1)
cnt[0] = 0
cnt[1] = 1
cnt[2] = 2 
for i in range(3,N+1):
    t = (cnt[i-1]+cnt[i-2])
    cnt[i] = t % amari

ans = 1
for i in range(M): 
    if i == 0:
        if A[i] != 1:
            ans*= cnt[A[i]-1]
    elif i > 0 and i < M:
        ans*=cnt[A[i] - A[i-1] - 1]

    if i == M-1:
        if A[i] != N -1:
            ans*= cnt[N - A[i]]
    
    if ans == 0:
        break
  
    ans %= amari

print(ans)
Problem p03018 (python)

Fixed submission:
s = input()
t = s.replace('BC', 'D') 
answer = 0
A = 0
for i in range(len(t)):
    if t[i] == 'A':
        A+=1
    elif t[i] == 'D':
        answer+=A
    else:
        A = 0

print(answer)

Buggy submission (verdict: Runtime Error):
s = input()
t = s.replace('BC', 'D')
answer = 0
A = 0
for i in range(len(t)):
    if t[i] == 'A':
        A+=1
    elif t[1] == 'D':
        answer+=A
    else:
        A = 0

print(answer)
Problem p03317 (python)

Fixed submission:
import math
N, K = [int(t) for t in input().split()]
A = [int(t) for t in input().split()]

print(math.ceil((N - 1) / (K-1)))

Buggy submission (verdict: Runtime Error):
import math
N, K = [int(t) for t in input().split()]
A = [int(t) for t in input().split()]

idx = A.index(1)
left = A[:idx+1]
right = A[idx:]


def get_cnt(L):
    return math.ceil((len(L) - 1) / (K-1))


if left + 1 < K or N - right < K:
    print(get_cnt(A))
else:
    print(get_cnt(left) + get_cnt(right))
Problem p03803 (python)

Fixed submission:
a = [int(i) for i in input().split()] 
if a[0] == 1:
  a[0] = a[0] + 13

if a[1] == 1:
  a[1] = a[1] + 13

  
if a[0] > a[1]:
  print("Alice")
elif a[0] < a[1]:
  print("Bob")
else:
  print("Draw")

Buggy submission (verdict: Runtime Error):
a = [int(i) for i in input().split()] 
if a[0] == 1:
  a[0] = a[0] +13
if a[1] ==1:
  a[1] = a[1] + 13
if a[0] > a[1]:
  print("Alice")
elif a[0] < a[1]:
  print("Bob")
else
  print("Draw")
Problem p02570 (python)

Fixed submission:
D,T,S=map(int,input().split())

if D <= T*S:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import sys

N=int(input())
A = list(map(int,input().split()))
 
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

if gcd_list(A) > 1:
    print("not coprime")
    sys.exit()

D = [i for i in range(max(A)+1)] #iを割り切る最小の素数を格納
p = 2
 
while(p*p<=max(A)):
    if D[p]==p:
        for i in range(2*p,max(A)+1,p):
            if D[i]==i:
                D[i]=p
 
    p+=1
    
prime = set()
for a in A:
    tmp=D[a]
    L=set()
    while(a>1):
        a=a//tmp
        L.add(tmp)
        tmp=D[a]

    for l in L:
        if l in prime:
            print("setwise coprime")
            sys.exit()
        else:
            prime.add(l)

print("pairwise coprime")

Buggy submission (verdict: Runtime Error):
import sys

N=int(input())
A = list(map(int,input().split()))
 
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

if gcd_list(A) > 1:
    print("not coprime")
    sys.exit()

D = [i for i in range(max(A)+1)] #iを割り切る最小の素数を格納
p = 2
 
while(p*p<=max(A)):
    if D[p]==p:
        for i in range(p*p,max(A)+1,p):
            if D[i]==i:
                D[i]=p
 
    p+=1
    
prime = set()
for a in A:
    tmp=D[a]
    L=set()
    while(a>1):
        a=a//tmp
        L.add(tmp)
        tmp=D[a]

    for l in L:
        if l in prime:
            print("setwise coprime")
            sys.exit()
        else:
            prime.add(l)

print("pairwise coprime")
Problem p02596 (python)

Fixed submission:
K=int(input())

a=7 #第1項
b=10
i=0 #index

if (K%7 == 0):
    L = 9*K/7
else:
    L = 9*K
    
if (L%2==0 or L%5==0):
    print(-1)
else:
    while(i<=L):
        if (b%L==1):
            break
        else:
            b=10*(b%L)
            i += 1
    print(i+1)

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

flag=0　#Kで割れた時にflag=1となる。

a=7 #第i項
i=0 #index

if (K%2 !=　0):
    print(-1)

else:
    while(flag==0):
        if(a%k==0):
            flag==1
        i += 1
        a=10*a+7

    print(i)
Problem p02623 (python)

Fixed submission:
from itertools import accumulate
import bisect

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

a_acc = [0] + list(accumulate(a))  # aを0冊読む=1冊も読まない場合があるので、[0]を先頭に追加します
b_acc = list(accumulate(b))  # bisect_rightでは、x以下の要素がいくつあるか？を求めるので、こちらに0は入れません

ans = 0
for an in range(n + 1):
    rem = k - a_acc[an]
    if rem < 0:
        # aをこれ以上読めません
        break

    bn = bisect.bisect_right(b_acc, rem)
    ans = max(ans, an + bn)

print(ans)

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

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

acum1=[0]
for i in range(n): #累積和ai,bjを求める
    acum1.append(acum1[-1]+arr1[i])
for i in range(m):
    acum2.append(acum2[-1]+arr2[i])

ans = 0
for an in range(n + 1):
    rem = k - acum1[an]
    if rem < 0:
        # aをこれ以上読めません
        break

    bn = bisect.bisect_right(acum2, rem)
    ans = max(ans, an + bn)

print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
import bisect
 
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
 
acum1=[0]
for i in range(n): #累積和ai,bjを求める
    acum1.append(acum1[-1]+arr1[i])
for i in range(m):
    acum2.append(acum2[-1]+arr2[i])
 
ans = 0
for an in range(n + 1):
    rem = k - acum1[an]
    if rem < 0:
        # aをこれ以上読めません
        break
 
    bn = bisect.bisect_right(acum2, rem)
    ans = max(ans, an + bn)
 
print(ans)

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

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

acum1=[0]
for i in range(n): #累積和ai,bjを求める
    acum1.append(acum1[-1]+arr1[i])
for i in range(m):
    acum2.append(acum2[-1]+arr2[i])

ans = 0
for an in range(n + 1):
    rem = k - acum1[an]
    if rem < 0:
        # aをこれ以上読めません
        break

    bn = bisect.bisect_right(acum2, rem)
    ans = max(ans, an + bn)

print(ans)
Problem p02594 (python)

Fixed submission:
x=int(input())
if x>=30:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
x=int(iput())
if x>=30:
    print('Yes')
else:
    print('No')
Problem p02685 (python)

Fixed submission:
n,m,k = map (int,input().split())
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % p


p = 998244353
N = n-1  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

mod = 998244353
ans = 0
#if k <=  n//2:
for i in range(k+1):
    ans += (cmb(n-1,i,mod) * pow(m-1,n-1-i,mod) * m) % mod
print(ans % mod)

Buggy submission (verdict: Runtime Error):
n,m,k = map (int,input().split())
def comb(n, r, mod):
  a = 1
  b = 1
  r = min(r, n - r)
  for i in range(r):
    a = a * (n - i) % mod
    b = b * (i + 1) % mod
  return a * pow(b, mod - 2, mod) % mod
mod = 998244353
ans = 0
if k <=  n//2:
    po = [0] * (k+1)
    po[0] = pow(m-1,n-1-k,mod)
    for i in range(1,k+1):
        po[i] =po[i-1] * (m-1) % mod
    for i in range(1,k+1):
        ans += (comb (n-1,i,mod) * po[n-1-i] * m) % mod
    print(ans % mod)
else:
    po = [0] * (k + 1)
    po[0] = 1
    for i in range(1, k + 1):
        po[i] = po[i - 1] * (m - 1) % mod
    for i in range(n-k-1):
        ans += (comb (n-1,n-1- (k+1+i),mod) * po[n-1-i] * m) % mod
    print((pow(m,n,mod)-ans) % mod)
Problem p02735 (python)

Fixed submission:
from collections import deque
import math
import sys

h,w = map(int,input().split())
s = [0] * h
for i in range(h):
     s[i] = [i for i in str(input())]
memo = [[300] * w for _ in range(h)]
memo[0][0] = 0
box=[deque([]) for _ in range(w+h-1)]
box[0].append([0,0])
ans = 0
for i in range(w+h-1):
     while box[i]:

          y,x = box[i].popleft()
          if y == h-1 and x == w-1:
               if s[y][x] == '.' and s[0][0] == '.':
                    print(ans//2)
               elif s[y][x] == '.' and s[0][0] == '#' :
                    print((ans+1)//2)
               elif s[y][x] == '#' and s[0][0] == '.':
                    print((ans + 1) // 2)
               else:
                    print(ans//2 + 1)
               sys.exit()
          for k, j in [(1, 0), (0, 1)]:
               nexty, nextx = y + k, x + j
               if nexty < h and nextx < w:
                    if memo[nexty][nextx] > 250:
                         memo[nexty][nextx] = ans
                         if s[nexty][nextx] == s[y][x]:
                              box[i].append([nexty, nextx])

                         elif s[nexty][nextx] != s[y][x]:
                              box[i + 1].append([nexty, nextx])


     ans += 1

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

h,w = map(int,input().split())
s = [0] * h
for i in range(h):
     s[i] = [i for i in str(input())]
memo=[[math.inf] * w for _ in range(h)]
box=[deque([]) for _ in range(w+h-1)]
box[0].append([0,0])
ans = 0
for i in range(w+h-1):
     while box[i]:
          y,x = box[i].popleft()
          if y == h-1 and x == w-1:
               if s[y][x] == '.' and s[0][0] == '.':
                    print(ans//2)
               elif s[y][x] == '.' and s[0][0] == '#' :
                    print((ans+1)//2)
               elif s[y][x] == '#' and s[0][0] == '.':
                    print((ans + 1) // 2)
               else:
                    print(ans//2 + 1)
               sys.exit()
          for k, j in [(1, 0), (0, 1)]:

               nexty, nextx = y + k, x + j
               if nexty < h and nextx < w:
                    if s[nexty][nextx] == s[y][x]:
                         box[i].append([nexty, nextx])

                    elif s[nexty][nextx] != s[y][x]:
                         box[i+1].append([nexty, nextx])


     ans += 1
Problem p02831 (python)

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

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

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

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
 
m = [0]*n
m[0] = sum(a)
 
for i in range((n-1)//2):
	m[0] -= 2*(a[1+i*2])
 
for i in range(1,n):
	m[i] = 2*a[i-1] - m[i-1]
 
print(' '.join(map(str, m)))

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = list(map(int,input().split()))
mat = np.matrix([np.zeros(n) for i in range(n)])
for i in range(n-1):
    mat[i,i] = 1/2
    mat[i,i + 1] = 1/2
mat[n-1,0] = 1/2
mat[n-1,n-1] = 1/2

ans = np.linalg.inv(mat) * np.matrix(a).T
anss = []
for i in range(n):
    anss.append(int(ans[i,0]))
print(*anss)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = list(map(int,input().split()))
mat = np.matrix([np.zeros(n) for i in range(n)])
for i in range(n-1):
    mat[i,i] = 1/2
    mat[i,i + 1] = 1/2
mat[n-1,0] = 1/2
mat[n-1,n-1] = 1/2

ans = np.linalg.inv(mat) @ np.matrix(a).T
anss = []
for i in range(n):
    anss.append(int(ans[i,0]))
print(*anss)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a =list(map(int,input().split()))
box = [[0]*n for _ in range(n)]
for i in range(n-1):
     box[i][i] = 1
     box[i][i+1] = 1

box[n-1][0] = 1
box[n-1][n-1] = 1
boxx = np.array(box)
inv = np.linalg.inv(boxx)
aa = np.array(a)
ans = np.dot(inv,aa)
print(*ans//2)
Problem p03013 (python)

Fixed submission:
n, m = map(int, input().split())
mod = 10**9 + 7
dp = [1]*(n+1)
 
for _ in range(m):
    a = int(input())
    dp[a] = 0
 
for i in range(2, n+1):
    if dp[i]>0:
        dp[i] = (dp[i-1]+dp[i-2])%mod
 
print(dp[n])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = [0]*m
for i in range(m):
    a[i] = int(input())
b=a[0]
for i in range(m-1):
    b = max(b,a[i+1]-a[i])
fib=[0,1]
for i in range(b-1):
    fib.append(fib[i]+fib[i+1])
ans = fib[a[0]]
for i in range(m-1):
    ans *= fib[a[i+1]-a[i]-1]
    ans % 1000000007
    print(ans)
ans *= fib[n-a[m-1]]
print(ans%1000000007)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = [0]*m
for i in range(m):
    a[i] = int(input())
b=a[0]
for i in range(m-1):
    b = max(b,a[i+1]-a[i])
fib=[0,1]
for i in range(b-1):
    fib.append(fib[i]+fib[i+1])
ans = fib[a[0]]
for i in range(m-1):
    ans *= fib[a[i+1]-a[i]-1]
    ans % 1000000007
    print(ans)
ans *= fib[n-a[m-1]]
print(ans%1000000007)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m = map(int,input().split())
a = [int(input()) for i in range(m)]

dp = [0] * (n+1)
for i in range(n+1):
     if i in a:
          dp[i] = 0
     elif i == 0 or i == 1:
          dp[i] = 1
     else:
          dp[i] = (dp[i-1] + dp[i-2])%1000000007
print(dp[n])
Problem p03104 (python)

Fixed submission:
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
#N = I()
#A = [LI() for _ in range(N)]

a,b = MI()

if a % 2 == 0:
    if b % 2 == 0:
        if (b-a) % 4 == 2:
            print(b + 1)
        else:
            print(b)
    else:
        if (b-a) % 4 == 1:
            print(1)
        else:
            print(0)
else:
    if b % 2 == 0:
        if (b-a) % 4 == 1:
            bst = bin(b)
            ast = bin(a)
            anst = '0b'
            if len(bst) - len(ast) > 0:
                for i in range(len(bst) - len(ast)):

                    anst += bst[2+i]
            for i in range(len(ast) -2):
                if ast[-len(ast) + 2 + i] == bst[-len(ast) + 2 + i]:
                    anst += '0'
                else:
                    anst += '1'
                aa = int(anst[2:],2)
            print(aa)

        else:
            bst = bin(b)
            ast = bin(a)
            anst = '0b'
            if len(bst) - len(ast) > 0:
                for i in range(len(bst) - len(ast)):
                    anst += bst[2 + i]
            for i in range(len(ast) - 2):
                if ast[-len(ast) + 2 + i] == bst[-len(ast) + 2 + i]:
                    anst += '0'
                else:
                    anst += '1'
                aa = int(anst[2:], 2)
            print(aa - 1)
    else:
        if (b-a) % 4 == 2:
            print(a-1)
        else:
            print(a)

Buggy submission (verdict: Runtime Error):
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
#N = I()
#A = [LI() for _ in range(N)]

a,b = MI()

if a % 2 == 0:
    if b % 2 == 0:
        if (b-a) % 4 == 2:
            print(b + 1)
        else:
            print(b)
    else:
        if (b-a) % 4 == 1:
            print(1)
        else:
            print(0)
else:
    if b % 2 == 0:
        if (b-a) % 4 == 1:
            bst = bin(b)
            ast = bin(a)
            anst = '0b'
            if len(bst) - len(ast) > 0:
                for i in range(len(bst) - len(ast)):

                    anst += bst[2+i]
            for i in range(len(ast) -2):
                if ast[-len(ast) + 2 + i] == bst[-len(ast) + 2 + i]:
                    anst += '0'
                else:
                    anst += '1'
                aa = int(anst[2:],2)
            print(aa)

        else:
            print(aa+1)
    else:
        if (b-a) % 4 == 2:
            print(a-1)
        else:
            print(a)
Problem p02659 (python)

Fixed submission:
a, b = input().split()
a = int( a )
b = int( 1000 * float( b ) )
m = a * b
m = m // 1000

print( m )

Buggy submission (verdict: Runtime Error):
#include <stdio.h>

int main(){
    double a, b;
    long m;
    scanf("%lf %lf", &a, &b );
    m = a * b;
    printf("%ld\n", m);
    return 0;
}
Problem p02762 (python)

Fixed submission:
import sys
sys.setrecursionlimit(200100)
n, m, k = map( int, input().split() )
friend = [ [] for _ in range( n ) ]

for _ in range( m ):
    a, b = map( int, input().split() )
    friend[ a - 1 ].append( b - 1 )
    friend[ b - 1 ].append( a - 1 )

graph_id = [ -1 for _ in range( n ) ]

def dfs( ver, g_id ):
    if graph_id[ ver ] == -1:
        graph_id[ ver ] = g_id
    else:
        return
    for next_v in friend[ ver ]:
        dfs( next_v, g_id )

g_id = 0
for ver in range( n ):
    if graph_id[ ver ] != -1:
        continue
    dfs( ver, g_id )
    g_id += 1

graph_size = [ 0 for _ in range( n ) ]
for ver in range( n ):
    graph_size[ graph_id[ ver ] ] += 1

ans = [ graph_size[ graph_id[ ver ] ] for ver in range( n ) ]

for _ in range( k ):
    c, d = map( int, input().split() )
    if graph_id[ c - 1 ] == graph_id[ d - 1 ]:
        ans[ c - 1 ] -= 1
        ans[ d - 1 ] -= 1

for ver in range( n ):
    ans[ ver ] = ans[ ver ] - len( friend[ ver ] ) - 1

print( " ".join( map( str, ans ) ) )

Buggy submission (verdict: Runtime Error):
n, m, k = map( int, input().split() )
friend = [ [] for _ in range( n ) ]

for _ in range( m ):
    a, b = map( int, input().split() )
    friend[ a - 1 ].append( b - 1 )
    friend[ b - 1 ].append( a - 1 )

VISITED = 1
NOT_VISITED = 0
visit = [ NOT_VISITED for _ in range( n ) ]
graph_id = [ -1 for _ in range( n ) ]

def dfs( ver, g_id ):
    if graph_id[ ver ] == -1:
        graph_id[ ver ] = g_id
    else:
        return
    for next_v in friend[ ver ]:
        dfs( next_v, g_id )

g_id = 0
for ver in range( n ):
    if graph_id[ ver ] != -1:
        continue
    dfs( ver, g_id )
    g_id += 1

graph_size = [ 0 for _ in range( n ) ]
for ver in range( n ):
    graph_size[ graph_id[ ver ] ] += 1

ans = [ graph_size[ graph_id[ ver ] ] for ver in range( n ) ]

for _ in range( k ):
    c, d = map( int, input().split() )
    if graph_id[ c - 1 ] == graph_id[ d - 1 ]:
        ans[ c - 1 ] -= 1
        ans[ d - 1 ] -= 1

for ver in range( n ):
    ans[ ver ] = ans[ ver ] - len( friend[ ver ] ) - 1

print( " ".join( map( str, ans ) ) )