WeixiangYan/CodeTransOcean huggingface dataset:
Task: Input_Output for pairs of numbers

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

int main(void)
{
	int i, n, a, b, *f;
	scanf("%d", &n);
	f = malloc(sizeof(*f) * n);

	for (i = 0; i < n; i++) {
		if (2 != scanf("%d %d", &a, &b))
			abort();
		f[i] = a + b;
	}

	for (i = 0; i < n; i++)
		printf("%d\n", f[i]);

	return 0;
}





Java: import java.util.Scanner;

public class Main {

	public static int doStuff(int a, int b){
	    int sum = a+b;
	    return sum;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		for(int i=0; i<n; i++){
			int a = in.nextInt();
			int b= in.nextInt();
			int result = doStuff(a, b);
			System.out.println(result);
		}
	}
}
Task: Input_Output for pairs of numbers

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

int main(void)
{
	int i, n, a, b, *f;
	scanf("%d", &n);
	f = malloc(sizeof(*f) * n);

	for (i = 0; i < n; i++) {
		if (2 != scanf("%d %d", &a, &b))
			abort();
		f[i] = a + b;
	}

	for (i = 0; i < n; i++)
		printf("%d\n", f[i]);

	return 0;
}







Python: def do_stuff(a, b):
	return a + b

t = input()
for x in range(0, t):
	a, b = raw_input().strip().split()
	print do_stuff(int(a), int(b))
Task: Input_Output for pairs of numbers


C++: #include <iostream>
#include <vector>
using namespace std;
 
int doStuff(int a, int b) {
	return a + b;
}
 
int main() {
 
	int t;
	cin >> t;
 
	vector<pair<int, int>> list(t);
 
	for(int j=0; j<t; j++){
		cin >> list[j].first >> list[j].second;
	}
 
	cout << endl;
 
	for(int j=0;j<t;j++){
		cout << doStuff(list[j].first, list[j].second) << endl;;
	}
}


C#: using System;
using static System.Linq.Enumerable;

public class Program
{
    static void Main(string[] args)
    {
	int count = Convert.ToInt32(Console.ReadLine());
	for (int line = 0; line < count; line++) {
            Console.WriteLine(Console.ReadLine().Split(' ').Sum(i => Convert.ToInt32(i)));
	}
    }
}
Task: Input_Output for pairs of numbers


C++: #include <iostream>
#include <vector>
using namespace std;
 
int doStuff(int a, int b) {
	return a + b;
}
 
int main() {
 
	int t;
	cin >> t;
 
	vector<pair<int, int>> list(t);
 
	for(int j=0; j<t; j++){
		cin >> list[j].first >> list[j].second;
	}
 
	cout << endl;
 
	for(int j=0;j<t;j++){
		cout << doStuff(list[j].first, list[j].second) << endl;;
	}
}



Go: package main

import (
	"fmt"
	"log"
)

func main() {
	var lines int
	n, err := fmt.Scanln(&lines)
	if n != 1 || err != nil {
		log.Fatal(err)
	}

	var a, b int
	for ; lines > 0; lines-- {
		n, err = fmt.Scanln(&a, &b)
		if n != 2 || err != nil {
			log.Fatal(err)
		}
		fmt.Println(a + b)
	}
}
Task: Input_Output for pairs of numbers


C++: #include <iostream>
#include <vector>
using namespace std;
 
int doStuff(int a, int b) {
	return a + b;
}
 
int main() {
 
	int t;
	cin >> t;
 
	vector<pair<int, int>> list(t);
 
	for(int j=0; j<t; j++){
		cin >> list[j].first >> list[j].second;
	}
 
	cout << endl;
 
	for(int j=0;j<t;j++){
		cout << doStuff(list[j].first, list[j].second) << endl;;
	}
}




Java: import java.util.Scanner;

public class Main {

	public static int doStuff(int a, int b){
	    int sum = a+b;
	    return sum;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		for(int i=0; i<n; i++){
			int a = in.nextInt();
			int b= in.nextInt();
			int result = doStuff(a, b);
			System.out.println(result);
		}
	}
}
Task: Input_Output for pairs of numbers


C++: #include <iostream>
#include <vector>
using namespace std;
 
int doStuff(int a, int b) {
	return a + b;
}
 
int main() {
 
	int t;
	cin >> t;
 
	vector<pair<int, int>> list(t);
 
	for(int j=0; j<t; j++){
		cin >> list[j].first >> list[j].second;
	}
 
	cout << endl;
 
	for(int j=0;j<t;j++){
		cout << doStuff(list[j].first, list[j].second) << endl;;
	}
}






Python: def do_stuff(a, b):
	return a + b

t = input()
for x in range(0, t):
	a, b = raw_input().strip().split()
	print do_stuff(int(a), int(b))
Task: Input_Output for pairs of numbers



C#: using System;
using static System.Linq.Enumerable;

public class Program
{
    static void Main(string[] args)
    {
	int count = Convert.ToInt32(Console.ReadLine());
	for (int line = 0; line < count; line++) {
            Console.WriteLine(Console.ReadLine().Split(' ').Sum(i => Convert.ToInt32(i)));
	}
    }
}


Go: package main

import (
	"fmt"
	"log"
)

func main() {
	var lines int
	n, err := fmt.Scanln(&lines)
	if n != 1 || err != nil {
		log.Fatal(err)
	}

	var a, b int
	for ; lines > 0; lines-- {
		n, err = fmt.Scanln(&a, &b)
		if n != 2 || err != nil {
			log.Fatal(err)
		}
		fmt.Println(a + b)
	}
}
Task: Input_Output for pairs of numbers



C#: using System;
using static System.Linq.Enumerable;

public class Program
{
    static void Main(string[] args)
    {
	int count = Convert.ToInt32(Console.ReadLine());
	for (int line = 0; line < count; line++) {
            Console.WriteLine(Console.ReadLine().Split(' ').Sum(i => Convert.ToInt32(i)));
	}
    }
}



Java: import java.util.Scanner;

public class Main {

	public static int doStuff(int a, int b){
	    int sum = a+b;
	    return sum;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		for(int i=0; i<n; i++){
			int a = in.nextInt();
			int b= in.nextInt();
			int result = doStuff(a, b);
			System.out.println(result);
		}
	}
}
Task: Input_Output for pairs of numbers



C#: using System;
using static System.Linq.Enumerable;

public class Program
{
    static void Main(string[] args)
    {
	int count = Convert.ToInt32(Console.ReadLine());
	for (int line = 0; line < count; line++) {
            Console.WriteLine(Console.ReadLine().Split(' ').Sum(i => Convert.ToInt32(i)));
	}
    }
}





Python: def do_stuff(a, b):
	return a + b

t = input()
for x in range(0, t):
	a, b = raw_input().strip().split()
	print do_stuff(int(a), int(b))
Task: Input_Output for pairs of numbers




Go: package main

import (
	"fmt"
	"log"
)

func main() {
	var lines int
	n, err := fmt.Scanln(&lines)
	if n != 1 || err != nil {
		log.Fatal(err)
	}

	var a, b int
	for ; lines > 0; lines-- {
		n, err = fmt.Scanln(&a, &b)
		if n != 2 || err != nil {
			log.Fatal(err)
		}
		fmt.Println(a + b)
	}
}


Java: import java.util.Scanner;

public class Main {

	public static int doStuff(int a, int b){
	    int sum = a+b;
	    return sum;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		for(int i=0; i<n; i++){
			int a = in.nextInt();
			int b= in.nextInt();
			int result = doStuff(a, b);
			System.out.println(result);
		}
	}
}
Task: Input_Output for pairs of numbers




Go: package main

import (
	"fmt"
	"log"
)

func main() {
	var lines int
	n, err := fmt.Scanln(&lines)
	if n != 1 || err != nil {
		log.Fatal(err)
	}

	var a, b int
	for ; lines > 0; lines-- {
		n, err = fmt.Scanln(&a, &b)
		if n != 2 || err != nil {
			log.Fatal(err)
		}
		fmt.Println(a + b)
	}
}




Python: def do_stuff(a, b):
	return a + b

t = input()
for x in range(0, t):
	a, b = raw_input().strip().split()
	print do_stuff(int(a), int(b))
Task: Input_Output for pairs of numbers

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

int main(void)
{
	int i, n, a, b, *f;
	scanf("%d", &n);
	f = malloc(sizeof(*f) * n);

	for (i = 0; i < n; i++) {
		if (2 != scanf("%d %d", &a, &b))
			abort();
		f[i] = a + b;
	}

	for (i = 0; i < n; i++)
		printf("%d\n", f[i]);

	return 0;
}


C++: #include <iostream>
#include <vector>
using namespace std;
 
int doStuff(int a, int b) {
	return a + b;
}
 
int main() {
 
	int t;
	cin >> t;
 
	vector<pair<int, int>> list(t);
 
	for(int j=0; j<t; j++){
		cin >> list[j].first >> list[j].second;
	}
 
	cout << endl;
 
	for(int j=0;j<t;j++){
		cout << doStuff(list[j].first, list[j].second) << endl;;
	}
}
Task: Input_Output for pairs of numbers





Java: import java.util.Scanner;

public class Main {

	public static int doStuff(int a, int b){
	    int sum = a+b;
	    return sum;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		for(int i=0; i<n; i++){
			int a = in.nextInt();
			int b= in.nextInt();
			int result = doStuff(a, b);
			System.out.println(result);
		}
	}
}



Python: def do_stuff(a, b):
	return a + b

t = input()
for x in range(0, t):
	a, b = raw_input().strip().split()
	print do_stuff(int(a), int(b))
Task: Function definition

C: double multiply(double a, double b)
{
   return a * b;
}



C#: static double multiply(double a, double b)
{
    return a * b;
}
Task: Function definition

C: double multiply(double a, double b)
{
   return a * b;
}


C++: inline double multiply(double a, double b)
{
   return a*b;
}
Task: Function definition

C: double multiply(double a, double b)
{
   return a * b;
}




Go: func multiply(a, b float64) float64 {
   return a * b
}
Task: Function definition

C: double multiply(double a, double b)
{
   return a * b;
}





Java: module MultiplyExample
    {
    static <Value extends Number> Value multiply(Value n1, Value n2)
        {
        return n1 * n2;
        }

    void run()
        {
        (Int i1, Int i2) = (7, 3);
        Int i3 = multiply(i1, i2);
        (Double d1, Double d2) = (2.7182818, 3.1415);
        Double d3 = multiply(d1, d2);
        @Inject Console console;
        console.print($"{i1}*{i2}={i3}, {d1}*{d2}={d3}");
        }
    }
Task: Function definition

C: double multiply(double a, double b)
{
   return a * b;
}








VB: Function Multiply(a As Integer, b As Integer) As Integer
  Return a * b
End Function
Task: Function definition


C++: inline double multiply(double a, double b)
{
   return a*b;
}


C#: static double multiply(double a, double b)
{
    return a * b;
}
Task: Function definition


C++: inline double multiply(double a, double b)
{
   return a*b;
}



Go: func multiply(a, b float64) float64 {
   return a * b
}
Task: Function definition


C++: inline double multiply(double a, double b)
{
   return a*b;
}




Java: module MultiplyExample
    {
    static <Value extends Number> Value multiply(Value n1, Value n2)
        {
        return n1 * n2;
        }

    void run()
        {
        (Int i1, Int i2) = (7, 3);
        Int i3 = multiply(i1, i2);
        (Double d1, Double d2) = (2.7182818, 3.1415);
        Double d3 = multiply(d1, d2);
        @Inject Console console;
        console.print($"{i1}*{i2}={i3}, {d1}*{d2}={d3}");
        }
    }
Task: Function definition


C++: inline double multiply(double a, double b)
{
   return a*b;
}







VB: Function Multiply(a As Integer, b As Integer) As Integer
  Return a * b
End Function
Task: Function definition



C#: static double multiply(double a, double b)
{
    return a * b;
}



Java: module MultiplyExample
    {
    static <Value extends Number> Value multiply(Value n1, Value n2)
        {
        return n1 * n2;
        }

    void run()
        {
        (Int i1, Int i2) = (7, 3);
        Int i3 = multiply(i1, i2);
        (Double d1, Double d2) = (2.7182818, 3.1415);
        Double d3 = multiply(d1, d2);
        @Inject Console console;
        console.print($"{i1}*{i2}={i3}, {d1}*{d2}={d3}");
        }
    }
Task: Function definition



C#: static double multiply(double a, double b)
{
    return a * b;
}






VB: Function Multiply(a As Integer, b As Integer) As Integer
  Return a * b
End Function
Task: Function definition




Go: func multiply(a, b float64) float64 {
   return a * b
}


Java: module MultiplyExample
    {
    static <Value extends Number> Value multiply(Value n1, Value n2)
        {
        return n1 * n2;
        }

    void run()
        {
        (Int i1, Int i2) = (7, 3);
        Int i3 = multiply(i1, i2);
        (Double d1, Double d2) = (2.7182818, 3.1415);
        Double d3 = multiply(d1, d2);
        @Inject Console console;
        console.print($"{i1}*{i2}={i3}, {d1}*{d2}={d3}");
        }
    }
Task: Function definition





Java: module MultiplyExample
    {
    static <Value extends Number> Value multiply(Value n1, Value n2)
        {
        return n1 * n2;
        }

    void run()
        {
        (Int i1, Int i2) = (7, 3);
        Int i3 = multiply(i1, i2);
        (Double d1, Double d2) = (2.7182818, 3.1415);
        Double d3 = multiply(d1, d2);
        @Inject Console console;
        console.print($"{i1}*{i2}={i3}, {d1}*{d2}={d3}");
        }
    }



Python: def multiply(x, y):
    return x * y
Task: Function definition




Go: func multiply(a, b float64) float64 {
   return a * b
}





VB: Function Multiply(a As Integer, b As Integer) As Integer
  Return a * b
End Function
Task: Function definition



C#: static double multiply(double a, double b)
{
    return a * b;
}


Go: func multiply(a, b float64) float64 {
   return a * b
}
Task: Function definition





Java: module MultiplyExample
    {
    static <Value extends Number> Value multiply(Value n1, Value n2)
        {
        return n1 * n2;
        }

    void run()
        {
        (Int i1, Int i2) = (7, 3);
        Int i3 = multiply(i1, i2);
        (Double d1, Double d2) = (2.7182818, 3.1415);
        Double d3 = multiply(d1, d2);
        @Inject Console console;
        console.print($"{i1}*{i2}={i3}, {d1}*{d2}={d3}");
        }
    }




VB: Function Multiply(a As Integer, b As Integer) As Integer
  Return a * b
End Function
Task: Function definition



C#: static double multiply(double a, double b)
{
    return a * b;
}




PHP: function multiply( $a, $b )
{
    return $a * $b;
}
Task: Function definition


C++: inline double multiply(double a, double b)
{
   return a*b;
}





PHP: function multiply( $a, $b )
{
    return $a * $b;
}
Task: Function definition




Go: func multiply(a, b float64) float64 {
   return a * b
}



PHP: function multiply( $a, $b )
{
    return $a * $b;
}
Task: Function definition





Java: module MultiplyExample
    {
    static <Value extends Number> Value multiply(Value n1, Value n2)
        {
        return n1 * n2;
        }

    void run()
        {
        (Int i1, Int i2) = (7, 3);
        Int i3 = multiply(i1, i2);
        (Double d1, Double d2) = (2.7182818, 3.1415);
        Double d3 = multiply(d1, d2);
        @Inject Console console;
        console.print($"{i1}*{i2}={i3}, {d1}*{d2}={d3}");
        }
    }


PHP: function multiply( $a, $b )
{
    return $a * $b;
}
Task: Function definition






PHP: function multiply( $a, $b )
{
    return $a * $b;
}



VB: Function Multiply(a As Integer, b As Integer) As Integer
  Return a * b
End Function
Task: Self numbers

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

typedef unsigned char bool;

#define TRUE 1
#define FALSE 0
#define MILLION 1000000
#define BILLION 1000 * MILLION
#define MAX_COUNT 2*BILLION + 9*9 + 1

void sieve(bool *sv) {
    int n = 0, s[8], a, b, c, d, e, f, g, h, i, j;
    for (a = 0; a < 2; ++a) {
        for (b = 0; b < 10; ++b) {
            s[0] = a + b;
            for (c = 0; c < 10; ++c) {
                s[1] = s[0] + c;
                for (d = 0; d < 10; ++d) {
                    s[2] = s[1] + d;
                    for (e = 0; e < 10; ++e) {
                        s[3] = s[2] + e;
                        for (f = 0; f < 10; ++f) {
                            s[4] = s[3] + f;
                            for (g = 0; g < 10; ++g) {
                                s[5] = s[4] + g;
                                for (h = 0; h < 10; ++h) {
                                    s[6] = s[5] + h;
                                    for (i = 0; i < 10; ++i) {
                                        s[7] = s[6] + i;
                                        for (j = 0; j < 10; ++j) {
                                            sv[s[7] + j+ n++] = TRUE;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

int main() {
    int count = 0;
    clock_t begin = clock();
    bool *p, *sv = (bool*) calloc(MAX_COUNT, sizeof(bool));
    sieve(sv);
    printf("The first 50 self numbers are:\n");
    for (p = sv; p < sv + MAX_COUNT; ++p) {
        if (!*p) {
            if (++count <= 50) printf("%ld ", p-sv);
            if (count == 100 * MILLION) {
                printf("\n\nThe 100 millionth self number is %ld\n", p-sv);
                break;
            }
        }
    }
    free(sv);
    printf("Took %lf seconds.\n", (double)(clock() - begin) / CLOCKS_PER_SEC);
    return 0;
}







Python: class DigitSumer :
    def __init__(self): 
        sumdigit = lambda n : sum( map( int,str( n )))
        self.t = [sumdigit( i ) for i in xrange( 10000 )]
    def __call__ ( self,n ):
        r = 0
        while n >= 10000 :
            n,q = divmod( n,10000 )
            r += self.t[q]
        return r + self.t[n] 


def self_numbers ():
    d = DigitSumer()
    s = set([])
    i = 1
    while 1 :
        n = i + d( i )
        if i in s :
            s.discard( i )
        else:
            yield i
        s.add( n )
        i += 1

import time
p = 100
t = time.time()
for i,s in enumerate( self_numbers(),1 ):
    if i <= 50 : 
        print s,
        if i == 50 : print
    if i == p :
        print '%7.1f sec  %9dth = %d'%( time.time()-t,i,s )
        p *= 10
Task: Self numbers


C++: #include <array>
#include <iomanip>
#include <iostream>

const int MC = 103 * 1000 * 10000 + 11 * 9 + 1;
std::array<bool, MC + 1> SV;

void sieve() {
    std::array<int, 10000> dS;
    for (int a = 9, i = 9999; a >= 0; a--) {
        for (int b = 9; b >= 0; b--) {
            for (int c = 9, s = a + b; c >= 0; c--) {
                for (int d = 9, t = s + c; d >= 0; d--) {
                    dS[i--] = t + d;
                }
            }
        }
    }
    for (int a = 0, n = 0; a < 103; a++) {
        for (int b = 0, d = dS[a]; b < 1000; b++, n += 10000) {
            for (int c = 0, s = d + dS[b] + n; c < 10000; c++) {
                SV[dS[c] + s++] = true;
            }
        }
    }
}

int main() {
    sieve();

    std::cout << "The first 50 self numbers are:\n";
    for (int i = 0, count = 0; count <= 50; i++) {
        if (!SV[i]) {
            count++;
            if (count <= 50) {
                std::cout << i << ' ';
            } else {
                std::cout << "\n\n       Index     Self number\n";
            }
        }
    }
    for (int i = 0, limit = 1, count = 0; i < MC; i++) {
        if (!SV[i]) {
            if (++count == limit) {
                
                std::cout << std::setw(12) << count << "   " << std::setw(13) << i << '\n';
                limit *= 10;
            }
        }
    }

    return 0;
}


C#: using System;
using static System.Console;

class Program {

  const int mc = 103 * 1000 * 10000 + 11 * 9 + 1;

  static bool[] sv = new bool[mc + 1];

  static void sieve() { int[] dS = new int[10000];
    for (int a = 9, i = 9999; a >= 0; a--)
      for (int b = 9; b >= 0; b--)
        for (int c = 9, s = a + b; c >= 0; c--)
          for (int d = 9, t = s + c; d >= 0; d--)
            dS[i--] = t + d;
    for (int a = 0, n = 0; a < 103; a++)
      for (int b = 0, d = dS[a]; b < 1000; b++, n += 10000)
        for (int c = 0, s = d + dS[b] + n; c < 10000; c++)
          sv[dS[c] + s++] = true; }

  static void Main() { DateTime st = DateTime.Now; sieve();
    WriteLine("Sieving took {0}s", (DateTime.Now - st).TotalSeconds); 
    WriteLine("\nThe first 50 self numbers are:");
    for (int i = 0, count = 0; count <= 50; i++) if (!sv[i]) {
        count++; if (count <= 50) Write("{0} ", i);
        else WriteLine("\n\n       Index     Self number"); }
    for (int i = 0, limit = 1, count = 0; i < mc; i++)
      if (!sv[i]) if (++count == limit) {
          WriteLine("{0,12:n0}   {1,13:n0}", count, i);
          if (limit == 1e9) break; limit *= 10; }
    WriteLine("\nOverall took {0}s", (DateTime.Now - st). TotalSeconds);
  }
}
Task: Self numbers


C++: #include <array>
#include <iomanip>
#include <iostream>

const int MC = 103 * 1000 * 10000 + 11 * 9 + 1;
std::array<bool, MC + 1> SV;

void sieve() {
    std::array<int, 10000> dS;
    for (int a = 9, i = 9999; a >= 0; a--) {
        for (int b = 9; b >= 0; b--) {
            for (int c = 9, s = a + b; c >= 0; c--) {
                for (int d = 9, t = s + c; d >= 0; d--) {
                    dS[i--] = t + d;
                }
            }
        }
    }
    for (int a = 0, n = 0; a < 103; a++) {
        for (int b = 0, d = dS[a]; b < 1000; b++, n += 10000) {
            for (int c = 0, s = d + dS[b] + n; c < 10000; c++) {
                SV[dS[c] + s++] = true;
            }
        }
    }
}

int main() {
    sieve();

    std::cout << "The first 50 self numbers are:\n";
    for (int i = 0, count = 0; count <= 50; i++) {
        if (!SV[i]) {
            count++;
            if (count <= 50) {
                std::cout << i << ' ';
            } else {
                std::cout << "\n\n       Index     Self number\n";
            }
        }
    }
    for (int i = 0, limit = 1, count = 0; i < MC; i++) {
        if (!SV[i]) {
            if (++count == limit) {
                
                std::cout << std::setw(12) << count << "   " << std::setw(13) << i << '\n';
                limit *= 10;
            }
        }
    }

    return 0;
}






Python: class DigitSumer :
    def __init__(self): 
        sumdigit = lambda n : sum( map( int,str( n )))
        self.t = [sumdigit( i ) for i in xrange( 10000 )]
    def __call__ ( self,n ):
        r = 0
        while n >= 10000 :
            n,q = divmod( n,10000 )
            r += self.t[q]
        return r + self.t[n] 


def self_numbers ():
    d = DigitSumer()
    s = set([])
    i = 1
    while 1 :
        n = i + d( i )
        if i in s :
            s.discard( i )
        else:
            yield i
        s.add( n )
        i += 1

import time
p = 100
t = time.time()
for i,s in enumerate( self_numbers(),1 ):
    if i <= 50 : 
        print s,
        if i == 50 : print
    if i == p :
        print '%7.1f sec  %9dth = %d'%( time.time()-t,i,s )
        p *= 10