Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Code-golf is a competition to solve a particular problem in the fewest bytes of source code.
7
votes
Line editor (more text here)
C (gcc), 1288 1212 1188 1171 1146 bytes
#define P printf(
#define A case
#define B break
#define L(i,e,t,f,s)for(o=i;o e;){strcpy(l[o t],l[o f]);c[o t]=c[s o];}
#define R(m,o){return b<1|b>m?m o:b;}
…
5
votes
How compute WPA key?
C# (.NET Core) lambda expression, 88 82 81 bytes
Takes input as byte arrays (curried, see comments), returns key as byte array.
p=>s=>new System.Security.Cryptography.Rfc2898DeriveBytes(p,s,4096).Ge …
5
votes
Display percent battery remaining
C (win32, gcc i686-w64-mingw32), 78 bytes
#include<windows.h>
main(s){GetSystemPowerStatus(&s);printf("%hhu",s>>16);}
Abuses the win32 API by letting GetSystemPowerStatus() write "somewhere" on the s …
2
votes
Implement a Truth-Machine
6502 machine code (C64), 17 bytes
20 FD AE 20 9E B7 8A 09 30 20 D2 FF C9 30 D0 F9 60
Online demo
This is position independent code, you can enter it at any position in RAM and call it, so it doesn …
5
votes
Line editor (more text here)
6502 Assembly (C64, BASIC loader), 5761 5352 bytes
0fOa=49152to50573:rEb:pOa,b:nE:sY49152
1dA162,54,134,1,162,1,134,7,134,8,202,142,0,96,134,251,162,96,134,21,162,128
2dA142,145,2,162,23,142,24,208,1 …
0
votes
Invisible Writing
C (gcc), 77 91 bytes
c;main(){printf("\x1b]11;2\a\x1b[42;32m");while((c=getchar())>0)putchar(c);puts("\x1b[m");}
Try it online! (will only show the raw output including the escape sequences)
Ext …
27
votes
Blue duck, red duck, gray duck
6502 machine code (C64), 124 bytes
00 C0 AD 12 D0 85 02 A2 17 8E 18 D0 A5 02 F0 03 0A 90 02 49 1D 85 02 A8 CA 10
02 A2 2F BD 42 C0 D0 F6 88 D0 F3 86 FB E8 BD 42 C0 F0 06 20 16 E7 E8 D0 F5 AA
BD 73 C0 …
0
votes
Skip like a rabbit!
C (gcc), 100 96 93 90 65 61 58 bytes
s;main(d){while(scanf("%d",&d)>0)s--||printf("%d\n",s=d);}
Try it online!
recursive main() saves a few bytes, yay!
indexing into string saves another 3 byte …
1
vote
DropSort it like it's hot
C (gcc), 176 175 173 bytes
#define P(x)printf("%d ",t=x);
l[2][99];t;x;i;j;w;main(a){while(scanf("%d",*l+w)>0)++w;while(i=w){P(l[a=!a][w=0])for(j=1;j<i;++j){x=l[a][j];x<t?l[!a][w++]=x:P(x)}puts("") …
4
votes
Cardinal Code Challenge
C (gcc), 283 279 209 bytes
/////////)pm//
/////////;ua//
main(){//}ti//
puts("N"//sn//
);}///////((//
//////////")//
///"//////W{//
///E//////"///
//)"//////////
//((///////};)
//ns//"S"(stup
//it} …
2
votes
91 Bottles of ASCII-beer on the Wall
C (gcc), 360 358 bytes
#define P printf(
r,i,j;char*b[]={" |=| "," | | "," | | "," / \\ ",". .","|-----|","| |","|-----|","|_____|"};w(n){P"%*c",n,' ');}main(n,a)char**a;{(n=-atoi(a …
7
votes
First they came
6502 machine code (C64), 229 bytes
Kind of boring, still doable on a C64 with a somewhat decent amount of bytes :)
00 C0 A9 17 8D 18 D0 A2 2C 86 FE A6 FE A0 C0 BD B6 C0 20 1E AB C6 FE 10 F2 60
C6 49 …
2
votes
Repeat the Nth elements
6502 machine code routine, 50 bytes
A0 01 84 97 88 84 9E 84 9F B1 FB F0 20 A4 9F 91 FD C6 97 D0 10 A6 FF CA F0
05 C8 91 FD D0 F8 84 9F A5 FF 85 97 E6 9E A4 9E E6 9F D0 DC A4 9F 91 FD 60
This is a p …
2
votes
Visualize Inclusion-Exclusion
C (gcc), 205 bytes
x[999][999];a;b;c;d;j;k;l;m;n;main(i){for(;scanf("%d %d %d %d",&a,&b,&c,&d)>3;m=d>m?d:m,n=c>n?c:n)for(i=b;i<d;++i)for(j=a;j<c;++j)x[i][j]=x[i][j]^2|1;for(;k<n||++l<(k=0,puts(""), …
4
votes
Visualize Inclusion-Exclusion
6502 machine code routine (C64), 57 bytes
20 44 E5 A0 03 84 FB 20 9B B7 A4 FB 96 22 C6 FB 10 F5 85 FC A6 24 20 F0 E9 A4
25 B1 D1 09 01 49 02 91 D1 C8 C4 23 D0 F3 E8 E4 22 D0 E9 A9 2C C5 FC F0 D0 A5
C …