previndexinfonext

code guessing, round #37 (completed)

started at ; stage 2 at ; ended at

specification

code guessing returns! the first challenge of the new age will be to compute digital roots. submissions may be written in any language.

the digital sum of a natural number in a given radix is the sum of all of its digits in that radix. to find the digital root, this process is iterated until the result is a single digit (and thus is its own digital sum).

your challenge, given a natural number and a radix, is to return the number's digital root in that radix. any sensible API may be used.

results

  1. 👑 LyricLy +5 -0 = 5
    1. seshoumara
    2. olus2000 (was Palaiologos)
    3. otesunki (was razetime)
    4. IFcoltransG
    5. Palaiologos (was otesunki)
    6. razetime (was taswelll)
    7. soup girl
    8. Olivia
    9. moshikoi
    10. taswelll (was Clouds)
    11. Clouds (was JJRubes)
    12. olive (was olus2000)
    13. JJRubes (was olive)
  2. IFcoltransG +5 -2 = 3
    1. seshoumara
    2. taswelll (was Palaiologos)
    3. otesunki (was razetime)
    4. olus2000 (was LyricLy)
    5. moshikoi (was otesunki)
    6. Palaiologos (was taswelll)
    7. soup girl
    8. Olivia
    9. JJRubes (was moshikoi)
    10. Clouds
    11. LyricLy (was JJRubes)
    12. razetime (was olus2000)
    13. olive
  3. Palaiologos +3 -0 = 3
    1. seshoumara
    2. soup girl (was razetime)
    3. razetime (was LyricLy)
    4. LyricLy (was IFcoltransG)
    5. moshikoi (was otesunki)
    6. otesunki (was taswelll)
    7. olive (was soup girl)
    8. IFcoltransG (was Olivia)
    9. Olivia (was moshikoi)
    10. Clouds
    11. JJRubes
    12. taswelll (was olus2000)
    13. olus2000 (was olive)
  4. moshikoi +3 -1 = 2
    1. seshoumara
    2. IFcoltransG (was Palaiologos)
    3. otesunki (was razetime)
    4. olus2000 (was LyricLy)
    5. Palaiologos (was IFcoltransG)
    6. taswelll (was otesunki)
    7. olive (was taswelll)
    8. soup girl
    9. Olivia
    10. LyricLy (was Clouds)
    11. Clouds (was JJRubes)
    12. razetime (was olus2000)
    13. JJRubes (was olive)
  5. razetime +2 -0 = 2
    1. seshoumara
    2. LyricLy (was Palaiologos)
    3. olus2000 (was LyricLy)
    4. JJRubes (was IFcoltransG)
    5. Palaiologos (was otesunki)
    6. olive (was taswelll)
    7. IFcoltransG (was soup girl)
    8. Olivia
    9. Clouds (was moshikoi)
    10. taswelll (was Clouds)
    11. otesunki (was JJRubes)
    12. soup girl (was olus2000)
    13. moshikoi (was olive)
  6. otesunki +2 -0 = 2
    1. soup girl (was seshoumara)
    2. JJRubes (was Palaiologos)
    3. Clouds (was razetime)
    4. Palaiologos (was LyricLy)
    5. Olivia (was IFcoltransG)
    6. taswelll
    7. moshikoi (was soup girl)
    8. seshoumara (was Olivia)
    9. IFcoltransG (was moshikoi)
    10. olive (was Clouds)
    11. razetime (was JJRubes)
    12. olus2000
    13. LyricLy (was olive)
  7. olive +2 -1 = 1
    1. seshoumara
    2. razetime (was Palaiologos)
    3. taswelll (was razetime)
    4. IFcoltransG (was LyricLy)
    5. Olivia (was IFcoltransG)
    6. soup girl (was otesunki)
    7. otesunki (was taswelll)
    8. Palaiologos (was soup girl)
    9. Clouds (was Olivia)
    10. JJRubes (was moshikoi)
    11. moshikoi (was Clouds)
    12. LyricLy (was JJRubes)
    13. olus2000
  8. soup girl +3 -3 = 0
    1. seshoumara
    2. IFcoltransG (was Palaiologos)
    3. otesunki (was razetime)
    4. razetime (was LyricLy)
    5. Palaiologos (was IFcoltransG)
    6. olive (was otesunki)
    7. Clouds (was taswelll)
    8. Olivia
    9. LyricLy (was moshikoi)
    10. JJRubes (was Clouds)
    11. taswelll (was JJRubes)
    12. olus2000
    13. moshikoi (was olive)
  9. JJRubes +1 -1 = 0
    1. seshoumara
    2. razetime (was Palaiologos)
    3. otesunki (was razetime)
    4. moshikoi (was LyricLy)
    5. LyricLy (was IFcoltransG)
    6. Palaiologos (was otesunki)
    7. Olivia (was taswelll)
    8. olus2000 (was soup girl)
    9. Clouds (was Olivia)
    10. soup girl (was moshikoi)
    11. taswelll (was Clouds)
    12. olive (was olus2000)
    13. IFcoltransG (was olive)
  10. olus2000 +3 -4 = -1
    1. seshoumara
    2. otesunki (was Palaiologos)
    3. olive (was razetime)
    4. soup girl (was LyricLy)
    5. IFcoltransG
    6. Palaiologos (was otesunki)
    7. Olivia (was taswelll)
    8. LyricLy (was soup girl)
    9. moshikoi (was Olivia)
    10. JJRubes (was moshikoi)
    11. Clouds
    12. taswelll (was JJRubes)
    13. razetime (was olive)
  11. taswelll +1 -2 = -1
    1. seshoumara
    2. Clouds (was Palaiologos)
    3. JJRubes (was razetime)
    4. otesunki (was LyricLy)
    5. LyricLy (was IFcoltransG)
    6. olive (was otesunki)
    7. Olivia (was soup girl)
    8. IFcoltransG (was Olivia)
    9. razetime (was moshikoi)
    10. soup girl (was Clouds)
    11. moshikoi (was JJRubes)
    12. Palaiologos (was olus2000)
    13. olus2000 (was olive)
  12. Clouds +1 -3 = -2
    1. Palaiologos (was seshoumara)
    2. Olivia (was Palaiologos)
    3. moshikoi (was razetime)
    4. IFcoltransG (was LyricLy)
    5. soup girl (was IFcoltransG)
    6. JJRubes (was otesunki)
    7. razetime (was taswelll)
    8. LyricLy (was soup girl)
    9. olive (was Olivia)
    10. seshoumara (was moshikoi)
    11. otesunki (was JJRubes)
    12. olus2000
    13. taswelll (was olive)
  13. Olivia +2 -5 = -3
    1. seshoumara
    2. IFcoltransG (was Palaiologos)
    3. otesunki (was razetime)
    4. Clouds (was LyricLy)
    5. JJRubes (was IFcoltransG)
    6. Palaiologos (was otesunki)
    7. taswelll
    8. moshikoi (was soup girl)
    9. razetime (was moshikoi)
    10. LyricLy (was Clouds)
    11. soup girl (was JJRubes)
    12. olive (was olus2000)
    13. olus2000 (was olive)
  14. seshoumara +0 -11 = -11
    1. soup girl (was Palaiologos)
    2. otesunki (was razetime)
    3. olus2000 (was LyricLy)
    4. JJRubes (was IFcoltransG)
    5. olive (was otesunki)
    6. razetime (was taswelll)
    7. Clouds (was soup girl)
    8. IFcoltransG (was Olivia)
    9. taswelll (was moshikoi)
    10. Olivia (was Clouds)
    11. LyricLy (was JJRubes)
    12. Palaiologos (was olus2000)
    13. moshikoi (was olive)

entries

you can download all the entries

entry #1

written by seshoumara
submitted at
3 likes

guesses
comments 2
otesunki

what the fuck


jan Junsa

jan junsa


post a comment


cg37_digital_root.sed 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
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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
#!/usr/bin/sed -nrf

:_Problem
	# digital root: sum all digits in a radix until the result is a single digit
	# https://cg.esolangs.gay/37/
:_Restrictions
	# Both number and radix are given as input in base 10
	# Incredibly slow computation beyond 4 digit numbers!


b debug
:main
	b digital_root
	:return_root
	s: [0-9]+:\n:p
b EOS


#x b
:digital_root
	:loop_dr
		s:^:0,:
l
		b digit_sum
		:return_sum
l
			s:^([0-9]+),[0-9]+:\1:
		/^([0-9]+) \1$/!{
			s:.*:&<MAX>&#result_dr_Mp<XAM>:
			b max_pos
			:result_dr_Mp
				s:<MAX>([0-9]+).*:@\1:
			/ ([0-9]+)@\1$/b finished
			s:@[0-9]+::
		}
	b loop_dr
	:finished
		s:@[0-9]+::
b return_root


#0,x b -> s,x b
:digit_sum
	:loop_ds
		s:,([0-9]+) ([0-9]+):&<MOD>\1 \2#result_ds_mdp<DOM>:
		b mod_pos
		:result_ds_mdp
			s:<MOD>([0-9]+).*:;\1:
		s:^([0-9]+)(,[0-9]+ [0-9]+);([0-9]+):\1\2<ADD>\1 \3#result_ds_ap<DDA>:
		b add_pos
		:result_ds_ap
			s:^[0-9]+(,[0-9]+ [0-9]+)<ADD>([0-9]+).*:\2\1:
		b integer_division
		:return_quotient
	/,0 /!b loop_ds
b return_sum


#s,x b -> s,(x//b) b
:integer_division
	s:$:;0 0:
	:loop_id
		s: ([0-9]+);[0-9]+ ([0-9]+):&<ADD>\1 \2#result_id_ap<DDA>:
		b add_pos
		:result_id_ap
			s:(;[0-9]+ )[0-9]+<ADD>([0-9]+).*:\1\2:
		/,([0-9]+) [0-9]+;[0-9]+ \1$/!{
			s:,([0-9]+) [0-9]+;[0-9]+ ([0-9]+):&<MAX>\1 \2#result_id_Mp<XAM>:
			b max_pos
			:result_id_Mp
				s:<MAX>([0-9]+).*:@\1:
			/([0-9]+)@\1$/b done
			s:@[0-9]+::
		}
		s:;([0-9]+) [0-9]+:&<INC>\1#result_id_ip<CNI>:
		b incr_pos
		:result_id_ip
			s:;[0-9]+( [0-9]+)<INC>([0-9]+).*:;\2\1:
	b loop_id
	:done
		s:,[0-9]+( [0-9]+);([0-9]+) [0-9]+@[0-9]+:,\2\1:
b return_quotient


:user_redirects
	/##result_dr_Mp<XAM>/b result_dr_Mp
	/##result_ds_mdp<DOM>/b result_ds_mdp
	/##result_ds_ap<DDA>/b result_ds_ap
	/##result_id_ap<DDA>/b result_id_ap
	/##result_id_Mp<XAM>/b result_id_Mp
	/##result_id_ip<CNI>/b result_id_ip
b EOS


:debug
	#test if GNU extensions are supported
	1v
b main


######################### MATH / UTILS ######################### (most of it was written before cg, used as my standard library :)

#4: <LCG>seed a c m#label<GCL> -> <LCG>new_seed##label<GCL>
:lcg_pos
	s:(<LCG>)([0-9]+ [0-9]+):\1<MULT>\2#result_mpp_lcgp<TLUM>:
	b mult_pos
	:result_mpp_lcgp
		s:(<LCG>)<MULT>([0-9]+)[^<]+<TLUM>:\1\2:
	s:(<LCG>)([0-9]+) ([0-9]+):\1<ADD>\3 \2#result_ap_lcgp<DDA>:
	b add_pos
	:result_ap_lcgp
		s:(<LCG>)<ADD>([0-9]+)[^<]+<DDA>:\1\2:
	s:(<LCG>)([0-9]+ [0-9]+):\1<MOD>\2#result_mdp_lcgp<DOM>:
	b mod_pos
	:result_mdp_lcgp
		s:(<LCG>)<MOD>([0-9]+)[^<]+<DOM>:\1\2#:
b redirect


#2: <INTERSECTION>3 4 5,2 3 4 5 6 7 8#label<NOITCESRETNI> -> <INTERSECTION>1##label<NOITCESRETNI>
:intersection_pos
	s:(<INTERSECTION>)([^,]+):\1!\2 :
	:loop_isp
		/<INTERSECTION>[^!]+!,/{
			s:(<INTERSECTION>)[^#]+:\10:
			b print_isp
		}
		/<INTERSECTION>[^!]*!([0-9]+) [^,]*,[^#]*\b\1\b/{
			s:(<INTERSECTION>)[^#]+:\11:
			b print_isp
		}
		s:(<INTERSECTION>[^!]*)!([0-9]+ ):\1\2!:
	b loop_isp
	:print_isp
		s:#[^<]+<NOITCESRETNI>:#&:
b redirect


#2: <SUBSET>3 4 5,2 3 4 5 6 7 8#label<TESBUS> -> <SUBSET>1##label<TESBUS>
:subset_pos
	s:(<SUBSET>)([^,]+):\1!\2 :
	:loop_ssp
		/<SUBSET>[^!]+!,/{
			s:(<SUBSET>)[^#]+:\11:
			b print_ssp
		}
		/<SUBSET>[^!]*!([0-9]+) [^,]*,[^#]*\b\1\b/{
			s:(<SUBSET>[^!]*)!([0-9]+ ):\1\2!:
			b loop_ssp
		}
	s:(<SUBSET>)[^#]+:\10:
	:print_ssp
		s:#[^<]+<TESBUS>:#&:
b redirect


#1+: <SEQ>3-5,2-8,7-7#label<QES> -> <SEQ>3 4 5,2 3 4 5 6 7 8,7##label<QES>
:seq_pos
	s:<SEQ>:&,:
	b next_sp
	:loop_sp
		/,([0-9]+)<INC>\1#[^<]+<CNI>[^<]+<QES>/b next_sp
		b incr_pos
		:result_ip_sp
			s:(<INC>)([0-9]+)#([^<]+<CNI>)([^,#]+)([^<]+<QES>):\1\2\3\4 \2\5:
	b loop_sp
	:next_sp
		s:,[0-9]+<INC>[^<]+<CNI>([^<]+<QES>):,\1:
		/,[0-9]+-[0-9]+[,#][^<]+<QES>/!b print_sp
		s:,([0-9]+)-([0-9]+)([,#][^<]+<QES>):,\2<INC>\1#result_ip_sp<CNI>\1\3:
	b loop_sp
	:print_sp
		s:(<SEQ>),([^#]+)(#[^<]+<QES>):\1\2#\3:
b redirect


#1+: <MAX>1 2 3#label<XAM> -> <MAX>3##label<XAM>
:max_pos
	s:(<MAX>)([0-9]+#):\10 \2:
	s: ?([0-9]+) ([0-9]+)(#[^<]+<XAM>):A\1,\1B\2,\2M\2\3:
	:loop_Mp
		/,0[BM][^<]+<XAM>/b next_Mp
		s:,([0-9]+)(B[^<]+<XAM>):,<DEC>\1#result_dp_Mp1<CED>\2:
		b decr_pos
		:result_dp_Mp1
			s:,<DEC>([0-9]+)#[^<]+<CED>(B[^<]+<XAM>):,\1\2:
		s:,([0-9]+)(M[^<]+<XAM>):,<DEC>\1#result_dp_Mp2<CED>\2:
		b decr_pos
		:result_dp_Mp2
			s:,<DEC>([0-9]+)#[^<]+<CED>(M[^<]+<XAM>):,\1\2:
	b loop_Mp
	:next_Mp
		s:A([0-9]+),[1-9][0-9]*B[0-9]+,0M[0-9]+([^<]+<XAM>):A0,0B0,0M\1\2:
		/<MAX>A/b print_Mp
		s:B[0-9]+,[0-9]+M([0-9]+)([^<]+<XAM>):B\1,\1M\1\2:
		s: ?([0-9]+)A[0-9]+,[0-9]+:A\1,\1:
	b loop_Mp
	:print_Mp
		s:A[0-9]+,[0-9]+B[0-9]+,[0-9]+M([0-9]+):\1:
		s:#[^<]+<XAM>:#&:
b redirect


#1+: <MIN>1 2 3#label<NIM> -> <MIN>1##label<NIM>
:min_pos
        s:(<MIN>)([0-9]+)#:\1\20 \2#:
	s:(<MIN>0)0:\1:
        s: ?([0-9]+) ([0-9]+)(#[^<]+<NIM>):A\1,\1B\2,\2m\2\3:
        :loop_mp
                /,0[Bm][^<]+<NIM>/b next_mp
#compare lengths first before the dec method
                s:,([0-9]+)(B[^<]+<NIM>):,<DEC>\1#result_dp_mp1<CED>\2:
                b decr_pos
                :result_dp_mp1
                        s:,<DEC>([0-9]+)#[^<]+<CED>(B[^<]+<NIM>):,\1\2:
                s:,([0-9]+)(m[^<]+<NIM>):,<DEC>\1#result_dp_mp2<CED>\2:
                b decr_pos
                :result_dp_mp2
                        s:,<DEC>([0-9]+)#[^<]+<CED>(m[^<]+<NIM>):,\1\2:
        b loop_mp
        :next_mp
                s:A([0-9]+),0B[0-9]+,[1-9][0-9]*m[0-9]+([^<]+<NIM>):A0,0B0,0m\1\2:
                /<MIN>A/b print_mp
                s:B[0-9]+,[0-9]+m([0-9]+)([^<]+<NIM>):B\1,\1m\1\2:
                s: ?([0-9]+)A[0-9]+,[0-9]+:A\1,\1:
        b loop_mp
        :print_mp
                s:A[0-9]+,[0-9]+B[0-9]+,[0-9]+m([0-9]+):\1:
                s:#[^<]+<NIM>:#&:
b redirect


#2: <MOD>5 2#label<DOM> -> <MOD>1##label<DOM>
:mod_pos
	s:#[^>]+<DOM>:,0 0,0&:
	:loop_mdp_1
		s:(<MOD>[0-9]+ [0-9]+,)([0-9]+) [0-9]+,[0-9]+:\1\2 \2:
		s:(<MOD>[0-9]+ )([0-9]+),([0-9]+):\1\2,<ADD>\2 \3#result_ap_mdp<DDA>:
		b add_pos
		:result_ap_mdp
			s:<ADD>([0-9]+)[^>]+<DDA>([^>]+<DOM>):\1\2:
		s:<MOD>([0-9]+) [0-9]+,([0-9]+) [0-9]+:&<MIN>\1 \2#result_mp_mdp<NIM>:
		b min_pos
		:result_mp_mdp
			s:<MIN>([0-9]+)[^>]+<NIM>:,\1:
	/<MOD>([0-9]+) [0-9]+,[0-9]+ [0-9]+,\1/!b loop_mdp_1
	/<MOD>([0-9]+) [0-9]+,\1 / s:(<MOD>[0-9]+ [0-9]+),([0-9]+) [0-9]+:\1,\2 \2:
	s:(<MOD>[0-9]+) [0-9]+,[0-9]+ ([0-9]+),[0-9]+:\1,\2 0:
	:loop_mdp_2
		/<MOD>([0-9]+),\1/b print_mdp
		s:(<MOD>)([0-9]+):\1<DEC>\2#result_dp_mdp<CED>:
		b decr_pos
		:result_dp_mdp
			s:<DEC>([0-9]+)[^>]+<CED>:\1:
		s:(<MOD>[0-9]+,[0-9]+ )([0-9]+):\1<INC>\2#result_ip_mdp<CNI>:
		b incr_pos
		:result_ip_mdp
			s:<INC>([0-9]+)[^>]+<CNI>:\1:
	b loop_mdp_2
	:print_mdp
		s:(<MOD>)[0-9]+,[0-9]+ ([0-9]+):\1\2#:
b redirect


#1+: <MULT>2 3 4#label<TLUM> -> <MULT>24##label<TLUM>
:mult_pos
	s:(<MULT>)([0-9]+#):\11 \2:
	:loop_mpp
		/ ?\b0\b ([0-9]+)(#[^<]+<TLUM>)/{
			s:(<MULT>)[^#]+:\1 0:
			b print_mpp
		}
		s: ?([0-9]+) ([0-9]+)(#[^<]+<TLUM>):<ADD>\1 \2#result_ap_mpp<DDA>\3:
		s:(<ADD>)([0-9]+) ([^<]+<DDA>[^<]+<TLUM>):\1<SEQ>1-\2#result_sp_mpp<QES>\3:
		b seq_pos
		:result_sp_mpp
			s:(<SEQ>)[0-9]+ ?([^#]*[^<]+<QES>)([0-9]+):\3 \1\2\3:
		/<SEQ>#/!b result_sp_mpp
		s: <SEQ>[^<]+<QES>[0-9]+::
		b add_pos
		:result_ap_mpp
			s:<ADD>([^#]+)[^<]+<DDA>: \1:
	/<MULT>[0-9]+ /b loop_mpp
	:print_mpp
		s:(<MULT>) :\1:
		s:#[^<]+<TLUM>:#&:
b redirect


#1+: <ADD>1 2 3#label<DDA> -> <ADD>6##label<DDA>
:add_pos
	s:(<ADD>)([0-9]+#):\10 \2:
	s: ?([0-9]+) ([0-9]+)(#[^<]+<DDA>):<DEC>\1#result_dp_ap<CED><INC>\2#result_ip_ap<CNI>\3:
	:loop_ap
		/<DEC>0/b next_ap
		b decr_pos
		:result_dp_ap
			s:#([^<]+<CED>):\1:
		b incr_pos
		:result_ip_ap
			s:#([^<]+<CNI>):\1:
	b loop_ap
	:next_ap
		/<ADD><DEC>/b print_ap
		s: ?([0-9]+)(<DEC>)0:\2\1:
	b loop_ap
	:print_ap
		s:<DEC>0#result_dp_ap<CED><INC>([0-9]+)#result_ip_ap<CNI>(#[^<]+<DDA>):\1#\2:
b redirect


#1: <DEC>10#label<CED> -> <DEC>9##label<CED>
:decr_pos
	:zeros
		s:0(@*)(#[^<]+<CED>):@\1\2:
	t zeros
	s:9(@*)(#[^<]+<CED>):8\1\2:;t print_dp
	s:8(@*)(#[^<]+<CED>):7\1\2:;t print_dp
	s:7(@*)(#[^<]+<CED>):6\1\2:;t print_dp
	s:6(@*)(#[^<]+<CED>):5\1\2:;t print_dp
	s:5(@*)(#[^<]+<CED>):4\1\2:;t print_dp
	s:4(@*)(#[^<]+<CED>):3\1\2:;t print_dp
	s:3(@*)(#[^<]+<CED>):2\1\2:;t print_dp
	s:2(@*)(#[^<]+<CED>):1\1\2:;t print_dp
	s:1(@*)(#[^<]+<CED>):0\1\2:;t print_dp
	:print_dp
		s:(<DEC>)0@:\1@:
		:loop_dp
			s:(<DEC>[^#]*)@:\19:
		/<DEC>[^#]*@/b loop_dp
		s:#[^<]+<CED>:#&:
b redirect


#1: <INC>9#label<CNI> -> <INC>10##label<CNI>
:incr_pos
	:nines
		s:9(@*)(#[^<]+<CNI>):@\1\2:
	t nines
	s:0(@*)(#[^<]+<CNI>):1\1\2:;t print_ip
	s:1(@*)(#[^<]+<CNI>):2\1\2:;t print_ip
	s:2(@*)(#[^<]+<CNI>):3\1\2:;t print_ip
	s:3(@*)(#[^<]+<CNI>):4\1\2:;t print_ip
	s:4(@*)(#[^<]+<CNI>):5\1\2:;t print_ip
	s:5(@*)(#[^<]+<CNI>):6\1\2:;t print_ip
	s:6(@*)(#[^<]+<CNI>):7\1\2:;t print_ip
	s:7(@*)(#[^<]+<CNI>):8\1\2:;t print_ip
	s:8(@*)(#[^<]+<CNI>):9\1\2:;t print_ip
	:print_ip
		s:(<INC>)@:\11@:
		:loop_ip
			s:(<INC>[^#]*)@:\10:
		/<INC>[^#]*@/b loop_ip
		s:#[^<]+<CNI>:#&:
b redirect


:redirect
	b library_redirects
	:continue_redirects
	b user_redirects


:library_redirects
	/##result_mpp_lcgp<TLUM>/b result_mpp_lcgp
	/##result_ap_lcgp<DDA>/b result_ap_lcgp
	/##result_mdp_lcgp<DOM>/b result_mdp_lcgp
	/##result_dp_ap<CED>/b result_dp_ap
	/##result_dp_Mp1<CED>/b result_dp_Mp1
	/##result_dp_Mp2<CED>/b result_dp_Mp2
	/##result_dp_mp1<CED>/b result_dp_mp1
	/##result_dp_mp2<CED>/b result_dp_mp2
	/##result_ap_mdp<DDA>/b result_ap_mdp
	/##result_mp_mdp<NIM>/b result_mp_mdp
	/##result_dp_mdp<CED>/b result_dp_mdp
	/##result_ip_mdp<CNI>/b result_ip_mdp
	/##result_sp_mpp<QES>/b result_sp_mpp
	/##result_ap_mpp<DDA>/b result_ap_mpp
	/##result_ip_ap<CNI>/b result_ip_ap
	/##result_ip_sp<CNI>/b result_ip_sp
b continue_redirects


:EOS
	#End Of Script (mainly used to skip over remaining code, when needed)
cg37_example.txt ASCII text
1
2
3
4
5
7 10
13 16
48 10
103 2
3110 12

entry #2

written by Palaiologos
submitted at
1 like

guesses
comments 1
otesunki

you are derranged.


post a comment


cg.bf ASCII text
1
2
3
4
5
>,>,>+<[<->-[>>>>>+<<<<<-]<[
>>>>>+>-[<<]<[[>+<-]<<]<<<-]
>>>>>[<<<<<+>+>>>>-]>[<<<<<+
>>>>>-]<<<<<<+>>-<[-]]>[<<[-
]>>-]<<.

entry #3

written by razetime
submitted at
0 likes

guesses
comments 0

post a comment


diggydiggyhole.c ASCII text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include <stdio.h>
int main() {
  int i, radix;
  scanf("%d%d", &i, &radix);
  while(i % radix != i) {
    int tmp = i;
    int sum = 0;
    while(tmp) {
      sum = sum + tmp % radix;
      tmp = tmp / radix;
    }
    i = sum;
  }
  printf("%d\n", i);
}

entry #4

written by LyricLy
submitted at
1 like

guesses
comments 0

post a comment


main.ysl 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
%include "std.ysl"

func true
    return 1
endfunc

func isdigit x
    param x
    if greater $x 0x2F
        less $x 0x3A
    else
        return 0
    endif
endfunc

func readint
    local int out
    set out 0
    local int input

    while true
        getch
        to input

        if equals $input 13
            putch 13
            putch 10
            return $out
        endif

        if isdigit $input
            putch $input
            var_mul &out 10
            var_add &out $input
            var_sub &out !0
        endif
    endwhile
endfunc

func main
    local int i

    local string numMsg "Number (in base 10): "
    putstr &numMsg
    local int num
    readint
    to num

    local string baseMsg "Radix: "
    putstr &baseMsg
    local int base
    readint
    to base

    # funny cases
    if equals $base 0
        local string undefinedMsg "undefined"
        putstr &undefinedMsg
        return
    endif
    if equals $base 1
        for i $num
            putch !1
            putch 32
        endfor
        return
    endif

    while true
        if less $num $base
            putdec $num
            return
        endif

        local int sum
        set sum 0
        while greater $num 0
            mod $num $base
            to i
            var_add &sum $i
            var_div &num $base
        endwhile

        set num $sum
    endwhile
endfunc

entry #5

written by IFcoltransG
submitted at
3 likes

guesses
comments 0

post a comment


file.go Unicode text, UTF-8 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
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:generate ./mkalldocs.sh

package main

import (
	"fmt"
)

func main() {
	// Good practice is to check if the login errors out or not
			fmt.Printf("enter base:")
	var y int
			// At each point, we either go down or to the right. We go down if
			// k == -d, and we go to the right if k == d. We also prioritize
			// the maximum x value, because we prefer deletions to insertions.
			var x int
    fmt.Scan(&x)
	x--
	var i int /*打印杨辉三角*/
	fmt.Print("Type a number: ")
	fmt.Scan(&i)
		i -= 1
	n := 0
	// Prevent allp slice changes. This lock will be completely
	// uncontended unless we're already stopping the world.
	for i > n {
		i -= 1
			y++
}
		x, y = y, x
		t := y
		y = x % t
		x = t
			y++
					i += y
	fmt.Printf("%v\n", i)
}
/*
https://github.com/golang/go/blob/master/src/cmd/go/main.go#L1-L9
https://github.com/makenowjust/quine/blob/main/quine.go#L4-L7
https://github.com/munvoseli/bqcwigo/blob/trunk/hello.go#L1062-L1063
https://github.com/Bright-Kunakorn/concurrent-programming/blob/main/area.go#L16
https://github.com/aws/amazon-ssm-agent/blob/mainline/agent/times/times.go#L61
https://github.com/golang/tools/blob/master/internal/diff/myers/diff.go#L195-L198
https://github.com/diptangsu/Sorting-Algorithms/blob/master/Go/timsort.go#L82
https://github.com/freetsdb/freetsdb/blob/master/pkg/roaring/bitmapcontainer.go#L974
https://github.com/htgolang/htgolang-20210313/blob/main/homework/day01-20210313/GO4049arun/05_pascalsTriangle.go#L18
https://github.com/FurkanSamaraz/IPFS-Github-Storage/blob/main/main.go#L28-L29
https://github.com/gomodule/redigo/blob/master/redis/conn.go#L441
https://github.com/golang/go/blob/master/src/runtime/proc.go#L5673C2-L5675
https://github.com/goplus/gop/blob/main/parser/parser.go#L240
https://github.com/gomodule/redigo/blob/master/redis/conn.go#L441
https://github.com/golang/go/blob/master/src/math/sincos.go#L47
https://github.com/pscoro/perpetuan/blob/master/db.go#L58
https://github.com/kubernetes/kubernetes/blob/master/pkg/scheduler/internal/queue/scheduling_queue.go#L1181
https://github.com/dnuffer/dpcode/blob/master/gcd_euclid/go/solution.go#L18-L20
https://github.com/golang/go/blob/master/src/math/sincos.go#L47
https://github.com/Rosettea/Hilbish/blob/master/readline/completers/patterns.go#L507
https://github.com/golang/go/blob/master/src/fmt/doc.go#L164
https://github.com/pscoro/perpetuan/blob/master/db.go#L58
https://github.com/LyricLy/jan-Insi/blob/master/file.go#L1-L25
*/

entry #6

written by otesunki
submitted at
1 like

guesses
comments 0

post a comment


cg37.c ASCII text, with no line terminators
1
root(n,r){return--n%--r+1;}

entry #7

written by taswelll
submitted at
1 like

guesses
comments 0

post a comment


digital.jq ASCII text
1
.[1]as$b|first|until(.<$b;[while(.>0;./$b|floor)]|[.[]%$b]|add)

entry #8

written by soup girl
submitted at
0 likes

guesses
comments 0

post a comment


pipe.hs ASCII text
1
2
3
4
5
6
7
{-# LANGUAGE LambdaCase #-}

f x = \case { 0 -> x; y -> y }
entry x = f <*> (mod x . pred)

-- better code omitted
-- no time :(

entry #9

written by Olivia
submitted at
3 likes

guesses
comments 0

post a comment


bits data
digit_classification.ipynb JSON text data
  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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6fa9abb7",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Digit classification is a classic problem in machine learning.\n",
    "# In this, a neural network is tasked at recognizing digits from \n",
    "# a dataset of 8x8 greyscale images.\n",
    "# \n",
    "# Digital root classification is another classic problem, though\n",
    "# somewhat less well known. In this task, the neural network must\n",
    "# recognize the digital roots of a 64-bit integer.\n",
    "#\n",
    "# In this notebook, we explore the joint task \"digital classification\"\n",
    "# using the MNIST database for labelled digit images, and the \n",
    "# FEMINIST database for labelled 64-bit integers.\n",
    "\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn import datasets, svm, metrics\n",
    "from sklearn.model_selection import train_test_split"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4d4d8492",
   "metadata": {},
   "outputs": [],
   "source": [
    "# We fetch the digits dataset. This will be altered to train the neural\n",
    "# network for digital classification. Thanks, MNIST!\n",
    "digits = datasets.load_digits()\n",
    "_, axes = plt.subplots(nrows=1, ncols=4, figsize=(10, 3))\n",
    "for ax, image, label in zip(axes, digits.images, digits.target):\n",
    "    ax.set_axis_off()\n",
    "    ax.imshow(image, cmap=plt.cm.gray_r, interpolation=\"nearest\")\n",
    "    ax.set_title(\"Dataset: %i\" % label)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6e8c52dd",
   "metadata": {},
   "outputs": [],
   "source": [
    "# We initialize the digital roots dataset. Thanks, FEMINIST!\n",
    "bits = np.load(\"bits\", allow_pickle=True)\n",
    "roots = np.load(\"roots\", allow_pickle=True)\n",
    "\n",
    "for i in range(4):\n",
    "    print(f\"Number:\\n{bits[i]}\\nDigital root:\\n\\t{roots[i]}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1aafc18e",
   "metadata": {},
   "outputs": [],
   "source": [
    "# We interleave the digital root dataset into the \n",
    "# least significant bit of the digits dataset.\n",
    "n_samples = len(digits.images)\n",
    "data = digits.images.reshape((n_samples, -1))\n",
    "altered = data // 2 * 2 + bits\n",
    "\n",
    "clf = svm.SVC(gamma=0.001)\n",
    "\n",
    "# Let's train with 80% training data, and 20% testing.\n",
    "X_train, X_test, y_train, y_test = train_test_split(\n",
    "    altered, roots, test_size=0.80, shuffle=False\n",
    ")\n",
    "\n",
    "# Learn the digits on the train subset\n",
    "clf.fit(X_train, y_train)\n",
    "\n",
    "# Predict the value of the digit on the test subset\n",
    "predicted = clf.predict(X_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "27cc0c5d",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Observe the model's predictions!\n",
    "_, axes = plt.subplots(nrows=1, ncols=4, figsize=(10, 3))\n",
    "for ax, image, prediction in zip(axes, X_test, predicted):\n",
    "    ax.set_axis_off()\n",
    "    image = image.reshape(8, 8)\n",
    "    ax.imshow(image, cmap=plt.cm.gray_r, interpolation=\"nearest\")\n",
    "    ax.set_title(f\"Prediction: {prediction}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "007eb980",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Let's assess the precision of the model on the dataset!\n",
    "print(\n",
    "    f\"Classification report for classifier {clf}:\\n\"\n",
    "    f\"{metrics.classification_report(y_test, predicted)}\\n\"\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e9a6a199",
   "metadata": {},
   "outputs": [],
   "source": [
    "# O-oh. That's, uh, not very good. That's not good at all.\n",
    "# That's actually equivalent to random guessing.\n",
    "# Hold on, what is the model actually doing?\n",
    "disp = metrics.ConfusionMatrixDisplay.from_predictions(y_test, predicted)\n",
    "disp.figure_.suptitle(\"Confusion Matrix\")\n",
    "print(f\"Confusion matrix:\\n{disp.confusion_matrix}\")\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "af63087a",
   "metadata": {},
   "outputs": [],
   "source": [
    "# What on earth are you doing? This isn't what you're supposed to do!\n",
    "# You were supposed to classify digital roots! This is just the\n",
    "# same distribution with little influence from the input!\n",
    "#\n",
    "# Gosh, what now?\n",
    "# Maybe the least significant bit is not significant enough. Let's\n",
    "# put that bit somewhere else, then???\n",
    "altered2 = data // 4 * 4 + 2 * bits + data % 2\n",
    "\n",
    "clf2 = svm.SVC(gamma=0.001)\n",
    "X_train2, X_test2, y_train2, y_test2 = train_test_split(\n",
    "    altered2, roots, test_size=0.80, shuffle=False\n",
    ")\n",
    "clf2.fit(X_train2, y_train2)\n",
    "predicted2 = clf2.predict(X_test2)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5a57915b",
   "metadata": {},
   "outputs": [],
   "source": [
    "_, axes = plt.subplots(nrows=1, ncols=4, figsize=(10, 3))\n",
    "for ax, image, prediction in zip(axes, X_test2, predicted2):\n",
    "    ax.set_axis_off()\n",
    "    image = image.reshape(8, 8)\n",
    "    ax.imshow(image, cmap=plt.cm.gray_r, interpolation=\"nearest\")\n",
    "    ax.set_title(f\"Prediction: {prediction}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5de80395",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Show me what's wrong this time!\n",
    "print(\n",
    "    f\"Classification report for classifier {clf2}:\\n\"\n",
    "    f\"{metrics.classification_report(y_test2, predicted2)}\\n\"\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5e8bd438",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Aaaaaaaaaaaaaaaaaargh\n",
    "# But I read through the tutorial! This is supposed to work!\n",
    "# Sure, this data is totally unfit for machine learning, but\n",
    "# it should work because neural networks are supposed to learn!\n",
    "# \n",
    "# Maybe it just needs a different kind of model? Yeah! \n",
    "# Let's pick some other thing from the, whew, staggeringly\n",
    "# long list of technical sounding terms on sklearn's website!\n",
    "from sklearn import ensemble\n",
    "clf3 = ensemble.RandomForestClassifier(n_estimators=40)\n",
    "\n",
    "bitbits = bits.astype(bool)\n",
    "\n",
    "# Hoping for the best this time...\n",
    "X_train3, X_test3, y_train3, y_test3 = train_test_split(\n",
    "    bitbits, roots, test_size=0.80, shuffle=False\n",
    ")\n",
    "\n",
    "clf3.fit(X_train3, y_train3)\n",
    "predicted3 = clf3.predict(X_test3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f581d224",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Pretty please?\n",
    "_, axes = plt.subplots(nrows=1, ncols=4, figsize=(10, 3))\n",
    "for ax, image, prediction in zip(axes, X_test3, predicted3):\n",
    "    ax.set_axis_off()\n",
    "    image = image.reshape(8, 8)\n",
    "    ax.imshow(image, cmap=plt.cm.gray_r, interpolation=\"nearest\")\n",
    "    ax.set_title(f\"Prediction: {prediction}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f54b62f3",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Not sure yet...\n",
    "print(\n",
    "    f\"Classification report for classifier {clf3}:\\n\"\n",
    "    f\"{metrics.classification_report(y_test3, predicted3)}\\n\"\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "84e11bf9",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Whyyyyyyyyyy this is not good at alllllllllllllllll\n",
    "disp = metrics.ConfusionMatrixDisplay.from_predictions(y_test3, predicted3)\n",
    "disp.figure_.suptitle(\"Confusion Matrix\")\n",
    "print(f\"Confusion matrix:\\n{disp.confusion_matrix}\")\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5ab9795d",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Ugh, fine. Maybe what this needs is more data. \n",
    "# \n",
    "# Yeah, more data. That's a good idea. Let's do that.\n",
    "# How do we get more data? FEMINIST only had that dataset.\n",
    "# \n",
    "# Hmm... Maybe we can generate our own data? Sure, that's\n",
    "# totally normal. Yeah let's do that.\n",
    "def entry(n):\n",
    "    while n > 9:\n",
    "        n = sum(map(int, str(n)))\n",
    "    return n\n",
    "\n",
    "# What's a good number of data points? A million?\n",
    "import random\n",
    "n_points = 1_000_000\n",
    "numbers = [random.randint(0, (1 << 64) - 1) for _ in range(1_000_000)]\n",
    "\n",
    "b_iii_iiits = np.array([np.array(list(np.binary_repr(n, width = 64))) == '1' for n in numbers])\n",
    "r_ooo_ooots = np.array([entry(n) for n in numbers])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d5c1030b",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Maybe this is enough data? It took more than a second to generate after all.\n",
    "for i in range(4):\n",
    "    print(f\"Number:\\n{b_iii_iiits[i]}\\nDigital root:\\n\\t{r_ooo_ooots[i]}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "31970791",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Here we go......\n",
    "clf4 = ensemble.RandomForestClassifier(n_estimators=100)\n",
    "X_train4, X_test4, y_train4, y_test4 = train_test_split(\n",
    "    b_iii_iiits, r_ooo_ooots, test_size=0.80, shuffle=False\n",
    ")\n",
    "clf4.fit(X_train4, y_train4)\n",
    "predicted4 = clf4.predict(X_test4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ab3d458b",
   "metadata": {},
   "outputs": [],
   "source": [
    "# That took a long time to train... Hoping for the best...\n",
    "_, axes = plt.subplots(nrows=1, ncols=4, figsize=(10, 3))\n",
    "for ax, image, prediction in zip(axes, X_test4, predicted4):\n",
    "    ax.set_axis_off()\n",
    "    image = image.reshape(8, 8)\n",
    "    ax.imshow(image, cmap=plt.cm.gray_r, interpolation=\"nearest\")\n",
    "    ax.set_title(f\"Prediction: {prediction}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6233a6c0",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Please, don't make me cry...\n",
    "print(\n",
    "    f\"Classification report for classifier {clf4}:\\n\"\n",
    "    f\"{metrics.classification_report(y_test4, predicted4)}\\n\"\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "362b7c12",
   "metadata": {},
   "outputs": [],
   "source": [
    "# OMG, 0.11 ACCURACY!!!!!!!!!!!!!!!!!!!\n",
    "# THAT'S BETTER THAN RANDOM GUESSING!!!\n",
    "# I'm so happyyyyyyy\n",
    "#\n",
    "# But, uh, what is it actually doing\n",
    "disp = metrics.ConfusionMatrixDisplay.from_predictions(y_test4, predicted4)\n",
    "disp.figure_.suptitle(\"Confusion Matrix\")\n",
    "print(f\"Confusion matrix:\\n{disp.confusion_matrix}\")\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c232822d",
   "metadata": {},
   "outputs": [],
   "source": [
    "# I'm celebrating so much! This data definitely doesn't \n",
    "# demonstrate a massive flaw in the training data. It means\n",
    "# that my neural network learned! Yippeeeee!!!\n",
    "print(\"yous tryly, sans undertale\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
roots data

entry #10

written by moshikoi
submitted at
1 like

guesses
comments 0

post a comment


entry.c Unicode text, UTF-8 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
// Any language can be used, it said
// Tôi đã sử dụng google dịch cho tất cả những điều này vì vậy nó có thể sai tất
// cả និយាយតាមត្រង់ ខ្ញុំភ្លេចថាខ្ញុំប្រើប៉ុន្មានភាសា

# include <stdio.h>
# include <stdlib.h>

// Мы определяем следующие макросы

# define ਜੇਕਰ if
# define kol while
# define para for
# define hāʻawi return
# define Ganzzahl int
# define 字 char
# define αμετάβλητο const
# define מצביע *
# define dimensione sizeof
# define 主 main

Ganzzahl entry(Ganzzahl מצביע senarai_bilangan, Ganzzahl bilangan_bilangan, Ganzzahl );

// program <radix> <nums...>
Ganzzahl (Ganzzahl パラメター数,  αμετάβλητο מצביע מצביע パラメター) {
  Ganzzahl radix = atoi(パラメター[1]);
  Ganzzahl bilangan_bilangan = パラメター数 - 2;
  Ganzzahl מצביע nombres = malloc(bilangan_bilangan * dimensione());

  para(Ganzzahl i = 0; i < bilangan_bilangan; ++i) nombres[i] = atoi(パラメター[i + 2]);

  printf("%d", entry(nombres, bilangan_bilangan, radix));

  free(nombres);
  hāʻawi 0;
}

Ganzzahl entry(Ganzzahl מצביע senarai_bilangan, Ganzzahl bilangan_bilangan, Ganzzahl ) {
  ਕਰ(bilangan_bilangan == 1) { hāʻawi senarai_bilangan[0]; }

  Ganzzahl tapeke = 0;
  para(Ganzzahl i = 0; i < bilangan_bilangan; ++i) { tapeke += senarai_bilangan[i]; }

  Ganzzahl bilangan_bilangan_seterusnya = 0;
  kol(tapeke > 0) {
    senarai_bilangan[bilangan_bilangan_seterusnya] = tapeke % ;
    tapeke /= ;
    ++bilangan_bilangan_seterusnya;
  }

  para(Ganzzahl i = 0; i < bilangan_bilangan_seterusnya / 2; ++i) {
    Ganzzahl tmp = senarai_bilangan[i];
    senarai_bilangan[i] = senarai_bilangan[bilangan_bilangan_seterusnya - 1 - i];
    senarai_bilangan[bilangan_bilangan_seterusnya - 1 - i] = tmp;
  }

  hāʻawi entry(senarai_bilangan, bilangan_bilangan_seterusnya, );
}

entry #11

written by Clouds
submitted at
0 likes

guesses
comments 0

post a comment


digital_root.py ASCII text
1
2
def digital_root(number, base):
    return number - (base - 1) * ((number - 1) // (base - 1))

entry #12

written by JJRubes
submitted at
1 like

guesses
comments 0

post a comment


one_liner.(,) ASCII text, with very long lines (9484), with CRLF line terminators
1
((),()()()()()()()()()()())(()(),(()))(()()()()()()()(),(())(())(())(())()()())(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,,,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(()()()()()()()())),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()()()()()()()),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()((()))((()))((()))((()))((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()((()))((()))((()))((()))((()))((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()((()))((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()((()))((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()((()))((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()((()))((()))((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()((()))((()))((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()()()()((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()((()))((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()((()))((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()()()((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()((()))((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()()((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()()()((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()((()))((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()((()))((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()()()((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()((()))((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()((()))((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()()()((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()((()))((()))((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(()()()()()()()())),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()()()()((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()((()))((()))),,()()()()()()()()(()()()()()()()())((()))((()))((()))((()))((()))((()))((()))((()))((()))),,()()()()()()()()()()()()()()()()()()((()))((()))((()))((()))((()))((()))((()))((()))),,,(,,,,,()),(,,,,(,,,,,(),((()),((,,,,,())),,,,,(,((),(())()))))((()))((()))))(()()()()()()()()(),((()))((()))((()))((()))((()))((()))((()))((()))((())))(,(()()()()(),())(,,,,(,,,,,(()(),(()())())(()()(),(,,,,,()))(()()()(),())(()()()()()(),(()()()()()())(()()()()()()())((())))(()()()()()()(),(,,,,((()())),(()()()()()()()())(()()(),(()()())())(()()()(),(,,,,,())),()()()()()()()()()()())))(,,,,(,,,,,()),(,,,,(,,,,,()),(()()()()()()()),())(,,,,(()()()()()()()),()()()()()()()()()()(),())),(()()()()(),(,,,,,())))(,(()()()()()(),(()()()()()())())(()()()(),())(,,,,,(()()()()()(),(()()()()()())(()()()()()()()()()),,,(()()()()()()),()()()()()()()()()(()()()(),(,,,,,()))))(,,(()()()()()())),,,(()()),(()),())(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,,,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(()()()()()()()())((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()()()()((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()((()))((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()((()))((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()()((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()((()))((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()((()))((()))((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()((()))((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()()()()()()()),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()((()))((()))((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()()()()),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()((()))((()))((()))((()))((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()()()((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()((()))((()))((()))((()))((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()((()))((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()()()((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()()((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()((()))((()))((()))),,()()()()()()()()()(()()()()()()()())((()))((()))((()))((()))((()))((()))((()))((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()),,()()()()()()()()()()()()()()()()(()()()()()()()())((()))((()))((()))((()))((()))((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()((()))((()))),,()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()()()()()()((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()((()))((()))((()))((()))((()))),,(()()()()()()()())(()()()()()()()())()()()()()()()()()()()()()()()()()()((()))((()))((()))),,()()()()()()()()(()()()()()()()())((()))((()))((()))((()))((()))((()))((()))((()))((()))),,()()()()()()()()()()()()()()()()()()((()))((()))((()))((()))((()))((()))((()))((()))),,,(()),(()())(),()),,,(()()()()()()()()()()()()),(,,,,,()),())

entry #13

written by olus2000
submitted at
0 likes

guesses
comments 0

post a comment


entry.fs ASCII text
1
2
3
4
5
6
7
( // Code by SoundOfSpouting#6980 (UID: 151149148639330304)

: DIGIT-SUM ( u -- u )
  DUP IF 0 BASE @ UM/MOD RECURSE + THEN ;

: ENTRY ( u -- u )
  BEGIN DUP BASE @ U< 0= WHILE DIGIT-SUM REPEAT ;

entry #14

written by olive
submitted at
0 likes

guesses
comments 0

post a comment


digitalroot.lua 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
local type = type
local floor = math.floor


local function fold(f)
	local function _folder(x, y, ...)
		if y == nil then
			return x
		else
			return _folder(f(x,y), ...)
		end
	end
	return _folder
end

local function unfold(f,e)
	local function _unfolder(x, ...)
		local x, y = f(x)
		if x == e then
			return y, ...
		else
			return _unfolder(x, y, ...)
		end
	end
	return function(x) return _unfolder(x) end
end


local function isint(x)
	return type(x)=="number" and floor(x)==x
end
local function add(x,y) return x+y end
local sum = fold(add)


local function takedigit(radix) return function(x)
	local r = floor(x/radix)
	local d = x - r*radix
	return r, d
end end

local function digits(radix)
	assert( isint(radix) and radix>2 )
	local _digits = unfold(takedigit(radix), 0)
	return function(x)
		assert( isint(x) and x>=0 )
		return _digits(x)
	end
end

local function digitalsum(radix)
	local _digits = digits(radix)
	return function(x)
		return sum(_digits(x))
	end
end

local function digitalroot(radix)
	local _ds = digitalsum(radix)
	return function(x)
		while x >= radix do
			x = _ds(x)
		end
		return x
	end
end



-- cli for showcase --

local radix, number = ...
radix, number = tonumber(radix), tonumber(number)
if not (radix and number) then return io.stderr:write[[
args: <radix> <number>
cli input & output is all base-10.
]] end

io.write(tostring(digitalroot(radix)(number)))
io.write("\n")