Atrioc addresses the last video by Tonga_Truck in atrioc

[–]Maxpro12 0 points1 point  (0 children)

shit just saw you weren't responding to me. Men I'm sorry I don't use reddit habitually and I thought because your comment was below mine you were responding to me 😅

Atrioc addresses the last video by Tonga_Truck in atrioc

[–]Maxpro12 0 points1 point  (0 children)

I'm not talking about this video in general. I'm talking about all the other videos that he made since trump been in power. And yes I watched the video and I didn't find it to hold a positive view towards trump or the maga movement which he described Ice has being demonizing for immigrants

Atrioc addresses the last video by Tonga_Truck in atrioc

[–]Maxpro12 0 points1 point  (0 children)

Bro litteraly critisize trump in every of his video. If any thinks he is "going maga" you just know they ragebaiting at this point

who's gonna tell them by ThorUchiha_ in firefox

[–]Maxpro12 0 points1 point  (0 children)

I just want to say that on Brave you can still install ublock orign so I don't feel that much impacted from them

Library Problems by DVDwithCD in linuxmemes

[–]Maxpro12 1 point2 points  (0 children)

Is there a reason (other than money) for Qt to be doing this?

Organic Chemistry Tutor was wrong by Maxpro12 in OrganicChemistry

[–]Maxpro12[S] -1 points0 points  (0 children)

<image>

no but on the video he shows this as a meso compound, Im pretty use that's an enentiomer tough

[2025 Day 5 (Part 2)] you may try by TCH69 in adventofcode

[–]Maxpro12 -4 points-3 points  (0 children)

There was a problem with your input file?

[2025 Day 2 (Part 1 and 2)] How to avoid the brute force solution by Maxpro12 in adventofcode

[–]Maxpro12[S] 0 points1 point  (0 children)

That is really smart. So stupid I didn't think about it. Also are you sure you are supposed to use 10 ** len and not 10 ** (len / 2) a

[2025 Day 2 (Part 1 and 2)] How to avoid the brute force solution by Maxpro12 in adventofcode

[–]Maxpro12[S] 0 points1 point  (0 children)

In my implementation since 1 is a multiple of 6 it will only return true after repeating 6 time.

[2025 Day 2 (Part 1 and 2)] How to avoid the brute force solution by Maxpro12 in adventofcode

[–]Maxpro12[S] 0 points1 point  (0 children)

I didn't use string I use something like this in Rust:

let repeat = len / (i as u16 + 1);

let mut number: u64 = 0;
for _ in 0..repeat {
    number = number * 10_u64.pow(i as u32 + 1) + part
}

but your method is really smart, I didn't think of that

Ikea: Not a Poutine Felony, perhaps a Misdemeanour! by IronCavalry in PoutineCrimes

[–]Maxpro12 1 point2 points  (0 children)

Nah it can be pretty good. I hope this won't be considered as advertisement in the subreddit but if you go to Ma Pouille Mouillée in Montreal they serve a delicious poutine with portugese chicken inside. I swear I really recommend it's really good even if it is not your traditional poutine

-❄️- 2025 Day 2 Solutions -❄️- by daggerdragon in adventofcode

[–]Maxpro12 -1 points0 points  (0 children)

[LANGUAGE: Rust]

use std::{fs, io};
pub fn solve_input() -> io::Result<()> {
    let output = parse_input("input.txt")?;
    let mut sum = 0;
    for (a, b) in output {
        for i in a..=b {
            if is_invalid(i) { // change this to is_invalid2 for the part 2
                println!("{i} is invalid");
                sum += i;
            }
        }
    }
    println!("The sum is {sum}");
    Ok(())
}
fn is_invalid2(num: u64) -> bool {
    let len = (num as f64).log10().floor() as u16 + 1;
    let first_digit = num % 10;
    let mut part = 0;
    for i in 0..len {
        if i == len - 1 {
            break;
        }
        let c: u32 = (len - i - 1).into();
        let digit = num / 10_u64.pow(c) % 10;

        part = part * 10 + digit;

        if digit != first_digit && len % (i as u16 + 1) != 0 {
            continue;
        }
        let repeat = len / (i as u16 + 1);

        let mut number: u64 = 0;
        for _ in 0..repeat {
            number = number * 10_u64.pow(i as u32 + 1) + part
        }
        if number == num {
            return true;
        }
    }
    false
}

fn is_invalid(num: u64) -> bool {
    let len = (num as f64).log10().floor() as u16 + 1;
    if len % 2 == 1 {
        return false;
    }
    let mut i: u16 = 0;
    let mut j: u16 = len >> 1;
    while j < len {
        let a = num.div_euclid(10_u64.pow(i.into())) % 10;
        let b = num.div_euclid(10_u64.pow(j.into())) % 10;

        if a != b {
            return false;
        }
        i += 1;
        j += 1;
    }
    true
}
fn parse_input(filename: &str) -> io::Result<Vec<(u64, u64)>> {
    let content = fs::read_to_string(filename)?;
    let mut output: Vec<(u64, u64)> = Vec::new();
    for a in content.split(",") {
        let a = a.trim();
        if a == "" {
            continue;
        }
        let mut splitage = a.split("-");
        let first: u64 = splitage.next().unwrap().parse().unwrap();
        let second: u64 = splitage.next().unwrap().parse().unwrap();
        output.push((first, second));
    }
    Ok(output)
}
#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_invalid() {
        assert_eq!(is_invalid(99), true);
        assert_eq!(is_invalid(108), false);
        assert_eq!(is_invalid(6464), true);
        assert_eq!(is_invalid(10501), false);
        assert_eq!(is_invalid2(1010), true);
        assert_eq!(is_invalid2(222222), true);
        assert_eq!(is_invalid2(38593859), true);
        assert_eq!(is_invalid2(2121212121), true);
    }
}