library(data.table)
dtM <- fread("input.txt", header = FALSE) |> `colnames<-`(c(letters[1:3]))
dt <- dtM dt$valid <- ifelse(dt$a + dt$b > dt$c & dt$a + dt$c > dt$b & dt$b + dt$c > dt$a, TRUE, FALSE) table(dt$valid)["TRUE"]
TRUE 862
dt <- dtM dt <- data.table(t(matrix(c(dt$a, dt$b, dt$c), 3, nrow(dt)))) |> `colnames<-`(c(letters[1:3])) dt$valid <- ifelse(dt$a + dt$b > dt$c & dt$a + dt$c > dt$b & dt$b + dt$c > dt$a, TRUE, FALSE) table(dt$valid)["TRUE"]
TRUE 1577