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

Fixed submission:

N,M = map(int,input().split())
lis = []
path = ["1"]

for i in range(M):

    a,b = map(int,input().split())
    lis.append([a,b])

for i in range(N-1):

    i += 1

    npath = []

    for p in path:


        for j in lis:

            if j[0] == int(p[-1]) and str(j[1]) not in p:

                npath.append(p + str(j[1]))

            if j[1] == int(p[-1]) and str(j[0]) not in p:

                npath.append(p + str(j[0]))

    path = npath.copy()


print (len(path))

Buggy submission (verdict: Runtime Error):

N,M = map(int,input().split())
lis = []
path = ["1"]

for i in range(M):

    a,b = map(int,input().split())
    lis.append([a,b])

for i in range(N-1):

    i += 1

    npath = []

    for p in path:


        for j in lis:

            if j[0] == int(p[-1]) and str(j[1]) not in p:

                npath.append(p + str(j[1]))

            if j[1] == int(p[-1]) and str(j[0]) not in p:

                npath.append(p + str(j[0]))

    path = npath.copy()


print (len(path))

Buggy submission (verdict: Runtime Error):

N,M = map(int,input().split())
lis = []
path = ["1"]

for i in range(M):

    a,b = map(int,input().split())
    lis.append([a,b])

for i in range(N-1):

    i += 1

    npath = []

    for p in path:


        for j in lis:

            if j[0] == int(p[-1]) and str(j[1]) not in p:

                npath.append(p + str(j[1]))

            if j[1] == int(p[-1]) and str(j[0]) not in p:

                npath.append(p + str(j[0]))

    path = npath.copy()


print (len(path))
Problem p02712 (python)

Fixed submission:
N = int(input())
total = 0
for i in range(1, N+1):
    if (i % 3) != 0 and (i % 5) != 0:
        total = total+i
print(total)

Buggy submission (verdict: Runtime Error):
N = int(input())
total = 0
for i in range(1,N+1)
    if (i%3) != 0 and (i%5) ! =0:
        total += i
print(total)

Buggy submission (verdict: Runtime Error):
N = int(input())
total = 0
for i in range(1,N+1)
    if i%3 != 0 and i%5 ! =0:
        total += i
print(total)

Buggy submission (verdict: Runtime Error):
N = int(input())
total = 0
for i in range(1,N+1)
    if i%3!=0 and i%5!=0:
        total += i
print(total)

Buggy submission (verdict: Runtime Error):
N = int(input())
total = 0
for i in range(1,N+1):
	if i%3!=0 and i%5!=0:
    	total += i
print(total)

Buggy submission (verdict: Runtime Error):
N = int(input())
total = 0
for i in range(1,N+1):
	if i%3!=0 and i%5!=0:
    	total = total + 1
print(total)

Buggy submission (verdict: Runtime Error):
N = int(input())
total = 0
for i in range(1,N+1):
	if i%3!=0 and i%5!=0:
    	total +=i
print(total)

Buggy submission (verdict: Runtime Error):
N = int(input())
total = 0
for i in range(1,N+1):
	if i%3 != 0 and i%5! = 0:
		total += i
print(total)

Buggy submission (verdict: Runtime Error):
N = int(input())
total = 0
for i in range(1,N+1):
	if i%3!=0 and i%5!=0:
    	total += i
print(total)

Buggy submission (verdict: Runtime Error):
N = int(input())
total = 0
for i in range(1,N+1):
	if N%3!=0 and N%5!=0:
    	total += i
print(total)
Problem p02860 (python)

Fixed submission:
a = int(input())
b = input()
if a%2 == 0:
  print("Yes" if b[:int(a/2)] == b[int(a/2):] else "No")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = input()
if a%2 == 0:
  print("Yes" if b[:(a/2)] == b[(a/2):] else "No")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = input()
if a%2 == 0:
  print("Yes" if a[:(a/2)] == a[(a/2):] else "No")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = input()
if a%2 == 0:
  print("Yes" if a[:(a/2-1)] == a[(a/2):] else "No")
else:
  print("No")
Problem p02862 (python)

Fixed submission:
import math
import numpy as np

def cmb(n, r, mod):
  r = min(r, n-r)
  return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 
N = 10**6
g1 = [1, 1] 
g2 = [1, 1] 
inverse = [0, 1] 

for i in range( 2, N + 1 ):
  g1.append( ( g1[-1] * i ) % mod )
  inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
  g2.append( (g2[-1] * inverse[-1]) % mod )

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

if (x+y) % 3 == 0:

  A = np.array([[1, 2],
                [2, 1]])

  b = np.array([x, y])

  N = np.linalg.solve(A, b)


  if N[0].is_integer() == True and N[1].is_integer() == True and N[0] >=0 and N[1] >=0:
        
      print(cmb(int(N[0]+N[1]),int(N[0]),mod))

  else:
      print(0)

else:
  print(0)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if (a+b)%3 == 0:
  n = (a+b)/3
  import math
  aa = math.factorial(a-n)
  bb = math.factorial(b-n)
  cc = math.factorial(n)
  print((cc/(bb*aa))%(10**9+7))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if (a+b)%3 == 0:
  n = (a+b)/3
  aa = math.factorial(a-n)
  bb = math.factorial(b-n)
  cc = math.factorial(n)
  print((cc/(bb*aa))%(10**9+7))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if (a+b)%3 == 0:
  a == a - min(a,b)
  b == b - min(a,b)
  c = a+b
  import math
  aa = math.factorial(a)
  bb = math.factorial(b)
  cc = math.factorial(c)
  print((cc/(bb*aa))%(10**9+7))
else:
  print(0)
Problem p02880 (python)

Fixed submission:
a = int(input())
i = 1
while i < 10:
  if a%i == 0 and 1<= a//i <=9:
    print("Yes")
    break
  else:
    i += 1
if i >=10:
    print("No")

Buggy submission (verdict: Runtime Error):
a = int(input())
i = 1
while i < 10:
  if a%i = 0 and 1<= a//i <=9:
    print("Yes")
    break
  else:
    i += 1
Problem p03315 (python)

Fixed submission:
s = input()
count = 0
for i in range(4):
  if s[i] == "+":
    count += 1
  else:
    count -=1
print(count)

Buggy submission (verdict: Runtime Error):
s = input()
count = 0
for i in range(4):
  if s[i] == +:
    count += 1
  else:
    count -=1
print(count)
Problem p03834 (python)

Fixed submission:
a,b,c = input().split(",")
print(a,b,c)

Buggy submission (verdict: Runtime Error):
print(*list[input().split(",")])

Buggy submission (verdict: Runtime Error):
a,b.c = input().split(",")
print(a,b,c)
Problem p02571 (python)

Fixed submission:
S = input()
T = input()

ans = len(T)

for i in range(len(S)-len(T)+1):
  tmp = len(T)
  for j in range(len(T)):
    if T[j] == S[i+j]:
      tmp -= 1
      ans = min(ans,tmp)
print(ans)

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

for i in range(len(T)):
  if i == 0:
    if T[:len(T)-i] in S:
      print(0)
  else:
    if T[:len(T)-i] in S and S[len(T)-i+1] != T[:len(T)-i]:
      print(i)
Problem p02572 (python)

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

mod= 10**9+7

A = sum(a)

ans=0

for i in a:
  A -= i
  A%=mod
  ans += A*i
  ans%=mod
print(ans)

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

mod= 10**9+7

A = sum(a)

ans=0

for i in a:
  A -= i
  A%=mod
  ans += A*x
  ans%=mod
print(ans)
Problem p02693 (python)

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

count = 0

for i in range(A,B+1):
  if i%K ==0:
    count +=1
  else:
    count+=0

if count >0:
  print('OK')
else:
  print('NG')

Buggy submission (verdict: Runtime Error):
K = int(input())
A,B = map(int,input().split())
 
if A%K==0 or B%K==0 or B-A >= K　and A <= K <= B:
  print('OK')
else:
  print('NG')
Problem p02699 (python)

Fixed submission:
S,W=(int(x) for x in input().split())

if S <= W:
  print('unsafe')
else:
  print('safe')

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

if int(S) <= int(W):
  print('unsafe')
elif int(S) > int(W):
  print('safe')

Buggy submission (verdict: Runtime Error):
if S <= W:
  print('unsafe')
else:
  print('safe')

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

if (S <= W) and 0 <= S,W <= 100: 
    print('unsafe')
else:
    print('safe')

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

if S <=W:
    print('unsafe')
else:
    print('safe')

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

if S <= W:
  print('unsafe')
else:
  print('safe')

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

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

Buggy submission (verdict: Runtime Error):
s = int(input())
w = int(input())

if s =< w:
  print("unsafe")
else:
  print("safe)

Buggy submission (verdict: Runtime Error):
s = input(int())
w = input(int())

if s =< w:
  print("unsafe")
else:
  print("safe")
Problem p02701 (python)

Fixed submission:
N = int(input())
S =[input() for i in range(N)]

s = set(S)

print(len(s))

Buggy submission (verdict: Runtime Error):
N = int(input())
S =[input() for i in range(N+1)]

s = set(S)

print(len(s))
Problem p02777 (python)

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

if U == S:
  print(A-1, B)
else:
  print(A, B-1)

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

if U == S:
  print(A-1, B)
else:
  print(A, B-1)
Problem p02860 (python)

Fixed submission:
N = int(input())
S = input()

print('Yes' if S[N//2:] == S[:N//2] else 'No')

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

print('Yes' if S[N//2:] == S[:N//2] else 'No')
Problem p02897 (python)

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

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

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

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

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

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

print(0.5 if N % ==0 else (N//2)+1/N)
Problem p02915 (python)

Fixed submission:
N = int(input())

print(N**3)

Buggy submission (verdict: Runtime Error):
print(int(input()**3)

Buggy submission (verdict: Runtime Error):
print(int(input()**3)
Problem p02970 (python)

Fixed submission:
import math
N,D = map(int, input().split())
print(math.ceil(N/(2*D+1)))

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

print(math.ceil(N/(2*D+1))
Problem p02987 (python)

Fixed submission:
S = input()
s = list(set(S))

print('Yes' if len(s)==2 and S.count(s[0]) == S.count(s[1]) == 2 else 'No')

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

print('Yes' if len(s)==2 and S.count(s[0]) == S.count(s[1]) == 2 else 'No')
Problem p03775 (python)

Fixed submission:
N = int(input())

import math

end = int(math.sqrt(N))+1
ans = len(str(N))

for a in range(1,end):
  if N % a ==0:
    b = N//a
    ans = min(ans, len(str(max(a,b))))
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
end = int(math.sqrt(N))+1
ans = len(str(N))

for a in range(1,end):
  if N%a == 0:
    b = N//a
    ans = min(ans, len(str(max(a,b)))
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
end = int(math.sqrt(N))+1
ans = len(str(N))

for a in range(1,end):
  if N%a == 0:
    b = N//i
    ans = min(ans, len(str(max(a,b)))
print(ans)
Problem p02580 (python)

Fixed submission:
import numpy as np
h,w,m=map(int, input().split())
hw=[tuple(map(int,input().split())) for i in range(m)]
H=np.zeros(h)
W=np.zeros(w)
for i in range(m):
    hi,wi=hw[i]
    H[hi-1]+=1
    W[wi-1]+=1
mh=max(H)
mw=max(W)
hmax=[i for i, x in enumerate(H) if x == mh]
wmax=[i for i, x in enumerate(W) if x == mw]
f=0
for i in range(m):
    hi,wi=hw[i]
    if H[hi-1]==mh and W[wi-1]==mw:
        f+=1
if len(hmax)*len(wmax)-f<1:
    print(int(mh+mw-1))
else:
    print(int(mh+mw))

Buggy submission (verdict: Runtime Error):
W=np.zeros(w)
for i in range(m):
    hi,wi=hw[i]
    H[hi-1]+=1
    W[wi-1]+=1
hmax=[i for i, x in enumerate(H) if x == max(H)]
wmax=[i for i, x in enumerate(W) if x == max(W)]
ans=0
mh=max(H)
mw=max(W)
for hi in hmax:
    for wi in wmax:
        if not ([hi+1,wi+1] in hw):
            ans=mh+mw
            print(int(ans))
            exit()
ans=mh+mw-1
print(int(ans))
Problem p02622 (python)

Fixed submission:
s=list(input())
t=list(input())
ans=0
for i in range(len(s)):
    if s[i]!=t[i]:
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
a=int(input())
print(a+a*a+a*a*a)
Problem p02623 (python)

Fixed submission:
n,m,k=map(int,input().split())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
ans=0
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])
j=m
for i in range(n+1):
    if k<a[i]:
        break
    while b[j]>k-a[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m,k=map(int,input().split())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
ans=0
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])
for i in range(n+1):
    if k<a[i]:
        break
    j=m
    while b[j]>k-a[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m,k=map(int,input().split())
A=[0]+list(map(int, input().split()))
B=[0]+list(map(int, input().split()))
ans=0
a=np.cumsum(np.array(A)).tolist()
b=np.cumsum(np.array(B)).tolist()
for i in range(n+1):
    if k<a[i]
        break
    j=m
    while b[j]>k-a[i]:
        j-=1
        ans=max(ans,i+j)
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
n,m,k=map(int,input().split())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
time=0
ans=0
if sum(a)+sum(b)<=k:
    print(n+m)
    exit()
a=deque(a)
b=deque(b)
a0=a.popleft()
b0=b.popleft()
while True:
  if a0>=b0:
    time+=b0
    if time>k:
      print(ans)
      exit()
    else:
      ans+=1
      b0=b.popleft()
  else:
    time+=a0
    if time>k:
      print(ans)
      exit()
    else:
      ans+=1
      a0=a.popleft()

Buggy submission (verdict: Runtime Error):
import heapq
n,m,k=map(int,input().split())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
time=0
ans=0
if sum(a)+sum(b)<=k:
    print(n+m)
    exit()
heapq.heapify(a)
heapq.heapify(b)
a0=heapq.heappop(a)
b0=heapq.heappop(b)
while True:
  if a0>=b0:
    time+=b0
    if time>k:
      print(ans)
      exit()
    else:
      ans+=1
      b0=heapq.heappop(b)
  else:
    time+=a0
    if time>k:
      print(ans)
      exit()
    else:
      ans+=1
      a0=heapq.heappop(a)
Problem p02699 (python)

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

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

Fixed submission:
n=str(input())
for i in range(len(n)):
  if n[i]=='7':
    print('Yes')
    exit()
print('No')

Buggy submission (verdict: Runtime Error):
n=list(map(int,input())
if n[i]==7:
  print('Yes')
else:
  print('No')
Problem p02729 (python)

Fixed submission:
n,m=map(int,input().split())
print(n*(n-1)//2 + m*(m-1)//2)

Buggy submission (verdict: Runtime Error):
l=int(input())
n=l/3
print(n*n*n)
Problem p02753 (python)

Fixed submission:
S=input()
if S == 'AAA' or S == 'BBB':
	print('No')
else:
	print('Yes')

Buggy submission (verdict: Runtime Error):
S=input()
if S= AAA or BBB
print(No)
 else print(YES)
Problem p02754 (python)

Fixed submission:
n,a,b=map(int,input().split())
q,mod=divmod(n,(a+b))
if mod>a:
  mod=a
print(q*a+mod)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
r=1
S=set()
while r<= 10**100:
	S='b'*A + str(S) +'r'*B
	if len(S)>10**18:
		S = S[1,10**18]
	r=r+1
print(S[1,N],count('b'))

Buggy submission (verdict: Runtime Error):
N,A,B =int(input())
r = 1
S=string()
while r<=10**100:
	S='b'*B+ S+ 'r'*A
    r += 1


print(S[1:N].count(b))
Problem p02759 (python)

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

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
list=[list(map(int,input().split())) for _ in range(m)]
flag=False
ans=['0']*n
for i in range(m):
  if list[i][0]==n:
    flag=True
  for j in range(i+1,m):
    if list[i][0]==list[j][0] and list[i][1]!=list[j][1]:
      print('-1')
      exit()
  ans[list[i][0]-1]=str(min(int(ans[list[i][0]-1]),list[i][1]))
if flag==True:
  print(''.join(ans))
else:
  print('-1')
Problem p02580 (python)

Fixed submission:
H,W,M=map(int,input().split())
countH=[0]*(H+1)
countW=[0]*(W+1)
S={}
i=0
for _ in range(M):
    h,w=map(int,input().split())
    countH[h]+=1
    countW[w]+=1
    S[str(h)+','+str(w)]=1

mh=max(countH)
mw=max(countW)
ans=mh+mw-1

c_mh=[]
i=0
while i<=H:
    if countH[i]==mh:
        c_mh.append(i)
    i+=1

c_mw=[]
i=0
while i<=W:
    if countW[i]==mw:
        c_mw.append(i)
    i+=1

ok=0
ok1=0
ok2=0
for h in c_mh:
    for w in c_mw:
        S.setdefault(str(h)+','+str(w))
        if S[str(h)+','+str(w)]==1:
            continue
        else:
            ans+=1
            ok=1
        if ok:
            break
    if ok:
        break

print(ans)

Buggy submission (verdict: Runtime Error):
H,W,M=map(int,input().split())
countH=[0]*(H+1)
countW=[0]*(W+1)
S=[[0]*(W+1)for _ in range(H+1)]
hw=[[0,0]for _ in range(M)]
i=0
for _ in range(M):
    h,w=map(int,input().split())
    countH[h]+=1
    countW[w]+=1
    hw[i]=[h,w]
    S[h][w]=1

hw.sort()
mh=max(countH)
mw=max(countW)
ans=mh+mw-1

c_mh=[]
i=0
while i<=H:
    if countH[i]==mh:
        c_mh.append(i)
    i+=1

c_mw=[]
i=0
while i<=W:
    if countW[i]==mw:
        c_mw.append(i)
    i+=1

ok=0
for h in c_mh:
    for w in c_mw:
        if S[h][w]==0:
            ans+=1
            ok=1
        if ok:
            break
    if ok:
        break

print(ans)
Problem p02623 (python)

Fixed submission:
from bisect import*

N,M,K=map(int,input().split())
*A,=map(int,input().split())
*B,=map(int,input().split())

sa=[0]+[0]*N
i=0
while i<N:
    sa[i+1]=sa[i]+A[i]
    i+=1

sb=[0]+[0]*M
j=0
while j<M:
    sb[j+1]=sb[j]+B[j]
    j+=1

i=bisect_right(sa,K)-1
ans=0
while 0<=i:
    j=bisect_right(sb,K-sa[i])-1
    ans=max(ans,i+j)
    i-=1

print(ans)

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

count=0
ans=0

i=0
j=0
while i<N or j<M:
    if i==N:
        count+=B[j]
        j+=1
        ans+=1
    elif j==N:
        count+=A[i]
        i+=1
        ans+=1
    elif A[i]<=B[j]:
        count+=A[i]
        i+=1
        ans+=1
    else:
        count+=B[j]
        j+=1
        ans+=1

    if count>K:
        ans-=1
        break

print(ans)
Problem p02725 (python)

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

B1=K-A[N-1]+A[0]

B=[]
i=0
while i<=N-2:
    B.append(A[i+1]-A[i])
    i=i+1
B=sorted(B)
print(K-max(B1,B[-1]))

Buggy submission (verdict: Runtime Error):
B1=K-A[N-1]+A[0]

B=[]
i=0
while i<=N-2:
    B.append(A[i+1]-A[i])
    i=i+1
B=sorted(B)
print(K-max(B1,B[-1]))
Problem p02726 (python)

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

Ans=[0]*N

i=1
d=0
while i<=N:
    j=i+1
    while j<=N:
        d=(min(j-i,abs(X-i)+1+abs(j-Y)))
        Ans[d]+=1
        j+=1
    i+=1

k=1
while k<=N-1:
    print(Ans[k])
    k+=1

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

Ans=[]

i=1
while i<=N:
    j=i+1
    while j<=N:
        Ans.append(min(j-i,abs(X-i)+1+abs(j-Y)))
        j=j+1
    i=i+1

k=1
while k<=N-1:
    print(Ans.count(k))
    k=k+1
Problem p02759 (python)

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

Buggy submission (verdict: Runtime Error):
print(math.ceil(int(input())/2))

Buggy submission (verdict: Runtime Error):
print(math.ceil(input()))
Problem p02831 (python)

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

import fractions
print(A*B//fractions.gcd(A,B))

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

import math
print(A*B//math.gcd(A,B))
Problem p02891 (python)

Fixed submission:
S=input()
K=int(input())

i=1
count1=0
while i<len(S):
    if S[i]==S[i-1]:
        count1+=1
        i+=1
    i+=1

ss=S*2
i=1
count2=0
while i<len(ss):
    if ss[i]==ss[i-1]:
        count2+=1
        i+=1
    i+=1

if 2*count1+1==count2 and len(set(S))!=1:
    print(K*count1+(K-1))
else:
    print(K*count2//2)

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

i=1
count=0
N=len(S)
while i<N:
    if S[i]==S[i-1]:
        count+=1
        if i==N-1:
            S+='A'
        i+=1
    i+=1

if S[0]==S[-1]:
    if S[0]==S[1]:
        print(count*K--(K-1)//2)
    else:
        print(count*K+(K-1))
else:
    print(count*K)
Problem p02897 (python)

Fixed submission:
N = int(input())

print(-(-N//2)/N)

Buggy submission (verdict: Runtime Error):
n=int(input());print(-(-N//2)/N)
Problem p02912 (python)

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

while M:
    A[-1]//=2
    M-=1
    i=-2
    while M and (-N<=i and A[i]>=A[-1]):
        A[i]//=2
        M-=1
        i-=1
    A.sort()

print(sum(A))

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

while M:
    A[-1]//=2
    M-=1
    i=-2
    while M and (-N<=i and A[i]>=A[-1]):
        A[i]//=2
        M-=1
        print(A)
        i-=1
    A.sort()

print(sum(A))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
*A,=map(int,input().split())
A=sorted(A)[::-1]
count=0
now=0
while M:
    i=0
    while i<=now and M:
        if count<N-1:
            while A[i]<A[count+1]:
                A[count+1]//=2
                count+=1
                M-=1
                if M==0:
                    break
        if M==0:
            break
        A[i]//=2
        i+=1
        M-=1
    now=count
        
print(sum(A))
Problem p03803 (python)

Fixed submission:
A,B=map(int,input().split())
if A==1:
    A=14
if B==1:
    B=14
print(['ABloibc e'[A<B::2],'Draw'][A==B])

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
if A=1:
    A=14
if B=1:
    B=14
print(['ABloibc e'[A<B::2],'Draw'][A==B])
Problem p02779 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A_ = {}

for a in A:
  if a not in A_:
    A_[a] = 1
  else:    
    A_[a] += 1
    break
if len(A) == len(A_):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A_ = {}

for a in A:
  if a not in A_:
    A_[a] = 1
  else:    
    A[a] += 1
    break
if len(A) == len(A_):
  print("YES")
else:
  print("NO")