func main() { n := make([]int, 0) s := bufio.NewScanner(os.Stdin) s.Split(bufio.SplitFunc(bufio.ScanWords)) for s.Scan() { k, _ := strconv.Atoi(s.Text()) n = append(n, k) } fmt.Println(n[0]-n[4], n[1]-n[3]) }
func main() { s := bufio.NewScanner(os.Stdin) s.Split(bufio.SplitFunc(bufio.ScanWords)) c, i, k := 0, 0, 0 for s.Scan() { i++ v, _ := strconv.Atoi(s.Text()) if i == 1 { k = v } else if i > 2 { c += v - k if c < 0 { c = 0 } } } fmt.Println(c) }