This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main(){for(;;)puts("a");} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use srfi-1) | |
(use srfi-13) | |
(use text.tree) | |
(define *width* 83) | |
(define (gidx lis) | |
(let lp ((lis lis) (idx 0) (res '())) | |
(if (null? lis) | |
(reverse res) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; in Scheme/Gauche | |
(use srfi-1) | |
(use util.combinations) | |
(define *filename* "./cipher1.txt") | |
(define *data* | |
(call-with-input-file *filename* | |
(compose | |
read-from-string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; in Scheme/Gauche | |
(add-load-path ".") | |
(use srfi-1) | |
(use scythe) | |
(define prime? | |
(prime-predicator 688590082)) | |
(define (corners l) | |
(map (compose (pa$ - (* l l)) (pa$ * (- l 1))) (iota 4))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; in Scheme/Gauche | |
(use srfi-1) | |
(format #t "~D~%" | |
(count | |
(lambda (e) (> (string-length (number->string (numerator e))) | |
(string-length (number->string (denominator e))))) | |
(let recur ((res '()) (n 1000) (d 3/2)) | |
(if (zero? n) | |
(reverse res) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; in Scheme/Gauche | |
(use srfi-1) | |
(use srfi-42) | |
(format #t "~D~%" | |
(apply max | |
(map | |
(compose | |
(apply$ +) | |
(map$ digit->integer) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; in Scheme/Gauche | |
(use srfi-13) | |
(use srfi-1) | |
(format #t "~D~%" | |
(count | |
(let ((rev (compose string->number string-reverse number->string))) | |
(rec (co e :optional (l 50)) | |
(if (zero? l) #t | |
(let ((d (+ e (rev e)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; in Scheme/Gauche | |
(use srfi-1) | |
(use srfi-42) | |
(define (permutation n r) | |
(let recur ((res 1) (n n) (r r)) | |
(if (zero? r) res | |
(recur (* res n) (- n 1) (- r 1))))) | |
(define (factorial n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; in Scheme/Gauche | |
(use srfi-1) | |
(define n->l (compose (cut sort <> char<?) string->list number->string)) | |
(format #t "~D~%" | |
(let recur ((n 1)) | |
(let ((orig (n->l n))) | |
(or (and (every | |
(lambda (e) (equal? orig (n->l (* n e)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; in Scheme/Gauche | |
(add-load-path ".") | |
(use srfi-1) | |
(use scythe) | |
(define limit 1000000) | |
(format #t "~D~%" | |
(receive (primes prime?) (primes limit) | |
(define (solver lis) |