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

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N = inputInt()
	Nnum = [0 for i in range(N+1)]

	for i in range(1,N+1):
		for j in range(i,N+1,i):
			Nnum[j] += 1

	ans = 0
	for i,val in enumerate(Nnum):
		ans += i * val

	print(ans)



#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
import sympy
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N = inputInt()

	ans = 0
	for i in range(N+1):
		tmp = sympy.divisor_count(i)
		#print(tmp)
		tmp = i * tmp
		ans += tmp

	print(ans)


def make_divisors(n):
    divisors = []
    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)

    # divisors.sort()
    return divisors

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()
Problem p02629 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N = inputInt()

	print(num2alpha(N).lower())


def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N = inputInt()

	print(alpha2num(N).upper())


def alpha2num(alpha):
    num=0
    for index, item in enumerate(list(alpha)):
        num += pow(26,len(alpha)-index-1)*(ord(item)-ord('A')+1)
    return num

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()
Problem p03013 (python)

Fixed submission:
import sys
import numpy as np
MOD = 1000000007
def main():
    n, m = [int(x) for x in input().split()]
    pattern = [1]
    broken = -1
    brokencnt = 0
    if brokencnt < m:
        broken = int(input())
        brokencnt += 1
    for i in range(1, n + 1):
        if i == broken:
            pattern.append(0)
            if brokencnt < m:
                broken = int(input())
                brokencnt += 1
            continue
        if i == 1:
            pattern.append(pattern[i - 1])
        if i > 1:
            pattern.append((pattern[i - 1] + pattern[i - 2]) % MOD)
    print(pattern[n])
main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
import statistics
from statistics import mean, median,variance,stdev
import math

def main():
	N, M = map(int, input().split(" "))
	N += 1
	a = []
	for i in range(M):
		tmp = int(input())
		tmp += 1
		a.append(tmp)
		if i != 0 and tmp == a[-1]+1:
			print(0)
			sys.exit()
			
	DP = [0 for i in range(N)]
	for i in range(N):
		if i == 0:
			DP[0] = 1
			continue
		if N-i in a:
			continue
		tmp = 0
		if i-1 >= 0:
			tmp = (tmp + (DP[i-1] % 1000000007)) % 1000000007
		if i-2 >= 0:
			tmp = (tmp + (DP[i-2] % 1000000007)) % 1000000007
		DP[i] = tmp
		
	#print(DP)
	print(DP[-1])
	
	
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import sympy as sym
input = sys.stdin.readline
 
# bisect_left(lists, 3)
# bisect_right(lists, 3)

# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

def main():
	N,M = map(int, input().split(" "))
	#N = int(input())
	#S = input()
	#S = list(S)
	
	a = []
	for _ in range(M):
		tmp = int(input())
		if len(a) != 0:
			if tmp-1 == a[-1]:
				print(0)
				sys.exit()
		a.append(tmp)

	if M == 0:
		print(fb(N+1))
		sys.exit()

	base = 0
	ans = 1
	for i, vol in enumerate(a):
		if base == 0:
			ans = ans * fb(vol)
			base = vol
		else:
			ans = (ans% 1000000007) * (fb(vol-base)% 1000000007)
			base = vol

	if N != base:
		ans = (ans% 1000000007) * (fb(N-base)% 1000000007)

	print(ans % 1000000007)


def fb(num):
    """num番目のフィボナッチ数を返す
    """
    a, b = 1, 0
    for _ in range(num):
        a, b = a + b, a
    return b

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

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
input = sys.stdin.readline
 
# bisect_left(lists, 3)
# bisect_right(lists, 3)

# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

def main():
	N, M = map(int, input().split(" "))
	#N = int(input())
	#S = input()

	A = input().split(" ")
	A = list(A)
	#A = A[:-1]
	A = [(int(s) * (-1), 1) for s in A]
	heapq.heapify(A)

	for i in range(M):
		b, c = map(int, input().split(" "))
		heapq.heappush(A, (c * (-1), b))
	
	ans = []
	for i in range(N):
		t, con = heapq.heappop(A)
		for _ in range(con):
			if len(ans) == N:
				print(sum(ans))
				sys.exit()
			ans.append(t * (-1))
	print(sum(ans))


if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
input = sys.stdin.readline
 
# bisect_left(lists, 3)
# bisect_right(lists, 3)
 
def main():
	N, M = map(int, input().split(" "))
	#N = int(input())
	#S = input()

	A = input().split(" ")
	A = list(A)
	#A = A[:-1]
	A = [int(s) for s in A]

	BC = []
	for i in range(M):
		b, c = map(int, input().split(" "))
		BC.append((c, b))

	BC.sort(reverse=True)
	A.sort()
	A_tmp = A

	ans = 0
	for i in BC:
		#print(A_tmp)
		c, b = i
		if A_tmp[0] >= c:
			continue

		tmp = bisect_left(A_tmp, c)
		if tmp <= b:
			A_tmp[:tmp] = [c] * tmp
			A_tmp = A_tmp[tmp:]
			ans = ans + (c * tmp)

		elif tmp > b:
			A_tmp[:b] = [c] * b
			A_tmp = A_tmp[b:]
			ans = ans + (c * b)
		
		A_tmp.sort()

	print(ans + sum(A_tmp))


if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
input = sys.stdin.readline
 
# bisect_left(lists, 3)
# bisect_right(lists, 3)
 
def main():
	N, M = map(int, input().split(" "))
	#N = int(input())
	#S = input()

	A = input().split(" ")
	A = list(A)
	#A = A[:-1]
	A = [int(s) for s in A]

	BC = []
	for i in range(M):
		b, c = map(int, input().split(" "))
		BC.append((c, b))

	BC.sort(reverse=True)
	A.sort()
	A_tmp = A[:]

	ans = 0
	for i in BC:
		#print(A_tmp)
		c, b = i
		if A_tmp[0] >= c:
			continue

		tmp = bisect_left(A_tmp, c)
		if tmp <= b:
			A_tmp[:tmp] = [c] * tmp
			A_tmp = A_tmp[tmp:]
			ans = ans + (c * tmp)

		elif tmp > b:
			A_tmp[:b] = [c] * b
			A_tmp = A_tmp[b:]
			ans = ans + (c * b)
		
		A_tmp.sort()

	print(ans + sum(A_tmp))


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

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

Buggy submission (verdict: Runtime Error):
x = int(input())
return "Yes" if x >= 30 else "No"
Problem p03135 (python)

Fixed submission:
t, x = map(int, input().split())
print(t / x)

Buggy submission (verdict: Runtime Error):
t, x = map(int, inupt().split())
print(t / x)
Problem p02659 (python)

Fixed submission:
import math

a, b = input().split()
A, B = [int(a), int(b.replace('.', ''))]

print(A * B // 100)

Buggy submission (verdict: Runtime Error):
import math

a, b = input().split()
A, B = [int(a), int(b.replace('.', '')]

print(A * B // 100)

Buggy submission (verdict: Runtime Error):
import math

a, b = input().split()
A, B = [int(a), int(b * 100)]

print(A * B / 100)
Problem p02595 (python)

Fixed submission:
N,Q = [int(w) for w in input().split()]
i = 0
x = []
y = []
count = 0
while i < N:
    a,b = [int(w) for w in input().split()]
    x.append(a)
    y.append(b)
    i +=1
for i in range(N):
    m = (x[i]**2 + y[i]**2)**(1/2)
    if  m <= Q:
        count += 1
    else:
        count += 0
print(count)

Buggy submission (verdict: Runtime Error):
N,Q = [int(w) for w in input().split()]
i = 0
x = []
y = []
while i < N:
    a,b = [int(w) for w in input().split()]
    x.append(a)
    y.append(b)
    i +=1
for i in range(N):
    m = (x[i]**2 + y[i]**2)**(1/2)
    if  m <= Q:
        count += 1
    else:
        count += 0
print(count) = 0

Buggy submission (verdict: Runtime Error):
N,Q = [int(w) for w in input().split()]
i = 0
x = []
y = []
while i < N:
    a,b = [int(w) for w in input().split()]
    x.append(a)
    y.append(b)
    i +=1
for i in range(N):
    m = (x[i]**2 + y[i]**2)**(1/2)
    if  m <= Q:
        count += 1
    else:
        count += 0
print(count)ount = 0

Buggy submission (verdict: Runtime Error):
N,Q = [int(w) for w in input().split()]
i = 0
x = []
y = []
cile i < N:
    a,b = [int(w) for w in input().split()]
    x.append(a)
    y.append(b)
    i +=1
for i in range(N):
    m = (x[i]**2 + y[i]**2)**(1/2)
    if  m <= Q:
        count += 1
    else:
        count += 0
print(count)ount = 0
Problem p02676 (python)

Fixed submission:
K = int(input())
S = str(input()).lower()

if 0 < K < 101 and 0 < len(S) < 101:
    if len(S) <= K:
        print(S)
    else:
        print(S[:K] + "...") 
else:
    print("Try again with K and length of S between 1 and 100 ")

Buggy submission (verdict: Runtime Error):
K = int(input())
S = str(input()).lower()

if 0 < K < 101 and 0 < len(S) < 101:
    if len(S) =< K:
        print(S)
    else:
        print(S[:K] + "...") 
else:
    print("Try again with K and length of S between 1 and 100 ")
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()))
 
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)
Problem p02623 (python)

Fixed submission:
import numpy

n,m,k = map(int,input().split())
li_a = list(map(int,input().split()))
li_b = list(map(int,input().split()))

li_A = [0] + list(numpy.cumsum(li_a))
li_B = [0] + list(numpy.cumsum(li_b))

ans, j = 0,m
for i in range(n+1):
    if li_A[i] > k:
        break
    while li_B[j] + li_A[i]> k:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy

n,m,k = map(int,input().split())
li_a = list(map(int,input().split()))
li_b = list(map(int,input().split()))

li_A = numpy.cumsum(li_a)
li_B = numpy.cumsum(li_b)

ans, j = 0,m
for i in range(n + 1):
    if li_A[i] > k:
        break
    while li_B[j] + li_A[i]> k:
        j -= 1
    ans = max(ans, i + j)
print(ans)

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

n,m,k = map(int,input().split())
li_a = deque(list(map(int,input().split())))
li_b = deque(list(map(int,input().split())))
ans,cnt = 0,0

for i in range(n+m+1):
    if n != 0:
        a_num = li_a[0]
    else:
        a_num = math.inf

    if m != 0:
        b_num = li_b[0]
    else:
        b_num = math.inf

    if a_num <= b_num:
        temp = a_num
        li_a.popleft()
        n -= 1
    else:
        temp = b_num
        li_b.popleft()
        m -= 1

    if cnt + temp > k:
        break
    else:
        cnt += temp
        ans += 1

print(ans)
Problem p02699 (python)

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

Buggy submission (verdict: Runtime Error):
s = input()
cnt=0
for i in range(len(s)-3):
    for j in range(i+4,len(s)):
        if int(s[i:j+1]) % 2019 == 0:
            cnt+= 1
print(cnt)
Problem p02753 (python)

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

Buggy submission (verdict: Runtime Error):
s=input().split()
if s[0] != s[1] or s[1] != s[2]:
    print("Yes)
else:
    print("No)

Buggy submission (verdict: Runtime Error):
s=list(input())
if s[0] != s[1] or s[1] != s[2]:
  print("Yes)
else:
        print("No)
Problem p02933 (python)

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

if a >= 3200:
    print(s)
else:
    print('red')

Buggy submission (verdict: Runtime Error):
n, q = map(int,input().split())
top_list = [list(map(int,input().split())) for i in range(n - 1)]
ope_list = [list(map(int,input().split())) for i in range(q)]
ans = [0] * n

"""
for i in ope_list:
    ans[i[0] - 1] += i[1]

for j in range(n):
    for k in top_list:
        if j + 1 == k[1]:
            ans[j] += ans[k[0] - 1]
"""

print(*ans)
Problem p02951 (python)

Fixed submission:
a, b, c = map(int,input().split())
print(max(c-a+b,0))

Buggy submission (verdict: Runtime Error):
a, b, c = map(int,input().split())
print(max(c-a-b),0)
Problem p02987 (python)

Fixed submission:
s = list(input())
s.sort()

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

Buggy submission (verdict: Runtime Error):
s = list(input())
s.sort()

if s[0] == s[1] and s[2] == s[3] and s[0] != s[3]
    print("Yes")
else:
    print("No")
Problem p03011 (python)

Fixed submission:
a, b, c = map(int, input().split())
print(min(min(a+b,b+c),a+c))

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print(min(min(a+b,b+c),a+c)
Problem p03723 (python)

Fixed submission:
a,b,c = map(int,input().split())
cnt=0
if a==b==c and a%2==0:
    cnt = -1
else:
    for i in range(100):
        if a%2==0 and b%2==0 and c%2==0:
            t_a = b//2 + c//2
            t_b = a//2 + c//2
            t_c = a//2 + b//2
            a,b,c = t_a,t_b,t_c
            cnt+=1
        else:
            break
print(cnt)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
cnt=0
if a==b==c and a%2==0:
    cnt = -1
    break
elif:
    for i in range(100):
        if a%2==0 and b%2==0 and c%2==10:
            t_a = b//2 + c//2
            t_b = a//2 + c//2
            t_c = a//2 + b//2
            a,b,c = t_a,t_b,t_c
            cnt+=1
        else:
            break
print(cnt)
Problem p02785 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n, k = map(int,input().split())
h = [int(i) for i in input().split()]

if k >= n:
    ans = 0
else:
    h.sort()
    tmp = 0
    for i in range(n-k, n):
        tmp += h[i]
    ans = (sum(h) - tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n, k = map(int,input().split())
h = [int(i) for i in input().split()]

h.sort()
tmp = 0
for i in range(n-k, n):
    tmp += h[i]
if k >= n:
    ans = 0
else:
    h.sort()
    tmp = 0
    for i in range(n-k, n):
        tmp += h[i]
    ans = (sum(h) - tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n, k = map(int,input().split())
h = [int(i) for i in input().split()]

h.sort()
tmp = 0
for i in range(n-k, n):
    tmp += h[i]
if k >= n:
    ans = 0
else:
    ans = (sum(h) - tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n, k = map(int,input().split())
h = [int(i) for i in input().split()]

tmp = 0
for i in range(n-k, n):
    tmp += h[i]
if k >= n:
    ans = 0
else:
    ans = (sum(h) - tmp)
print(ans)
Problem p02831 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a,b = map(int,input().split())

def gcd(a,b):
    x = max(a,b)
    y = min(a,b)
    if x % y == 0:
        return y
    else:
        while True:
            if x % y != 0:
                z = x % y
                x = y
                y = z
            else:
                break
        return z


def lcm(a,b):
    return a * b // gcd(a,b)

ans = lcm(a,b)
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
a,b = map(int,input().split())

ans = a * b // math.gcd(a,b)
print(ans)
Problem p02862 (python)

Fixed submission:
# -*- coding: utf-8 -*-
#コンビネーション
def cmb(n, r):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % mod

N = 10 ** 6  # N は必要分だけ用意する
mod = pow(10, 9) + 7
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) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    factinv.append((factinv[-1] * inv[-1]) % mod)

import math
x, y = map(int,input().split())

if (2 * y - x) % 3 != 0 and (2 * x - y) % 3 != 0:
    print(0)
else:
    a = (2 * y - x) // 3
    b = (2 * x - y) // 3
    ans = cmb(a+b, a)
    print(ans % (pow(10, 9) + 7))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
x, y = map(int,input().split())

if (2 * y - x) % 3 != 0 and (2 * x - y) % 3 != 0:
    print(0)
else:
    a = (2 * y - x) // 3
    b = (2 * x - y) // 3
    ans = math.factorial(a + b) / (math.factorial(a) * math.factorial(b))
    print(int(ans) % (pow(10, 9) + 7))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

X, Y = map(int,input().split())

ans = 0
for i in range(int(X)):
    for h in range(int(X)):
        if X == 1 * i + 2 * h:
            a = i
            b = h
if Y == 1 * b + 2 * a:
    ans = (a + b) 

print(ans % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

X, Y = map(int,input().split())

ans = 0
for i in range(int(X)):
    for h in range(int(X)):
        if X == 1 * i + 2 * h:
            a = i
            b = h
if Y == 1 * b + 2 * a:
    ans = (a + b) 

print(ans % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

X, Y = map(int,input().split())

ans = 0
if X % 2 == 0 and Y % 2 == 0:
    print(0)
else:
    for i in range(X):
        if X == (1 + 2) * i:
            a = i
    print(a)
    print((a * 2) % (10 ** 9 + 7))
Problem p03209 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n, x = map(int,input().split())

l = [0 for _ in range(n+1)] #バーガーの長さ
p = [0 for _ in range(n+1)] #パティの枚数
l[0] = 1
p[0] = 1
for i in range(1,n+1):
    l[i] = 3 + 2 * l[i-1]
    p[i] = 1 + 2 * p[i-1]
#print(l)
#print(p)

def solv(n, x): #答えを返します
    #print(n, x)
    if n == 0:
        if x == 1:
            return 1
        if x == 0:
            return 0
    else:
        if x <= 1:
            return 0
        elif 1 < x <= l[n-1] + 1:
            return solv(n-1, x - 1)
        elif x == l[n-1] + 2:
            return solv(n-1, x - 2) + 1
        elif l[n-1] + 3 <= x:
            if x == l[n]:
                return p[n-1] + 1 + solv(n - 1, x - 3 - l[n - 1])
            else:
                return  p[n-1] + 1 + solv(n - 1, x - 2 - l[n - 1])

print(solv(n,x))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n, x = map(int,input().split())

def solv(n):
    if n == 0:
        return 'P'
    else:
        tmp = solv(n - 1)
        return 'B' + tmp + 'P' + tmp + 'B'

ans = solv(n)
print(list(ans[:x]).count('P'))
Problem p02594 (python)

Fixed submission:
n = int(input())

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

Buggy submission (verdict: Runtime Error):
n = int(input())
c = list(input())
cFixed = [x for x in c]
cFixed.sort()
lastR = -1
for i in range(n):
	if cFixed[i] == "R":
		lastR = i
ans = 0
for i in range(lastR+1):
	if c[i] == "W":
		ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
c = list(input())
cFixed = [x for x in c]
cFixed.sort()
for i in range(n):
	if cFixed[i] == "R":
		lastR = i
ans = 0
for i in range(lastR+1):
	if c[i] == "W":
		ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
c = list(input())
cFixed = [x for x in c]
cFixed.sort()
for i in range(n):
	if cFixed[i] == "R":
		lastR = i
ans = 0
for i in range(lastR+1):
	if c[i] == "W":
		ans += 1

print(ans)
Problem p02597 (python)

Fixed submission:
n = int(input())
c = list(input())
cFixed = [x for x in c]
cFixed.sort()
lastR = -1
for i in range(n):
	if cFixed[i] == "R":
		lastR = i
ans = 0
for i in range(lastR+1):
	if c[i] == "W":
		ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
c = list(input())
cFixed = [x for x in c]
cFixed.sort()
for i in range(n):
	if cFixed[i] == "R":
		lastR = i
ans = 0
for i in range(lastR+1):
	if c[i] == "W":
		ans += 1

print(ans)

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

n = int(input())
c = list(input())
cFixed = [x for x in c]
cFixed.sort()
for i in range(n):
	if cFixed[i] == "R":
		lastR = i
ans = 0
"""for i in range(n):
	if c[i] != cFixed[i]:
		j = br(c,"R", lo = lastR + 1)-1
		#print(j,i,c[j],c[i],cFixed[i])
		c[i] = c[j]
		c[j] = "W"
		ans += 1


print(ans)"""

for i in range(lastR+1):
	if c[i] == "W":
		ans += 1

print(ans)