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

Fixed submission:
import bisect
N = int(input())
top = list(map(int,input().split()))
middle = list(map(int,input().split()))	
bottom = list(map(int,input().split()))	

top.sort()
middle.sort()
bottom.sort()

ans = 0
for i in middle:
  can_put_upstair = bisect.bisect_left(top,i)
  can_put_downstair = N - bisect.bisect_right(bottom,i)
  #print(can_put_upstair,can_put_downstair)
  ans += can_put_upstair*can_put_downstair

print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
top = list(map(int,input().split()))
middle = list(map(int,input().split()))	
bottom = list(map(int,input().split()))	

top.sort()
middle.sort()
bottom.sort()

ans = 0
for i in middle:
  can_put_upstair = bisect.bisect_left(top,i)
  can_put_donwstair = N - bisect.bisect_right(bottom,i)
  ans += can_put_upstair*can_put_downstair

print(ans)
Problem p03752 (python)

Fixed submission:
def LI(): return list(map(int,input().split()))
N,K = LI()
a = LI()
ans = float('INF')
for i in range(2**(N-1)):
    bit = [i>>j&1 for j in range(N-1)]
    if K-1!=sum(bit):
        continue
    #print("bit",bit)
    cost,kijun = 0,a[0]
    for k in range(N-1):
        if bit[k]==0:
            kijun = max(kijun,a[k+1])
            continue
        if a[k+1]>=kijun+1:
            kijun = a[k+1]
            continue
        cost += (kijun+1)-a[k+1]
        kijun += 1
    ans = min(ans,cost)
print(ans)

Buggy submission (verdict: Runtime Error):
import copy
N,K = map(int,input().split())
A_list = list(map(int,input().split()))	
###########
can_see = [0]
max_building = A_list[0]
for i in range(0,N-1):
  
  if max_building < A_list[i+1]:
    can_see.append(i+1)
    max_building = A_list[i+1]

#print("can_see",can_see)
need_to_build = K-len(can_see)
#print("NTB",need_to_build)

#1つ目のタワーは足すことがないので抜かしてビット全探索。
#need_to_buildと同じフラグが立ったものだけ、Ｂｕｉｌｄして値段を検索
min_money = 100000000000000000
samebuilding_flag = False
for i in range(2**(N-1)):
  #print("roop start")
  bit_box = [0] * (N-1)
  for j in range(N-1):
    if (i>>j)&1:
      bit_box[N-1-1-j] = 1
      if N-1-j in can_see:
        #print("flag apeeard")
        samebuilding_flag = True
        
  #print(bit_box)
  if bit_box.count(1) != need_to_build:
    #print("not match")
    #print(bit_box)
    pass
    
  elif samebuilding_flag == True:
    samebuilding_flag = False
    pass
  
  else:
    #試すものがここに残る。
    #print("try parameters")
    #print(bit_box)
    building_list = copy.deepcopy(A_list)
    use_money = 0
    
    bit_box_start = bit_box.index(1)
   #print("BBS",bit_box_start)
    for _ in range(0,len(can_see))[::-1]:
      if can_see[_] < bit_box_start+1:
        highest_building = building_list[can_see[_]]
        break
    
    
    
    for k in range(0,N-1):
      if bit_box[k] == 1:
        #print("build start building No.",k+2)
        
        if highest_building >= building_list[k+1]:
          #print("make higher")
          use_money += (highest_building-building_list[k+1]+1)
          #print("use_money",use_money)
          #print(f"change {building_list[k+1]} to {highest_building+1} ")
          building_list[k+1] = highest_building+1
          highest_building = building_list[k+1]
          #print("building now",building_list)
        else:
          #print("stay")
          #print("building now",building_list)
          pass
          
    #print("use_money",use_money)
    min_money = min(min_money,use_money)
    #print("result",min_money)
    del building_list
    
print(min_money)
Problem p03854 (python)

Fixed submission:
import re
s = input()

if re.match("(dreamer|dream|eraser|erase)+$",s):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
import re
s = imput()

if re.match("(dreamer|dream|eraser|erase)+dreamer",s):
  print("YES")
else:
  print("NO")
Problem p02921 (python)

Fixed submission:
S = input()
T = input()
c = 0
for s,t in zip(S,T):
  if s == t: c+=1
print(c)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
c = 0
for s,t in zip(S,T):
  if s = t: c+=1
print(c)
Problem p02927 (python)

Fixed submission:
M, D = map(int, input().split())
c=0
for m in range(1,M+1):
  for d in range(1,D+1):
    d1 = d%10
    d10 = d//10
    if d1>1 and d10>1 and d1*d10==m:
      c+=1
print(c)

Buggy submission (verdict: Runtime Error):
M, D = map(int, input().split())
c=0
for m in range(1,M+1):
  for d in range(1,D+1):
    d1 = d%10
    d10 = d//10
    if d1>1 and d10>1 and d1*d2==m:
      c+=1
print(c)

Buggy submission (verdict: Runtime Error):
M, D = map(int, input().split())
c=0
for m in range(1,M+1):
  for d in range(1,D+1):
    d1 = d%10
    d10 = d//10
    if d1>1 and d10>1 and d1*d2=m: c+=1
print(c)
Problem p02585 (python)

Fixed submission:
import sys
import copy
input = sys.stdin.readline


N,K=map(int,input().split())
P=list(map(int,input().split()))
C=list(map(int,input().split()))

ans=-1*(10**10)

if K<10000000:
    for i in range(N):
        tmp=0
        pos=i
        count=0
        while count<K:    
            #print(pos,P[pos])
            tmp+=C[P[pos]-1]
            if tmp>ans:
                ans=tmp
            
            pos=P[pos]-1
            count+=1
     
    print(ans)
else:
    
    for i in range(N):
        tmp=0
        pos=i
        gpos=i
        count=0
        while count<K:    
            #print(pos,P[pos])
            tmp+=C[P[pos]-1]
            if tmp>ans:
                ans=tmp
            
            
            pos=P[pos]-1
            count+=1
            if pos==gpos:
                divide=K//count-1
                tmp=tmp*divide
                count=count*divide
                gpos=10**10
            
    
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import copy
input = sys.stdin.readline


N,K=map(int,input().split())
P=list(map(int,input().split()))
C=list(map(int,input().split()))

ans=-1*(10**10)

if K<100000:
    for i in range(N):
    tmp=0
    pos=i
    count=0
    while count<K:    
        #print(pos,P[pos])
        tmp+=C[P[pos]-1]
        if tmp>ans:
            ans=tmp
        
        pos=P[pos]-1
        count+=1
 
    print(ans)
else:
    
    for i in range(N):
        tmp=0
        pos=i
        gpos=i
        count=0
        while count<K:    
            #print(pos,P[pos])
            tmp+=C[P[pos]-1]
            if tmp>ans:
                ans=tmp
            
            
            pos=P[pos]-1
            count+=1
            if pos==gpos and count!=K:
                divide=K//count
                tmp=tmp*divide
                count=count*divide
                gpos=10**10
            
    
    print(ans)
Problem p02675 (python)

Fixed submission:
# coding: utf-8
# Your code here!

S=int(input())%10
S=S%10

if S==3:
    print("bon")
elif S==0 or S==1 or S==6 or S==8:
    print("pon")
else:
    print("hon")

Buggy submission (verdict: Runtime Error):
S=input()
if int(S[2])==3:
    print("bon")
elif int(S[2])==0 or int(S[2])==1 or int(S[2])==6 or int(S[2])==8:
    print("pon")
else:
    print("hon")

Buggy submission (verdict: Runtime Error):
S=input()
if int(S[2])==3:
    print("bon")
elif int(S[2])==0 or int(S[2])==1 or int(S[2])==6 or int(S[2])==8:
    print("pon")
else:
    print("hon")
Problem p02801 (python)

Fixed submission:
print(chr(ord(input()) + 1))

Buggy submission (verdict: Runtime Error):
print chr(ord('a') + 1)
Problem p02995 (python)

Fixed submission:
import fractions

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


kobaisu=C//fractions.gcd(C,D)*D


ans=B -(B//C+B//D-B//kobaisu)

ans2=(A-1)-((A-1)//C +(A-1)//D - (A-1)//kobaisu)

print(int(ans-ans2))

Buggy submission (verdict: Runtime Error):
import math

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


kobaisu=C//math.gcd(C,D)*D


ans=B -(B//C+B//D-B//kobaisu)

ans2=(A-1)-((A-1)//C +(A-1)//D - (A-1)//kobaisu)

print(int(ans-ans2))

Buggy submission (verdict: Runtime Error):
import math

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

#最小公倍数a * b / gcd(a, b)
kobaisu=C//math.gcd(C,D)*D


ans=B -(B//C+B//D-B//kobaisu)

ans2=(A-1)-((A-1)//C +(A-1)//D - (A-1)//kobaisu)

print(int(ans-ans2))

Buggy submission (verdict: Runtime Error):
import math

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

#最小公倍数a * b / gcd(a, b)
kobaisu=C/math.gcd(C,D)*D



ans=B -(B//C+B//D-B//kobaisu)

ans2=(A-1)-((A-1)//C +(A-1)//D - (A-1)//kobaisu)

print(int(ans-ans2))
Problem p03161 (python)

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

L=list(map(int,input().split()))
S=[0]*110000
for i in range(N):
    S[i]=L[i]

DP=[10**12]*110000

DP[0]=0
for i in range(N):
    for j in range(1,M+1):
        if DP[i+j]>DP[i]+abs(S[i+j]-S[i]):
            DP[i+j]=DP[i]+abs(S[i+j]-S[i])



print(DP[N-1])

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

L=list(map(int,input().split()))
S=[0]*100010
for i in range(N):
    S[i]=L[i]

DP=[10**12]*100010

DP[0]=0
for i in range(N):
    for j in range(1,M+1):
        if DP[i+j]>DP[i]+abs(S[i+j]-S[i]):
            DP[i+j]=DP[i]+abs(S[i+j]-S[i])



print(DP[N-1])
Problem p03309 (python)

Fixed submission:
# coding: utf-8
# Your code here!
import statistics

N=int(input())
S=list(map(int,input().split()))

S1=[]
for i in range(N):
    S1.append(S[i]-i)
S1.sort()
chuouchi=statistics.median_high(S1)
chuouchi2=statistics.median_low(S1)
chuouchi3=statistics.median(S1)
ans=10**20
ansj=0
A=chuouchi-4
B=chuouchi+4
C=chuouchi2-4
D=chuouchi2+4
E=int(chuouchi3)-4
F=int(chuouchi3)+4
for i in range(A,B):
    goukei=0
    for j in range(N):
        goukei+=abs(S[j]-(i+j+1))
        
    if ans>goukei:
        ans=goukei
        
for i in range(C,D):
    goukei=0
    for j in range(N):
        goukei+=abs(S[j]-(i+j+1))
        
    if ans>goukei:
        ans=goukei

for i in range(E,F):
    goukei=0
    for j in range(N):
        goukei+=abs(S[j]-(i+j+1))
        
    if ans>goukei:
        ans=goukei        
        
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import statistics

N=int(input())
S=list(map(int,input().split()))

S1=[]
for i in range(N):
    S1.append(S[i])
S1.sort()
chuouchi=statistics.median_high(S)
chuouchi2=statistics.median_low(S)
chuouchi3=statistics.median(S)
ans=10**20
ansj=0
A=chuouchi-N//2-4
B=chuouchi-N//2+4
C=chuouchi2-N//2-4
D=chuouchi2-N//2+4
E=chuouchi3-N//2-4
F=chuouchi3-N//2+4
for i in range(A,B):
    goukei=0
    for j in range(N):
        goukei+=abs(S[j]-(i+j+1))
        
    if ans>goukei:
        ans=goukei
        
for i in range(C,D):
    goukei=0
    for j in range(N):
        goukei+=abs(S[j]-(i+j+1))
        
    if ans>goukei:
        ans=goukei

for i in range(E,F):
    goukei=0
    for j in range(N):
        goukei+=abs(S[j]-(i+j+1))
        
    if ans>goukei:
        ans=goukei        
        
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
N=int(input())
S=list(map(int,input().split()))

S1=[]
for i in range(N):
    S1.append(S[i])
S1.sort()
chuouchi=S1[len(S1)//2]
chuouchi2=S1[len(S1)//2+1]
ans=10**15
ansj=0
for i in range(chuouchi-N//2-5,chuouchi-N//2+5):
    goukei=0
    for j in range(N):
        goukei+=abs(S[j]-(i+j+1))
        ansj=j
    if ans>goukei:
        ans=goukei
        
for i in range(chuouchi2-N//2-5,chuouchi2-N//2+5):
    goukei=0
    for j in range(N):
        goukei+=abs(S[j]-(i+j+1))
        ansj=j
    if ans>goukei:
        ans=goukei
        
        
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
N=int(input())
S=list(map(int,input().split()))

S1=[]
for i in range(N):
    S1.append(S[i])
S1.sort()
chuouchi=S1[len(S1)//2]
chuouchi2=S1[len(S1)//2+1]
ans=10**15
ansj=0
for i in range(chuouchi-N//2-10,chuouchi-N//2+10):
    goukei=0
    for j in range(N):
        goukei+=abs(S[j]-(i+j+1))
        ansj=j
    if ans>goukei:
        ans=goukei
        
for i in range(chuouchi2-N//2-10,chuouchi2-N//2+10):
    goukei=0
    for j in range(N):
        goukei+=abs(S[j]-(i+j+1))
        ansj=j
    if ans>goukei:
        ans=goukei
        
        
print(ans)
Problem p03624 (python)

Fixed submission:
S=input()

if "a" not in S:
    print("a")
elif "b"  not in S:
    print("b")
elif "c"  not in S:
    print("c")
elif "d"  not in S:
    print("d")
elif "e"  not in S:
    print("e")
elif "f"  not in S:
    print("f")
elif "g"  not in S:
    print("g")
elif "h"  not in S:
    print("h")
elif "i"  not in S:
    print("i")
elif "j"  not in S:
    print("j")
elif "k"  not in S:
    print("k")
elif "l"  not in S:
    print("l")
elif "m"  not in S:
    print("m")
elif "n"  not in S:
    print("n")
elif "o"  not in S:
    print("o")
elif "p"  not in S:
    print("p")
elif "q"  not in S:
    print("q")
elif "r"  not in S:
    print("r")
elif "s"  not in S:
    print("s")
elif "t"  not in S:
    print("t")
elif "u"  not in S:
    print("u")
elif "v"  not in S:
    print("v")
elif "w"  not in S:
    print("w")
elif "x"  not in S:
    print("x")
elif "y"  not in S:
    print("y")
elif "z"  not in S:
    print("z")
else:
    print("None")

Buggy submission (verdict: Runtime Error):
mojiretsu=input()
kakunin="abcdefghijklmnopqrstuvwxyz"
nagasa=len(mojiretsu)
bunkai=[]
for i in range(nagasa): 
    bunkai.append(mojiretsu[i:i+1])
bunkai1=list(set(bunkai))
bunkai1.sort()
ans="None"
NGFlug=False
j=0

for k in range(len(bunkai)):
    if bunkai1[k]!=kakunin[k:k+1]:
        ans=kakunin[k:k+1]
        NGFlug=True
        break

    j+=1

if NGFlug==True:
    
    print(ans)
elif j<27:
    print(kakunin[j:j+1])
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
mojiretsu=input()
kakunin="abcdefghijklmnopqrstuvwxyz"
nagasa=len(mojiretsu)
bunkai=[]
for i in range(nagasa): 
    bunkai.append(mojiretsu[i:i+1])
bunkai1=list(set(bunkai))
bunkai1.sort()
ans="None"
NGFlug=False
j=1

for k in range(len(bunkai)):
    if bunkai1[k]!=kakunin[k:k+1]:
        ans=kakunin[k:k+1]
        NGFlug=True
        break

    j+=1

if NGFlug==True:
    
    print(ans)
elif j<27:
    print(kakunin[j:j+1])
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
mojiretsu=input()
kakunin="abcdefghijklmnopqrstuvwxyz"
nagasa=len(mojiretsu)
bunkai=[]
for i in range(nagasa): 
    bunkai.append(mojiretsu[i:i+1])
bunkai1=list(set(bunkai))
bunkai1.sort()
ans="None"


for k in range(len(bunkai)):
    if bunkai1[k]!=kakunin[k:k+1]:
        ans=kakunin[k:k+1]
        
        break
    
print(ans)
Problem p03633 (python)

Fixed submission:
import fractions

N=int(input())
S=[]
for i in range(N):
    S.append(int(input()))


def koubaisu(a,b):
    return a*b//fractions.gcd(a,b)

ans=1

if N==1:
    print(S[0])
    exit()
elif N==2:
    ans=koubaisu(S[0],S[1])
    print(ans)
    exit()
elif N>2:
    ans=koubaisu(S[0],S[1])
    for i in range(N-2):
        ans=koubaisu(ans,S[i+2])

print(ans)

Buggy submission (verdict: Runtime Error):
import fractions

N=int(input())
S=[]
for i in range(N):
    S.append(int(input()))


def koubaisu(a,b):
    return a*b//fractions.gcd(a,b)
ans=koubaisu(S[0],S[1])

if N>2:
    for i in range(N-2):
        ans=koubaisu(ans,S[i+2])
else:
    pass
print(ans)
Problem p03637 (python)

Fixed submission:
N=int(input())

S=list(map(int,input().split()))

div1=0
div2=0
div4=0
lenS=len(S)

for i in range(N):
    if S[i]%4==0:
        div4+=1
    elif S[i]%2==0:
        div2+=1
    else:
        div1+=1

if lenS%2==0:

    if div4*2+div2>=lenS:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
else:
    
    if (div4*2+1)>=lenS:
        print("Yes")
        exit()
    elif div4*2+div2>=lenS:
        print("Yes")
        exit()
    else:
        print("No")
        exit()

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

S=list(map(int,input().split()))

div1=0
div2=0
div4=0
lenS=len(S)

for i in range(N):
    if S[i]%4==0:
        div4+=1
    elif S[i]%2==0:
        div2+=1
    else:
        div1+=1

if lenS%2==0:

    if div4*2+div2>=lenS:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
else:
    
    if (div4*2+1)>=lenS:
        print("Yes")
        exit()
    elif div4*2+div2>=lens:
        print("Yes")
        exit()
    else:
        print("No")
Problem p02639 (python)

Fixed submission:
from sys import stdin, stdout
import sys
import bisect
INF=1e9
def get_int(): return int(stdin.readline().strip())
def get_ints(): return map(int,stdin.readline().strip().split()) 
def get_array(): return list(map(int,stdin.readline().strip().split()))
def get_string(): return stdin.readline().strip()
def op(c): return stdout.write(c)
#from collections import defaultdict 
#for _ in range(int(stdin.readline())):
x=get_array()
for i in range(len(x)):
    if x[i]==0:
        print(i+1)

Buggy submission (verdict: Runtime Error):
from sys import stdin, stdout
import sys
import bisect
INF=1e9
def get_int(): return int(stdin.readline().strip())
def get_ints(): return map(int,stdin.readline().strip().split()) 
def get_array(): return list(map(int,stdin.readline().strip().split()))
def get_string(): return stdin.readline().strip()
def op(c): return stdout.write(c)
#from collections import defaultdict 
#for _ in range(int(stdin.readline())):
x=get_array()
for i in range(len(x):
    if x[i]==0:
        print(i+1)

Buggy submission (verdict: Runtime Error):
from sys import stdin, stdout
import sys
import bisect
INF=1e9
def get_int(): return int(stdin.readline().strip())
def get_ints(): return map(int,stdin.readline().strip().split()) 
def get_array(): return list(map(int,stdin.readline().strip().split()))
def get_string(): return stdin.readline().strip()
def op(c): return stdout.write(c)
#from collections import defaultdict 
#for _ in range(int(stdin.readline())):
x=get_array()
for i in range(x):
    if x[i]==0:
        print(i+1)
Problem p02818 (python)

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

if A+B<=K:
  print('0 0')
elif A<=K:
  print('0 {}'.format(B-K+A))
else:
  print('{} {}'.format(A-K,B))

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

if A+B<=K:
  print('0 0')
elif A<=K:
  print('0 {}'.format(B-K+A))
else:
  print('{} {}'.format(A-X,B))

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

if A+B<K:
  print('0 0')
elif A<K:
  print('0 {}'.format(B-K+A))
else:
  print('{} {}'.format(A-X,B))
Problem p03035 (python)

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


if a<=5:
    fee = 0
elif a>=13:
    fee = b
else:
    fee = b//2

print(fee)

Buggy submission (verdict: Runtime Error):
def main():    
    n,m = map(int,input().split())

    a_list = list(map(int,input().split()))
    total = 0

    for i in range(m):
        b,c = map(int,input().split())
        a_list.extend([c]*b)

    a_list.sort(reverse=True)
    print(sum(a_list[:n]))

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

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

for x in range(0, X+1):
    if 2 * x + 4 * (X-x) == Y:
        print('Yes')
        sys.exit()
print('No')

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

for x in range(0, X+1):
    if 2 * x + 4 * (X-x) == Y:
        print('Yes')
        sys.exit()
print('No'
Problem p02741 (python)

Fixed submission:
arr=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

K=input()
K=int(K)
print(arr[K-1])

Buggy submission (verdict: Runtime Error):
arr=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

K=input()
print(arr[int(K)])
Problem p03200 (python)

Fixed submission:
s = list(input())
Ans = 0
W_put_place = 0
for i in range(len(s)):
    if s[i] == 'W':
        Ans += i - W_put_place
        W_put_place += 1
print(Ans)

Buggy submission (verdict: Runtime Error):
import collections
s = list(input())
Ans = 0
c = collections.Counter(s)
d = c['B']
for i in range(len(s)):
    if s[i] == 'B':
        for j in range(len(s)-i-1):
            if s[i+j+1]=='W':
                Ans += j+1
                s[i] = 'W'
                s[i+1] = 'B'
                s[i+j+1] = 'B'
                break
    if i = d:
        break
print(Ans)
Problem p03578 (python)

Fixed submission:
import sys

n = int(input())
dn = list(map(int, input().split()))
m = int(input())
tn = list(map(int, input().split()))

num_dict = {}

for i in range(n):
    if str(dn[i]) in num_dict.keys():
        num_dict[str(dn[i])] += 1
    else:
        num_dict[str(dn[i])] = 1

for i in range(m):
    if str(tn[i]) in num_dict.keys():
        num_dict[str(tn[i])] += -1
    else:
        print("NO")
        sys.exit()

result_list = list(num_dict.values())
for i in range(len(result_list)):
    if result_list[i] < 0:
        print("NO")
        sys.exit()
print("YES")

Buggy submission (verdict: Runtime Error):
import sys

n = int(input())
dn = list(map(int, input().split()))
m = int(input())
tn = list(map(int, input().split()))

d_num = [0 for i in range(200001)]
t_num = [0 for i in range(200001)]

for i in range(len(dn)):
    d_num[dn[i]] += 1

for i in range(len(tn)):
    t_num[tn[i]] += 1
    
for i in range(len(t_num)):
    if d_num[i] < t_num[i]:
        print("NO")
        sys.exit()
print("YES")

Buggy submission (verdict: Runtime Error):
import sys

n = int(input())
dn = list(map(int, input().split()))
m = int(input())
tn = list(map(int, input().split()))

d_num = [0 for i in range(200001)]
t_num = [0 for i in range(200001)]

for i in range(len(dn)):
    d_num[dn[i]] += 1

for i in range(len(tn)):
    t_num[tn[i]] += 1
    
for i in range(len(t_num)):
    if d_num[i] < t_num[i]:
        print("NO")
        sys.exit()
print("yes")
Problem p02742 (python)

Fixed submission:
import math
 
l = [int(x) for x in input().split()]

if l[0] == 1 or l[1] == 1:
  print(1)
else:
  print(math.ceil((l[0]*l[1])/2))

Buggy submission (verdict: Runtime Error):
import math

l = [int(x) for x in input().split]

print(math.ceil(l[0]*l[1]))
Problem p02783 (python)

Fixed submission:
x = [int(x) for x in input().split()]

import math

print(math.ceil(x[0]/x[1]))

Buggy submission (verdict: Runtime Error):
x = [int(x) for x in input().split()]

import math

print(math.ceil(x[0]/x[1])
Problem p02613 (python)

Fixed submission:
def B():
    n = int(input())
    s = []
    for _ in range(n):
        s.append(input())
    import collections
    c = collections.Counter(s)
    ret_l = ["AC","WA","TLE","RE"]
    for t in ret_l:
        print(t +  " x " + str(c[t]))
B()

Buggy submission (verdict: Runtime Error):
defB():
    n = int(input())
    s = [list(map(str,input().split())) for i in range(n)]
    import collections
    c = collections.Counter(s)
    ret_l = ["AC","WA","TLE","RE"]
    for t in ret_l:
        print(t +  " x " + str(c[t]))
B()
Problem p02756 (python)

Fixed submission:
s = list(str(input()))
q = int(input())
w = [list(map(str,input().split())) for i in range(q)]

reverse = False
front_list = []
end_list = []

for data in w:
    if int(data[0]) == 1:
        reverse = not reverse
    else:
        if (int(data[1]) == 1 and not reverse) or (int(data[1]) == 2 and reverse):
            front_list.append(data[2])
        else:
            end_list.append(data[2])
if not reverse:
    front_list.reverse()
    print("".join(front_list + s + end_list))
else:
    end_list.reverse()
    s.reverse()
    print("".join(end_list + s + front_list))

Buggy submission (verdict: Runtime Error):
def change_fb(str_list):
    tmp = str_list[0]
    str_list[0] = str_list[-1]
    str_list[-1] = tmp

s = str(input())
q = int(input())
w = [input() for i in range(q)]

change = False
str_list = list(s)
for data in w:
    if int(data[0]) == 1:
        change = not change
    else:
        if change:
            change = False
            change_fb(str_list)
        t,f,c = data.split()
        if int(f) == 1:
            str_list.insert(0, c)
        else:
            str_list.append(c)
    print(str_list)

if change:
    change_fb(str_list)

print("".join(str_list))