WeixiangYan/CodeTransOcean huggingface dataset:
Task: Combinations with repetitions






PHP: <?php
  function combos($arr, $k) {
    if ($k == 0) {
      return array(array());
    }
    
    if (count($arr) == 0) {
      return array();
    }
    
    $head = $arr[0];
    
    $combos = array();
    $subcombos = combos($arr, $k-1);
    foreach ($subcombos as $subcombo) {
      array_unshift($subcombo, $head);
      $combos[] = $subcombo;
    }
    array_shift($arr);
    $combos = array_merge($combos, combos($arr, $k));
    return $combos;
  }
  
  $arr = array("iced", "jam", "plain");
  $result = combos($arr, 2);
  foreach($result as $combo) {
    echo implode(' ', $combo), "<br>";
  }
  $donuts = range(1, 10);
  $num_donut_combos = count(combos($donuts, 3));
  echo "$num_donut_combos ways to order 3 donuts given 10 types";
?>






Ada: with Ada.Text_IO;
procedure Combinations is

   generic
      type Set is (<>);
   function Combinations
     (Count  : Positive;
      Output : Boolean := False)
      return   Natural;

   function Combinations
     (Count  : Positive;
      Output : Boolean := False)
      return   Natural
   is
      package Set_IO is new Ada.Text_IO.Enumeration_IO (Set);
      type Set_Array is array (Positive range <>) of Set;
      Empty_Array : Set_Array (1 .. 0);
      function Recurse_Combinations
        (Number : Positive;
         First  : Set;
         Prefix : Set_Array)
         return   Natural
      is
         Combination_Count : Natural := 0;
      begin
         for Next in First .. Set'Last loop
            if Number = 1 then
               Combination_Count := Combination_Count + 1;
               if Output then
                  for Element in Prefix'Range loop
                     Set_IO.Put (Prefix (Element));
                     Ada.Text_IO.Put ('+');
                  end loop;
                  Set_IO.Put (Next);
                  Ada.Text_IO.New_Line;
               end if;
            else
               Combination_Count := Combination_Count +
                                    Recurse_Combinations
                                       (Number - 1,
                                        Next,
                                        Prefix & (1 => Next));
            end if;
         end loop;
         return Combination_Count;
      end Recurse_Combinations;
   begin
      return Recurse_Combinations (Count, Set'First, Empty_Array);
   end Combinations;

   type Donuts is (Iced, Jam, Plain);
   function Donut_Combinations is new Combinations (Donuts);

   subtype Ten is Positive range 1 .. 10;
   function Ten_Combinations is new Combinations (Ten);

   Donut_Count : constant Natural :=
      Donut_Combinations (Count => 2, Output => True);
   Ten_Count   : constant Natural := Ten_Combinations (Count => 3);
begin
   Ada.Text_IO.Put_Line ("Total Donuts:" & Natural'Image (Donut_Count));
   Ada.Text_IO.Put_Line ("Total Tens:" & Natural'Image (Ten_Count));
end Combinations;
Task: Multiple distinct objects



C#: using System;
using System.Linq;
using System.Collections.Generic;

List<Foo> foos = Enumerable.Range(1, n).Select(x => new Foo()).ToList();









Ada: A : array (1..N) of T;
Task: Multiple distinct objects

C: foo *foos = malloc(n * sizeof(*foos));
for (int i = 0; i < n; i++)
  init_foo(&foos[i]);











Ada: A : array (1..N) of T;
Task: Multiple distinct objects


C++: 
T* p = new T[n]; 


for(size_t i = 0; i != n; ++i)
   p[i] = make_a_T(); 


delete[] p;










Ada: A : array (1..N) of T;
Task: Multiple distinct objects




Go: func nxm(n, m int) [][]int {
    d2 := make([][]int, n)
    for i := range d2 {
        d2[i] = make([]int, m)
    }
    return d2
}








Ada: A : array (1..N) of T;
Task: Multiple distinct objects





Java: Foo[] foos = new Foo[n]; 
for (int i = 0; i < foos.length; i++)
    foos[i] = new Foo();


Foo[] foos_WRONG = new Foo[n];
Arrays.fill(foos, new Foo());  







Ada: A : array (1..N) of T;
Task: Multiple distinct objects

C: foo *foos = malloc(n * sizeof(*foos));
for (int i = 0; i < n; i++)
  init_foo(&foos[i]);
Task: Multiple distinct objects



C#: using System;
using System.Linq;
using System.Collections.Generic;

List<Foo> foos = Enumerable.Range(1, n).Select(x => new Foo()).ToList();
Task: Multiple distinct objects


C++: 
T* p = new T[n]; 


for(size_t i = 0; i != n; ++i)
   p[i] = make_a_T(); 


delete[] p;
Task: Multiple distinct objects





Java: Foo[] foos = new Foo[n]; 
for (int i = 0; i < foos.length; i++)
    foos[i] = new Foo();


Foo[] foos_WRONG = new Foo[n];
Arrays.fill(foos, new Foo());
Task: Multiple distinct objects




Go: func nxm(n, m int) [][]int {
    d2 := make([][]int, n)
    for i := range d2 {
        d2[i] = make([]int, m)
    }
    return d2
}
Task: Multiple distinct objects







Python: [Foo()] * n
Task: Multiple distinct objects



C#: using System;
using System.Linq;
using System.Collections.Generic;

List<Foo> foos = Enumerable.Range(1, n).Select(x => new Foo()).ToList();








Fortran: program multiple
  
  type T
     integer :: a = 3
  end type T

  
  type S
     integer, pointer :: a
  end type S

  type(T), allocatable :: T_array(:)
  type(S), allocatable :: S_same(:)
  integer              :: i
  integer, target      :: v
  integer, parameter   :: N = 10

  
  allocate(T_array(N))

  
  T_array(5)%a = 1

  
  write(*,'(10i2)') (T_array(i),i=1,N)

  
  allocate(S_same(N))
  v = 5
  do i=1, N
     allocate(S_same(i)%a)
     S_same(i)%a => v
  end do

  
  write(*,'(10i2)') (S_same(i)%a,i=1,N)

  
  v = 3
  write(*,'(10i2)') (S_same(i)%a,i=1,N)  

end program multiple
Task: Multiple distinct objects


C++: 
T* p = new T[n]; 


for(size_t i = 0; i != n; ++i)
   p[i] = make_a_T(); 


delete[] p;









Fortran: program multiple
  
  type T
     integer :: a = 3
  end type T

  
  type S
     integer, pointer :: a
  end type S

  type(T), allocatable :: T_array(:)
  type(S), allocatable :: S_same(:)
  integer              :: i
  integer, target      :: v
  integer, parameter   :: N = 10

  
  allocate(T_array(N))

  
  T_array(5)%a = 1

  
  write(*,'(10i2)') (T_array(i),i=1,N)

  
  allocate(S_same(N))
  v = 5
  do i=1, N
     allocate(S_same(i)%a)
     S_same(i)%a => v
  end do

  
  write(*,'(10i2)') (S_same(i)%a,i=1,N)

  
  v = 3
  write(*,'(10i2)') (S_same(i)%a,i=1,N)  

end program multiple
Task: Multiple distinct objects

C: foo *foos = malloc(n * sizeof(*foos));
for (int i = 0; i < n; i++)
  init_foo(&foos[i]);










Fortran: program multiple
  
  type T
     integer :: a = 3
  end type T

  
  type S
     integer, pointer :: a
  end type S

  type(T), allocatable :: T_array(:)
  type(S), allocatable :: S_same(:)
  integer              :: i
  integer, target      :: v
  integer, parameter   :: N = 10

  
  allocate(T_array(N))

  
  T_array(5)%a = 1

  
  write(*,'(10i2)') (T_array(i),i=1,N)

  
  allocate(S_same(N))
  v = 5
  do i=1, N
     allocate(S_same(i)%a)
     S_same(i)%a => v
  end do

  
  write(*,'(10i2)') (S_same(i)%a,i=1,N)

  
  v = 3
  write(*,'(10i2)') (S_same(i)%a,i=1,N)  

end program multiple
Task: Multiple distinct objects




Go: func nxm(n, m int) [][]int {
    d2 := make([][]int, n)
    for i := range d2 {
        d2[i] = make([]int, m)
    }
    return d2
}







Fortran: program multiple
  
  type T
     integer :: a = 3
  end type T

  
  type S
     integer, pointer :: a
  end type S

  type(T), allocatable :: T_array(:)
  type(S), allocatable :: S_same(:)
  integer              :: i
  integer, target      :: v
  integer, parameter   :: N = 10

  
  allocate(T_array(N))

  
  T_array(5)%a = 1

  
  write(*,'(10i2)') (T_array(i),i=1,N)

  
  allocate(S_same(N))
  v = 5
  do i=1, N
     allocate(S_same(i)%a)
     S_same(i)%a => v
  end do

  
  write(*,'(10i2)') (S_same(i)%a,i=1,N)

  
  v = 3
  write(*,'(10i2)') (S_same(i)%a,i=1,N)  

end program multiple
Task: Multiple distinct objects





Java: Foo[] foos = new Foo[n]; 
for (int i = 0; i < foos.length; i++)
    foos[i] = new Foo();


Foo[] foos_WRONG = new Foo[n];
Arrays.fill(foos, new Foo());  






Fortran: program multiple
  
  type T
     integer :: a = 3
  end type T

  
  type S
     integer, pointer :: a
  end type S

  type(T), allocatable :: T_array(:)
  type(S), allocatable :: S_same(:)
  integer              :: i
  integer, target      :: v
  integer, parameter   :: N = 10

  
  allocate(T_array(N))

  
  T_array(5)%a = 1

  
  write(*,'(10i2)') (T_array(i),i=1,N)

  
  allocate(S_same(N))
  v = 5
  do i=1, N
     allocate(S_same(i)%a)
     S_same(i)%a => v
  end do

  
  write(*,'(10i2)') (S_same(i)%a,i=1,N)

  
  v = 3
  write(*,'(10i2)') (S_same(i)%a,i=1,N)  

end program multiple
Task: Multiple distinct objects







Python: [Foo()] * n 




Fortran: program multiple
  
  type T
     integer :: a = 3
  end type T

  
  type S
     integer, pointer :: a
  end type S

  type(T), allocatable :: T_array(:)
  type(S), allocatable :: S_same(:)
  integer              :: i
  integer, target      :: v
  integer, parameter   :: N = 10

  
  allocate(T_array(N))

  
  T_array(5)%a = 1

  
  write(*,'(10i2)') (T_array(i),i=1,N)

  
  allocate(S_same(N))
  v = 5
  do i=1, N
     allocate(S_same(i)%a)
     S_same(i)%a => v
  end do

  
  write(*,'(10i2)') (S_same(i)%a,i=1,N)

  
  v = 3
  write(*,'(10i2)') (S_same(i)%a,i=1,N)  

end program multiple
Task: Five weekends



C#: using System;

namespace _5_Weekends
{
    class Program
    {
        const int FIRST_YEAR = 1900;
        const int LAST_YEAR = 2100;
        static int[] _31_MONTHS = { 1, 3, 5, 7, 8, 10, 12 }; 

        static void Main(string[] args)
        {
            int totalNum = 0;
            int totalNo5Weekends = 0;

            for (int year = FIRST_YEAR; year <= LAST_YEAR; year++)
            {
                bool has5Weekends = false;

                foreach (int month in _31_MONTHS)
                {
                    DateTime firstDay = new DateTime(year, month, 1);
                    if (firstDay.DayOfWeek == DayOfWeek.Friday)
                    {
                        totalNum++;
                        has5Weekends = true;
                        Console.WriteLine(firstDay.ToString("yyyy - MMMM"));
                    }
                }

                if (!has5Weekends) totalNo5Weekends++;
            }
            Console.WriteLine("Total 5-weekend months between {0} and {1}: {2}", FIRST_YEAR, LAST_YEAR, totalNum);
            Console.WriteLine("Total number of years with no 5-weekend months {0}", totalNo5Weekends);
        }
    }
}









Ada: with Ada.Text_IO;              use Ada.Text_IO;
with Ada.Calendar.Formatting;  use Ada.Calendar;

use Ada.Calendar.Formatting;

procedure Five_Weekends is
   Months : Natural := 0;
begin
   for Year in Year_Number range 1901..2100 loop
      for Month in Month_Number range 1..12 loop
         begin
            if Day_Of_Week (Formatting.Time_Of (Year, Month, 31)) = Sunday then
               Put_Line (Year_Number'Image (Year) & Month_Number'Image (Month));
               Months := Months + 1;
            end if;
         exception
            when Time_Error =>
               null;
         end;
      end loop;
   end loop;
   Put_Line ("Number of months:" & Integer'Image (Months));
end Five_Weekends;
Task: Five weekends

C: #include <stdio.h>
#include <time.h>

static const char *months[] = {"January", "February", "March", "April", "May",
    "June", "July", "August", "September", "October", "November", "December"};
static int long_months[] = {0, 2, 4, 6, 7, 9, 11};

int main() {
    int n = 0, y, i, m;
    struct tm t = {0};
    printf("Months with five weekends:\n");
    for (y = 1900; y <= 2100; y++) {
        for (i = 0; i < 7; i++) {
            m = long_months[i];
            t.tm_year = y-1900;
	    t.tm_mon = m;
	    t.tm_mday = 1;
            if (mktime(&t) == -1) { 
                printf("Error: %d %s\n", y, months[m]);
                continue;
            }
            if (t.tm_wday == 5) { 
                printf("  %d %s\n", y, months[m]);
                n++;
            }
        }
    }
    printf("%d total\n", n);
    return 0;
}











Ada: with Ada.Text_IO;              use Ada.Text_IO;
with Ada.Calendar.Formatting;  use Ada.Calendar;

use Ada.Calendar.Formatting;

procedure Five_Weekends is
   Months : Natural := 0;
begin
   for Year in Year_Number range 1901..2100 loop
      for Month in Month_Number range 1..12 loop
         begin
            if Day_Of_Week (Formatting.Time_Of (Year, Month, 31)) = Sunday then
               Put_Line (Year_Number'Image (Year) & Month_Number'Image (Month));
               Months := Months + 1;
            end if;
         exception
            when Time_Error =>
               null;
         end;
      end loop;
   end loop;
   Put_Line ("Number of months:" & Integer'Image (Months));
end Five_Weekends;
Task: Five weekends


C++: #include <vector>
#include <boost/date_time/gregorian/gregorian.hpp>
#include <algorithm>
#include <iostream>
#include <iterator>
using namespace boost::gregorian ;

void print( const date &d ) {
   std::cout << d.year( ) << "-" << d.month( ) << "\n" ;
}

int main( ) {
   greg_month longmonths[ ] = {Jan, Mar , May , Jul ,
      Aug , Oct , Dec } ;
   int monthssize = sizeof ( longmonths ) / sizeof (greg_month ) ;
   typedef std::vector<date> DateVector ;
   DateVector weekendmonster ;
   std::vector<unsigned short> years_without_5we_months ;
   for ( unsigned short i = 1900 ; i < 2101 ; i++ ) {
      bool months_found = false ; 
      for ( int j = 0 ; j < monthssize ; j++ ) {
	 date d ( i , longmonths[ j ] , 1 ) ;
	 if ( d.day_of_week( ) == Friday ) {  
	    weekendmonster.push_back( d ) ;
	    if ( months_found == false )
	       months_found = true ;
         }
      }
      if ( months_found == false ) {
	 years_without_5we_months.push_back( i ) ;
      }
   }
   std::cout << "Between 1900 and 2100 , there are " << weekendmonster.size( )
      << " months with 5 complete weekends!\n" ;
   std::cout << "Months with 5 complete weekends are:\n" ;
   std::for_each( weekendmonster.begin( ) , weekendmonster.end( ) , print ) ;
   std::cout <<  years_without_5we_months.size( ) << " years had no months with 5 complete weekends!\n" ;
   std::cout << "These are:\n" ;
   std::copy( years_without_5we_months.begin( ) , years_without_5we_months.end( ) ,
	 std::ostream_iterator<unsigned short>( std::cout , "\n" ) ) ;
   std::cout << std::endl ;
   return 0 ;
}










Ada: with Ada.Text_IO;              use Ada.Text_IO;
with Ada.Calendar.Formatting;  use Ada.Calendar;

use Ada.Calendar.Formatting;

procedure Five_Weekends is
   Months : Natural := 0;
begin
   for Year in Year_Number range 1901..2100 loop
      for Month in Month_Number range 1..12 loop
         begin
            if Day_Of_Week (Formatting.Time_Of (Year, Month, 31)) = Sunday then
               Put_Line (Year_Number'Image (Year) & Month_Number'Image (Month));
               Months := Months + 1;
            end if;
         exception
            when Time_Error =>
               null;
         end;
      end loop;
   end loop;
   Put_Line ("Number of months:" & Integer'Image (Months));
end Five_Weekends;
Task: Five weekends




Go: package main

import (
    "fmt"
    "time"
)

func main() {
    var n int                                 
    var first, last time.Time                 
    haveNone := make([]int, 0, 29)            
    fmt.Println("Months with five weekends:") 
    for year := 1900; year <= 2100; year++ {
        var hasOne bool 
        for _, month := range []time.Month{1, 3, 5, 7, 8, 10, 12} {
            t := time.Date(year, month, 1, 0, 0, 0, 0, time.UTC)
            if t.Weekday() == time.Friday {
                
                fmt.Println("  ", t.Format("2006 January"))
                n++
                hasOne = true
                last = t
                if first.IsZero() {
                    first = t
                }
            }
        }
        if !hasOne {
            haveNone = append(haveNone, year)
        }
    }
    fmt.Println(n, "total\n") 
    
    fmt.Println("First five dates of weekends:")
    for i := 0; i < 5; i++ {
        fmt.Println("  ", first.Format("Monday, January 2, 2006"))
        first = first.Add(7 * 24 * time.Hour)
    }
    fmt.Println("Last five dates of weekends:")
    for i := 0; i < 5; i++ {
        fmt.Println("  ", last.Format("Monday, January 2, 2006"))
        last = last.Add(7 * 24 * time.Hour)
    }
    
    fmt.Println("\nYears with no months with five weekends:")
    for _, y := range haveNone {
        fmt.Println("  ", y)
    }
    fmt.Println(len(haveNone), "total")
}








Ada: with Ada.Text_IO;              use Ada.Text_IO;
with Ada.Calendar.Formatting;  use Ada.Calendar;

use Ada.Calendar.Formatting;

procedure Five_Weekends is
   Months : Natural := 0;
begin
   for Year in Year_Number range 1901..2100 loop
      for Month in Month_Number range 1..12 loop
         begin
            if Day_Of_Week (Formatting.Time_Of (Year, Month, 31)) = Sunday then
               Put_Line (Year_Number'Image (Year) & Month_Number'Image (Month));
               Months := Months + 1;
            end if;
         exception
            when Time_Error =>
               null;
         end;
      end loop;
   end loop;
   Put_Line ("Number of months:" & Integer'Image (Months));
end Five_Weekends;
Task: Five weekends





Java: import java.util.Calendar;
import java.util.GregorianCalendar;

public class FiveFSS {
    private static boolean[] years = new boolean[201];
    private static int[] month31 = {Calendar.JANUARY, Calendar.MARCH, Calendar.MAY,
        Calendar.JULY, Calendar.AUGUST, Calendar.OCTOBER, Calendar.DECEMBER};

    public static void main(String[] args) {
        StringBuilder months = new StringBuilder();
        int numMonths = 0;
        for (int year = 1900; year <= 2100; year++) {
            for (int month : month31) {
                Calendar date = new GregorianCalendar(year, month, 1);
                if (date.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) {
                    years[year - 1900] = true;
                    numMonths++;
                    
                    months.append((date.get(Calendar.MONTH) + 1) + "-" + year +"\n");
                }
            }
        }
        System.out.println("There are "+numMonths+" months with five weekends from 1900 through 2100:");
        System.out.println(months);
        System.out.println("Years with no five-weekend months:");
        for (int year = 1900; year <= 2100; year++) {
            if(!years[year - 1900]){
                System.out.println(year);
            }
        }
    }
}







Ada: with Ada.Text_IO;              use Ada.Text_IO;
with Ada.Calendar.Formatting;  use Ada.Calendar;

use Ada.Calendar.Formatting;

procedure Five_Weekends is
   Months : Natural := 0;
begin
   for Year in Year_Number range 1901..2100 loop
      for Month in Month_Number range 1..12 loop
         begin
            if Day_Of_Week (Formatting.Time_Of (Year, Month, 31)) = Sunday then
               Put_Line (Year_Number'Image (Year) & Month_Number'Image (Month));
               Months := Months + 1;
            end if;
         exception
            when Time_Error =>
               null;
         end;
      end loop;
   end loop;
   Put_Line ("Number of months:" & Integer'Image (Months));
end Five_Weekends;
Task: Five weekends







Python: from datetime import (date,
                      timedelta)

DAY = timedelta(days=1)
START, STOP = date(1900, 1, 1), date(2101, 1, 1)
WEEKEND = {6, 5, 4}  
FMT = '%Y %m(%B)'


def five_weekends_per_month(start: date = START,
                            stop: date = STOP) -> list[date]:
    
    current_date = start
    last_month = weekend_days = 0
    five_weekends = []
    while current_date < stop:
        if current_date.month != last_month:
            if weekend_days >= 15:
                five_weekends.append(current_date - DAY)
            weekend_days = 0
            last_month = current_date.month
        if current_date.weekday() in WEEKEND:
            weekend_days += 1
        current_date += DAY
    return five_weekends


dates = five_weekends_per_month()
indent = '  '
print(f"There are {len(dates)} months of which the first and last five are:")
print(indent + ('\n' + indent).join(d.strftime(FMT) for d in dates[:5]))
print(indent + '...')
print(indent + ('\n' + indent).join(d.strftime(FMT) for d in dates[-5:]))

years_without_five_weekends_months = (STOP.year - START.year
                                      - len({d.year for d in dates}))
print(f"\nThere are {years_without_five_weekends_months} years in the "
      f"range that do not have months with five weekends")





Ada: with Ada.Text_IO;              use Ada.Text_IO;
with Ada.Calendar.Formatting;  use Ada.Calendar;

use Ada.Calendar.Formatting;

procedure Five_Weekends is
   Months : Natural := 0;
begin
   for Year in Year_Number range 1901..2100 loop
      for Month in Month_Number range 1..12 loop
         begin
            if Day_Of_Week (Formatting.Time_Of (Year, Month, 31)) = Sunday then
               Put_Line (Year_Number'Image (Year) & Month_Number'Image (Month));
               Months := Months + 1;
            end if;
         exception
            when Time_Error =>
               null;
         end;
      end loop;
   end loop;
   Put_Line ("Number of months:" & Integer'Image (Months));
end Five_Weekends;
Task: Five weekends








VB: Option Explicit

Sub Main()
Dim y As Long, m As Long, t As String, cpt As Long, cptm As Long
    For y = 1900 To 2100
        t = vbNullString
        For m = 1 To 12 Step 2
            If m = 9 Then m = 8
            If Weekday(DateSerial(y, m, 1)) = vbFriday Then
                t = t & ", " & m
                cptm = cptm + 1
            End If
        Next
        If t <> "" Then
            Debug.Print y & t
        Else
            cpt = cpt + 1
        End If
    Next
    Debug.Print "There is " & cptm & " months with five full weekends from the year 1900 through 2100"
    Debug.Print "There is " & cpt & " years which don
End Sub




Ada: with Ada.Text_IO;              use Ada.Text_IO;
with Ada.Calendar.Formatting;  use Ada.Calendar;

use Ada.Calendar.Formatting;

procedure Five_Weekends is
   Months : Natural := 0;
begin
   for Year in Year_Number range 1901..2100 loop
      for Month in Month_Number range 1..12 loop
         begin
            if Day_Of_Week (Formatting.Time_Of (Year, Month, 31)) = Sunday then
               Put_Line (Year_Number'Image (Year) & Month_Number'Image (Month));
               Months := Months + 1;
            end if;
         exception
            when Time_Error =>
               null;
         end;
      end loop;
   end loop;
   Put_Line ("Number of months:" & Integer'Image (Months));
end Five_Weekends;
Task: Five weekends

C: #include <stdio.h>
#include <time.h>

static const char *months[] = {"January", "February", "March", "April", "May",
    "June", "July", "August", "September", "October", "November", "December"};
static int long_months[] = {0, 2, 4, 6, 7, 9, 11};

int main() {
    int n = 0, y, i, m;
    struct tm t = {0};
    printf("Months with five weekends:\n");
    for (y = 1900; y <= 2100; y++) {
        for (i = 0; i < 7; i++) {
            m = long_months[i];
            t.tm_year = y-1900;
	    t.tm_mon = m;
	    t.tm_mday = 1;
            if (mktime(&t) == -1) { 
                printf("Error: %d %s\n", y, months[m]);
                continue;
            }
            if (t.tm_wday == 5) { 
                printf("  %d %s\n", y, months[m]);
                n++;
            }
        }
    }
    printf("%d total\n", n);
    return 0;
}