WeixiangYan/CodeTransOcean huggingface dataset:
Task: Determine if two triangles overlap


C++: #include <vector>
#include <iostream>
#include <stdexcept>
using namespace std;

typedef std::pair<double, double> TriPoint;

inline double Det2D(TriPoint &p1, TriPoint &p2, TriPoint &p3) 
{
	return +p1.first*(p2.second-p3.second)
		+p2.first*(p3.second-p1.second)
		+p3.first*(p1.second-p2.second);
}

void CheckTriWinding(TriPoint &p1, TriPoint &p2, TriPoint &p3, bool allowReversed)
{
	double detTri = Det2D(p1, p2, p3);
	if(detTri < 0.0)
	{
		if (allowReversed)
		{
			TriPoint a = p3;
			p3 = p2;
			p2 = a;
		}
		else throw std::runtime_error("triangle has wrong winding direction");
	}
}

bool BoundaryCollideChk(TriPoint &p1, TriPoint &p2, TriPoint &p3, double eps)
{
	return Det2D(p1, p2, p3) < eps;
}

bool BoundaryDoesntCollideChk(TriPoint &p1, TriPoint &p2, TriPoint &p3, double eps)
{
	return Det2D(p1, p2, p3) <= eps;
}

bool TriTri2D(TriPoint *t1,
	TriPoint *t2,
	double eps = 0.0, bool allowReversed = false, bool onBoundary = true)
{
	
	CheckTriWinding(t1[0], t1[1], t1[2], allowReversed);
	CheckTriWinding(t2[0], t2[1], t2[2], allowReversed);

	bool (*chkEdge)(TriPoint &, TriPoint &, TriPoint &, double) = NULL;
	if(onBoundary) 
		chkEdge = BoundaryCollideChk;
	else 
		chkEdge = BoundaryDoesntCollideChk;

	
	for(int i=0; i<3; i++)
	{
		int j=(i+1)%3;

		
		
		if (chkEdge(t1[i], t1[j], t2[0], eps) &&
			chkEdge(t1[i], t1[j], t2[1], eps) &&
			chkEdge(t1[i], t1[j], t2[2], eps))
			return false;
	}

	
	for(int i=0; i<3; i++)
	{
		int j=(i+1)%3;

		
		
		if (chkEdge(t2[i], t2[j], t1[0], eps) &&
			chkEdge(t2[i], t2[j], t1[1], eps) &&
			chkEdge(t2[i], t2[j], t1[2], eps))
			return false;
	}

	
	return true;
}

int main()
{
	{TriPoint t1[] = {TriPoint(0,0),TriPoint(5,0),TriPoint(0,5)};
	TriPoint t2[] = {TriPoint(0,0),TriPoint(5,0),TriPoint(0,6)};
	cout << TriTri2D(t1, t2) << "," << true << endl;}

	{TriPoint t1[] = {TriPoint(0,0),TriPoint(0,5),TriPoint(5,0)};
	TriPoint t2[] = {TriPoint(0,0),TriPoint(0,5),TriPoint(5,0)};
	cout << TriTri2D(t1, t2, 0.0, true) << "," << true << endl;}

	{TriPoint t1[] = {TriPoint(0,0),TriPoint(5,0),TriPoint(0,5)};
	TriPoint t2[] = {TriPoint(-10,0),TriPoint(-5,0),TriPoint(-1,6)};
	cout << TriTri2D(t1, t2) << "," << false << endl;}

	{TriPoint t1[] = {TriPoint(0,0),TriPoint(5,0),TriPoint(2.5,5)};
	TriPoint t2[] = {TriPoint(0,4),TriPoint(2.5,-1),TriPoint(5,4)};
	cout << TriTri2D(t1, t2) << "," << true << endl;}

	{TriPoint t1[] = {TriPoint(0,0),TriPoint(1,1),TriPoint(0,2)};
	TriPoint t2[] = {TriPoint(2,1),TriPoint(3,0),TriPoint(3,2)};
	cout << TriTri2D(t1, t2) << "," << false << endl;}

	{TriPoint t1[] = {TriPoint(0,0),TriPoint(1,1),TriPoint(0,2)};
	TriPoint t2[] = {TriPoint(2,1),TriPoint(3,-2),TriPoint(3,4)};
	cout << TriTri2D(t1, t2) << "," << false << endl;}

	
	{TriPoint t1[] = {TriPoint(0,0),TriPoint(1,0),TriPoint(0,1)};
	TriPoint t2[] = {TriPoint(1,0),TriPoint(2,0),TriPoint(1,1)};
	cout << TriTri2D(t1, t2, 0.0, false, true) << "," << true << endl;}

	
	{TriPoint t1[] = {TriPoint(0,0),TriPoint(1,0),TriPoint(0,1)};
	TriPoint t2[] = {TriPoint(1,0),TriPoint(2,0),TriPoint(1,1)};
	cout << TriTri2D(t1, t2, 0.0, false, false) << "," << false << endl;}

}
Task: Determine if two triangles overlap







Python: from __future__ import print_function
import numpy as np

def CheckTriWinding(tri, allowReversed):
	trisq = np.ones((3,3))
	trisq[:,0:2] = np.array(tri)
	detTri = np.linalg.det(trisq)
	if detTri < 0.0:
		if allowReversed:
			a = trisq[2,:].copy()
			trisq[2,:] = trisq[1,:]
			trisq[1,:] = a
		else: raise ValueError("triangle has wrong winding direction")
	return trisq

def TriTri2D(t1, t2, eps = 0.0, allowReversed = False, onBoundary = True):
	
	t1s = CheckTriWinding(t1, allowReversed)
	t2s = CheckTriWinding(t2, allowReversed)

	if onBoundary:
		
		chkEdge = lambda x: np.linalg.det(x) < eps
	else:
		
		chkEdge = lambda x: np.linalg.det(x) <= eps

	
	for i in range(3):
		edge = np.roll(t1s, i, axis=0)[:2,:]

		
		
		if (chkEdge(np.vstack((edge, t2s[0]))) and
			chkEdge(np.vstack((edge, t2s[1]))) and  
			chkEdge(np.vstack((edge, t2s[2])))):
			return False

	
	for i in range(3):
		edge = np.roll(t2s, i, axis=0)[:2,:]

		
		
		if (chkEdge(np.vstack((edge, t1s[0]))) and
			chkEdge(np.vstack((edge, t1s[1]))) and  
			chkEdge(np.vstack((edge, t1s[2])))):
			return False

	
	return True

if __name__=="__main__":
	t1 = [[0,0],[5,0],[0,5]]
	t2 = [[0,0],[5,0],[0,6]]
	print (TriTri2D(t1, t2), True)

	t1 = [[0,0],[0,5],[5,0]]
	t2 = [[0,0],[0,6],[5,0]]
	print (TriTri2D(t1, t2, allowReversed = True), True)

	t1 = [[0,0],[5,0],[0,5]]
	t2 = [[-10,0],[-5,0],[-1,6]]
	print (TriTri2D(t1, t2), False)

	t1 = [[0,0],[5,0],[2.5,5]]
	t2 = [[0,4],[2.5,-1],[5,4]]
	print (TriTri2D(t1, t2), True)

	t1 = [[0,0],[1,1],[0,2]]
	t2 = [[2,1],[3,0],[3,2]]
	print (TriTri2D(t1, t2), False)

	t1 = [[0,0],[1,1],[0,2]]
	t2 = [[2,1],[3,-2],[3,4]]
	print (TriTri2D(t1, t2), False)

	
	t1 = [[0,0],[1,0],[0,1]]
	t2 = [[1,0],[2,0],[1,1]]
	print (TriTri2D(t1, t2, onBoundary = True), True)

	
	t1 = [[0,0],[1,0],[0,1]]
	t2 = [[1,0],[2,0],[1,1]]
	print (TriTri2D(t1, t2, onBoundary = False), False)
Task: Sudoku

C: #include <stdio.h>

void show(int *x)
{
	int i, j;
	for (i = 0; i < 9; i++) {
		if (!(i % 3)) putchar('\n');
		for (j = 0; j < 9; j++)
			printf(j % 3 ? "%2d" : "%3d", *x++);
		putchar('\n');
	}
}

int trycell(int *x, int pos)
{
	int row = pos / 9;
	int col = pos % 9;
	int i, j, used = 0;

	if (pos == 81) return 1;
	if (x[pos]) return trycell(x, pos + 1);

	for (i = 0; i < 9; i++)
		used |= 1 << (x[i * 9 + col] - 1);

	for (j = 0; j < 9; j++)
		used |= 1 << (x[row * 9 + j] - 1);

	row = row / 3 * 3;
	col = col / 3 * 3;
	for (i = row; i < row + 3; i++)
		for (j = col; j < col + 3; j++)
			used |= 1 << (x[i * 9 + j] - 1);

	for (x[pos] = 1; x[pos] <= 9; x[pos]++, used >>= 1)
		if (!(used & 1) && trycell(x, pos + 1)) return 1;

	x[pos] = 0;
	return 0;
}

void solve(const char *s)
{
	int i, x[81];
	for (i = 0; i < 81; i++)
		x[i] = s[i] >= '1' && s[i] <= '9' ? s[i] - '0' : 0;

	if (trycell(x, 0))
		show(x);
	else
		puts("no solution");
}

int main(void)
{
	solve(	"5x..7...."
		"6..195..."
		".98....6."
		"8...6...3"
		"4..8.3..1"
		"7...2...6"
		".6....28."
		"...419..5"
		"....8..79"	);

	return 0;
}
Task: Sudoku



C#: using System;

class SudokuSolver
{
    private int[] grid;

    public SudokuSolver(String s)
    {
        grid = new int[81];
        for (int i = 0; i < s.Length; i++)
        {
            grid[i] = int.Parse(s[i].ToString());
        }
    }

    public void solve()
    {
        try
        {
            placeNumber(0);
            Console.WriteLine("Unsolvable!");
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
            Console.WriteLine(this);
        }
    }

    public void placeNumber(int pos)
    {
        if (pos == 81)
        {
            throw new Exception("Finished!");
        }
        if (grid[pos] > 0)
        {
            placeNumber(pos + 1);
            return;
        }
        for (int n = 1; n <= 9; n++)
        {
            if (checkValidity(n, pos % 9, pos / 9))
            {
                grid[pos] = n;
                placeNumber(pos + 1);
                grid[pos] = 0;
            }
        }
    }

    public bool checkValidity(int val, int x, int y)
    {
        for (int i = 0; i < 9; i++)
        {
            if (grid[y * 9 + i] == val || grid[i * 9 + x] == val)
                return false;
        }
        int startX = (x / 3) * 3;
        int startY = (y / 3) * 3;
        for (int i = startY; i < startY + 3; i++)
        {
            for (int j = startX; j < startX + 3; j++)
            {
                if (grid[i * 9 + j] == val)
                    return false;
            }
        }
        return true;
    }

    public override string ToString()
    {
        string sb = "";
        for (int i = 0; i < 9; i++)
        {
            for (int j = 0; j < 9; j++)
            {
                sb += (grid[i * 9 + j] + " ");
                if (j == 2 || j == 5)
                    sb += ("| ");
            }
            sb += ('\n');
            if (i == 2 || i == 5)
                sb += ("------+-------+------\n");
        }
        return sb;
    }

    public static void Main(String[] args)
    {
        new SudokuSolver("850002400" +
                         "720000009" +
                         "004000000" +
                         "000107002" +
                         "305000900" +
                         "040000000" +
                         "000080070" +
                         "017000000" +
                         "000036040").solve();
        Console.Read();
    }
}
Task: Sudoku


C++: #include <iostream>
using namespace std;

class SudokuSolver {
private:
    int grid[81];

public:

    SudokuSolver(string s) {
        for (unsigned int i = 0; i < s.length(); i++) {
            grid[i] = (int) (s[i] - '0');
        }
    }

    void solve() {
        try {
            placeNumber(0);
            cout << "Unsolvable!" << endl;
        } catch (char* ex) {
            cout << ex << endl;
            cout << this->toString() << endl;
        }
    }

    void placeNumber(int pos) {
        if (pos == 81) {
            throw (char*) "Finished!";
        }
        if (grid[pos] > 0) {
            placeNumber(pos + 1);
            return;
        }
        for (int n = 1; n <= 9; n++) {
            if (checkValidity(n, pos % 9, pos / 9)) {
                grid[pos] = n;
                placeNumber(pos + 1);
                grid[pos] = 0;
            }
        }
    }

    bool checkValidity(int val, int x, int y) {
        for (int i = 0; i < 9; i++) {
            if (grid[y * 9 + i] == val || grid[i * 9 + x] == val)
                return false;
        }
        int startX = (x / 3) * 3;
        int startY = (y / 3) * 3;
        for (int i = startY; i < startY + 3; i++) {
            for (int j = startX; j < startX + 3; j++) {
                if (grid[i * 9 + j] == val)
                    return false;
            }
        }
        return true;
    }

    string toString() {
        string sb;
        for (int i = 0; i < 9; i++) {
            for (int j = 0; j < 9; j++) {
                char c[2];
                c[0] = grid[i * 9 + j] + '0';
                c[1] = '\0';
                sb.append(c);
                sb.append(" ");
                if (j == 2 || j == 5)
                    sb.append("| ");
            }
            sb.append("\n");
            if (i == 2 || i == 5)
                sb.append("------+-------+------\n");
        }
        return sb;
    }

};

int main() {
    SudokuSolver ss("850002400"
                    "720000009"
                    "004000000"
                    "000107002"
                    "305000900"
                    "040000000"
                    "000080070"
                    "017000000"
                    "000036040");
    ss.solve();
    return EXIT_SUCCESS;
}
Task: Sudoku







Python: def initiate():
    box.append([0, 1, 2, 9, 10, 11, 18, 19, 20])
    box.append([3, 4, 5, 12, 13, 14, 21, 22, 23])
    box.append([6, 7, 8, 15, 16, 17, 24, 25, 26])
    box.append([27, 28, 29, 36, 37, 38, 45, 46, 47])
    box.append([30, 31, 32, 39, 40, 41, 48, 49, 50])
    box.append([33, 34, 35, 42, 43, 44, 51, 52, 53])
    box.append([54, 55, 56, 63, 64, 65, 72, 73, 74])
    box.append([57, 58, 59, 66, 67, 68, 75, 76, 77])
    box.append([60, 61, 62, 69, 70, 71, 78, 79, 80])
    for i in range(0, 81, 9):
        row.append(range(i, i+9))
    for i in range(9):
        column.append(range(i, 80+i, 9))

def valid(n, pos):
    current_row = pos/9
    current_col = pos%9
    current_box = (current_row/3)*3 + (current_col/3)
    for i in row[current_row]:
        if (grid[i] == n):
            return False
    for i in column[current_col]:
        if (grid[i] == n):
            return False
    for i in box[current_box]:
        if (grid[i] == n):
            return False
    return True

def solve():
    i = 0
    proceed = 1
    while(i < 81):
        if given[i]:
            if proceed:
                    i += 1
            else:
                i -= 1
        else:
            n = grid[i]
            prev = grid[i]
            while(n < 9):
              if (n < 9):
                  n += 1
              if valid(n, i):
                  grid[i] = n
                  proceed = 1
                  break
            if (grid[i] == prev):
               grid[i] = 0
               proceed = 0
            if proceed:
               i += 1
            else:
               i -=1

def inputs():
    nextt = 'T'
    number = 0
    pos = 0
    while(not(nextt == 'N' or nextt == 'n')):
        print "Enter the position:",
        pos = int(raw_input())
        given[pos - 1] = True
        print "Enter the numerical:",
        number = int(raw_input())
        grid[pos - 1] = number
        print "Do you want to enter another given?(Y, for yes: N, for no)"
        nextt = raw_input()


grid = [0]*81
given = [False]*81
box = []
row = []
column = []
initiate()
inputs()
solve()
for i in range(9):
    print grid[i*9:i*9+9]
raw_input()
Task: Sudoku








VB: Dim grid(9, 9)
Dim gridSolved(9, 9)

Public Sub Solve(i, j)
  If i > 9 Then
    
    For r = 1 To 9
      For c = 1 To 9
        gridSolved(r, c) = grid(r, c)
      Next c
    Next r
    Exit Sub
  End If
  For n = 1 To 9
    If isSafe(i, j, n) Then
      nTmp = grid(i, j)
      grid(i, j) = n
      If j = 9 Then
        Solve i + 1, 1
      Else
        Solve i, j + 1
      End If
      grid(i, j) = nTmp
    End If
  Next n
End Sub

Public Function isSafe(i, j, n) As Boolean
Dim iMin As Integer
Dim jMin As Integer

If grid(i, j) <> 0 Then
  isSafe = (grid(i, j) = n)
  Exit Function
End If



For c = 1 To 9
  If grid(i, c) = n Then
    isSafe = False
    Exit Function
  End If
Next c


For r = 1 To 9
 If grid(r, j) = n Then
   isSafe = False
   Exit Function
 End If
Next r


iMin = 1 + 3 * Int((i - 1) / 3)
jMin = 1 + 3 * Int((j - 1) / 3)
For r = iMin To iMin + 2
  For c = jMin To jMin + 2
    If grid(r, c) = n Then
      isSafe = False
      Exit Function
    End If
  Next c
Next r


isSafe = True
End Function

Public Sub Sudoku()
  
  
  

  Dim s(9) As String

  
  s(1) = "001005070"
  s(2) = "920600000"
  s(3) = "008000600"
  s(4) = "090020401"
  s(5) = "000000000"
  s(6) = "304080090"
  s(7) = "007000300"
  s(8) = "000007069"
  s(9) = "010800700"
  For i = 1 To 9
    For j = 1 To 9
      grid(i, j) = Int(Val(Mid$(s(i), j, 1)))
    Next j
  Next i
  
  Solve 1, 1
  
  Debug.Print "Solution:"
  For i = 1 To 9
    For j = 1 To 9
      Debug.Print Format$(gridSolved(i, j)); " ";
    Next j
    Debug.Print
  Next i
End Sub
Task: Sudoku






PHP: 	class SudokuSolver {
		protected $grid = [];
		protected $emptySymbol;
		public static function parseString($str, $emptySymbol = '0')
		{
			$grid = str_split($str);
			foreach($grid as &$v)
			{
				if($v == $emptySymbol)
				{
					$v = 0;
				}
				else
				{
					$v = (int)$v;
				}
			}
			return $grid;
		}
		
		public function __construct($str, $emptySymbol = '0') {
			if(strlen($str) !== 81)
			{
				throw new \Exception('Error sudoku');
			}
			$this->grid = static::parseString($str, $emptySymbol);
			$this->emptySymbol = $emptySymbol;
		}
		
		public function solve()
		{
			try
			{
				$this->placeNumber(0);
				return false;
			}
			catch(\Exception $e)
			{
				return true;
			}
		}
		
		protected function placeNumber($pos)
		{
			if($pos == 81)
			{
				throw new \Exception('Finish');
			}
			if($this->grid[$pos] > 0)
			{
				$this->placeNumber($pos+1);
				return;
			}
			for($n = 1; $n <= 9; $n++)
			{
				if($this->checkValidity($n, $pos%9, floor($pos/9)))
				{
					$this->grid[$pos] = $n;
					$this->placeNumber($pos+1);
					$this->grid[$pos] = 0;
				}
			}
		}
		
		protected function checkValidity($val, $x, $y)
		{
			for($i = 0; $i < 9; $i++)
			{
				if(($this->grid[$y*9+$i] == $val) || ($this->grid[$i*9+$x] == $val))
				{
					return false;
				}
			}
			$startX = (int) ((int)($x/3)*3);
			$startY = (int) ((int)($y/3)*3);

			for($i = $startY; $i<$startY+3;$i++)
			{
				for($j = $startX; $j<$startX+3;$j++)
				{
					if($this->grid[$i*9+$j] == $val)
					{
						return false;
					}
				}
			}
			return true;
		}

		public function display() {
			$str = '';
			for($i = 0; $i<9; $i++)
			{
				for($j = 0; $j<9;$j++)
				{
					$str .= $this->grid[$i*9+$j];
					$str .= " ";
					if($j == 2 || $j == 5)
					{
						$str .= "| ";
					}
				}
				$str .= PHP_EOL;
				if($i == 2 || $i == 5)
				{
					$str .=  "------+-------+------".PHP_EOL;
				}
			}
			echo $str;
		}
		
		public function __toString() {
			foreach ($this->grid as &$item)
			{
				if($item == 0)
				{
					$item = $this->emptySymbol;
				}
			}
			return implode('', $this->grid);
		}
	}
	$solver = new SudokuSolver('009170000020600001800200000200006053000051009005040080040000700006000320700003900');
	$solver->solve();
	$solver->display();
Task: Hello world_Newline omission



C#: using System;

class Program
{
    static void Main(string[] args)
    {
        
        Console.WriteLine("Goodbye, World!");

        
        Console.Write("Goodbye, World!");
    }
}









Ada: with Ada.Text_IO;

procedure Goodbye_World is
begin
   Ada.Text_IO.Put("Goodbye, World!");
end Goodbye_World;
Task: Hello world_Newline omission

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

int main(int argc, char *argv[]) {
  (void) printf("Goodbye, World!");    
  return EXIT_SUCCESS;
}











Ada: with Ada.Text_IO;

procedure Goodbye_World is
begin
   Ada.Text_IO.Put("Goodbye, World!");
end Goodbye_World;
Task: Hello world_Newline omission


C++: #include <iostream>

int main() {
  std::cout << "Goodbye, World!";
  return 0;
}










Ada: with Ada.Text_IO;

procedure Goodbye_World is
begin
   Ada.Text_IO.Put("Goodbye, World!");
end Goodbye_World;
Task: Hello world_Newline omission




Go: package main

import "fmt"

func main() { fmt.Print("Goodbye, World!") }








Ada: with Ada.Text_IO;

procedure Goodbye_World is
begin
   Ada.Text_IO.Put("Goodbye, World!");
end Goodbye_World;
Task: Hello world_Newline omission





Java: public class HelloWorld
{
 public static void main(String[] args)
 {
  System.out.print("Goodbye, World!");
 }
}







Ada: with Ada.Text_IO;

procedure Goodbye_World is
begin
   Ada.Text_IO.Put("Goodbye, World!");
end Goodbye_World;
Task: Hello world_Newline omission







Python: import sys
sys.stdout.write("Goodbye, World!")





Ada: with Ada.Text_IO;

procedure Goodbye_World is
begin
   Ada.Text_IO.Put("Goodbye, World!");
end Goodbye_World;
Task: Hello world_Newline omission








VB: Module Module1

    Sub Main()
        Console.Write("Goodbye, World!")
    End Sub

End Module




Ada: with Ada.Text_IO;

procedure Goodbye_World is
begin
   Ada.Text_IO.Put("Goodbye, World!");
end Goodbye_World;
Task: Hello world_Newline omission

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

int main(int argc, char *argv[]) {
  (void) printf("Goodbye, World!");    
  return EXIT_SUCCESS;
}
Task: Hello world_Newline omission



C#: using System;

class Program
{
    static void Main(string[] args)
    {
        
        Console.WriteLine("Goodbye, World!");

        
        Console.Write("Goodbye, World!");
    }
}
Task: Hello world_Newline omission


C++: #include <iostream>

int main() {
  std::cout << "Goodbye, World!";
  return 0;
}
Task: Hello world_Newline omission





Java: public class HelloWorld
{
 public static void main(String[] args)
 {
  System.out.print("Goodbye, World!");
 }
}
Task: Hello world_Newline omission








VB: Module Module1

    Sub Main()
        Console.Write("Goodbye, World!")
    End Sub

End Module
Task: Hello world_Newline omission




Go: package main

import "fmt"

func main() { fmt.Print("Goodbye, World!") }
Task: Hello world_Newline omission







Python: import sys
sys.stdout.write("Goodbye, World!")
Task: Hello world_Newline omission



C#: using System;

class Program
{
    static void Main(string[] args)
    {
        
        Console.WriteLine("Goodbye, World!");

        
        Console.Write("Goodbye, World!");
    }
}








Fortran: program bye
  write (*,'(a)',advance='no') 'Goodbye, World
end program bye
Task: Hello world_Newline omission


C++: #include <iostream>

int main() {
  std::cout << "Goodbye, World!";
  return 0;
}









Fortran: program bye
  write (*,'(a)',advance='no') 'Goodbye, World
end program bye
Task: Hello world_Newline omission

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

int main(int argc, char *argv[]) {
  (void) printf("Goodbye, World!");    
  return EXIT_SUCCESS;
}










Fortran: program bye
  write (*,'(a)',advance='no') 'Goodbye, World
end program bye
Task: Hello world_Newline omission




Go: package main

import "fmt"

func main() { fmt.Print("Goodbye, World!") }







Fortran: program bye
  write (*,'(a)',advance='no') 'Goodbye, World
end program bye
Task: Hello world_Newline omission





Java: public class HelloWorld
{
 public static void main(String[] args)
 {
  System.out.print("Goodbye, World!");
 }
}






Fortran: program bye
  write (*,'(a)',advance='no') 'Goodbye, World
end program bye
Task: Hello world_Newline omission







Python: import sys
sys.stdout.write("Goodbye, World!")




Fortran: program bye
  write (*,'(a)',advance='no') 'Goodbye, World
end program bye
Task: Hello world_Newline omission








VB: Module Module1

    Sub Main()
        Console.Write("Goodbye, World!")
    End Sub

End Module



Fortran: program bye
  write (*,'(a)',advance='no') 'Goodbye, World
end program bye
Task: Hello world_Newline omission






PHP: echo "Goodbye, World !";





Fortran: program bye
  write (*,'(a)',advance='no') 'Goodbye, World
end program bye
Task: Hello world_Newline omission

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

int main(int argc, char *argv[]) {
  (void) printf("Goodbye, World!");    
  return EXIT_SUCCESS;
}









COBOL: IDENTIFICATION DIVISION.
PROGRAM-ID. GOODBYE-WORLD.

PROCEDURE DIVISION.
DISPLAY 'Goodbye, World!'
    WITH NO ADVANCING
END-DISPLAY
.
STOP RUN.
Task: Hello world_Newline omission



C#: using System;

class Program
{
    static void Main(string[] args)
    {
        
        Console.WriteLine("Goodbye, World!");

        
        Console.Write("Goodbye, World!");
    }
}







COBOL: IDENTIFICATION DIVISION.
PROGRAM-ID. GOODBYE-WORLD.

PROCEDURE DIVISION.
DISPLAY 'Goodbye, World!'
    WITH NO ADVANCING
END-DISPLAY
.
STOP RUN.
Task: Hello world_Newline omission


C++: #include <iostream>

int main() {
  std::cout << "Goodbye, World!";
  return 0;
}








COBOL: IDENTIFICATION DIVISION.
PROGRAM-ID. GOODBYE-WORLD.

PROCEDURE DIVISION.
DISPLAY 'Goodbye, World!'
    WITH NO ADVANCING
END-DISPLAY
.
STOP RUN.
Task: Hello world_Newline omission





Java: public class HelloWorld
{
 public static void main(String[] args)
 {
  System.out.print("Goodbye, World!");
 }
}





COBOL: IDENTIFICATION DIVISION.
PROGRAM-ID. GOODBYE-WORLD.

PROCEDURE DIVISION.
DISPLAY 'Goodbye, World!'
    WITH NO ADVANCING
END-DISPLAY
.
STOP RUN.
Task: Hello world_Newline omission







Python: import sys
sys.stdout.write("Goodbye, World!")



COBOL: IDENTIFICATION DIVISION.
PROGRAM-ID. GOODBYE-WORLD.

PROCEDURE DIVISION.
DISPLAY 'Goodbye, World!'
    WITH NO ADVANCING
END-DISPLAY
.
STOP RUN.
Task: Hello world_Newline omission








VB: Module Module1

    Sub Main()
        Console.Write("Goodbye, World!")
    End Sub

End Module


COBOL: IDENTIFICATION DIVISION.
PROGRAM-ID. GOODBYE-WORLD.

PROCEDURE DIVISION.
DISPLAY 'Goodbye, World!'
    WITH NO ADVANCING
END-DISPLAY
.
STOP RUN.
Task: Hello world_Newline omission




Go: package main

import "fmt"

func main() { fmt.Print("Goodbye, World!") }






COBOL: IDENTIFICATION DIVISION.
PROGRAM-ID. GOODBYE-WORLD.

PROCEDURE DIVISION.
DISPLAY 'Goodbye, World!'
    WITH NO ADVANCING
END-DISPLAY
.
STOP RUN.
Task: Hello world_Newline omission






PHP: echo "Goodbye, World !";






Ada: with Ada.Text_IO;

procedure Goodbye_World is
begin
   Ada.Text_IO.Put("Goodbye, World!");
end Goodbye_World;
Task: Hello world_Newline omission






PHP: echo "Goodbye, World !";
Task: Hello world_Newline omission






PHP: echo "Goodbye, World !";




COBOL: IDENTIFICATION DIVISION.
PROGRAM-ID. GOODBYE-WORLD.

PROCEDURE DIVISION.
DISPLAY 'Goodbye, World!'
    WITH NO ADVANCING
END-DISPLAY
.
STOP RUN.