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

Fixed submission:
def f(x,n):
	if x == 1: return [n];
	if x % 2 == 1:
		return f(x >> 1,n + 1) + [n]
	else:
		return [n] + f(x - 1,n + 1)

def g(x,n):
	if x == 1: return [n];
	if x % 2 == 1:
		return g(x >> 1,n + 1) + [n]
	else:
		return g(x - 1,n + 1) + [n]

n = input()
p = f(n,1) + g(n,1)
print len(p)
print ' '.join(list(map(str,p)))

Buggy submission (verdict: Runtime Error):
def f(x,n):
	if x == 1: return [n];
	if x % 2 == 1:
		return f(x >> 1,n + 1) + [n]
	else:
		return [n] + f(x - 1,n + 1)

n = input()
p += range(1,len(p) + 1)
print ' '.join(list(map(str,p)))
Problem p03041 (python)

Fixed submission:
N,K=(int(x) for x in input().split())
S=list(input())
S[K-1] = S[K-1].lower()
print(''.join(S))

Buggy submission (verdict: Runtime Error):
N,K=(int(x) for x in input().split())
S=list(int(i) for i in input())
S[K-1] = S[K-1].lower()
print(' '.join(S))

Buggy submission (verdict: Runtime Error):
N,K=(int(x) for x in input().split())
S=list(int(i) for i in input())
S[K-1] = S[K-1].lower()
print(','.join(S))

Buggy submission (verdict: Runtime Error):
N,K=(int(x) for x in input().split())
S=list(int(i) for i in input())
S[K] = S[K].lower()
print(','.join(S))
Problem p03803 (python)

Fixed submission:
A,B=[int(x) for x in input().split()]
if A==1:
  A=14
if B==1:
  B=14
if A>B:
  print('Alice')
elif B>A:
  print('Bob')
else:
  print('Draw')

Buggy submission (verdict: Runtime Error):
A,B=[int(x) for in x input().split()]
if A==1:
  A=14
if B==1:
  B=14
if A>B:
  print('Alice')
elif B>A:
  print('Bob')
else:
  print('Drow')

Buggy submission (verdict: Runtime Error):
A,B=[int(x) for in x input().split()]
if A=1:
  A==14
if B=1:
  B==14
if A>B:
  print('Alice')
elif B>A:
  print('Bob')
else:
  print('Drow')

Buggy submission (verdict: Runtime Error):
A,B=(int(x) forx in input.split())
if A=1:
  A==14
if B=1:
  B==14
if A>B:
  print('Alice')
elif B>A:
  print('Bob')
else:
  ('Drow')

Buggy submission (verdict: Runtime Error):
1<=A<=13
1<=B<=13

if A > B >=2 or A=1 ,B >= 2 :
  print(Alice)
elif B > A =2 or B=1 ,A >= 2:
  print(Bob)
elif A = B:
  print(Draw)
Problem p03834 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c=map(str,input().split())
print(a+' '+b+' '+c)
Problem p03012 (python)

Fixed submission:
N = int(input())
W = list(map(int, input().split()))
 
S1 = 0
S2 = 0
ans = []
 
for i in range(N-1):
  S1 = sum(W[:i+1])
  S2 = sum(W[i+1:])
  ans.append(abs(S1-S2))
print(min(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
w = list(map(int,input().split()))
 
import numpy as np
 
a = np.cumsum(W)
 
print(int(min(abs(sum(w)/2 - a))*2))
Problem p03042 (python)

Fixed submission:
s=(input())
s1=int(s[:2])
s2=int(s[2:])
 
if 1<= s1 <=12 and 1<= s2 <= 12:
    print("AMBIGUOUS")
 
elif 0<= s1 <=99 and 1<= s2 <= 12:
    print("YYMM")
 
elif 1<= s1 <=12 and 0<= s2 <= 99:
    print("MMYY")
 
else:
    print("NA")

Buggy submission (verdict: Runtime Error):
while True:
    c = input()
    c = [int(c[0] + c[1]),int(c[2] + c[3])]
    g = ""
    if c[0] > 12 and c[1] < 13 and c[1] != 0:
        g = "YYMM"
    if c[0] < 13 and c[1] > 12 and c[0] != 0:
        g = "MMYY"
    if c[0] < 13 and c[1] < 13:
        g = "AMBIGUOUS"
    if c[0] < 1 or c[1] < 1 or c[1] > 12 and c[0] > 12:
        g = "NA"
    print(g)
Problem p02897 (python)

Fixed submission:
N=int(input())

p=0
for i in range(N+1):
    if i%2==1:
        p +=1
print(p/N)

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

p=0
for i in range(1,N):
    if i%2==1:
        p +=1
print(p/n)
Problem p03013 (python)

Fixed submission:

N,M = (int(i) for i in input().split())
a = [0] * M
mod = 1000000007
for i in range(M):
    a[i] = int(input())
a.append(100000000)
flag = 0
for i in range(M-1):
    if a[i] + 1 == a[i+1]:
        flag = 1
        break

dp = [1] * (N + 1)
tmp = 0

for i in range(N-1):
    if i+1 == a[tmp]:
        dp[i+2] = dp[i]
    elif i == a[tmp]:
        dp[i+2] = dp[i+1]
        tmp += 1
    else:
        dp[i+2] = (dp[i+1] + dp[i]) % mod

if flag == 1:
    print(0)
else:
    print(dp[N])

Buggy submission (verdict: Runtime Error):
import math

N,M = (int(i) for i in input().split())
a = [0] * M
mod = 1000000007
for i in range(M):
    a[i] = int(input())

def calc(f,t):
    tmp = t - f
    i = 1
    ans = 1
    if tmp == 1:
        return 1
    if tmp == 0:
        return 1
    while(tmp >= 2*i):
        ans += math.factorial(tmp - i) // math.factorial(i) // math.factorial(tmp - 2*i)
        i += 1
    return ans

flag = 0
A = 1
A *= calc(0,a[0]-1)

for i in range(M-1):
    if a[i] + 1 == a[i+1]:
        flag = 1
        break
    A *= calc(a[i]+1,a[i+1]-1)
    A %= mod

A *= calc(a[M-1]+1,N)
A %= mod

if flag == 1:
    print(0)
elif M == 0:
    print(calc(0,N))
else:
    print(A)
Problem p03038 (python)

Fixed submission:
import heapq

N,M = (int(i) for i in input().split())
A = list(map(int,input().split()))
A.sort()
D = []
len = 0
BC = [0] * M

for i in range(M):
    BC[i] = list(map(int,input().split()))
BC.sort(key = lambda x:x[1],reverse = True)
for i in range(M):
    D.extend([BC[i][1]] * BC[i][0])
    len += BC[i][0]
    if len > N:
        break
cnt = min(N,len)
for i in range(cnt):
    if A[0] < D[i]:
        heapq.heapreplace(A,D[i])
    else:
        break
print(sum(A))

Buggy submission (verdict: Runtime Error):
import heapq

N,M = (int(i) for i in input().split())
A = list(map(int,input().split()))
A.sort()
D = []
len = 0
for i in range(M):
    B,C = (int(i) for i in input().split())
    for j in range(B):
        heapq.heappush(D,C)
        len += 1
        if len > N:
            heapq.heappop(D)
            len -= 1

for i in range(N):
    if A[0] < D[-1]:
        heapq.heapreplace(A,D[-1])
        D.pop(-1)
    else:
        break
print(sum(A))
Problem p02897 (python)

Fixed submission:
N = int(input())
if N % 2 == 1:
  print((int(N/2) + 1)/N)
else:
  print(0.5)

Buggy submission (verdict: Runtime Error):
N = input()
if N % 2 == 1:
  print(int(N/2)/N)
else:
  print(0.5)

Buggy submission (verdict: Runtime Error):
N = float(input())
if N % 2.0 == 1.0:
  print(((N + 1.0)/2.0)/N)
else:
  print((N/2.0/)N)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N % 2 == 1:
  print(((N + 1)/2)/N)
else:
  print((N/2/)N)

Buggy submission (verdict: Runtime Error):
N = input()
if N % 2 == 1:
  print(((N + 1)/2)/N)
else:
  print((N/2/)N)
Problem p02897 (python)

Fixed submission:
num = int(input())
if(num%2==0):
  print(0.5)
else:
  print(((num+1)/2)/num)

Buggy submission (verdict: Runtime Error):
num = int(input())
if(num%2==0):
  print(0.5)
else:
  print(((n+1)/2)/n)
Problem p03307 (python)

Fixed submission:
n = int(input())
if n%2==0:
    print(n)
else:
    print(int(2 * n))

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
print(int(2*n/math.gcd(2,n)))
Problem p03745 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
mode = 0
ans = 1
for i in range(1,n):
    d = a[i]-a[i-1]
    if mode == 0:
        mode = d
        continue
    if mode>0:
        if d<0:
            ans += 1
            mode = 0
    elif mode<0:
        if d>0:
            ans += 1
            mode = 0
print(ans)

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

n,l,t = li()
a,ac,au = [],[],[]
for i in range(n):
    x,y = li()
    if i == 0: start = y
    a.append(x)
    if y == 1:
        ac.append(x)
    else:
        au.append(x)

tt = t%l

if start == 2:
    acc = [n-ac[-s] for s in range(1,len(ac)+1)]
    dist = au[0]+acc[0]
    j = 0
    for i in range(1, min(len(au), len(acc))):
        if dist > tt:
            j = i-1
            break
        if i&1:
            dist += au[i]-au[i-1]
        else:
            dist += acc[i]-acc[i-1]
    if j&1:
        pointofone = n - acc[j//2]
    else:
        pointofone = au[j//2]
else:
    acc = [-au[0]] + [n-ac[-s] for s in range(1, len(ac))]
    dist = acc[0] + au[0]
    j = 0
    for i in range(1, min(len(ac), len(acc)) ):
        if dist > tt:
            j = i-1
            break
        if i&1:
            dist += acc[i]-acc[i-1]
        else:
            dist += au[i]-au[i-1]
    if j == 0:
        pointofone = ac[0]
    elif j&1:
        pointofone = au[j//2]
    else:
        pointofone = n - acc[j//2]

ant = sorted([(s-t)%l for s in au] + [(s+t)%l for s in ac])
st = ant.index(pointofone)
ant = ant[st:]+ant[:st]
print(*ant, sep='\n')
Problem p03986 (python)

Fixed submission:
s = input()
stack = [s[0]]
for i in range(1,len(s)):
    if len(stack)==0:
        stack.append(s[i])
        continue
    else:
        cur_str = stack[-1]
        new_str = s[i]
        if cur_str+new_str=="ST":
            stack.pop()
        else:
            stack.append(new_str)
print(len(stack))

Buggy submission (verdict: Runtime Error):
s = input()
stack = [s[0]]
for i in range(1,len(s)):
    cur_str = stack[-1]
    new_str = s[i]
    if cur_str+new_str=="ST":
        stack.pop()
    else:
        stack.append(new_str)
print(len(stack))
Problem p03072 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
count = 0
for i in range(1,n+1):
    exam = h[0:i]
    sorted_exam = sorted(exam)
    if exam[-1] == sorted_exam[-1]:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
count = 1
for i in range(1, n):
    if all(h[i] >= h[j] for j in range(0, i-1)):
        count += 1
if h[0] > h[1]:
    print(count-1)
else:
    print(count)
Problem p03075 (python)

Fixed submission:
import sys
list = [int(input()) for _ in range(6)]
for i in range(5):
  for j in range(i+1, 5):
    if list[j] - list[i] > list[5]:
      print(':(')
      sys.exit()
print('Yay!')

Buggy submission (verdict: Runtime Error):
import sys
list = [input() for _ in range(6)]
for i in range(5):
  for j in range(i+1, 5):
    if list[j] - list[i] > list[5]:
      print(':(')
      sys.exit()
print('Yay!')
Problem p02987 (python)

Fixed submission:
S = list(input())
A = S[0]
while A in S :
    S.remove(A)
if len(S) == 2 :
    if S[0] == S[1] :
        print("Yes")
    else :
        print("No")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
S = list(input())
A = S[0]
while A in S :
    S.remove(A)
B = S[0]
if len(S) == 2 :
    if B in S :
        print("Yes")
    else :
        print("No")
else :
    print("No")
Problem p02916 (python)

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

last = -1

sum = sum(b) 

for i in range(n):
    if last == a[i]-1:
        sum += c[last-1]
    last = a[i]
print(sum)

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

sum = sum(c) + sum(b) - c[a[n-1]-1]

print(sum)
Problem p02933 (python)

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

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

Buggy submission (verdict: Runtime Error):

import sys
input = sys.stdin.readline

n, q = [int(x) for x in input().split()]

edge = [[] for _ in range(n)]

counter = [0] * n

for _ in range(n-1):
    a, b = [int(x) for x in input().split()]
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

for _ in range(q):
    a, b = [int(x) for x in input().split()]
    counter[a-1] += b

parent = [0]

for i in parent:
    for v in edge[i]:
        if v in parent:
            continue
        parent.append(v)
        counter[v] += counter[i]
        
print(" ".join(map(str, counter)))
Problem p03631 (python)

Fixed submission:
N=int(input())
a=N//100
b=N%10
if a==b:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N=int(input())
a=N//100
b=N%10
if a==b:
  print('Yes')
else:
  pritn('No')
Problem p03073 (python)

Fixed submission:
S=str(input())
s=len(S)
Sk=[]
Sg=[]
for i in range(0,s,2):
    Sk.append(S[i])
for i in range(1,s,2):
    Sg.append(S[i])
Sk0=Sk.count('0')
Sk1=Sk.count('1')
Sg0=Sg.count('0')
Sg1=Sg.count('1')
Stotal=[Sk0,Sk1,Sg0,Sg1]
if Sk0+Sg1<Sk1+Sg0:
    print(Sk0+Sg1)
else:
    print(Sk1+Sg0)

Buggy submission (verdict: Runtime Error):
S=str(input())
s=len(S)
Sk=[]
Sg=[]
for i in range(0,s,2):
    Sk.append(Sstr[i])
for i in range(1,s,2):
    Sg.append(Sstr[i])
Sk0=Sk.count('0')
Sk1=Sk.count('1')
Sg0=Sg.count('0')
Sg1=Sg.count('1')
Stotal=[Sk0,Sk1,Sg0,Sg1]
if Sk0+Sg1<Sk1+Sg0:
    print(Sk0+Sg1)
else:
    print(Sk1+Sg0)
Problem p03072 (python)

Fixed submission:
n = int(input())
data = list(map(int,input().split()))
h = 0
ans = 0
for i in range(n):
	if data[i]>=h:
		ans+=1
		h = data[i]
print(ans);

Buggy submission (verdict: Runtime Error):
n = input()
data = list(map(int,input().split()))
h = 0
ans = 0
for i in range(0,n):
	if data[i]>h:
		ans++
print(ans);
Problem p03075 (python)

Fixed submission:
data = [int(input()) for i in range(5)]
K = int(input())
print(":(" if data[4]-data[0]>K else "Yay!" )

Buggy submission (verdict: Runtime Error):
data = [int(input()) for i in range(5)]
K = input()
print(":(" if data[4]-data[0]>K else "Yay!" )

Buggy submission (verdict: Runtime Error):
data = [input() in range(5)]
K = input()
print(":(" if data[4]-data[0]>K else "Yay!" )
Problem p03104 (python)

Fixed submission:
# F(a,b) = a xor (a+1) ,,, (b-1) xor b
# F(a,b) = F(0,a-1) xor F(0,b)
# 偶数nについて、 n xor (n+1) = 1

# f(n) == F(0,n)
def f(n):
	num = (n+1)//2	# n xor (n+1) の個数
	if num%2==0:
		if n%2==1:
			return 0
		else:
			return n
	else:
		if n%2==1:
			return 1
		else:
			return 1^n

a,b= list(map(int,input().split()))
print(f(a-1)^f(b))

Buggy submission (verdict: Runtime Error):
# F(a,b) = F(0,a-1) xor F(0,b)
# 偶数nについて、 n xor (n+1) = 1
a,b = list(map(int,input().split()))
a = (((a+1)/2)%2)^(a-1)	# F(0,a-1)
b = (((b+1)/2)%2)^b		# F(0,b)
print(a^b)
Problem p02897 (python)

Fixed submission:
n = int(input())
print('{:.10f}'.format((n//2 + n%2)/n))

Buggy submission (verdict: Runtime Error):
from collections import*
n,m,*t=map(int,open(0).read().split())
i,o,r=[0]*n,[[]for _ in'_'*n],[]
for a,b in zip(*[iter(t)]*2):
  o[a-1]+=b-1,
  i[b-1]+=1
q=deque(v for v in range(n)if i[v]<1)
while q:
  v=q.popleft()
  r+=v,
  for w in o[v]:
    i[w]-=1
    if i[w]==0:q+=w,
print(-(len(r)==n))
for j,k in enumerate(i):
  if i[j]>0: print(j+1)
Problem p02916 (python)

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
s = 0
for x in B:
    s += x
for i in range(n-1):
    if A[i+1]-A[i]==1:
        s += C[A[i]-1]
print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
s = 0
for x in B:
    s += x
for i in range(n-1):
    if A[i+1]-A[i]==1:
        s += C[A[i]]
print(s)
Problem p03327 (python)

Fixed submission:
n = int(input())

if n <= 999:
    print("ABC")
else:
    print("ABD")

Buggy submission (verdict: Runtime Error):
# import time
N, C = map(int, input().split())              # 同上。map関数を使うとこのように書ける

D = [[0 for i in range(C)] for j in range(C)]
c = [[0 for i in range(N)] for j in range(N)]
# iwakan = [[[0 for i in range(N)] for j in range(N)] for k in range(C)]

for i in range(C):
    D[i] = list(map(int, input().split()))

for i in range(N):
    c[i] = list(map(int, input().split()))

# まず違和感リストを作る。
# for i in range(C):
#     for j in range(N):
#         for k in range(N):
#             iwakan[i][j][k] = D[c[j][k] - 1][i]

'''
Gij0 : (i + j) % 3 == 0 となる場所
Gij1 : (i + j) % 3 == 1 となる場所
Gij2 : (i + j) % 3 == 2 となる場所
とした時に、
Gijnに属する場所全ての色をaに塗り替える場合の違和感の合計を
iwakan[n][a]とする。
iwakan[n][a]を全て求めるための計算量は、30*500*500 = 7500000
iwakan を用いて全ての色の塗り替えの組み合わせを求めるための計算量は
30 * 29 * 28 = 24360
'''

# t1 = time.time()

# Gijnに属する色の数を合計したリストを作る。
numOfColors = [[0 for i in range(C)] for j in range(3)]
for i in range(N):
    for j in range(N):
        if (i + j) % 3 == 0:
            numOfColors[0][c[i][j] - 1] = numOfColors[0][c[i][j] - 1] + 1
        if (i + j) % 3 == 1:
            numOfColors[1][c[i][j] - 1] = numOfColors[1][c[i][j] - 1] + 1
        if (i + j) % 3 == 2:
            numOfColors[2][c[i][j] - 1] = numOfColors[2][c[i][j] - 1] + 1

iwakan = [[0 for i in range(C)] for j in range(3)]
for i in range(3):
    for j in range(C):
        for a in range(C):
            iwakan[i][j] = iwakan[i][j] + numOfColors[i][a] * D[a][j]

# t2 = time.time()

sum_min = float("inf")
for i in range(C):
    for j in range(C):
        for k in range(C):
            if (i == j) or (j == k) or (k == i):
                pass
            else:
                sum_tmp = iwakan[0][i] + iwakan[1][j] + iwakan[2][k]
                if sum_min > sum_tmp:
                    sum_min = sum_tmp

# t3 = time.time()

print(sum_min)

# elapsed_time1 = t2 - t1
# elapsed_time2 = t3 - t2
# print(f'time1: {elapsed_time1}')
# print(f'time2: {elapsed_time2}')
Problem p03209 (python)

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

answer = 0
red = x

searching_index = n
while red > 0:
    for i in reversed(range(searching_index + 1)):
        length = 2**(i + 2) - 3
        if red >= length:
            if red >= length + 1:
                answer += 1
                red -= 1
            searching_index = i
            answer += 2**(i+1) - 1
            red -= length
            break
        red -= 1

print(answer)

Buggy submission (verdict: Runtime Error):
def feed_runrun(answer, burger_dimension, appetite):
    if appetite == 0:
        return answer

    burger_size = 2 ** (burger_dimension + 2) - 3
    # 食べきれないなら小さくして試す
    if appetite < burger_size:
        return feed_runrun(answer, burger_dimension - 1, appetite - 1)

    amount_of_p = 2 ** (burger_dimension + 1) - 1
    if appetite == burger_size + 1:
        return answer + amount_of_p + 1
    return feed_runrun(answer + amount_of_p + 1, burger_dimension, appetite - burger_size - 1)


n, x = map(int, input().split())
print(feed_runrun(0, n, x))

Buggy submission (verdict: Runtime Error):
def feed_runrun(answer, burger_dimension, appetite):
    if appetite == 0:
        return answer

    burger_size = 2 ** (burger_dimension + 2) - 3
    # 食べきれない
    if appetite < burger_size:
        return feed_runrun(answer, burger_dimension - 1, appetite - 1)
    # 食べきれるので, 食べる
    amount_of_p = 2 ** (burger_dimension + 1) - 1
    return feed_runrun(answer + amount_of_p + 1, burger_dimension, appetite - burger_size - 1)


n, x = map(int, input().split())
print(feed_runrun(0, n, x))
Problem p03804 (python)

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

A = [ input() for _ in range(N) ]
B = [ input() for _ in range(M) ]

for i in range(N-M+1):
  for _ in range(A[i].count(B[0])):
    l = A[i].index(B[0])
    result = True
    for k in range(1, M):
      if B[k] != A[i+k][l:l+len(B[k])]:
        result = False
        break
    if result:
      print("Yes")
      exit()
    l += 1
      
print("No")

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

A = [ input() for _ in range(N) ]
B = [ input() for _ in range(M) ]

for i in range(N-M+1):
  for _ in range(A[i].count(B[0])):
    l = A[i].index(B[0], l)
    result = True
    for k in range(1, M):
      if B[k] != A[i+k][l:l+len(B[k])]:
        result = False
        break
    if result:
      print("Yes")
      exit()
    l += 1
      
print("No")
Problem p02897 (python)

Fixed submission:
n = int(input())


if n % 2 == 0:
    print(0.5)
else:
    print((n//2 + 1)/n)

Buggy submission (verdict: Runtime Error):
num, jet = (input().split())

height = list(map(int, input().split()))
ans = 0

for n in height:
    if n >= int(jet):
        ans += 1
    else:
        continue

print(ans)
Problem p03315 (python)

Fixed submission:
s = input()
n, m  = s.count('+'), s.count('-')
print(n-m)

Buggy submission (verdict: Runtime Error):
import math
n, c = map(int, input().split())

a = input()
print(math.ceil((n-1)//(c-1)))

Buggy submission (verdict: Runtime Error):
n, c = map(int, input().split())
print((n-1)//(c-1))

Buggy submission (verdict: Runtime Error):
S = input()
Sum =sum(int(i) for i in str(S))
if int(S) % Sum == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input().split()
n = int(input())
a +=s.count('+')
b  -= s.count('-')
print(n-a-b)

Buggy submission (verdict: Runtime Error):
s = input().split()
n = int(input())
n +=s.count('+')
n  -= s.count('-')
print(n)
Problem p02897 (python)

Fixed submission:
N = int(input())
if(N == 1):
  print(1)
elif(N %2 == 0):
  print(0.5)
elif(N %2 == 1):
  print((N+1)/(2*N))

Buggy submission (verdict: Runtime Error):
N = int(input())
if(N == 1):
  return(1)
elif(N %2 == 0):
  return(0.5)
elif(N %2 == 1):
  return((N+1)/(2*N))
Problem p02897 (python)

Fixed submission:
N = int(input())

print((N+1)//2/N)

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

print(f'{(N+1)//2/N}')
Problem p03286 (python)

Fixed submission:
import bisect
n = int(input())
ps = [0] * (1 << 16)
for i in range(1 << 16):
    temp = 0
    for j in range(16):
        if (i >> j) & 1:
                temp += (-2) ** (2 *j)
    ps[i] = temp

pattern1 = None
pattern2 = None

for i in range(1 << 16):
    temp2 = 0
    for j in range(16):
        if (i >> j) & 1:
                temp2 += (-2) ** (2 *j + 1)
    n2 = n - temp2
    pattern1 = bisect.bisect_left(ps, n2)
    if pattern1 != (1 << 16) and ps[pattern1] == n2:
        pattern2 = bin(i)[2:].zfill(16)
        pattern1 = bin(pattern1)[2:].zfill(16)
        break

ans = ""
for i in range(16):
    ans += pattern2[i]
    ans += pattern1[i]
    
true_ans = ""
flag = False
for i in range(len(ans)):
    if ans[i]=="1":
        true_ans += "1"
        flag = True
    elif flag:
        true_ans += "0"

if true_ans == "":
    true_ans = "0"
        
print(true_ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ps = [0] * (1 << 16)
for i in range(1 << 16):
    temp = 0
    for j in range(16):
        if (i >> j) & 1:
                temp += (-2) ** (2 *j)
    ps[i] = temp

"""
for index, value in enumerate(ps):
    print(bin(index)[2:].zfill(16), value)
"""

pattern1 = None
pattern2 = None

for i in range(1 << 16):
    temp2 = 0
    for j in range(16):
        if (i >> j) & 1:
                temp2 += (-2) ** (2 *j + 1)
    n2 = n - temp2
    pattern1 = bisect.bisect_left(ps, n2)
    if pattern1 != (1 << 16) and ps[pattern1] == n2:
        pattern2 = bin(i)[2:].zfill(16)
        pattern1 = bin(pattern1)[2:].zfill(16)
        break

ans = ""
for i in range(16):
    ans += pattern2[i]
    ans += pattern1[i]
    
true_ans = ""
flag = False
for i in range(len(ans)):
    if ans[i]=="1":
        true_ans += "1"
        flag = True
    elif flag:
        true_ans += "0"

if true_ans == "":
    true_ans = "0"
        
print(true_ans)
Problem p02897 (python)

Fixed submission:
a = int(input())
if a%2 == 0:
  print(1/2)
else:
  print((a//2+1)/a)

Buggy submission (verdict: Runtime Error):
a = int(input())
if i%2 == 0:
  print(1/2)
else:
  print((a/2+1)/a)

Buggy submission (verdict: Runtime Error):
a = int(input('<< '))
k=0
for i in range(1,a):
  if i%2 == 1:
    k += 1
  v = k/a
print(v)

Buggy submission (verdict: Runtime Error):
a = int(input('<< '))
k=0
for i in range(1,a):
  if i%2 == 1:
    k += 1
  v = k/a

print v

Buggy submission (verdict: Runtime Error):
import random
a = int(input('<< '))
k=0
for i in range(1,a):
  if i%2 == 1:
    k += 1
  v = k/a

print v

Buggy submission (verdict: Runtime Error):
import random
a = int(input('<< '))
k=0
g=0
for i in range(1,a):
  if i%2 == 1:
    k += 1
  v = k/a

print(v)

Buggy submission (verdict: Runtime Error):
import random
a = int(input('<< '))
k=0
g=0
for i in range(1,a):
  if i%2 == 1:
    k += 1
  v = k/a

print v
Problem p03011 (python)

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

Buggy submission (verdict: Runtime Error):
p = int(input())
q = int(input())
r = int(input())
a = p + q
b = q + r
c = p + r
print(min(a,b,c))

Buggy submission (verdict: Runtime Error):
p = int(input())
q = int(input())
r = int(input())
a = p + q
b = q + r
c = p + r
print(max(a,b,c))