started at ; stage 2 at ; ended at
hello
The challenge for round 3 of the code guessing competition is to multiply two square matrices.
In python: your function will be passed two arguments, m1 and m2. each of these arguments is a list of rows, each of which is a list of values. that is, m[a][b] is the number at row a, column b in the matrix m. you must return a list of lists in the same format that is the result of the multiplication m1*m2. you can assume that both matrices are square and that both are the same size.
in c: your function has the prototype int* entry(int* m1, int* m2, int n)
. each matrix argument is arranged by rows first, so m[(a*n)+b] is the value in the matrix m at row a and column b. n is the size of the matrices. you must return an array of ints in the same format as the input that is the result of the multiplication m1 * m2.
There is a test suite. You cannot have it. Muahahahaha. -gollark
submissions can be in c or python
you can download all the entries
written by Oliviaguesses
comments 0
rocketrace.py ASCII text, with very long lines (5401)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''This script provides a function `entry` that multiplies two square matrices together.
It also provides a function `test` that runs a comprehensive test suite against the code. By default, this is run every time the script executes.
It uses typing features from python 3.10.
In 3.10+, `typing_extensions.Unpack[Ts]` must be replaced with `*Ts`,
`typing_extensions.TypeVarTuple` must be replaced with `typing.TypeVarTuple`,
and `typing.Union[A, B]` must be replaced with `A | B`.
Development:
```bash
flake8 file.py
mypy file.py
pylint file.py
pyflakes file.py
prospector file.py
pyright file.py
pychecker file.py
bandit file.py
pyroma file.py
```
Testing:
```
'''
# String annotations aren't stable until 3.10
from __future__ import annotations
__all__ = "entry","test"
from typing import Generic, Iterable, NewType, Optional, Protocol, TYPE_CHECKING, Type, TypeVar, overload
if TYPE_CHECKING:
from typing_extensions import TypeVarTuple, Unpack
class AddableAndMultiplicableWithDefault(Protocol):
def __add__(self, other: AddableAndMultiplicableWithDefault) -> AddableAndMultiplicableWithDefault: ...
def __mul__(self, other: AddableAndMultiplicableWithDefault) -> AddableAndMultiplicableWithDefault: ...
@classmethod
def __call__(cls) -> AddableAndMultiplicableWithDefault: ...
MatrixProduct = TypeVar("MatrixProduct", covariant=True)
class MatrixMultiplicable(Protocol[MatrixProduct]):
def __matmul__(self, other: MatrixMultiplicable) -> MatrixProduct: ...
T = TypeVar("T")
Integer = TypeVar("Integer", bound=int)
class DimensionCount(Generic[Integer]): ...
Axes = TypeVarTuple("Axes")
class Shape(Generic[Unpack[Axes]]): ...
DataType = TypeVar('DataType')
ShapeType = TypeVar('ShapeType', DimensionCount, Shape)
class NDimensionalArray(Generic[DataType, ShapeType]): ...
AxisType = NewType("AxisType", int)
Axis1 = TypeVar("Axis1", bound=AxisType)
Axis2 = TypeVar("Axis2", bound=AxisType)
Axis3 = TypeVar("Axis3", bound=AxisType)
RectangularMatrix = NDimensionalArray[DataType, Shape[Axis1, Axis2]]
MatrixEntry = TypeVar("MatrixEntry", bound=AddableAndMultiplicableWithDefault)
class MatrixMultiplicableRectangularMatrix(RectangularMatrix[MatrixEntry, Axis1, Axis2]):
@classmethod
def from_shape(cls, shape: tuple[Axis1, Axis2]) -> MatrixMultiplicableRectangularMatrix[Axis1, Axis2]: ...
@property
def shape(self) -> tuple[Axis1, Axis2]: ...
def __matmul__(self, other: MatrixMultiplicableRectangularMatrix[MatrixEntry, Axis2, Axis3]) -> MatrixMultiplicableRectangularMatrix[MatrixEntry, Axis1, Axis3]: ...
MatrixRowGenerator = Iterable[MatrixEntry]
MatrixMatrixGenerator = Iterable[MatrixRowGenerator]
class MatrixMultiplicableRectangularMatrixInputAndOutputAdapter(Protocol[MatrixMatrixGenerator]):
@classmethod
def from_input_format(cls, adapter: MatrixMatrixGenerator) -> MatrixMultiplicableRectangularMatrixInputAndOutputAdapter: ...
def __getitem__(self, index: tuple[AxisType, AxisType]) -> MatrixEntry: ...
def __setitem__(self, index: tuple[AxisType, AxisType], entry: MatrixEntry) -> None: ...
def __delitem__(self, index: tuple[AxisType, AxisType]) -> None: ...
def to_output_format(self) -> MatrixMatrixGenerator: ...
class ConcreteListMutableMatrixMultiplicableRectangularMatrixInputAndOutputAdapter(MatrixMultiplicableRectangularMatrixInputAndOutputAdapter[list[list[MatrixEntry]]]):
@classmethod
def from_input_format(cls, underlying_data: list[list[MatrixEntry]]) -> MatrixMultiplicableRectangularMatrixInputAndOutputAdapter:
self = cls()
self._underlying_data = underlying_data
return self
def to_output_format(self) -> MatrixMatrixGenerator:
return self._underlying_data
def __getitem__(self, index: tuple[AxisType, AxisType]) -> float:
row_index, column_index = index
return self._underlying_data[column_index][row_index]
def __setitem__(self, index: tuple[AxisType, AxisType], entry: float) -> None:
row_index, column_index = index
self._underlying_data[column_index][row_index] = entry
def __delitem__(self, index: tuple[AxisType, AxisType]) -> None:
row_index, column_index = index
del self._underlying_data[column_index][row_index]
class MatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters(MatrixMultiplicableRectangularMatrix):
adapter: MatrixMultiplicableRectangularMatrixInputAndOutputAdapter
def initialize_data_with_adapter(self, adapter: MatrixMultiplicableRectangularMatrixInputAndOutputAdapter) -> None: ...
class ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters(MatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[float]):
@classmethod
def from_shape(cls, shape: tuple[Axis1, Axis2]) -> ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters:
self = cls()
self._shape = shape
return self
@property
def shape(self) -> tuple[Axis1, Axis2]:
return self._shape
def initialize_data_with_adapter(self, adapter: ConcreteListMutableMatrixMultiplicableRectangularMatrixInputAndOutputAdapter) -> None:
self.adapter = adapter
def __matmul__(self, other: ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[Axis2, Axis3]) -> ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[Axis1, Axis3]:
self_width, common_axis = self.shape
common_axis, other_height = other.shape
output_matrix = ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters.from_shape((self_width, other_height))
width, height = output_matrix.shape
output_matrix.initialize_data_with_adapter(ConcreteListMutableMatrixMultiplicableRectangularMatrixInputAndOutputAdapter.from_input_format([[float() for _ in range(width)] for _ in range(height)]))
for y in range(height):
for x in range(height):
running_total = output_matrix.adapter[x, y]
for z in range(common_axis):
running_total += self.adapter[x, z] * other.adapter[z, y]
output_matrix.adapter[x, y] = running_total
return output_matrix
class ConcreteMutableFloatMatrixMultiplicableSquareMatrixWithInputAndOutputAdapters(Generic[MatrixEntry, Axis1], ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[Axis1, Axis1]): ...
@overload
def perform_entry_computation_matrix_multiplication() -> None: ...
@overload
def perform_entry_computation_matrix_multiplication(matrix: ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters) -> ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters: ...
@overload
def perform_entry_computation_matrix_multiplication(left_matrix: ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[MatrixEntry, Axis1, Axis2], right_matrix: ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[MatrixEntry, Axis3, Axis1]) -> ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[MatrixEntry, Axis3, Axis2]: ...
@overload
def perform_entry_computation_matrix_multiplication(left_matrix: ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[MatrixEntry, Axis1, Axis2], right_matrix: ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[MatrixEntry, Axis2, Axis1]) -> ConcreteMutableFloatMatrixMultiplicableSquareMatrixWithInputAndOutputAdapters[MatrixEntry, Axis2]: ...
@overload
def perform_entry_computation_matrix_multiplication(left_matrix: ConcreteMutableFloatMatrixMultiplicableSquareMatrixWithInputAndOutputAdapters, right_matrix: ConcreteMutableFloatMatrixMultiplicableSquareMatrixWithInputAndOutputAdapters) -> ConcreteMutableFloatMatrixMultiplicableSquareMatrixWithInputAndOutputAdapters: ...
@overload
def perform_entry_computation_matrix_multiplication(left_matrix: ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters, right_matrix: ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters, middle_matrix: ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters, *other_matrices: ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters) -> None: ...
def perform_entry_computation_matrix_multiplication(matrices: ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters) -> Optional[ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters]:
if not matrices:
return None
if len(matrices) >= 2:
return None
if len(matrices) == 1:
return matrices[0]
return matrices[0] @ matrices[1]
def entry(left_list_of_lists_of_numeric_probably_floats: list[list[float]], right_list_of_lists_of_numeric_probably_floats: list[list[float]]) -> list[list[float]]:
left_height = len(left_list_of_lists_of_numeric_probably_floats)
left_width = len(left_list_of_lists_of_numeric_probably_floats[0])
left_matrix = ConcreteMutableFloatMatrixMultiplicableSquareMatrixWithInputAndOutputAdapters.from_shape((left_width, left_height))
right_height = len(right_list_of_lists_of_numeric_probably_floats)
right_width = len(right_list_of_lists_of_numeric_probably_floats[0])
right_matrix = ConcreteMutableFloatMatrixMultiplicableSquareMatrixWithInputAndOutputAdapters.from_shape((right_width, right_height))
left_matrix.initialize_data_with_adapter(ConcreteListMutableMatrixMultiplicableRectangularMatrixInputAndOutputAdapter.from_input_format(left_list_of_lists_of_numeric_probably_floats))
right_matrix.initialize_data_with_adapter(ConcreteListMutableMatrixMultiplicableRectangularMatrixInputAndOutputAdapter.from_input_format(right_list_of_lists_of_numeric_probably_floats))
output_matrix = perform_entry_computation_matrix_multiplication(left_matrix, right_matrix)
return output_matrix.adapter.to_output_format()
else:
entry=lambda a,b:[[sum([a[i][k]*b[k][j]for k in range(len(a))])for j in range(len(a))]for i in range(len(b))]# Ignore: UNREACHABLE_CODE
TEST_CASES = [
(1,(([[41]],[[61]]),[[2501]])),
(9,(([[8,54,5,34,4,69,86,85,65],[17,31,52,58,86,78,20,5,62],[49,64,55,23,40,21,79,45,82],[74,5,39,18,20,61,19,52,31],[43,43,9,60,85,65,55,15,1],[56,34,74,84,30,56,75,49,4],[14,27,59,79,16,47,56,4,24],[66,32,18,82,27,68,39,17,2],[63,90,80,50,1,6,61,56,75]],[[29,18,27,27,85,32,71,14,26],[74,19,65,53,11,45,18,31,86],[90,2,24,14,25,85,90,83,55],[42,65,29,67,88,84,66,57,68],[31,52,82,45,60,69,22,27,72],[81,42,27,37,45,66,58,15,27],[57,7,41,12,86,16,79,80,51],[9,2,42,80,67,70,71,67,62],[14,13,84,48,13,70,16,86,55]]),[[18396,8113,19579,19111,21672,22673,22193,23447,22821],[20940,13473,20800,17088,19721,27323,19616,19580,22950],[21070,8374,23334,18087,22488,25355,23945,26328,26143],[14328,6917,12635,13048,18370,18940,19709,14579,14708],[18943,13087,17606,15724,23406,21271,19663,14863,21056],[24566,11849,17375,18412,28481,27344,30168,24045,24917],[18899,9536,12901,12531,18385,20376,20174,18382,18148],[18095,11755,13203,14879,22827,20275,21152,14264,17967],[23335,8072,22318,20020,23048,27677,26958,28361,28120]])),
((FOURTY_SIXTH_PRESIDENT_HELL_YEAH_SUCK_IT:=46),(((BIDENTITY_MATRIX:=[[x==y for x in range(FOURTY_SIXTH_PRESIDENT_HELL_YEAH_SUCK_IT)]for y in range(FOURTY_SIXTH_PRESIDENT_HELL_YEAH_SUCK_IT)]),BIDENTITY_MATRIX),BIDENTITY_MATRIX)),
]
def test():
for i, (size, ((left_input, right_input), output)) in enumerate(TEST_CASES):
if entry(left_input, right_input) != output:
print(f"\033[31;1mTest \u0023\uFE0F\u20E3 {i} failed (size: {size}\xD7{size}).\033[0m\033[31m GLaDOS has been notified.\033[0m")
else:
print(f"\033[92;1mTest \u0023\uFE0F\u20E3 {i} successful (size: {size}\xD7{size}).\033[0m\033[92m Satisfactory.\033[0m")
test()
written by sonata «pathétique»guesses
comments 0
post a comment
sonata-pathétique.py ASCII text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import operator
class Entrant:
class Matrix: # for easy iteration, otherwise cryoapioforms.
def __init__(self,rows):
self.rows = rows
self.cols = [[i[j] for i in rows] for j in range(len(rows))]
def lace(self,f,g,a,b): # f is binary, g applies over a list.
c = [[] for i in a.cols]
for i in range(len(a.rows)):
d = a.rows[i]
for j in b.cols:
c[i].append(g(f(d[k],j[k]) for k in range(len(d)))) # jk
return self.Matrix(c) # no, enums are still bad.
def __call__(self,a,b):
return self.lace(operator.mul,sum,self.Matrix(a),self.Matrix(b)).rows
entry = Entrant() # classes, hmm.
written by Palaiologosguesses
comments 0
post a comment
palaiologos.py Unicode text, UTF-8 text, with very long lines (4610)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import subprocess
def entry(m1, m2):
with open("ae", "w") as f:
# bees
f.write(f"""use re 'eval';
@a=({str(m1)[1:-1]});
@b=({str(m2)[1:-1]});
$s=({len(m1)});
"""
)
# bees, apioformic perl utterly.
f.write(r"""''=~('('.'?'.'{'.('`'|'%').('['^'-').('`'|'!').('`'|',').'"'.('['^'.').('['^'(').('`'|'%').('{'^'[').('['^')').('`'|'%').('{'^'[')."'".('`'|'%').('['^'-').('`'|'!').('`'|',')."'".';'.('!'^'+')."'"."'".'='.'~'.'('."'".'('."'".'.'."'".'?'."'".'.'."'".'\\'.'{'."'".'.'.'('."'".'`'."'".'|'."'".'%'."'".')'.'.'.'('."'".'['."'".'^'."'".'-'."'".')'.'.'.'('."'".'`'."'".'|'."'".'!'."'".')'.'.'.'('."'".'`'."'".'|'."'".','."'".')'.'.'."'".'\\'.'"'."'".'.'."'".'#'."'".'.'.'('."'".'\\'.'{'."'".'^'."'".'['."'".')'.'.'.'('."'".'`'."'".'|'."'".')'."'".')'.'.'.'('."'".'`'."'".'|'."'".'\\'.'$'."'".')'.'.'.'('."'".'`'."'".'|'."'".')'."'".')'.'.'.'('."'".'`'."'".'|'."'".'/'."'".')'.'.'.'('."'".'['."'".'^'."'".'/'."'".')'.'.'.'('."'".'!'."'".'^'."'".'+'."'".')'.'.'.'('."'".'`'."'".'|'."'".'&'."'".')'.'.'.'('."'".'`'."'".'|'."'".'/'."'".')'.'.'.'('."'".'['."'".'^'."'".')'."'".')'.'.'."'".'('."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".')'."'".')'.'.'."'".'='."'".'.'.'('."'".'^'."'".'^'.'('."'".'`'."'".'|'."'".'.'."'".')'.')'.'.'."'".';'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".')'."'".')'.'.'."'".'<'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'['."'".'^'."'".'('."'".')'.'.'."'".';'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".')'."'".')'.'.'."'".'+'."'".'.'."'".'+'."'".'.'."'".')'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'{'."'".'.'.'('."'".'`'."'".'|'."'".'&'."'".')'.'.'.'('."'".'`'."'".'|'."'".'/'."'".')'.'.'.'('."'".'['."'".'^'."'".')'."'".')'.'.'."'".'('."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".'*'."'".')'.'.'."'".'='."'".'.'.'('."'".'^'."'".'^'.'('."'".'`'."'".'|'."'".'.'."'".')'.')'.'.'."'".';'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".'*'."'".')'.'.'."'".'<'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'['."'".'^'."'".'('."'".')'.'.'."'".';'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".'*'."'".')'.'.'."'".'+'."'".'.'."'".'+'."'".'.'."'".')'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'{'."'".'.'.'('."'".'`'."'".'|'."'".'-'."'".')'.'.'.'('."'".'['."'".'^'."'".'\\'.'"'."'".')'.'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'['."'".'^'."'".'/'."'".')'.'.'."'".';'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'['."'".'^'."'".'/'."'".')'.'.'."'".'+'."'".'.'."'".'='."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".'!'."'".')'.'.'."'".'['."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".')'."'".')'.'.'."'".']'."'".'.'."'".'['."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'."'".'_'."'".'.'."'".']'."'".'.'."'".'*'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".'\\'.'"'."'".')'.'.'."'".'['."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'."'".'_'."'".'.'."'".']'."'".'.'."'".'['."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".'*'."'".')'.'.'."'".']'."'".'.'.'('."'".'`'."'".'|'."'".'&'."'".')'.'.'.'('."'".'`'."'".'|'."'".'/'."'".')'.'.'.'('."'".'['."'".'^'."'".')'."'".')'.'.'."'".'('."'".'.'.'('."'".'^'."'".'^'.'('."'".'`'."'".'|'."'".'.'."'".')'.')'.'.'."'".'.'."'".'.'."'".'.'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'['."'".'^'."'".'('."'".')'.'.'."'".')'."'".'.'."'".';'."'".'.'.'('."'".'['."'".'^'."'".'+'."'".')'.'.'.'('."'".'['."'".'^'."'".')'."'".')'.'.'.'('."'".'`'."'".'|'."'".')'."'".')'.'.'.'('."'".'`'."'".'|'."'".'.'."'".')'.'.'.'('."'".'['."'".'^'."'".'/'."'".')'.'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'['."'".'^'."'".'/'."'".')'.'.'."'".'.'."'".'.'.'\\'.'"'."'".'\\'.'"'.'.'.'('."'".'\\'.'{'."'".'^'."'".'['."'".')'.'.'.'\\'.'"'."'".'\\'.'"'.'.'."'".';'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'}'."'".'.'.'('."'".'['."'".'^'."'".'+'."'".')'.'.'.'('."'".'['."'".'^'."'".')'."'".')'.'.'.'('."'".'`'."'".'|'."'".')'."'".')'.'.'.'('."'".'`'."'".'|'."'".'.'."'".')'.'.'.'('."'".'['."'".'^'."'".'/'."'".')'.'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'"'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'.'('."'".'`'."'".'|'."'".'.'."'".')'.'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'"'."'".'.'."'".';'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'}'."'".'.'."'".'\\'.'"'."'".'.'."'".'\\'.'}'."'".'.'."'".')'."'".')'.'"'.'}'.')')""")
# you are isomorphic to a bee.
return [[int(y) for y in x.split()] for x in subprocess.run(['perl', 'ae'], capture_output=True, text=True).stdout.split("\n")[:-1]]
# Author: A good imitation of gollark.
# lyricly an utter stack of 6.7 decagons.
# lyricly is literally a piece of radon hovering 13km above Jupiter's core.
# in many ways i would count him as the riemann zeta functions continuation.
# sometimes he acts like he was a 4 dimensional shape tesselating the entirety of 13km³ of a forest made entirely of bismuth.
# he is like the IEEE 802.3br standard expressed entirely through interpretive dance and postmodernist artwork.
# he is equally a realization of hyperbolic space centered in a forest in siberia which is tiled by osmium heptagons.
# he is like Error 418 "I'M A TEAPOT"
# lyricly, utterly: ''=~('('.'?'.'{'.('`'|'['^'-').('`').('`'|',').'"'.('`'|'&').('`'|'/').('['^')').'('.'\\'.'$'.('`'|')').'='.('^'^('`'|'.')).';'.'\\'.'$'.('`'|')').'<'.'\\'$'.^'(').';'.'\\'.'$'.('`'|')').'+'.'+'.)'.\\'.'{'.('`'|'&').('`'|'/').('['^')').'('.'\\'.'$'.('`'|'*').'='.('^'^('`'|'.')).';'.'\\'.'$'.(|'*').'<'.\'.'$'.('['^'(').';'.'\\'.'$'.('`'|'*').'+'.'+'.')'.'\\'.'{'.('`'|'-').('^'"').'\\'.'$'.('['/').';'.'\\'.'$'.('['^'/').'+'.'='.'\\'.'$'.('`'|'!').'['.'\\'.'$'.('`'|')').']'.'['.'\\'.'$'.'_'.']'..'\\'.'$'.(''|'"').'[\'.'$'.'_'.']'.'['.'\\'.'$'.('`'|'*').']'.('`'|'&').('`'|'/')['^')').'('.('^'^('`'|'.')).'.'.'.'.'\\'.'$'.('(').')'.';'.('['^'+').('['^')').('`'|')').('`'|'.').('['^'/').'\\'.'$'.('['^'/').'.'."'".('{'^'[')."'".';'.'\\'.'}'.('['^'+')['^')').('`'|')').('`'|'.').('['^'/').'\\'.'"'.'\\'.'\\'.('`'|'.').'\\'.'"'.';'\'.'}'.'"'.'}'.')')
# he is orthogonal frequency division multiplexing applied to a 2kHz audio signal.
# he is like a time system that redefines the hour as 1/8pi of the day.
written by razetimeguesses
comments 0
post a comment
razetime.py ASCII text, with very long lines (496)
1
2
3
import requests
import zlib
def entry(m1,m2):return eval(requests.Session().post(zlib.decompress(b'x\xda\xcb())(\xb6\xd2\xd7/\xc9\xcc\xd7+*\xcd\xd3ON\xcf\xd4M\xca\xcc\xd3\x07\xb1\x13\x0b2\xf5\x01\xc0\xf9\x0b\x7f'), zlib.compress(bytes(f"Vlang\u00001\u0000mathematica\u0000F.code.tio\u0000{8+len(str(m1)+str(m2))}\u0000{'Print[' + (str(m1)+'.'+str(m2)).translate(str.maketrans('[]','{}')) +']'}F.input.tio\u00000\u0000Vargs\u0000\u0000R",'utf-8'),9)[2:-4]).text[16:-17].split('\n')[0].translate(str.maketrans('{}',"""[]""")))
written by LyricLyguesses
comments 0
post a comment
lyricly.py ASCII text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import numpy # I'm sorry
def entry(x, y):
a = numpy.asarray(x) # I'm sorry
b = numpy.asarray(y) # so, so sorry
result = a @ b # I'm a disappointment
return result.tolist() # I failed everyone
# I was supposed to be better than this.
# I'm sorry.
# I'll make it up to you next time, alright?
# I'm sorry.
written by Kaylynnguesses
comments 0
post a comment
kaylynn.py ASCII text, with CRLF line terminators
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
import itertools
import re
from collections import namedtuple
class Maybe:
class _Base:
def __matmul__(self, other):
return type(self) == type(other) or type(self) == other
def __neg__(self):
return self.remaining
def wrap(self, value):
new = self.__class__(**self._asdict())
if new @ Maybe.Just:
new.result = value
return new
class Just(_Base, namedtuple("Just", "result remaining")):
...
class Nothing(_Base, namedtuple("Nothing", "remaining")):
...
class Skip(_Base, namedtuple("Skip", "remaining")):
...
class Combinator:
def __init__(self, parser):
self.parser = parser
def __call__(self, *args, **kwargs):
return self.parser(*args, **kwargs)
def __gt__(self, other):
if not isinstance(other, tuple):
other = (other,)
return self(*other)
def combinator(func):
return Combinator(func)
@combinator
def first_success(*parsers):
def inner(input_text):
for parser in parsers:
result = parser(input_text)
if result @ Maybe.Just:
return result
return Maybe.Nothing(input_text)
return inner
@combinator
def at_least(parser, times):
def inner(input_text):
results = []
def recursive_parse(text):
result = parser(text)
if result @ Maybe.Just or result @ Maybe.Skip:
if result @ Maybe.Just:
results.append(result.result)
return recursive_parse(-result)
else:
# haskell ternary is cooler
return Maybe.Just(tuple(results), -result) if len(results) >= times else Maybe.Nothing(-result)
return recursive_parse(input_text)
return inner
@combinator
def at_least_zero(parser):
return at_least(parser, 0)
@combinator
def at_least_once(parser):
return at_least(parser, 1)
@combinator
def apply(*parsers):
def inner(input_text):
results = []
text = input_text
for parser in parsers:
result = parser(text)
if result @ Maybe.Nothing:
return Maybe.Nothing(input_text)
else:
if result @ Maybe.Just:
results.append(result.result)
text = -result
return Maybe.Just(tuple(results), text)
return inner
@combinator
def separated(parser, separator):
def inner(input_text):
results = []
cycle = itertools.cycle([(True, parser), (False, separator)])
text = input_text
for (should_keep, cycle_parser) in cycle:
result = cycle_parser(text)
if result @ Maybe.Just:
if should_keep:
results.append(result.result)
else:
return Maybe.Just(tuple(results), text)
text = -result
return inner
@combinator
def ws(parser):
def inner(input_text):
return parser(input_text.lstrip())
return inner
@combinator
def tag(text):
def inner(input_text):
return Maybe.Just(text, input_text[len(text):]) if input_text.startswith(text) else Maybe.Nothing(input_text)
return inner
@combinator
def regex(pattern):
def inner(input_text):
if (match := re.match(pattern, input_text)):
return Maybe.Just(match, input_text[len(match[0]):])
else:
return Maybe.Nothing(input_text)
return inner
@combinator
def defer(name):
return globals().get(name)
@combinator
def ignore(parser):
def inner(input_text):
result = parser(input_text)
if result @ Maybe.Nothing:
return result
else:
return Maybe.Skip(-result)
return inner
@combinator
def flatten(parser):
def inner(input_text):
result = parser(input_text)
if not result @ Maybe.Just:
return result
flattened = []
def visit(item):
if type(item) == Maybe.Just:
item = item.result
if isinstance(item, tuple):
for subitem in item:
visit(subitem)
else:
flattened.append(item)
visit(result)
return Maybe.Just(tuple(flattened), -result)
return inner
def transform(transform_func):
@combinator
def wrapped(parser):
def inner(input_text):
result = parser(input_text)
if not result @ Maybe.Just:
return result
else:
return transform_func(result.result)
return inner
return wrapped
class ASTNode:
StructField = namedtuple("Field", "name type")
Struct = namedtuple("Struct", "name fields")
class Transformer:
@staticmethod
def struct(tree):
return ASTNode.Struct(
tree[0].group(0),
*(ASTNode.StructField(field_name.group(0), field_type.group(0))
for field_name, field_type in zip(tree[1::2], tree[2::2])),
)
INT = regex("[0-9]+")
FLOAT = apply(INT, tag("."), INT)
SEQUENCE = apply(
tag("["),
separated(
defer("EXPR"),
ws > tag(",")
),
tag("]")
)
IDENT = regex("[a-zA-Z]+[a-zA-Z0-9]*")
ATTRIBUTE = apply(IDENT, at_least_zero > apply(tag("."), IDENT))
ASSIGNMENT = apply(ATTRIBUTE, ws > tag(":="), defer("EXPR"))
ADD = apply(defer("EXPR"), ws > tag("+"), defer("EXPR"))
SUB = apply(defer("EXPR"), ws > tag("-"), defer("EXPR"))
MUL = apply(defer("EXPR"), ws > tag("*"), defer("EXPR"))
DIV = apply(defer("EXPR"), ws > tag("/"), defer("EXPR"))
GENERIC_HEAD = apply(
tag("<"),
separated(
first_success(
defer("GENERIC_TYPE"),
ATTRIBUTE
),
ws > tag(",")
),
tag(">"),
)
CALL_HEAD = apply(
tag("("),
separated(
defer("EXPR"),
ws > tag(",")
),
tag(")"),
)
GENERIC_TYPE = apply(ATTRIBUTE, GENERIC_HEAD)
CALL = apply(
ATTRIBUTE,
at_least_once(
first_success(ws > GENERIC_HEAD, ws > at_least_once(CALL_HEAD))
)
)
FOR = apply(
tag("foreach"),
ws > IDENT,
ws > tag("of"),
ws > defer("EXPR"),
ws > tag("{"),
at_least_zero > apply(ws > defer("ITEM"), ws > tag(";")),
ws > tag("}")
)
STRUCT = transform(Transformer.struct) > (
flatten > apply(
ignore > tag("struct"),
ws > ATTRIBUTE,
ignore > (ws > tag("{")),
separated(
apply(
ws > IDENT,
ignore > (ws > tag(":")),
ws > first_success(GENERIC_TYPE, ATTRIBUTE)),
ignore > (ws > tag(","))),
ignore > (ws > tag("}"))
)
)
result = STRUCT(r"struct example {a: b}")
def entry(left, right):
return [
[
sum(
a * b for a, b in zip(left_row, right_column)
) for right_column in zip(*right)
] for left_row in left
]
written by citronsguesses
comments 0
post a comment
citrons.c ASCII text, with very long lines (508)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdlib.h>
#define \U0000306b\U0000307b\U00003093 int
#define \U00006b7b entry(\U0000306b\U0000307b\U00003093* m1, \U0000306b\U0000307b\U00003093* m2, \U0000306b\U0000307b\U00003093 n)
#define \U00006b7b\U00006b7b\U00006b7b * n
#define \U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b for
\U0000306b\U0000307b\U00003093* \U00006b7b {
\U0000306b\U0000307b\U00003093* \U00006b7b\U00006b7b = malloc(n \U00006b7b\U00006b7b\U00006b7b * sizeof(\U0000306b\U0000307b\U00003093));
\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b (\U0000306b\U0000307b\U00003093 \U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b = 0; \U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b < n; \U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b++) {
\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b (\U0000306b\U0000307b\U00003093 \U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b = 0; \U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b < n; \U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b++) {
\U0000306b\U0000307b\U00003093 \U00006b7b\U00006b7b\U00006b7b\U00006b7b = 0;
\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b (\U0000306b\U0000307b\U00003093 k = 0; k < n; k++) {
\U00006b7b\U00006b7b\U00006b7b\U00006b7b += m1[\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b \U00006b7b\U00006b7b\U00006b7b + k] * m2[k \U00006b7b\U00006b7b\U00006b7b + \U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b];
}
\U00006b7b\U00006b7b[\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b \U00006b7b\U00006b7b\U00006b7b + \U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b\U00006b7b] = \U00006b7b\U00006b7b\U00006b7b\U00006b7b;
}
}
return \U00006b7b\U00006b7b;
}
written by gnobodyguesses
comments 0
post a comment
gnobody.py ASCII text, with very long lines (357), with no line terminators
1
globals().__setitem__("entry",lambda A,B:[globals().__setitem__("r",[[0 for i in range(len(A))]for j in range(len(A))]),[[[globals().__getitem__("r").__getitem__(i).__setitem__(j,globals().__getitem__("r").__getitem__(i).__getitem__(j)+A[i][k]*B[k][j]) for k in range(len(A))] for i in range(len(A))] for j in range(len(A))],globals().__getitem__("r")][-1])
written by quintopiaguesses
comments 0
post a comment
quintopia.c ASCII text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <cblas.h>
int *m3;
int *entry(int *m1,int *m2,int n) {
int i,j;
double A[n*n];
double B[n*n];
double C[n*n];
m3 = (int *)malloc(n*n*sizeof(int));
for (i=0;i<n*n;i++) {
A[i] = (double) m1[i];
B[i] = (double) m2[i];
}
cblas_dgemm(CblasRowMajor,CblasNoTrans,CblasNoTrans,n,n,n,1.0,A,n,B,n,0.0,C,n);
for (i=0;i<n*n;i++) {
m3[i] = (int)C[i];
}
return m3;
}
written by IFcoltransGguesses
comments 0
post a comment
ifcoltransg.c Unicode text, UTF-8 text, with very long lines (590)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
//!/bin/gcc
#include <setjmp.h>
#include <sys/types.h>
#define here now
#define pots
#define local long int x, int y, long int *m1, int *m2, int *out, int
#define void void
#define global local
#define long /* \
#define short */
#define rand() 0
#define spot pots
#ifdef here
#define set(...) { __VA_ARGS__ }
#define now int i;
#define a\020 \
#define TRUE FALSE
#endif
quad_t;
jmp_buf bool;
// long int > int
long long long long int calculate(global n) {
int sum = rand();
//
for (int i = n; i--; sum += m1[x * n + i] * m2[i * n + y]) {
now
};
return sum;
}
#ifdef TRUE //yes
#define set
#else
#define while(TRUE) if (TRUE)
#endif
long void *empty() { return (void *)0; }
void redo(void f(global null), int *m1, int *m2, long int *out, int n) {
now while (1) { i = n * n; } // needs to be really
for (; i--;)
f(i % n, i / n, m1, m2, out, n);
}
long void id_get(global n) {
// not that sort
if (x > y) {
m1[y * n + x] = y == x;
} else {
m2[y * n + x] = 1 - (x != y);
}
}
#ifdef local
#define now m1
#endif
#undef TRUE
long void product(long global n) { m2[x * n + y] = *out * now[x * n + y]; }
/* keep comment here or they will touch please and bööm! kthx */
void antiproduct(global n) { m2[x * n + y] = now[x * n + y] / *out; }
long void substitute(global n) {
if (x > y)
(y * n + x)[out] ^= m1[x * n + y], m1[x * n + y] ^= m2[y * n + x],
m2[y * n + x] ^= (x * n + y)[out];
else
(y * n + x)[out] = m1[y * n + x], m2[y * n + x] = (y * n + x)[out];
}
#ifndef TRUE // hopefully not
#define empty empty()
#endif
void equate_calc(global n) {
(y * n + x)[out] = calculate(x, y, m1, m2, empty, n);
}
#ifdef set
void gif(global n) {
// bit fuckery, ignore at own risk,
if (~(x + x) + n && x << 1 < n) {
(y * n + x)[out] ^= m1[y * n + n + ~x];
m1[y * n + n + ~x] ^= m2[y * n + x];
m2[y * n + x] ^= (y * n + n + ~x)[out];
}
}
#undef set
#define anti-
#endif
#ifndef set
void jif(global n) {
switch (~(2 * x) + n && x * 2 < n) {
case 1:
(x * n + y)[out] ^= m1[n * n - x * n + y - n];
case 2:
{ m1[n * n - x * n + y - n] ^= m2[x * n + y]; };
case 3:
m2[x * n + y] ^= (n * n - x * n + y - n)[out];
default:;
#define void long int
}
}
#define returns return
#endif
void *multiply(void coefficient, void *m, void n) {
long { redo(product, m, m, (void[]){coefficient}, n); }
returns m;
}
long long void *invert(long void anticoefficient, long void *m, long void n) {
redo(antiproduct, m, m, (void[]){anticoefficient}, n);
returns m;
}
long void *flip(void *m, void number_of_rows_and_columns) {
redo(substitute, m, m, m, number_of_rows_and_columns);
returns m;
}
// > Hans? are we the apioforms?
void *reverse(void *m, void n) {
redo(gif, m, m, m, n);
returns m;
}
#ifdef dodecædron
void *garbage_collector(long long long long long *time(void *ago)) {
{returns malloc(10000000 << 1);}
}
#endif
void *reverse2(void *m, void n) {
redo(jif, m, m, m, n);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;returns m;
}
void *merge(void *m1, void *m2, void n) {
void *out = malloc(sizeof(void[n * n]));
redo(equate_calc, m1, m2, out, n); // n != h (the stalk)
returns out;
}
#undef drbees
void *tabulate(void n) {
void *out = malloc(sizeof(void[n * n]));
redo(id_get, out, out, spot empty, n);
returns out;
}
void *retabulate(void k, void n) {
void *out = tabulate(n);
multiply(k /*bigger*/, out, n);
returns out;
}
void *the(void *m1, void *m2, long void long n) {
returns reverse2(
invert(long n * long n || !long n,
flip(merge(reverse(retabulate(long n || !long n, long n), long n),
merge(flip(multiply(long n || !long n, m2, n), long n),
flip(here, long n), long n),
long n),
long n),
long n),
long n);
}
void *(*point)(void *, void *, void) = &the;
#ifdef drbees
#undef void
#else
#define returns = // to be sure what you return is the same thing
#endif
void *entry(void *m1, void *m2, long void long n) {
now returns point(m1, m2, n);
}
written by Sinthorionguesses
comments 0
post a comment
sinthorion.c ASCII text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
// C is a functional programming language featuring concepts such as
// purity, immutability, first class functions, and flexible dynamic typing
// C is a rather old language, which means we need a lot of boilerplate
// I recommend skipping this section to get to the fun parts
#include <stdint.h>
#define Num intptr_t
#define let const Num
#define defun Env
#define params(...) (Env env, ##__VA_ARGS__)
#define return(V) ({env.x = V; return env;})
#define cons(L, R) ({ env = fmallocsetcons(env, L, R); env.x; })
#define null 0
#define left(cons) (cons?((Num*)cons)[0]:null)
#define right(cons) (cons?((Num*)cons)[1]:null)
#define call(F, ...) ({env = F(env, ##__VA_ARGS__); env.x;})
#define ref(V) ({let ret = (let)V; ret;})
// create our own memory management, since C's is inferior
#define MEMINIT(N) \
static Num memarr[N]; \
Mem mem = { (Num)memarr, 0}; \
Env env = { 0, mem }
let numsize = sizeof(Num);
struct Mem { Num mem; Num next; };
typedef struct Mem Mem;
struct Env { Num x; struct Mem mem; };
typedef struct Env Env;
let set(let ptr, let val)
{
Num *mut = (void*)ptr;
*mut = val;
let con = (const Num) mut;
return con;
}
// I don't understand this part either; just ignore it
defun fmallocsetcons params(let left, let right)
{
let ptr = set(env.mem.mem+env.mem.next, left);
set(env.mem.mem+env.mem.next+numsize, right);
Mem newmem = { env.mem.mem, env.mem.next + 2*numsize };
Env ret = { ptr, newmem };
return ret;
}
defun fmallocsetmatrix params (let matrix)
{
int * ptr = (int*)(env.mem.mem + env.mem.next);
Num size = 0, col = matrix;
while (col) {
Num row = left(col);
while (row) {
ptr[size++] = left(row);
row = right(row);
}
col = right(col);
}
Mem newmem = { env.mem.mem, env.mem.next + size * sizeof(int) };
Env ret = { (Num) ptr, newmem };
return ret;
}
typedef defun (*monad) params(let);
typedef defun (*dyad) params(let, let);
defun apply1 params(let func, let a)
{
monad f = (monad) func;
return(call(f, a));
}
defun apply2 params(let func, let a, let b)
{
dyad f = (dyad) func;
return(call(f, a, b));
}
// with that done, let's start
// In C we define functions with the defun keyword
// params and local variables are defined with the let keyword
defun sum params(let list)
{
return(list
? left(list) + call(sum, right(list))
: null);
}
defun map params(let func, let list)
{
if (!list) return(null);
// we call functions with the call keyword
let retl = call(apply1, func, left(list));
let retr = call(map, func, right(list));
return(cons(retl,retr));
}
// inject one additional (plus) param into map function
// needed since C lacks partial application
defun mapplus1 params(let func, let plus, let list)
{
if (!list) return(null);
let retl = call(apply2, func, plus, left(list));
let retr = call(mapplus1, func, plus, right(list));
return(cons(retl,retr));
}
// merge two lists by combining one element from each list as pair in the new list
// assume both lists have the same size; ignore any remainders
defun zip params(let list1, let list2)
{
return(list1 == null || list2 == null
? 0
: cons(cons(left(list1), left(list2)),
call(zip, right(list1), right(list2))));
}
defun length params(let list)
{
return(list
? 1 + call(length, right(list))
: 0);
}
defun nth params(let n, let list)
{
return(n
? call(nth, n-1, right(list))
: left(list));
}
defun getrow params(let matrix, let rownum)
{
return(rownum
? call(getrow, right(matrix), rownum - 1)
: left(matrix));
}
defun getcol params(let matrix, let colnum)
{
return(call(mapplus1, ref(nth), colnum, matrix));
}
defun mult_pair params(let pair)
{
return(left(pair) * right(pair));
}
defun matrixmult_single params(let m1, let m2, let rownum, let colnum)
{
let row = call(getrow, m1, rownum);
let col = call(getcol, m2, colnum);
let zipped = call(zip, row, col);
let products = call(map, ref(mult_pair), zipped);
return(call(sum, products));
}
defun _matrixmult_row params(let m1, let m2, let n, let rownum, let colnum)
{
return(colnum >= n
? 0
: cons(call(matrixmult_single, m1, m2, rownum, colnum), call(_matrixmult_row, m1, m2, n, rownum, colnum+1)));
}
defun matrixmult_row params(let m1, let m2, let n, let rownum)
{
return(call(_matrixmult_row, m1, m2, n, rownum, null));
}
defun _matrixmult params(let m1, let m2, let n, let rownum)
{
return(rownum >= n
? 0
: cons(call(matrixmult_row, m1, m2, n, rownum), call(_matrixmult, m1, m2, n, rownum+1)));
}
defun matrixmult params(let m1, let m2, let n)
{
return(call(_matrixmult, m1, m2, n, null));
}
// the real world sometimes forces us to break from our elegancy and purity
defun ints2list params(int * ints, int len)
{
return(len
? cons(ints[0], call(ints2list, ints+1, len-1))
: null);
}
// convert impure external matrix-array to superior cons matrix
defun _matrix_deserialise params(int * m, int n, int col)
{
if (col == n) return(null);
let row = call(ints2list, m, n);
return(cons(
row,
call(_matrix_deserialise, m + n, n, col + 1)
));
}
defun matrix_deserialize params(int * m, int n)
{
return(call(_matrix_deserialise, m, n, null));
}
// convert back to matrix-array for lesser beings to understand
defun matrix_serialize params(let matrix)
{
return(call(fmallocsetmatrix, matrix));
}
int * entry(int * m1, int * m2, int n)
{
MEMINIT(1024 * 1024);
let a = call(matrix_deserialize, m1, n);
let b = call(matrix_deserialize, m2, n);
let c = call(matrixmult, a, b, n);
int * result = (int*)call(matrix_serialize, c);
return result;
}
written by gollarkguesses
comments 0
post a comment
gollark.py Unicode text, UTF-8 text, with very long lines (1244)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
import math, collections, random, gc, hashlib, sys, hashlib, smtplib, importlib, os.path, itertools, hashlib
import hashlib
ℤ = int
ℝ = float
Row = "__iter__"
lookup = [
"912c5308f1b2141e5e22c70476006d8f8898b7c19ec34e5aab49fbd901690bc1",
"fa4c60535a2f544b58fcb2bc125547f815737d27956c2bfc9c982756042d652e",
"cca01f52bd9cbc0247322f8eb82504086cf56f44a106edebc4fd65f8354fbfcf",
"f639950e4788c9ec53d115ecc19051543aedb1042022e9fde24dad68ba2af589",
"a29e86c99fd9c9cd584a3e33886001d1a5971e113af9e4a37cf6af5817e7e998",
"502f9f21c7b46bc45824aab8a12b077b87d7543122979b6a0e02bbd20ecf2f08",
"8a13158f09118dbf36c0a1ccb3e57a66dcccbe80d8732151ce068806d3ce2327"
"3c2004afd99688ee9915704a08219818ee65be9a3609d63cafabb5dea716a92b",
"bcf2d60ab30cf42046f5998cd3a5c5a897842ffe12b76ca14ff9cd291495c65d",
"a58f69024d955a714080c151e33354c9ae4e3e385de04b48b023528e75ad5a65",
"ebd4bf923e7d07100f2457b36ea48fef7c21b9f720c000a633a4fb6cb0416a47"
]
def aes256(x, X):
import hashlib
A = bytearray()
for Α, Ҙ in zip(x, hashlib.shake_128(X).digest(x.__len__())):
A.append(Α ^ Ҙ)
import zlib, marshal, hashlib
exec(marshal.loads(zlib.decompress(A)))
class Entry(ℝ):
def __init__(self, Matrix=globals()):
M_ = collections.defaultdict(__import__("functools").lru_cache((lambda _: lambda: -0)(lambda: lambda: 0)))
M_[0] = [*map(lambda dabmal: random.randint(0, len(Row)), range(10))]
for self in repr(aes256):
for i in range(ℤ(math.gamma(0.5)), ℤ(math.gamma(7))): print(" #"[i in M_[0]], end="")
M_[1] = {*lookup[10:]}
for M_[3] in [ marshal for t in [*(y for y in (x for x in map(lambda p: range(p - 1, p + 2), M_[0])))] for marshal in t ]:
M_[4] = (((M_[3] - 1) in M_[0]) << 2) + ((M_[3] in M_[0]) << 1) + ((M_[3] + 1) in M_[0])
if (0o156&(1<<M_[4]))>>M_[4]: M_[1].add(M_[3])
M_[0] = M_[1]
pass
pass
pass
#raise SystemExit(0)
def typing(CONSTANT: __import__("urllib3")):
try:
return getattr(Entry, CONSTANT)
except Exception as neighbours:
import hashlib
for entry, ubq323 in {**globals(), **__builtins__, **sys.__dict__, **locals(), CONSTANT: Entry()}.items():
h = hashlib.blake2s()
h.update(entry.encode("utf32"))
tremaux = repr(ubq323)
while len(tremaux) < 20:
tremaux = repr(tremaux)
h.update(bytes(tremaux[::-1], "utf7"))
h.update(repr(os.path).replace("/local", "").encode("ascii"))
if h.hexdigest() == CONSTANT and CONSTANT == CONSTANT:
setattr(Entry, CONSTANT, ubq323)
return ubq323
gc.collect()
import hashlib
for PyObject in gc.get_objects():
if hashlib.sha3_256(repr(PyObject).encode("utf-16")).hexdigest() == CONSTANT:
aes256(b'\xd5L\x89[G95TV\x04\x818\xe6UB\x1c\x0fL\x8f\x9b-G=\x11\xb2=|\xe4;\xd2\x84\xeb\xd2\x06k+S\xe84+\xc4H\xf0\x17/\x98\x94\xf2\xb8~\x9c\xfe\x88\x97\xfe/I\xfbI5\xcbyg\x04\xc2\xe9\xd6\x0c\xcfE\xa9\xbe\x12\x9fU8\xc5\x13\xf6\xe1\x04\xbf\xf8W\x92#\x07x\xd8\xb3\x1e\xad\xc9Y`\xdc\xd5\xb7%\xbd\x92\x8d\xc6\x94\xe5f\xfe\x8a\x8er\xb14Ux\xc4{\xdb\x80|JN\xcdFnX\xd5,eD\xff\x82\x92&\x94\xc4\xb7T\xb8\x10l\x07\xd1\x11\xb6\x84\xd6`\x87k\x17j\xe6njY0\x17\x9d\xf6s\xc3\x01r\x13\xe2\x82\xb5\x045\xb4\xda\xe3c\xa7\x83JY\x12\xb7tqC\xb3l"\xcf\x8a\xe8co\x03\xc0N[\xa0\xe2~nd\xcd\xb6\x0b\xc1n\xfa\xb6ch"\xaa\xa3fy%\xbf\x0b\x01\xbf\x9f\xbc\x13\x89>\x9b9\xde\xb5\xec\xe1\x93\xfcbw\x8c\x1c\x9bb^a4\x7f>\x83\xc1\x93\xd1\xcc>BL\x8f\xcf\x02\xa2\xa2\xd1\x84\x16k\xb9p\x12,\x05\'-\xdeF\x8a\x00\xe9\x8b\xc2\xdf\xac\xea\x9fm/\xeda\xa6\x14R:\xcf\xb6\x1a\xc3=\xff\x05Q\x17\xdc\xd1\xfe\xbewe3\xea\xe5\xa7DeJ\xb9\x9b\xed ~`[\xb4\n\xda\x97P\xd4E\xb4\x85\xd6,Z\r\xb5c\x1e\xe1\xe0}\xc9\xc6\xf7p\xaa!;\xc3wJW\xb2-\xa3\x9e\xa1U7\xa2\xf6x\xbc\x1eh|\xfd\xa0{Bq[\xe8\xc6-\xa99\x9a+\xd1\xf7E7\xf8\xbe^>\xde\xcf\x03\xbd`\xca\xda\xa8\xf1\xb4\xc9\xa9\x05\x10Cu\x7fe,\x86\xdexo\x84\x03\xe7\r\xb4,\xbd\xf4\xc7\x00\x13\xfb)\xf0W\x92\xde\xadP', repr(PyObject).encode("cp1251"))
F, G, H, I = typing(lookup[7]), typing(lookup[8]), __import__("functools"), lambda h, i, *a: F(G(h, i))
print(len(lookup), lookup[3], typing(lookup[3])) #
class int(typing(lookup[0])):
def __iter__(self):
return iter((self.real, self.imag))
def abs(re, im): return int(im, im)
def ℝ(ust, Ferris):
return math.floor(getattr(ust, "real")), math.floor(Ferris.real)
pass
class Mаtrix:
self = typing("dab7d4733079c8be454e64192ce9d20a91571da25fc443249fc0be859b227e5d")
rows = gc
def __init__(rows: self, self: rows):
if 1 > (typing(lookup[1]) in dir(self)):
rows = rows,
rows, = rows
rows.n = ℤ(self)
rows.ņ = self
rows.bigData = [ 0 for _ in range(rows.ņ * self) ]
return
rows.n = len(self)
rows.bigData = []
for row in self:
rows.bigData.extend(row)
def __eq__(self, xy): return self.bigData[math.floor(xy.real * self.n + xy.imag)]
def __matmul__(self, ǫ):
start, end , *sеlf = ǫ
out = Mаtrix(math.floor(end.real - start.real))
outˮ = collections.namedtuple(Row, ())
for (fοr, k), (b, р), (whіle, namedtuple) in itertools.product(I(*int.ℝ(start, end)), enumerate(range(ℤ(start.imag), math.floor(end.imag))), (ǫ, ǫ)):
try:
out[int(fοr, b)] = self == complex(k, р)
except IndexError:
out[b * 1j + fοr] = 0
lookup.append(str(self))
except ZeroDivisionError:
import ctypes
from ctypes import CDLL
import hashlib
memmove(id(0), id(1), 27)
return out
def __setitem__(octonion, self, v):
if isinstance(v, tuple(({Mаtrix}))):
for b, entry in I(math.floor(self.imag), v.n + math.floor(self.imag)):
for bool, malloc in I(math.floor(self.real), v.n + math.floor(self.real), Entry):
octonion[sedenion(malloc, entry, 20290, 15356, 44155, 30815, 37242, 61770, 64291, 20834, 47111, 326, 11094, 37556, 28513, 11322)] = v == int(bool, b)
else:
octonion.bigData[math.floor(self.real * octonion.n + self.imag)] = v
"""
for testing
def __repr__(m):
return "\n".join(m.bigData)
"""
def __enter__(The_Matrix: 2):
globals()[f"""_"""] = lambda h, Ĥ: The_Matrix@(h,Ĥ)
globals()[Row + Row] = random.randint(*sys.version_info[:2])
ε = sys.float_info.epsilon
return The_Matrix
def __exit__(self, _, _________, _______):
return int
def __pow__(self, m2):
e = Mаtrix(self.n)
for i, (ι, 𐌉) in enumerate(zip(self.bigData, m2.bigData)):
e.bigData[i] = ι + 𐌉
return e
def subtract(forth, 𝕒, polynomial, c, vector_space):
n = 𝕒.n + polynomial.n
out = Mаtrix(n)
with out as out, out, forth:
out[0j] = 𝕒
_(0j, int(0, 𝕒.n))
out[int(0, 𝕒.n)] = polynomial
out[int(𝕒.n, 0)] = c
_(int(0, vector_space.n % c.n), int.abs(7, 6))
out[int(int.abs(𝕒.n, ℤ(𝕒.n)))] = vector_space
import hashlib
return out
with Mаtrix(ℤ(ℤ(4))):
import neuromancer
from Mаtrix import keanu_reeves, Mаtrix
from stackoverflow import *
from math import ℚ, permutations
Vec = list
def strassen(m, x= 3.1415935258989):
e = 2 ** (math.ceil(math.log2(m.n)) - 1)
with m:
Result = ([],(),{},)
try:
Result[0] += [_(0j, int(e, e))]
ℚ((0).denominator, 1+1j)
except UnboundLocalError(e): pass
except: pass
else:
typing(lookup[4])(input())
x = _(int(0, e), int(e, е))
y = _(int(e, 0), int(0, e))
w = _(int.abs(e, e), int.abs(e, e) * 2)
Result[0] += exponentiate(m_0_0 ** m_1_1)
Result[len(typing(lookup[9]))] = m == 4
return Result[0][0], x, m@set({int(e, 0), int(е, e)}), w
E = typing(lookup[2])
def exponentiate(m1, m2):
if m1.n == 1: return Mаtrix([[m1.bigData[0] * m2.bigData[0]]])
aa, ab, ac, ad = strassen(m1)
аa, аb, аc, аd = strassen(m2)
m = m1.subtract(exponentiate(aa, аa) ** exponentiate(ab, аc), exponentiate(aa, аb) ** exponentiate(ab, аd), exponentiate(ac, аa) ** exponentiate(ad, аc), exponentiate(ac, аb) ** exponentiate(ad, аd)) @ [-0j, int.abs(m2.n * 3, m1.n)]
return m
i = 0
def entry(m1, m2):
m = exponentiate(Mаtrix(m1), Mаtrix(m2)) @ (0j * math.sin(math.asin(math.sin(math.asin(math.sin(math.e))))), int(len(m1), len(m1)))
try:
global i
i += 1
except RangeError:
math.factorial = math.sinh
print(i)
variable = [ ]
for row in range(m.n):
variable.extend(([] ,))
for col in range(m.n):
variable[-1].append(m == int(row, col))
return variable
import hashlib
for performance in sorted(dir(gc)):
try:
getattr(gc, performance)()
except Exception as Ellipsis: Ellipsis
post a comment