code stringlengths 1 46.1k ⌀ | label class label 1.18k
classes | domain_label class label 21
classes | index stringlengths 4 5 |
|---|---|---|---|
import Data.List
toBase :: Int -> Integer -> [Int]
toBase b = unfoldr f
where
f 0 = Nothing
f n = let (q, r) = n `divMod` fromIntegral b in Just (fromIntegral r, q)
fromBase :: Int -> [Int] -> Integer
fromBase n lst = foldr (\x r -> fromIntegral n*r + fromIntegral x) 0 lst
listToInt :: Int -> [Int] -> In... | 718Index finite lists of positive integers | 8haskell | ivuor |
assert(math.type~=nil, "Lua 5.3+ required for this test.")
minint, maxint = math.mininteger, math.maxinteger
print("min, max int64 = " .. minint .. ", " .. maxint)
print("min-1 underflow = " .. (minint-1) .. " equals max? " .. tostring(minint-1==maxint))
print("max+1 overflow = " .. (maxint+1) .. " equals min? " .... | 710Integer overflow | 1lua | d5pnq |
if _VERSION:sub(5) + 0 < 5.1 then print"too old" end | 709Introspection | 1lua | f4adp |
$ perl -de1
Loading DB routines from perl5db.pl version 1.3
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(-e:1): 1
DB<1> sub f {my ($s1, $s2, $sep) = @_; $s1 . $sep . $sep . $s2}
DB<2> p f('Rosetta', 'Code', ':')
Rosetta::Code
DB<3> q | 707Interactive programming (repl) | 2perl | vet20 |
null | 717Idiomatically determine all the characters that can be used for symbols | 11kotlin | cpa98 |
import BigInt
func is89(_ n: Int) -> Bool {
var n = n
while true {
var s = 0
repeat {
s += (n%10) * (n%10)
n /= 10
} while n > 0
if s == 89 {
return true
} else if s == 1 {
return false
}
n = s
}
}
func iterSquare(upToPower pow: Int) {
var sums = [BigInt... | 703Iterated digits squaring | 17swift | azj1i |
import java.math.BigInteger;
import static java.util.Arrays.stream;
import java.util.*;
import static java.util.stream.Collectors.*;
public class Test3 {
static BigInteger rank(int[] x) {
String s = stream(x).mapToObj(String::valueOf).collect(joining("F"));
return new BigInteger(s, 16);
}
... | 718Index finite lists of positive integers | 9java | xymwy |
null | 708Inverted index | 11kotlin | xyrws |
package main
type animal struct {
alive bool
}
type dog struct {
animal
obedienceTrained bool
}
type cat struct {
animal
litterBoxTrained bool
}
type lab struct {
dog
color string
}
type collie struct {
dog
catchesFrisbee bool
}
func main() {
var pet lab
pet.alive = tru... | 712Inheritance/Single | 0go | bdmkh |
class Animal{ | 712Inheritance/Single | 7groovy | r0tgh |
int main(int argc, char const *argv[]) {
for (char c = 0x41; c < 0x5b; c ++) putchar(c);
putchar('\n');
for (char c = 0x61; c < 0x7b; c ++) putchar(c);
putchar('\n');
return 0;
} | 719Idiomatically determine all the lowercase and uppercase letters | 5c | 2aalo |
int find(char *s, char c) {
for (char *i = s; *i != 0; i++) {
if (*i == c) {
return i - s;
}
}
return -1;
}
void reverse(char *b, char *e) {
for (e--; b < e; b++, e--) {
char t = *b;
*b = *e;
*e = t;
}
}
struct Complex {
double rel, img;
};... | 720Imaginary base numbers | 5c | pfdby |
null | 718Index finite lists of positive integers | 11kotlin | pftb6 |
package Camera;
1; | 711Inheritance/Multiple | 2perl | o2j8x |
use strict;
use warnings;
use List::Util 'sum';
sub comma { reverse ((reverse shift) =~ s/(.{3})/$1,/gr) =~ s/^,//r }
my ($index, $last, $gap, $count) = (0, 0, 0, 0);
my $threshold = 10_000_000;
print "Gap Index of gap Starting Niven\n";
while (1) {
$count++;
next unless 0 == $count % sum split //, $coun... | 715Increasing gaps between consecutive Niven numbers | 2perl | ivgo3 |
class Animal a
class Animal a => Cat a
class Animal a => Dog a
class Dog a => Lab a
class Dog a => Collie a | 712Inheritance/Single | 8haskell | d5kn4 |
for $i (0..0x7f) {
$c = chr($i);
print $c if $c =~ /\w/;
}
use utf8;
binmode STDOUT, ":utf8";
for (0..0x1ffff) {
$c = chr($_);
print $c if $c =~ /\p{Word}/;
} | 717Idiomatically determine all the characters that can be used for symbols | 2perl | xy9w8 |
image filter(image img, double *K, int Ks, double, double); | 721Image convolution | 5c | w6zec |
use bigint;
use ntheory qw(fromdigits todigitstring);
use feature 'say';
sub rank { join '', fromdigits(join('a',@_), 11) }
sub unrank { split 'a', todigitstring(@_[0], 11) }
say join ' ', @n = qw<12 11 0 7 9 15 15 5 7 13 5 5>;
say $n = rank(@n);
say join ' ', unrank $n; | 718Index finite lists of positive integers | 2perl | yhk6u |
class Camera:
pass | 711Inheritance/Multiple | 3python | ivhof |
def digit_sum(n, sum):
sum += 1
while n > 0 and n% 10 == 0:
sum -= 9
n /= 10
return sum
previous = 1
gap = 0
sum = 0
niven_index = 0
gap_index = 1
print()
niven = 1
while gap_index <= 22:
sum = digit_sum(niven, sum)
if niven% sum == 0:
if niven > previous + gap:
... | 715Increasing gaps between consecutive Niven numbers | 3python | nuriz |
null | 710Integer overflow | 2perl | 786rh |
module Commatize
refine Integer do
def commatize
self.to_s.gsub( /(\d)(?=\d{3}+(?:\.|$))(\d{3}\..*)?/, )
end
end
end
using Commatize
def isqrt(x)
q, r = 1, 0
while (q <= x) do q <<= 2 end
while (q > 1) do
q >>= 2; t = x-r-q; r >>= 1
if (t >= 0) then x, r = t, r+q end
e... | 705Isqrt (integer square root) of X | 14ruby | 6jo3t |
python
Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on
win32
Type , , or for more information.
>>> def f(string1, string2, separator):
return separator.join([string1, '', string2])
>>> f('Rosetta', 'Code', ':')
'Rosetta::Code'
>>> | 707Interactive programming (repl) | 3python | uwzvd |
def validISBN13?(str)
cleaned = str.delete().chars
return false unless cleaned.size == 13
cleaned.each_slice(2).sum{|d1, d2| d1.to_i + 3*d2.to_i }.remainder(10) == 0
end
isbns = [, , , ]
isbns.each{|isbn| puts } | 704ISBN13 check digit | 14ruby | 8la01 |
[ $
$ QsTtUuVvWwXxYyZz()[]{}<>~=+-*/^\|_.,:;?!'string is used, so cannot
appear as a character in that string. In the second
string all the reasonable delimiters are used, so Q
is used as the delimiter.
As it is not possible to make a string that uses all
the characters, two strings are concatenated (joi... | 717Idiomatically determine all the characters that can be used for symbols | 3python | qmcxi |
unsigned int frames = 0;
unsigned int t_acc = 0;
void print_fps ()
{
static Uint32 last_t = 0;
Uint32 t = SDL_GetTicks();
Uint32 dt = t - last_t;
t_acc += dt;
if (t_acc > 1000)
{
unsigned int el_time = t_acc / 1000;
printf(,
(float) frames / (float) el_time);
t_acc = 0;
frames =... | 722Image noise | 5c | cph9c |
module Camera
end
class MobilePhone
end
class CameraPhone < MobilePhone
include Camera
end | 711Inheritance/Multiple | 14ruby | d5bns |
trait Camera {}
trait MobilePhone {}
trait CameraPhone: Camera + MobilePhone {} | 711Inheritance/Multiple | 15rust | f4pd6 |
use num::BigUint;
use num::CheckedSub;
use num_traits::{One, Zero};
fn isqrt(number: &BigUint) -> BigUint {
let mut q: BigUint = One::one();
while q <= *number {
q <<= &2;
}
let mut z = number.clone();
let mut result: BigUint = Zero::zero();
while q > One::one() {
q >>= &2;
... | 705Isqrt (integer square root) of X | 15rust | yhi68 |
use Set::Object 'set';
sub createindex
{
my @files = @_;
my %iindex;
foreach my $file (@files)
{
open(F, "<", $file) or die "Can't read file $file: $!";
while(<F>) {
s/\A\W+//;
foreach my $w (map {lc} grep {length() >= 3} split /\W+/)
{
if ( exists($iindex... | 708Inverted index | 2perl | 2adlf |
$ R
R version 2.7.2 (2008-08-25)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support... | 707Interactive programming (repl) | 13r | cpn95 |
fn main() {
let isbns = ["978-1734314502", "978-1734314509", "978-1788399081", "978-1788399083"];
isbns.iter().for_each(|isbn| println!("{}: {}", isbn, check_isbn(isbn)));
}
fn check_isbn(isbn: &str) -> bool {
if isbn.chars().filter(|c| c.is_digit(10)).count()!= 13 {
return false;
}
le... | 704ISBN13 check digit | 15rust | o2e83 |
public class Animal{ | 712Inheritance/Single | 9java | s94q0 |
function Animal() { | 712Inheritance/Single | 10javascript | nuhiy |
object IdiomaticallyDetermineSymbols extends App {
private def print(msg: String, limit: Int, p: Int => Boolean, fmt: String) =
println(msg + (0 to 0x10FFFF).filter(p).take(limit).map(fmt.format(_)).mkString + "...")
print("Java Identifier start: ", 72, cp => Character.isJavaIdentifierStart(cp), "%c")
pr... | 717Idiomatically determine all the characters that can be used for symbols | 16scala | nu4ic |
def rank(x): return int('a'.join(map(str, [1] + x)), 11)
def unrank(n):
s = ''
while n: s,n = [n%11] + s, n
return map(int, s.split('a'))[1:]
l = [1, 2, 3, 10, 100, 987654321]
print l
n = rank(l)
print n
l = unrank(n)
print l | 718Index finite lists of positive integers | 3python | mkbyh |
trait Camera
trait MobilePhone
class CameraPhone extends Camera with MobilePhone | 711Inheritance/Multiple | 16scala | 37ezy |
protocol Camera {
}
protocol Phone {
}
class CameraPhone: Camera, Phone {
} | 711Inheritance/Multiple | 17swift | nukil |
nivens = Enumerator.new {|y| (1..).each {|n| y << n if n.remainder(n.digits.sum).zero?} }
cur_gap = 0
puts 'Gap Index of gap Starting Niven'
nivens.each_cons(2).with_index(1) do |(n1, n2), i|
break if i > 10_000_000
if n2-n1 > cur_gap then
printf , n2-n1, i, n1
cur_gap = n2-n1
end
end | 715Increasing gaps between consecutive Niven numbers | 14ruby | f4jdr |
null | 715Increasing gaps between consecutive Niven numbers | 15rust | tghfd |
null | 712Inheritance/Single | 11kotlin | azl13 |
package main
import (
"fmt"
"unicode"
)
const (
lcASCII = "abcdefghijklmnopqrstuvwxyz"
ucASCII = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
)
func main() {
fmt.Println("ASCII lower case:")
fmt.Println(lcASCII)
for l := 'a'; l <= 'z'; l++ {
fmt.Print(string(l))
}
fmt.Println()
fmt.Println("\nASCII upper case:")
fmt.P... | 719Idiomatically determine all the lowercase and uppercase letters | 0go | qmmxz |
package main
import (
"fmt"
"math"
"strconv"
"strings"
)
const (
twoI = 2.0i
invTwoI = 1.0 / twoI
)
type quaterImaginary struct {
b2i string
}
func reverse(s string) string {
r := []rune(s)
for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
r[i], r[j] = r[j], r[i... | 720Imaginary base numbers | 0go | 6j73p |
package main
import (
"fmt"
"image"
"image/color"
"image/jpeg"
"math"
"os"
) | 721Image convolution | 0go | cpk9g |
package main
import (
"fmt"
"math"
) | 716Infinity | 0go | 4q852 |
package main
import (
"bufio"
"io"
"log"
"os"
)
func main() {
in := bufio.NewReader(os.Stdin)
for {
s, err := in.ReadString('\n')
if err != nil { | 713Input loop | 0go | nuji1 |
def lineMap = [:]
System.in.eachLine { line, i ->
lineMap[i] = line
}
lineMap.each { println it } | 713Input loop | 7groovy | s95q1 |
<?php
function buildInvertedIndex($filenames)
{
$invertedIndex = [];
foreach($filenames as $filename)
{
$data = file_get_contents($filename);
if($data === false) die('Unable to read file: ' . $filename);
preg_match_all('/(\w+)/', $data, $matches, PREG_SET_ORDER);
foreach... | 708Inverted index | 12php | s9jqs |
require v5.6.1;
require 5.6.1;
require 5.006_001; | 709Introspection | 2perl | jom7f |
func checkISBN(isbn: String) -> Bool {
guard!isbn.isEmpty else {
return false
}
let sum = isbn
.compactMap({ $0.wholeNumberValue })
.enumerated()
.map({ $0.offset & 1 == 1? 3 * $0.element: $0.element })
.reduce(0, +)
return sum% 10 == 0
}
let cases = [
"978-1734314502",
"978-173431450... | 704ISBN13 check digit | 17swift | 0c1s6 |
main = do putStrLn $ "Lower: " ++ ['a'..'z']
putStrLn $ "Upper: " ++ ['A'..'Z'] | 719Idiomatically determine all the lowercase and uppercase letters | 8haskell | mkkyf |
import java.util.stream.IntStream;
public class Letters {
public static void main(String[] args) throws Exception {
System.out.print("Upper case: ");
IntStream.rangeClosed(0, 0x10FFFF)
.filter(Character::isUpperCase)
.limit(72)
.forEach(n -> System... | 719Idiomatically determine all the lowercase and uppercase letters | 9java | f44dv |
import Data.Char (chr, digitToInt, intToDigit, isDigit, ord)
import Data.Complex (Complex (..), imagPart, realPart)
import Data.List (delete, elemIndex)
import Data.Maybe (fromMaybe)
base :: Complex Float
base = 0:+ 2
quotRemPositive :: Int -> Int -> (Int, Int)
quotRemPositive a b
| r < 0 = (1 + q, floor (realPart ... | 720Imaginary base numbers | 8haskell | jo87g |
import java.awt.image.*;
import java.io.File;
import java.io.IOException;
import javax.imageio.*;
public class ImageConvolution
{
public static class ArrayData
{
public final int[] dataArray;
public final int width;
public final int height;
public ArrayData(int width, int height)
{
this(... | 721Image convolution | 9java | r0qg0 |
def rank(arr)
arr.join('a').to_i(11)
end
def unrank(n)
n.to_s(11).split('a').map(&:to_i)
end
l = [1, 2, 3, 10, 100, 987654321]
p l
n = rank(l)
p n
l = unrank(n)
p l | 718Index finite lists of positive integers | 14ruby | cp19k |
object IndexFiniteList extends App {
val (defBase, s) = (10, Seq(1, 2, 3, 10, 100, 987654321))
def rank(x: Seq[Int], base: Int = defBase) =
BigInt(x.map(Integer.toString(_, base)).mkString(base.toHexString), base + 1)
def unrank(n: BigInt, base: Int = defBase): List[BigInt] =
n.toString(base + 1).split(... | 718Index finite lists of positive integers | 16scala | uwxv8 |
def biggest = { Double.POSITIVE_INFINITY } | 716Infinity | 7groovy | l1wc1 |
maxRealFloat :: RealFloat a => a -> a
maxRealFloat x = encodeFloat b (e-1) `asTypeOf` x where
b = floatRadix x - 1
(_,e) = floatRange x
infinity :: RealFloat a => a
infinity = if isInfinite inf then inf else maxRealFloat 1.0 where
inf = 1/0 | 716Infinity | 8haskell | qmlx9 |
import System.IO
readLines :: Handle -> IO [String]
readLines h = do
s <- hGetContents h
return $ lines s
readWords :: Handle -> IO [String]
readWords h = do
s <- hGetContents h
return $ words s | 713Input loop | 8haskell | uwov2 |
import BigInt
func integerSquareRoot<T: BinaryInteger>(_ num: T) -> T {
var x: T = num
var q: T = 1
while q <= x {
q <<= 2
}
var r: T = 0
while q > 1 {
q >>= 2
let t: T = x - r - q
r >>= 1
if t >= 0 {
x = t
r += q
}
}
... | 705Isqrt (integer square root) of X | 17swift | 378z2 |
$ irb
irb(main):001:0> def f(string1, string2, separator)
irb(main):002:1> [string1, '', string2].join(separator)
irb(main):003:1> end
=> :f
irb(main):004:0> f('Rosetta', 'Code', ':')
=>
irb(main):005:0> exit
$ | 707Interactive programming (repl) | 14ruby | 4q65p |
(load "path/to/file") | 723Include a file | 6clojure | 4qa5o |
Class = {
classname = "Class aka Object aka Root-Of-Tree",
new = function(s,t)
s.__index = s
local instance = setmetatable(t or {}, s)
instance.parent = s
return instance
end
}
Animal = Class:new{classname="Animal", speak=function(s) return s.voice or "("..s.classname.." has no voice)" end }
Cat ... | 712Inheritance/Single | 1lua | e32ac |
null | 719Idiomatically determine all the lowercase and uppercase letters | 11kotlin | 8ll0q |
function ASCIIstring (pattern)
local matchString, ch = ""
for charNum = 0, 255 do
ch = string.char(charNum)
if string.match(ch, pattern) then
matchString = matchString .. ch
end
end
return matchString
end
print(ASCIIstring("%l"))
print(ASCIIstring("%u")) | 719Idiomatically determine all the lowercase and uppercase letters | 1lua | o228h |
null | 721Image convolution | 10javascript | bdiki |
<?php
if (version_compare(PHP_VERSION, '5.3.0', '<' ))
{
echo( . PHP_VERSION . );
exit();
}
$bloop = -3;
if (isset($bloop) && function_exists('abs'))
{
echo(abs($bloop));
}
echo(count($GLOBALS) . );
echo(array_sum($GLOBALS) . );
?> | 709Introspection | 12php | tgef1 |
my @prisoner = 0 .. 40;
my $k = 3;
until (@prisoner == 1) {
push @prisoner, shift @prisoner for 1 .. $k-1;
shift @prisoner;
}
print "Prisoner @prisoner survived.\n" | 702Josephus problem | 2perl | zritb |
name: myapp
version: "1.0"
author: A Rust Developer <rustme@home.com>
about: Does awesome things
args:
- STRING1:
about: First string to use
required: true
index: 1
- STRING2:
about: Second string to use
required: true
index: 2
- SEPARATOR:
about: Separtor to use
re... | 707Interactive programming (repl) | 15rust | gsy4o |
C:\>scala
Welcome to Scala version 2.8.0.r21356-b20100407020120 (Java HotSpot(TM) Client V
M, Java 1.6.0_05).
Type in expressions to have them evaluated.
Type :help for more information.
scala> "rosetta"
res0: java.lang.String = rosetta | 707Interactive programming (repl) | 16scala | joc7i |
public class ImaginaryBaseNumber {
private static class Complex {
private Double real, imag;
public Complex(double r, double i) {
this.real = r;
this.imag = i;
}
public Complex(int r, int i) {
this.real = (double) r;
this.imag = (doub... | 720Imaginary base numbers | 9java | uwevv |
double infinity = Double.POSITIVE_INFINITY; | 716Infinity | 9java | pf3b3 |
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
Type , or for more information.
>>> for calc in ''' -(-2147483647-1)
2000000000 + 2000000000
-2147483647 - 2147483647
46341 * 46341
(-2147483647-1) / -1'''.split('\n'):
ans = eval(calc)
print('Expression:%r evaluates to... | 710Integer overflow | 3python | joy7p |
import java.io.InputStream;
import java.util.Scanner;
public class InputLoop {
public static void main(String args[]) { | 713Input loop | 9java | mkwym |
'''
This implements: http:
'''
from pprint import pprint as pp
from glob import glob
try: reduce
except: from functools import reduce
try: raw_input
except: raw_input = input
def parsetexts(fileglob='InvertedIndex/T*.txt'):
texts, words = {}, set()
for txtfile in glob(fileglob):
with open(txtfile,... | 708Inverted index | 3python | vef29 |
for $i (0..2**8-1) {
$c = chr $i;
$lower .= $c if $c =~ /[[:lower:]]/;
$upper .= $c if $c =~ /[[:upper:]]/;
}
print "$lower\n";
print "$upper\n"; | 719Idiomatically determine all the lowercase and uppercase letters | 2perl | 4qq5d |
classes = (str.isupper, str.islower, str.isalnum, str.isalpha, str.isdecimal,
str.isdigit, str.isidentifier, str.isnumeric, str.isprintable,
str.isspace, str.istitle)
for stringclass in classes:
chars = ''.join(chr(i) for i in range(0x10FFFF+1) if stringclass(chr(i)))
print('\nString clas... | 719Idiomatically determine all the lowercase and uppercase letters | 3python | gss4h |
null | 721Image convolution | 11kotlin | ve121 |
Infinity | 716Infinity | 10javascript | xycw9 |
$ js -e 'while (line = readline()) { do_something_with(line); }' < inputfile | 713Input loop | 10javascript | ve825 |
<?php
function Jotapata($n=41,$k=3,$m=1){$m--;
$prisoners=array_fill(0,$n,false);
$deadpool=1;
$order=0;
while((array_sum(array_count_values($prisoners))<$n)){
foreach($prisoners as $thisPrisoner=>$dead){
if(!$dead){
if($deadpool==$k){
$order++;
$prisoners[$thisPrisoner]=((($n-$m)>($order)... | 702Josephus problem | 12php | bdrk9 |
LETTERS
letters | 719Idiomatically determine all the lowercase and uppercase letters | 13r | vee27 |
null | 720Imaginary base numbers | 11kotlin | 9bkmh |
fun main(args: Array<String>) {
val p = Double.POSITIVE_INFINITY | 716Infinity | 11kotlin | 78nr4 |
import sys
major, minor, bugfix = sys.version_info[:3]
if major < 2:
sys.exit('Python 2 is required')
def defined(name):
return name in globals() or name in locals() or name in vars(__builtins__)
def defined2(name):
try:
eval(name)
return True
except NameError:
... | 709Introspection | 3python | hi9jw |
package main
import (
"bufio"
"fmt"
"log"
"math/rand"
"os"
"strconv"
"strings"
"time"
)
var cave = map[int][3]int{
1: {2, 3, 4}, 2: {1, 5, 6}, 3: {1, 7, 8}, 4: {1, 9, 10}, 5: {2, 9, 11},
6: {2, 7, 12}, 7: {3, 6, 13}, 8: {3, 10, 14}, 9: {4, 5, 15}, 10: {4, 8, 16},
11: {5, 12... | 724Hunt the Wumpus | 0go | knshz |
package main
import (
"code.google.com/p/x-go-binding/ui/x11"
"fmt"
"image"
"image/color"
"image/draw"
"log"
"os"
"time"
)
var randcol = genrandcol()
func genrandcol() <-chan color.Color {
c := make(chan color.Color)
go func() {
for {
select {
... | 722Image noise | 0go | w6teg |
2.1.1:001 > a = 2**62 -1
=> 4611686018427387903
2.1.1:002 > a.class
=> Fixnum
2.1.1:003 > (b = a + 1).class
=> Bignum
2.1.1:004 > (b-1).class
=> Fixnum | 710Integer overflow | 14ruby | kn9hg |
error: attempt to divide with overflow
--> src/main.rs:3:23
|
3 | let i32_5: i32 = (-2_147_483_647 - 1) / -1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(const_err)]` on by default | 710Integer overflow | 15rust | bdckx |
null | 713Input loop | 11kotlin | tgbf0 |
if(getRversion() < "2.14.1")
{
warning("Your version of R is older than 2.14.1")
q()
} | 709Introspection | 13r | gs347 |
int main()
{
int a, b;
scanf(, &a, &b);
if (a < b)
printf(, a, b);
if (a == b)
printf(, a, b);
if (a > b)
printf(, a, b);
return 0;
} | 725Integer comparison | 5c | 6ju32 |
bool isHumble(int i) {
if (i <= 1) return true;
if (i % 2 == 0) return isHumble(i / 2);
if (i % 3 == 0) return isHumble(i / 3);
if (i % 5 == 0) return isHumble(i / 5);
if (i % 7 == 0) return isHumble(i / 7);
return false;
}
int main() {
int limit = SHRT_MAX;
int humble[16];
int coun... | 726Humble numbers | 5c | l1rcy |
import System.Random
import System.IO
import Data.List
import Data.Char
import Control.Monad
cave :: [[Int]]
cave = [
[1,4,7], [0,2,9], [1,3,11], [2,4,13], [0,3,5],
[4,6,14], [5,7,16], [0,6,8], [7,9,17], [1,8,10],
[9,11,18], [2,10,12], [11,13,19], [3,12,14], [5,13,15],
[14,16,19], [... | 724Hunt the Wumpus | 8haskell | nu9ie |
puts , [*..].join, , [*..].join | 719Idiomatically determine all the lowercase and uppercase letters | 14ruby | 788ri |
fn main() {
println!(
"Lowercase letters: {}",
(b'a'..=b'z').map(|c| c as char).collect::<String>()
);
println!(
"Uppercase letters: {}",
(b'A'..=b'Z').map(|c| c as char).collect::<String>()
);
} | 719Idiomatically determine all the lowercase and uppercase letters | 15rust | joo72 |
object IdiomaticallyDetermineLowercaseUppercase extends App {
println("Upper case: "
+ (0 to 0x10FFFF).map(_.toChar).filter(_.isUpper).take(72).mkString + "...")
println("Lower case: "
+ (0 to 0x10FFFF).map(_.toChar).filter(_.isLower).take(72).mkString + "...")
} | 719Idiomatically determine all the lowercase and uppercase letters | 16scala | bddk6 |
cabal install glfw-b | 722Image noise | 8haskell | 6jg3k |
function infinity()
return 1/0 | 716Infinity | 1lua | jod71 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.