<jupyter_start><jupyter_text>Counting Sundays You are given the following information, but you may prefer to do some research for yourself.- 1 Jan 1900 was a Monday.- Thirty days has September,April, June and November.All the rest have thirty-one,Saving February alone,Which has twenty-eight, rain or shine.And on leap years, twenty-nine.- A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400.How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)? ---  Idea Accumulate the total days of each month since 1 Jan 1900, and check if the first day of this month is sunday. ---<jupyter_code>month_day_norm = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
month_day_leap = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
def is_leap(y):
    return y % 400 == 0 or (y % 100 != 0 and y % 4 == 0)
is_leap(1901), is_leap(1904), is_leap(2000), is_leap(1900)
def solve():
    day_cnt = 0
    sunday_first_cnt = 0
    for y in range(1900, 2001):
        if is_leap(y):
            month_day = month_day_leap
        else:
            month_day = month_day_norm
            
        for m in range(12):
            if y != 1900 and day_cnt % 7 == 6:
                sunday_first_cnt += 1
            day_cnt += month_day[m]
    return sunday_first_cnt
solve()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09130434782608696, 'fraction_numerical': 0.08550724637681159, 'mean_word_length': 2.9457142857142857, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '441169', 'license': 'MIT', 'n_tokens_mistral': 562, 'n_tokens_neox': 443, 'n_words': 191, 'path': '1-25/p19.ipynb', 'repo_name': 'Sorosliu1029/Euler', 'size': '1380'}