Language: C++

<?php 
    $sc = new Scanner();
    while(true){
        $turn = $sc->nextInt();
        if($turn==0) {
            break;
        }
        $a_point=0;
        $b_point=0;
        for($i=0;$i<$turn;$i++){
            $a=$sc->nextInt();
            $b=$sc->nextInt();
            if($a>$b){
                $a_point += $a+$b;
            }else if ($a<$b) {
                $b_point += $a+$b;
            }else {
                $a_point+=$a;
                $b_point+=$b;
            }
        }
        echo $a_point,' ',$b_point,'\n';
    }
    class Scanner {
        private $arr = [];
        private $count = 0;
        private $pointer = 0;
        public function next() {
            if($this->pointer >= $this->count) {
                $str = trim(fgets(STDIN));
                $this->arr = explode(' ', $str);
                $this->count = count($this->arr);
                $this->pointer = 0;
            }
            $result = $this->arr[$this->pointer];
            $this->pointer++;
            return $result;
        }
        public function hasNext() {
            return $this->pointer < $this->count;
        }
        public function nextInt() {
            return (int)$this->next();
        }
        public function nextDouble() {
            return (double)$this->next();
        }
    }
    class out {
        public static function println($str) {
            echo $str . PHP_EOL;
        }
    }
 ?>

Compiler output:
a.cc:1:1: error: expected unqualified-id before '<' token
    1 | <?php
      | ^
a.cc:3:5: error: expected unqualified-id before 'while'
    3 |     while(true){
      |     ^~~~~
a.cc:25:16: error: expected ':' before '$arr'
   25 |         private $arr = [];
      |                ^~~~~
      |                :
a.cc:25:17: error: '$arr' does not name a type
   25 |         private $arr = [];
      |                 ^~~~
a.cc:26:16: error: expected ':' before '$count'
   26 |         private $count = 0;
      |                ^~~~~~~
      |                :
a.cc:26:17: error: '$count' does not name a type
   26 |         private $count = 0;
      |                 ^~~~~~
a.cc:27:16: error: expected ':' before '$pointer'
   27 |         private $pointer = 0;
      |                ^~~~~~~~~
      |                :
a.cc:27:17: error: '$pointer' does not name a type
   27 |         private $pointer = 0;
      |                 ^~~~~~~~
a.cc:28:15: error: expected ':' before 'function'
   28 |         public function next() {
      |               ^~~~~~~~~
      |               :
a.cc:28:16: error: 'function' does not name a type; did you mean 'union'?
   28 |         public function next() {
      |                ^~~~~~~~
      |                union
a.cc:39:15: error: expected ':' before 'function'
   39 |         public function hasNext() {
      |               ^~~~~~~~~
      |               :
a.cc:39:16: error: 'function' does not name a type; did you mean 'union'?
   39 |         public function hasNext() {
      |                ^~~~~~~~
      |                union
a.cc:42:15: error: expected ':' before 'function'
   42 |         public function nextInt() {
      |               ^~~~~~~~~
      |               :
a.cc:42:16: error: 'function' does not name a type; did you mean 'union'?
   42 |         public function nextInt() {
      |                ^~~~~~~~
      |                union
a.cc:45:15: error: expected ':' before 'function'
   45 |         public function nextDouble() {
      |               ^~~~~~~~~
      |               :
a.cc:45:16: error: 'function' does not name a type; did you mean 'union'?
   45 |         public function nextDouble() {
      |                ^~~~~~~~
      |                union
a.cc:48:6: error: expected ';' after class definition
   48 |     }
      |      ^
      |      ;
a.cc:50:15: error: expected ':' before 'static'
   50 |         public static function println($str) {
      |               ^~~~~~~
      |               :
a.cc:50:23: error: 'function' does not name a type; did you mean 'union'?
   50 |         public static function println($str) {
      |                       ^~~~~~~~
      |                       union
a.cc:53:6: error: expected ';' after class definition
   53 |     }
      |      ^
      |      ;
a.cc:54:2: error: expected unqualified-id before '?' token
   54 |  ?>
      |  ^