kazuyamaa/multi-language-messages-01 huggingface dataset:
Task: Narcissistic decimal number
Java: public class Narc{
	public static boolean isNarc(long x){
		if(x < 0) return false;
		
		String xStr = Long.toString(x);
		int m = xStr.length();
		long sum = 0;
		
		for(char c : xStr.toCharArray()){
			sum += Math.pow(Character.digit(c, 10), m);
		}
		return sum == x;
	}

	public static void main(String[] args){
		for(long x = 0, count = 0; count < 25; x++){
			if(isNarc(x)){
				System.out.print(x + " ");
				count++;
			}
		}
	}
}

Python: from __future__ import print_function
from itertools import count, islice

def narcissists():
    for digits in count(0):
        digitpowers = [i**digits for i in range(10)]
        for n in range(int(10**(digits-1)), 10**digits):
            div, digitpsum = n, 0
            while div:
                div, mod = divmod(div, 10)
                digitpsum += digitpowers[mod]
            if n == digitpsum:
                yield n

for i, n in enumerate(islice(narcissists(), 25), 1):
    print(n, end=' ')
    if i % 5 == 0: print() 
print()
Task: Narcissistic decimal number
Java: public class Narc{
	public static boolean isNarc(long x){
		if(x < 0) return false;
		
		String xStr = Long.toString(x);
		int m = xStr.length();
		long sum = 0;
		
		for(char c : xStr.toCharArray()){
			sum += Math.pow(Character.digit(c, 10), m);
		}
		return sum == x;
	}

	public static void main(String[] args){
		for(long x = 0, count = 0; count < 25; x++){
			if(isNarc(x)){
				System.out.print(x + " ");
				count++;
			}
		}
	}
}

VB: Private Function narcissistic(n As Long) As Boolean
    Dim d As String: d = CStr(n)
    Dim l As Integer: l = Len(d)
    Dim sumn As Long: sumn = 0
    For i = 1 To l
        sumn = sumn + (Mid(d, i, 1) - "0") ^ l
    Next i
    narcissistic = sumn = n
End Function

Public Sub main()
    Dim s(24) As String
    Dim n As Long: n = 0
    Dim found As Integer: found = 0
    Do While found < 25
        If narcissistic(n) Then
            s(found) = CStr(n)
            found = found + 1
        End If
        n = n + 1
    Loop
    Debug.Print Join(s, ", ")
End Sub
Task: Narcissistic decimal number
Go: package main

import "fmt"

func narc(n int) []int {
	power := [...]int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
	limit := 10
	result := make([]int, 0, n)
	for x := 0; len(result) < n; x++ {
		if x >= limit {
			for i := range power {
				power[i] *= i 
			}
			limit *= 10
		}
		sum := 0
		for xx := x; xx > 0; xx /= 10 {
			sum += power[xx%10]
		}
		if sum == x {
			result = append(result, x)
		}
	}
	return result
}

func main() {
	fmt.Println(narc(25))
}

Python: from __future__ import print_function
from itertools import count, islice

def narcissists():
    for digits in count(0):
        digitpowers = [i**digits for i in range(10)]
        for n in range(int(10**(digits-1)), 10**digits):
            div, digitpsum = n, 0
            while div:
                div, mod = divmod(div, 10)
                digitpsum += digitpowers[mod]
            if n == digitpsum:
                yield n

for i, n in enumerate(islice(narcissists(), 25), 1):
    print(n, end=' ')
    if i % 5 == 0: print() 
print()
Task: Narcissistic decimal number
Go: package main

import "fmt"

func narc(n int) []int {
	power := [...]int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
	limit := 10
	result := make([]int, 0, n)
	for x := 0; len(result) < n; x++ {
		if x >= limit {
			for i := range power {
				power[i] *= i 
			}
			limit *= 10
		}
		sum := 0
		for xx := x; xx > 0; xx /= 10 {
			sum += power[xx%10]
		}
		if sum == x {
			result = append(result, x)
		}
	}
	return result
}

func main() {
	fmt.Println(narc(25))
}

VB: Private Function narcissistic(n As Long) As Boolean
    Dim d As String: d = CStr(n)
    Dim l As Integer: l = Len(d)
    Dim sumn As Long: sumn = 0
    For i = 1 To l
        sumn = sumn + (Mid(d, i, 1) - "0") ^ l
    Next i
    narcissistic = sumn = n
End Function

Public Sub main()
    Dim s(24) As String
    Dim n As Long: n = 0
    Dim found As Integer: found = 0
    Do While found < 25
        If narcissistic(n) Then
            s(found) = CStr(n)
            found = found + 1
        End If
        n = n + 1
    Loop
    Debug.Print Join(s, ", ")
End Sub
Task: Narcissistic decimal number
Python: from __future__ import print_function
from itertools import count, islice

def narcissists():
    for digits in count(0):
        digitpowers = [i**digits for i in range(10)]
        for n in range(int(10**(digits-1)), 10**digits):
            div, digitpsum = n, 0
            while div:
                div, mod = divmod(div, 10)
                digitpsum += digitpowers[mod]
            if n == digitpsum:
                yield n

for i, n in enumerate(islice(narcissists(), 25), 1):
    print(n, end=' ')
    if i % 5 == 0: print() 
print()

VB: Private Function narcissistic(n As Long) As Boolean
    Dim d As String: d = CStr(n)
    Dim l As Integer: l = Len(d)
    Dim sumn As Long: sumn = 0
    For i = 1 To l
        sumn = sumn + (Mid(d, i, 1) - "0") ^ l
    Next i
    narcissistic = sumn = n
End Function

Public Sub main()
    Dim s(24) As String
    Dim n As Long: n = 0
    Dim found As Integer: found = 0
    Do While found < 25
        If narcissistic(n) Then
            s(found) = CStr(n)
            found = found + 1
        End If
        n = n + 1
    Loop
    Debug.Print Join(s, ", ")
End Sub
Task: Narcissistic decimal number
C: #include <stdio.h>
#include <gmp.h>

#define MAX_LEN 81

mpz_t power[10];
mpz_t dsum[MAX_LEN + 1];
int cnt[10], len;

void check_perm(void)
{
	char s[MAX_LEN + 1];
	int i, c, out[10] = { 0 };

	mpz_get_str(s, 10, dsum[0]);
	for (i = 0; s[i]; i++) {
		c = s[i]-'0';
		if (++out[c] > cnt[c]) return;
	}

	if (i == len)
		gmp_printf(" %Zd", dsum[0]);
}

void narc_(int pos, int d)
{
	if (!pos) {
		check_perm();
		return;
	}

	do {
		mpz_add(dsum[pos-1], dsum[pos], power[d]);
		++cnt[d];
		narc_(pos - 1, d);
		--cnt[d];
	} while (d--);
}

void narc(int n)
{
	int i;
	len = n;
	for (i = 0; i < 10; i++)
		mpz_ui_pow_ui(power[i], i, n);

	mpz_init_set_ui(dsum[n], 0);

	printf("length %d:", n);
	narc_(n, 9);
	putchar('\n');
}

int main(void)
{
	int i;

	for (i = 0; i <= 10; i++)
		mpz_init(power[i]);
	for (i = 1; i <= MAX_LEN; i++) narc(i);

	return 0;
}

Java: public class Narc{
	public static boolean isNarc(long x){
		if(x < 0) return false;
		
		String xStr = Long.toString(x);
		int m = xStr.length();
		long sum = 0;
		
		for(char c : xStr.toCharArray()){
			sum += Math.pow(Character.digit(c, 10), m);
		}
		return sum == x;
	}

	public static void main(String[] args){
		for(long x = 0, count = 0; count < 25; x++){
			if(isNarc(x)){
				System.out.print(x + " ");
				count++;
			}
		}
	}
}
Task: Narcissistic decimal number
C: #include <stdio.h>
#include <gmp.h>

#define MAX_LEN 81

mpz_t power[10];
mpz_t dsum[MAX_LEN + 1];
int cnt[10], len;

void check_perm(void)
{
	char s[MAX_LEN + 1];
	int i, c, out[10] = { 0 };

	mpz_get_str(s, 10, dsum[0]);
	for (i = 0; s[i]; i++) {
		c = s[i]-'0';
		if (++out[c] > cnt[c]) return;
	}

	if (i == len)
		gmp_printf(" %Zd", dsum[0]);
}

void narc_(int pos, int d)
{
	if (!pos) {
		check_perm();
		return;
	}

	do {
		mpz_add(dsum[pos-1], dsum[pos], power[d]);
		++cnt[d];
		narc_(pos - 1, d);
		--cnt[d];
	} while (d--);
}

void narc(int n)
{
	int i;
	len = n;
	for (i = 0; i < 10; i++)
		mpz_ui_pow_ui(power[i], i, n);

	mpz_init_set_ui(dsum[n], 0);

	printf("length %d:", n);
	narc_(n, 9);
	putchar('\n');
}

int main(void)
{
	int i;

	for (i = 0; i <= 10; i++)
		mpz_init(power[i]);
	for (i = 1; i <= MAX_LEN; i++) narc(i);

	return 0;
}

VB: Private Function narcissistic(n As Long) As Boolean
    Dim d As String: d = CStr(n)
    Dim l As Integer: l = Len(d)
    Dim sumn As Long: sumn = 0
    For i = 1 To l
        sumn = sumn + (Mid(d, i, 1) - "0") ^ l
    Next i
    narcissistic = sumn = n
End Function

Public Sub main()
    Dim s(24) As String
    Dim n As Long: n = 0
    Dim found As Integer: found = 0
    Do While found < 25
        If narcissistic(n) Then
            s(found) = CStr(n)
            found = found + 1
        End If
        n = n + 1
    Loop
    Debug.Print Join(s, ", ")
End Sub
Task: Narcissistic decimal number
C++: #include <iostream>
#include <vector>
using namespace std;
typedef unsigned int uint;

class NarcissisticDecs
{
public:
    void makeList( int mx )
    {
	uint st = 0, tl; int pwr = 0, len;
        while( narc.size() < mx )
	{
	    len = getDigs( st );
	    if( pwr != len )
	    {
		pwr = len;
		fillPower( pwr );
	    }
            tl = 0;
	    for( int i = 1; i < 10; i++ )
		tl += static_cast<uint>( powr[i] * digs[i] );

	    if( tl == st ) narc.push_back( st );
	    st++;
	}
    }

    void display()
    {
	for( vector<uint>::iterator i = narc.begin(); i != narc.end(); i++ )
	    cout << *i << " ";
	cout << "\n\n";
    }

private:
    int getDigs( uint st )
    {
	memset( digs, 0, 10 * sizeof( int ) );
	int r = 0;
	while( st )
	{
	    digs[st % 10]++;
	    st /= 10;
	    r++;
	}
        return r;
    }

    void fillPower( int z )
    {
	for( int i = 1; i < 10; i++ )
	    powr[i] = pow( static_cast<float>( i ), z );
    }

    vector<uint> narc;
    uint powr[10];
    int digs[10];
};

int main( int argc, char* argv[] )
{
    NarcissisticDecs n;
    n.makeList( 25 );
    n.display();
    return system( "pause" );
}

Java: public class Narc{
	public static boolean isNarc(long x){
		if(x < 0) return false;
		
		String xStr = Long.toString(x);
		int m = xStr.length();
		long sum = 0;
		
		for(char c : xStr.toCharArray()){
			sum += Math.pow(Character.digit(c, 10), m);
		}
		return sum == x;
	}

	public static void main(String[] args){
		for(long x = 0, count = 0; count < 25; x++){
			if(isNarc(x)){
				System.out.print(x + " ");
				count++;
			}
		}
	}
}
Task: Narcissistic decimal number
C++: #include <iostream>
#include <vector>
using namespace std;
typedef unsigned int uint;

class NarcissisticDecs
{
public:
    void makeList( int mx )
    {
	uint st = 0, tl; int pwr = 0, len;
        while( narc.size() < mx )
	{
	    len = getDigs( st );
	    if( pwr != len )
	    {
		pwr = len;
		fillPower( pwr );
	    }
            tl = 0;
	    for( int i = 1; i < 10; i++ )
		tl += static_cast<uint>( powr[i] * digs[i] );

	    if( tl == st ) narc.push_back( st );
	    st++;
	}
    }

    void display()
    {
	for( vector<uint>::iterator i = narc.begin(); i != narc.end(); i++ )
	    cout << *i << " ";
	cout << "\n\n";
    }

private:
    int getDigs( uint st )
    {
	memset( digs, 0, 10 * sizeof( int ) );
	int r = 0;
	while( st )
	{
	    digs[st % 10]++;
	    st /= 10;
	    r++;
	}
        return r;
    }

    void fillPower( int z )
    {
	for( int i = 1; i < 10; i++ )
	    powr[i] = pow( static_cast<float>( i ), z );
    }

    vector<uint> narc;
    uint powr[10];
    int digs[10];
};

int main( int argc, char* argv[] )
{
    NarcissisticDecs n;
    n.makeList( 25 );
    n.display();
    return system( "pause" );
}

Python: from __future__ import print_function
from itertools import count, islice

def narcissists():
    for digits in count(0):
        digitpowers = [i**digits for i in range(10)]
        for n in range(int(10**(digits-1)), 10**digits):
            div, digitpsum = n, 0
            while div:
                div, mod = divmod(div, 10)
                digitpsum += digitpowers[mod]
            if n == digitpsum:
                yield n

for i, n in enumerate(islice(narcissists(), 25), 1):
    print(n, end=' ')
    if i % 5 == 0: print() 
print()
Task: Mouse position
C: #include <stdio.h>
#include <X11/Xlib.h>

int main()
{
  Display *d;
  Window inwin;      
  Window inchildwin; 
  int rootx, rooty; 
  int childx, childy;  
  Atom atom_type_prop; 
  int actual_format;   
  unsigned int mask;   
  unsigned long n_items, bytes_after_ret;
  Window *props; 

  
  d = XOpenDisplay(NULL); 

  
  (void)XGetWindowProperty(d, DefaultRootWindow(d),
			   XInternAtom(d, "_NET_ACTIVE_WINDOW", True),
			   0, 1, False, AnyPropertyType,
			   &atom_type_prop, &actual_format,
			   &n_items, &bytes_after_ret, (unsigned char**)&props);
			  
  XQueryPointer(d, props[0], &inwin,  &inchildwin,
		&rootx, &rooty, &childx, &childy, &mask);
  printf("relative to active window: %d,%d\n", childx, childy);

  XFree(props);           
  (void)XCloseDisplay(d); 
  return 0;
}

C#: using System;
using System.Windows.Forms;
static class Program
{
    [STAThread]
    static void Main()
    {
        Console.WriteLine(Control.MousePosition.X);
        Console.WriteLine(Control.MousePosition.Y);
    }
}
Task: Mouse position
C: #include <stdio.h>
#include <X11/Xlib.h>

int main()
{
  Display *d;
  Window inwin;      
  Window inchildwin; 
  int rootx, rooty; 
  int childx, childy;  
  Atom atom_type_prop; 
  int actual_format;   
  unsigned int mask;   
  unsigned long n_items, bytes_after_ret;
  Window *props; 

  
  d = XOpenDisplay(NULL); 

  
  (void)XGetWindowProperty(d, DefaultRootWindow(d),
			   XInternAtom(d, "_NET_ACTIVE_WINDOW", True),
			   0, 1, False, AnyPropertyType,
			   &atom_type_prop, &actual_format,
			   &n_items, &bytes_after_ret, (unsigned char**)&props);
			  
  XQueryPointer(d, props[0], &inwin,  &inchildwin,
		&rootx, &rooty, &childx, &childy, &mask);
  printf("relative to active window: %d,%d\n", childx, childy);

  XFree(props);           
  (void)XCloseDisplay(d); 
  return 0;
}

Go: package main

import (
    "fmt"
    "github.com/go-vgo/robotgo"
)

func isInside(x, y, w, h, mx, my int) bool {
    rx := x + w - 1
    ry := y + h - 1
    return mx >= x && mx <= rx && my >= y && my <= ry
}

func main() {
    name := "gedit" 
    fpid, err := robotgo.FindIds(name)
    if err == nil && len(fpid) > 0 {
        pid := fpid[0]
        robotgo.ActivePID(pid) 
        x, y, w, h := robotgo.GetBounds(pid)
        fmt.Printf("The active window's top left corner is at (%d, %d)\n", x, y)
        fmt.Printf("Its width is %d and its height is %d\n", w, h)
        mx, my := robotgo.GetMousePos()
        fmt.Printf("The screen location of the mouse cursor is (%d, %d)\n", mx, my)
        if !isInside(x, y, w, h, mx, my) {
            fmt.Println("The mouse cursor is outside the active window")
        } else {
            wx := mx - x
            wy := my - y
            fmt.Printf("The window location of the mouse cursor is (%d, %d)\n", wx, wy)
        }
    } else {
        fmt.Println("Problem when finding PID(s) of", name)
    }
}
Task: Mouse position
C: #include <stdio.h>
#include <X11/Xlib.h>

int main()
{
  Display *d;
  Window inwin;      
  Window inchildwin; 
  int rootx, rooty; 
  int childx, childy;  
  Atom atom_type_prop; 
  int actual_format;   
  unsigned int mask;   
  unsigned long n_items, bytes_after_ret;
  Window *props; 

  
  d = XOpenDisplay(NULL); 

  
  (void)XGetWindowProperty(d, DefaultRootWindow(d),
			   XInternAtom(d, "_NET_ACTIVE_WINDOW", True),
			   0, 1, False, AnyPropertyType,
			   &atom_type_prop, &actual_format,
			   &n_items, &bytes_after_ret, (unsigned char**)&props);
			  
  XQueryPointer(d, props[0], &inwin,  &inchildwin,
		&rootx, &rooty, &childx, &childy, &mask);
  printf("relative to active window: %d,%d\n", childx, childy);

  XFree(props);           
  (void)XCloseDisplay(d); 
  return 0;
}

Java: Point mouseLocation = MouseInfo.getPointerInfo().getLocation();
Task: Mouse position
C#: using System;
using System.Windows.Forms;
static class Program
{
    [STAThread]
    static void Main()
    {
        Console.WriteLine(Control.MousePosition.X);
        Console.WriteLine(Control.MousePosition.Y);
    }
}

Java: Point mouseLocation = MouseInfo.getPointerInfo().getLocation();
Task: Mouse position
Go: package main

import (
    "fmt"
    "github.com/go-vgo/robotgo"
)

func isInside(x, y, w, h, mx, my int) bool {
    rx := x + w - 1
    ry := y + h - 1
    return mx >= x && mx <= rx && my >= y && my <= ry
}

func main() {
    name := "gedit" 
    fpid, err := robotgo.FindIds(name)
    if err == nil && len(fpid) > 0 {
        pid := fpid[0]
        robotgo.ActivePID(pid) 
        x, y, w, h := robotgo.GetBounds(pid)
        fmt.Printf("The active window's top left corner is at (%d, %d)\n", x, y)
        fmt.Printf("Its width is %d and its height is %d\n", w, h)
        mx, my := robotgo.GetMousePos()
        fmt.Printf("The screen location of the mouse cursor is (%d, %d)\n", mx, my)
        if !isInside(x, y, w, h, mx, my) {
            fmt.Println("The mouse cursor is outside the active window")
        } else {
            wx := mx - x
            wy := my - y
            fmt.Printf("The window location of the mouse cursor is (%d, %d)\n", wx, wy)
        }
    } else {
        fmt.Println("Problem when finding PID(s) of", name)
    }
}

Java: Point mouseLocation = MouseInfo.getPointerInfo().getLocation();
Task: Mouse position
Java: Point mouseLocation = MouseInfo.getPointerInfo().getLocation();

Python: def setup():
    size(640, 480)

def draw():
    
    ellipse(mouseX, mouseY, 5, 5) 
    println("x:{} y:{}".format(mouseX, mouseY))
Task: Mouse position
Java: Point mouseLocation = MouseInfo.getPointerInfo().getLocation();

VB: Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    
    Me.Print "X:" & X
    Me.Print "Y:" & Y
End Sub
Task: Mouse position
Go: package main

import (
    "fmt"
    "github.com/go-vgo/robotgo"
)

func isInside(x, y, w, h, mx, my int) bool {
    rx := x + w - 1
    ry := y + h - 1
    return mx >= x && mx <= rx && my >= y && my <= ry
}

func main() {
    name := "gedit" 
    fpid, err := robotgo.FindIds(name)
    if err == nil && len(fpid) > 0 {
        pid := fpid[0]
        robotgo.ActivePID(pid) 
        x, y, w, h := robotgo.GetBounds(pid)
        fmt.Printf("The active window's top left corner is at (%d, %d)\n", x, y)
        fmt.Printf("Its width is %d and its height is %d\n", w, h)
        mx, my := robotgo.GetMousePos()
        fmt.Printf("The screen location of the mouse cursor is (%d, %d)\n", mx, my)
        if !isInside(x, y, w, h, mx, my) {
            fmt.Println("The mouse cursor is outside the active window")
        } else {
            wx := mx - x
            wy := my - y
            fmt.Printf("The window location of the mouse cursor is (%d, %d)\n", wx, wy)
        }
    } else {
        fmt.Println("Problem when finding PID(s) of", name)
    }
}

Python: def setup():
    size(640, 480)

def draw():
    
    ellipse(mouseX, mouseY, 5, 5) 
    println("x:{} y:{}".format(mouseX, mouseY))
Task: Mouse position
Go: package main

import (
    "fmt"
    "github.com/go-vgo/robotgo"
)

func isInside(x, y, w, h, mx, my int) bool {
    rx := x + w - 1
    ry := y + h - 1
    return mx >= x && mx <= rx && my >= y && my <= ry
}

func main() {
    name := "gedit" 
    fpid, err := robotgo.FindIds(name)
    if err == nil && len(fpid) > 0 {
        pid := fpid[0]
        robotgo.ActivePID(pid) 
        x, y, w, h := robotgo.GetBounds(pid)
        fmt.Printf("The active window's top left corner is at (%d, %d)\n", x, y)
        fmt.Printf("Its width is %d and its height is %d\n", w, h)
        mx, my := robotgo.GetMousePos()
        fmt.Printf("The screen location of the mouse cursor is (%d, %d)\n", mx, my)
        if !isInside(x, y, w, h, mx, my) {
            fmt.Println("The mouse cursor is outside the active window")
        } else {
            wx := mx - x
            wy := my - y
            fmt.Printf("The window location of the mouse cursor is (%d, %d)\n", wx, wy)
        }
    } else {
        fmt.Println("Problem when finding PID(s) of", name)
    }
}

VB: Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    
    Me.Print "X:" & X
    Me.Print "Y:" & Y
End Sub
Task: Mouse position
Python: def setup():
    size(640, 480)

def draw():
    
    ellipse(mouseX, mouseY, 5, 5) 
    println("x:{} y:{}".format(mouseX, mouseY))

VB: Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    
    Me.Print "X:" & X
    Me.Print "Y:" & Y
End Sub
Task: Mouse position
C#: using System;
using System.Windows.Forms;
static class Program
{
    [STAThread]
    static void Main()
    {
        Console.WriteLine(Control.MousePosition.X);
        Console.WriteLine(Control.MousePosition.Y);
    }
}

VB: Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    
    Me.Print "X:" & X
    Me.Print "Y:" & Y
End Sub
Task: Mouse position
C: #include <stdio.h>
#include <X11/Xlib.h>

int main()
{
  Display *d;
  Window inwin;      
  Window inchildwin; 
  int rootx, rooty; 
  int childx, childy;  
  Atom atom_type_prop; 
  int actual_format;   
  unsigned int mask;   
  unsigned long n_items, bytes_after_ret;
  Window *props; 

  
  d = XOpenDisplay(NULL); 

  
  (void)XGetWindowProperty(d, DefaultRootWindow(d),
			   XInternAtom(d, "_NET_ACTIVE_WINDOW", True),
			   0, 1, False, AnyPropertyType,
			   &atom_type_prop, &actual_format,
			   &n_items, &bytes_after_ret, (unsigned char**)&props);
			  
  XQueryPointer(d, props[0], &inwin,  &inchildwin,
		&rootx, &rooty, &childx, &childy, &mask);
  printf("relative to active window: %d,%d\n", childx, childy);

  XFree(props);           
  (void)XCloseDisplay(d); 
  return 0;
}

Python: def setup():
    size(640, 480)

def draw():
    
    ellipse(mouseX, mouseY, 5, 5) 
    println("x:{} y:{}".format(mouseX, mouseY))
Task: Mouse position
C: #include <stdio.h>
#include <X11/Xlib.h>

int main()
{
  Display *d;
  Window inwin;      
  Window inchildwin; 
  int rootx, rooty; 
  int childx, childy;  
  Atom atom_type_prop; 
  int actual_format;   
  unsigned int mask;   
  unsigned long n_items, bytes_after_ret;
  Window *props; 

  
  d = XOpenDisplay(NULL); 

  
  (void)XGetWindowProperty(d, DefaultRootWindow(d),
			   XInternAtom(d, "_NET_ACTIVE_WINDOW", True),
			   0, 1, False, AnyPropertyType,
			   &atom_type_prop, &actual_format,
			   &n_items, &bytes_after_ret, (unsigned char**)&props);
			  
  XQueryPointer(d, props[0], &inwin,  &inchildwin,
		&rootx, &rooty, &childx, &childy, &mask);
  printf("relative to active window: %d,%d\n", childx, childy);

  XFree(props);           
  (void)XCloseDisplay(d); 
  return 0;
}

VB: Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    
    Me.Print "X:" & X
    Me.Print "Y:" & Y
End Sub
Task: Mouse position
C#: using System;
using System.Windows.Forms;
static class Program
{
    [STAThread]
    static void Main()
    {
        Console.WriteLine(Control.MousePosition.X);
        Console.WriteLine(Control.MousePosition.Y);
    }
}

Go: package main

import (
    "fmt"
    "github.com/go-vgo/robotgo"
)

func isInside(x, y, w, h, mx, my int) bool {
    rx := x + w - 1
    ry := y + h - 1
    return mx >= x && mx <= rx && my >= y && my <= ry
}

func main() {
    name := "gedit" 
    fpid, err := robotgo.FindIds(name)
    if err == nil && len(fpid) > 0 {
        pid := fpid[0]
        robotgo.ActivePID(pid) 
        x, y, w, h := robotgo.GetBounds(pid)
        fmt.Printf("The active window's top left corner is at (%d, %d)\n", x, y)
        fmt.Printf("Its width is %d and its height is %d\n", w, h)
        mx, my := robotgo.GetMousePos()
        fmt.Printf("The screen location of the mouse cursor is (%d, %d)\n", mx, my)
        if !isInside(x, y, w, h, mx, my) {
            fmt.Println("The mouse cursor is outside the active window")
        } else {
            wx := mx - x
            wy := my - y
            fmt.Printf("The window location of the mouse cursor is (%d, %d)\n", wx, wy)
        }
    } else {
        fmt.Println("Problem when finding PID(s) of", name)
    }
}
Task: Mouse position
C#: using System;
using System.Windows.Forms;
static class Program
{
    [STAThread]
    static void Main()
    {
        Console.WriteLine(Control.MousePosition.X);
        Console.WriteLine(Control.MousePosition.Y);
    }
}

Python: def setup():
    size(640, 480)

def draw():
    
    ellipse(mouseX, mouseY, 5, 5) 
    println("x:{} y:{}".format(mouseX, mouseY))
Task: Program name
C: #include <stdio.h>

int main(int argc, char **argv) {
	printf("Executable: %s\n", argv[0]);

	return 0;
}

C#: using System;
namespace ProgramName
{
	class Program
	{
		static void Main(string[] args)
		{
			Console.Write(Environment.CommandLine);
		}
	}
}