code stringlengths 1 46.1k ⌀ | label class label 1.18k
classes | domain_label class label 21
classes | index stringlengths 4 5 |
|---|---|---|---|
(defn sb-step [v]
(let [i (quot (count v) 2)]
(conj v (+ (v (dec i)) (v i)) (v i))))
(def all-sbs (sequence (map peek) (iterate sb-step [1 1])))
(defn first-appearance [n]
(first (keep-indexed (fn [i x] (when (= x n) i)) all-sbs)))
(defn gcd [a b]
(loop [a (if (neg? a) (- a) a)
b (if (neg? b) (... | 201Stern-Brocot sequence | 6clojure | z8ltj |
void step_up(void)
{
while (!step()) {
step_up();
}
} | 203Stair-climbing puzzle | 5c | 9fum1 |
import java.util.*;
import java.util.stream.*;
public class StateNamePuzzle {
static String[] states = {"Alabama", "Alaska", "Arizona", "Arkansas",
"California", "Colorado", "Connecticut", "Delaware", "Florida",
"Georgia", "hawaii", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa",
"Kansas... | 199State name puzzle | 9java | ct79h |
(def level (atom 41))
(def prob 0.5001)
(defn step
[]
(let [success (< (rand) prob)]
(swap! level (if success inc dec))
success) ) | 203Stair-climbing puzzle | 6clojure | uy7vi |
my $str = 'Foo';
$str .= 'bar';
print $str; | 193String append | 2perl | lzac5 |
package main
import (
"fmt"
"runtime"
)
func main() {
stackTrace := make([]byte, 1024)
n := runtime.Stack(stackTrace, true)
stackTrace = stackTrace[:n]
fmt.Printf("%s\n", stackTrace)
fmt.Printf("(%d bytes)\n", len(stackTrace))
} | 202Stack traces | 0go | spdqa |
null | 199State name puzzle | 11kotlin | 3ouz5 |
def rawTrace = { Thread.currentThread().stackTrace } | 202Stack traces | 7groovy | a701p |
use constant pi => 3.14159265;
use List::Util qw(sum reduce min max);
sub normdist {
my($m, $sigma) = @_;
my $r = sqrt -2 * log rand;
my $theta = 2 * pi * rand;
$r * cos($theta) * $sigma + $m;
}
$size = 100000; $mean = 50; $stddev = 4;
push @dataset, normdist($mean,$stddev) for 1..$size;
my $m = sum... | 197Statistics/Normal distribution | 2perl | 49e5d |
package main
import (
"fmt"
"sort"
"strconv"
"strings"
)
var data = `12 127 28 42` | 198Stem-and-leaf plot | 0go | rlwgm |
public class StackTracer {
public static void printStackTrace() {
StackTraceElement[] elems = Thread.currentThread().getStackTrace();
System.out.println("Stack trace:");
for (int i = elems.length-1, j = 2 ; i >= 3 ; i--, j+=2) {
System.out.printf("%" + j + "s%s.%s%n", "",
elems[i].getClassName(), ele... | 202Stack traces | 9java | t09f9 |
try {
throw new Error;
} catch(e) {
alert(e.stack);
} | 202Stack traces | 10javascript | mduyv |
import Data.List
import Control.Arrow
import Control.Monad
nlsRaw = "12 127 28 42 39 113 42 18 44 118 44 37 113 124 37 48 127 36 29 31"
++ " 125 139 131 115 105 132 104 123 35 113 122 42 117 119 58 109 23 105 63"
++ " 27 44 105 99 41 128 121 116 125 32 61 37 127 29 113 121 58 114 126 53"
++ " 114 96 25 109 7 31 ... | 198Stem-and-leaf plot | 8haskell | 016s7 |
null | 202Stack traces | 11kotlin | oez8z |
use warnings;
use strict;
use feature qw{ say };
sub uniq {
my %uniq;
undef @uniq{ @_ };
return keys %uniq
}
sub puzzle {
my @states = uniq(@_);
my %pairs;
for my $state1 (@states) {
for my $state2 (@states) {
next if $state1 le $state2;
my $both = join q(),
... | 199State name puzzle | 2perl | pg8b0 |
str = ;
str += ;
print(str) | 193String append | 3python | 23elz |
function Inner( k )
print( debug.traceback() )
print "Program continues..."
end
function Middle( x, y )
Inner( x+y )
end
function Outer( a, b, c )
Middle( a*b, c )
end
Outer( 2, 3, 5 ) | 202Stack traces | 1lua | iw3ot |
const unsigned long multiplier[] = {1, 3, 5, 7, 11, 3*5, 3*7, 3*11, 5*7, 5*11, 7*11, 3*5*7, 3*5*11, 3*7*11, 5*7*11, 3*5*7*11};
unsigned long long gcd(unsigned long long a, unsigned long long b)
{
while (b != 0)
{
a %= b;
a ^= b;
b ^= a;
a ^= b;
}
return a;
}
unsigned l... | 204Square form factorization | 5c | md2ys |
typedef unsigned char bool;
typedef unsigned long long uint64;
void sieve(uint64 limit, uint64 *primes, uint64 *length) {
uint64 i, count, p, p2;
bool *c = calloc(limit + 1, sizeof(bool));
primes[0] = 2;
count = 1;
p = 3;
for (;;) {
p2 = p * p;
if (p2 > limit) break;
... | 205Square-free integers | 5c | 4975t |
from __future__ import division
import matplotlib.pyplot as plt
import random
mean, stddev, size = 50, 4, 100000
data = [random.gauss(mean, stddev) for c in range(size)]
mn = sum(data) / size
sd = (sum(x*x for x in data) / size
- (sum(data) / size) ** 2) ** 0.5
print(
% (mn, sd, max(data), min(data), s... | 197Statistics/Normal distribution | 3python | gcw4h |
func step_up(){for !step(){step_up()}} | 203Stair-climbing puzzle | 0go | ej0a6 |
class Stair_climbing{
static void main(String[] args){
}
static def step_up(){
while not step(){
step_up();
}
}
} | 203Stair-climbing puzzle | 7groovy | k5eh7 |
stepUp :: Robot ()
stepUp = untilM step stepUp
untilM :: Monad m => m Bool -> m () -> m ()
untilM test action = do
result <- test
if result then return () else action >> untilM test action | 203Stair-climbing puzzle | 8haskell | 3oczj |
n <- 100000
u <- sqrt(-2*log(runif(n)))
v <- 2*pi*runif(n)
x <- u*cos(v)
y <- v*sin(v)
hist(x) | 197Statistics/Normal distribution | 13r | v6p27 |
public void stepUp() {
while (!step()) stepUp();
} | 203Stair-climbing puzzle | 9java | iwzos |
package main
import (
"fmt"
"math"
)
func isqrt(x uint64) uint64 {
x0 := x >> 1
x1 := (x0 + x/x0) >> 1
for x1 < x0 {
x0 = x1
x1 = (x0 + x/x0) >> 1
}
return x0
}
func gcd(x, y uint64) uint64 {
for y != 0 {
x, y = y, x%y
}
return x
}
var multiplier = []u... | 204Square form factorization | 0go | a7q1f |
from collections import defaultdict
states = [, , , ,
, , , , ,
, , , , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , ,
, , , , , ,
, , , ,
]
states = sorted(set(states))
smap = defaultdict(list)
for i, s1 in enumerate(states[:-1]):
for s2 in states[i + 1:]:
smap[.join(sorted(s1 + s2))].append(s1... | 199State name puzzle | 3python | 1ropc |
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
public class StemAndLeaf {
private static int[] data = { 12, 127, 28, 42, 39, 113, 42, 18, 44, 118,
44, 37, 113, 124, 37, 48, 127, 36, 29, 31, 125, 139, 131, 115, 105,
132, 104, 123,... | 198Stem-and-leaf plot | 9java | a7n1y |
null | 203Stair-climbing puzzle | 11kotlin | qbix1 |
double rand01() { return rand() / (RAND_MAX + 1.0); }
double avg(int count, double *stddev, int *hist)
{
double x[count];
double m = 0, s = 0;
for (int i = 0; i < n_bins; i++) hist[i] = 0;
for (int i = 0; i < count; i++) {
m += (x[i] = rand01());
hist[(int)(x[i] * n_bins)] ++;
}
m /= count;
for (int i = 0... | 206Statistics/Basic | 5c | 5mguk |
s =
s +=
s <<
puts s | 193String append | 14ruby | uyxvz |
use std::ops::Add;
fn main(){
let hello = String::from("Hello world");
println!("{}", hello.add("!!!!"));
} | 193String append | 15rust | 5mquq |
<!DOCTYPE html PUBLIC "- | 198Stem-and-leaf plot | 10javascript | sp3qz |
use Carp 'cluck';
sub g {cluck 'Hello from &g';}
sub f {g;}
f; | 202Stack traces | 2perl | gcb4e |
function step_up()
while not step() do step_up() end
end | 203Stair-climbing puzzle | 1lua | spnq8 |
use strict;
use warnings;
use feature 'say';
use ntheory <is_prime gcd forcomb vecprod>;
my @multiplier;
my @p = <3 5 7 11>;
forcomb { push @multiplier, vecprod @p[@_] } scalar @p;
sub sff {
my($N) = shift;
return 1 if is_prime $N;
return sqrt $N if sqrt($N) == int sqrt $N;
for my $... | 204Square form factorization | 2perl | 234lf |
var d = "Hello" | 193String append | 16scala | rl8gn |
class NormalFromUniform
def initialize()
@next = nil
end
def rand()
if @next
retval, @next = @next, nil
return retval
else
u = v = s = nil
loop do
u = Random.rand(-1.0..1.0)
v = Random.rand(-1.0..1.0)
s = u**2 + v**2
break if (s > 0.0) && (... | 197Statistics/Normal distribution | 14ruby | 72qri |
package main
import (
"fmt"
"sternbrocot"
)
func main() { | 201Stern-Brocot sequence | 0go | gcp4n |
<?php
class StackTraceDemo {
static function inner() {
debug_print_backtrace();
}
static function middle() {
self::inner();
}
static function outer() {
self::middle();
}
}
StackTraceDemo::outer();
?> | 202Stack traces | 12php | nx6ig |
package main
import (
"fmt"
"math"
)
func sieve(limit uint64) []uint64 {
primes := []uint64{2}
c := make([]bool, limit+1) | 205Square-free integers | 0go | oed8q |
require 'set'
Primes = [ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,
43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]
States = [
, , , , , ,
, , , , , ,
, , , , , , ,
, , , , ,
, , , , , ,
, , , , ,
, , , , ,
, , , , , ,
, , ,
]
def print_answer(states)
... | 199State name puzzle | 14ruby | ejnax |
null | 197Statistics/Normal distribution | 15rust | jvs72 |
import Data.List (elemIndex)
sb :: [Int]
sb = 1: 1: f (tail sb) sb
where
f (a: aa) (b: bb) = a + b: a: f aa bb
main :: IO ()
main = do
print $ take 15 sb
print
[ (i, 1 + (\(Just i) -> i) (elemIndex i sb))
| i <- [1 .. 10] <> [100]
]
print $
all (\(a, b) -> 1 == gcd a b) $
take 1000... | 201Stern-Brocot sequence | 8haskell | spfqk |
import traceback
def f(): return g()
def g(): traceback.print_stack()
f() | 202Stack traces | 3python | rlpgq |
import Data.List.Split (chunksOf)
import Math.NumberTheory.Primes (factorise)
import Text.Printf (printf)
isSquareFree :: Integer -> Bool
isSquareFree = all ((== 1) . snd) . factorise
squareFrees :: Integer -> Integer -> [Integer]
squareFrees lo hi = filter isSquareFree [lo..hi]
counts :: (Ord a, Num b) => [a] ... | 205Square-free integers | 8haskell | 235ll |
object StateNamePuzzle extends App { | 199State name puzzle | 16scala | spzqo |
var s = "foo" | 193String append | 17swift | v6w2r |
null | 198Stem-and-leaf plot | 11kotlin | husj3 |
foo <- function()
{
bar <- function()
{
sys.calls()
}
bar()
}
foo() | 202Stack traces | 13r | uyjvx |
import java.util.ArrayList;
import java.util.List;
public class SquareFree
{
private static List<Long> sieve(long limit) {
List<Long> primes = new ArrayList<Long>();
primes.add(2L);
boolean[] c = new boolean[(int)limit + 1]; | 205Square-free integers | 9java | 6i93z |
data = { 12,127,28,42,39,113, 42,18,44,118,44,37,113,124,37,48,127,36,29,31,
125,139,131,115,105,132,104,123,35,113,122,42,117,119,58,109,23,105,
63,27,44,105,99,41,128,121,116,125,32,61,37,127,29,113,121,58,114,126,
53,114,96,25,109,7,31,141,46,13,27,43,117,116,27,7,68,40,31,115,124,42,
128,52,... | 198Stem-and-leaf plot | 1lua | k50h2 |
import java.math.BigInteger;
import java.util.LinkedList;
public class SternBrocot {
static LinkedList<Integer> sequence = new LinkedList<Integer>(){{
add(1); add(1);
}};
private static void genSeq(int n){
for(int conIdx = 1; sequence.size() < n; conIdx++){
int consider = sequence.get(conIdx);
int pre = ... | 201Stern-Brocot sequence | 9java | 1r0p2 |
sub step_up { step_up until step; } | 203Stair-climbing puzzle | 2perl | v6r20 |
void end_with_db(void);
MYSQL *mysql = NULL;
bool connect_db(const char *host, const char *user, const char *pwd,
const char *db, unsigned int port)
{
if ( mysql == NULL )
{
if (mysql_library_init(0, NULL, NULL)) return false;
mysql = mysql_init(NULL); if ( mysql == NULL ) return false;
MYSQL *myp ... | 207SQL-based authentication | 5c | qbsxc |
import 'dart:math' as Math show sqrt, pow, Random; | 206Statistics/Basic | 18dart | 9flm8 |
(() => {
'use strict';
const main = () => { | 201Stern-Brocot sequence | 10javascript | qbdx8 |
def outer(a,b,c)
middle a+b, b+c
end
def middle(d,e)
inner d+e
end
def inner(f)
puts caller(0)
puts
end
outer 2,3,5 | 202Stack traces | 14ruby | jva7x |
package main
import (
"bytes"
"crypto/md5"
"crypto/rand"
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
)
func connectDB() (*sql.DB, error) {
return sql.Open("mysql", "rosetta:code@/rc")
}
func createUser(db *sql.DB, user, pwd string) error {
salt := make([]byte, 16)
ran... | 207SQL-based authentication | 0go | 23vl7 |
null | 205Square-free integers | 11kotlin | dqznz |
def callStack = try { error("exception") } catch { case ex => ex.getStackTrace drop 2 }
def printStackTrace = callStack drop 1 foreach println | 202Stack traces | 16scala | pgqbj |
def step_up1():
deficit = 1
while deficit > 0:
if step():
deficit -= 1
else:
deficit += 1 | 203Stair-climbing puzzle | 3python | uy7vd |
step <- function() {
success <- runif(1) > p
level <<- level - 1 + (2 * success)
success
} | 203Stair-climbing puzzle | 13r | ct595 |
import java.io.UnsupportedEncodingException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import... | 207SQL-based authentication | 9java | jvh7c |
function squareFree (n)
for root = 2, math.sqrt(n) do
if n % (root * root) == 0 then return false end
end
return true
end
function run (lo, hi, showValues)
io.write("From " .. lo .. " to " .. hi)
io.write(showValues and ":\n" or " = ")
local count = 0
for i = lo, hi do
if squareFree(i) then
... | 205Square-free integers | 1lua | fs3dp |
null | 207SQL-based authentication | 11kotlin | 5m4ua |
null | 201Stern-Brocot sequence | 11kotlin | jve7r |
def step_up
start_position = $position
step until ($position == start_position + 1)
end
def step
if rand < 0.5
$position -= 1
p if $DEBUG
return false
else
$position += 1
p if $DEBUG
return true
end
end
$position = 0
step_up | 203Stair-climbing puzzle | 14ruby | 49h5p |
int main() {
int n = 1, count = 0, sq, cr;
for ( ; count < 30; ++n) {
sq = n * n;
cr = (int)cbrt((double)sq);
if (cr * cr * cr != sq) {
count++;
printf(, sq);
}
else {
printf(, sq);
}
}
return 0;
} | 208Square but not cube | 5c | 3o3za |
package main
import (
"fmt"
"math"
"math/rand"
"strings"
)
func main() {
sample(100)
sample(1000)
sample(10000)
}
func sample(n int) { | 206Statistics/Basic | 0go | 8ai0g |
null | 201Stern-Brocot sequence | 1lua | huwj8 |
fn step_up() {
while!step() {
step_up();
}
} | 203Stair-climbing puzzle | 15rust | gck4o |
use DBI;
sub connect_db {
my ($dbname, $host, $user, $pass) = @_;
my $db = DBI->connect("dbi:mysql:$dbname:$host", $user, $pass)
or die $DBI::errstr;
$db->{RaiseError} = 1;
$db
}
sub create_user {
my ($db, $user, $pass) = @_;
my $salt = pack "C*", map {int rand 256} 1..16;
$d... | 207SQL-based authentication | 2perl | oei8x |
import Data.Foldable (foldl')
import System.Random (randomRs, newStdGen)
import Control.Monad (zipWithM_)
import System.Environment (getArgs)
intervals :: [(Double, Double)]
intervals = map conv [0 .. 9]
where
xs = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
conv s =
let [h, l] = take 2 $ ... | 206Statistics/Basic | 8haskell | lzvch |
def stepUp { while (! step) stepUp } | 203Stair-climbing puzzle | 16scala | jv17i |
my @data = sort {$a <=> $b} qw( 12 127 28 42 39 113 42 18 44 118 44
37 113 124 37 48 127 36 29 31 125 139 131 115 105 132 104 123 35 113
122 42 117 119 58 109 23 105 63 27 44 105 99 41 128 121 116 125 32
61 37 127 29 113 121 58 114 126 53 114 96 25 109 7 31 141 46 13
27 43 117 ... | 198Stem-and-leaf plot | 2perl | z8utb |
function connect_db($database, $db_user, $db_password, $host = 'localhost', $port = NULL, $die = false) {
if(!$db_handle = @mysql_connect($host.($port? ':'.$port : ''), $db_user, $db_password)) {
if($die)
die(.mysql_error());
else
return false;
}
if(!@mysql_select_db($database, $db_handle)) {
if... | 207SQL-based authentication | 12php | gcr42 |
(def squares (map #(* % %) (drop 1 (range))))
(def square-cubes (map #(int (. Math pow % 6)) (drop 1 (range))))
(def squares-not-cubes (filter #(not (= % (first (drop-while (fn [n] (< n %)) square-cubes)))) squares))
(println "Squares but not cubes:")
(println (take 30 squares-not-cubes))
(println "Both squares and c... | 208Square but not cube | 6clojure | ctc9b |
import static java.lang.Math.pow;
import static java.util.Arrays.stream;
import static java.util.stream.Collectors.joining;
import static java.util.stream.IntStream.range;
public class Test {
static double[] meanStdDev(double[] numbers) {
if (numbers.length == 0)
return new double[]{0.0, 0.0};
... | 206Statistics/Basic | 9java | 3oyzg |
func step_up() {
while!step() {
step_up()
}
} | 203Stair-climbing puzzle | 17swift | 5mju8 |
import mysql.connector
import hashlib
import sys
import random
DB_HOST =
DB_USER =
DB_PASS =
DB_NAME =
def connect_db():
''' Try to connect DB and return DB instance, if not, return False '''
try:
return mysql.connector.connect(host=DB_HOST, user=DB_USER, passwd=DB_PASS, db=DB_N... | 207SQL-based authentication | 3python | iwnof |
use ntheory qw/is_square_free moebius/;
sub square_free_count {
my ($n) = @_;
my $count = 0;
foreach my $k (1 .. sqrt($n)) {
$count += moebius($k) * int($n / $k**2);
}
return $count;
}
print "Squarefree numbers between 1 and 145:\n";
print join(' ', grep { is_square_free($_) } 1 .. 145), "... | 205Square-free integers | 2perl | jvb7f |
void talk(const char *s)
{
pid_t pid;
int status;
pid = fork();
if (pid < 0) {
perror();
exit(1);
}
if (pid == 0) {
execlp(, , s, (void*)0);
perror();
_exit(1);
}
waitpid(pid, &status, 0);
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
exit(1);
}
int main()
{
talk();
return 0;
} | 209Speech synthesis | 5c | rc4g7 |
require 'mysql2'
require 'securerandom'
require 'digest'
def connect_db(host, port = nil, username, password, db)
Mysql2::Client.new(
host: host,
port: port,
username: username,
password: password,
database: db
)
end
def create_user(client, username, password)
salt = SecureRandom.random_byte... | 207SQL-based authentication | 14ruby | dqfns |
(use 'speech-synthesis.say)
(say "This is an example of speech synthesis.") | 209Speech synthesis | 6clojure | b5hkz |
null | 206Statistics/Basic | 11kotlin | nxfij |
import math
def SquareFree ( _number ):
max = (int) (math.sqrt ( _number ))
for root in range ( 2, max+1 ):
if 0 == _number% ( root * root ):
return False
return True
def ListSquareFrees( _start, _end ):
count = 0
for i in range ( _start, _end+1 ):
if True == SquareFree( i ):
print ( .format(i),... | 205Square-free integers | 3python | hupjw |
package main
import (
"go/build"
"log"
"path/filepath"
"github.com/unixpickle/gospeech"
"github.com/unixpickle/wav"
)
const pkgPath = "github.com/unixpickle/gospeech"
const input = "This is an example of speech synthesis."
func main() {
p, err := build.Import(pkgPath, ".", build.FindOnly)
... | 209Speech synthesis | 0go | nwoi1 |
'say "This is an example of speech synthesis."'.execute() | 209Speech synthesis | 7groovy | sbxq1 |
from collections import namedtuple
from pprint import pprint as pp
from math import floor
Stem = namedtuple('Stem', 'data, leafdigits')
data0 = Stem((12, 127, 28, 42, 39, 113, 42, 18, 44, 118, 44, 37, 113, 124, 37,
48, 127, 36, 29, 31, 125, 139, 131, 115, 105, 132, 104, 123, 35,
113, 122, ... | 198Stem-and-leaf plot | 3python | 3o5zc |
import System.Process (callProcess)
say text = callProcess "espeak" ["
main = say "This is an example of speech synthesis." | 209Speech synthesis | 8haskell | u62v2 |
var utterance = new SpeechSynthesisUtterance("This is an example of speech synthesis.");
window.speechSynthesis.speak(utterance); | 209Speech synthesis | 10javascript | v3l25 |
math.randomseed(os.time())
function randList (n) | 206Statistics/Basic | 1lua | dqtnq |
x <- c(12, 127, 28, 42, 39, 113, 42, 18, 44, 118, 44, 37, 113, 124, 37, 48, 127, 36,
29, 31, 125, 139, 131, 115, 105, 132, 104, 123, 35, 113, 122, 42, 117, 119, 58, 109,
23, 105, 63, 27, 44, 105, 99, 41, 128, 121, 116, 125, 32, 61, 37, 127, 29, 113,
121, 58, 114, 126, 53, 114, 96, 25, 109, 7, 31, 141, 46, 13, 27, 43... | 198Stem-and-leaf plot | 13r | dqlnt |
use strict;
use warnings;
sub stern_brocot {
my @list = (1, 1);
sub {
push @list, $list[0] + $list[1], $list[1];
shift @list;
}
}
{
my $generator = stern_brocot;
print join ' ', map &$generator, 1 .. 15;
print "\n";
}
for (1 .. 10, 100) {
my $index = 1;
my $generator = stern_brocot... | 201Stern-Brocot sequence | 2perl | t0cfg |
null | 209Speech synthesis | 11kotlin | tsdf0 |
require
class Integer
def square_free?
prime_division.none?{|pr, exp| exp > 1}
end
end
puts (1..145).select(&:square_free?).each_slice(20).map{|a| a.join()}
puts
m = 10**12
puts (m..m+145).select(&:square_free?).each_slice(6).map{|a| a.join()}
puts
markers = [100, 1000, 10_000, 100_000, 1_000_000]
count = ... | 205Square-free integers | 14ruby | b4akq |
char *split(char *str);
int main(int argc,char **argv)
{
char input[13]=;
printf(,split(input));
}
char *split(char *str)
{
char last=*str,*result=malloc(3*strlen(str)),*counter=result;
for (char *c=str;*c;c++) {
if (*c!=last) {
strcpy(counter,);
counter+=2;
last=*c;
}
*counter=*c;
counter++;
}
*... | 210Split a character string based on change of character | 5c | 81q04 |
while:; do
for rod in \| / - \\; do printf ' %s\r' $rod; sleep 0.25; done
done | 211Spinning rod animation/Text | 4bash | xh1wb |
int main() {
int i, j, ms = 250;
const char *a = ;
time_t start, now;
struct timespec delay;
delay.tv_sec = 0;
delay.tv_nsec = ms * 1000000L;
printf();
time(&start);
while(1) {
for (i = 0; i < 4; i++) {
printf();
printf();
... | 211Spinning rod animation/Text | 5c | sbeq5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.