Columns depending on posts count

This will need to be customized for your situation but it should be helpful.

      <?php
  // Start the loop.
  $i = 0; while ( $the_query->have_posts() ) : $the_query->the_post();
  if ( $i == 1 ) : ?>
    <div class="col-md-12">
  <?php elseif ( $i == 2 ) : ?>
    <div class="col-md-6">
  <?php elseif ( $i == 3 ) : ?>
    <div class="col-md-4">
  <?php endif; ?>

  <?php
  // Include the carousel template content.
  get_template_part( 'template-parts/content', get_post_format() ); ?>

  </div>

  <?php
  // End the loop.
  $i++; endwhile;

tech