import Foundation func readInput(_ filePath: String) throws -> [Int] { return try String(contentsOfFile: filePath, encoding: .ascii) .split(separator: "\n").compactMap { Int($0) } } func rand(seed: Int, n: Int) -> Int { return (0..> 5) ^ res) return ((res << 11) ^ res) & 0b111111111111111111111111 } } let seeds = try readInput(CommandLine.arguments[1]) print(seeds.map { rand(seed: $0, n: 2000) }.reduce(0, +))