Hello, World!

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type

Welcome to the DMOJ!

In this task, you must print out the message Hello, World! — the judge is very strict, so you must output it with the same capitalization and punctuation.

Some example solutions in a couple of languages are shown below. After you've gotten the hang of submitting, try out a harder problem like A Plus B.

Python 2/3

print("Hello, World!")


public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");


#include <iostream>

using namespace std;

int main() {
    cout << "Hello, World!" << endl;
    return 0;


#include <stdio.h>

int main() {
    printf("Hello, World!\n");
    return 0;


program helloworld;
  writeln('Hello, World!');

JavaScript (Node.js)

console.log('Hello, World!');

JavaScript (V8)

print('Hello, World!');


put "Hello, World!"


main = putStrLn "Hello, World!"


print "Hello, World!\n";


    echo "Hello, World!\n";


using System;

class HelloWorld {
    public static void Main(string[] args) {
        Console.WriteLine("Hello, World!");


import std.stdio;

void main() {
    writeln("Hello, World!");


package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")


object helloworld extends App {
    println("Hello, World!")


print("Hello, World!")


fun main(args: Array<String>) {
    print("Hello, World!")


#lang racket
(displayln "Hello, World!")


puts 'Hello, World!'


fn main() {
    println!("Hello, World!");


print_string "Hello, World!\n";

NASM x86

section .text
global _start

        mov     eax,    4
        xor     ebx,    ebx
        inc     ebx
        mov     ecx,    msg
        mov     edx,    len
        int     80h

        xor     eax,    eax
        inc     eax
        xor     ebx,    ebx
        int     80h

section .data
        msg     db      "Hello, World!", 0xA
        len     equ     $ - msg


  • -1
    Weifeng_Wang  commented on Feb. 21, 2024, 2:11 a.m.



  • 0
    WenhanZhang  commented on Oct. 20, 2023, 4:41 p.m.

    this is must be known as the beginner question

  • -29
    Jinx  commented on Sept. 23, 2023, 8:35 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.

  • 5
    Nyuu  commented on May 19, 2023, 12:09 a.m.

    Here is a solution in llvm-ir

    @formatString = private constant [15 x i8] c"Hello, World!\0A\00"
    declare i32 @printf(i8* nocapture, ...)
    define i32 @main() {
        call i32 (i8*, ...) @printf(i8* getelementptr ([15 x i8], [15 x i8]* @formatString, i32 0, i32 0))
        ret i32 0

  • 23
    devnarula  commented on Dec. 31, 2021, 12:24 a.m.

    Instructions unclear. I hacked into NASA

    • -6
      kresteodymium  commented on March 21, 2022, 2:02 a.m.

      This comment is hidden due to too much negative feedback. Show it anyway.

    • 3
      gavin_chen  commented on March 20, 2022, 6:06 p.m.

      Dang did you see plans on going to Mars?

    • 5
      thomas_li  commented on Dec. 31, 2021, 4:17 a.m.

      devnarula ORZZZZZZZZZ

  • 7
    tsingchen2008  commented on Aug. 6, 2020, 3:33 a.m.

    Hello, World!

    • 169
      doruuu  commented on Aug. 6, 2020, 6:34 p.m.

      Please refrain from putting problem solutions in the comments.

  • 6
    Togohogo1  commented on Jan. 3, 2020, 5:35 p.m. edit 7

    Languages that I can't AC in:

    1. Groovy
    2. Sed

    Groovy has an actual AC submission but not a single AC for Sed.

  • 17
    quentin9909  commented on April 15, 2019, 5:06 p.m. edited

    BrainF Answer


    • 34
      hxxr  commented on Aug. 19, 2019, 1:33 a.m. edited

      Shorter BF solution


  • -84
    qcminecraft  commented on Aug. 26, 2018, 1:20 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.

  • -36
    Raymo111  commented on Aug. 7, 2018, 11:40 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.

  • 38
    quantum  commented on Aug. 23, 2017, 3:00 p.m. edited

    Please note that comments are not for extended discussion.

    The DMOJ Discord Server exists for this purpose, and should be used if you want to ask questions or otherwise make comments that are unlikely to benefit other readers. This includes discussing problem spoilers or requests to debug code.

    Violation of this may result in your comments being removed. Repeat offenders may be muted.

  • 37
    root  commented on Sept. 26, 2016, 2:58 a.m. edit 3

    There's me with assembly trying every bit of performance voodoo magic known to man. And then there's that guy with python2 four places above me who simply did "print 'Hello, World!'". Then comes the depressing realization that I literally spent more than two hours on a hello world program...

    • 28
      moladan123  commented on Sept. 26, 2016, 9:39 p.m.

      Look on the bright side. You just made hello world run in only 4 kilobytes.

  • -36
    moladan123  commented on Jan. 24, 2015, 11:23 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.

    • 9
      quantum  commented on Jan. 24, 2015, 11:25 p.m.

      The best submissions does this already. Besides, it is trivially doable in some languages, most notably assembly.

  • 62
    Get_Shrekd_Fedora_Scrublord  commented on Nov. 14, 2014, 7:20 p.m.

    This is too challenging for most people. It's unreasonable to think you can keep the memory under 64M. Petition to remove this problem from the Internet.

    • -16
      python6645  commented on Nov. 29, 2020, 12:47 a.m.

      This comment is hidden due to too much negative feedback. Show it anyway.

    • 28
      Kyddlygon1_9  commented on Nov. 19, 2014, 4:24 p.m.

      After carefully rereading the problem's requirements over and over again, I have concluded that you are in fact correct. I will gladly sign such a petition, if only to ease the pain one must suffer staying up long nights trying to complete this unfeasible project. My sentiments out to all families who have fallen victim to this terrible request.