Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
S=str(input())
N=len(S)
a=[]
y=[]
x=0
a=list(S)


while 'BW' in S :
    a=list(S)
    for y in reversed((a)):

        for i in range (0,N-1):
            if a[i]=='B' and a[i+1]=='W' :
                a[i]='W'
                a[i+1]='B'
                x=x+1
                S=''.join(a)
print(x)


Fixed submission:
S=str(input())
N=len(S)
a=[]
y=0
x=0
z=0
a=list(S)

y=([i for i, p in enumerate(a) if p == 'W'])
z=len(y) #Wの個数
x=sum(y) #Wのi番目の合計

b=(1/2)*z*(z-1)
print(int(x-b))
Buggy python submission (verdict: Runtime Error):
def f():
    N = int(input())
    A = []
    
    for n in range(N):
        templist = []
        for a in range(int(input())):
            templist.extend(list(map(int, input().split())))
        A.append(templist)
    
    print(A)
    
    maxlen = len(str(bin(2**len(A)-1).replace('0b','')))
    for j in reversed((range(2**len(A)))):
        tempb = str(bin(j).replace('0b',''))
        for i in range(maxlen - len(tempb)):
            tempb = '0'+tempb
        # ここでパターン仮置き確定
        tempj = list(map(int, list(tempb)))
        counter = 0
        for jj in range(len(tempj)):
            if tempj[jj] == 1: # 正直者の場合
                if tempj[A[jj][0]-1] != A[jj][1]:# 本当は違う
                    break
                else:
                    counter += 1
            else:
                if tempj[A[jj][0]-1] == A[jj][1]:# 本当はあってる
                    break
                else:
                    counter += 1
        if counter == len(A):
            return print(tempj.count(1))
            
    return print(tempj.count(1))
    
f()

Fixed submission:
def f():
    N = int(input())
    A = []
    
    for n in range(N):
        templist = []
        for a in range(int(input())):
            templist.append(list(map(int, input().split())))
        A.append(templist)
    
    # print(A)
    J = [0]
    maxlen = len(str(bin(2**len(A)-1).replace('0b','')))
    for j in reversed((range(2**len(A)))):
        tempb = str(bin(j).replace('0b',''))
        for i in range(maxlen - len(tempb)):
            tempb = '0'+tempb
        # ここでパターン仮置き確定
        tempj = list(map(int, list(tempb)))
        counter = 0
        for jj in range(len(tempj)):
            if tempj[jj] == 1: # 正直者の場合
                # 証言の数だけループを回す
                shocounter = 0
                for s in range(len(A[jj])):
                    if tempj[A[jj][s][0]-1] != A[jj][s][1]:# 本当は違う
                        break
                    else:
                        shocounter += 1
                if shocounter == len(A[jj]):
                    counter += 1
            else:
                # 証言の数だけループを回す
                shocounter = 0
                for s in range(len(A[jj])):
                    if tempj[A[jj][s][0]-1] == A[jj][s][1]:# 本当はあってる
                        continue
                    else:
                        shocounter += 1
                if shocounter > 0:
                    counter += 1
        if counter == len(A):
            J.append(tempj.count(1))
    
    list.sort(J, reverse=True)        
    return print(J[0])
    
f()
Buggy python submission (verdict: Time Limit Exceeded):
def f():
    N, Y = map(int, input().split())
    
    y1 = 10000
    y2 = 5000
    y3 = 1000
    
    y1_num = 0
    y2_num = 0
    y3_num = 0
    for y1_num in reversed(range(N+1)):
        y2_num = 0
        remain_Y1 = Y - y1*y1_num
        if remain_Y1 == 0 and sum([y1_num, y2_num, y3_num]) == N:
            return print(y1_num, y2_num, y3_num)
        elif remain_Y1 < 0:
            continue
        else:
            for y2_num in reversed(range(N+1 - y1_num)):
                y3_num = 0
                remain_Y2 = remain_Y1 - y2*y2_num
                if remain_Y2 == 0 and sum([y1_num, y2_num, y3_num]) == N:
                    return print(y1_num, y2_num, y3_num)
                elif remain_Y2 < 0:
                    continue
                else:
                    for y3_num in reversed(range(N+1 - y1_num - y2_num)):
                        remain_Y3 = remain_Y2 - y3*y3_num
                        if remain_Y3 == 0 and sum([y1_num, y2_num, y3_num]) == N:
                            return print(y1_num, y2_num, y3_num)
                        elif remain_Y3 < 0:
                            continue
    return print(-1, -1, -1)
                        
f()
      

Fixed submission:
def f():
    N, Y = map(int, input().split())
    
    y1 = 10000
    y2 = 5000
    y3 = 1000
    
    y1_num = 0
    y2_num = 0
    y3_num = 0
    for y1_num in reversed(range(N+1)):
        y2_num = 0
        remain_Y1 = Y - y1*y1_num
        if remain_Y1 == 0 and sum([y1_num, y2_num, y3_num]) == N:
            return print(y1_num, y2_num, y3_num)
        elif remain_Y1 < 0:
            continue
        else:
            for y2_num in reversed(range(N+1 - y1_num)):
                y3_num = N - y1_num - y2_num
                remain_Y2 = remain_Y1 - y2*y2_num - y3*y3_num
                if remain_Y2 == 0 and sum([y1_num, y2_num, y3_num]) == N:
                    return print(y1_num, y2_num, y3_num)
                elif remain_Y2 < 0:
                    continue
    return print(-1, -1, -1)
                        
f()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n = int(input())
alist = list(map(int,input().split()))
binlist = [0]*60
mod_number = 10**9+7
for a in alist:
    a_bin = bin(a)
    for i in range(len(a_bin)-2):
        if int(a_bin[-(i+1)])==1:
            binlist[-(i+1)] += 1
            #print(a,a_bin,i,binlist)
ans = 0
for i in range(60):
    ans = (ans + binlist[-(i+1)]*(n-binlist[-(i+1)])*pow(2,i))%mod_number
    
print(ans)

Fixed submission:
n = int(input())
alist = list(map(int,input().split()))
binlist = [0]*60
mod_number = 10**9+7

def dec2bin(target):
    amari = []
    while target != 0:
        amari.append(target%2)
        target = target//2
    amari.reverse()
    return amari

for a in alist:
    a_bin = dec2bin(int(a))
    for i in range(len(a_bin)):
        if int(a_bin[-(i+1)])==1:
            binlist[-(i+1)] += 1
            #print(a,a_bin,i,binlist)
ans = 0
for i in range(60):
    ans = (ans + binlist[-(i+1)]*(n-binlist[-(i+1)])*pow(2,i))%mod_number
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
alist = list(map(int,input().split()))
binlist = [0 for _ in range(60)]
mod_number = 10**9+7
for a in alist:
    a_bin = bin(a)
    for i in range(len(a_bin)-2):
        if int(a_bin[-(i+1)])==1:
            binlist[-(i+1)] += 1
            #print(a,a_bin,i,binlist)
ans = 0
for i in range(60):
    ans = (ans + binlist[-(i+1)]*(n-binlist[-(i+1)])*pow(2,i))%mod_number
    
print(ans)

Fixed submission:
n = int(input())
alist = list(map(int,input().split()))
binlist = [0]*60
mod_number = 10**9+7

def dec2bin(target):
    amari = []
    while target != 0:
        amari.append(target%2)
        target = target//2
    amari.reverse()
    return amari

for a in alist:
    a_bin = dec2bin(int(a))
    for i in range(len(a_bin)):
        if int(a_bin[-(i+1)])==1:
            binlist[-(i+1)] += 1
            #print(a,a_bin,i,binlist)
ans = 0
for i in range(60):
    ans = (ans + binlist[-(i+1)]*(n-binlist[-(i+1)])*pow(2,i))%mod_number
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
alist = list(map(int,input().split()))
binlist = [0 for _ in range(60)]
mod_number = 10**9+7
for a in alist:
    a_bin = bin(a)
    for i in range(len(a_bin)-2):
        if int(a_bin[-(i+1)])==1:
            binlist[-(i+1)] += 1
            #print(a,a_bin,i,binlist)
ans = 0
for i in range(60):
    ans = (ans + binlist[-(i+1)]*(n-binlist[-(i+1)])*pow(2,i))%mod_number
    
print(ans)

Fixed submission:
n = int(input())
alist = list(map(int,input().split()))
binlist = [0]*60
mod_number = 10**9+7

def dec2bin(target):
    amari = []
    while target != 0:
        amari.append(target%2)
        target = target//2
    amari.reverse()
    return amari

for a in alist:
    a_bin = dec2bin(int(a))
    for i in range(len(a_bin)):
        if int(a_bin[-(i+1)])==1:
            binlist[-(i+1)] += 1
            #print(a,a_bin,i,binlist)
ans = 0
for i in range(60):
    ans = (ans + binlist[-(i+1)]*(n-binlist[-(i+1)])*pow(2,i))%mod_number
    
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())

all_v = a*a*b
#h = x/(a*a)

if all_v/2 >= x:
    print(90-math.degrees(math.atan(2*x/(a*b*b))))
else:
    print(90-math.degrees(math.atan(a*a*a/(2*(a*a*b-x)))))

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

all_v = a*a*b

if all_v == x:
    print(0)
elif all_v/2 >= x:
    print(90-math.degrees(math.atan(2*x/(a*b*b))))
else:
    print(90-math.degrees(math.atan(a*a*a/(2*(a*a*b-x)))))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l_list = sorted(map(int,input().split()))
ans = 0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if l_list[i]+l_list[j] > l_list[k]:
                ans += 1
            else:
                break
print(ans)

Fixed submission:
import bisect
N = int(input())
l_list = sorted(map(int,input().split()))
ans = 0
#print(l_list)
for i in range(N):
    for j in range(i+1,N):
        sum_ij = l_list[i]+l_list[j]
        bi_num = bisect.bisect_left(l_list,sum_ij)
        #print(i,j,sum_ij,bi_num,bi_num-j)
        ans += bi_num-j-1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_list = list(map(int,input().split()))
res = []
for i in range(N):
    res.append(A_list.index(i+1)+1)

for s in res:
    print(s, end =" ")

Fixed submission:
import numpy as np
N = int(input())
A_list = list(map(int,input().split()))
res = np.argsort(A_list)

for s in res:
    print(s+1, end =" ")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_list = list(map(int,input().split()))
res = []
for i in range(N):
    res.append(A_list.index(i+1)+1)

for s in res:
    print(s, end =" ")

Fixed submission:
import numpy as np
N = int(input())
A_list = list(map(int,input().split()))
res = np.argsort(A_list)

for s in res:
    print(s+1, end =" ")
Buggy python submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())
gcd_n = math.gcd(A,B)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

if A==1 or B==1:
    print(1)
else:
    print(len(factorization(gcd_n))+1)

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

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

#最大公約数
def my_gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
    
gcd_n = my_gcd(max(A,B),min(A,B))

if A==1 or B==1:
    print(1)
else:
    print(len(factorization(gcd_n))+1)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
ab_list = []
c_bit_list = []
INF = 1000000000
for _ in range(M):
    a,b = list(map(int,input().split()))
    ab_list.append([a,b])
    c=0
    c_in = list(map(int,input().split()))
    for k in range(b):
        c |= 1<<(c_in[k]-1)
    c_bit_list.append([c,a])

dp_all_number = pow(2,N)
c_bit_list_len = len(c_bit_list)
dp = [INF for _ in range(dp_all_number)]
dp[0] = 0

for i in range(dp_all_number):
    for j in range(c_bit_list_len):
        #print(i,j)
        dp[i | c_bit_list[j][0]] = min(dp[i | c_bit_list[j][0]],dp[i]+c_bit_list[j][1])
if dp[-1] == INF:
    print(-1)
else:
    print(dp[-1])

Fixed submission:
N,M = map(int,input().split())
ab_list = []
c_bit_list = []
INF = 1000000000
for _ in range(M):
    a,b = list(map(int,input().split()))
    ab_list.append([a,b])
    c=0
    c_in = list(map(int,input().split()))
    for k in range(b):
        c |= 1<<(c_in[k]-1)
    c_bit_list.append([c,a])

dp_all_number = pow(2,N)
c_bit_list_len = len(c_bit_list)
dp = [INF for _ in range(dp_all_number)]
dp[0] = 0

for i in range(dp_all_number):
    for j in range(c_bit_list_len):
        #print(i,j)
        dp[i | c_bit_list[j][0]] = min(dp[i | c_bit_list[j][0]],dp[i]+c_bit_list[j][1])
if dp[-1] == INF:
    print(-1)
else:
    print(dp[-1])
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
asiba = list(map(int,input().split()))
dp =[math.inf] *N

dp[0]=0
dp[1]=abs(asiba[1]-asiba[0])

for i in range(2,N):
    dp[i] = min(dp[i-2]+abs(asiba[i]-asiba[i-2]),dp[i])
    dp[i] = min(dp[i-1]+abs(asiba[i]-asiba[i-1]),dp[i])
print(dp[N-1])

Fixed submission:
N = int(input())
asiba = list(map(int,input().split()))
dp =[10**10] *N

dp[0]=0
dp[1]=abs(asiba[1]-asiba[0])

for i in range(2,N):
    dp[i] = min(dp[i-2]+abs(asiba[i]-asiba[i-2]),dp[i])
    dp[i] = min(dp[i-1]+abs(asiba[i]-asiba[i-1]),dp[i])
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
#https://atcoder.jp/contests/dp/tasks/dp_a
import math
N = int(input())
asiba = list(map(int,input().split()))
dp =[math.inf] *N

dp[0]=0
dp[1]=abs(asiba[1]-asiba[0])

for i in range(2,N):
    dp[i] = min(dp[i-2]+abs(asiba[i]-asiba[i-2]),dp[i])
    dp[i] = min(dp[i-1]+abs(asiba[i]-asiba[i-1]),dp[i])
print(dp[N-1])

Fixed submission:
N = int(input())
asiba = list(map(int,input().split()))
dp =[10**10] *N

dp[0]=0
dp[1]=abs(asiba[1]-asiba[0])

for i in range(2,N):
    dp[i] = min(dp[i-2]+abs(asiba[i]-asiba[i-2]),dp[i])
    dp[i] = min(dp[i-1]+abs(asiba[i]-asiba[i-1]),dp[i])
print(dp[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
N,W = map(int,input().split())
#N,W = [3,8]
wvlist = [list(map(int,input().split())) for _ in range(N)]
INF = 10**15
ans = INF
#初期条件
dp = [[INF for _ in range(N*1000+1)] for i in range(N+1)]
dp[0][0] = 0

for i in range(N):
    for v in range(N*1000+1):
        if v-wvlist[i][1]>=0:
            dp[i+1][v] = min(dp[i+1][v],dp[i][v-wvlist[i][1]]+wvlist[i][0])
        dp[i+1][v] = min(dp[i+1][v],dp[i][v])
        
for i in range(N*1000+1):
    if W >= dp[N][i]:
        ans = i
        
print(ans)
    

Fixed submission:
import numpy as np
N,W = map(int,input().split())
#N,W = [3,8]
wvlist = [list(map(int,input().split())) for _ in range(N)]
INF = 10**15
ans = INF

#初期条件
#dp = [[INF for _ in range(N*1000+1)] for i in range(N+1)]
dp = np.full((N+1,N*1000+1),INF)
dp[0][0] = 0

for i in range(N):
    dp[i+1][:wvlist[i][1]] = dp[i][:wvlist[i][1]]
    dp[i+1][wvlist[i][1]:] = np.minimum(dp[i][wvlist[i][1]:],dp[i][:-wvlist[i][1]]+wvlist[i][0])
        
for i in range(N*1000+1):
    if W >= dp[N][i]:
        ans = i
        
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
s = input()
t = input()
ans = ''
slen = len(s)
tlen = len(t)

dp = [[0 for i in range(tlen+1)] for j in range(slen+1)]

for i in range(slen):
    for j in range(tlen):
        if s[i]==t[j]:
            dp[i+1][j+1]=max(dp[i][j]+1,dp[i+1][j],dp[i][j+1])
        else:
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])
#ここまでで、DP配列が完成
#あとはDPの最後から遡る
i = slen
j = tlen
while (i>0 and j>0):
    if dp[i][j]==dp[i-1][j]:
        i -= 1
        continue
    elif dp[i][j]==dp[i][j-1]:
        j -= 1
        continue
    else:
        #print(i,j)
        ans = s[i-1] + ans
        i -= 1
        j -= 1
        
print(ans)

Fixed submission:
import sys
input = sys.stdin.readline
s = input()
t = input()
ans = ''
slen = len(s)
tlen = len(t)

dp = [[0 for i in range(tlen+1)] for j in range(slen+1)]

for i in range(slen):
    for j in range(tlen):
        if s[i]==t[j]:
            dp[i+1][j+1]=max(dp[i][j]+1,dp[i+1][j],dp[i][j+1])
        else:
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])
#ここまでで、DP配列が完成
#あとはDPの最後から遡る
i = slen
j = tlen
while (i>0 and j>0):
    if dp[i][j]==dp[i-1][j]:
        i -= 1
        continue
    elif dp[i][j]==dp[i][j-1]:
        j -= 1
        continue
    else:
        #print(i,j)
        ans = s[i-1] + ans
        i -= 1
        j -= 1
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()
ans = ''
slen = len(s)
tlen = len(t)

dp = [[0 for i in range(tlen+1)] for j in range(slen+1)]

for i in range(slen):
    for j in range(tlen):
        if s[i]==t[j]:
            dp[i+1][j+1]=max(dp[i][j]+1,dp[i+1][j],dp[i][j+1])
        else:
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])
#ここまでで、DP配列が完成
#あとはDPの最後から遡る
i = slen
j = tlen
while (i>0 and j>0):
    if dp[i][j]==dp[i-1][j]:
        i -= 1
        continue
    elif dp[i][j]==dp[i][j-1]:
        j -= 1
        continue
    else:
        #print(i,j)
        ans = s[i-1] + ans
        i -= 1
        j -= 1
        
print(ans)

Fixed submission:
import sys
input = sys.stdin.readline
s = input()
t = input()
ans = ''
slen = len(s)
tlen = len(t)

dp = [[0 for i in range(tlen+1)] for j in range(slen+1)]

for i in range(slen):
    for j in range(tlen):
        if s[i]==t[j]:
            dp[i+1][j+1]=max(dp[i][j]+1,dp[i+1][j],dp[i][j+1])
        else:
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])
#ここまでで、DP配列が完成
#あとはDPの最後から遡る
i = slen
j = tlen
while (i>0 and j>0):
    if dp[i][j]==dp[i-1][j]:
        i -= 1
        continue
    elif dp[i][j]==dp[i][j-1]:
        j -= 1
        continue
    else:
        #print(i,j)
        ans = s[i-1] + ans
        i -= 1
        j -= 1
        
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(float,input().split()))
ans = 0
dp = [[0 for _ in range(N+1)] for __ in range(N+1)]
dp[0][0]=1
for i in range(1,N+1):
    for j in range(i+1):
        if j==0:
            dp[i][j]=dp[i-1][j]*(1-P[i-1])
        else:
            dp[i][j]=dp[i-1][j-1]*P[i-1] + dp[i-1][j]*(1-P[i-1])

for i in range(N+1):
    if i>N/2:
        ans += dp[N][i]
print(ans)

Fixed submission:
N = int(input())
P = list(map(float,input().split()))
ans = 0
dp = [[0 for _ in range(N+1)] for __ in range(N+1)]
dp[0][0]=1
for i in range(1,N+1):
    for j in range(i+1):
        if j==0:
            dp[i][j]=dp[i-1][j]*(1-P[i-1])
        else:
            dp[i][j]=dp[i-1][j-1]*P[i-1] + dp[i-1][j]*(1-P[i-1])

for i in range(N+1):
    if i>N/2:
        ans += dp[N][i]
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())

x_before = 0
y_before = 0
t_before = 0
ans = 'YES'

for i in range(N):
    t, x, y = map(int, input().split())
    
    #i番目とi+1番目までの距離
    distace = abs(x-x_before) + abs(y-y_before)
    
    #i番目とi+1番目までの時間
    time = abs(t-t_before)
    
    #i+1番目のtimeで行くことが可能か判定
    if((time-distace<0) or (time-distace%2!=0)):
        ans = 'NO'
        break
        
    #i+1番目のtimeで行くことが可能なら値を更新
    x_before = x
    y_before = y
    t_before = t
    
print(ans)

Fixed submission:
a,b = map(int,input().split())
if(a*b%2==0):
    print('Even')
else:
    print('Odd')
Buggy python submission (verdict: Runtime Error):
def build_stairs(N=N, HN=HN):
    if N == 1:
        return "Yes"
    for n in range(N-1):
        if HN[n] - HN[n+1] > 1:
            return "No"
        elif HN[n] - HN[n+1] == 1:
            HN[n+1] += 1
        if HN[n] < HN[n+1]:
            continue
    return "Yes"

N = int(input())
HN = input().split()
HN = [int(i) for i in HN]
ans = build_stairs(N, HN)
print(ans)
print("")

Fixed submission:
N = int(input())
HN = input().split()

def build_stairs(N=N, HN=HN):
    if N == 1:
        return "Yes"
    for n in range(N-1):
        if HN[n] - HN[n+1] > 1:
            return "No"
        elif HN[n] - HN[n+1] == 1:
            HN[n+1] += 1
        if HN[n] < HN[n+1]:
            continue
    return "Yes"

HN = [int(i) for i in HN]
ans = build_stairs(N, HN)
print(ans)
print("")
Buggy python submission (verdict: Runtime Error):
import itertools
import numpy as np
H, W = map(int, input().split())
arr = []
for _ in range(H):
    S = input().split()
    S = [int(s) for s in S]
    arr.append(S)
x = list(itertools.combinations(arr,2))
count = 0
for i in range(len(x)):
    vec_a = np.array(x[i][0])
    vec_b = np.array(x[i][1])
    d = np.linalg.norm(vec_a - vec_b)
    d2 = int(d)
    if d == d2:
        count+=1
print(count)
print()

Fixed submission:
a, b, c = map(int, input().split())
if a*b <= c:
    print(a*b)
else:
    print(c)
print()
Buggy python submission (verdict: Runtime Error):
def cakes_and_donuts(N=N):
  max_7_num = N//7
  max_4_num = N//4
  for i in range(max_7_num):
    for j in range(max_4_num):
      if 7*(i+1) + 4*(j+1) == N:
        return 'Yes'
  return 'No'

N = int(input())
s = cakes_and_donuts(N)
print(''.format(s))

Fixed submission:
N = int(input())

def cakes_and_donuts(N=N):
  if N % 4 ==0 or N % 7 ==0:
    return 'Yes'  
  max_7_num = N//7
  max_4_num = N//4
  for i in range(max_7_num):
    for j in range(max_4_num):
      if 7*(i+1) + 4*(j+1) == N:
        return 'Yes'
  return 'No'

s = cakes_and_donuts(N)
print('{}'.format(s))

Buggy python submission (verdict: Runtime Error):
def cakes_and_donuts(N=N):
  max_7_num = N//7
  max_4_num = N//4
  for i in range(max_7_num):
    for j in range(max_4_num):
      if 7*(i+1) + 4*(j+1) == N:
        return 'Yes'
  return 'No'

N = int(input())
cakes_and_donuts(N)


Fixed submission:
N = int(input())

def cakes_and_donuts(N=N):
  if N % 4 ==0 or N % 7 ==0:
    return 'Yes'  
  max_7_num = N//7
  max_4_num = N//4
  for i in range(max_7_num):
    for j in range(max_4_num):
      if 7*(i+1) + 4*(j+1) == N:
        return 'Yes'
  return 'No'

s = cakes_and_donuts(N)
print('{}'.format(s))
Buggy python submission (verdict: Runtime Error):
def solution(n, k, l_list):
    l_list.sort(reverse=True)
    result = sum(l_list[:k])
    return result


N, K = [int(value) for value in input().split(' ')]
l_list = [int(value) for value in input().split(' ')]
print(solution(N, K, l_list))

Fixed submission:
def solution(a, b):
    total = a + b
    if total % 3 == 0:
        print('Possible')
    elif a % 3 == 0:
        print('Possible')
    elif b % 3 == 0:
        print('Possible')
    else:
        print('Impossible')

A, B = input().split(' ')
A, B = int(A), int(B)

solution(A, B)

Buggy python submission (verdict: Runtime Error):
def solution(a, b):
    total = a + b
    if total % 3 == 0:
        print('Possible')
    elif a % 3 == 0:
        print('Possible')
    elif:
        b % 3 == 0:
        print('Possible')
    else:
        print('Impossible')

A, B = input().split(' ')
A, B = int(A), int(B)

solution(A, B)

Fixed submission:
def solution(a, b):
    total = a + b
    if total % 3 == 0:
        print('Possible')
    elif a % 3 == 0:
        print('Possible')
    elif b % 3 == 0:
        print('Possible')
    else:
        print('Impossible')

A, B = input().split(' ')
A, B = int(A), int(B)

solution(A, B)

Buggy python submission (verdict: Runtime Error):
def solution(a, b):
    total = a + b
    if (total % 3 == 0) and total >= 3:
        print('Possible')
    else:
        print('Impossible')

A, B = input().split(' ')
A, B = int(A), int(B)

solution(A, B)

Fixed submission:
def solution(a, b):
    total = a + b
    if total % 3 == 0:
        print('Possible')
    elif a % 3 == 0:
        print('Possible')
    elif b % 3 == 0:
        print('Possible')
    else:
        print('Impossible')

A, B = input().split(' ')
A, B = int(A), int(B)

solution(A, B)

Buggy python submission (verdict: Runtime Error):
def solution(a, b):
    total = a + b
    if (total % 3 == 0) and total >= 3:
        print('Possible')
    else:
        print('Impossible')

A, B = raw_input().split(' ')
A, B = int(A), int(B)

solution((A, B))

Fixed submission:
def solution(a, b):
    total = a + b
    if total % 3 == 0:
        print('Possible')
    elif a % 3 == 0:
        print('Possible')
    elif b % 3 == 0:
        print('Possible')
    else:
        print('Impossible')

A, B = input().split(' ')
A, B = int(A), int(B)

solution(A, B)