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

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

lis = [0] * n
for i in A:
  lis[i-1] += 1

for j in range(len(lis)):
  print(lis[j])

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = list(map(int,input().split()))

ac = Counter(a)
ad = list(ac.values())
ad.sort()
for i in range(n-1):
  print(ad[i])

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = list(map(int,input().split()))

ac = Counter(a)
ad = list(ac.values())
ad.sort()
for i in range(n):
  print(ad[i])

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

for i in range(n):
    print(i.count(a))

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

for i in range(n):
    print(a.count(a)\n)

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

for i in range(n):
  for range(len(a)):
    if i in a:
      count++
    print(count\n)
Problem p02915 (python)

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

Buggy submission (verdict: Runtime Error):
n = input()
print(n ** 2)

Buggy submission (verdict: Runtime Error):
n = int(input())
pow(n,3)
print(n
Problem p02577 (python)

Fixed submission:
n = int(input())
ln = list(str(n))
from collections import Counter
nc = dict(Counter(ln))
s = 0
if n != 0:
    for i in range(1, 10):
        if str(i) in nc:
            s += i * nc[str(i)]
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
ln = list(str(n))
from collections import Counter
nc = dict(Counter(ln))
s = 0
if n != 0:
    for i in range(1, 10):
        s += i * nc[str(i)]
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
ln = list(str(n))
from collections import Counter
nc = dict(Counter(ln))
s = 0
for i in range(1, 10):
    s += i * nc[str(i)]
if s % 9 == 0:
    print('Yes')
else:
    print('No')
Problem p02629 (python)

Fixed submission:
n = int(input())
rev = []
nn = n
def c(n):
    k = 1
    i = 1
    while n > 26 ** i:
        n -= 26 ** i
        k += 1
        i += 1
    return n

def d(n):
    k = 1
    i = 1
    while n > 26 ** i:
        n -= 26 ** i
        k += 1
        i += 1
    return k

n = c(n) - 1
while n > 25:
    r = n % 26
    rev.append(r)
    n //= 26
rev.append(n)
sl = list('abcdefghijklmnopqrstuvwxyz')
l = len(rev)
name = []
for i in range(d(nn) - l):
    name.append('a')
for i in range(len(rev)):
    d = sl[rev[l - 1 - i]]
    name.append(d)
dogname = ''.join(name)
print(dogname)

Buggy submission (verdict: Runtime Error):
n = int(input())
rev = []
nn = n
def c(n):
    k = 1
    i = 1
    while n > 26 ** i:
        n -= 26 ** i
        k += 1
        i += 1
    return n

def d(n):
    k = 1
    i = 1
    while n > 26 ** i:
        n -= 26 ** i
        k += 1
        i += 1
    return k

n = c(n)
while n > 26:
    r = n % 26
    rev.append(r)
    n //= 26
rev.append(n)
sl = list('abcdefghijklmnopqrstuvwxyz')
l = len(rev)
if l >= 2:
    for i in range(1, l):
        rev[i] += 1
name = []

for i in range(d(nn) - l):
    name.append('a')
for i in range(len(rev)):
    d = sl[rev[l - 1 - i] - 1]
    name.append(d)
dogname = ''.join(name)
print(dogname)

Buggy submission (verdict: Runtime Error):
n = int(input())
rev = []
nn = n
def c(n):
    k = 1
    i = 1
    while n > 26 ** i:
        n -= 26 ** i
        k += 1
        i += 1
    return n

def d(n):
    k = 1
    i = 1
    while n > 26 ** i:
        n -= 26 ** i
        k += 1
        i += 1
    return k

n = c(n)
while n > 26:
    r = n % 26
    rev.append(r)
    n //= 26
rev.append(n)
sl = list('abcdefghijklmnopqrstuvwxyz')
l = len(rev)
for i in range(1, l):
    rev[i] += 1
name = []

for i in range(d(nn) - l):
    name.append('a')
for i in range(len(rev)):
    d = sl[rev[l - 1 - i] - 1]
    name.append(d)
dogname = ''.join(name)
print(dogname)

Buggy submission (verdict: Runtime Error):
n = int(input())
rev = []
nn = n
def c(n):
    k = 1
    i = 1
    while n > 26 ** i:
        n -= 26 ** i
        k += 1
        i += 1
    return n

def d(n):
    k = 1
    i = 1
    while n > 26 ** i:
        n -= 26 ** i
        k += 1
        i += 1
    return k

n = c(n)
while n > 26:
    r = n % 26
    if r == 0:
        r = 26
    rev.append(r)
    n //= 26
rev.append(n)
sl = list('abcdefghijklmnopqrstuvwxyz')
l = len(rev)
for i in range(1, l):
    rev[i] += 1
name = []

for i in range(d(nn) - l):
    name.append('a')
for i in range(len(rev)):
    d = sl[rev[l - 1 - i] - 1]
    name.append(d)
dogname = ''.join(name)
print(dogname)
Problem p02711 (python)

Fixed submission:
n = input()
for i in range(3):
    if n[i] == '7':
        print('Yes')
        break
else:
    print('No')

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

from collections import Counter
rgb = dict(Counter(s))
if len(rgb) < 3:
    print('0')
else:
    p = rgb['R'] * rgb['G'] * rgb['B']
    for i in range(1, (len(s)-1)//2 + 1):
        for j in range(len(s) - 2*i):
            if {s[j], s[j + i], s[j + 2*i]} == {'R', 'G', 'B'}:
                p -= 1
    print(p)

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

from collections import Counter
rgb = dict(Counter(s))
p = rgb['R'] * rgb['G'] * rgb['B']
for i in range(1, len(s)//2):
    for j in range(len(s) - 2*i):
        if {s[j], s[j + i], s[j + 2*i]} == {'R', 'G', 'B'}:
            p -= 1
print(p)
Problem p02723 (python)

Fixed submission:
s = input()
if (s[2] == s[3]) & (s[4] == s[5]):
    print('Yes')
else:
    print('No')

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

Buggy submission (verdict: Runtime Error):
x = int(input())
h = 0
fh = x // 500
h += fh * 1000
r = x % 500
f = r // 5
h += f * 5
print(h)
Problem p02729 (python)

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

def factorial(n):
    v = 1
    for i in range(1, n + 1):
        v *= i
    return v

def comb(a, b):
    return factorial(a) // (factorial(b) * factorial(a - b))

if (n < 2) & (m < 2):
    print('0')
elif n < 2:
    print(comb(m, 2))
elif m < 2:
    print(comb(n, 2))
else:
    print(comb(n, 2) + comb(m, 2))

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

def factorial(n):
    v = 1
    for i in range(1, n + 1):
        v *= i
    return v

def comb(a, b):
    return factorial(a) // (factorial(b) * factorial(a - b))

from collections import Counter
acnt = dict(Counter(a))
value = list(acnt.values())
sv = 0
for i in range(len(value)):
    if value[i] > 1:
        sv += (value[i]*value[i-1])//2
for i in range(n):
    cur = a[i]
    cursv = sv
    if acnt[cur] > 2:
        cursv = cursv - acnt[cur] + 1
    elif acnt[cur] == 2:
        cursv -= 1
    print(cursv)
Problem p02753 (python)

Fixed submission:
s = input()
if s[0] == s[1] == s[2]:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
s = input()
q = int(input())
for i in range(q):
    query = list(map(str, input().split()))
    if len(query) == 1:
        s = s[::-1]
    else:
        if int(query[1]) == 1:
            s = query[2] + s
        else:
            s = s + query[2]
print(s)
Problem p02759 (python)

Fixed submission:
n = int(input())
a = n // 2 + n % 2
print(a)

Buggy submission (verdict: Runtime Error):
n = int(input().split())
a = n // 2 + n % 2
print(a)
Problem p02879 (python)

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

if (1 <= a <= 9) & (1 <= b <= 9):
    print(a * b)
else:
    print('-1')

Buggy submission (verdict: Runtime Error):
n = int(input())
maxn = int(n ** 0.5)
for i in range(maxn):
    p = maxn - i
    if n % p == 0:
        q = n // p
        break
print(p + q - 2)
Problem p02933 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
s = 0
for i in range(n):
    s += 1 / a[i]
print(1 / s)
Problem p02577 (python)

Fixed submission:
N=int(input())
if N%9 == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = input()
if N % 9 == 0:
  print('yes')
else:
  print('no')
Problem p03775 (python)

Fixed submission:
#!/usr/bin/env python3


def div_pairs(n):
    for i in range(1, n + 1):
        if i * i > n:
            break
        d, m = divmod(n, i)
        if m == 0:
            yield (i, d)


def f(a, b):
    return max(len(str(a)), len(str(b)))


def solve(n):
    return min(f(a, b) for a, b in div_pairs(n))


def main():
    print(solve(int(input())))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3


def div_pairs(n):
    for i in range(1, n):
        if i * i > n:
            break
        d, m = divmod(n, i)
        if m == 0:
            yield (i, d)


def f(a, b):
    return max(len(str(a)), len(str(b)))


def solve(n):
    return min(f(a, b) for a, b in div_pairs(n))


def main():
    print(solve(int(input())))


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

Fixed submission:
S = list(input())
T = list(input())
O = list()
a = 0
for i in range (len(S) - len(T) + 1):
    b = 0
    m = 0
    for i in range (len(T)):
        if S[b + a] != T[b]:
            m = m + 1
        b = b + 1
    O.append(m)
    a = a + 1
O.sort()
print(O[0])

Buggy submission (verdict: Runtime Error):
S = list(input())
T = list(input())
O = list()
a = 0
for i in range (len(S) - len(T)):
    b = 0
    m = 0
    for i in range (len(T)):
        if S[b + a] != T[b]:
            m = m + 1
        b = b + 1
    O.append(m)
    a = a + 1
O.sort()
print(O[0])
Problem p02552 (python)

Fixed submission:
x = int(input())
print(1 if x ==0 else 0)

Buggy submission (verdict: Runtime Error):
!
Problem p02557 (python)

Fixed submission:
def solve():    
    n = int(input())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    b = b[::-1]
    
    l = []
    num = -1
    for i in range(n):
        if a[i] == b[i]:
            l.append(i)
            num = a[i]
    
    ind = 0
    for i in range(n):
        if b[i] != num and a[i] != num and ind < len(l):
            b[i], b[l[ind]] = b[l[ind]], b[i]
            ind += 1
    
    if ind < len(l):
        print('No')
    else:
        print('Yes')
        print(*b)
    
                        
if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve():    
    n = int(input())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    b = b[::-1]
    
    l = []
    num -= 1
    for i in range(n):
        if a[i] == b[i]:
            l.append(i)
            num = a[i]
    
    ind = 0
    for i in range(n):
        if b[i] != num and a[i] != num and ind < len(l):
            b[i], b[l[ind]] = b[l[ind]], b[i]
            ind += 1
    
    if ind < len(l):
        print('No')
    else:
        print('Yes')
        print(*b)
    
                        
if __name__ == "__main__":
    solve()
Problem p02623 (python)

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

ans,j=0,m
for i in range(n+1):
    if a[i]>k:
        break
    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()))
ans=0
count=0
a=0
b=0

while count<k:
    if A[a]<B[b]:
        if k-count>=A[a]:
            count+=A[a]
            ans+=1
            if a<len(A)-1:
                a+=1
            else:
                A[a]=10**10
        else:
            print(ans)
            break
                
    if A[a]>B[b]:
        if k-count>=B[b]:
            count+=B[b]
            ans+=1
            if b<len(B)-1:
                b+=1
            else:
                B[b]=10**10
    
        else:
            print(ans)
            break
    
    if A[a]==B[b]:
        if k-count>=B[b]:
            if A[a+1]<B[b+1]:
                count+=A[a]
                ans+=1
                if a<len(A)-1:
                    a+=1
                else:
                    A[a]=10**10
            else:
                count+=B[b]
                ans+=1
                if b<len(B)-1:
                    b+=1
                else:
                    B[b]=10**10
        else:
            print(ans)
            break

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
count=0
a=0
b=0

while count<k:
    if A[a]<B[b]:
        if k-count>=A[a]:
            count+=A[a]
            ans+=1
            if a<len(A)-1:
                a+=1
            else:
                A[a]=10**10
        else:
            print(ans)
            break
                
    if A[a]>B[b]:
        if k-count>=B[b]:
            count+=B[b]
            ans+=1
            if b<len(B)-1:
                b+=1
            else:
                B[b]=10**10
    
        else:
            print(ans)
            break
    
    if A[a]==B[b]:
        if k-count>=B[b]:
            if A[a+1]<B[b+1]:
                count+=A[a]
                ans+=1
                if a<len(A)-1:
                    a+=1
                else:
                    A[a]=10**10
            else:
                count+=B[b]
                ans+=1
                if b<len(B)-1:
                    b+=1
                else:
                    B[b]=10**10
        else:
            print(ans)
            break
Problem p02624 (python)

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

Buggy submission (verdict: Runtime Error):
import sympy as sy
n=int(input())
ans=0
for i in range(1,n+1):
    ans+=i*len(sy.divisors(i))
print(ans)
Problem p02725 (python)

Fixed submission:
K,N=map(int,input().split())
A=list(map(int,input().split()))
B=sorted(A)
C=[]
for i in range(N-1):
    C.append(B[i+1]-B[i])
C.append(B[0]+K-B[N-1])
print(K-max(C))

Buggy submission (verdict: Runtime Error):
K,N=map(int,input().split())
A=[list(map(int,input().split()))]
del A[index(min(A))]
for a in A:
  a-=min(A)
print(max(A)-min(A))

Buggy submission (verdict: Runtime Error):
K,N=map(int,input().split())
A=[list(map(int,input().split()))]
print(max(A)-min(A))
Problem p02833 (python)

Fixed submission:
n = input()
m = len(n)
n = int(n)
if n%2==1:
    print(0)
else:
    if m==1:
        print(0)
    else:
        ans = 0
        i = 1
        while  True:
            ans_plus=n//(2*5**i)
            if ans_plus==0:
                break
            ans += ans_plus
            
            i += 1
        print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
if n == 0:
    print(0)
if n == 1:
    print(0)
else:
    if n % 2 ==1:
        print(0)
    else:
        ans = 0
        l = 10
        while n>=l:
            ans += floor(n/(l))
            l *= 5
        print(ans)
Problem p03053 (python)

Fixed submission:
from collections import deque
 
def solve(h, w, a):
    used = [[True] * (w+2) for _ in range(h+2)]
    que = deque()
    for r in range(h):
        used[r+1][1:-1] = map(lambda _:_=="#", a[r])
        for c in range(w):
            if a[r][c] == "#":
                que.append((r+1, c+1, 0))
    neighbors = [(1,0), (0,1), (-1,0), (0,-1)]
    while que:
        r, c, k = que.popleft()
        for dr, dc in neighbors:
            nr, nc = r+dr, c+dc
            if not used[nr][nc]:
                que.append((nr, nc, k+1))
                used[nr][nc] = True
    return k
 
h, w = map(int, input().split())
a = [input() for _ in range(h)]
print(solve(h, w, a))

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

h, w = map(int,input().split())
grid = [input() for i in range(h)]

#初期の黒の位置からの距離
dist = [[-1]*w for _ in range(h)] 

#黒の位置をキューに追加（複数スタート）
black_cells = deque()
for i in range(h):
    for j in range(w):
        if grid[i][j] == '#':
            black_cells.append((h,w))
            dist[i][j] = 0

def bfs(black_cells, dist):
    d = 0
    while black_cells:
        h,w = black_cells.popleft()
        d = dist[h][w]
        for dy, dx in ((1,0),(0,1),(-1,0),(0,-1)):
            new_h = h + dh
            new_w = w + dw
            if new_h <0 or h<=new_h or new_w <0 or w <= new_w:
                continue
            if dist[new_h][new_w] == -1: # セルがしろであるのと同意
                dist[new_h][new_w] = d+1
                
                black_cells.append((new_h,new_w))
    return d

d = bfs(black_cells, dist)
print(d)
Problem p03073 (python)

Fixed submission:
s = input()
l= len(s)
 
if l== 1:
    print(0)
    exit()
 
even = s[::2]
odd = s[1::2]

odd_zero = odd.count("0")
even_one = even.count("1")
 

odd_one = odd.count("1")
even_zero = even.count("0")
 
print(min(odd_zero + even_one, odd_one + even_zero))

Buggy submission (verdict: Runtime Error):
ースコード 

Copy
Copy
#参考 ： AtCoder # 14682107
s = input()
len = len(s)
 
if len == 1:
    print(0)
    exit()
 
even = s[::2]
odd = s[1::2]
 
#偶数番目に0が並ぶと仮定したときの異物の数
# 0101...
odd_zero = odd.count("0")
even_one = even.count("1")
 
 
#奇数番目に0が並ぶと仮定したときの異物の数
# 1010...
odd_one = odd.count("1")
even_zero = even.count("0")
 
print(min(odd_zero + even_one, odd_one + even_zero))

Buggy submission (verdict: Runtime Error):
ースコード 

Copy
Copy
#参考 ： AtCoder # 14682107
s = input()
len = len(s)
 
if len == 1:
    print(0)
    exit()
 
even = s[::2]
odd = s[1::2]
 
#偶数番目に0が並ぶと仮定したときの異物の数
# 0101...
odd_zero = odd.count("0")
even_one = even.count("1")
 
 
#奇数番目に0が並ぶと仮定したときの異物の数
# 1010...
odd_one = odd.count("1")
even_zero = even.count("0")
 
print(min(odd_zero + even_one, odd_one + even_zero))
Problem p02623 (python)

Fixed submission:
def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    AReqTime = [0]
    BReqTime = [0]

    for i in range(N):
        AReqTime.append(AReqTime[i] + A[i])
    for i in range(M):
        BReqTime.append(BReqTime[i] + B[i])

    j = M
    answer = 0

    for i in range(N + 1):
        if(AReqTime[i] > K):
            break

        while BReqTime[j] > K - AReqTime[i]:
            j = j - 1

        answer = max(i + j, answer)

    print(answer)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def survey(A, B, Ai, Bi, AMax, BMax, answer, reqTime, K):
    if(reqTime > K):
        return answer - 1
    else:
        if(Ai == AMax and Bi == BMax):
            return answer
        elif(Ai == AMax):
            return survey(A, B, Ai, Bi + 1, AMax, BMax, answer + 1, reqTime + B[Bi], K)
        elif(Bi == BMax):
            return survey(A, B, Ai + 1, Bi, AMax, BMax, answer + 1, reqTime + A[Ai], K)
        else:
            return max(survey(A, B, Ai + 1, Bi, AMax, BMax, answer + 1, reqTime + A[Ai], K), survey(A, B, Ai, Bi + 1, AMax, BMax, answer + 1, reqTime + B[Bi], K))
        
def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    A = A
    B = B

    AMax = len(A)
    BMax = len(B)

    answer = 0
    reqTime = 0

    Ai = 0
    Bi = 0

    answer = survey(A, B, Ai, Bi, AMax, BMax, answer, reqTime, K)
    print(answer)

if __name__ == "__main__":
    main()
Problem p02659 (python)

Fixed submission:
def main():
    A, B = map(int, input().replace(".", "").split())
    print(A*B//100)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    inputList = input().split()
    print(int(inputList[0]) * int(inputList[1]))

if __name__ == "__main__":
    main()
Problem p02781 (python)

Fixed submission:
#https://atcoder.jp/contests/abc154/tasks/abc154_e

def oneNum(N):
    answer = 0

    while(N > 0):
        if(N >= 9):
            answer = answer + 9
        else:
            answer = answer + N
        
        N = N // 10

    return answer

def twoNum(N):
    answer = 0

    strN = str(N)
    topN = int(strN[0])
    lenN = len(strN)

    if(lenN != 1):
        answer = answer + oneNum(int(strN[1:])) + (topN - 1) * oneNum(int('9' * (lenN - 1)))
        N = int('9' * (lenN - 1))

    while(N >= 10):
        N = N // 10
        answer = answer + 9 * oneNum(N)

    return answer

def main():
    N = int(input())
    K = int(input())

    answer = 0

    if(K == 1):
        answer = oneNum(N)

    elif(K == 2):
        answer = twoNum(N)

    else:
        strN = str(N)
        topN = int(strN[0])
        lenN = len(strN)

        answer = answer + twoNum(int(strN[1:])) + (topN - 1) * twoNum(int('9' * (lenN - 1)))

        N = int('9' * (lenN - 1))

        while(N >= 100):
            N = N // 10
            answer = answer + 9 * twoNum(N)

    print(answer)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def oneNum(N):
    answer = 0

    while(N > 0):
        if(N >= 9):
            answer = answer + 9
        else:
            answer = answer + N
        
        N = N // 10

    return answer

def twoNum(N):
    answer = 0

    strN = str(N)
    topN = int(strN[0])
    lenN = len(strN)

    answer = answer + oneNum(int(strN[1:])) + (topN - 1) * oneNum(int('9' * (lenN - 1)))

    N = int('9' * (lenN - 1))

    while(N >= 10):
        N = N // 10
        answer = answer + 9 * oneNum(N)

    return answer

def main():
    N = int(input())
    K = int(input())

    answer = 0

    if(K == 1):
        answer = oneNum(N)

    elif(K == 2):
        answer = twoNum(N)

    else:
        strN = str(N)
        topN = int(strN[0])
        lenN = len(strN)

        answer = answer + twoNum(int(strN[1:])) + (topN - 1) * twoNum(int('9' * (lenN - 1)))

        N = int('9' * (lenN - 1))

        while(N >= 100):
            N = N // 10
            answer = answer + 9 * twoNum(N)

    print(answer)


if __name__ == "__main__":
    main()
Problem p02594 (python)

Fixed submission:
X=int(input())

if X>=30:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
c=input()

i=0
listNum=[]

for i in range(N):
    w=c.count("W",0,i)
    s=c.count("R",i+1,N)
    listNum.append(max(w,s))
    i+=1
print(min(listNum))
Problem p02627 (python)

Fixed submission:
import sys
from sys import stdin

str = sys.stdin.readline()

if str.islower():
    print('a')
else:
    print('A')

Buggy submission (verdict: Runtime Error):
from sys import stdin

str = stdin.readline().rstrip()

if str.islower():
    print('a')
else:
    print('A'from sys import stdin

str = stdin.readline().rstrip()

if str.islower():
    print('a')
else:
    print('A'
Problem p02754 (python)

Fixed submission:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    n,a,b = map(int,input().split())
    a_count=0
    d,r=divmod(n,a+b)
    a_count+=a*d
    if r > a:
        a_count+=a
    else:
        a_count+=r
    print(a_count)

if __name__=="__main__":
    main()

Buggy submission (verdict: Runtime Error):
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    n,a,b = map(int,input().split())
    count=0
    blue_count=0
    blue=""
    red=""
    tmp=""
    ball_list=[]

    while count < n:
        blue = "b"*a
        red = "r"*b
        tmp+=blue+red
        count=len(tmp)
    ball_list.append(tmp)
    print(str(ball_list[0])[:n].count("b"))

if __name__=="__main__":
    main()