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

Fixed submission:
A,B,C=map(int,input().split())
D=C-(A-B)
if D<=0:
   print(0)
else:
   print(D)

Buggy submission (verdict: Runtime Error):
A,B,C=(int,input().split())
D=C-(A-B)
if D<=0:
   print(0)
else:
   print(D)

Buggy submission (verdict: Runtime Error):
A,B,C=(int,input().split())
D=C-(A-B)
if D<=0
   print(0)
else:
   print(D)
Problem p03250 (python)

Fixed submission:
s=sorted(list(map(int,input().split())))[::-1]
print(s[0]*10+s[1]+s[2])

Buggy submission (verdict: Runtime Error):
s=sorted(list(map(int,input().input())))[::-1]
print(s[0]*10+s[1]+s[2])
Problem p02699 (python)

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

main()

Buggy submission (verdict: Runtime Error):
def main():

    n = int(input())
    db = []
    kinds = 0

    for i in range(10):
        tmp = []
        db.append(tmp)

    for i in range(n):
        str = input()
        num = len(str)

        if(not(str in db[num-1])):
            db[num-1].append(str)
            kinds = kinds + 1

    print(kinds)

main()
Problem p02707 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
s = [0 for _ in range(n)]
for i in range(n-1):
    s[a[i]-1] += 1
for t in s:print(t)

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

Fixed submission:
s = list(input())

k = int(input())

n = len(s)

if(len(set(s)) == 1):
    print(n*k//2)
else:
    t = 0
    c = 1
    for i in range(n-1):
        if(s[i] == s[i+1]):
            c += 1
        else:
            t += c // 2
            c = 1
    t += c // 2
    if(s[0] != s[-1]):
        print(t*k)
    else:
        a = 0
        b = 0
        for i in range(n):
            if(s[i] == s[0]):a+=1
            else:break
        for i in range(n)[::-1]:
            if(s[i] == s[-1]):b+=1
            else:break
        print(t*k - (a//2 + b//2 - (a+b)//2) * (k-1))

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

k = int(input())

n = len(s)

if(len(set(s)) == 1):
    print(n*k//2)
else:
    if(s[0] != s[-1]):
        print(n//2*k)
    else:
        print(n//2*k - (a//2 + b//2 - (a+b)//2) * (k-1))
Problem p02912 (python)

Fixed submission:
import heapq

n,m = map(int,input().split())
a = list(map(lambda x:int(x)*(-1),input().split()))

heapq.heapify(a)

for _ in range(m):
    x = heapq.heappop(a) * -1
    x //= 2
    heapq.heappush(a,-1*x)
print(-sum(a))

Buggy submission (verdict: Runtime Error):
import bisect


n,m = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a)
k = 0
for _ in range(m):
    k -= 1
    if(k > 0):continue
    a_tmp = a.pop()
    if(len(a)==0):a.append(a_tmp//2)
    else:
        a2 = a[-1]
        k = a_tmp // a2
        a_tmp //= 2 ** k
        if(a_tmp >= a[-1]):a.append(a_tmp)
        elif(a_tmp <= a[0]):a.insert(0,a_tmp)
        else:
            index = bisect.bisect_left(a,a_tmp)
            a.insert(index,a_tmp)


print(sum(a))

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

n,m = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a)
a = deque(a)
for _ in range(m):
    a_tmp = a.pop()
    a_tmp //= 2
    if(len(a)==0):a.append(a_tmp)
    else:
        if(a_tmp >= a[-1]):a.append(a_tmp)
        elif(a_tmp <= a[0]):a.appendleft(a_tmp)
        else:
            index = bisect.bisect_left(a,a_tmp)
            a.insert(index,a_tmp)


print(sum(a))
Problem p02990 (python)

Fixed submission:
def frac(n):
	r = 1
	for i in range(1,n+1):
		r*=i
	return(r)

def ans(n,k,i):
	if(n-k < i-1):return(0)
	r1 = frac(k-1) // frac(k-i) // frac(i-1)
	r2 = frac(n-k+1) // frac(n-k-i+1) // frac(i)
	
	return(r1*r2)

n,k = map(int,input().split())

for i in range(1,k+1):
	print(int(ans(n,k,i))%1000000007)

Buggy submission (verdict: Runtime Error):
def frac(n):
	r = 1
	for i in range(1,n+1):r*=i
	return(r)

def ans(n,k,i):
	if(n-k < i-1):return(0)
	r1 = frac(k-1) / frac(k-i) / frac(i-1)
	r2 = frac(n-k+1) / frac(n-k-i+1) / frac(i)
	
	return(r1*r2)

n,k = map(int,input().split())



for i in range(1,k+1):
	print(int(ans(n,k,i))%1000000007)
Problem p03013 (python)

Fixed submission:

n,m = map(int,input().split())
b = [True] * n
for i in range(m):
    x = int(input())
    b[x-1] = False

dp = [0] * n
if(n == 1):
    print(1)
    exit()
if(b[0]):
    dp[0] = 1
    if(b[1]):dp[1] = 2
else:
    if(b[1]):dp[1] = 1

for i in range(2,n):
    if(b[i]):
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
print(dp[-1])

Buggy submission (verdict: Runtime Error):

n,m = map(int,input().split())
b = [True] * n
for i in range(m):
    x = int(input())
    b[x-1] = False

dp = [0] * n
if(n == 1):
    print(1)
if(b[0]):
    dp[0] = 1
    if(b[1]):dp[1] = 2
else:
    if(b[1]):dp[1] = 1

for i in range(2,n):
    if(b[i]):
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
print(dp[-1])

Buggy submission (verdict: Runtime Error):

n,m = map(int,input().split())
b = [True] * n
for i in range(m):
    x = int(input())
    b[x-1] = False

dp = [0] * n

if(b[0]):
    dp[0] = 1
    if(b[1]):dp[1] = 2
else:
    if(b[1]):dp[1] = 1

for i in range(2,n):
    if(b[i]):
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
print(dp[-1])
Problem p03242 (python)

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

Buggy submission (verdict: Runtime Error):
n = input()
for i in range(len(n)):
    if(n[i] == '1'):n[i] = '9'
    elif(n[i] == '9'):n[i] = '1'
print(n)
Problem p03745 (python)

Fixed submission:
import sys
n=int(input())
a=list(map(int,input().split()))
x=0
if(n==1):
  print(1)
  sys.exit()
for i in range(n-1):
  if(a[i+1-x]==a[i-x]):
    a.pop(i-x)
    n-=1
    x+=1
    if(n==3):break
if(a[0]==a[1]):
  a.pop(0)
  n-=1
if(n==2):
  print(1)
  sys.exit()
til=a[1]-a[0]
x=0
for i in range(n-1):
  tilt=a[i+1]-a[i]
  if(til*tilt<0):
    x+=1
    if(i+2>=n):
      break
    til=a[i+2]-a[i+1]
print(x+1)

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
a=list(map(int,input().split()))
x=0
for i in range(n-1):
  if(a[i+1-x]==a[i-x]):
    a.pop(i-x)
    n-=1
    x+=1
    if(n==3):break
if(a[0]==a[1]):
  a.pop(0)
  n-=1
if(n==1):
  print(1)
  sys.exit()
if(n==2):
  print(1)
  sys.exit()
til=a[1]-a[0]
x=0
for i in range(n-1):
  tilt=a[i+1]-a[i]
  if(til*tilt<0):
    x+=1
    if(i+2>=n):
      break
    til=a[i+2]-a[i+1]
print(x+1)

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
a=list(map(int,input().split()))
x=0
for i in range(n-1):
  if(a[i+1-x]==a[i-x]):
    a.pop(i-x)
    n-=1
    x+=1
    if(n==3):break
if(a[0]==a[1]):
  a.pop(0)
  n-=1

if(n==2):
  print(1)
  sys.exit()
til=a[1]-a[0]
x=0
for i in range(n-1):
  tilt=a[i+1]-a[i]
  if(til*tilt<0):
    x+=1
    if(i+2>=n):
      break
    til=a[i+2]-a[i+1]
print(x+1)

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
a=list(map(int,input().split()))
x=0
for i in range(n-1):
  if(a[i+1-x]==a[i-x]):
    a.pop(i)
    n-=1
    x+=1
    if(n==3):break
if(a[0]==a[1]):
  a.pop(0)
  n-=1

if(n==2):
  print(1)
  sys.exit()
til=a[1]-a[0]
x=0
for i in range(n-1):
  tilt=a[i+1]-a[i]
  if(til*tilt<0):
    x+=1
    if(i+2>=n):
      break
    til=a[i+2]-a[i+1]
print(x+1)
Problem p03803 (python)

Fixed submission:
a,b=map(int,input().split())
if(a==b):
  print("Draw")
elif(a<b):
  if(a==1):
    print("Alice")
  else:
    print("Bob")
else:
  if(b==1):
    print("Bob")
  else:
    print("Alice")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if(a==b):
  print("Draw")
elif(a<b):
  if(a==1):
    print("Alice")
  else:
    print("Bob")
else:
  if(b==1):
    print("Alice")
  else:
	print("Bob")
Problem p03804 (python)

Fixed submission:
import sys
N,M=map(int,input().split())
Ai=[]
Bi=[]
for i in range(N):
    Ai.append(input())
for i in range(M):
    Bi.append(input())
roop=N-M+1
for i in range(roop):
    for j in range(roop):
        #print("A")
        flag=1
        for k in range(M):
            #print(Ai[i+k][j:j+M])
            if(Ai[i+k][j:j+M]!=Bi[k]):
                flag=0
                break;
        if(flag==1):
            print("Yes")
            sys.exit()
print("No")

Buggy submission (verdict: Runtime Error):
import sys
N,M=map(int,input().split())
Ai=[]
Bi=[]
for i in range(N):
    Ai.append(input())
for i in range(M):
    Bi.append(input())
roop=N-M+1
for i in range(roop):
    for j in range(roop):
        #print("")
        flag=1
        for k in range(roop):
            #print(Ai[i+k][j:j+M])
            if(Ai[i+k][j:j+M]!=Bi[k]):
                flag=0
                break;
        if(flag==1):
            print("Yes")
            sys.exit()
print("No")
Problem p03986 (python)

Fixed submission:
s=input()
n=len(s)
sta=[]
for i in range(n):
  if(s[i]=="S"):
    sta.append("S")
  else:
    if(len(sta)==0 or sta[-1]=="T"):sta.append("T")
    else:sta.pop()
print(len(sta))

Buggy submission (verdict: Runtime Error):
s=input()
while("ST" in s):
  s.remove("ST")
print(len(s))
Problem p02682 (python)

Fixed submission:
A,B,C,K = input().split()
if int(A) >= int(K):
  print(K)
elif int(A)+int(B) >= int(K):
  print(A)
else:
  print(int(A) + int(A) + int(B) - int(K))

Buggy submission (verdict: Runtime Error):
A,B,C,K = input().split()
if A >= K:
  print(K)
elif A+B >= K:
  print(A)
else:
  print(A + A + B - K)

Buggy submission (verdict: Runtime Error):
A,B,C,K = input().split()
if A > K:
  print(K)
elif A+B > K:
  print(A)
else:
  print(2*A + B - K)
Problem p03041 (python)

Fixed submission:
N,K = (int(x) for x in input().split())
S = input()
if 1 <= N <= 50 and 1 <=K <= N and len(S) == N :
    komoji = S[K-1:K].lower()

    Out = S[:K-1] + komoji + S[K:]

    print(Out)

Buggy submission (verdict: Runtime Error):
,K = (int(x) for x in input().split())
S = input()
if N <= 50:
    komoji = S[K-1:K].lower()

    Out = S[:K-1] + komoji + S[K:]

    print(Out)

Buggy submission (verdict: Runtime Error):
N,K = int(input()), int(input())
S = input()
if N <= 50:
    komoji = S[K-1:K].lower()

    Out = S[:K-1] + komoji + S[K:]

    print(Out)

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

komoji = S[K-1:K].lower()

Out = S[:K-1] + komoji + S[K:N+1]

print(Out)

Buggy submission (verdict: Runtime Error):
N,K = int(input('N = ')), int(input('K = '))
S = input('S = ')

komoji = S[K-1:K].lower()

Out = S[:K-1] + komoji + S[K:N+1]

print(Out)
Problem p02695 (python)

Fixed submission:
import math
import itertools

n,m,q = map(int,input().split())
li=[input() for i in range(q)]

ans_list=list()
ans=0
xans=0

lis =  list(range(1,m+1))
for team in itertools.combinations_with_replacement(lis,n):
  
    for i in range(q):
      
      lix=li[i].split()
      
      if team[int(lix[1])-1]-team[int(lix[0])-1]==int(lix[2]):
        ans=int(lix[3])
        xans+=ans
        
       
        
    ans_list+=[xans]
    xans=0
      
    
    
print(max(ans_list))

Buggy submission (verdict: Runtime Error):
import math
import itertools

n,m,q = map(int,input().split())
li=[input() for i in range(q)]

ans_list=list()
ans=0

lis =  list(range(1,m+1))
for team in itertools.combinations(lis, n):

    for i in range(q):
      lix=li[i].split()
      
      if team[int(lix[1])-1]-team[int(lix[0])-1]==int(lix[2]):
        ans+=int(lix[3])
        
    ans_list+=[ans]
    ans=0
      
    
    
print(max(ans_list))
Problem p02711 (python)

Fixed submission:
n=input()

a=n.count('7')

if a==0:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
import math from gcd
k=input()

ans=0
i=0

for a in range(k+1):
  for b in range(k+1):
    i==gcd(a,B)
    for c in range(k+1):
      ans+=gcd(i,c)
      
print(ans)
Problem p02759 (python)

Fixed submission:
import math
print(math.ceil(int(input())/2))

Buggy submission (verdict: Runtime Error):
print(round(int(input()/2))
Problem p02879 (python)

Fixed submission:
a, b = [int(i) for i in input().split()]
 
if 1 <= a <= 9 and 1 <= b <= 9:
    print(a*b)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
a, b = [int(i) for i in input().split()]

if 1 <= a =< 9 and 1 <= b =< 9:
    print(a*b)
else:
    print(-1)
Problem p03041 (python)

Fixed submission:
a,b=[int(i) for i in input().split()]
c=list(input())

c[b-1] = str.lower(c[b-1])

c = ''.join(c)

print(c)

Buggy submission (verdict: Runtime Error):
a,b=[int(i) for i in input().split()]
c=list(input())

c[b] = str.lower(c[b])

c = ''.join(c)

print(c)
Problem p03207 (python)

Fixed submission:
a = int(input())
b = []
for i in range(a):
    b.append(int(input()))

b.sort()

b[-1] = b[-1] / 2

print(int(sum(b)))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = []
for i in range(a):
  b.append(int(input()))

b.sort()

b[-1::] == b[-1::] / 2

print(sum(b))
Problem p03208 (python)

Fixed submission:
a, b = [int(i) for i in input().split()]
c = []
for i in range(a):
    c.append(int(input()))

c.sort()

temp = 999999999999999999999999999999999999999999999999999999999999999999999999999999999
for a in range(len(c) - b + 1):
    s = c[a + b - 1]
    t = c[a]
    if s - t < temp:
        temp = s - t

print(temp)

Buggy submission (verdict: Runtime Error):
a, b = [int(i) for i in input().split()]
c = []
for i in range(a):
    c.append(int(input()))

c.sort()

temp = 999999999999999999999999999999999999999999999999999999999999999999999999999999999
for a in range(len(c) - b + 1):
    if c[a + 2] - c[a] < temp:
        temp = c[a + 2] - c[a]

print(temp)

Buggy submission (verdict: Runtime Error):
a, b = [int(i) for i in input().split()]
c = []
for i in range(a):
    c.append(int(input()))

c.sort()

temp = 99999999
for a in range(len(c) - b + 1):
    if c[a + 2] - c[a] < temp:
        temp = c[a + 2] - c[a]

print(temp)
Problem p02688 (python)

Fixed submission:
import numpy as np
n, k=map(int, input().split())

pp = []
for i in range(2*k):
    pp.append(list(input().split()))

p = pp[1::2]
s = 0
l = []

for i in range(k):
    q = p[i]
    l.extend(q)


ll = set(l)

print(n - len(ll))

Buggy submission (verdict: Runtime Error):
import numpy as np
n, k=map(int, input().split())

pp = []
for i in range(2*k):
    pp.append(list(input().split()))

p = pp[1::2]
s = 0
l = []

for i in range(k):
    q = p[i]
    
    l.extend(q)

ll = set(l)

print(n - len(ll))
Problem p02711 (python)

Fixed submission:
vv = int(input())

if vv <= 999 and vv >= 100:
    vvvv = list(str(vv))


    ccc = "7" in vvvv

    if ccc == True:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
vv = list(input())

ccc = "7" in vv

if ccc = True:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):

vv = list(input())

ccc = "7" in vv

if ccc = True:
    print("Yes")
else:
    print("No")
Problem p03135 (python)

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

c = int(a)
d = int(b)

time = c / d

print(time)

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

c = int(a)
d = int(b) 

time = (1/c) * d

return(time)
Problem p02711 (python)

Fixed submission:
print "Yes" if '7' in raw_input() else "No"

Buggy submission (verdict: Runtime Error):
print "Yes" if '7' in raw_input() else "No"

Buggy submission (verdict: Runtime Error):
print "Yes" if '7' in raw_input() else "No"
Problem p02790 (python)

Fixed submission:
a, b = raw_input().split()
Z = [a * int(b), b * int(a)]
print sorted(Z)[0]

Buggy submission (verdict: Runtime Error):
a, b = raw_input().split()
Z = [a * b, b * a]
print sorted(Z)[0]
Problem p02699 (python)

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

Buggy submission (verdict: Runtime Error):
 s, w = (int(x) for x in input().split())
if s <= w:
    print('unsafe')
else:
    print('safe')
Problem p02711 (python)

Fixed submission:
n = str(input())
a = '7'
if a in n:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = n // 100
b = n % 100 // 10
c = n % 10
if a = 7:
  print('Yes')
elif b = 7:
  print('Yes')
elif c = 7:
  print('Yes')
else:
  print('No')
Problem p02682 (python)

Fixed submission:

A, B, C, K = [int(x) for x in input().split()]


if A >= K:
    print(K)
elif A + B >= K:
    print(A)
else:
    lack = K - A - B
    print(A - lack)

Buggy submission (verdict: Runtime Error):
if K >= One:
    print(One)
elif 0 < K < One:
    print(K)
Problem p02689 (python)

Fixed submission:
a=input().split()
N=int(a[0])
M=int(a[1])
H=[int(x) for x in input().split()]
way=[]
for i in range(M):
    way.append([int(x) for x in input().split()])

dic={}
for i in range(N):
    dic[i]=set()

for h in way:
    dic[h[0]-1].add(h[1]-1)
    dic[h[1]-1].add(h[0]-1)
    

print(sum(all([H[i]>H[hs] for hs in dic[i]])for i in range(N)))

Buggy submission (verdict: Runtime Error):
a=input().split()
N=int(a[0])
M=int(a[1])
H=[int(x) for x in input().split()]
way=[]
for i in range(M):
    way.append([int(x) for x in input().split()])

ans=0
for i in range(N):
    con_i=[]
    for j in range(M):
        if way[j][0]==i+1:
            con_i.append(H[way[j][1]-1])
        if way[j][1]==i+1:
            con_i.append(H[way[j][0]-1])
    

    if max(con_i)<H[i]:
        ans+=1
    
print(ans)
Problem p02711 (python)

Fixed submission:
from sys import stdin

N = int(stdin.readline().rstrip())


a=N%10
b=((N-a)/10)%10
c=(N-10*b-a)/100
n=[a,b,c]
if 7 in n:
    print('Yes')

else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
 
r, g, b = 0, 0, 0
for i in range(N):
    if S[i] == 'R':
        r += 1
    elif S[i] == 'G':
        g += 1
    else:
        b += 1
 
a = r*g*b
 
for i in range(N):
    for j in range(i+1, N):
        if 2*j-i < N:
            if (S[i] != S[j]) and (S[j] != S[2*j-i]) and (S[i] != S[2*j-i]):
                a -= 1
 
print(a)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=list(input())
import sys

sys.setrecursionlimit(10**6)

r=a.count('R')
g=a.count('G')
b=a.count('B')
s=0
for i in range(N-1):
    for j in range(i+1, N):
        if 2*j-i < N:
            if a[i] !=a[j] and a[j]!=a[2*j-i] and a[2*j-i]!=a[i]:
                s+=1

n=r*g*b-s
print(n)

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

r=a.count('R')
g=a.count('G')
b=a.count('B')
N=len(a)
s=0
for i in range(N-1):
    for j in range(i+1, N):
        if 2*j-i < N:
            if a[i] !=a[j] and a[j]!=a[2*j-i] and a[2*j-i]!=a[i]:
                s+=1

n=r*g*b-s
print(n)

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

r=a.count('R')
g=a.count('G')
b=a.count('B')
N=len(a)
s=0
for i in range(N):
    for j in range(i+1, N):
        if 2*j-i < N:
            if a[i] !=a[j] and a[j]!=a[2*j-i] and a[2*j-i]!=a[i]:
                s+=1

print(r*g*b-s)
Problem p02693 (python)

Fixed submission:
K=int(input())
A_B=list(map(int,input().split()))
A=A_B[0]
B=A_B[1]
m=1
c=0
for i in range(A,(B+1)):
  if(i%K==0):
    c=1
    break
if(c==1):
  print("OK")
else:
  print("NG")

Buggy submission (verdict: Runtime Error):
K=int(input())
A_b=list(map(int,input().split()))
A=A_B[0]
B=A_b[1]
m=1
for i in range(B):
  m=i*k
  if (m>A and m<B):
    print("OK")
  else:
    print("NG")
Problem p02736 (python)

Fixed submission:

def twos_in_factorial(n):
    return n - bin(n).count('1')


def parity_of_nCr(n, i):
    """ if odd, return False. """
    f = twos_in_factorial
    return f(n) - f(n-i) - f(i) > 0


if __name__ == "__main__":
    n = int(input())
    nums = list(map(lambda x: int(x) - 1, input().strip()))
    no_one = False
    if 1 not in nums:
        nums = [num // 2 for num in nums]
        no_one = True

    is_odd = False
    for i, num in enumerate(nums):
        if not parity_of_nCr(n-1, i) and num & 1:
            is_odd ^= 1

    if not is_odd:
        print(0)
    else:
        print(1 << no_one)

Buggy submission (verdict: Runtime Error):
import heapq
import math
import random
import sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, namedtuple, UserDict
from functools import cmp_to_key, lru_cache, reduce
from itertools import (chain, combinations, combinations_with_replacement,
                       permutations, product)

sys.setrecursionlimit(10**6+1)
write = sys.stdout.write
# input = sys.stdin.buffer.readline

MOD = 10**9 + 7
INT_MAX = (1 << 63) - 1

@lru_cache(None)
def dfs(i, j, nums):
    if i == 1:
        return int(nums[j-1])
    return abs(dfs(i-1, j, nums) - dfs(i-1, j+1, nums))

if __name__ == "__main__":
    n = int(input())
    nums = input()
    print(dfs(n, 1, nums))
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 = int(input())

W = int(input())

if W >= S:
    print("unsafe")
else:
    print("safe")

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

W = int(input())

if W >= S:
  print("unsafe")
else:
  print("safe")

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

W = int(input())

if W >= S:
  print("unsafe")
  
else:
  print("safe")

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

W = int(input())

if W >= S:
  print("unsafe")
  
else:
  print("safe")

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

W = int(input())

if W >= S/2:
  print("unsafe")
  
else:
  print("safe")

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

W = int(input())

if S >= W/2:
  print("unsafe")
  
else:
  print("safe")

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

W = int(input())

if S >= W/2:
  print("unsafe")
  
else:
  print("safe")
Problem p02682 (python)

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

if A >= K:
  print(K)
elif A + B >= K:
  print(A)
else:
  k = K - A - B
  print(A - k)

Buggy submission (verdict: Runtime Error):
from itertools import combinations
 
A, B, C, K = map(int, input().split(" "))

a = -100
_sum = 0
for i in combinations([1] * A + [0] * B + [-1]*C, K):
  if (_sum := sum(i)) > a:
    a = _sum
print(a)
Problem p02711 (python)

Fixed submission:
x = input()
if "7" in str(x):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
from itertools import product

x1 = int(input())
x2 = input()

R_i = [i for i, x in enumerate(x2) if x == "R"]
G_i = [i for i, x in enumerate(x2) if x == "G"]
B_i = [i for i, x in enumerate(x2) if x == "B"]

R = len(R_i)
G = len(G_i)
B = len(B_i)

xs = map(sorted, product(R_i, G_i))

s = 0
for a in xs:
    k = a[1]*2 - a[0]  # 2j-i
    if k in B_i:
        s +=1
    i = a[0]*2 - a[1]  # 2j-k
    if i in B_i:
        s +=1
    j = (a[0] + a[1]) / 2
    if j.is_integer():
        j = int(j)
        if j in B_i:
            s +=1
print(R*G*B - s)

Buggy submission (verdict: Runtime Error):
from itertools import product

x1 = int(input())
x2 = input()

R = [i for i, x in enumerate(x2) if x == "R"]
G = [i for i, x in enumerate(x2) if x == "G"]
B = [i for i, x in enumerate(x2) if x == "B"]

group = map(sorted, product(R, G, B))
voter = [1 for i in group if (i[1] - i[0]) != (i[2] - i[1])]
print(sum(voter))
Problem p02712 (python)

Fixed submission:
x = int(input())
sum = 0
for i in range(x+1):
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        sum += i
print(sum)

Buggy submission (verdict: Runtime Error):
x = input()
sum = 0
for i in range(x+1):
    if i % 3 or i % 5:
        pass
    else:
        sum += i
print(sum)

Buggy submission (verdict: Runtime Error):
x = input()
sum = 0
for i in range(x):
  if i % 3 or i % 5:
    pass
  else:
    sum += i
print(sum)