WeixiangYan/CodeTransOcean huggingface dataset:
Task: Top rank per group






PHP: $data = Array(
            Array("Tyler Bennett","E10297",32000,"D101"),
            Array("John Rappl","E21437",47000,"D050"),
            Array("George Woltman","E00127",53500,"D101"),
            Array("Adam Smith","E63535",18000,"D202"),
            Array("Claire Buckman","E39876",27800,"D202"),
            Array("David McClellan","E04242",41500,"D101"),
            Array("Rich Holcomb","E01234",49500,"D202"),
            Array("Nathan Adams","E41298",21900,"D050"),
            Array("Richard Potter","E43128",15900,"D101"),
            Array("David Motsinger","E27002",19250,"D202"),
            Array("Tim Sampair","E03033",27000,"D101"),
            Array("Kim Arlich","E10001",57000,"D190"),
            Array("Timothy Grove","E16398",29900,"D190")
            );
function top_sal($num){
    global $data;
    $depts = Array();
    foreach($data as $key => $arr){
        if(!isset($depts[$arr[3]])) $depts[$arr[3]] = Array();
        $depts[$arr[3]][] = $key;
    }   
    function topsalsort($a,$b){
        global $data;
        if ($data[$a][2] == $data[$b][2]) {
            return 0;
        }
        return ($data[$a][2] < $data[$b][2]) ? 1 : -1;
    }
    foreach ($depts as $key => $val){
        usort($depts[$key],"topsalsort");
    }
    ksort($depts);
    echo '<pre>';
    foreach ($depts as $key => $val){
        echo $key . '<br>';
        echo 'Name          ID      Salary<br>';
        $count = 0;
        foreach($val as $value){
            echo $data[$value][0] . '   ' . $data[$value][1] . '    ' . $data[$value][2] . '<br>';
            $count++;
            if($count>=$num) break;
        }
        echo '<br>';
    }
    echo '</pre>';
}
top_sal(3);





Fortran:       DATA EMPLOYEE(1:3)/
     1 GRIST("Tyler Bennett","E10297",32000,"D101"),
     2 GRIST("John Rappl","E21437",47000,"D050"),
     3 GRIST("George Woltman","E00127",53500,"D101")/
Task: Top rank per group






PHP: $data = Array(
            Array("Tyler Bennett","E10297",32000,"D101"),
            Array("John Rappl","E21437",47000,"D050"),
            Array("George Woltman","E00127",53500,"D101"),
            Array("Adam Smith","E63535",18000,"D202"),
            Array("Claire Buckman","E39876",27800,"D202"),
            Array("David McClellan","E04242",41500,"D101"),
            Array("Rich Holcomb","E01234",49500,"D202"),
            Array("Nathan Adams","E41298",21900,"D050"),
            Array("Richard Potter","E43128",15900,"D101"),
            Array("David Motsinger","E27002",19250,"D202"),
            Array("Tim Sampair","E03033",27000,"D101"),
            Array("Kim Arlich","E10001",57000,"D190"),
            Array("Timothy Grove","E16398",29900,"D190")
            );
function top_sal($num){
    global $data;
    $depts = Array();
    foreach($data as $key => $arr){
        if(!isset($depts[$arr[3]])) $depts[$arr[3]] = Array();
        $depts[$arr[3]][] = $key;
    }   
    function topsalsort($a,$b){
        global $data;
        if ($data[$a][2] == $data[$b][2]) {
            return 0;
        }
        return ($data[$a][2] < $data[$b][2]) ? 1 : -1;
    }
    foreach ($depts as $key => $val){
        usort($depts[$key],"topsalsort");
    }
    ksort($depts);
    echo '<pre>';
    foreach ($depts as $key => $val){
        echo $key . '<br>';
        echo 'Name          ID      Salary<br>';
        $count = 0;
        foreach($val as $value){
            echo $data[$value][0] . '   ' . $data[$value][1] . '    ' . $data[$value][2] . '<br>';
            $count++;
            if($count>=$num) break;
        }
        echo '<br>';
    }
    echo '</pre>';
}
top_sal(3);
Task: Halt and catch fire



C#: int a=0,b=1/a;









Ada: procedure Halt_And_Catch_Fire is
begin
   raise Program_Error with "Halt and catch fire";
end Halt_And_Catch_Fire;
Task: Halt and catch fire

C: int main(){int a=0, b=0, c=a/b;}











Ada: procedure Halt_And_Catch_Fire is
begin
   raise Program_Error with "Halt and catch fire";
end Halt_And_Catch_Fire;
Task: Halt and catch fire


C++: #include <stdexcept>
int main()
{
    throw std::runtime_error("boom");
}










Ada: procedure Halt_And_Catch_Fire is
begin
   raise Program_Error with "Halt and catch fire";
end Halt_And_Catch_Fire;
Task: Halt and catch fire




Go: package main; import "fmt"; func main(){a, b := 0, 0; fmt.Println(a/b)}








Ada: procedure Halt_And_Catch_Fire is
begin
   raise Program_Error with "Halt and catch fire";
end Halt_And_Catch_Fire;
Task: Halt and catch fire







Python: 0/0





Ada: procedure Halt_And_Catch_Fire is
begin
   raise Program_Error with "Halt and catch fire";
end Halt_And_Catch_Fire;
Task: Halt and catch fire

C: int main(){int a=0, b=0, c=a/b;}
Task: Halt and catch fire



C#: int a=0,b=1/a;
Task: Halt and catch fire


C++: #include <stdexcept>
int main()
{
    throw std::runtime_error("boom");
}
Task: Halt and catch fire


C++: #include <stdexcept>
int main()
{
    throw std::runtime_error("boom");
}









Fortran:       PROGRAM A
      CALL ABORT
      END
Task: Halt and catch fire




Go: package main; import "fmt"; func main(){a, b := 0, 0; fmt.Println(a/b)}
Task: Subleq



C#: using System;

namespace Subleq {
    class Program {
        static void Main(string[] args) {
            int[] mem = {
                15, 17, -1, 17, -1, -1, 16, 1, -1, 16,
                3, -1, 15, 15, 0, 0, -1, 72, 101, 108,
                108, 111, 44, 32, 119, 111, 114, 108, 100, 33,
                10, 0,
            };

            int instructionPointer = 0;

            do {
                int a = mem[instructionPointer];
                int b = mem[instructionPointer + 1];

                if (a == -1) {
                    mem[b] = Console.Read();
                }
                else if (b == -1) {
                    Console.Write((char)mem[a]);
                }
                else {
                    mem[b] -= mem[a];
                    if (mem[b] < 1) {
                        instructionPointer = mem[instructionPointer + 2];
                        continue;
                    }
                }

                instructionPointer += 3;
            } while (instructionPointer >= 0);
        }
    }
}









Ada: with Ada.Text_IO;

procedure Subleq is
   
   Storage_Size: constant Positive := 2**8; 
   Steps: Natural := 999; 
 
   subtype Address is Integer range -1 .. (Storage_Size-1);
   subtype Memory_Location is Address range 0 .. Address'Last;
 
   type Storage is array(Memory_Location) of Integer;
 
   package TIO renames Ada.Text_IO;
   package IIO is new TIO.Integer_IO(Integer);
 
   procedure Read_Program(Mem: out Storage) is
      Idx: Memory_Location := 0;
   begin
      while not TIO.End_Of_Line loop
	 IIO.Get(Mem(Idx));
 	 Idx := Idx + 1;
      end loop;
   exception 
      when others => TIO.Put_Line("Reading program: Something went wrong!"); 
   end Read_Program;
 
   procedure Execute_Program(Mem: in out Storage) is
      PC: Integer := 0; 
      function Source return Integer is (Mem(PC));
      function Dest return Integer is (Mem(PC+1));
      function Branch return Integer is (Mem(PC+2));
      function Next return Integer is (PC+3);
   begin
      while PC >= 0 and Steps >= 0 loop
	 Steps := Steps -1;
	 if Source = -1 then 
            declare
               Char: Character;
            begin
               TIO.Get (Char);
               Mem(Dest) := Character'Pos (Char);
            end;
	    PC := Next;
	 elsif Dest = -1 then 
	    TIO.Put(Character'Val(Mem(Source)));
	    PC := Next;
	 else 
	    Mem(Dest) := Mem(Dest) - Mem(Source);
	    if Mem(Dest) <= 0 then  
	       PC := Branch;
	    else
	       PC := Next;
	    end if;
	 end if;
      end loop;
      TIO.Put_Line(if PC >= 0 then "Emergency exit: program stopped!" else "");
    exception
      when others => TIO.Put_Line("Failure when executing Program"); 
   end Execute_Program;
 
   Memory: Storage := (others => 0); 
 
begin
 
   Read_Program(Memory);
   Execute_Program(Memory);
 
end Subleq;
Task: Subleq

C: #include <stdlib.h>
#include <stdio.h>

void
subleq(int *code)
{
	int ip = 0, a, b, c, nextIP;
	char ch;
	while(0 <= ip) {
		nextIP = ip + 3;
		a = code[ip];
		b = code[ip + 1];
		c = code[ip + 2];
		if(a == -1) {
			scanf("%c", &ch);
			code[b] = (int)ch;
		} else if(b == -1) {
			printf("%c", (char)code[a]);
		} else {
			code[b] -= code[a];
			if(code[b] <= 0)
				nextIP = c;
		}
		ip = nextIP;
	}
}

void
processFile(char *fileName)
{
	int *dataSet, i, num;
	FILE *fp = fopen(fileName, "r");
	fscanf(fp, "%d", &num);
	dataSet = (int *)malloc(num * sizeof(int));
	for(i = 0; i < num; i++)
		fscanf(fp, "%d", &dataSet[i]);
	fclose(fp);
	subleq(dataSet);
}

int
main(int argC, char *argV[])
{
	if(argC != 2)
		printf("Usage : %s <subleq code file>\n", argV[0]);
	else
		processFile(argV[1]);
	return 0;
}











Ada: with Ada.Text_IO;

procedure Subleq is
   
   Storage_Size: constant Positive := 2**8; 
   Steps: Natural := 999; 
 
   subtype Address is Integer range -1 .. (Storage_Size-1);
   subtype Memory_Location is Address range 0 .. Address'Last;
 
   type Storage is array(Memory_Location) of Integer;
 
   package TIO renames Ada.Text_IO;
   package IIO is new TIO.Integer_IO(Integer);
 
   procedure Read_Program(Mem: out Storage) is
      Idx: Memory_Location := 0;
   begin
      while not TIO.End_Of_Line loop
	 IIO.Get(Mem(Idx));
 	 Idx := Idx + 1;
      end loop;
   exception 
      when others => TIO.Put_Line("Reading program: Something went wrong!"); 
   end Read_Program;
 
   procedure Execute_Program(Mem: in out Storage) is
      PC: Integer := 0; 
      function Source return Integer is (Mem(PC));
      function Dest return Integer is (Mem(PC+1));
      function Branch return Integer is (Mem(PC+2));
      function Next return Integer is (PC+3);
   begin
      while PC >= 0 and Steps >= 0 loop
	 Steps := Steps -1;
	 if Source = -1 then 
            declare
               Char: Character;
            begin
               TIO.Get (Char);
               Mem(Dest) := Character'Pos (Char);
            end;
	    PC := Next;
	 elsif Dest = -1 then 
	    TIO.Put(Character'Val(Mem(Source)));
	    PC := Next;
	 else 
	    Mem(Dest) := Mem(Dest) - Mem(Source);
	    if Mem(Dest) <= 0 then  
	       PC := Branch;
	    else
	       PC := Next;
	    end if;
	 end if;
      end loop;
      TIO.Put_Line(if PC >= 0 then "Emergency exit: program stopped!" else "");
    exception
      when others => TIO.Put_Line("Failure when executing Program"); 
   end Execute_Program;
 
   Memory: Storage := (others => 0); 
 
begin
 
   Read_Program(Memory);
   Execute_Program(Memory);
 
end Subleq;
Task: Subleq


C++: #include <fstream>
#include <iostream>
#include <iterator>
#include <vector>

class subleq {
public:
    void load_and_run( std::string file ) {
        std::ifstream f( file.c_str(), std::ios_base::in );
        std::istream_iterator<int> i_v, i_f( f );
        std::copy( i_f, i_v, std::back_inserter( memory ) );
        f.close();
        run();
    }

private:
    void run() {
        int pc = 0, next, a, b, c;
        char z;
        do {
            next = pc + 3;
            a = memory[pc]; b = memory[pc + 1]; c = memory[pc + 2];
            if( a == -1 ) {
                std::cin >> z; memory[b] = static_cast<int>( z );
            } else if( b == -1 ) {
                std::cout << static_cast<char>( memory[a] );
            } else {
                memory[b] -= memory[a];
                if( memory[b] <= 0 ) next = c;
            }
            pc = next;
        } while( pc >= 0 );
    }

    std::vector<int> memory;
};

int main( int argc, char* argv[] ) {
    subleq s;
    if( argc > 1 ) {
        s.load_and_run( argv[1] );
    } else {
        std::cout << "usage: subleq <filename>\n";
    }
    return 0;
}










Ada: with Ada.Text_IO;

procedure Subleq is
   
   Storage_Size: constant Positive := 2**8; 
   Steps: Natural := 999; 
 
   subtype Address is Integer range -1 .. (Storage_Size-1);
   subtype Memory_Location is Address range 0 .. Address'Last;
 
   type Storage is array(Memory_Location) of Integer;
 
   package TIO renames Ada.Text_IO;
   package IIO is new TIO.Integer_IO(Integer);
 
   procedure Read_Program(Mem: out Storage) is
      Idx: Memory_Location := 0;
   begin
      while not TIO.End_Of_Line loop
	 IIO.Get(Mem(Idx));
 	 Idx := Idx + 1;
      end loop;
   exception 
      when others => TIO.Put_Line("Reading program: Something went wrong!"); 
   end Read_Program;
 
   procedure Execute_Program(Mem: in out Storage) is
      PC: Integer := 0; 
      function Source return Integer is (Mem(PC));
      function Dest return Integer is (Mem(PC+1));
      function Branch return Integer is (Mem(PC+2));
      function Next return Integer is (PC+3);
   begin
      while PC >= 0 and Steps >= 0 loop
	 Steps := Steps -1;
	 if Source = -1 then 
            declare
               Char: Character;
            begin
               TIO.Get (Char);
               Mem(Dest) := Character'Pos (Char);
            end;
	    PC := Next;
	 elsif Dest = -1 then 
	    TIO.Put(Character'Val(Mem(Source)));
	    PC := Next;
	 else 
	    Mem(Dest) := Mem(Dest) - Mem(Source);
	    if Mem(Dest) <= 0 then  
	       PC := Branch;
	    else
	       PC := Next;
	    end if;
	 end if;
      end loop;
      TIO.Put_Line(if PC >= 0 then "Emergency exit: program stopped!" else "");
    exception
      when others => TIO.Put_Line("Failure when executing Program"); 
   end Execute_Program;
 
   Memory: Storage := (others => 0); 
 
begin
 
   Read_Program(Memory);
   Execute_Program(Memory);
 
end Subleq;
Task: Subleq




Go: package main

import (
	"io"
	"log"
	"os"
)

func main() {
	var mem = []int{
		15, 17, -1, 17, -1, -1, 16, 1, -1, 16, 3, -1, 15, 15, 0, 0, -1,
		
		72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33, 10,
		0,
	}
	for ip := 0; ip >= 0; {
		switch {
		case mem[ip] == -1:
			mem[mem[ip+1]] = readbyte()
		case mem[ip+1] == -1:
			writebyte(mem[mem[ip]])
		default:
			b := mem[ip+1]
			v := mem[b] - mem[mem[ip]]
			mem[b] = v
			if v <= 0 {
				ip = mem[ip+2]
				continue
			}
		}
		ip += 3
	}
}

func readbyte() int {
	var b [1]byte
	if _, err := io.ReadFull(os.Stdin, b[:]); err != nil {
		log.Fatalln("read:", err)
	}
	return int(b[0])
}

func writebyte(b int) {
	if _, err := os.Stdout.Write([]byte{byte(b)}); err != nil {
		log.Fatalln("write:", err)
	}
}








Ada: with Ada.Text_IO;

procedure Subleq is
   
   Storage_Size: constant Positive := 2**8; 
   Steps: Natural := 999; 
 
   subtype Address is Integer range -1 .. (Storage_Size-1);
   subtype Memory_Location is Address range 0 .. Address'Last;
 
   type Storage is array(Memory_Location) of Integer;
 
   package TIO renames Ada.Text_IO;
   package IIO is new TIO.Integer_IO(Integer);
 
   procedure Read_Program(Mem: out Storage) is
      Idx: Memory_Location := 0;
   begin
      while not TIO.End_Of_Line loop
	 IIO.Get(Mem(Idx));
 	 Idx := Idx + 1;
      end loop;
   exception 
      when others => TIO.Put_Line("Reading program: Something went wrong!"); 
   end Read_Program;
 
   procedure Execute_Program(Mem: in out Storage) is
      PC: Integer := 0; 
      function Source return Integer is (Mem(PC));
      function Dest return Integer is (Mem(PC+1));
      function Branch return Integer is (Mem(PC+2));
      function Next return Integer is (PC+3);
   begin
      while PC >= 0 and Steps >= 0 loop
	 Steps := Steps -1;
	 if Source = -1 then 
            declare
               Char: Character;
            begin
               TIO.Get (Char);
               Mem(Dest) := Character'Pos (Char);
            end;
	    PC := Next;
	 elsif Dest = -1 then 
	    TIO.Put(Character'Val(Mem(Source)));
	    PC := Next;
	 else 
	    Mem(Dest) := Mem(Dest) - Mem(Source);
	    if Mem(Dest) <= 0 then  
	       PC := Branch;
	    else
	       PC := Next;
	    end if;
	 end if;
      end loop;
      TIO.Put_Line(if PC >= 0 then "Emergency exit: program stopped!" else "");
    exception
      when others => TIO.Put_Line("Failure when executing Program"); 
   end Execute_Program;
 
   Memory: Storage := (others => 0); 
 
begin
 
   Read_Program(Memory);
   Execute_Program(Memory);
 
end Subleq;
Task: Subleq





Java: import java.util.Scanner;

public class Subleq {

    public static void main(String[] args) {
        int[] mem = {15, 17, -1, 17, -1, -1, 16, 1, -1, 16, 3, -1, 15, 15, 0, 0,
            -1, 72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33, 10, 0};

        Scanner input = new Scanner(System.in);
        int instructionPointer = 0;

        do {
            int a = mem[instructionPointer];
            int b = mem[instructionPointer + 1];

            if (a == -1) {
                mem[b] = input.nextInt();

            } else if (b == -1) {
                System.out.printf("%c", (char) mem[a]);

            } else {

                mem[b] -= mem[a];
                if (mem[b] < 1) {
                    instructionPointer = mem[instructionPointer + 2];
                    continue;
                }
            }

            instructionPointer += 3;

        } while (instructionPointer >= 0);
    }
}







Ada: with Ada.Text_IO;

procedure Subleq is
   
   Storage_Size: constant Positive := 2**8; 
   Steps: Natural := 999; 
 
   subtype Address is Integer range -1 .. (Storage_Size-1);
   subtype Memory_Location is Address range 0 .. Address'Last;
 
   type Storage is array(Memory_Location) of Integer;
 
   package TIO renames Ada.Text_IO;
   package IIO is new TIO.Integer_IO(Integer);
 
   procedure Read_Program(Mem: out Storage) is
      Idx: Memory_Location := 0;
   begin
      while not TIO.End_Of_Line loop
	 IIO.Get(Mem(Idx));
 	 Idx := Idx + 1;
      end loop;
   exception 
      when others => TIO.Put_Line("Reading program: Something went wrong!"); 
   end Read_Program;
 
   procedure Execute_Program(Mem: in out Storage) is
      PC: Integer := 0; 
      function Source return Integer is (Mem(PC));
      function Dest return Integer is (Mem(PC+1));
      function Branch return Integer is (Mem(PC+2));
      function Next return Integer is (PC+3);
   begin
      while PC >= 0 and Steps >= 0 loop
	 Steps := Steps -1;
	 if Source = -1 then 
            declare
               Char: Character;
            begin
               TIO.Get (Char);
               Mem(Dest) := Character'Pos (Char);
            end;
	    PC := Next;
	 elsif Dest = -1 then 
	    TIO.Put(Character'Val(Mem(Source)));
	    PC := Next;
	 else 
	    Mem(Dest) := Mem(Dest) - Mem(Source);
	    if Mem(Dest) <= 0 then  
	       PC := Branch;
	    else
	       PC := Next;
	    end if;
	 end if;
      end loop;
      TIO.Put_Line(if PC >= 0 then "Emergency exit: program stopped!" else "");
    exception
      when others => TIO.Put_Line("Failure when executing Program"); 
   end Execute_Program;
 
   Memory: Storage := (others => 0); 
 
begin
 
   Read_Program(Memory);
   Execute_Program(Memory);
 
end Subleq;
Task: Subleq







Python: import sys

def subleq(a):
    i = 0
    try:
        while i >= 0:
            if a[i] == -1:
                a[a[i + 1]] = ord(sys.stdin.read(1))
            elif a[i + 1] == -1:
                print(chr(a[a[i]]), end="")
            else:
                a[a[i + 1]] -= a[a[i]]
                if a[a[i + 1]] <= 0:
                    i = a[i + 2]
                    continue
            i += 3
    except (ValueError, IndexError, KeyboardInterrupt):
        print("abort")
        print(a)

subleq([15, 17, -1, 17, -1, -1, 16, 1, -1, 16, 3, -1, 15, 15,
        0, 0, -1, 72, 101, 108, 108, 111, 44, 32, 119, 111,
        114, 108, 100, 33, 10, 0])





Ada: with Ada.Text_IO;

procedure Subleq is
   
   Storage_Size: constant Positive := 2**8; 
   Steps: Natural := 999; 
 
   subtype Address is Integer range -1 .. (Storage_Size-1);
   subtype Memory_Location is Address range 0 .. Address'Last;
 
   type Storage is array(Memory_Location) of Integer;
 
   package TIO renames Ada.Text_IO;
   package IIO is new TIO.Integer_IO(Integer);
 
   procedure Read_Program(Mem: out Storage) is
      Idx: Memory_Location := 0;
   begin
      while not TIO.End_Of_Line loop
	 IIO.Get(Mem(Idx));
 	 Idx := Idx + 1;
      end loop;
   exception 
      when others => TIO.Put_Line("Reading program: Something went wrong!"); 
   end Read_Program;
 
   procedure Execute_Program(Mem: in out Storage) is
      PC: Integer := 0; 
      function Source return Integer is (Mem(PC));
      function Dest return Integer is (Mem(PC+1));
      function Branch return Integer is (Mem(PC+2));
      function Next return Integer is (PC+3);
   begin
      while PC >= 0 and Steps >= 0 loop
	 Steps := Steps -1;
	 if Source = -1 then 
            declare
               Char: Character;
            begin
               TIO.Get (Char);
               Mem(Dest) := Character'Pos (Char);
            end;
	    PC := Next;
	 elsif Dest = -1 then 
	    TIO.Put(Character'Val(Mem(Source)));
	    PC := Next;
	 else 
	    Mem(Dest) := Mem(Dest) - Mem(Source);
	    if Mem(Dest) <= 0 then  
	       PC := Branch;
	    else
	       PC := Next;
	    end if;
	 end if;
      end loop;
      TIO.Put_Line(if PC >= 0 then "Emergency exit: program stopped!" else "");
    exception
      when others => TIO.Put_Line("Failure when executing Program"); 
   end Execute_Program;
 
   Memory: Storage := (others => 0); 
 
begin
 
   Read_Program(Memory);
   Execute_Program(Memory);
 
end Subleq;
Task: Subleq

C: #include <stdlib.h>
#include <stdio.h>

void
subleq(int *code)
{
	int ip = 0, a, b, c, nextIP;
	char ch;
	while(0 <= ip) {
		nextIP = ip + 3;
		a = code[ip];
		b = code[ip + 1];
		c = code[ip + 2];
		if(a == -1) {
			scanf("%c", &ch);
			code[b] = (int)ch;
		} else if(b == -1) {
			printf("%c", (char)code[a]);
		} else {
			code[b] -= code[a];
			if(code[b] <= 0)
				nextIP = c;
		}
		ip = nextIP;
	}
}

void
processFile(char *fileName)
{
	int *dataSet, i, num;
	FILE *fp = fopen(fileName, "r");
	fscanf(fp, "%d", &num);
	dataSet = (int *)malloc(num * sizeof(int));
	for(i = 0; i < num; i++)
		fscanf(fp, "%d", &dataSet[i]);
	fclose(fp);
	subleq(dataSet);
}

int
main(int argC, char *argV[])
{
	if(argC != 2)
		printf("Usage : %s <subleq code file>\n", argV[0]);
	else
		processFile(argV[1]);
	return 0;
}
Task: Subleq



C#: using System;

namespace Subleq {
    class Program {
        static void Main(string[] args) {
            int[] mem = {
                15, 17, -1, 17, -1, -1, 16, 1, -1, 16,
                3, -1, 15, 15, 0, 0, -1, 72, 101, 108,
                108, 111, 44, 32, 119, 111, 114, 108, 100, 33,
                10, 0,
            };

            int instructionPointer = 0;

            do {
                int a = mem[instructionPointer];
                int b = mem[instructionPointer + 1];

                if (a == -1) {
                    mem[b] = Console.Read();
                }
                else if (b == -1) {
                    Console.Write((char)mem[a]);
                }
                else {
                    mem[b] -= mem[a];
                    if (mem[b] < 1) {
                        instructionPointer = mem[instructionPointer + 2];
                        continue;
                    }
                }

                instructionPointer += 3;
            } while (instructionPointer >= 0);
        }
    }
}