<commit_before>// Use different design

let monthDay:[Int] = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,]
let monthDayL:[Int] = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,]
let yzero = 2000

func leapYear(_ y:Int) -> Bool {
    if (y % 4 == 0) && (y % 400 == 0 || y % 100 != 0) {
        return true
    } else {
        return false
    }
}

class Date {
    var d:Int
    var m:Int
    var y:Int

    init(days:Int, month:Int, year:Int) {
        self.d = days
        self.m = month
        self.y = year
    }
    
    func addDate(days:Int) {

        var daysLeft:Int = days + self.d
        
        while daysLeft > 0 {
            var monthTable:[Int] = leapYear(self.y) ? monthDayL : monthDay

            if daysLeft > monthTable[self.m - 1] {
                daysLeft = daysLeft - monthTable[self.m - 1]
                self.m += 1
                self.d = 1
                
                if self.m > 12 {
                    self.y += 1
                    self.m -= 12
                }
                
            } else {
                self.d = daysLeft
                daysLeft = 0
            }
            print(self.d)
            print(self.m)
            print(self.y)
            print(daysLeft)
        }
    }
}

var testa = Date(days:25, month:2, year:2004)
testa.addDate(days:370)<commit_msg>a bit, I am cold<commit_after>// Use different design

let monthDay:[Int] = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,]
let monthDayL:[Int] = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,]
let yzero = 2000

func leapYear(_ y:Int) -> Bool {
    if (y % 4 == 0) && (y % 400 == 0 || y % 100 != 0) {
        return true
    } else {
        return false
    }
}

class Date {
    var d:Int
    var m:Int
    var y:Int

    init(days:Int, month:Int, year:Int) {
        self.d = days
        self.m = month
        self.y = year
    }
    
    func addDate(days:Int) {

        var daysLeft:Int = days + self.d
        
        while daysLeft > 0 {
            var monthTable:[Int] = leapYear(self.y) ? monthDayL : monthDay

            if daysLeft > monthTable[self.m - 1] {
                daysLeft = daysLeft - monthTable[self.m - 1]
                self.m += 1
                self.d = 1
                
                if self.m > 12 {
                    self.y += 1
                    self.m -= 12
                }
                
            } else {
                self.d = daysLeft
                daysLeft = 0
            }
        }
    }

    func reduceDate(days:Int) {

        var daysLeft:Int = self.d - days

        if daysLeft > 0 {
            self.d = daysLeft
        }else if daysLeft == 0 {
            self.m -= 1
            
        }


    }
}

var testa = Date(days:25, month:2, year:2004)
testa.addDate(days:370)
{'fraction_non_alphanumeric': 0.12378902045209902, 'fraction_numerical': 0.06063867958378184, 'mean_word_length': 1.1935483870967742, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5291888', 'n_tokens_mistral': 1106, 'n_tokens_neox': 910, 'n_words': 254}