#!/usr/bin/env tclsh set nums [split [read stdin] \n] set n [llength $nums] for {set i 0} {$i < $n - 1} {incr i} { for {set j $i} {$j < $n} {incr j} { set a [lindex $nums $i] if {$a eq ""} continue set b [lindex $nums $j] if {$b eq ""} continue if {$a + $b == 2020} {puts "$a $b [expr {$a * $b}]"; exit} } }