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

Fixed submission:
from itertools import accumulate

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

# 累積和
a = [0] + list(accumulate(A))
b = [0] + list(accumulate(B))

ans = 0
j = M
for i in range(N + 1):
    # Aで既にKを超えていたらBから取れない
    if a[i] > K:
        break
    # 選択可能な最大のjを探す
    # 最大のjは前回のj以下
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)

print(ans)

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

a_i = 0
b_i = 0
t = 0
count = 0
while t <= K:
    if a_i < len(A) and A[a_i] < B[b_i] and t + A[a_i] <= K:
        t += A[a_i]
        count += 1
        a_i += 1
    elif b_i < len(B) and t + B[b_i] <= K:
        t += B[b_i]
        count += 1
        b_i += 1
    else:
        break
print(count)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))[::-1]
B = list(map(int, input().split()))[::-1]

t = 0
count = 0
while t <= K:
    if A and A[-1] < B[-1] and t + A[-1] <= K:
        t += A.pop()
        count += 1
    elif B and t + B[-1] <= K:
        t += B.pop()
        count += 1
    else:
        break
print(count)
Problem p02689 (python)

Fixed submission:
N,M=map(int,input().split())
H=list(map(int,input().split()))
A=[0]*N
for i in range(M):
    a,b=map(int,input().split())
    A[a-1]=max(A[a-1],H[b-1])
    A[b-1]=max(A[b-1],H[a-1])
res=sum([H[i]>A[i] for i in range(N)])
print(res)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
high=list(map(int,input().split()))
A=[0]*N
for i in range(M):
    a,b=map(int,input().split())
    A[a-1]=max(A[a-1],H[b-1])
    A[b-1]=max(A[b-1],H[a-1])
res=sum([H[i]>A[i] for i in range(N)])
print(res)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
high=list(map(int,input().split()))
A=[0]*N
for i in range(M):
    a,b=map(int,input().split())
    A[a-1]=max(A[a-1],H[b-1])
    A[b-1]=max(A[b-1],H[a-1])
res=sum(H[i]>A[i] for i in range(N))
print(res)
Problem p02712 (python)

Fixed submission:
n=int(input())
num=0
for i in range(1,n+1):
    if (i%3!=0) and (i%5!=0):
        num+=i
print(num)

Buggy submission (verdict: Runtime Error):
n=map(int,input().split())
num=0
for i in range(n):
    if (i%3!=0) and (i%5!=0):
        num+=i
print(num)

Buggy submission (verdict: Runtime Error):
n=map(int,input().split())
for i in range(n):
    if (i%3==0) and (i%5==0):
        print("FizzBuzz")
    elif (i%3==0) and (i%5!=0):
        print("Fizz")
    elif (i%3!=0) and (i%5==0):
        print("Buzz")
    else:
        print(i)
Problem p02771 (python)

Fixed submission:
a,b,c=map(int,input().split())
if (a==b!=c) or (a!=b==c) or (a==c!=b):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if (a==b!=c) or (a!=b==c) or (a==c!=b):
    print("Yes")
else:
    prnit("No")
Problem p02777 (python)

Fixed submission:
S,T=map(str,input().split())
A,B=map(int,input().split())
U=str(input())
if U==S:
    A-=1
elif U==T:
    B-=1
print(A, B)

Buggy submission (verdict: Runtime Error):
S,T=map(str,input().split())
A,B=map(str,input().split())
U=str(input())
if U==S:
    A-=1
elif U==T:
    B-=1
print(A, B)
Problem p02779 (python)

Fixed submission:
n=int(input())
table=sorted(list(map(int,input().split())))
for i in range(n-1):
    if table[i]==table[i+1]:
        print("NO")
        exit()
print("YES")

Buggy submission (verdict: Runtime Error):
n=int(input())
table=sorted(list(map(int,input().split())))
for i in range(n):
    if table[i]==table[i+1]:
        print("NO")
        exit()
print("YES")
Problem p02835 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a+b+c>=22:
    print("bust")
else:
    print("win")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input(),split())
if a+b+c>=22:
    print("bust")
else:
    print("win")
Problem p02847 (python)

Fixed submission:
s=input()
I=["SUN","MON","TUE","WED","THU","FRI","SAT"]
for i in range(7):
    if I[i]==s:
        print(7-i)

Buggy submission (verdict: Runtime Error):
I=["SUN","MON","TUE","WED","THU","FRI","SAT"]
for i in range(7):
    if I[i]==input():
        print(7-i)
Problem p02987 (python)

Fixed submission:
s=sorted(input())
if (s[0]==s[1]) and (s[2]==s[3]) and (s[0]!=s[2]):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=sort(input())
if (s[0]==s[1]) and (s[2]==s[3])　and (s[0]!=s[2]):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=sorted(input())
if (s[0]==s[1]) and (s[2]==s[3])　and (s[0]!=s[2]):
    print("Yes")
else:
    print("No")
Problem p03041 (python)

Fixed submission:
n,k=map(int,input().split())
s=list(input())
if s[k-1]=="A":
    s[k-1]="a"
elif s[k-1]=="B":
    s[k-1]="b"
elif s[k-1]=="C":
    s[k-1]="c"
print("".join(s))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=str(input())
if s[k-1]=="A":
    s[k-1]="a"
elif s[k-1]=="B":
    s[k-1]="b"
elif s[k-1]=="C":
    s[k-1]="c"
print(s)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=str(input())
if s[k+1]=="A":
    s[k+1]="a"
elif s[k+1]=="B":
    s[k+1]="b"
elif s[k+1]=="C":
    s[k+1]="c"
print(s)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
if s[k+1]=="A":
    s[k+1]="a"
elif s[k+1]=="B":
    s[k+1]="b"
elif s[k+1]=="C":
    s[k+1]="c"
print(s)
Problem p03075 (python)

Fixed submission:
I=[]
for i in range(5):
    I.append(int(input()))
k=int(input())
if I[4]-I[0]<=k:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
for i in range(5):
    I=list(map(int,input()))
k=int(input())
if I[4]-I[0]<=k:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
or i in range(5):
    I=list(map(int,input().split()))
k=int(input())
if max(I)-min(I)<=k:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
for i in range(5):
    I=list(int(input()))
k=int(input())
if max(I)-min(I)<=k:
    print("Yes")
else:
    print("No")
Problem p03137 (python)

Fixed submission:
N,M=map(int,input().split())
if N>M:
    print(0)
    exit()
lst=list(map(int,input().split()))
lst.sort()
sum_1=max(lst)-min(lst)
D=[]
for i in range(1,M):
    D.append(lst[i]-lst[i-1])
D.sort(reverse=True)
sum_2=0
for i in range(N-1):
    sum_2+=D[i]
ans=0
ans=sum_1-sum_2
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
if N>M:
    print(0)
lst=list(map(int,input().split()))
lst.sort()
sum_1=max(lst)-min(lst)
D=[]
for i in range(1,M):
    D.append(lst[i]-lst[i-1])
D.sort(reverse=True)
sum_2=0
for i in range(N-1):
    sum_2+=D[i]
ans=0
ans=sum_1-sum_2
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
lst=list(map(int,input().split()))
lst.sort()
sum_1=max(lst)-min(lst)
D=[]
for i in range(1,M):
    D.append(lst[i]-lst[i-1])
D.sort(reverse=True)
sum_2=0
for i in range(N-1):
    sum_2+=D[i]
ans=0
ans=sum_1-sum_2
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
lst=list(map(int,input().split()))
sort(lst)
sum_1=sum(lst)
D=[]
for i in range(1,M):
    D.append(lst[i]-lst[i-1])
sort(D,reverse=True)
sum_2=0
for i in range(N-1):
    sum_2+=D[i]
ans=0
ans=sum_1-sum_2
print(ans)
Problem p03208 (python)

Fixed submission:
n,k=map(int,input().split())
ans=[]
for i in range(n):
    ans.append(int(input()))
ans.sort()
print(min(ans[j+k-1]-ans[j] for j in range(n-k+1)))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
ans=[]
for i in range(n):
    ans.append(int(input()))
ans.sort()
print(min(ans[i+k-1]-ans[i] for j in range(n-k+1)))
Problem p02597 (python)

Fixed submission:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    N = int(input())
    C = list(input().strip())
    l, r = 0, N-1
    ans = 0
    if 'R' not in C or 'W' not in C:
        print(0)
        return True
    while l < r:
        while C[l] == 'R':
            l += 1
        while C[r] == 'W':
            r -= 1
        if l < r:
            ans += 1
            l += 1
            r -= 1
            
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    N = int(input())
    C = list(input().strip())
    invC = C[::-1]
    ans = 0
    leftW = C.index('W')
    rightR = N - 1 - invC.index('R')
    while leftW < rightR:
        # print('C={}, invC={}'.format(C, invC))
        # print('leftW={}, rightR={}'.format(leftW, rightR))
        ans += 1
        C[rightR] = 'W'
        invC[-1-rightR] = 'W'
        C[leftW] = 'R'
        invC[-1-leftW] = 'R'
        leftW = C.index('W')
        rightR = N - 1 - invC.index('R')
    print(ans)

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

Fixed submission:
def main():
    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    A, B, C, K = [int(x) for x in input().strip().split()]
    if K <= A + B:
        print(min(K, A))
    else:
        print(A - (K - A - B))
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    A, B, C, K = [int(x) for x in input().strip().split()]
    if K <= A + B:
        print(min(K, A))
    else:
        print(A - (K - A - B)))
    
if __name__ == '__main__':
    main()
Problem p02726 (python)

Fixed submission:
import sys
from collections import defaultdict
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
N, X, Y = [int(x) for x in input().strip().split()]
D = defaultdict(int)
for k in range(1, N):
    for k2 in range(k+1, N+1):
        D[min(k2 - k, abs(X-k) + 1 + abs(Y-k2), abs(Y-k) + 1 + abs(X-k2))] += 1

for k in range(1, N):
    print(D[k])

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
N, X, Y = [int(x) for x in input().strip().split()]
G = np.zeros((N, N), dtype=int)
for k in range(N):
    for k2 in range(k+1, N):
        G[k, k2] = min(k2 - k, G[min(k, X-1), max(k, X-1)]+1+abs(k2 - (Y - 1)))

for k in range(1, N):
    print(sum(sum(G == k)))
Problem p02862 (python)

Fixed submission:
import sys
input = sys.stdin.readline

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

X, Y = [int(x) for x in input().strip().split()]
p = (X, 2 * X)
n1 = X
n2 = 0
f = True
while p != (X, Y):
    n1 -= 2
    n2 += 1
    p = (n1 + 2 * n2, 2 * n1 + n2)
    if p[1] <= 0:
        f = False
        break

if n1 < 0 or n2 < 0:
    print(0)
else:
    print(combination(n1 + n2, n1) % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

X, Y = [int(x) for x in input().strip().split()]
p = (X, 2 * X)
n1 = X
n2 = 0
f = True
while p != (X, Y):
    n1 -= 2
    n2 += 1
    p = (n1 + 2 * n2, 2 * n1 + n2)
    if p[1] <= 0:
      	f = False
        break
if f:
    print(combination(n1 + n2, n1) % (10 ** 9 + 7))
else:
    print(0)
Problem p02948 (python)

Fixed submission:
import sys,heapq
input=sys.stdin.readline
N,M=[int(x) for x in input().strip().split()]
AB=[list(map(int,input().strip().split())) for _ in range(N)]
AB.sort()
n=0
sumB=0
q=[]
for m in range(1,M+1):
    while n<N and AB[n][0]<=m:
        heapq.heappush(q,-AB[n][1])
        n+=1
    if len(q)!=0:
        sumB+=heapq.heappop(q)

print(-sumB)

Buggy submission (verdict: Runtime Error):
import sys,heapq
input=sys.stdin.readline
N,M=[int(x) for x in input().strip().split()]
AB=[list(map(int,input().strip().split())) for _ in range(N)]
AB.sort()
n=0
sumB=0
q=[]
for m in range(1,M+1):
    maxB=0
    while n<N and AB[n][0]<=m:
        heapq.heappush(q,-AB[n][1])
        n+=1
    sumB+=heapq.heappop(q)
    if len(q)==0: break
    
print(-sumB)

Buggy submission (verdict: Runtime Error):
import sys,heapq
input=sys.stdin.readline
N,M=[int(x) for x in input().strip().split()]
AB=[list(map(int,input().strip().split())) for _ in range(N)]
AB.sort()
print(AB)
n=0
sumB=0
q=[]
for m in range(1,M+1):
    maxB=0
    while n<N and AB[n][0]<=m:
        heapq.heappush(q,-AB[n][1])
        n+=1
    sumB+=heapq.heappop(q)
    if len(q)==0: break
    
print(-sumB)
Problem p02990 (python)

Fixed submission:
import sys
from itertools import combinations, permutations
input = sys.stdin.readline
N, K = [int(x) for x in input().strip().split()]
d = {}

pascals_triangle = [1] * 2001
pascals_triangle[0] = [1]
for i in range(1, 2001):
    pascals_triangle[i] = [pascals_triangle[i-1][0]] * (i+1)
    for j in range(1, i):
        pascals_triangle[i][j] = pascals_triangle[i-1][j-1] + pascals_triangle[i-1][j]

for i in range(1, K + 1):
    if i > N - K + 1:
        print(0)
        continue
    ans = 0
    blue_ball = pascals_triangle[K-1][i-1]
    red_ball = pascals_triangle[N-K+1][i]
    ans += (blue_ball * red_ball) % (10 ** 9 + 7)
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from itertools import combinations, permutations
input = sys.stdin.readline
N, K = [int(x) for x in input().strip().split()]
d = {}

pascals_triangle = [1] * 2001
pascals_triangle[0] = [1]
for i in range(1, 2001):
    pascals_triangle[i] = [pascals_triangle[i-1][0]] * (i+1)
    for j in range(1, i):
        pascals_triangle[i][j] = pascals_triangle[i-1][j-1] + pascals_triangle[i-1][j]

for i in range(1, K + 1):
    ans = 0
    blue_ball = pascals_triangle[K-1][i-1]
    red_ball = pascals_triangle[N-K+1][i]
    ans += (blue_ball * red_ball) % (10 ** 9 + 7)
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from itertools import combinations, permutations
input = sys.stdin.readline
N, K = [int(x) for x in input().strip().split()]
d = {}

def pascals_triangle(a, b):
    l = [1]
    for i in range(2, a+2):
        l_ = l[:]
        l = [l_[0]] * i
        for j in range(1, i - 1):
            l[j] = l_[j-1] + l_[j]
    return l[b]
            
for i in range(1, K + 1):
    ans = 0
    if not (K-1, i-1) in d:
        d[(K-1, i-1)] = pascals_triangle(K-1, i-1)    
    blue_ball = d[(K-1, i-1)]
    if not (N-K+1, i) in d:
        d[(N-K+1, i)] = pascals_triangle(N-K+1, i)
    red_ball = d[(N-K+1, i)]
    ans += (blue_ball * red_ball) % (10 ** 9 + 7)
    print(ans)
Problem p03013 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N, M = [int(x) for x in input().strip().split()]
A = set([int(input()) for _ in range(M)])
s = [0 for _ in range(N + 1)]
s[0] = 1
if 1 not in A:
  s[1] = 1

for n in range(2, N+1):
  if n in A:
    continue
  else:
    s[n] = s[n-1] + s[n-2]
print(s[-1] % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N, M = [int(x) for x in input().strip().split()]
A = [int(input()) for _ in range(M)]
ans = [0 for _ in range(N+1)]
ans[0] = 0
if 1 not in A:
  ans[1] = 1
if 2 not in A:
  ans[2] = ans[1] + 1

for i in range(3, N+1):
  if i in A:
    ans[i] = 0
    continue
  for j in (1, 2):
    if ans[i-j] != 0:
      ans[i] += ans[i-j]
  else:
    ans[i] %= (10 ** 9 + 7)
print(ans[-1] % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N, M = [int(x) for x in input().strip().split()]
A = [int(input()) for _ in range(M)]
ans = [0 for _ in range(N+1)]
ans[0] = 0
if 1 not in A:
  ans[1] = 1
if 2 not in A:
  ans[2] = ans[1] + 1

for i in range(3, N+1):
  if i in A:
    ans[i] = 0
    continue
  for j in (1, 2):
    if ans[i-j] != 0:
      ans[i] += ans[i-j]

print(ans[:])
Problem p03041 (python)

Fixed submission:
N,K=[int(x) for x in input().split()]
S=input()
print(S[:K-1]+S[K-1].lower()+S[K:])

Buggy submission (verdict: Runtime Error):
N,K=[int(x) for x in input().split()]
S=input()
print(S[:K]+S[K].lower()+S[min(K+1,N-1):])

Buggy submission (verdict: Runtime Error):
N,K=[int(x) for x in input().split()]
S=input()
print(S[:K]+S[K].lower()+S[min(K+1,N-1)]:)
Problem p03242 (python)

Fixed submission:
n=list(input())
for i in range(len(n)):
  if n[i] == '1':
    n[i] = '9'
  elif n[i] == '9':
    n[i] = '1'

print(int(''.join(n)))

Buggy submission (verdict: Runtime Error):
n=list(input())
for i in n:
  if n[i] == '1':
    n[i] = '9'
  elif n[i] == '9':
    n[i] = '1'

print(int(''.join(n)))
Problem p03252 (python)

Fixed submission:
import sys
input = sys.stdin.readline

S = input().strip()
T = input().strip()
dic = {}

for s, t in zip(S, T):
    if s not in dic:
        dic[s] = t
    elif dic[s] != t:
        print('No')
        exit()

if len(dic) != len(set(dic.values())):
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

S = input().strip()
T = input().strip()

dic = defaultdict(list)

def check(d):
    for k, i in d.items():
        if k != i:
            return False
    else:
        return True

for s, t in zip(S, T):
    if s not in dic:
        dic[s] = t
    elif dic[s] != t:
        print('No')
        exit()

if len(dic) != len(set(dic.values())):
    print('No')
else:
    print('Yes')
Problem p03345 (python)

Fixed submission:
# 0:a, b, c, a-b
# 1:b+c, a+c, a+b, b-a
# 2:2a+b+c, a+2b+c, a+b+2c, a-b
# 3:2a+3b+3c, 3a+2b+3c, 3a+3b+2c, b-a
# 4:6a+5b+5c, 5a+6b+5c, 5a+5b+6c, a-b
A, B, C, K = [int(x) for x in input().strip().split()]
ans = (A-B)*(-1)**(K%2)
if ans > 10 ** 18:
  print('Unfair')
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
# 0:a, b, c, a-b
# 1:b+c, a+c, a+b, b-a
# 2:2a+b+c, a+2b+c, a+b+2c, a-b
# 3:2a+3b+3c, 3a+2b+3c, 3a+3b+2c, b-a
# 4:6a+5b+5c, 5a+6b+5c, 5a+5b+6c, a-b
A, B, C, K = [int(x) for x in input().strip().split()]
ans = (a-b)*-1**(K%2)
if ans > 10 ** 18:
  print('Unfair')
else:
  print(ans)
Problem p03723 (python)

Fixed submission:
A, B, C = map(int, input().strip().split())
ans = 0
while (A != B or B != C) and (A % 2) + (B % 2) + (C % 2) == 0:
  A, B, C = (B + C) // 2, (A + C) // 2, (A + B) // 2
  ans += 1
if (A % 2) + (B % 2) + (C % 2) == 0 and A == B == C:
  ans = -1
print(ans)

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().strip().split())
ans = 0
while A != B and B != C and (A % 2) + (B % 2) + (C % 2) == 0:
  A, B, C = (B + C) // 2, (A, C) // 2, (A + B) // 2
  ans += 1
print(ans)
Problem p02688 (python)

Fixed submission:
n, k = map(int, input().split())
s = [0] * (n+1)
a = [0] * k
for i in range(k):
    d = int(input())
    aa = [int(_) for _ in input().split()]
    a[i] = aa

for i in range(k):
    l = len(a[i])
    for j in range(l):
        s[a[i][j]] += 1

ans = 0
for i in range(1, n+1):
    if s[i] == 0:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = [0] * (n+1)
a = [0] * k
for i in range(k):
    d = int(input())
    aa = [int(_) for _ in input().split()]
    a[i] = aa

for i in range(k):
    l = len(a[i])
    for j in range(l):
        s[a[i][j]] += 1

ans = 0
for i in range(1, k+1):
    if s[i] == 0:
        ans += 1
print(ans)
Problem p02766 (python)

Fixed submission:
n, k = map(int, input().split())
ans = 0

def Base_10_to_n(X, n):
    if (int(X / n)):
        return Base_10_to_n(int(X / n), n) + str(X % n)
    return str(X % n)

print(len(str(Base_10_to_n(n, k))))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
ans = 0

def base_10_to_n(x, n):
    if int(x / n):
        return base_10_to_n(int(x / n), n) + str(X % n)
    return str(x % n)

print(len(str(base_10_to_n(n, k))))
Problem p02792 (python)

Fixed submission:
n = int(input())
num = [[0 for i in range(10)] for j in range(10)]

ans = 0

for _ in range(n):
    i = _ + 1
    if i < 10:
        num[i][i] += 1
    elif i % 10 != 0:
        moji = str(i)
        num[int(moji[0])][int(moji[len(moji)-1])] += 1
    else:
        pass

for i in range(1, 10):
    for j in range(1, 10):
        ans += num[i][j] * num[j][i]

print(ans)

Buggy submission (verdict: Runtime Error):
s = int(input())
num = [[0 for i in range(10)] for j in range(10)]

ans = 0

for _ in range(n):
    i = _ + 1
    if i < 10:
        num[i][i] += 1
    elif i % 10 != 0:
        moji = str(i)
        num[int(moji[0])][int(moji[len(moji)-1])] += 1
    else:
        pass

for i in range(1, 10):
    for j in range(1, 10):
        ans += num[i][j] * num[j][i]

print(ans)

Buggy submission (verdict: Runtime Error):
s = int(input())
num = [[0 for i in range(10)] for j in range(10)]

ans = 0

for _ in range(n):
    i = _ + 1
    if i < 10:
        num[i][i] += 1
    elif i % 10 != 0:
        moji = str(i)
        num[int(moji[0])][int(moji[len(moji)-1])] += 1
    else:
        pass

for i in range(1, 10):
    for j in range(1, 10):
        ans += num[i][j] * num[j][i]

for i in num:
    for j in i:
        print(j, " ", end="")
    print()

print(ans)
Problem p03804 (python)

Fixed submission:
n, m = map(int, input().split())
a, b = [0] * n, [0] * m
for i in range(n):
    a[i] = list(input())
for i in range(m):
    b[i] = list(input())

if n == 1:
    if a[0] == b[0]:
        print('Yes')
    else:
        print('No')
    exit()

for sx in range(n-m):
    for sy in range(n-m):
        chk = True
        for tx in range(m):
            for ty in range(m):
                #print(sx+tx, sy+ty)
                if a[sx+tx][sy+ty] == b[tx][ty]:
                    pass
                else:
                    chk = False
        if chk:
            print('Yes')
            exit()
print('No')

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a, b = [0] * n, [0] * m
for i in range(n):
    a[i] = list(input())
for i in range(m):
    b[i] = list(input())

for sx in range(n-1):
    for sy in range(n-1):
        chk = True
        for tx in range(m):
            for ty in range(m):
                if a[sx+tx][sy+ty] == b[tx][ty]:
                    pass
                else:
                    chk = False
                    break
        if chk:
            print('Yes')
            exit()
print('No')
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
import math
A,B = input().split()
A=Decimal(A)
B=Decimal(B)
AB=math.floor(A*B)
print(AB)

Buggy submission (verdict: Runtime Error):
from decimal import Decimal
A,B = input().split()
A=Decimal(A)
B=Decimal(B)
AB=math.floor(A*B)
print(AB)
Problem p02624 (python)

Fixed submission:
n = int(input())
res = 0
for i in range(1, n + 1):
  d = n // i
  res += d * (d + 1) // 2 * i
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
import numpy
div = np.zeros(N+1, np.int64)
for n in range(1, N+1):
  for m in range(n, N+1, n):
    div[m] += m
print(sum(div))
Problem p02987 (python)

Fixed submission:
print('Yes' if len(set(input()))==2 else 'No')

Buggy submission (verdict: Runtime Error):
print('Yes' if len(set(input()))==2, 'No')