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

Fixed submission:
from sys import stdin


def main():
    N = int(stdin.readline().rstrip())

    if N == 0:
        print('0')
        return

    ans = ''
    base = 2
    while N != 1:
        ans = str(abs(N % base)) + ans
        N = N // base
        N = -1 * N
    print('1' + ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from sys import stdin
stdin = open('sample.txt')


def main():
    N = int(stdin.readline().rstrip())

    if N == 0:
        print('0')
        return

    ans = ''
    base = 2
    while N != 1:
        ans = str(abs(N % base)) + ans
        N = N // base
        N = -1 * N
    print('1' + ans)


if __name__ == '__main__':
    main()
Problem p02699 (python)

Fixed submission:
S, W = input().split()

S = int(S)
W = int(W)

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

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

if S > W:
  print('safe')
else:
  print('unsafe')

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

if S>W:
  print('safe')
else:
  print('unsafe')

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

Buggy submission (verdict: Runtime Error):
if S > W:
  print('safe')
else:
  print('unsafe')
Problem p02707 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
D = [0 for i in range(N)]

for i in A:
    D[i-1] += 1

for i in range(len(D)):
    print(D[i])

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

for i in range(1,1+N):
    print(A.count(str(i)))
Problem p02693 (python)

Fixed submission:
k = int(input())
a,b = map(int,input().split())
ans = 'NG'
for i in range(a,b+1):
    if i%k == 0:
        ans = 'OK'
        break
print(ans)

Buggy submission (verdict: Runtime Error):
# k=(int)(input())
import math
a,b,n=map(int,input().split())
if(n<=b):
    print(math.floor((a*n)/b))
else:
    print(math.floor((a*b-1)/b))
Problem p02701 (python)

Fixed submission:
n = int(input())
s = [input() for i in range(n)]

print(len(list(set(s))))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [int(input()) for i in range(n)]

tango = []
count = 0
for i in s:
  if i not in tango:
    count += 1
    tango.append(i)
print(count)
Problem p02879 (python)

Fixed submission:
a, b = map(int, input().split())
 
n = -1
if (a < 10) and (b < 10):
  n = a * b
else:
  pass
print(n)

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

n = int(input())

l = []
if n == 2:
    print(1)
    sys.exit()
else:
    for i in range(2, int(math.sqrt(n) + 1)):
        if n % i == 0:
            for i in range(1, int(math.sqrt(n)) + 1):
                if n % i == 0:
                    j = n // i
                    l.append(i + j)
            print(min(l) - 2)
            sys.exit()
print(n -1)
Problem p02880 (python)

Fixed submission:
import sys
n = int(input())

for i in range(1, 10):
  for j in range(1, 10):
    if i * j == n:
      print('Yes')
      sys.exit()
print('No')

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

for i in range(1, 10):
  for j in range(1, 10):
    if i * j ==n n:
      print('Yes')
      exit()
print('No')
Problem p02989 (python)

Fixed submission:
n = int(input())
d = list(map(int, input().split()))
print(sorted(d)[n//2]-sorted(d)[n//2-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int, input().split()))
print(d[sorted(d)//2]-d[sorted(d)//2-1])
Problem p03073 (python)

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

def henkan(a):
    if a == "0":
        a = "1"
    else:
        a = "0"
    return a
    
ans = 0
a = 0
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        a = henkan(S[i+1])
        ans += 1
        S[i+1] = a
print(ans)

Buggy submission (verdict: Runtime Error):
S = [i for i in input()]

def henkan(a):
    if a == "0":
        a = "1"
    else:
        a = "0"
    return a
    
ans = 0
a = 0
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        a = henkan(S[i+1])
        ans += 1
        print("a", a)
        S[i+1] = a
        print(S)
print(ans)
Problem p02701 (python)

Fixed submission:
n = int(input())
s =[]
for i in range(n):
    s.append(input())
print(len(set(s)))

Buggy submission (verdict: Runtime Error):
n = int(input())
s =[]
for i in range(n):
  	str = input()
    if not str in s: 
    	s.append(str)
    
print(len(s))
Problem p03252 (python)

Fixed submission:
# coding:utf-8

# 解答みながらの復習

S = str(input())
T = str(input())

Sdic = [0 for _ in range(26)]
Tdic = [0 for _ in range(26)]

alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n",\
    "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]

Able = True

for i in range(len(S)):
    si = S[i]
    ti = T[i]
    if Sdic[alphabet.index(si)] == 0:
        Sdic[alphabet.index(si)] = ti
    elif Sdic[alphabet.index(si)] != ti:
        Able = False
        break
    if Tdic[alphabet.index(ti)] == 0:
        Tdic[alphabet.index(ti)] = si
    elif Tdic[alphabet.index(ti)] != si:
        Able = False
        break
        
print("Yes" if Able else "No")

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

# 解答みながらの復習

S = str(input())
T = str(input())

Sdic = [0 for _ in range(26)]
Tdic = [0 for _ in range(26)]

alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l' \
    'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

Able = True

for i in range(len(S)):
    si = S[i]
    ti = T[i]
    if Sdic[alphabet.index(si)] == 0:
        Sdic[alphabet.index(si)] = ti
    elif Sdic[alphabet.index(si)] != 0:
        if Sdic[alphabet.index(si)] == ti:
            pass
        else:
            Able = False
            break
    elif Tdic[alphabet.index(ti)] == 0:
        Tdic[alphabet.index(ti)] = si
    elif Tdic[alphabet.index(ti)] != 0:
        if Tdic[alphabet.index(ti)] == si:
            pass
        else:
            Able = False
            break

print("Yes" if Able else "No")
Problem p02676 (python)

Fixed submission:
numTest = int(input())

inputLine = input()

print(inputLine[0 : numTest] + '...' if len(inputLine) > numTest else inputLine)

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

inputLine = input()

print(inputLine[0 : numTest] + '...' if len(inputLine) > numTest else inputLine
Problem p02689 (python)

Fixed submission:
N,M=map(int,input().split())
H=list(map(int,input().split()))
flg=[1]*N


for m in range(M):
  a,b =map(int,input().split())
  if H[a-1]<H[b-1]:
    flg[a-1]=0
  elif H[a-1]>H[b-1]:
    flg[b-1]=0
  else:
    flg[a-1]=flg[b-1]=0
  
print(flg.count(1))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
H=list(map(int,input().split()))
flg=[0]*N
T=[[] for _ in range(N)]

for m in range(M):
  a,b =map(int,input().split())
  T[a-1].append(b)
  T[b-1].append(a)

for n in range(N):
  if not T[n]:
    flg[n] =1
  else:
    MAX=max([H[t-1] for t in T[n]])
  if H[n]>MAX:
    flg[n]=1

print(sum(flg))
Problem p03075 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

list=[a,b,c,d,e]
list.sort(reverse=True)

if list[0]-list[4]<=k:
  print("Yay!")
  
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

K=min(K,3000)

AB=[a+b for a in A for b in B]
AB.sort(reverse=True)

ABC=[ab+c for ab in AB[:K] for c in C]
ABC.sort(reverse=True)

for k in range(K):
	print(ABC[k])

Buggy submission (verdict: Runtime Error):
X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

K=min(K,3000)

AB=[a+b for a in A for b in B]
AB.sort(reverse=True)

ABC=[ab+c for ab in AB[:K] for c in C[:K]]
ABC.sort(reverse=True)

for k in range(K):
	print(ABC[k])
Problem p02693 (python)

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

for i in range(a, b + 1):
  if i % k == 0:
    flag = True

if flag:
  print('OK')
else:
  print('NG')

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

for i in range(a, b + 1):
  if (i % k == 0):
    falg = True

if falg:
  print('OK')
else:
  print('NG')
Problem p02723 (python)

Fixed submission:
a = input()
b = list(a)
if b[2] == b[3] and b[4] == b[5]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a = input()
b = list(a)
if b[2] == b[3] and b[4] == b[5]:
  print('Yes')
else:
  cofff
  print('No')
Problem p02707 (python)

Fixed submission:
import collections

N = int(input())

A = [int(i) for i in input().split()]

c = collections.Counter(A)

for i in range(1, N+1):
    print(c[i])

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

A = []

for i in range(N-1):
    A.append(int(input()))

B = []

for j in range(N-1):
    temp = 0
    for i in A:
        if i-2 == j:
            temp += 1
    B.append(temp)        
for j in range(N-1):
    print(B[j])

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

A = []

for i in range(N-1):
    A.append(int(input()))

B = []

for j in range(N-1):
    temp = 0
    for i in A:
        if i-2 == j:
            temp += 1
    B.append(temp)        
for j in range(N-1):
    print(B[j])

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

A = []

for i in range(N-1):
    A.append(int(input()))

B = []

for j in range(N-1):
    temp = 0
    for i in A:
        if i-2 == j:
            temp += 1
    B.append(temp)        
for j in range(N-1):
    print(B[j])
Problem p02831 (python)

Fixed submission:
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
import math

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
import math

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(A, B))
Problem p02835 (python)

Fixed submission:
A1, A2, A3 = map(int, input().split())
s = A1 + A2 + A3

if s >= 22:
    print('bust')
else:
    print('win')

Buggy submission (verdict: Runtime Error):
A1, A2, A3 = map(int, input().split())
s = A1 + A2 + A3

if s >= 22:
    print(bust)
else:
    print(win)
Problem p02693 (python)

Fixed submission:
def main():
  K=int(input())
  A,B=map(int, input().split())
  for i in range(A,B+1):
    sTgt=i
    if(i%K==0):
      print('OK')
      break
    elif(i==B):
      print('NG')
  
if __name__=='__main__':
  main()

Buggy submission (verdict: Runtime Error):
import math
from sys import stdin
input = stdin.readline
def main():
  A,B,N=map(int,input().split())
  sMax=0
  sCount=0
  sTgt_past=0
  if(N//B>=1):
    print(A-1)
  else:
    for i in range(1,B):
      sTgt=(A*i//B)-A*(i//B)
      if(i==1):
        sMax=sTgt
      else:
        sMax=max(sMax,sTgt)
      sTgt_past=sMax
    print(int(sMax))
  
if __name__=='__main__':
  main()
Problem p02711 (python)

Fixed submission:
n = int(input())
for i in range(3):
  n_i=n//10**(2-i)
  if(n_i==7):
    print('Yes')
    break
  if(i==2):
    print('No')
  n=n-n_i*10**(2-i)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
sum=0
for k in range(n):
  for j in range(k):
    for i in range(j):
      if(((j-i)!=(k-j))&(s[i]!=s[j])&(s[j]!=s[k])&(s[k]!=s[i])):

        sum=sum+1
          
print(sum)
Problem p02729 (python)

Fixed submission:
N,M = map(int,input().split())
if((N<=1)&(M<=1)):
  num=0
else:
  num=int(N*(N-1)/2)+int(M*(M-1)/2)
print(num)

Buggy submission (verdict: Runtime Error):
L=int(input())
max_vol=L**3/27

print(max_vol)

Buggy submission (verdict: Runtime Error):
L=int(input())
max_vol=0
for i in range(1,L):
  for j in range(1,L-i):
    k=L-i-j
    vol=i*j*k
    max_vol=max(max_vol,vol)
print(max_vol)
Problem p02753 (python)

Fixed submission:
S=input()
Sset=set(S)
if(len(Sset)==2):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import math
A,B=map(int, input().split())
flag=False
for i in range(1250):
  A_X=math.floor(i*0.08)
  if(A_X==A):
    B_X=math.floor(i*0.10)
    if(B_X==B):
      print(i)
      flag=True
      break
if(flag==False):
  print(-1)

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

s=N//(A+B)
NA=N%(A+B)
if(A!=0):
  if(NA<A):
    sA=0
    sAG=NA
  else:
    sA=1
    sAG=0
else:
  sA=0
  sAG=0
print(s*A+sA*A+sAG)

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

s=N//(A+B)
NA=N-s*(A+B)
if(A!=0):
  if(NA//A>=1):
    sA=1
  else:
    sA=NA
else:
  sA=0
print(s*A+sA*A)

Buggy submission (verdict: Runtime Error):
S=input()
if(len(Sset)==2):
  print('Yes')
else:
  print('No')
Problem p02754 (python)

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

s=N//(A+B)
NA=N%(A+B)
if(A!=0):
  if(NA<A):
    sA=0
    sAG=NA
  else:
    sA=1
    sAG=0
else:
  sA=0
  sAG=0
print(s*A+sA*A+sAG)

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

s=N//(A+B)
NA=N%(A+B)
if(A!=0):
  if(NA<A):
    sA=0
    sAG=NA
  else:
    sA=1
    sAG=0
else:
  sA=0
print(s*A+sA*A+sAG)
Problem p02777 (python)

Fixed submission:
S,T=input().split()
a,b=map(int,input().split())
U=input()
if(S==U):
  a=a-1
else:
  b=b-1
print(a,b)

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

if len(set(A)) == N:
    print('YES')
else:
    print('NO')
Problem p02711 (python)

Fixed submission:
N = input()
match_flg = 0
for nn in N:
  if( nn== "7" ):
    print( "Yes" )
    match_flg = 1
    break
if( match_flg == 0 ):
	print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
match_flg = 0
for nn in N:
  if( nn== "7" ):
    print( "Yes" )
    match_flg = 1
    break
if( match_flg == 0 ):
	print("No")

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

match_flg = 0
for nn in N:
  if( nn== "7" ):
    print( Yes )
    match_flg = 1
    break
if( match_flg == 0 ):
	print("No")

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

match_flg = 0
for nn in N:
  if( n== "7" ):
    print( Yes )
    match_flg = 1
    break
if( match_flg == 0 ):
	print("No")
Problem p02753 (python)

Fixed submission:
bus = input()
if not( 'A' in bus):
  print( 'No')
elif not( 'B' in bus):
  print( 'No' )
else:
  print( 'Yes' )

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

fflag = 0
for i in range(q):
  qi = input()
  if( qi == "1"):
    fflag += 1 
  else:
    if( fflag%2 == 0 ):
      if( qi[2] == "2" ):
        a += qi[4]
      else:
        a = qi[4] + a
    else:
      if( qi[2] == "2" ):
        a = qi[4] + a
      else:
        a += qi[4]      
    
if( fflag%2==0 ):
  print( a )
else:
  print( a[::-1] )

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

fflag = 1
for i in range(q):
  qi = input()
  if( qi == "1"):
    fflag *= -1 
  else:
    if( fflag == 1 ):
      if( qi[2] == "2" ):
        a += qi[4]
      else:
        a = qi[4] + a
    else:
      if( qi[2] == "2" ):
        a = qi[4] + a
      else:
        a += qi[4]      
    
if( fflag == 1 ):
  print( a )
else:
  print( a[::-1] )

Buggy submission (verdict: Runtime Error):
bus = input()

if not 'A' in bus:
  print( 'Yes' )
if not 'B' in bus:
  print( 'Yes' )
else
  print( 'No' )
Problem p02688 (python)

Fixed submission:
N,K=map(int,input().split())
B=[]
for i in range(K):
  D=int(input())
  A=list(map(int,input().split()))
  for j in A:
    B.append(j)
print(N-len(set(B)))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
m=[]
for i in range(n):
  d=int(input())
  a=list(map(int,input().split()))
  for i in a:
    m=m.append(i)
j=set(m)
print(n-len(j))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input())
B=[]
for i in range(K):
  D=int(input())
  A=list(map(int,input().split()))
  for j in A:
    B.append(j)
print(N-len(set(B)))
Problem p02699 (python)

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

Buggy submission (verdict: Runtime Error):
N=int(input())
L=[input() for i in range(N)]
M=set(L)
print(len(M))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
while a or c >0:
  c=c-b
  if c<=0:
    print('Yes')
    break
  a=a-d
  if a<=0:
    print('No')
    break

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
e=a//d
f=c//b
x=a-e*d
y=c-f*b
if x==y==0:
  if f<=e:
    print('Yes')
  else:
    print('N0')
elif x==0 and y!=0:
  if f+1<=e:
    print('Yes')
  else:
    print('No')
elif y==0 and x!=0:
  if f<=e+1:
    print('Yes')
  else:
    print('NO')
else:
  if f<=e:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
e=a//d
f=c//b
x=a-e*d
y=c-f*b
if x==y==0:
  if f<=e:
    print('Yes')
  else:
    print('N0')
elif x==0 and y!=0:
  if f+1<=e:
    print('YES')
  else:
    print('No')
elif y==0 and x!=0:
  if f<=e+1:
    print('Yes')
  else:
    print('NO')
else:
  if f<=e:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
e=a//d
f=c//b
x=a-e*d
y=c-f*b
if x==y==0:
  if f<=e:
    print('Yes')
  else:
    print('N0')
if x==0:
  if f+1<=e:
    print('YES')
  else:
    print('No')
if y==0:
  if f<=e+1:
    print('Yes')
  else:
    print('NO')
else:
  if f<=e:
    print('Yes')
  else:
    print('No')
Problem p02701 (python)

Fixed submission:
N=int(input())
S=[input() for i in range (N)]
L=list(S)
M=list(set(L))
j=len(M)
print(j)

Buggy submission (verdict: Runtime Error):
N=int(input())
L=[input() for i in range(n)]
M=set(L)
print(len(M))

Buggy submission (verdict: Runtime Error):
N=int(input())
L=[input() for i range(N)]
M=sorted(L)
print(len(M))
Problem p02711 (python)

Fixed submission:
N=input()
if '7' in N:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N=int(input())
a=n//3
b=n//5
c=n//15
A=3*a*(a+1)//2+5*b*(b+1)//2-15*c*(c+1)//2
print(n*(n+1)//2-A)

Buggy submission (verdict: Runtime Error):
N=input()
if '7' in  N
print('Yes')
if not '7' in N
print('No')

Buggy submission (verdict: Runtime Error):
 N=input()
if 7 in N
print('Yes')
if not 7 in N
print('No')

Buggy submission (verdict: Runtime Error):
if 7 in N
print('Yes')
if not 7 in N
print('No')
Problem p02771 (python)

Fixed submission:
a,b,c=map(int,input().split())
l=[a,b,c]
l.sort()
if l[0]==l[1] and l[1]!=l[2]:
  print('Yes')
elif l[0]!=l[1] and l[1]==l[2]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
l=[a,b,c]
sorted(l)
if len(l)==2:
  print('Yes')
elif:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c=mpp(int,input().split())
l=[a,b,c]
sorted(l)
if len(l)==2:
  print('Yes')
elif:
  print('No')
Problem p03250 (python)

Fixed submission:
a,b,c=map(int,input().split())
L=[a,b,c]
L.sort()
print(L[2]*10+L[1]+L[0])

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
L[a,b,c]
L.sort()
print(L[2]*10+L[1]+L[0])
Problem p03307 (python)

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

Buggy submission (verdict: Runtime Error):
N=int(input())
for i in range(1,2N):
  if i%2==0 and i%N==0:
    print(i)
    break
Problem p02773 (python)

Fixed submission:
def main():
  n = int(input())
  dict = {}
  for i in range(n):
    s = input()
    dict.setdefault(s, 0)
    dict[s] += 1
  max_val = 0
  ans_ls = []
  for kv in dict.items():
    if kv[1] > max_val:
      max_val = kv[1]
      ans_ls = [kv[0]]    
    elif kv[1] == max_val:
      ans_ls.append(kv[0])
  ans_ls = sorted(ans_ls)
  for name in ans_ls:
    print(name)
 
 
if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def main():
  n = int(input())
  ls = []
  ls_count = []
  for i in range(n):
    item = input()
	if not item in ls:
      ls.append('item')
      ls_count.append(1)
    else:
      ls_count[ls.index(item)] += 1
  max_count = max(ls_count)
  max_index = [i for i, n in enumerate(ls_count) if n == max_count]
  ans = []
  for idx in max_index:
    ans.append(ls[idx])
  ans = sorted(ans)
  for itm in ans:
    print(itm)
  

if __name__ == '__main__':
  main()
Problem p03291 (python)

Fixed submission:
s = input()
dp = [0 for _ in range(0,4)]
dp[3] = 1
dp[0] = 0
dp[1] = 0
dp[2] = 0
abc = "ABC".index
mod = 10**9 + 7
for i in range(len(s)-1,-1,-1):
    if s[i] == "?":
        dp = [
        (dp[0]*3+ dp[1])%mod
        ,(dp[1]*3+ dp[2])%mod
        ,(dp[2]*3 + dp[3])%mod
        ,(dp[3]*3)%mod
        ]
    else:
        num = abc(s[i])
        dp[num] += dp[num+1] % mod
print(dp[0] %mod)

Buggy submission (verdict: Runtime Error):
s = input()
dp = [0 for _ in range(0,4)]
dp[3] = 1
dp[0] = 0
dp[1] = 0
dp[2] = 0
abc = "ABC".index
mod = 10**9 + 7
for i in range(len(s)-1,-1,-1):
    if s[i] == "?":
        dp = [
        (dp[0]*3+ dp[1])%mod
        ,(dp[1]*3+ dp[2])%mod
        ,(dp[2]*3 + dp[3])%mod
        ,(dp[3]*3)%mod
        ]
    else:
        num = abc(s[i])
        dp[i][num] += dp[i+1][num+1] % mod
# for i in range(len(s),-1,-1):
#     print(dp[i])
print(dp[0][0] %mod)
Problem p02754 (python)

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

#moji="b"*A+"r"*B
#print(moji)

if A==B==0:
    print(0)
elif A==0:
    print(0)
else:

    if N==(A+B):
        print(A)
    elif N>A+B:
        if N%(A+B)>A:
            print((N//(A+B))*A+A)
        else:
            print((N//(A+B))*A+N%(A+B))
    else:
        if N<A:
            print(N)
        else:
            print(A)

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

moji="b"*A+"r"*B
#print(moji)

if A==B==0:
    print(0)
elif A==0:
    print(0)
else:

    if N==A+B:
        print(A)
    elif N>A+B:
        if N%(A+B)>A:
            print((N//(A+B))*A+A)
        else:
            print((N//(A+B))*A+N%(A+B))
    else:
        print(A)

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

moji="b"*A+"r"*B
#print(moji)

if N==A+B:
    print(A)
elif N>A+B:
    if N%(A+B)>A:
        print((N//(A+B))*A+A)
    else:
        print((N//(A+B))*A+N%(A+B))
else:
    print(A)
Problem p02831 (python)

Fixed submission:
import fractions
a,b=map(int, input().split())
f=fractions.gcd(a,b)
f2=a*b//f
print(f2)

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



def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))
Problem p02688 (python)

Fixed submission:
N,K = map(int, input().split())
A=[]
for i in range(K):
    d = int(input())
    a=list(map(int, input().split()))
    for i in range(d):
        A.append(a[i])

ans = len(list(set(A)))
print(N-ans)

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

 
ans = len(list(set(A)))
print(N-ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
for i in range(K):
    d = int(input())
    for i in range(d):
        a = int(input())
        A.append(a) 
ans = len(list(set(A)))
print(N-ans)