aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyoungjin JEON <jeongoon@gmail.com>2020-09-04 19:49:02 +1000
committerMyoungjin JEON <jeongoon@gmail.com>2020-09-04 19:49:02 +1000
commit5a2d74170cae763d960bdc11dadd8ff0c44adf49 (patch)
tree2802c00cf6e279e7613192c411cbf07c8456993b
parentf059aefd4be1155fcfdef60e59e5ca89d69875ee (diff)
parent69aa01d0563a7dfc001cdf49bac53371e4765c2b (diff)
downloadperlweeklychallenge-club-5a2d74170cae763d960bdc11dadd8ff0c44adf49.tar.gz
perlweeklychallenge-club-5a2d74170cae763d960bdc11dadd8ff0c44adf49.tar.bz2
perlweeklychallenge-club-5a2d74170cae763d960bdc11dadd8ff0c44adf49.zip
Merge remote-tracking branch 'upstream/master' into ch-076
-rwxr-xr-xchallenge-076/jo-37/perl/ch-1.pl45
-rw-r--r--challenge-076/jo-37/perl/ch-2.grid19
-rwxr-xr-xchallenge-076/jo-37/perl/ch-2.pl160
-rw-r--r--challenge-076/mark-anderson/raku/ch-1.raku65
-rw-r--r--challenge-076/mark-anderson/raku/ch-2.raku3
-rw-r--r--challenge-076/markus-holzer/raku/ch-1.raku13
-rw-r--r--challenge-076/markus-holzer/raku/ch-2.board19
-rw-r--r--challenge-076/markus-holzer/raku/ch-2.golfed.raku9
-rw-r--r--challenge-076/markus-holzer/raku/ch-2.raku16
-rw-r--r--challenge-076/markus-holzer/raku/ch-2.words54
-rwxr-xr-xchallenge-076/mohammad-anwar/perl/ch-1.pl83
-rwxr-xr-xchallenge-076/mohammad-anwar/perl/ch-1.t83
-rw-r--r--challenge-076/nunovieira220/perl/ch-1.pl31
-rw-r--r--challenge-076/nunovieira220/perl/ch-2.pl116
-rw-r--r--challenge-076/nunovieira220/perl/dict.txt53
-rw-r--r--challenge-076/nunovieira220/perl/grid.txt19
-rw-r--r--stats/pwc-current.json295
-rw-r--r--stats/pwc-language-breakdown-summary.json60
-rw-r--r--stats/pwc-language-breakdown.json1088
-rw-r--r--stats/pwc-leaders.json746
-rw-r--r--stats/pwc-summary-1-30.json120
-rw-r--r--stats/pwc-summary-121-150.json38
-rw-r--r--stats/pwc-summary-151-180.json118
-rw-r--r--stats/pwc-summary-181-210.json38
-rw-r--r--stats/pwc-summary-31-60.json44
-rw-r--r--stats/pwc-summary-61-90.json98
-rw-r--r--stats/pwc-summary-91-120.json110
-rw-r--r--stats/pwc-summary.json414
28 files changed, 2347 insertions, 1610 deletions
diff --git a/challenge-076/jo-37/perl/ch-1.pl b/challenge-076/jo-37/perl/ch-1.pl
new file mode 100755
index 0000000000..4897dd70c3
--- /dev/null
+++ b/challenge-076/jo-37/perl/ch-1.pl
@@ -0,0 +1,45 @@
+#!/usr/bin/perl
+
+use Test2::V0;
+use Math::Prime::XS 'is_prime';
+use bigint;
+
+# The task states:
+# "find the minimum number of prime numbers required, whose summation
+# gives you $N".
+# This does not imply finding specific summands, IMHO.
+#
+# According to Goldbach's conjecture, every even number greater than two
+# can be expressed as the sum of two primes. As there is no exception to
+# this rule for $n <= 4e18, it may be considered as valid for this task.
+sub num_prime_summands {
+ my ($n) = @_; # keep @_
+ $_[1] = 2; # provide default retcode
+
+ return 0 if $n < 2; # not a sum of primes
+ return 1 if $n == 2; # 2 is prime
+ goto &assure if $n % 2 == 0; # Goldbach's conjecture
+ return 1 if is_prime $n; # $n is prime
+ return 2 if is_prime $n - 2; # $n - 2 is prime
+
+ $_[1]++; goto &assure; # Else: $n minus any odd prime is even,
+ # where Goldbach's conjecture is
+ # applied again.
+}
+
+# Warn about results that cannot be assured.
+sub assure {
+ my ($n, $r) = @_;
+ warn "The result is not assured!\n" if $n > 4e18;
+
+ $r;
+}
+
+
+is num_prime_summands($_->[0]), $_->[1]
+ foreach [1, 0], [2, 1], [3, 1], [4, 2], [5, 1], [6, 2], [7, 1],
+ [8, 2], [9, 2], [10, 2], [11, 1], [12, 2], [13, 1], [14, 2],
+ [15, 2], [16, 2], [17, 1], [18, 2], [19, 1], [20, 2], [21, 2],
+ [22, 2], [23, 1], [24, 2], [25, 2], [26, 2], [27, 3], [28, 2];
+
+done_testing;
diff --git a/challenge-076/jo-37/perl/ch-2.grid b/challenge-076/jo-37/perl/ch-2.grid
new file mode 100644
index 0000000000..31cf2e0fd8
--- /dev/null
+++ b/challenge-076/jo-37/perl/ch-2.grid
@@ -0,0 +1,19 @@
+B I D E M I A T S U C C O R S T
+L D E G G I W Q H O D E E H D P
+U S E I R U B U T E A S L A G U
+N G N I Z I L A I C O S C N U D
+T G M I D S T S A R A R E I F G
+S R E N M D C H A S I V E E L I
+S C S H A E U E B R O A D M T E
+H W O V L P E D D L A I U L S S
+R Y O N L A S F C S T A O G O T
+I G U S S R R U G O V A R Y O C
+N R G P A T N A N G I L A M O O
+E I H A C E I V I R U S E S E D
+S E T S U D T T G A R L I C N H
+H V R M X L W I U M S N S O T B
+A E A O F I L C H T O D C A E U
+Z S C D F E C A A I I R L N R F
+A R I I A N Y U T O O O U T P F
+R S E C I S N A B O S C N E R A
+D R S M P C U U N E L T E S I L
diff --git a/challenge-076/jo-37/perl/ch-2.pl b/challenge-076/jo-37/perl/ch-2.pl
new file mode 100755
index 0000000000..3fa0946b0f
--- /dev/null
+++ b/challenge-076/jo-37/perl/ch-2.pl
@@ -0,0 +1,160 @@
+#!/usr/bin/perl
+
+# Usage: ch-2.pl [grid [words]]
+# Defaults: grid from challenge, local dictionary
+
+use v5.16;
+use warnings;
+use autodie;
+use utf8;
+
+use List::Util qw(min max);
+
+# Minimal word length to search for.
+use constant MIN => 5;
+
+# Read the letter grid. The letters may be separated by whitespace.
+sub read_grid {
+ open my $fh, '<', shift;
+
+ map [split /\s*/], <$fh>;
+}
+
+# Read the dictionary and build a regex that matches all individual
+# words. Inspired by https://perlmonks.org/?node_id=1179840.
+# Longer matching words take precedence over shorter ones.
+# Overlapping words are not searched for.
+sub read_dict {
+ open my $fh, '<', shift;
+
+ # Returns qr/(?:word1|word2|...|wordN)/i
+ sub {local $" = '|'; qr/(?:@_)/i}->(
+ map {quotemeta}
+ sort {length $b <=> length $a}
+ map {chomp; length >= MIN ? $_ : ()} <$fh>);
+}
+
+# Create index mappings for four directions.
+# Each mapping consists of a list of lists of index pairs that
+# specify the grid positions forming a string to be examined.
+# [0, 0] is top left, [$rows - 1, $cols - 1] is bottom right.
+# Returns an array of subs that create a specific indexing.
+sub indexing ($$) {
+ my ($rows, $cols) = @_;
+
+ # Helper to calculate the end index for the traversal of a diagonal:
+ # Starts at 0, grows to the plateau at min($rows, $cols) - 1
+ # and then decreases to 0. The plateau degenerates to a peak
+ # if $rows == $cols.
+ my $diag_end = sub {
+ my $diag = shift;
+ min($diag, $rows - 1, $cols - 1, $rows + $cols - 2 - $diag);
+ };
+
+ (
+ # east
+ sub {
+ map {
+ my $row = $_;
+ # Strings run towards east.
+
+ [map [$row, $_], 0 .. $cols - 1];
+ } 0 .. $rows - 1;
+ },
+
+ # south
+ sub {
+ map {
+ my $col = $_;
+ # Strings run towards south.
+
+ [map [$_, $col], 0 .. $rows - 1];
+ } 0 .. $cols - 1;
+ },
+
+ # southeast
+ sub {
+ map {
+ my $diag = $_;
+ # Start of string moves from bottom left up to top left
+ # and then from top left to top right. Strings run
+ # towards southeast.
+ my $row = max($rows - 1 - $diag, 0);
+ my $col = max($diag - $rows + 1, 0);
+
+ [map [$row + $_, $col + $_], 0 .. $diag_end->($diag)];
+ } 0 .. $rows + $cols - 2;
+ },
+
+ # northeast
+ sub {
+ map {
+ my $diag = $_;
+ # Start of string moves from top left down to bottom left
+ # and then from bottom left to bottom right. Strings run
+ # towards northeast.
+ my $row = min($diag, $rows - 1);
+ my $col = max($diag - $rows + 1, 0);
+
+ [map [$row - $_, $col + $_], 0 .. $diag_end->($diag)];
+ } 0 .. $rows + $cols - 2;
+ }
+ );
+}
+
+#
+# main
+#
+
+my @grid = read_grid $ARGV[0] // 'ch-2.grid';
+my $needle = read_dict $ARGV[1] // '/usr/share/dict/words';
+
+local $\ = "\n";
+
+# Apply each indexing to the grid data and match the retrieved strings
+# forward and reversed against the dictionary.
+for my $index (indexing @grid, @{$grid[0]}) {
+ my @haystack = map {join '', map $grid[$_->[0]][$_->[1]], @$_}
+ $index->();
+ print foreach map /($needle)/g,
+ @haystack, map {scalar reverse} @haystack;
+}
+
+# Result from running the example grid against the local English
+# dictionary:
+
+__DATA__
+SUCCORS
+MIDST
+BROAD
+OVARY
+PATNA
+VIRUSES
+GARLIC
+FILCH
+AIMED
+WIGGED
+BURIES
+SOCIALIZING
+GOATS
+MALIGNANT
+BLUNTS
+SHRINES
+HAZARD
+GRIEVES
+OUGHT
+SPASMODIC
+MALLS
+DEPARTED
+LIENS
+QUASHED
+ANTES
+ENTER
+PUDGIEST
+RAPED
+MARGO
+CONSTITUTIONS
+THEOREMS
+AROSE
+CLOVEN
+CROON
diff --git a/challenge-076/mark-anderson/raku/ch-1.raku b/challenge-076/mark-anderson/raku/ch-1.raku
index 7f4dccfb93..4141f6c41d 100644
--- a/challenge-076/mark-anderson/raku/ch-1.raku
+++ b/challenge-076/mark-anderson/raku/ch-1.raku
@@ -2,56 +2,25 @@
=begin usage
-Usage: raku ch-1.raku 121
+Usage: raku ch-1.raku 51
Output:
- 3 5 113
- 3 11 107
- 3 17 101
- 3 29 89
- 3 47 71
- 3 59 59
- 5 7 109
- 5 13 103
- 5 19 97
- 5 37 79
- 5 43 73
- 7 11 103
- 7 13 101
- 7 17 97
- 7 31 83
- 7 41 73
- 7 43 71
- 7 47 67
- 7 53 61
- 7 7 107
-11 13 97
-11 31 79
-11 37 73
-11 43 67
-13 19 89
-13 29 79
-13 37 71
-13 41 67
-13 47 61
-17 31 73
-17 37 67
-17 43 61
-19 23 79
-19 29 73
-19 31 71
-19 41 61
-19 43 59
-19 19 83
-23 31 67
-23 37 61
-29 31 61
-31 37 53
-31 43 47
-31 31 59
-37 41 43
-37 37 47
+ 2 2 47
+ 3 5 43
+ 3 7 41
+ 3 11 37
+ 3 17 31
+ 3 19 29
+ 5 17 29
+ 5 23 23
+ 5 5 41
+ 7 13 31
+ 7 7 37
+11 17 23
+11 11 29
+13 19 19
+17 17 17
=end usage
@@ -75,7 +44,7 @@ sub MAIN(UInt $N where $N > 1) {
}
sub min-primes(UInt $N, $count) {
- my @primes = ((2..$N).grep(*.is-prime) xx 2).flat;
+ my @primes = ((2..$N).grep(*.is-prime) xx $count).flat;
my @results = @primes.combinations($count).grep(*.sum == $N)
.map(*.sort)
diff --git a/challenge-076/mark-anderson/raku/ch-2.raku b/challenge-076/mark-anderson/raku/ch-2.raku
index d763d9361a..8d6235c9ee 100644
--- a/challenge-076/mark-anderson/raku/ch-2.raku
+++ b/challenge-076/mark-anderson/raku/ch-2.raku
@@ -78,6 +78,9 @@ wigged
=end usage
+# My word list doesn't include plurals so if a word matches then
+# I'll use the below module to check if the plural is in the grid.
+
use Lingua::EN::Inflect:from<Perl5> 'PL';
sub MAIN(Str $grid, Str $word-list, UInt $word-length=5) {
diff --git a/challenge-076/markus-holzer/raku/ch-1.raku b/challenge-076/markus-holzer/raku/ch-1.raku
new file mode 100644
index 0000000000..9741904c25
--- /dev/null
+++ b/challenge-076/markus-holzer/raku/ch-1.raku
@@ -0,0 +1,13 @@
+my $N = 1528;
+
+my @primes = (2..^$N)
+ .grep( *.is-prime );
+
+my @candidates = @primes X @primes;
+
+my @solutions = @candidates
+ .grep( *.sum == $N )
+ .map( *.sort.cache )
+ .unique( with => &[~~] );
+
+.say for @solutions; \ No newline at end of file
diff --git a/challenge-076/markus-holzer/raku/ch-2.board b/challenge-076/markus-holzer/raku/ch-2.board
new file mode 100644
index 0000000000..c5766eae93
--- /dev/null
+++ b/challenge-076/markus-holzer/raku/ch-2.board
@@ -0,0 +1,19 @@
+B I D E M I A T S U C C O R S T
+L D E G G I W Q H O D E E H D P
+U S E I R U B U T E A S L A G U
+N G N I Z I L A I C O S C N U D
+T G M I D S T S A R A R E I F G
+S R E N M D C H A S I V E E L I
+S C S H A E U E B R O A D M T E
+H W O V L P E D D L A I U L S S
+R Y O N L A S F C S T A O G O T
+I G U S S R R U G O V A R Y O C
+N R G P A T N A N G I L A M O O
+E I H A C E I V I R U S E S E D
+S E T S U D T T G A R L I C N H
+H V R M X L W I U M S N S O T B
+A E A O F I L C H T O D C A E U
+Z S C D F E C A A I I R L N R F
+A R I I A N Y U T O O O U T P F
+R S E C I S N A B O S C N E R A
+D R S M P C U U N E L T E S I L \ No newline at end of file
diff --git a/challenge-076/markus-holzer/raku/ch-2.golfed.raku b/challenge-076/markus-holzer/raku/ch-2.golfed.raku
new file mode 100644
index 0000000000..a92512aef8
--- /dev/null
+++ b/challenge-076/markus-holzer/raku/ch-2.golfed.raku
@@ -0,0 +1,9 @@
+sub MAIN($W,$B){
+my@w=$W.IO.lines;
+my@b=$B.IO.slurp.subst(' ',:g).lines;
+my$w=@b[0].chars;
+my@c=@b.map(|*.comb);
+sub f($t){$t~"~"~$t.flip~~m:ex:i/@w/}
+multi r{@c.batch($w),|((0,0),(0,1),(1,0)).map(&r)}
+multi r($o){(^$w).map({@c[$_+$o[0],($_+$w+$o[1])...*]})}
+.say for f r.flat.join} \ No newline at end of file
diff --git a/challenge-076/markus-holzer/raku/ch-2.raku b/challenge-076/markus-holzer/raku/ch-2.raku
new file mode 100644
index 0000000000..28e90a4d17
--- /dev/null
+++ b/challenge-076/markus-holzer/raku/ch-2.raku
@@ -0,0 +1,16 @@
+unit sub MAIN($words-file, $board-file);
+
+my @words = $words-file.IO.lines;
+my $width = $board-file.IO.lines.head.chars div 2 + 1;
+my @chars = $board-file.IO.slurp.comb( /\w/ );
+
+.Str.say for words-in rotated-data.flat.join;
+
+sub words-in( $text ) {
+ $text ~'~'~ $text.flip ~~ m:ex:i/@words/ }
+
+sub rotated-data {
+ @chars.batch( $width ), |( (0,0), (0,1), (1,0) ).map: &rotate-data }
+
+sub rotate-data( @offsets ) {
+ (^$width).map: { @chars[ ($_ + @offsets[0]), ($_ + $width + @offsets[1]) ... * ] } }
diff --git a/challenge-076/markus-holzer/raku/ch-2.words b/challenge-076/markus-holzer/raku/ch-2.words
new file mode 100644
index 0000000000..f566351133
--- /dev/null
+++ b/challenge-076/markus-holzer/raku/ch-2.words
@@ -0,0 +1,54 @@
+argos
+margo
+patna
+traci
+tracie
+aimed
+align
+antes
+arose
+ashed
+blunt
+blunts
+broad
+buries
+clove
+cloven
+constitution
+constitutions
+croon
+depart
+departed
+enter
+filch
+garlic
+goats
+grieve
+grieves
+hazard
+liens
+malign
+malignant
+malls
+midst
+ought
+ovary
+parted
+pudgiest
+quash
+quashed
+raped
+ruses
+shrine
+shrines
+social
+socializing
+spasm
+spasmodic
+succor
+succors
+theorem
+theorems
+virus
+viruses
+wigged \ No newline at end of file
diff --git a/challenge-076/mohammad-anwar/perl/ch-1.pl b/challenge-076/mohammad-anwar/perl/ch-1.pl
new file mode 100755
index 0000000000..ac66f3fd48
--- /dev/null
+++ b/challenge-076/mohammad-anwar/perl/ch-1.pl
@@ -0,0 +1,83 @@
+#!/usr/bin/perl
+
+#
+# Perl Weekly Challenge - 076
+#
+# Task #1: Prime Sum
+#
+# https://perlweeklychallenge.org/blog/perl-weekly-challenge-076
+#
+
+use strict;
+use warnings;
+use Algorithm::Combinatorics qw(combinations);
+
+my $SUM = $ARGV[0];
+
+print "USAGE: perl $0 <positive_number>\n" and exit unless defined $SUM;
+print prime_sum(find_prime_upto($SUM), $SUM);
+
+#
+#
+# METHODS
+
+sub prime_sum {
+ my ($primes, $sum) = @_;
+
+ print sprintf("Primes: %s\n", join(", ", @$primes));
+ my $prime_sum = [];
+ foreach my $i (1 .. $sum) {
+ last if ($i > @$primes);
+ foreach my $comb (combinations($primes, $i)) {
+ my $_sum = 0;
+ $_sum += $_ for @$comb;
+ if ($_sum == $sum) {
+ if ((@$prime_sum == 0) || (@$prime_sum > @$comb)) {
+ $prime_sum = $comb;
+ }
+ }
+
+ if (@$prime_sum) {
+ return sprintf("Prime Sum: %s\n", join ", ", @$prime_sum);
+ }
+ }
+ }
+
+ return "None found.\n";
+}
+
+sub find_prime_upto {
+ my ($sum) = @_;
+
+ die "ERROR: Invalid sum [$sum].\n"
+ unless (($sum =~ /^\d+$/) && ($sum > 0));
+
+ my $range = { map { $_ => 1 } 2..$sum };
+ my $prime = [];
+
+ my $i = 2;
+ while (keys %$range) {
+ push @$prime, $i;
+ ($i, $range) = sieve_of_eratosthenes($i, $range);
+ last unless defined $i;
+ }
+
+ return $prime;
+}
+
+#
+#
+# https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
+
+sub sieve_of_eratosthenes {
+ my ($i, $range) = @_;
+
+ foreach my $j (sort { $a <=> $b } keys %$range) {
+ delete $range->{$j} unless ($j % $i);
+ }
+
+ $i = (sort { $a <=> $b } keys %$range)[0];
+ $i += 0 if defined $i;
+
+ return ($i, $range);
+}
diff --git a/challenge-076/mohammad-anwar/perl/ch-1.t b/challenge-076/mohammad-anwar/perl/ch-1.t
new file mode 100755
index 0000000000..bd749b9f80
--- /dev/null
+++ b/challenge-076/mohammad-anwar/perl/ch-1.t
@@ -0,0 +1,83 @@
+#!/usr/bin/perl
+
+#
+# Perl Weekly Challenge - 076
+#
+# Task #1: Prime Sum
+#
+# https://perlweeklychallenge.org/blog/perl-weekly-challenge-076
+#
+
+use strict;
+use warnings;
+use Test::More;
+use Algorithm::Combinatorics qw(combinations);
+
+is(prime_sum(find_prime_upto(9), 9), "2, 7", "testing prime sum = 9");
+is(prime_sum(find_prime_upto(12), 12), "5, 7", "testing prime sum = 12");
+
+done_testing;
+
+#
+#
+# METHODS
+
+sub prime_sum {
+ my ($primes, $sum) = @_;
+
+ my $prime_sum = [];
+ foreach my $i (1 .. $sum) {
+ last if ($i > @$primes);
+ foreach my $comb (combinations($primes, $i)) {
+ my $_sum = 0;
+ $_sum += $_ for @$comb;
+ if ($_sum == $sum) {
+ if ((@$prime_sum == 0) || (@$prime_sum > @$comb)) {
+ $prime_sum = $comb;
+ }
+ }
+
+ if (@$prime_sum) {
+ return join ", ", @$prime_sum;
+ }
+ }
+ }
+
+ return 0;
+}
+
+sub find_prime_upto {
+ my ($sum) = @_;
+
+ die "ERROR: Invalid sum [$sum].\n"
+ unless (($sum =~ /^\d+$/) && ($sum > 0));
+
+ my $range = { map { $_ => 1 } 2..$sum };
+ my $prime = [];
+
+ my $i = 2;
+ while (keys %$range) {
+ push @$prime, $i;
+ ($i, $range) = sieve_of_eratosthenes($i, $range);
+ last unless defined $i;
+ }
+
+ return $prime;
+}
+
+#
+#
+# https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
+
+sub sieve_of_eratosthenes {
+ my ($i, $range) = @_;
+
+ foreach my $j (sort { $a <=> $b } keys %$range) {
+ delete $range->{$j} unless ($j % $i);
+ }
+
+ $i = (sort { $a <=> $b } keys %$range)[0];
+ $i += 0 if defined $i;
+
+ return ($i, $range);
+}
diff --git a/challenge-076/nunovieira220/perl/ch-1.pl b/challenge-076/nunovieira220/perl/ch-1.pl
new file mode 100644
index 0000000000..c0f895f75d
--- /dev/null
+++ b/challenge-076/nunovieira220/perl/ch-1.pl
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use List::Util qw[min];
+use Math::Prime::Util qw[is_prime];
+
+# Calculate prime num
+sub prime_sum {
+ my $N = $_[0];
+ my %calcs = ();
+ $calcs{2} = 1;
+
+ for(my $i = 3; $i <= $N; $i += 2) {
+ if(is_prime($i)) {
+ for my $key (keys %calcs) {
+ my $sum = $i + $key;
+ my $inc = $calcs{$key} + 1;
+ $calcs{$sum} = $calcs{$sum} ? min($calcs{$sum}, $inc) : $inc;
+ }
+
+ $calcs{$i} = 1;
+ }
+ }
+
+ return $calcs{$N} || 0;
+}
+
+# Input/Output
+my $N = scalar @ARGV ? $ARGV[0] : 9;
+print prime_sum($N)."\n"; \ No newline at end of file
diff --git a/challenge-076/nunovieira220/perl/ch-2.pl b/challenge-076/nunovieira220/perl/ch-2.pl
new file mode 100644
index 0000000000..de5889aad4
--- /dev/null
+++ b/challenge-076/nunovieira220/perl/ch-2.pl
@@ -0,0 +1,116 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+sub get_word {
+ my $build = $_[0];
+ my $val = $_[1];
+ my %dict = %{$_[2]};
+ my @res = ();
+
+ if (grep(/^$build$/, @{$dict{$val}})) {
+ my $index = 0;
+ $index++ until $dict{$val}[$index] eq $build;
+ splice(@{$dict{$val}}, $index, 1);
+ push @res, $build;
+ }
+
+ return @res;
+}
+
+# Search grid
+sub search_grid {
+ my @grid = @{$_[0]};
+ my %dict = %{$_[1]};
+ my %revs = %{$_[2]};
+ my $gridX = scalar @grid;
+ my $gridY = scalar @{$grid[0]};
+ my @res = ();
+
+ for(my $i = 0; $i < $gridX; $i++) {
+ for(my $j = 0; $j < $gridY; $j++) {
+ my $val = $grid[$i][$j];
+ next if(!$dict{$val});
+
+ #horizontal
+ my $build = $val;
+
+ for(my $k = $j + 1; $k < $gridY; $k++) {
+ $build .= $grid[$i][$k];
+ push @res, get_word($build, $val, \%dict);
+ last if (!grep(/$build/, @{$dict{$val}}));
+ }
+
+ #vertical
+ $build = $val;
+
+ for(my $k = $i + 1; $k < $gridX; $k++) {
+ $build .= $grid[$k][$j];
+ push @res, get_word($build, $val, \%dict);
+ last if (!grep(/$build/, @{$dict{$val}}));
+ }
+
+ #diagonal down
+ $build = $val;
+ my $k1 = $i + 1;
+ my $k2 = $j + 1;
+
+ while($k1 < $gridX && $k2 < $gridY) {
+ $build .= $grid[$k1][$k2];
+ push @res, get_word($build, $val, \%dict);
+ last if (!grep(/$build/, @{$dict{$val}}));
+ $k1++; $k2++;
+ }
+
+ #diagonal up
+ $build = $val;
+ $k1 = $i + 1;
+ $k2 = $j - 1;
+
+ while($k1 < $gridX && $k2 > 0) {
+ $build .= $grid[$k1][$k2];
+ push @res, get_word($build, $val, \%dict);
+ last if (!grep(/$build/, @{$dict{$val}}));
+ $k1++; $k2--;
+ }
+ }
+ }
+
+ # Print words
+ my %final = map { $revs{$_} ? ($revs{$_} => 1) : ($_ => 1) } @res;
+ print $_."\n" for (sort keys %final);
+}
+
+# Input/Output
+open(my $fh1, "<", "grid.txt") or die "Can't open < grid.txt: $!";
+open(my $fh2, "<", "dict.txt") or die "Can't open < dict.txt: $!";
+
+my @grid = ();
+while(<$fh1>) {
+ chomp;
+ my @arr = split(/ /, lc($_));
+ push @grid, \@arr;
+}
+
+my %dict = ();
+my %revs = ();
+while(<$fh2>) {
+ chomp;
+ my $line = $_;
+ my $rev = reverse($line);
+
+ my $lineFirst = substr($line, 0, 1);
+ $dict{$lineFirst} = () if(!$dict{$lineFirst});
+ push @{$dict{$lineFirst}}, lc($line);
+
+ my $revFirst = substr($rev, 0, 1);
+ $dict{$revFirst} = () if(!$dict{$revFirst});
+ push @{$dict{$revFirst}}, lc($rev);
+ $revs{$rev} = $line;
+}
+
+search_grid(\@grid, \%dict, \%revs);
+
+close($fh1);
+close($fh2); \ No newline at end of file
diff --git a/challenge-076/nunovieira220/perl/dict.txt b/challenge-076/nunovieira220/perl/dict.txt
new file mode 100644
index 0000000000..bbb2714ce7
--- /dev/null
+++ b/challenge-076/nunovieira220/perl/dict.txt
@@ -0,0 +1,53 @@
+argos
+margo
+patna
+traci
+tracie
+aimed
+align
+antes
+arose
+ashed
+blunt
+blunts
+broad
+buries
+clove
+cloven
+constitution
+constitutions
+croon
+depart
+departed
+enter
+filch
+garlic
+goats
+grieve
+grieves
+hazard
+liens
+malign
+malignant
+malls
+midst
+ought
+ovary
+parted
+pudgiest
+quash
+quashed
+ruses
+shrine
+shrines
+social
+socializing
+spasm
+spasmodic
+succor
+succors
+theorem
+theorems
+virus
+viruses
+wigged \ No newline at end of file
diff --git a/challenge-076/nunovieira220/perl/grid.txt b/challenge-076/nunovieira220/perl/grid.txt
new file mode 100644
index 0000000000..c5766eae93
--- /dev/null
+++ b/challenge-076/nunovieira220/perl/grid.txt
@@ -0,0 +1,19 @@
+B I D E M I A T S U C C O R S T
+L D E G G I W Q H O D E E H D P
+U S E I R U B U T E A S L A G U
+N G N I Z I L A I C O S C N U D
+T G M I D S T S A R A R E I F G
+S R E N M D C H A S I V E E L I
+S C S H A E U E B R O A D M T E
+H W O V L P E D D L A I U L S S
+R Y O N L A S F C S T A O G O T
+I G U S S R R U G O V A R Y O C
+N R G P A T N A N G I L A M O O
+E I H A C E I V I R U S E S E D
+S E T S U D T T G A R L I C N H
+H V R M X L W I U M S N S O T B
+A E A O F I L C H T O D C A E U
+Z S C D F E C A A I I R L N R F
+A R I I A N Y U T O O O U T P F
+R S E C I S N A B O S C N E R A
+D R S M P C U U N E L T E S I L \ No newline at end of file
diff --git a/stats/pwc-current.json b/stats/pwc-current.json
index ea3cde34c8..25d3c44ed7 100644
--- a/stats/pwc-current.json
+++ b/stats/pwc-current.json
@@ -1,52 +1,100 @@
{
- "subtitle" : {
- "text" : "[Champions: 12] Last updated at 2020-09-03 12:51:37 GMT"
- },
- "yAxis" : {
- "title" : {
- "text" : "Total Solutions"
- }
- },
- "plotOptions" : {
- "series" : {
- "dataLabels" : {
- "enabled" : 1,
- "format" : "{point.y}"
- },
- "borderWidth" : 0
+ "series" : [
+ {
+ "data" : [
+ {
+ "drilldown" : "Alexander Pankoff",
+ "y" : 2,
+ "name" : "Alexander Pankoff"
+ },
+ {
+ "name" : "Andinus",
+ "y" : 2,
+ "drilldown" : "Andinus"
+ },
+ {
+ "name" : "Jorg Sommrey",
+ "y" : 2,
+ "drilldown" : "Jorg Sommrey"
+ },
+ {
+ "drilldown" : "Luca Ferrari",
+ "name" : "Luca Ferrari",
+ "y" : 4
+ },
+ {
+ "name" : "Mark Anderson",
+ "y" : 2,
+ "drilldown" : "Mark Anderson"
+ },
+ {
+ "y" : 2,
+ "name" : "Markus Holzer",
+ "drilldown" : "Markus Holzer"
+ },
+ {
+ "name" : "Mohammad S Anwar",
+ "y" : 2,
+ "drilldown" : "Mohammad S Anwar"
+ },
+ {
+ "drilldown" : "Myoungjin Jeon",
+ "name" : "Myoungjin Jeon",
+ "y" : 4
+ },
+ {
+ "y" : 2,
+ "name" : "Neil Bowers",
+ "drilldown" : "Neil Bowers"
+