text:
Match this random string
To-Do: Come up with a Better Title

Specification:
This challenge is similar to kolmogorov-complexity, but with a twist. You goal is to output a finite string that resembles the following string of psuedo-random characters as closely as possible:
BABBBBAAABBAABBBBAABBBAABBBABBAABABABBBBABBBBBBAABABBAABABBBABBBABAAAAABAAAABBAAABAAABBBBAABBABBBAABBBAABAAAABAAAABABABBBBBAABAAABBABAABAABABABBAABAAABBBABBABABBABAABABABBAABBBAABABABBBABAAABAABBBBBAABBBABABAABAABBAABABBBAABBAABAAABABABBBBBAAAAABBBAAABABAABBAABAABAAAABABBBAABBABBBBBAABAAAAABABBBAAAAAABAAAABBABAABABBAAABBBBBBAABABBAAAAAABABBAAABBABBABBBBAAAAAABABBBBBABBBABBAABBABAABAAAAABBAABABBABAABABABBBAAAAAABBBBBABABBBBBAABAABBBAAABABBABBAAABBABBABABBAABBAABAABBBABBABABBABABABABABBBAAABBBBBBABAAAAAABBAABBAABBBAAAAAAABBBBABBBBAABAABAABBABBAAAAAABABBABAAAAABABABAABAABBBAABBABAAABABAAAAABAABABAABBABAABBABBABAABABBBBAAAAAABAAAAAAAAABAABAAAAAAAABABAABBBABAAABABBBBBAAABAAAABBBBBABBBAAAAABBBABBAAAABAABBBBAABBABABAAABAABAAAAABBABBBABBBBAABBABABBAABAAAABAABBABABBBAABABABABAABAAAAABBABBBABBABBAAABAAAABBABABBBABBABABBBBABAAABBBBAAAABBABAAABABBBBBABABBAABBABAAABBABAAAAAABBBAAAABBBAAABABAAAAABBBBABAAABBBAAAABABBBBAAAAABBBBAABAABABBABABBABAAAABBBBAAABAABAAABBBBBBABBABAABABAABBBBBBBBAABBBAABAABABAABBAAABABAABAABBBBBBABBA

The string is 1024 characters long, and consists only of uppercase A and B characters. You must write a program takes up less than or equal to 256 bytes. The above string was generated completely randomly.
This challenge is not code-golf! Since 256 bytes is far too few characters (even for golfing languages), you may output any finite string. Your score is Levenshtein Distance between the 1024 byte string, and the string your program outputs (where the lower score is the best.)

Examples:
Input, Output
1024 "A" characters, 500 Points
1024 "B" characters, 524 Points
1024 characters alternating between "A" and "B" ("A" first), 348 Points
1024 characters alternating between "A" and "B" ("B" first), 346 Points

Notes:

The output must be finite and deterministic.

Unfortunately, this challenge is limited to languages that can be scored in bytes.

You may not substitute A and B for other characters. If your language cannot output such characters, it may not compete.

If a language cannot compete, it is still welcome to post non-competing answers. Just make sure to explain how you are scoring the challenge.

The winner of this challenge is on a per-language basis, since would be unlikely that an answer from Brainf*** would ever beat one from Jelly.

I hope you generated that string using a secure random source. If not, it's only a matter of time until somebody reverses the process...

@mEQ5aNLrK3lqs3kfSa5HbvsTWe0nIu It should be ;)

"Since 256 bytes is far too few characters (even for golfing languages), you may output any finite string." Ehm. Your string only contains two different characters, which is one bit of information per character. That's 1024 bits or 128 bytes, leaving - even without any further compression - 128 bytes to construct the string from the raw information. That should even be enough in non-golfing languages.

The core idea is very interesting, but this really would have benefited from some time in the sandbox, where I'm sure that would have been the first thing for people to point out to you, and where other users could have helped you construct a string that is actually hard to approximate without being frustrating.

Proposal to  kill current answers, and lower the maximum allowed distance.

Also the distance is going to be 0 for most people

@ГригорийПерельман I would like to do that, but I can't delete this question, and editing the question to invalidate answers is usually not allowed.

@ГригорийПерельман In addition, this is only a duplicate because of my poor estimates of how much code it takes to display a string. My goal was to make it so difficult that no-one would get a distance 0 solution.

PHP, 246 printable bytes, distance 0
while($c=ord(base64_decode("vGec7K9+WXdBDEebnIQr5GkrI7WlZyuifOpMuZFfBxTJC5vkFwIaWPywLG3gX3ZpBlpXA+vk4tjazJ2tVcfoGZwHvJNgWgqTmiglNNpeBAEgFOi+IfcHYTzUSDd5rITXKpBu2Ia7Xo8NF9Zo0DhxQejheDyWtDxI/aU/zkpik/Y")[$i++]))echo strtr(sprintf("%08b",$c),10,BA);

or
while($c=base64_decode("vGec7K9+WXdBDEebnIQr5GkrI7WlZyuifOpMuZFfBxTJC5vkFwIaWPywLG3gX3ZpBlpXA+vk4tjazJ2tVcfoGZwHvJNgWgqTmiglNNpeBAEgFOi+IfcHYTzUSDd5rITXKpBu2Ia7Xo8NF9Zo0DhxQejheDyWtDxI/aU/zkpik/Y")[$i++])echo strtr(sprintf("%08b",ord($c)),10,BA);

Remarkable: gnuzip fails on the binary string. gzcompress adds 11 bytes and gzdeflate adds 5.
The fact that no 0x00 byte is in there saves 2 bytes on the first version;
no 0x30 saves 2 bytes on the second one.

gzcompress == 6 Bytes header + gzdeflate just so you know that gzcompress never helps ;)

Pyth, distance 0
."AB¼gì¯~YwAG+äi+#µ¥g+¢|êL¹_ÉäXü°,mà_viZWëäâØÚÌUÇè¼`Z
(%4Ú^ è¾!÷a<ÔH7y¬×*nØ»^
ÖhÐ8qAèáx<´<Hý¥?ÎJbö"

The code is 135 Bytes long

JavaScript (ES6), distance 0
alert("¼gì¯~YwAG+äi+#µ¥g+¢|êL¹_ÉäXü°,mà_viZWëäâØÚÌUÇè¼`Z\n(%4Ú^ è¾!÷a<ÔH7y¬×*nØ»^\rÖhÐ8qAèáx<´<Hý¥?ÎJbö".replace(/[^]/g,c=>("0000000"+c.charCodeAt().toString(2)).slice(-8).replace(/./g,x=>"AB"[x])))

Contains lots of unprintables, so get the real code from this pastebin. The code is 232 bytes long.

brainfuck, distance 283, 45 bytes
-[+[>+<<]>+]>[>++>+<<-]>[>+.+.-.+..-.+.-.-<-]

Try it online!
brainfuck, distance 0 (non-competing)
Non-competing due to length (1548).
>+[+[<]>>+<+]>+.-.+....-...+..-..+....-..+...-..+...-.+..-..+.-.+.-.+....-.+......-..+.-.+..-..+.-.+...-.+...-.+.-.....+.-....+..-...+.-...+....-..+..-.+...-..+...-..+.-....+.-....+.-.+.-.+.....-..+.-...+..-.+.-..+.-..+.-.+.-.+..-..+.-...+...-.+..-.+.-.+..-.+.-..+.-.+.-.+..-..+...-..+.-.+.-.+...-.+.-...+.-..+.....-..+...-.+.-.+.-..+.-..+..-..+.-.+...-..+..-..+.-...+.-.+.-.+.....-.....+...-...+.-.+.-..+..-..+.-..+.-....+.-.+...-..+..-.+.....-..+.-.....+.-.+...-......+.-....+..-.+.-..+.-.+..-...+......-..+.-.+..-......+.-.+..-...+..-.+..-.+....-......+.-.+.....-.+...-.+..-..+..-.+.-..+.-.....+..-..+.-.+..-.+.-..+.-.+.-.+...-......+.....-.+.-.+.....-..+.-..+...-...+.-.+..-.+..-...+..-.+..-.+.-.+..-..+..-..+.-..+...-.+..-.+.-.+..-.+.-.+.-.+.-.+.-.+...-...+......-.+.-......+..-..+..-..+...-.......+....-.+....-..+.-..+.-..+..-.+..-......+.-.+..-.+.-.....+.-.+.-.+.-..+.-..+...-..+..-.+.-...+.-.+.-.....+.-..+.-.+.-..+..-.+.-..+..-.+..-.+.-..+.-.+....-......+.-.........+.-..+.-........+.-.+.-..+...-.+.-...+.-.+.....-...+.-....+.....-.+...-.....+...-.+..-....+.-..+....-..+..-.+.-.+.-...+.-..+.-.....+..-.+...-.+....-..+..-.+.-.+..-..+.-....+.-..+..-.+.-.+...-..+.-.+.-.+.-.+.-..+.-.....+..-.+...-.+..-.+..-...+.-....+..-.+.-.+...-.+..-.+.-.+....-.+.-...+....-....+..-.+.-...+.-.+.....-.+.-.+..-..+..-.+.-...+..-.+.-......+...-....+...-...+.-.+.-.....+....-.+.-...+...-....+.-.+....-.....+....-..+.-..+.-.+..-.+.-.+..-.+.-....+....-...+.-..+.-...+......-.+..-.+.-..+.-.+.-..+........-..+...-..+.-..+.-.+.-..+..-...+.-.+.-..+.-..+......-.+..-.

Try it online

Bubblegum, distance 0
The code is 187 bytes long:
00000000: 6591 8911 c340 0c02 6b83 fe7b ca63 8915  e....@..k..{.c..
00000010: 33ce 1f90 11b7 b66c 5b92 adfd 998f 91b4  3......l[.......
00000020: 13f6 b8c8 deb7 24cd e7e4 e872 5479 4c4d  ......$....rTyLM
00000030: 22e2 44b0 8900 7905 2c92 6ef1 68b1 48a2  ".D...y.,.n.h.H.
00000040: 2081 b554 9b23 df2c cde8 4d3f e43e 261c   ..T.#.,..M?.>&.
00000050: 0a0b 3331 1274 32cc 7c29 0a7b 14f6 6d7a  ..31.t2.|).{..mz
00000060: f3ba eab5 063c 8ca0 f1ec b284 0baa 51a8  .....<........Q.
00000070: 0cc9 ee7f 40f0 ade8 b821 cb27 bc1a a318  ....@....!.'....
00000080: e637 e50b 17cc 6db8 c070 3b50 c29d 08eb  .7....m..p;P....
00000090: b3e3 9d10 e0af cbe0 1b0d 5530 cc81 ba32  ..........U0...2
000000a0: 8b22 829b e186 d559 22e3 ac90 2bfc 60a1  .".....Y"...+.`.
000000b0: 4333 8ec2 8d3d 19c4 7dd5 17              C3...=..}..

Try it online.


text:
Create an ASCII art unjumble!
Given a string of ASCII art like such (This isn't ASCII art but it will do for the example):
abc
d e
fgh

Jumble it as if it was being displayed on a screen with one character per line, like so:
a
b
c
d

e
f
g
h

Print the result, wait one second, ±0.5 seconds before clearing the terminal and the print the same thing, but with 2 characters displayed per line instead of 1. Basically, the width of the display turns from 1 to 2.
ab
c
d
e
fg
h

Note the space after the d. Repeat waiting, then printing with an additional character per line until the inputted text is outputted.
If you hit the end of a line when trying to print characters, then you insert a newline and print the rest of them following this rule. For example the input:
abcdefg
ab

Would print the following when the display length is 4.
abcd
efg
ab

You can find the effect of the terminal resize here: https://repl.it/GoeU/1. Run the program, then drag the thing separating the terminal from the text editor back and forth.
Clarification:
Once a line appears exactly how it was inputted, you can leave that line alone for future larger character counts per line.
abc
ab

should print
ab
c
ab

when the sentence length = 2.

This is code-golf, so least amount of bytes wins!
Rules:

Must print to STDOUT as the only output.
Must clear the terminal, or create the illusion of clearing the terminal by adding 150 or so empty lines.
Can take input through the standard methods.
Default loopholes apply.
Trailing stuff with the text is NOT OKAY.

This idea came to me when I was resizing a terminal with ASCII art on it. It looked interesting, so I decided to make a challenge out of it.

Test cases:
Since it would be too much work to show each step for each test case individually, I will review each answer to make sure it is valid. Make sure the answer can handle the test cases.
 ______   ______     __     __   __     ______      __    __     ______
/\  == \ /\  == \   /\ \   /\ "-.\ \   /\__  _\    /\ "-./  \   /\  ___\
\ \  _-/ \ \  __<   \ \ \  \ \ \-.  \  \/_/\ \/    \ \ \-./\ \  \ \  __\
 \ \_\    \ \_\ \_\  \ \_\  \ \_\\"\_\    \ \_\     \ \_\ \ \_\  \ \_____\
  \/_/     \/_/ /_/   \/_/   \/_/ \/_/     \/_/      \/_/  \/_/   \/_____/

This pastebin.
                        __/\__
                        \    /
                  __/\__/    \__/\__
                  \                /
                  /_              _\
                    \            /
      __/\__      __/            \__      __/\__
      \    /      \                /      \    /
__/\__/    \__/\__/                \__/\__/    \__/\__

Bash (with GNU coreutils), 69 bytes
n=`tee x|wc -L`;for i in `seq 1 $n`;do fold -w$i x;sleep 1;clear;done

Saves input in temporary file x, then counts the longest line (GNU coreutils' wc has -L flag for this) and iterates for each console width from 1 to the longest line length. fold, sleep and clear does the rest of the magic.

Python 3.6, 124 bytes
Loops over length of input string like officialaimm's solution
import re,time
def d(s):
 for i in range(len(s)):print(*'\n'*75,*re.split(f'(.{{1,{i+1}}})',s)[1::2],sep='\n');time.sleep(1)

143 bytes to only go to width of longest line a al Frxstrem's Bash answer
import re,time
def d(s):
 for i in range(max(map(len,s.split()))):print(*'\n'*75,*re.split(f'(.{{1,{i+1}}})', s)[1::2],sep='\n');time.sleep(.5)

Uses "re.split((.{1,i+1}))" to break the string into groups of characters.  Because '.' doesn't match '\n', the groups don't wrap around from one line to the next. If the regex uses a capturing group, then re.split() returns a list with the matched groups at the odd indexes.  These are retrieved with [1::2].
Uses python 3.6 f-string to make the re pattern depend on group width i.
The * in front of re.split() uses python 3.6 unpacking to turn the list into arguments to the print statement.  Similarly, *'\n'*75, turns into 75 '\n' arguments to the print statement.  With the print keyword argument sep='\n', the result is printing about 150 blank lines to clear the screen, followed by each group of characters on a separate line.

This ones way better and shorter than mine. Great job! (y)

Python 3.5 (238 233 229 225 223 222 bytes)
- Works fine  in the windows terminal; not sure about other platforms, because of the system-specific os.system("cls") command.
- The string passed should be marked by \n for newlines eg: 'abc\nd efgh\n'
import os,time
def b(s):
 p=len(s);z=print;r=range
 for i in r(1,p):
  os.system("cls");l=0
  for j in r(p):
   z(s[j],end="");l+=1
   if(s[j]=='\n'):l=0
   if(j+1<p and l==i and s[j+1]!='\n'):z();l=0
  z();time.sleep(.5)

Saved 5 bytes: removed unwanted whitespaces
Saved 4 bytes: shorthand for len(s)
Saved 4 bytes: Thanks to sparklepony (shorthand for print)
saved 2 bytes: Thanks to sparklepony (shorthand for range as r and r(0,i) as range(i))
saved 1 byte: Thanks to steve (0.5 as just .5)

Cool! I think you could shave off some bytes by using the code z=print at the top, and then changing all other instances of print() to z().

I think you cold do the same thing you did with print with range, and instead of range(0,3) use range(3).

sleep(0.5) can be rewritten as merely sleep(.5)

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
When integers join the queue
Introduction
A queue is an abstract data type where elements are added to the front (enqueue) and removed from the back (dequeue). This is also known as the FIFO (First In First Out) principle.
It is best shown with an example:

Challenge
Given a non-empty array that contains positive integers and elements that indicate a dequeue (removing an element), output the final list of the queue.
Let's say that X denotes a dequeue in this example. Let's take a look at the following list:
[45, X, X, 37, 20, X, 97, X, 85]

This can be translated to the following queue-pseudo code:
                   Queue
Enqueue 45    ->   45
Dequeue       ->
Dequeue       ->              (dequeue on an empty queue is a no-op)
Enqueue 37    ->   37
Enqueue 20    ->   20 37
Dequeue       ->   20
Enqueue 97    ->   97 20
Dequeue       ->   97
Enqueue 85    ->   85 97

You can see that in the end, the result is [85, 97], which is the output for this sequence.

Test cases
Note that you may choose any other symbol or character for X, as long as it's not a positive integer.
[1, X, 2, X, 3, X]      ->     []
[1, 2, X]               ->     [2]
[1, 2, 3]               ->     [3, 2, 1]
[1, 2, X, X, X, 3]      ->     [3]
[1, 2, X, 3, X, 4]      ->     [4, 3]

This is code-golf, so the submission with the least amount of bytes wins!

Can it be a space separated string Instead of an array?

@Riley Sure, whatever works best for you

Can we use a negative number for x (Haskell doesn't support heterogeneous lists)

...or other non-non-negative integers like zero or a half?

@GenericDisplayName Hmm, good point. I'll allow it as long it's not a positive integer

@JonathanAllan I have changed the specs

Sorry, does that mean using 0 is allowed, or only negative numbers?

@DavidConrad Yes, using zero is allowed.

Really any string for X? Including something like q.pop();?

@feersum Sorry, I meant character. Updated the spec.

Jelly, 8 bytes
F;@Ṗṛ?¥/

Uses any falsy value (0 or empty iterable) to dequeue.
Try it online!
How it works
F;@Ṗṛ?¥/  Main link. Argument: A (array)

       /  Reduce A by the link to the left.
      ¥     Combine the two links to the left into a dyadic chain.
F             Flatten the left argument.
    ṛ?        If the right argument is truthy:
 ;@             Concatenate the right argument and the flattened left argument.
              Else:
   Ṗ            Pop; remove the last element of the flattened left argument.
                This is why flattening is required, as Ṗ doesn't handle integers
                as intended for this challenge.

Actually it's not forbidden. Only positive integers are forbidden, 0 is neutral.

That's not what it said when I posted my answer, but thank for the heads up.

Python 2, 56 53 50 bytes
q=[]
for i in input():q=[[i]+q,q[:i]][i<0]
print q

Try it Online!
Dequeue is -1. This trick allows easy pythonic slicing of the queue.

Mathematica, 102 bytes
Definitely not the shortest solution, but I couldn't resist because it's kind of perverse.
r=Reverse@{##}&
a_~f~b___:=b
f[a_,b___,]:=b
ToExpression[{"r[","f["~Table~StringCount[#,"]"],#}<>"]"]&

After some helper functions, this defines a pure function that takes a string as input: in the string, numbers are separated by commas (whitespace is optional); the dequeue character is "]"; and the list does not have delimiters in the front or back. For instance, the first example in the OP would be input as the string "45,],],37,20,],97,],85". The output of the function is a list of numbers.
The function counts how many dequeues "]" are in the input string, appends that many copies of "f[" to the front of the string, and then surrounds the whole thing by "r[...]". In the example above, this produces "r[f[f[f[f[45,],],37,20,],97,],85]"; notice the brackets are balanced.
Then, ToExpression interprets the resulting string as a piece of Mathematica code and executes it. The function f is conveniently defined to retain all its arguments except the first (and also ignores trailing commas; this is necessary to handle dequeueing empty queues anyway), and r converts the resulting sequence of numbers into a list of numbers in the right order.

Is the comma in line 3 at b___, meant to be there? It works, but the comma turns red because of it. (also, what's the difference between lines 2 and 3?)

Good eye :) Line 2 is equivalent to f[a_,b___]:=b (without the comma), while line 3 is equivalent to f[a_,b___,Null]:=b. In both cases, b___ refers to any number of arguments (including none at all). Line 3 is more specific, so is always used before line 2 when appropriate. So the function f ignores its first argument, and also ignores its last argument if that argument is Null. This was necessary to handle dequeueing an empty queue. Note that a typical input will yield an expression like r[f[f[f[5,3,],2,],],11], where each comma before ] again denotes a Null.

Wow, very nice :). By the way, I think it's actually 102 bytes; you may have counted an extra newline character at the end.

Retina, 30 bytes
1+`\d+,(.*?)X,?|^X,
$1
O^$`\d+

Try it online!
Repeatedly removes the first number that's (not necessarily immediately) followed by an X together with that X, or an X at the beginning of the string. Then reverses the remaining numbers.

JavaScript, 70 63 53 50 43 bytes
Thanks @Neil for golfing off 10 bytes with x.map instead of for loop and ternary expression
Thanks @Arnauld for golfing off 3 bytes
Thanks @ETHproductions for golfing off 7 bytes
x=>(t=[],x.map(a=>+a?t=[a,...t]:t.pop()),t)

Try it online!
Dequeue can be any non-numeric value other than true.

This would be shorter if you used a ternary instead of an if statement, and shorter still if you used map instead of a loop, and even shorter still if you used an expression instead of a block. See the tips.

I had posted the first version I got working. Then I ate dinner :P

You can do x=>(t=[],x.map(a=>a>0?t.unshift(a):t.pop()),t) to save quite a few bytes on the return

x=>x.map(a=>a>0?t.unshift(a):t.pop(),t=[])&&t is even shorter.

(Or just a? suffices, I guess?)

The a>0 is so that strings return false

Mathematica, 46 45 bytes
Thanks to ngenisis for saving 1 byte.
Reverse[#//.{_Integer:0,a___,X,b___}:>{a,b}]&

Basically the same as my Retina answer, using pattern matching. We repeatedly match the first X and remove it along with the first number (if one exists). After we're done, we reverse the list.

MATL, 13 12 bytes
vi"@?@wh}IL)

Input is an array of numbers, with 0 for "dequeue".
Output is numbers separated by spaces. An empty result is shown as nothing.
Try it online! Or verify all test cases.
Explanation
v        % Concatenate stack contents: gives []. This will grow to represent the queue
i        % Input numeric array
"        % For each entry in the input array
  @?     %   If current entry is non-zero
    @wh  %     Prepend current entry to the queue
  }      %   Else
    IL)  %     Remove last element from the queue
         %   End (implicit)
         % End (implicit)
         % Display (implicit)

Pure Bash, 72
Input given as command-line parameters.
for a;{
[ ${a/X} ]&&q=(${a:n++,0} ${q[@]})||((n-=n>0))
}
echo ${q[@]::n}

Try it online.

Haskell, 41 40 Bytes
l#a|a>0=a:l|l>[]=init l|1>0=l

Function is foldl(#)[] (Also included in bytecount with a byte of separation in between)
Try it online!
X is any non-positive integer
EDIT: -1 byte thanks to nimi

You can flip the last two guards to save a byte: |l>[]=init l|1>0=l

Haskell, 41 bytes
x&y:z|y<1=init x&z|w<-y:x=w&z
x&y=x
([]&)

Ninja'd :) seems like we had the same idea

(Although you need parentheses around the y:z like x&(y:z)

It works in my REPL which is part of hugs. I'm not sure of the exact version though.

Julia, 78 76 73 57 bytes
f(a)=(q=[];[x<1?q=q[2:end]:push!(q,x)for x=a];reverse(q))

Thanks to Harrison Grodin for some excellent Julia golfing suggestions. Replaced if/else with ternary and for/end with list comprehension for a savings of 16 bytes.
f(a)=(q=[];for x in a if x<1 q=q[2:end]else q=[q...,x]end end;reverse(q))

Removed some unnecessary spaces for a savings of 3 bytes.
Before negative numbers or zero were allowed:
f(a)=(q=[];for x in a if x==:X q=q[2:end] else q=[q...,x] end end;r everse(q))

Ungolfed:
function dequeue(list)
    queue = []

    for x in list
        if x < 1
            queue = queue[2:end]
        else
            queue = [queue..., x]
        end
    end

    reverse(queue)
end

I'm fairly new to Julia; there may be a better way. Uses :X for X, which is a Symbol in Julia. Updated: Now that 0 is allowed, uses 0 (or any negative number) for X, saving two characters. Updated again to remove some whitespace that I didn't realize wasn't needed.

PHP, 85 Bytes
<?$r=[];foreach($_GET as$v)is_int($v)?array_unshift($r,$v):array_pop($r);print_r($r);

-8 Bytes $v instead of is_int($v)if every dequeue value belongs to false

05AB1E, 12 11 bytes
Saved a byte thanks to Riley
)Evyai¨ëy¸ì

Try it online!
Explanation
Dequeues are denoted by any letter.
)             # wrap stack in a list (pushes empty list)
 Ev           # for each y in evaluated input
   yai        # if y is a letter
      ¨       # remove the first element of the list
       ëy¸ì   # else, prepend y to the list

GNU Sed, 43
Score includes +2 for use of the -r and -n flags.
G
s/X\n( *|(.*)\b\S+ *)$/\2/
s/\n/ /
h
$p

Try it online.
Explanation
                            # Implicitly read the next line
G                           # append a newline, then the contents of the hold space
s/X\n( *|(.*)\b\S+ *)$/\2/  # If the input was an X, remove it, the newline, and any element at the end
s/\n/ /                     # Otherwise if the input was not an X, it is simply enqueued by removing the newline between it and the rest of the line
h                           # save a copy of the queue to the hold space
$p                          # since we're using -n to suppress output at the end of processing each input line, then this explicit print is required in the last line

Python 3, 95 94 bytes
def f(x):q=[];[*map(lambda s:exec(("q.pop(0)"if q else"","q+=[s]")[s!="X"]),x)];print(q[::-1])

Try it online!
Also 94 bytes:
def f(x):q=[];[*map(lambda s:exec((("","q.pop(0)")[q>[]],"q+=[s]")[s!="X"]),x)];print(q[::-1])

Perl 5, 28 + 1 = 29 bytes
28 bytes of code + -p flag.
/\d/?$\=$_.$\:$\=~s/.*
$//}{

Try it online!
It uses a string ($\) as the queue: when the input contains an integer (/\d/?, we append it at the beginning of $\ ($\=$_.$\), and otherwise, we remove the last one with s/.*\n$//. At the end, $\ is implicitly printed thanks to -p flag (and those unmatched }{).

Other approaches:

33 bytes, using an array as the queue (it's the most natural way to do it in Perl I think, but not the shortest):
/X/?pop@F:unshift@F,$_}{$_="@F"

Try it online!
52 bytes, using regex and reverse (it happens to be quite exactly the same thing as Martin Ender's Retina answer - thanks to whom I saved 2 bytes on it). Reversing the list takes a lot of characters though, because to preserve the integers, I have to convert the string to an array to reverse it, then back to a string to print it. (say for instead of $_=join$", can save 2 bytes, but it requires -E or -M5.010 and it's not that interesting).
s/\d+ (.*?)X ?|^X/$1/&&redo;$_=join$",reverse split

Try it online!

Swift 3, 70 bytes
Assuming we have an array of Ints like let x = [1, 2,-1,3,-1,4]
print(x.reduce([].prefix(0)){(a,i)in return i>0 ?[i]+a:a.dropLast(1)})

Note that [].prefix(0) is a sneaky way to get an empty ArraySlice

C++, 122 119 bytes
#import<list>
void f(std::list<int>o,std::list<int>&q){for(int i:o)if(i)q.push_front(i);else if(q.size())q.pop_back();}

0 indicates a dequeue.
Try it online!

Suggest i?q.push_front(i):q.size()?q.pop_back():(void)0 instead of if(i)q.push_front(i);else if(q.size())q.pop_back()

Python 2, 58 bytes
def f(x,r=[]):
 for i in x:r=i and[i]+r or r[:-1]
 print r

Try it online!
Uses 0 as a dequeue value
-10 bytes thanks to pxeger

58 Try it online!

@pxeger Very nice, thanks!

Batch, 160 bytes
@set s=.
@for %%n in (%*)do @if %%n==X (call set s=%%s:* =%%)else call set s=%%s:~,-1%%%%n .
@set t=
@for %%n in (%s:~,-1%)do @call set t= %%n%%t%%
@echo%t%

This was harder than it needed to be.

Although Batch can enumerate the result of splitting a string, it can't easily remove an element from the enumeration.
It can remove the first item, but only if there is at least one item. Otherwise you get garbage.

This means that I a) need to have an end-of-queue marker, which doesn't get removed, and b) have to manipulate the queue back-to-front, so new items get inserted in just before the end marker, so that old items can be removed from the front, which then means I c) have to reverse the queue before printing it.

PHP, 70 bytes
foreach($argv as$v)+$v?$r[]=$v:array_shift($r);krsort($r);print_r($r);

Scala, 97 bytes
type S=Seq[_];def f(a:S,b:S):S=a match{case h::t=>f(t,if(h==0)b dropRight 1 else h+:b);case _=>b}

As input, f takes a list with 0 as the "dequeue" element. It uses tail-recursion with a second parameter (b), acting as an accumulator. Initially, b is the empty Seq (Nil).
Explanations :
type S=Seq[_]                               // defines a type alias (save 1 byte since Seq[_] is used 3 times)
def f(a: S, b: S): S = {                    // a is the initial list, b is an accumulator
    a match {
        case h::t =>                        // if a is non-empty
            f(t,                            // recursive call to f with 1st parameter as the tail
                if (h==0) b dropRight 1     // if h == 0 (dequeue) then remove last element of b,
                else h+:b                   // otherwise, just add h at the beginning of b in recursive call
            )
        case _ => b                         // when the list is empty, return b (final result)
    }
}

Note : b dropRight 1 is used instead of b.tail to avoid exception : tail of empty list.
Test cases :
f(Seq(45, 0, 0, 37, 20, 0, 97, 0, 85), Nil)     // List(85, 97)
f(Seq(1, 0, 2, 0, 3, 0), Nil)                   // List()
f(Seq(1, 2, 0), Nil)                            // List(2)
f(Seq(1, 2, 3), Nil)                            // List(3, 2, 1)
f(Seq(1, 2, 0, 0, 0, 3), Nil)                   // List(3)
f(Seq(1, 2, 0, 3, 0, 4), Nil)                   // List(4, 3)

f can also work with other types (String, char, ..., even heterogeneous list of those types!) :
f(Seq(false, '!', "world", 0, "Hello"), Nil)    // List(Hello, world, !)

REXX, 115 bytes
arg n
do while n>''
  parse var n m n
  if m=X then pull
  else queue m
  end
o=
do while queued()>0
  pull a
  o=a o
  end
say o

Takes a space-separated string, prints a space separated string

C#, 115 bytes +33 bytes for using
l=>{var r=new List<int>();foreach(var n in l)if(n<0)try{r.RemoveAt(0);}catch{}else r.Add(n);r.Reverse();return r;};

Anonymous method which returns a list of integers after performing the en-queuing and dequeuing operations. Negative integers are used for removing elements from the queue.
Full program with ungolfed method and test cases:
using System;
using System.Collections.Generic;

public class Program
{
    static void PrintList(List<int> list)
    {
        var s = "{";
        foreach (int element in list)
            s += element + ", ";
        if (s.Length > 1)
            s += "\b\b";
        s += "}";
        Console.WriteLine(s);
    }

    public static void Main()
    {
        Func<List<int>, List<int>> f =
        l =>
        {
            var r = new List<int>();
            foreach (var n in l)
                if (n < 0)
                    try
                    {
                        r.RemoveAt(0);
                    }
                    catch
                    { }
                else
                    r.Add(n);
            r.Reverse();
            return r;
        };

        // test cases:
        var list = new List<int>(new[]{1, -1, 2, -1, 3, -1});   // {}
        PrintList(f(list));

        list = new List<int>(new[]{1, 2, -1});  // {2}
        PrintList(f(list));

        list = new List<int>(new[]{1, 2, 3});   // {3, 2, 1}
        PrintList(f(list));

        list = new List<int>(new[]{1, 2, -1, -1, -1, 3});   // {3}
        PrintList(f(list));

        list = new List<int>(new[]{1, 2, -1, 3, -1, 4});    // {4, 3}
        PrintList(f(list));
    }
}

K (ngn/k), 18 17 bytes
-1 byte from @ngn
(){$[y;y,;-1_]x}/

Try it online!
Uses 0 as the dequeue element.

(){...}/ set up a reduction seeded with () (an empty list), over the (implicit) input
$[...]x apply x (the queue) to the result of $[] (cond)
$[y;y,;-1_] depending on the new value (i.e. if it is 0 or isn't), return a function projection either prepending the new value (y,), or dequeuing the last element (-1_)

$[~y;-1_;y,] -> $[y;y,;-1_] ?

Ruby, 65 54 bytes
q=[];(eval$*[0]).each{|i|q=[i]+q;q=q[1..-2]if i<0};p q

The separator can be any negative number.

Welcome to the site, and nice first answer!

J, 18 bytes
(*@[;@{}:@];,)/@|.

Try it online!

(...)/@|. Reverse and reduce by verb in parens...
}:@];, Create the two options (regular vs deque, represented by 0) as a boxed pair: left elm is the deque case (ie, accumlator with tail removed }:@]) and right elm is the normal case (new elm appended as head ,).
(*@[...{ Pick the correct case, which is the signum of the left argument in the reduction *@[, from our boxed pair {...
;@ And unbox it.

Zsh, 46 bytes
for a (`<&0`)$a&&{shift -p;:}||set $a $@
<<<$@

Try it online!

Julia 0.7, 41 bytes
!a=(q=[];a.|>i->q=i>0?[i;q]:q[1:end-1];q)

Try it online!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
It's [current year] already, folks, go home
On most new-years challenges when it is currently not the corresponding year of the challenge, It says this in the front.

It's [current year] already, folks, go home.

You have to output this text with the current year substituted.

I/O
Input: None.
Output: It's [current year] already, folks, go home.

First test run, got the time instead of the date: It's 8:58 already, folks, go home.

Can I take input and then ignore it (i.e do something along the lines of String goHome(Object foo){return "It's "+currentYear()+" already, folks, go home.";} (but much shorter, of course))?

It's a shame I shouldn't compile the challenge to literally: ///, 46 bytes It's the current year already, folks, go home.

@steenbergh If only school was that way in the morning. xD :P

I feel this challenge would be more appropriate if it were "if it's not the current year, output this, else output nothing", but still good challenge +1

Are we allowed to assume that this will be used on years after 2000 or it has to work on whatever year the target machine may support?

@MatteoItalia Yes, Year will be after the Epoch (1900 on most languages). I mean, come on. It's 2017.

@SIGSEGV: let's make this extra clear: I'm talking about after 2000, not after 1900. My language supports 1980-2099, but I can shave some bytes by assuming the year to be always after 2000.

@MatteoItalia ...No. Please don't assume that.

would this be [tag:kolmogorov-complexity]?

@tfbninja I don't think so... It may only change annually, but the output is not constant, and the program does essentially take input (just, from the system and not the user).

bash + date, 40 bytes
date +"It's %Y already, folks, go home."

Try it online!

Also works with ZSH

It works on nearly every shell, but I named it bash because TIO link is bash.

C (gcc), 58 bytes
f(){printf("It's%s already, folks, go home.",__DATE__+6);}

Note you need to recompile this once a year to get the correct functionality.

@RobertFraser To run any C (gcc) answer on this site you run it as gcc golf.c && ./a.out. That in this process a binary is formed is irrelevant for code golf. My source code is being judged, not the binary being generated (if that was the case my answer would be x86-64).

So it's not a C program but a GCC+shell program

@Elazar No, those are just the instructions to run any C (gcc) answer on this site.

True, but this is not "A C program that will produce the desired output" but "A shell command that will produce the desired output"

Its also not a c-Programm because there is no main().

@12431234123412341234123 Functions are acceptable answers here on codegolf.

@Elazar __DATE__ is standard C, any compiler would work, even in a IDE without a visible shell

Nitpickers ... @orlp, since __DATE__[6] is a space, you can spare one byte: ..."It's%s already, folks, go home.",__DATE__+6);} (mind the missing space between It's and %s).

My point has nothing to do with standard/nonstandard C. My point is: this is a compile-time (preprocessing time) program, not a C program. The runtime is the C preprocessor + some external execution.

@YSC What??? Somebody removed that golf from my answer. It was in the original version.

Well, "somebody" is OP ^^ They might have thought it was a typo.

05AB1E, 21 20 bytes
Saved a byte thanks to Erik the Outgolfer
žg“It's ÿˆ§,¹Ò,‚œ€¨.

Try it online!

I think you were confusing 05AB1E with Jelly, which has “...» syntax for compressed strings and the » can't be suppressed in any case.

This is the only solution without readable text :(

Explanation please?

@ckjbgames built-in dictionary

@boboquack Yes, It's  is readable. For the rest do this.

TeX (44 bytes)
It's \the\year\ already, folks, go home.\bye

PHP, 42 bytes
It's <?=date(Y)?> already, folks, go home.

Pretty sure you need quotes around the Y.

@MichealJohnson PHP will convert unrecogized constants to strings with the same value, so this should work (but it'll throw a notice)

@MichealJohnson You're never sure with PHP

Bash, 45 characters
printf "It's %(%Y)T already, folks, go home."

Bash's built-in printf in version 4.2 got the %(fmt)T format specifier and since version 4.3 it defaults to current timestamp in absence of argument.
Sample run:
bash-4.3$ printf "It's %(%Y)T already, folks, go home."
It's 2017 already, folks, go home.

Batch, 45 bytes
@echo It's %date:~6% already, folks, go home.

Batch is actually reasonably competitive for once.

I guess this solution result varies from different locale settings...

Mathematica, 53 bytes
Print["It's ",Now[[1,1]]," already, folks, go home."]

Reads like "It's Now already, folks, go home."

x86 machine code on DOS - 62 bytes
00000000  b4 04 cd 1a bf 23 01 88  c8 24 0f 00 05 4f c1 e9  |.....#...$...O..|
00000010  04 75 f4 ba 1b 01 b4 09  cd 21 c3 49 74 27 73 20  |.u.......!.It's |
00000020  30 30 30 30 20 61 6c 72  65 61 64 79 2c 20 66 6f  |0000 already, fo|
00000030  6c 6b 73 2c 20 67 6f 20  68 6f 6d 65 2e 24        |lks, go home.$|
0000003e

Even though the input from the BIOS is in BCD (as opposed to the plain 16 bit value got from the equivalent DOS call), decoding it to ASCII turned out to be almost as long as base-10 printing a register. Oh well.
    org 100h

section .text

start:
    mov ah,4
    int 1ah             ; get the date from BIOS; cx now contains the year in packed BCD
    mov di,placeholder  ; put di on the last character of placeholder
lop:
    mov al,cl
    and al,0xf  ; get the low nibble of cx
    add [di],al ; add it to the digit
    dec di      ; previous character
    shr cx,4    ; next nibble
    jnz lop     ; loop as long as we have digits to unpack in cx
    mov dx,its
    mov ah,9
    int 21h     ; print the whole string
    ret

its:
    db "It's 000"
placeholder:
    db "0 already, folks, go home.$"

Python 2, 67 bytes
import time
print"It's",time.gmtime()[0],"already, folks, go home."

Try it online!

Ruby, 52 bytes
puts"It's #{Time.now.year} already, folks, go home."

CJam, 38 bytes
"It's "et0=" already, folks, go home."

Try it online!

Mathematica, 58 bytes
"It's "<>ToString@#<>" already, folks, go home."&@@Date[]&

Anonymous function. Takes no input and returns a string as output. No, I'm not going to make a REPL submission, post it yourself if that one byte is so important.

PowerShell 3.0, 44 bytes
"It's $(date|% y*) already, folks, go home."

PowerShell is competing quite well today!

This will not work in version 2 of PowerShell (the foreach syntax). So you should have a v3+ identifier on here. Cool other wise.

Japt, 31 bytes
`It's {Ki} alÎ%y, folks, go Êà.

Try it online!

Perl 6,  53  51 bytes
say "It's {Date.today.year} already, folks, go home."

Try it
say "It's {now.Date.year} already, folks, go home."

Try it

TI-Basic (TI-84 Plus CE with OS 5.2+), 64 bytes
getDate
"It's "+toString(Ans(1))+" already, folks, go home.

TI-Basic is a tokenized language. Some commands (getDate, toString(, etc.), and all lowercase letters are two-bytes and everything else used here is one byte each.
Explanation:
getDate                                             # 3, store {Y,M,D} in Ans
"It's "+toString(Ans(1))+" already, folks, go home. # 61, implicitly return required string with Y from getDate

TI-Basic (TI-84 Plus CE with OS 5.1), 108 bytes
{0,1→L1
getDate
Ans(1)L1→L2
LinReg(ax+b) Y1
Equ►String(Y1,Str0
sub(Str0,1,length(Str0)-3→Str0
"It's "+Str0+" already, folks, go home.

TI-Basic is a tokenized language. The more complicated user variables (Y1, L1, L2, Str0), some commands (LinReg(ax+b , getDate, sub(,  Equ►String(, length(), and all lowercase letters are two-bytes and everything else used here is one byte each.
OS 5.2 added a toString( command, which obsolesces about half of this submission, which is based off of this algorithm.
Explanation:
{0,1→L1                                  # 8 bytes
getDate                                  # 3 bytes, store {Y,M,D} list in Ans
Ans(1)L1→L2                              # 10 bytes, multiply L1 by the year and store in L2
LinReg(ax+b) Y1                          # 5 bytes, take a linear regression of the points specified by each pair of corresponding coordinates in L1 and L2 and store it in Y1
Equ►String(Y1,Str0                       # 8 bytes, convert Y1 to a string
sub(Str0,1,length(Str0)-3→Str0           # 18 bytes, remove the "X+0" from LinReg
"It's "+Str0+" already, folks, go home.  # 56 bytes, implicitly return the required output

you can inline L_1 in the 5.1 programs. gets rid of a newline, two "L_1" tokens, and a →. 6 bytes saved?

@striking LinReg(ax+b) uses L_1 and L_2, so I have to set them both.

Save some bytes on the first: use max(getDate) instead because the largest number in getDate is always the year.

JavaScript ES6, 56 bytes
_=>`It's ${Date().split` `[3]} already, folks, go home.`

Try it online!

const f = _=>`It's ${Date().split` `[3]} already, folks, go home.`

console.log(f())

+1 Exactly the solution I was about to post. You could also use substr(11,4) or slice(11,15) instead of the split.

Don't you require more than 56 bytes as part the challenge is to output it?

@cnorthfield Generally speaking in code golf, a function that returns a value is an acceptable answer unless the question has more specific requirements. Check out this and this.

@powelles Thank you for explaining

That is true @powelles, but your answer doesn't return anything unless more is added to your golf.

@Kyle The function returns the string. Functions are acceptable, see the previous links to meta.

@grgarside I was under the impression that the golf has to be executable as is, and return/display with only the code given - which this answer does not. If this isn't the case, then I'll be on my way. As shown in the runnable code snippet, more is needed to make this actually execute: assigning the function _=>\It's ${Date().split` `[3]} already, folks, go home.`to a variableconst fand calling that functionf()in aconsole.log`

Please read this and this, in addition to the posts linked in my previous comment

“more is needed to make this actually execute” – @KyleFairns, that is callable, all you have to do is to call it: (_=>\It's ${Date().split` `[3]} already, folks, go home.`)()`.

R, 62 59 62 bytes
cat("It's",format(Sys.time(),"%Y"),"already, folks, go home.")

Using substr(date(),21,24) instead of format(Sys.time(),"%Y") saves three bytes

does this works in year 20017?

Ahh. Correct. Reverting back. Tnx!!

Using substring(date(),21) also saves 3 bytes and works for years beyond 9999.

Vyxal, 39 27 bytes
`It's % ×ġ, ṗḊ, go λ∵.`kðt%

Try it Online!
Surely golfable?

C#, 58 bytes
()=>"It's "+DateTime.Now.Year+" already, folks, go home.";

Anonymous function which returns the required string.
Full program:
using System;

public class Program
{
    public static void Main()
    {
        Func<string> f=
        ()=>"It's "+DateTime.Now.Year+" already, folks, go home.";

        Console.WriteLine(f());
    }
}

I think you can save characters by using C# 6 strings: $"It's {DateTime.Now.Year} etc etc".

()=>$"It's {DateTime.Now.Year} already, folks, go home."; 57

Pyth, 38 bytes
s["It's ".d3" already, folks, go home.

Online interpreter.

Same length: s["It's ".d3d." y\n9?}7Tè+1°Õh6%Ñ<  (If you replace \n by an actual newline) link

@KarlKastor How did that work for you?

Don't quite get the question. I used the online interpreter. The algorithm to create pyth's packed ."strings is: +++\.N++hSzeSzCi-RChSzCMz-hCeSzChSzN

@KarlKastor I used that, but it must be something in Chrome, and I highly doubt it's the printable unprintable characters.

JavaScript, 77 71 67 63 bytes

alert("It's "+Date().split(' ')[3]+" already, folks, go home.")

Thanks to @programmer5000 for the spaces!
JavaScript ES6 66 60 bytes

alert(`It's ${Date().split` `[3]} already, folks, go home.`)

Welcome to PPCG! Please golf your answer (remove the spaces around the +s!)

console.log("It's",new Date().getFullYear(),"already, folks, go home.") for 71 bytes

@fəˈnɛtɪk reverted back to console.log, added brackets to ES6 alert

Haskell, 113 bytes
import Data.Time.Clock
f=do t<-getCurrentTime;putStr$"It's "++(fst.span(>'-').show)t++" already, folks, go home."

Try it online! Replace f with main for a full program.
The function getCurrentTime returns a UTCTime object which looks something like "2017-04-02 10:22:29.8550527 UTC" when converted to a string by show. fst.span(>'-') takes the leading characters while they are larger than '-', that is the current year. For the next 7972 years take 4 would work for 8 bytes less, but we want our code to work correctly for ever and ever.
As far as I see build-in functions to get the current year require a import Data.Time.Calendar, so extracting the year from the string should be the shortest option.

Befunge-98, 57 55 bytes
"emoh og ,sklof ,ydaerla@ s'tI"4k,y\4*:*/"&2"*+.f7+k,@

Try it online!
Thanks to James Holderness for pointing out my mistake with the sysinfo instruction.
"emoh og ,sklof ,ydaerla@ s'tI" pushes the sentence to the stack where 4k, prints the first word. y is the sysinfo instruction. When passed 20 (the unprintable in the string), it returns 256*256*(year-1900) + 256*month + day of month. \4*:*/"&2"*+. takes just the year from the value and prints it andf7+k, prints the rest of the sentence.

@JamesHolderness Arghhh, that explains why I've never been able to get sysinfo working. Thanks a bunch!

VBScript, 53 bytes
msgbox"It's "&year(now())&" already, folks, go home."

You could save 4 bytes by assigning to a variable and 2 more by dropping the parentheses after now, giving you s="It's "&year(now)&" already, folks, go home." (49 bytes). In fact, you can shave 4 more bytes off by just using It's <%year(now)%> already, folks, go home. (45 bytes).

JavaScript ES6, 63 62 bytes
_=>`It's ${new Date().getFullYear()} already, folks, go home`

Syntax error, you have an extra closing ).

Oops, fixed now.

Uhm… I wrote “extra closing )”, not “missing opening (”. ;)

You're right...

Python 3, 73 68 bytes
import time
print(time.strftime("It's %Y already, folks, go home."))

Very basic answer. The "%Y" gets the current year.
Thanks to @ovs for removing 5 bytes

Save 6 bytes with print(f"It's {time.gmtime()[0]} already, go home")

@L3viathan thats too similar to the other Python answer

SmileBASIC, 65 bytes
Edit: This one should handle years of any size, even though SB (as far as I'm aware) doesn't support any year that isn't 4 characters.
?"It's "+LEFT$(DATE$,INSTR(DATE$,"/"))+" already, folks, go home.

Does this works in year 20017?

Javascript, 67 bytes
alert("It's "+new Date().getFullYear()+" already, folks, go home.")

T-SQL, 66 bytes
print concat('It''s ',year(getdate()),' already, folks, go home.')

QBIC, 48 bytes
?@It's `+right$(_D,4)+@ already, folks, go home.

I really should start working on substring...
Explanation:
?       PRINT
@ ... ` String literal:
        - creates a string with all the text from @ to `,
        - stores it as the first available string var (A$)
        - and injects A$ at the current point in the QBasic translated code.
+       String concatenation
right$  QBasic function to take characters from the right.
_D      QBIC's call to get the system date as dd-mm-yyyy (_d gets the time)
+@ ...  Second string lit (B$). Doesn't need the closing ` because of EOF.

Update: Substring saves me 4 bytes:
?@It's `+_s_D,-4|+@ already, folks, go home.

GolfScript, 48 bytes
"It's #{Time.new.year} already, folks, go home."

Try it online!
Yes, this is string interpolation.

MATL, 42 bytes
'It''s '1&Z'V' already, folks, go home.'&h

Try it online!
'It''s '                      % Push this string
1&Z'                          % Push current year
V                             % Convert to string
' already, folks, go home.'   % Push this string
&h                            % Concatenate all stack contents horizontally
                              % Implicitly display

APL (Dyalog), 44 40 bytes
4 saved thanks to Uriel by rearranging the structure
¯5⌽'already, folks, go home.It''s',1⊃⎕ts

Try it online!
Explanation
'alrea ... It''s', ⍝ "alrea .. It's" concatenated with
1⊃⎕ts              ⍝ the first element in the ⎕ts (contains the year)
¯5⌽                ⍝ rotated 5 times to the right

40 - ¯5⌽'already, folks, go home.It''s',1⊃⎕ts

@Uriel Thanks for me getting the crossed out 44 :D

IBM/Lotus Notes Formula, 54 bytes
Not exactly challenging but here we go anyway...
"It's "+@Text(@Year(@Now))+" already, folks, go home."

Java 8, 81 78 bytes
()->System.out.print("It's "+java.time.Year.now()+" already, folks, go home.")

Don't need the semicolon at the end of a lambda, and either print or printf will be shorter than println.

Noodel, 34 bytes
Ƈƈy”VẠṇ`DðC1}816ṚĊC:@-~ḂC'^D^#8Ụ İ

Try it:)

How it works
Ƈƈy”VẠṇ`DðC1}816ṚĊC:@-~ḂC'^D^#8Ụ İ
Ƈƈy                                # Gets the current year.
Ƈ                                  # Gets the current time as an integer.
 ƈy                                # Takes the integer and gets the current year from it.

   ”VẠṇ`DðC1}816ṚĊC:@-~ḂC'^D^#8Ụ İ # Creates the string.
   ”VẠṇ`DðC1}816ṚĊC:@-~ḂC'^D^#8Ụ   # Pushes on the string "It's¤ð¤already,¤folks,¤go¤home." as an array splitting on the "ð" character where "¤" is a space.
                                   # (space) NOOP that separates commands.
                                 İ # Concatenate the array using the current year.
                                   # Implicitly print to the screen.

Excel, 48 bytes
="It's "&YEAR(NOW())&" already, folks, go home."

SmileBASIC, 51 bytes
?"It's ";LEFT$(DATE$,4);" already, folks, go home.

I don't think it's reasonable to ever expect support for 5 digit years, but if SB gets updated in 10 millennia, then this should work for 1 extra byte:
DTREAD OUT Y,,?"It's ";Y;" already, folks, go home.

Aceto, 39 38 + 1 for (-l flag) 40 39 bytes
τ"It's "pp" already, folks, go home."p

Try it online!
Saved one byte thanks to DLosc

τ"It's "pp" already, folks, go home."p
τ                 push local datetime on stack
"..."             push the first part of the string
     pp           print both
       "..."      second part of string
            p     print it

@DLosc Nice! I'll update

SenseTalk, 47 bytes
put "It's"&&the year&&"already, folks, go home"

Factor, 49 bytes
now year>> [I It's ${} already, folks, go home.I]

Attempt This Online!

Thunno 2, 26 bytes
‘It's % ¥Ƙ, ⁶Ẇ, go ⱮŻ.‘kO%

Attempt This Online!
Explanation
‘...‘kO%  # Full program
‘...‘     # Compressed string "It's % already, folks, go home."
     kO%  # Replace the "%" with the current year
          # Implicit output

Gawk, 64 60 bytes
GNU Awk has a couple of built-in function to get current time and date.
BEGIN{print"It's "strftime("%Y")" already, folks, go home."}

Edit
The script can run from a file (-f), which saves 4 bytes (thanks manatwork).

Actually that is just 60 bytes. The enclosing single quotes and the escape code for single quote are needed only because the shell. You can put the code in a file max.awk and run it as gawk -f max.awk, so becomes clear that only the 60 bytes in the file needs to be counted. (The -f command line option is for free, other command line options would be counted.)

@manatwork I didn't know that -f is free. But it's shorter the way you say it, no matter if it was free or not. I am really confused when counting command line options towards the byte count. Is there a rule or a post that talks about which options count and which don't? I couldn't find it on my own.

Not a great reading, but we used to point freshmen to On “interactive” answers and other special conditions. Generally, is free whatever is strictly necessary to let the interpreter find the code.

Emacs/Lisp, 70 bytes
(concat "It's " (format-time-string "%Y") " already, folks, go home.")

You can reduce your byte count by removing unnecessary spaces.

Lua, 59 bytes
Gets the system date
print("It's "..os.date('%Y').." already, folks, go home.")

REXX, 53 bytes
say "It's" left(date(s),4) "already, folks, go home."

Does this work in year 20017?

No, it assumes a four-character year.

Fourier, 101 bytes
73a116a39a115a32a~S5do32a97a108a+6a101a-4a+3a121a44aSa102a+9~Aa-3a-1a+8a44aSa103a+8aSa104aAa-2a-8a46a

Try it online!

This doesn't have as many 4s as I expected...

T-SQL 74 bytes
print 'It''s '+CAST(year(GETDATE())as varchar)+' already, folks, go home.'

Appreciate that there is a shorter answer above but in the event that you're in the SQL-Server dark ages and don't have CONCAT available this will work :)

AHK 43 bytes
Send,It's %A_Year% already, folks, go home.

Tcl, 63
No chance of ever winning
puts "It's [clock f [clock se] -f %Y] already, folks, go home."

demo

Forth, 49 bytes
I tried leaving off the trailing " and it worked. Cool.
." It's " time&date . ." already, folks, go home.

Try it online

time&date – nsec nmin nhour nday nmonth nyear
Report the current time of day. Seconds, minutes and hours are numbered from 0. Months are numbered from 1. - Source

SQLite, 65 bytes
SELECT"It's "||strftime('%Y','now')||' already, folks, go home.';

Try it online!

Processing.org 48 bytes
print("It's",year(),"already, folks, go home.");

Jekyll, 35 bytes
Jekyll is a static site generator and it's the backend of GH Pages. If only it counts as a language here.
It's :year already, folks, go home.

Pyth, 38 bytes
%"It's %d already, folks, go home.".d3

Try it online!

VBA, 56 Bytes
MsgBox "It's " & Year(Now) & " already, folks, go home."

Squash the spaces and save 4 bytes

Excel VBA, 44 Bytes
Not sure if this is a cheat... assuming "It's" in in cell A1 on an Excel worksheet and " already, folks, go home." is in A3:
Msgbox Range("A1") & Year(Now) & Range("A3")

Well, this is .

@user202729 I don't see any technical reason why (https://codegolf.stackexchange.com/tags/code-golf/info). This function takes no inputs as per OPs rules. What do you think?

VBA (Excel), 42 bytes
Using Immediate Window.
?"It's"year(now)"already, folks, go home."

Attache, 47 bytes
C!DateFormat!"It's %Y already, folks, go home."

Try it online!
This is a constant function that returns the year it was defined in. Alternatively, a function that returns the year it was called in:
{DateFormat!"It's %Y already, folks, go home."}

And for an extra byte:
"It's %s already, folks, go home."%Date[].year|C

or
{"It's %s already, folks, go home."%Date[].year}

Nothing too special going on here in either case.

Python 2, 90 86 83 78 bytes
from datetime import*;print"It's",date.today().year,"already, folks, go home."

EDIT: Shaved off a couple of bytes.
EDIT: Shaved off more thanks to @HyperNeutrino

I can't believe ST beat Python 2...

Not valid. You need to print the "It's ___ already, folks, go home" part.

D'oh sorry... fixed...

78 bytes

SOGL V0.12, 24 22 bytes
uS"³9n⁶=⅛8!⅔ηεēæ▼∙Ω╝‘⁽

Try it Here!

jq, 52 characters
(48 characters code + 4 characters command line options)
now|strftime("It's %Y already, folks, go home.")

Sample run:
bash-4.4$ jq -nr 'now|strftime("It'"'"'s %Y already, folks, go home.")'
It's 2018 already, folks, go home.

Try it online!

Gema, 63 characters
\A=@subst{<D4>=It's \$0 already, folks, go home.\;?=;@date}@end

Sample run:
bash-4.4$ gema '\A=@subst{<D4>=It'"'"'s \$0 already, folks, go home.\;?=;@date}@end'
It's 2018 already, folks, go home.

jamal, 56 characters
{@format date=YEAR}It's {@date} already, folks, go home.

Sample run:
bash-4.4$ perl jamal.pl year.jam
It's 2018 already, folks, go home.

Arturo, 47 bytes
clip~"It's |now\year| already, folks, go home."

Try it!
Outputs to clipboard. The link includes a stdout version too.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Storing an array of Integers to WOM
Very few, if any, programs or applications have utilised the proposed spec for WOM which was initially thought up in the early 1970s as a polar opposite to ROM, so your task is to take a dataset of n Integers and simulate storing it to a WOM schema as a proof of concept.
Your array must contain 1 or more integers. Smallest solution wins.

Hopefully you have realised the date?

The story behind the WOM spec is here: http://www.sigwom.com/?page_id=17

For me very clear what OP is asking. "Have you had your second coffee yet?"

I don't typically drink coffee so no

Point is, who is awake and who is still half asleep?

Related

Anyone for a cup of Green Tea?


text:
Find Diffy Games
A fun game to play if you are bored is the Diffy Game. It is a one player game that is pretty simple and can consume a good deal of your time.
The Diffy game works like as follows:  You start with a list of non-negative integers, in this example we will use
3 4 5 8

Then you take the absolute difference between adjacent numbers
 (8)  3   4   5   8
    5   1   1   3

Then you repeat.  You repeat until you realize you have entered a loop. And then generally the game starts from the beginning again.
3 4 5 8
5 1 1 3
2 4 0 2
0 2 4 2
2 2 2 2
0 0 0 0
0 0 0 0

Often the game has no goal, you are just biding time by doing arithmetic in your head. However when I have the pleasure of playing this game my goal is always to try and pick a period and try to construct a game that loops with that particular period.
Not all games are periodic, the example above is not periodic for example because it eventually reaches a game with all zeros and thus can never make it back to its starting position. In fact it seems that the vast majority of games are not periodic making the few games that are a rare gem.

Given a game that loops with a particular period it is trivial to make another game that loops with the same period by just doubling the sequence. For example the game:
1 0 1

Plays out exactly the same as the game:
1 0 1 1 0 1

In fact, we can consider that both are really the infinitely repeating game:
... 1 0 1 ...

We will consider them one game for the sake of this challenge.
In a similar fashion multiplying the entire sequence by a constant will also trivially preserve the period so we once again are going to count any two games that differ by a constant factor to be the same game.

The infinite strings ... 1 0 1 ... and ... 0 1 1 ... are obviously the same string shifted by one character.  We will not count these as different games, but when one reaches the other it will not be considered the end of the cycle when determining the period of a game. For example:
The two games
... 0 0 0 1 0 1 ...  = A
... 0 0 1 1 1 1 ...  = B
... 0 1 0 0 0 1 ...  = A << 4
... 1 1 0 0 1 1 ...  = B << 4
... 0 1 0 1 0 0 ...  = A << 2
... 1 1 1 1 0 0 ...  = B << 2

and
... 0 0 1 0 1 0 ...  = A << 1
... 0 1 1 1 1 0 ...  = B << 1
... 1 0 0 0 1 0 ...  = A << 5
... 1 0 0 1 1 1 ...  = B << 5
... 1 0 1 0 0 0 ...  = A << 3
... 1 1 1 0 0 1 ...  = B << 3

are both games with period 6.  They share no term with each other at any point in their loops (unlike ... 1 1 0 ... and ... 1 0 1 ... which reach each other) but because they are shifted versions of each other they are considered the same game when counting.

Reflecting (or reversing) an infinite string gives essentially the same behavior, but does not necessarily give the same period. Consider, for example,
... 0 0 0 1 0 0 1 1 0 1 0 1 1 1 1 ...

and its reflection
... 1 1 1 1 0 1 0 1 1 0 0 1 0 0 0 ...

If we considered the next generation to be produced at a half-way point between the characters:
... 0 0 0 1 0 0 1 1 0 1 0 1 1 1 1 ...
 ... 0 0 1 1 0 1 0 1 1 1 1 0 0 0 1 ...

... 1 1 1 1 0 1 0 1 1 0 0 1 0 0 0 ...
 ... 0 0 0 1 1 1 1 0 1 0 1 1 0 0 1 ...

then both would have shifted position by 3.5 elements. However, we don't consider the next generation to be produced with that half-element offset, so one rounds up to a 4-element shift giving a period of 15, and the other rounds down to a 3-element shift giving a period of 5.
For this reason we consider an asymmetric string and its reflection to be distinct, even though the cycles are in some sense isomorphic. Of course, if they form part of the same cycle then it only counts as one cycle.

With these restrictions a little mathematics can show that there are in fact a finite number of Diffy cycles with any given finite period. Moreover, every infinite string with a finite period is an infinite repetition of a finite string.
Note that the strings can be larger or shorter than the periods. For example, there is a string of length 5 with period 15, and a string of length 15 with period 5. All of the strings with period 19 are of length 9709.
Task
Given a number n such that n is larger than 1 via standard input methods determine the number of distinct Diffy cycles with a period of exactly n.
(It seems that, in the literature, 0 is often not considered a periodic Diffy game. Since this is a gray area I will not ask you to solve for n = 1)
This is code-golf, so the goal is to minimize the number of bytes in your source code.
Test Cases
2  ->   0
3  ->   1
4  ->   0
5  ->   1
6  ->   1
7  ->   3
8  ->   0
9  ->   4
10 ->   4
11 ->   3
12 ->   5
13 ->   5
14 ->  24
15 ->  77
16 ->   0
17 -> 259
18 -> 259
19 ->  27
20 -> 272
21 -> 811
22 -> 768
23 ->  91
24 -> 340
25 -> 656

Hints
All Periodic diffy games will contain only zero and a single constant, this means every periodic game will be isomorphic to some diffy game consisting only of zeros and ones.

Ok, I've created a chat room: http://chat.stackexchange.com/rooms/56459/diffy-games

Are 010001->111001->000101->100111->010100->011110->010001 and 110110->101101->011011->110110 distinct?

@Mirac7 Sorry its been so long, I'm pretty sure those games are distinct

Python 2, 181 bytes
n=input()
m=2**n
a=[m]*m
r=lambda i:[i*-~m>>k&m-1 for k in range(n)]
def s(i):
 if a[i]&m:a[i]=i;a[i]=s(min(r(i^i*2)))
 return a[i]
print sum(min(r(i)[1:])>i==s(i)for i in range(m))

Try it online!
How it works
The rules that transform each row of a binary diffy game into the next row are the same as the rules that transform each column into the next column.  Therefore, it suffices to find all distinct cycles within the graph of all canonical length-n columns, where a column is “canonical” if it is lexicographically smaller than all of its rotations (this automatically excludes columns with period smaller than n).
With columns represented as binary numbers 0 ≤ i < 2n, the rule sends i to the smallest rotation of i XOR (i⋅2).  (If i is canonical, its high bit is zero and we do not need to worry about wraparound here.)
So we loop through all possible columns i, check for canonicity, then repeatedly apply the rule until we find a column we’ve visited before, memoizing the first such revisited column.  Exactly one column in each cycle will be its own first revisited column.

How does this work?

@WheatWizard Added an explanation.

Nice Job! You earned the bounty. @AndersKaseorg


text:
Let's Play Hide and Seek!
The user will hide, and the computer will try to find them.
First, the program will take an input, for the size of the grid. Like 5x5, 10x10, 15x15, etc. The grid won't always be a perfect square.
The grid is sort of like a chessboard:
_______________________________
|     |     |     |     |     |
| A1  |     |     |     |     | A
|_____|_____|_____|_____|_____|
|     |     |     |     |     |
|     | B2  |     |     |     | B
|_____|_____|_____|_____|_____|
|     |     |     |     |     |
|     |     | C3  |     |     | C
|_____|_____|_____|_____|_____|
|     |     |     |     |     |
|     |     |     | D4  |     | D
|_____|_____|_____|_____|_____|
|     |     |     |     |     |
|     |     |     |     | E5  | E
|_____|_____|_____|_____|_____|
   1     2     3     4     5

Now, the user will pick a square, such as B2 (without telling the computer)
The computer will start guessing squares. If it picks the correct square, the user will respond with y. If not, they will input the direction their tile is from the one picked (N, NE, E, SE, S, SW, W).
So if the user picked B2, and the computer guessed C3, the user would input NW.
Here is an example of the outputs and inputs:
Grid?
5x5

C3?
NW

C2?
N

B2?
y

Scoring:
This will be scored a little differently than a normal challenge.
The winner is the program that takes lowest number of guesses  (on average) it takes to guess the correct square. The test cases to be averaged will be all of the possible squares in a 5x5 and then in a 10x10.
However, it must also work with every pattern of grid up to 26 rows (i.e. 5x8, 6x2, 20x5, etc.).
Please include a way for it to be tested, such as a JSFiddle.
And lastly, in case of a tie, the shortest program wins.

If I'm hiding on A1 and the computer guesses B9, is the proper response NW or W?

@GregMartin It would be NW.... N, W, S, E must all be straight while anything on a different row/column must be NW, NE, SW, SE

Is there flexibility in the specific format of input and output? If there are more than 26 rows, what are they called?

@GregMartin You can be flexible with the output but try to keep it simple. It doesn't have to be exactly the same but should have a similar style. You do not need to account for anything above 26, I will edit that.

I don't know what "similar style" means. Can we take input as an ordered pair of integers (row#, col#)? (PS: These types of questions are reasons why pre-posting challenges in the Sandbox is a great idea.)

The AI must take in input, guess an output. It does not need to follow a format. I also did post this in the Sandbox but didn't get much feedback.

Can we use neural network to guess the square at the first time? XD

@SIGSEGV Sure, I dont see why not.

Python 3.6, 466 398 392 bytes, minimax
x, y = 1, 1
w, h = [int(x) for x in input('Grid?\n').split('x')]

def split_factor(a, b):
    N = b-y
    W = a-x
    S = h+~N
    E = w+~W
    return max(1, N, W, S, E, N*W, S*W, S*E, N*E)

def move(a, b):
    *Z, = zip([a, x, a, a+1, x, x, a+1, a+1],
              [y, b, b+1, b, y, b+1, b+1, y],
              [1, a-x, 1, w+x+~a, a-x, a-x, w+x+~a, w+x+~a],
              [b-y, 1, h+y+~b, 1, b-y, h+y+~b, h+y+~b, b-y])
    return Z[['N', 'W', 'S', 'E', 'NW', 'SW', 'SE', 'NE'].index(d)]

d = ''
while d != 'y':
    print()
    splits = {(a, b): split_factor(a, b) for a in range(x, x+w) for b in range(y, y+h)}
    a, b = min(splits, key=splits.get)
    d = input(f'{a}{"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[b]}?\n')
    x, y, w, h = move(a, b)

Input and output should be in the form shown in the example. This finds the square with the minimal "split factor"--which is the largest remaining area that can result from the player's answer (i.e. NW, E, y, etc.)--and guesses that. Yes, that's always the center of the remaining area in this game, but this technique of minimizing the worst-case will work more generally in similar games with different rules.
Unreadable version:
x=y=d=1
w,h=map(int,input('Grid?\n').split('x'))
while d!='y':print();s={(a,b):max(b-y,h+y+~b)*max(w+x+~a,a-x)for a in range(x,x+w)for b in range(y,y+h)};a,b=min(s,key=s.get);d=input(f'{a}{chr(64+b)}?\n');*z,=zip([a+1,x,a+1,x,a,a,a+1,x],[b+1,b+1,y,y,b+1,y,b,b],[w+x+~a,a-x,w+x+~a,a-x,1,1,w+x+~a,a-x],[h+y+~b,h+y+~b,b-y,b-y,h+y+~b,b-y,1,1]);x,y,w,h=z[~'WENS'.find(d)or-'NWNESWSE'.find(d)//2-5]

Mathematica, optimal behavior on test cases, 260 bytes
For[a=f=1;{c,h}=Input@Grid;z=Characters;t=<|Thread[z@#->#2]|>&;r="";v=Floor[+##/2]&;b:=a~v~c;g:=f~v~h,r!="y",r=Input[g Alphabet[][[b]]];{{a,c},{f,h}}={t["NSu",{{a,b-1},{b+1,c},{b,b}}]@#,t["uWX",{{g,g},{f,g-1},{g+1,h}}]@#2}&@@Sort[z@r/.{c_}:>{c,"u"}/."E"->"X"]]

This program can be tested by cutting and pasting the above code into the Wolfram Cloud. (Test quickly, though: I think there's a time limit for each program run.) The program's guesses look like 2 c instead of C2, but otherwise it runs according to the spec above. The grid must be input as an ordered pair of integers, like {26,100}, and responses to the program's guesses must be input as strings, like "NE" or "y".
The program keeps track of the smallest and largest row number and column number that is consistent with the inputs so far, and always guesses the center point of the subgrid of possibilities (rounding NW). The program is deterministic, so it's easy to compute the number of guesses it requires on average over a fixed grid. On a 10x10 grid, the program requires 1 guess for a single square, 2 guesses for eight squares, 3 guesses for 64 squares, and 4 guesses for the remaining 27 squares, for an average of 3.17; and this is the theoretical minimum, given how many 1-guess, 2-guess, etc. sequences can lead to correct guesses. Indeed, the program should achieve the theoretical minimum on any size grid for similar reasons. (On a 5x5 grid, the average number of guesses is 2.6.)
A little code explanation, although it's fairly straightforward other than the golfingness. (I exchanged the order of some initializing statements for expository purposes—no effect on byte count.)
1  For[a = f = 1; z = Characters; t = <|Thread[z@# -> #2]|> &;
2      v = Floor[+##/2] &; b := a~v~c; g := f~v~h;
3      r = ""; {c, h} = Input@Grid,
4    r != "y",
5    r = Input[g Alphabet[][[b]]];
6      {{a, c}, {f, h}} = {t["NSu", {{a, b - 1}, {b + 1, c}, {b, b}}]@#,
7        t["uWX", {{g, g}, {f, g - 1}, {g + 1, h}}]@#2} & @@
8        Sort[z@r /. {c_} :> {c, "u"} /. "E" -> "X"]
   ]

Lines 1-3 initialize the For loop, which actually is just a While loop in disguise, so hey, two fewer bytes. The possible row-number and column-number ranges at any moment is stored in {{a, c}, {f, h}}, and the centered guess in that subgrid is computed by the functions {b, g} defined in line 2. Line 3 initializes the max-row c and max-column h from user input, and also initializes r which is the loop-tested variable and also the subsequent user inputs.
While the test on line 4 is satisfied, line 5 gets input from the user, where the prompt comes from the current guess {b, g} (Alphabet[][[b]]] converts the row number to a letter). Then lines 6-8 update the subgrid-of-possibilities (and hence implicitly the next guess). For example, t["NSu", {{a, b - 1}, {b + 1, c}, {b, b}}] (given the definition of t on line 1) expands to
<| "N" -> {a, b - 1}, "S" -> {b + 1, c}, "u" -> {b, b}|>

where you can see the min-row and max-row numbers being updated according to the user's last input. Line 8 converts any possible input to an ordered pair of characters of the form { "N" | "S" | "u", "u" | "W" | "X"}; here "u" stands for a correct row or column, and "X" stands for East (just to allow Sort to work nicely). When the user finally inputs "y", these lines throw an error, but then the loop-test fails and the error is never propogated (the program simply halts anyway).

Batch, divide-and-conquer
@echo off
set z = ABCDEFGHIJKLMNOPQRSTUVWXYZ
set /p g = Grid?
set /a w = 0, n = 0, e = %g :x= + 1, s = % + 1
:l
set /a x = (w + e) / 2, y = (n + s) / 2
call set c = %%z :~%y%,1%%
set /p g = %c %%x%?
if %g :w=.% == %g % set /a w = x
if %g :n=.% == %g % set /a n = y
if %g :e=.% == %g % set /a e = x
if %g :s=.% == %g % set /a s = y
if %g :y=.% == %g % goto l

Works by creating the bounding box of the the area still to be searched. The next guess is always the centre of the box. For those compass points that are not included in the response, the box is reduced in that direction. For example for a response of N, the left, right and bottom of the box are set to the guessed square.
At 369 bytes I'm not expecting to beat anybody so I've left the spaces in for readibility.

Well, divide-and-conquer is generally useful for big testcases but not for small cases, any better algorithms?

@SIGSEGV Not sure what you mean; Greg and Ben's answers use the centre of the box method too.

We still need a better algorithm.

@SIGSEGV The center of box method is optimal. There is no better algorithm.


text:
running consecutive commands in bash
Usually to run multiple commands consecutively one would do:
sudo apt update && sudo apt upgrade # 35 characters

I can't help but feel there's a neat trick to running these with less keystrokes, and you golfers here love challenges :)
I've found a ton of answers around various SE Sites related to running arguments to different commands or commands in parallel, but nothing like what I'm after.
I've come to achieve what I want a couple of ways, but it's way longer and more difficult to type:
 x=('update' 'upgrade') && for i in ${x[*]}; do sudo apt $i; done

I quickly shortened this to:
for x in update upgrade; do sudo apt $x; done

then
for x in update upgrade;do sudo apt $x;done # 43 characters

Using bash, what is a golfed way of achieving the above? shortest line wins
(this is my first post to the group, please be kind if I've used the wrong tags) ;)
edit: as pointed out my own loops don't exactly do what is in the question due to the && being conditional on the first command not having an error (I do know this). There's also the fact that my loops (and the original command line without the -y switch) still requires user input to complete. An oversight. Time for some more explicit instructions.
My original thought was to have something like:
echo update upgrade | sudo apt

with the objective of just running one after the other.
In the interests of trying to open this up to other languages, let's expand it thusly:
Objectives:

run both commands
require no more than one additional keystroke by the user
can outsource this to other other languages/scripts*
can be scripted if:

gracefully fails (error messages are ok, but it shouldn't try and execute anything else in error)
it's something commonly or "unobtrusively installable" in linux/ubuntu (I feel I may regret this line)
the script takes at least three arguments

command to run

argument 1

argument 2

argument n

or specified on the command line, (see next example)
in this second case, see the note below
./twice "sudo apt" update upgrade

*I have it in mind that someone could construct a cute little binary/script from a printf, but the essence is, if it can be run from an executable script, all characters of the script EXCEPT the first line (the shebang) count.
If I've totally messed this up, feel free to close. Cheers

Hello and welcome to the site!  Generally we don't like language specific challenges here because they leave out people who don't golf in that language.  However I don't see a way to include other languages and its not against the rules so it should be fine.

I would also recommend clarifying exactly what you want out of solutions.  I assume you want to update and upgrade your packages based on the code provided but I would recommend explicitly outlining what you want from submissions.  Its nice to do this because golfing often involves going right up against the rules of the challenge and its better if these things are explicitly defined.

Note that your loops aren't equivalent to the original command. Because of &&, the second one will run only if the first didn't encounter an error.

I feel I've bitten off more than I can chew and messed up the whole essence of the original intent. Feel free to close this if that's the case.

@Dennis But that could easily be fixed by substituting ;.

My personal recommendation is not to use the word "guys" when addressing a general readership. Research shows that "guys" is not a gender-neutral term, in terms of the images and defaults it evokes in readers' minds; and using gender-specific terms reinforces our unconscious biases against women in technical fields, and makes them feel even less welcome.

@GregMartin so, "Everyone" or "People"?

BTW, saving that to a file and saving to startup totally destroys the need of such command.

@GregMartin certainly not intended, edited none-the-less http://english.stackexchange.com/questions/19074/what-is-a-feminine-version-of-guys

40 bytes
for a in ${@:2};do eval "${1} ${a}";done

Usage: ./[filename] "[primary command]" [arguments]
Ex. ./twice "sudo apt" update upgrade (Assumes 'twice' as file name)
Was this what you wanted?
Note: Please golf me further if it is possible, and correct me if I'm wrong. This was my first bash entry.

I was just doing this. Ninja'd me well :D

I think you can replace do and done with braces

Hence for a in ${@:2};{ $1 $a;} suffices in #!/bin/bash -e

24 bytes
Interactively, you can reduce this to 24 keystrokes (plus root password)
su
apt update
^dat^grad

An abstract script starts at 25 bytes +boilerplate:
#!/bin/bash -e
for x in ${@:2}
{
$1 $x
}

or at 29 bytes:
printf "$1 %s
" ${@:2}|sh -e

as in
e(){ printf "$1 %s\n" ${@:2}|sh -e;}
e "sudo apt" up{dat,grad}e

For concrete one-liners, the 32 bytes of
sudo sh -ec apt\ up{dat,grad}e\;

are only 1 byte shorter than
sudo apt update&&sudo apt upgrade

or 3 bytes shorter than
e(){ sudo apt up$1e;};e dat&&e grad

facepalm why?

the sh -ec "apt update;apt upgrade;" error exits (-e) on update error

No. That was not what I meant. nearly everyone (including betseg, one of the primary users on PPCG) is being confused of the question and just answer how to do the equivalent of sudo apt update && sudo apt upgrade. Sorry, but read the question again please.


text:
Who won the game?
Task
Everyone knows the game "Tic-Tac-Toe". Your task is it, to evaluate an ascii tic-tac-toe matchfield. Your Programm/Function should output/return the winner: O, X or nobody (N).
Pattern
X|O|X
O|X|O
O|O|X

In this case your programm/function should output/return 'X'
Rules

Input can come from STDIN, function arguments, command line argument, file, whatever suits you.

The program can be a function, full program, whatever works, really, as long as no external files are needed to run it.

You can assume that the input is valid.

Test Cases
X|O|X
O|X|X  = O
O|O|O

O|X|O
X|X|O  = X
O|X|X

X|O|X
O|X|O  = N
O|X|O

This is code-colf, so the shortest answer (in bytes) wins.

The first test case... A GLIDER?

@SIGSEGV Good eye!


text:
No Singles Allowed
This is a fairly simple challenge.
Write a program that computes the distance between two points on a 2D plane. However, you can't use any functions or operators (referred to here as symbols) that are 1 character long.
Examples:

-=, +=, *=, /=, %=, etc. are allowed.
||, &&, --, ++ are allowed as well.
+, -, /, * are not allowed.
f(x) is not allowed, but fn(x) is.
S 5 4 is not allowed, but SUM 5 4 is.
if(lol==lel) is allowed.
Simply putting two separate single-character operators one after the other is not allowed, eg. !!(true) isn't allowed.

Exceptions:

Single semicolons or the equivalent are allowed, e.g. foo();, as long as they are being used as an end-of-command symbol.
Commas (,) and periods (.) are allowed.
Parentheses (()) and other symbols that are used in such a way to require a second match are allowed. Examples:

foo(); is allowed, as is foo(x);.
[5,6] is allowed.
"strings" are allowed.
for(i+=5;;i++){} is allowed
if(1<2 && 2>3) is not allowed, as the symbols are being interpreted as greater than and less than symbols, and so do not require the other.
([{<>}]) is allowed.
][ is not allowed, as the symbols do not match.
Essentially, the interpreter/compiler/etc.(?) should recognize the symbols as matching.

Specifications:

Whitespace does not count for the single character rule, e.g. this == that and this  ==that etc. are both allowed.
Standard rules for loopholes etc. apply.
Input can be in any reasonable format of two points. Examples:

[{x:0,y:0},{x:9,y:786}]*
[[5,4],[6,8]]
"54,37,68,9760"
new Point(0,0), new Point(5,6)
["34,56","23,98657"]
etc.

Output should be a double or equivalent with 5 significant digits.
No eval!
This is code-golf, so shortest allowed and functioning code wins!

*You would have to construct the objects a different way, as colons are single symbols.
Good luck without being able to use the = operator! :P
Edit: Imaginary 5 kudo points for not using a built-in.

"f(x) is not allowed, but fn(x) is", aren't (, x and ) all one character long? You also seem to be missing a winning criterion.

you used variables with 1 character long, is that acceptable?

@FelipeNardiBatista Variables that are 1 character long are good to go, as long as it's not a function.

@MartinEnder Oops, forgot the code-golf tag.... :P Parentheses do not count, I'll add that into my question.

what about : ?

@Feathercrown, questions like this are very hard to get right... What about "special operators"? You allow (), but what about @? ., :, = and so on?

This seems awfully language specific. In CJam, . is a sort of meta-operator that combines with the next token into a single new operator, so that .- is element-wise subtraction. Is that one two-character symbol or are those two one-character symbols?

Restricted source questions are notoriously difficult to get right, because the tend to make many language assumptions. For example here, the language Whitespace has no effective restrictions. For future challenges, I recommend posting to the Sandbox where you can get meaningful feedback and iron out details before posting a challenge to Main.

What about strings? "foo"

I've clarified those questions. @StewieGriffin The whole point is that special operators are restricted; no, those are not allowed.

@MartinEnder The cjam example is interesting... I guess that would count as one two-character operator.

i would like to add dist s t=sum(map(**2)(zipWith subtract s t))**0.5 but the on hold status seems to prevent me from doing that.

@RomanCzyborra the = symbol is not allowed

Are all strings allowed? In python: eval("a+b") it's a valid string, but it will be executed as code

You say that semicolons are allowed as line ending symbols but for(i+=5;;i++){}  is disallowed? The semicolons in a for loop are line ending symbols. Just because they commonly don't have a newline after them does not mean that they are some type of operator.

Bigram/Trigram allowed?

Well there goes every 2d esolang :(

@WheatWizard Wait, the are? I thought they were their own thing.

@FelipeNardiBatista Good catch. Eval is not allowed.

Should've added a "no built-ins" restriction. Oh well.

The list of things which are unclear is too long to write because I'd certainly miss a few, but includes: 1. What is a "symbol"? 2. Is -- allowed when it's two separate stack-based subtractions? In general it's not clear whether the rules are meant to apply on a syntax level or on a source level (although it is clear that you didn't think about any languages outside the ALGOL family) -- and in fact they seem to be mixed together. 3. It's not obvious why you need to explicitly allow "'([{<>}])'", given that it's a string. 4. The rules on input are rendered irrelevant by the ban on eval.

@PeterTaylor 1. A symbol is an operator. I've added that into the question for clarity. 2. -- as 2 -s is not allowed under this rule as it is 2 separate single-character operators, which are illegal in this challenge. 3. Not really a problem, since it's just another example of something that's valid, but I "fixed" it anyways. 4. I'm not sure I understand, please clarify.

@WheatWizard It appears that you are right. Fixin' it.

@ETHProductions, TaylorScott, DownChristopher, and powelles: Can you please explain what exactly is unclear?

Python 2, 35 bytes
print abs(input().__sub__(input()))

Example input for points (5,4) and (6,8):
5+4j
6+8j
4.12310562562

or:
complex(5,4)
complex(6,8)
4.12310562562

Try it online!

@nimi . and , are allowed, however = is not, which is going to be the hard part for most languages.

@nini fixed it, as () and . are now allowed

Mathematica, 17 bytes
EuclideanDistance

A function invoked like EuclideanDistance[{5,4}, {6,8}]. Works in other dimensions as well.
Mathematica and its long command names thank you for your support.

JavaScript, 10 bytes
Math.hypot

Returns a function that does the job. For 13 bytes, I can do it using only paired puncutation:
Math['hypot']

R, 33 bytes
cd<-function(a,b)dist(rbind(a,b))

Try it online!
R, 26 bytes
dist(rbind(scan(),scan()))

Octave, 20 bytes
abs(diff(input('')))

Takes input on the form: [5+4j, 6+8j].
Anonymous functions can't be used since @ is a single character. It takes a vector with two complex numbers as input, calculated the difference, and takes the absolute value.