If each image contains one beetle and one ball, and no beetle has all its legs on the surface of the ball.
return beetles ;return balls ;return images ;return number of  #1 for each  #3 ;return #3 where  #4 is equal to  one ;return number of  #2 for each  #5 ;return #5 where  #6 is equal to  one ;return number of  #3 ;return number of  #7 ;return if  #8 is equal to  #9 ;return surface of #2 ;return legs of #1 ;return #12 that are on #11 ;return number of  #12 for each  #1 ;return number of  #13 for each  #1 ;return #1 where  #14 is equal to  #15 ;return number of  #16 ;return if  #17 is equal to  zero ;return if  both  #10 and #18 are true
['select', 'select', 'select', 'group', 'comparative', 'group', 'comparative', 'aggregate', 'aggregate', 'boolean', 'project', 'project', 'filter', 'group', 'group', 'comparative', 'aggregate', 'boolean', 'boolean']