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

Fixed submission:
A,B=map(int,input().split())
def f(n):
    if n%4==0:
        return n
    elif n%4==1:
        return 1
    elif n%4==2:
        return n^1
    else:
        return 0
print(f(A-1)^f(B))

Buggy submission (verdict: Runtime Error):
import numpy as np
A,B=map(int,input().split())
s=[]
for i in range(A,B+1):
    s.append(format(i,'b'))
for i in range(len(s)):
    if len(s[i])<len(s[-1]):
        s[i]='0'+s[i]
a=np.array(s)
b=[list(map(int,a[i])) for i in range(len(a))]
b=np.array(b)
x=[0]*len(s[-1])#x[0]~s[len(s[-1])-1]
ans=''
for i in range(len(s[-1])):
    if np.sum(b[:,i])%2==0:
        x[len(s[-1])-1-i]='0'
    else:
         x[len(s[-1])-1-i]='1'
for i in range(len(s[-1])):
    ans+=x[i]
print(ans)
print(int(ans,2))
Problem p03107 (python)

Fixed submission:
S=list(map(int,input()))
a=0
b=0
for i in range(len(S)):
    if S[i]==1:
        a+=1
    else:
        b+=1
print(2*min(a,b))

Buggy submission (verdict: Runtime Error):
S=list(map(int,input()))
a=0
b=0
for i in range(lin(S)):
  if S[i]==1:
    a+=1
  else:
    b+=1
print(2*min(a,b))
Problem p03253 (python)

Fixed submission:
N,M=map(int,input().split())
a=[]
ans=1
def calc(n):#nの素因数分解
    for i in range(2,int(n**0.5)+10):
        count=0
        while n%i==0:
            n//=i
            count+=1
        if count>=1:
            a.append([i,count])
    if n!=1:
        a.append([n,1])
calc(M)
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result
for i in range(len(a)):
    ans*=cmb(a[i][1]+N-1,a[i][1])
print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
import math
from scipy import special
a=[]
ans=1
def calc(n):#nの素因数分解
    for i in range(2,int(n**0.5)+10):
        count=0
        while n%i==0:
            n//=i
            count+=1
        if count>=1:
            a.append([i,count])
    if n!=1:
        a.append([n,1])
calc(M)
for i in range(len(a)):
    ans*=special.comb(a[i][1]+N-1,a[i][1],True)
print(ans%(10**9+7))
Problem p03077 (python)

Fixed submission:
n = int(input())
List = []
List.append(int(input()))
List.append(int(input()))
List.append(int(input()))
List.append(int(input()))
List.append(int(input()))

import math
print(math.ceil(n/min(List))+4)

Buggy submission (verdict: Runtime Error):
n = int(input())
List = []
List.append(int(input()))
List.append(int(input()))
List.append(int(input()))
List.append(int(input()))
List.append(int(input()))

#import math
print(math.ceil(n/min(List))+4)
Problem p03137 (python)

Fixed submission:
N, M, *X = map(int, open(0).read().split())
X.sort()

y = sorted([X[i + 1] - X[i] for i in range(len(X) - 1)], reverse=True)
print(sum(y[N - 1:]))

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

x_diff = [x[i+1] - x[i] for i in range(len(x)-1)]
for _ in range(n-1):
    del x_diff[x_diff.index(max(x_diff))]
    
print(sum(x_diff))
Problem p02753 (python)

Fixed submission:
Line = set(list(input()))

if len(Line) == 2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S =input()

input_line = int(input())

flag0 = ""
flag1 = ""
flag = 0


for i in range(input_line):
    action = list(input())
    # print(flag0,flag1)
    # print(action)
    if action[0]=="1":
        if flag == 0:
            flag = 1
        else:
            flag = 0
    else:
        # print("check")
        if action[2] == "2":
            
            if flag == 0:
                flag0 = flag0 + action[4]
            elif flag ==1:
                flag1 = action[4] + flag1
        else:
            if flag == 0:
                flag0 = action[4] + flag0
            
            elif flag == 1:
                flag1 += action[4]
                
S = flag0 + S + flag1
if flag == 1:
    S = S[::-1]
    
print(S)
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_sum = [0]
for i in range(N):
    A_sum.append(A[i]+A_sum[i])

B_sum = [0]
for i in range(M):
    B_sum.append(B[i]+B_sum[i])

max_count = 0
j = M
for i in range(N+1):
    if A_sum[i] > K:
        break

    while B_sum[j] + A_sum[i] > K:
        j -= 1
    max_count = max(max_count, i + j)
print(max_count)

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_sum = []
a_sum = 0
for a in A:
    a_sum += a
    A_sum.append(a_sum)

B_sum = []
b_sum = 0
for b in B:
    b_sum += b
    B_sum.append(b_sum)

max_count = 0
for i in range(N):
    j = M - 1
    if A_sum[i] > K:
        break

    while B_sum[j] + A_sum[i] > K:
        j -= 1
    max_count = max(max_count, i+1 + j+1)
print(max_count)

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_sum = []
a_sum = 0
for a in A:
    a_sum += a
    A_sum.append(a_sum)

B_sum = []
b_sum = 0
for b in B:
    b_sum += b
    B_sum.append(b_sum)

max_count = 0
for idx, a_sum in enumerate(A_sum):
    j = M - 1
    if a_sum > K:
        break

    while B_sum[j] + a_sum > K:
        j -= 1
    max_count = max(max_count, idx+1 + j+1)
print(max_count)

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_sum = []
a_sum = 0
for a in A:
    a_sum += a
    A_sum.append(a_sum)

B_sum = []
b_sum = 0
for b in B:
    b_sum += b
    B_sum.append(b_sum)

max_count = 0
for idx, a_sum in enumerate(A_sum):
    j = M - 1
    if a_sum > K:
        break

    while B_sum[j] + a_sum > K:
        j -= 1
    max_count = max(max_count, idx+1 + j+1)
print(max_count)
Problem p02754 (python)

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


if N % (A+B) >= A:
    print((N // (A+B))*A + A)
else:
    print((N // (A+B))*A + N % (A+B))

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

blue = "b"*A
red = "r"*B
br = blue + red

# print(blue, red, br)

S = br*N
import collections

print(collections.Counter(S[:N])["b"])
Problem p02860 (python)

Fixed submission:
N = int(input())
S = input()
if S[:int(N / 2)] == S[int(N / 2):]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
if S[N/2] == S[N/2:]:
    print("Yes")
else:
    print("No")
Problem p02915 (python)

Fixed submission:
N = int(input())
print(N**3)

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

print(N**3)
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(s)
    else:
        print("red")
Problem p02954 (python)

Fixed submission:
S = input()

s_list = S.split("LR")
all_list = []

for idx, s in enumerate(s_list):
    if len(s_list) > 1:
        if idx != 0 and idx != len(s_list)-1:
            s = "R" + s + "L"
        elif idx == 0:
            s = s + "L"
        elif idx == len(s_list)-1:
            s = "R" + s
    s_len = len(s)
    R_count = s.count('R')
    L_count = s.count('L')
    R_list = [0 for _ in range(R_count)]
    L_list = [0 for _ in range(L_count)]

    if s_len % 2 == 0:
        R_list[R_count - 1] = s_len // 2
        L_list[0] = s_len // 2

    else:
        if R_count % 2 == 1:
            R_list[R_count - 1] = s_len - (s_len // 2)
            L_list[0] = s_len // 2
        else:
            R_list[R_count - 1] = s_len // 2
            L_list[0] = s_len - (s_len // 2)

    all_list.extend(R_list)
    all_list.extend(L_list)

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

Buggy submission (verdict: Runtime Error):
S = input()

s_list = S.split("LR")
all_list = []

for idx, s in enumerate(s_list):
    if len(s_list) > 2:
        if idx != 0 and idx != len(s_list)-1:
            s = "R" + s + "L"
        elif idx == 0:
            s = s + "L"
        elif idx == len(s_list)-1:
            s = "R" + s
    s_len = len(s)
    R_count = s.count('R')
    L_count = s.count('L')
    R_list = [0 for _ in range(R_count)]
    L_list = [0 for _ in range(L_count)]

    if s_len % 2 == 0:
        R_list[R_count - 1] = s_len // 2
        L_list[0] = s_len // 2

    else:
        if R_count % 2 == 1:
            R_list[R_count - 1] = s_len - (s_len // 2)
            L_list[0] = s_len // 2
        else:
            R_list[R_count - 1] = s_len // 2
            L_list[0] = s_len - (s_len // 2)

    all_list.extend(R_list)
    all_list.extend(L_list)

print(" ".join(map(str, all_list)))
Problem p02990 (python)

Fixed submission:
from operator import mul
from functools import reduce

def cmb(n, r):
    r = min(n - r, r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under % (10 ** 9 + 7)

N, K = map(int, input().split())
for i in range(K):
    if N-K+1 >= i + 1 and K-1 >= i:
        # a = factorial(N-K+1) / factorial(i+1) / factorial(N-K+1 - (i+1))
        a = cmb(N-K+1, i + 1)
        # b = factorial(K-1) / factorial(i) / factorial(K-1 - i)
        b = cmb(K-1, i)
        print((a*b) % (10**9+7))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def cmb(n, r):
    r = min(n - r, r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under % (10 ** 9 + 7)

N, K = map(int, input().split())
for i in range(K):
    # a = factorial(N-K+1) / factorial(i+1) / factorial(N-K+1 - (i+1))
    a = cmb(N-K+1, i + 1)
    # b = factorial(K-1) / factorial(i) / factorial(K-1 - i)
    b = cmb(K-1, i)

    print((a*b) % (10**9+7))

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def cmb(n, r):
    r = min(n - r, r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

N, K = map(int, input().split())
for i in range(K):
    # a = factorial(N-K+1) / factorial(i+1) / factorial(N-K+1 - (i+1))
    a = cmb(N-K+1, i + 1)
    # b = factorial(K-1) / factorial(i) / factorial(K-1 - i)
    b = cmb(K-1, i)

    print((a*b) % (10**9+7))

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def cmb(n, r):
    r = min(n - r, r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

a = cmb(n, r)
N, K = map(int, input().split())
for i in range(K):
    # a = factorial(N-K+1) / factorial(i+1) / factorial(N-K+1 - (i+1))
    a = cmb(N-K+1, i + 1)
    # b = factorial(K-1) / factorial(i) / factorial(K-1 - i)
    b = cmb(K-1, i)

    print((a*b) % (10**9+7))

Buggy submission (verdict: Runtime Error):
from math import factorial
N, K = map(int, input().split())
for i in range(K):
    a = factorial(N-K+1) / factorial(i+1) / factorial(N-K+1 - (i+1))
    b = factorial(K-1) / factorial(i) / factorial(K-1 - i)

    print((a*b) % (10**9+7))
Problem p03307 (python)

Fixed submission:
N = int(input())

import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

print(lcm(2, N))

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

import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(2, N))
Problem p03775 (python)

Fixed submission:
def make_divisors(n):
    divisors = []
    min_k = 10
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            k = max(len(str(int(i))), len(str(int(n // i))))
            min_k = min(min_k, k)

    # divisors.sort()
    return min_k

N = int(input())
# min_k = len(str(N)) + 1
# for i in range(1, N):
#     if N % i != 0:
#         continue
#     if i ** 2 > N:
#         break
#     else:
#         ii = N // i
#         k = max(len(str(i)), len(str(ii)))
#         # print(i, ii, k, min_k)
#         if min_k > k:
#             min_k = k
print(make_divisors(N))

Buggy submission (verdict: Runtime Error):
def make_divisors(n):
    divisors = []
    min_k = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
                k = max(len(str(int(i))), len(str(int(n // i))))
                min_k.append(k)

    # divisors.sort()
    return min_k

N = int(input())
# min_k = len(str(N)) + 1
# for i in range(1, N):
#     if N % i != 0:
#         continue
#     if i ** 2 > N:
#         break
#     else:
#         ii = N // i
#         k = max(len(str(i)), len(str(ii)))
#         # print(i, ii, k, min_k)
#         if min_k > k:
#             min_k = k
print(min(make_divisors(N)))

Buggy submission (verdict: Runtime Error):
def make_divisors(n):
    divisors = []
    min_k = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
                k = max(len(str(i)), len(str(n // i)))
                min_k.append(k)

    # divisors.sort()
    return min_k

N = int(input())
# min_k = len(str(N)) + 1
# for i in range(1, N):
#     if N % i != 0:
#         continue
#     if i ** 2 > N:
#         break
#     else:
#         ii = N // i
#         k = max(len(str(i)), len(str(ii)))
#         # print(i, ii, k, min_k)
#         if min_k > k:
#             min_k = k
print(min(make_divisors(N)))
Problem p02596 (python)

Fixed submission:
k = int(input())
i = int(str(k)[-1])
if(i % 2 == 0 | i % 5 == 0 ):
    print(-1)
else:
    num = 7
    result=1
    for i in range(k):
        if(num % k == 0):
            break
        else:
            num = (7+ num*10)%k
            result+=1
    else:
        result = -1
    print(result)

Buggy submission (verdict: Runtime Error):
k = int(input())
i = int(str(k)[-1])
if(i % 2 == 0 | i % 5 == 0 ):
    print(-1)
else:
    numl = [0]*k
    num = 7
    for i in range(k):
        numl[i] = num
        num = 7+ num*10
        
    for i in range(k):
        if(numl[i] % k == 0):
            break
        else:
            result=i+1
    else:
        result = -1
    print(result)
Problem p02597 (python)

Fixed submission:
n = int(input())
c = input()
cl = list(c)
wi = 0
wnum=0
ri = n-1
rnum=0
br=0
bw=0
res1 = n
break1 = 0
for i in range(n):
    while(cl[wi] == "R" and bw==0):
        wi+=1
        if(wi >= n-1):
            bw=1
            break
    if(cl[wi] == "W"):
        wnum+=1
    while(cl[ri] == "W" and br==0):
        ri-=1
        if(ri <= 0):
            br=1
            break
    if(cl[ri] == "R"):
        rnum+=1
    if(ri < wi and break1 == 0):
        res1 = i
        break1 = 1
    wi+=1
    if(wi >= n-1):
        wi=0
        bw=1
    ri-=1
    if(ri <= 0):
        ri=n-1
        br=1

    if(br*bw==1):
        break
print(min(res1, rnum, wnum))

Buggy submission (verdict: Runtime Error):
n = int(input())
c = input()
cl = list(c)
wi = 0
wnum=0
ri = n-1
rnum=0
br=0
bw=0
for i in range(n):
    while(cl[wi] == "R" and bw==0):
        wi+=1
        if(wi >= n-1):
            bw=1
            break
    if(cl[wi] == "W"):
        wnum+=1
    wi+=1
    if(wi >= n-1):
        wi=0
        bw=1
    while(cl[ri] == "W" and br==0):
        ri-=1
        if(ri <= 0):
            br=1
            break
    if(cl[ri] == "R"):
        rnum+=1
    ri-=1
    if(ri <= 0):
        ri=n-1
        br=1
    if(ri < wi):
        res1 = i+1
    if(br*bw==1):
        break
print(min(res1, rnum, wnum))

Buggy submission (verdict: Runtime Error):
n = int(input())
c = input()
cl = list(c)
wi = 0
wnum=0
ri = n-1
rnum=0
br=0
bw=0
for i in range(n):
    while(cl[wi] == "R" and bw==0):
        wi+=1
        if(wi >= n-1):
            bw=1
            break
    if(cl[wi] == "W"):
        wnum+=1
    wi+=1
    if(wi >= n-1):
        wi=0
        bw=1
    while(cl[ri] == "W" and br==0):
        ri-=1
        if(ri <= 0):
            br=1
            break
    if(cl[ri] == "R"):
        rnum+=1
    ri-=1
    if(ri <= 0):
        ri=n-1
        br=1
    #print(wi, ri)
    if(ri < wi):
        res1 = i+1
    if(br*bw==1):
        break
print(min(res1, rnum, wnum))

Buggy submission (verdict: Runtime Error):
n = int(input())
c = input()
cl = list(c)
wi = 0
wnum=0
ri = n-1
rnum=0
for i in range(n):
    br=0
    bw=0
    while(cl[wi] == "R" and br==0):
        wi+=1
        if(wi >= n-1):
            br=1
            break
    if(cl[wi] == "W"):
        wnum+=1
    wi+=1
    if(wi >= n-1):
        wi=0
        br=1
    while(cl[ri] == "W" and bw==0):
        ri-=1
        if(ri <= 0):
            bw=1
            break
    if(cl[ri] == "R"):
        rnum+=1
    ri-=1
    if(ri <= 0):
        ri=n-1
        bw=1
    #print(wi, ri)
    if(ri < wi):
        res1 = i+1
    if(br*bw==1):
        break
print(min(res1, rnum, wnum))
Problem p02624 (python)

Fixed submission:
n = int(input())
result = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        if(i * j <= n):
            result += i*j
        else:
            break
print(result)

Buggy submission (verdict: Runtime Error):
import math
from operator import mul
from functools import reduce
def get_primenumber(number):#エラトステネスの篩
    prime_list = []
    search_list = list(range(2,number+1))
    #search_listの先頭の値が√nの値を超えたら終了
    while search_list[0] <= math.sqrt(number):
        head_num = search_list.pop(0)
        prime_list.append(head_num)
        #head_numの倍数を除去
        search_list = [num for num in search_list if num % head_num != 0]
    #prime_listにsearch_listを結合
    prime_list.extend(search_list)
    return prime_list

n = int(input())
plist = get_primenumber(n)
result = 0
for i in range(1, n+1):
    templ = [1]
    i1 = i
    for j in plist:
        if(j == i):
            templ.append(2)
            break
        elif(i % j == 0):
            temp = 1
            while(i % j == 0 and i != j):
                
                i = int(i / j)
                temp += 1
            if(i == j):
                temp +=1
            templ.append(temp)
    result += reduce(mul, templ) * i1
print(result)
Problem p02627 (python)

Fixed submission:
data = input()

if data.isupper():
    print("A")
elif data.islower():
    print("a")

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


for i in range(Q):
    b, c = map(int, input().split())
    for j, name in enumerate(An):
        if An[j] == b:
            An[j] = c
    
    print(sum(An))

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

bc = [map(int, input().split()) for _ in range(Q)]
b, c = [list(i) for i in zip(*bc)]

for i in range(Q):
    for j, name in enumerate(An):
        if An[j] == b[i]:
            An[j] = c[i]
    
    print(sum(An))
Problem p02546 (python)

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

Buggy submission (verdict: Runtime Error):
from pattern.en import pluralize, singularize
s=input()
print(pluralize(s))
Problem p02577 (python)

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

Buggy submission (verdict: Runtime Error):
N=int(input())
if N%9 == 0:
  print(Yes)
else:
  print(No)

Buggy submission (verdict: Runtime Error):
int(input())
N = input()
if(N%9=0)
print(Yes)
if(N%9=!0)
print(No)
Problem p02831 (python)

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

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

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
num = 1
ans = 0
for i in range(n):
  if A[i] == num:
    num += 1
    ans += 1
if ans == 0:
  print("-1")
else:
  print(n-ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
num = 1
ans = 0
for i in range(n):
  if A[i] == num:
    num += 1
    ans += 1
if ans == 0:
  print("-1")
else:
print(n-ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
num = 1
ans = 0
for i in range(n):
  if A[i] == num:
    num += 1
    ans += 1
if ans = 0:
  print("-1")
else:
print(n-ans)
Problem p03127 (python)

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
import fractions
g = fractions.gcd(A[0],A[1])
for i in range(2,n):
  g = fractions.gcd(g,A[i])
print(g)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int,input().split()))
import fractions
g = fractions.gcd(A[0],A[1])
for i in range(2,n):
  g = fracitons.gcd(g,A[i])
print(g)
Problem p02552 (python)

Fixed submission:
x = int(input())

if x == 0:
    print(1)

else:
    print(0)

Buggy submission (verdict: Runtime Error):
x = import()

if x == 0:
    print(1)

else:
    print(0)

Buggy submission (verdict: Runtime Error):
x = int(import())

if x == 0:
    print(1)

else:
    print(0)
Problem p02594 (python)

Fixed submission:
temp = int(input())
if temp >= 30:
    print("Yes")

else:
    print("No")

Buggy submission (verdict: Runtime Error):
temp = input()
if temp >= 30:
    print("Yes")

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

Fixed submission:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

n = inp()
s = input().strip()
print(s[:s.count('R')].count('W'))

Buggy submission (verdict: Runtime Error):
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

n = inp()
s = input().strip()
if s.count('W') in [0,n]:
    print(0)
    exit()
ans = n
w,r = 0,s.count('R')
for i in range(n):
    if s[i] == 'W':
        w += 1
    elif s[i] == 'R':
        r -= 1
    ans = max(ans,min(w,r))
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

n = inp()
s = input().strip()
l,r = 0,n-1
ct = 0
if s.count('W') in [0,n]:
    print(ct)
    exit()
while l < r:
    while s[l] == 'R':
        if l >= r:
            break
        l += 1
    while s[r] == 'W':
        if l >= r:
            break
        r -= 1
    ct += 1
    l += 1
    r -= 1
print(min(ct,s.count('R'),s.count('W')))
Problem p02622 (python)

Fixed submission:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

s = input().strip()
t = input().strip()
n = len(s)
ans = 0
for i in range(n):
    if s[i] != t[i]:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

s = input().strip()
t = input().strip()
ans = 0
for i in range(n):
    if s[i] != t[i]:
        ans += 1
print(ans)