text:
It's time for a clock challenge!
I'd like you to build me a clock that displays time in this format:
18 ----------
19 --------------------------------------------------

This displays '18:10'. The current hour and the next hour are shown at the front of the line, followed by a space and a number of dashes: on the first line the number of minutes that have passed in this hour, and the second line shows how many more minutes to go in this hour.
To clarify

The clock should display the system's time. If fetching the time from another source is more convenient, that's fine too. It may not be supplied as input.
At 18:00, the top line is just 18 (Trailing spaces allowed but not required)
At 18:59, the bottom line is 19 -
The hours < 10 are either pre-padded with a 0 (01 -----) or right-aligned ( 1 -----). A left-aligned single digit is not allowed, not even if the dashes start at the right place (1  ----- is invalid).
The clock should display the hours in a 24h-format.
Although it's called the 24h format, there is not actually a 24 on it. During the 23rd hour, the second line starts with 00 or  0.
The display needs to be updated at least once a minute, but that doesn't have to happen at exactly 00 seconds. You may update more frequently / continuously if that is more convenient, but the result must of course still be legible - not one smear all over the screen.

Input
None.
Output

As described above. Trailing spaces to pad the clock to 60-ish positions is allowed on both lines, a trailing newline is also allowed.
The screen needs to be cleared when displaying the next minute: either with a clear-screen command or by adding no less than 30 newlines.

Additional rules

Standard loopholes are forbidden
code-golf, shortest answer in bytes wins.

may we have two spaces between the number and the dashes?

@Adám I think not, see the last example in "To clarify" bullet #4. But this may not address your question, which is more general.

"updated once a minute" -- Can it be updated more often?

@smls Yes, you may update as often as you like. I'll change the specs to 'at least once a minute'.

@Adám No, only one space between the numbers and he dashes.

Does it have to print immediately or can it print after a minute?

Just to clarify, is it okay for numbers less than 10 to be outputted like this 1 ----- without a leading space?

@KritixiLithos That would break alignment with two-digit hours (9, 10 or 23, 00), so no, not allowed.

Can I have a leading space on all lines (and two leading spaces for single digits)? It would save about a gajillion bytes in QBasic.

Actually, it may not be a gajillion--looks like PRINT USING can be used to avoid the leading space for positive numbers. TIL. But thanks. :)

After 23, is the next hour 24 or 0?

@KritixiLithos It's 0.

@steenbergh: You might want to clarify that in the question, since practically every submission has 24.

@kundor Added your suggestion.

for languages with no datetime functions, can we take current time as input?

@Razetime sure.

MATL, 41 bytes
Thanks to @Kundor for noticing a mistake, now corrected
`XxFT"4&Z'@+24\OH&YAO'-'60@*5&Z'-|Y"hhD]T

Try it at MATL online! But note that the program is killed after 30 seconds, so it's difficult to catch any changes in the output.
How it works
`           % Do...while
  Xx        %   Clear screen
  FT        %   Push [0 1]
  "         %   For each k in [0 1]
    4&Z'    %     Push current hour
    @+      %     Add k
    24\     %     Modulo 24. This transforms 24 into 0
    OH&YA   %     Convert to base-10 string with 2 digits
    O       %     Push 0. Concatenating with chars will convert this to char,
            %     and char(0) will be displayed as a space
    '-'     %     Push '-'
    60@*    %     Push 60*k
    5&Z'    %     Push current minute
    -|      %     Absolute difference. This gives current minute for k==0,
            %     or 60 minus that for k==1
    Y"      %     Repeat '-' that many times
    hh      %     Concatenate the top three elements into a string
    D      %      Display
  ]         %   End
  T         %   Push true
            % End (implicit). Since the top of the stack contains true, this
            % gives an infinite loop

Could be me, but at the second iteration, only the top line is printed...

@steenbergh It works for me with minutes and seconds instead of hours and minutes, so the changes are easily seen: https://matl.suever.net/?code=%60XxFT"5%26Z%27%40%2BOH%26YAO%27-%2760%40%2a6%26Z%27-%7CkY"hhD%5DT&inputs=&version=19.7.1

Yep, works. - in fact, might be cool to have this as lines 3 and 4 of my own clock.

@steenbergh: you accepted this answer, but it's not valid—it shows the hour after 23 as 24. I believe the shortest correct answer is the Ruby one by Value Ink.

@kundor Thanks for noticing. Corrected at the cost of 3 bytes

TI-Basic, 94 bytes
"
Repeat 99<length(Ans
Ans+"-
End
Ans→Str1
Repeat 0
getTime
ClrDraw
Ans{Ans(1)≠24,1,1
Text(0,0,Ans(1),sub(Str1,1,1+Ans(2
Text(6,0,Ans(1)+1,sub(Str1,1,61-Ans(2
End

Relatively straightforward. That's a string with one space at the beginning. The hours are right-aligned. This only works on TI-84+ calculators since the TI-83 does not have an internal clock.
Edit: Thanks @kundor for noticing that I didn't close the last loop. Fixed now (+2 bytes).
Edit #2: First hour should be zero, not twenty-four. Corrected at a cost of +14 bytes.

Every command count as one byte ?

@Sygmei Most tokens are one byte, yes. However, tokens such as Str1, getTime, and sub( are two bytes each. You can learn more at http://tibasicdev.wikidot.com/tokens

You wouldn't happen to have a link to an emulator, would you?

I would recommend https://www.cemetech.net/projects/jstified/ but do remember that it's morally wrong to use a ROM from the internet with this emulator unless you own that type of calculator yourself.

I would never, ever use this ROM to actually calculate anything! Perish the thought.

Don't be scared to click the link, because the emulator is legit and asks you to upload your own ROM before it will work. TI used to have them freely available but they're not any more. If you can find a TI-84 from a friend, that would be the best option.

At least in wabbitemu on my phone, this doesn't seem to update unless I add End at the end of the program, in which case it blinks constantly.

Hey @kundor, it was my fault that I didn't add the End statement -- thanks for the catch. But, the blinking may be a result of the emulator. If you want, clearing the ClrDraw command may give you nicer results on your emulator. It's required for the challenge, though.

Batch, 197 bytes
@echo off
set/ah=100+%time:~0,2%,m=1%time:~3,2%
cls
call:l
set/ah=(h-3)%%24+100,m=260-m
call:l
timeout/t>nul 60
%0
:l
set s=%h:~1%
for /l %%i in (101,1,%m%)do call set s=%%s%%-
echo %s%

Note: 10th line has a trailing space. For me, %time% formats hours with a leading space but minutes with a leading zero. I decided a leading zero was an easier output format, since all I have to do for that is to add 100 hours and remove the first digit. Minutes are trickier as 08 or 09 will cause octal parse errors, so I prefix a 1 effectively adding 100 minutes, adjusting for this by offsetting the loop appropriately, which is a byte shorter than subtracting the 100.

Python 3.6, 110 114 112 bytes
from time import*
while[sleep(9)]:h,m=localtime()[3:5];print('\n'*50+'%2d '%h+'-'*m+f'\n{-~h%24:2} '+'-'*(60-m))

This uses the new f-string formatting to save one byte (f'\n{h+1:2} ' vs '\n%2d '%(h+1).) You can change [sleep(9)] to  1 to save 8 bytes, but then it just spams the screen.
Saved one byte changing while 1:...;sleep 60 to while[sleep(60)]:..., thanks to TuukkaX.
I had to use 5 more bytes to get the next hour displayed after 23 to be 0, instead of 24, as OP just commented. :-(
Recovered one byte by only sleeping 9 seconds instead of 60.
Saved two bytes using a bit-fiddling to shorten (h+1)%24, borrowed from Value Ink's Ruby answer.

Could you please explain why you've put square brackets around the if condition? Wouldn't just having the space between while and sleep be 1 byte, as opposed to the 2 on either side? EDIT: Never mind, it's to make it truthy. Fair enough.

@shadow: sleep returns None, which is falsy.

@ToivoSäwén: sleep is also in the time module, so importing * is better.

Ruby, 98 95 91 bytes
Updates every 5 seconds. Only works in Unix-style terminals.
loop{t=Time.now;puts`clear`+"%02d %s
%02d "%[h=t.hour,?-*m=t.min,-~h%24]+?-*(60-m);sleep 5}

Windows command prompt version, 95 92 bytes:
loop{t=Time.now;puts"\e[H\e[2J%02d %s
%02d "%[h=t.hour,?-*m=t.min,-~h%24]+?-*(60-m);sleep 5}

Can you use backticks instead of system? \cls`vssystem'cls'`

It seems not, but you can use h=t.hour and then use h instead of the second t.hour, which saves 3 bytes.

@IMP1 indeed, backticks don't work for cls. Thanks for your other suggestion, though!

@IMP1 as it turns out, puts\clear`is the way to go if you use Unix terminals. It just doesn't work with the Windows command promptcls`.

For windows, you can puts"\e[H\e[2J" to clear the console, which I think shaves four bytes.
It would make your first line read loop{t=Time.now;puts"\e[H\e[2J%02d %s

@IMP1 thanks! Although, it only saved 3 bytes AFAIK

C, 176 162 161 160 156 bytes
This is a gross abuse of pointers but compiles and runs as specified.  Be sure to compile without optimization otherwise you are likely to hit a segfault.
main(){int*localtime(),b[9],*t;memset(b,45,60);for(;;)time(&t),t=localtime(&t),usleep(printf("\e[2J%.2d %.*s\n%.2d %.*s\n",t[2],t[1],b,t[2]+1,60-t[1],b));}

Ungolfed:
#import<time.h>
main()
{
 int *t,b[60];
 memset(b,45,60);
 for(;;) {
  time(&t);
  t=localtime(&t);
  usleep(printf("\e[2J%.2d %.*s\n%.2d %.*s\n",t[2],t[1],b,t[2]+1,60-t[1],b));
 }
}

Perl 6, 113 bytes
loop {$_=DateTime.now;.put for |('' xx 30),|([\+](.hour,1)».fmt('%2s')Z('-' Xx[\-](.minute,60)».abs));sleep 60}

Try it once with a one second timeout.
Or try an altered version that outputs the result of running for several hours.
Expanded:
loop {                  # keep repeating forever

  $_ = DateTime.now;    # assign an object representing the current time

    .put                # print with trailing newline
                        # ( adds a space between numbers and dashes )

  for                   # for each of the following

    |(                  # make it a slip so that it is all part of one list

      '' xx 30          # 30 empty strings (30 empty lines)
    ),

    |(

        [\+](           # triangle produce
          .hour,        # the hour
          1             # the hour plus one

        )».fmt( '%2s' ) # both formatted to two element string ( space padded )

      Z                 # zipped with

        (
            '-'         # a dash

          Xx            # cross (X) using string repeat (x) operator

            [\-](       # triangle produce
              .minute,  # the minute
              60        # the minute minus 60

            )».abs      # absolute value of both
        )
    );

  sleep 60              # wait until the next minute
}

What operators does the 'triangle produce' support? In [\+] it adds and in [\-] it seems to subtract. Does this work with multiplication and such?

@TuukkaX It should work with almost all infix operators. It is basically the same as [+] LIST which is reduce, except it gives you the intermediate values. See the docs page for produce

Java 8, 313 300 299 bytes
import java.time.*;()->{for(int c=0,h=LocalDateTime.now().getHour(),m=LocalDateTime.now().getMinute(),i;;)if(c>30){c=0;String l="",u,d;for(i=0;i++<60;)l+="-";u=l.substring(0,m);d=l.substring(m);System.out.println((h<10?"0":"")+h+" "+u+"\n"+(h<9?"0":"")+(h+1)+" "+d);}else{c++;System.out.println();}}

This only updates every 30 iterations of the while loop.  The other 29 iterations just print new lines.
Updated
Saved 13 14 bytes due to Kevin Cruijssen's help! Thanks!

Hi, welcome to PPCG! First of all, only programs/functions are allowed, and your current code is a snippet. You'll have to surround it with a method (i.e. void f(){...} and need to add the imports it required (in your case import java.time.*;). That being said, your code can be golfed at multiple places to lower it to 311 bytes (even with the added method-declaration and import). (Since it's too long for this comment, I've placed it in the next comment.. xD)

import java.time.*;void f(){for(int c=0,h=LocalDateTime.now().getHour(),m=LocalDateTime.now().getMinute(),i;;)if(c>99){c=0;String l="",u,d;for(i=0;i++<61;)l+="-";u=l.substring(0,m);d=l.substring(m);System.out.println((h<10?"0":"")+h+" "+u+"\n"+(h<9?"0":"")+(h+1)+" "+d);}else{c++;System.out.println();}} (303 bytes) I recommend reading Tips for Golfing in Java and Tips for golfing in . Enjoy your stay.

@KevinCruijssen I updated my answer and was able to save 3 more bytes by using lambda notation.  Also I changed a few pieces to the code you provided, as well, to meet the specifications (e.g. for(i=0;i++<60 instead of 61 and (h<10? instead of 9.  Thanks for informing me about method declaration and some golfing tips!

Ah, the 61 instead of 60 was indeed my mistake. I thought I had written it as for(i=0;++i<61 instead of for(i=0;i++<61 (in this second case it should indeed be 60, and even though it's the same amount of bytes, it's probably more obvious/readable). The h<9 in my code is correct, though. You had h+1<10 before and I simply changed this to h<9 by removing 1 on both sides. :)

@KevinCruijssen Ha I didn't pick up on that! h<9.  I will edit it to save 1 more byte.  Thanks again!

QBasic, 120 127 121 bytes
Don't run this for very long or your laptop will catch fire. Now 99.several9s% more CPU-efficient.
CLS
m=TIMER\60
h=m\60
m=m MOD 60
FOR i=1TO 2
?USING"## ";h MOD 24;
FOR j=1TO m
?"-";
NEXT
?
h=h+1
m=60-m
NEXT
SLEEP 1
RUN

Ungolfed and explanation
DO
    CLS
    totalMinutes = TIMER \ 60
    hour = totalMinutes \ 60
    minute = totalMinutes MOD 60

    FOR row = 1 TO 2
        PRINT USING "## "; hour MOD 24;
        FOR j = 1 TO minute
            PRINT "-";
        NEXT j
        PRINT

        hour = hour + 1
        minute = 60 - minute
    NEXT row

    SLEEP 1
LOOP

We start by clearing the screen, then get the current hours and minutes from TIMER, which returns the number of seconds since midnight.
This is the first time I've tried PRINT USING, so I was delighted to discover that it doesn't suffer from the usual QBasic quirk that positive numbers are printed with a leading space. ## as the format specifier ensures that single-digit numbers are right-aligned and padded with a space, as required. We have to use a loop for the hyphens, unfortunately, since QBasic does not have a string repetition function. (If I'm mistaken, please let me know!)
All the PRINT statements end with ; to suppress the newline; but after the hyphens, we need a newline; thus, the solitary ? after the inner FOR loop.
The SLEEP 1 is now necessary. Without it, the screen gets cleared so quickly after printing that it's just a flickering mess. (I used LOCATE 1 instead of CLS at first for that reason, until I realized that CLS with SLEEP is shorter anyway.) RUN restarts the program from the top--the shortest way to get an infinite loop.

How does this handle the last hour of the day? Top line reads 23, but what;'s the hour on the bottom line?

I'm using the Note7 and thinking of running this program for the foreseeable future in place of my status bar clock. Is that a good idea?

@steenbergh Whoops, fixed. It would be helpful for you to mention that edge case in the question.

@DLosc Nah, I'm just joking :)). But yeah, smart!!

@DLosc I see you're still just adding 1 to the hour for line 2. Again, I don't see how does this handles 23/00?

@steenbergh He prints h MOD 24, if initially h=23 then the next loop cycle its 24 and gets modded to 0. But I'm curious if it works as well. The CLS clears the first line so there are never both printed lines on the screen, right?

@Jens it works fine -- the CLS is only called when the main loop (defined by RUN) loops, so both lines are printed, then there's the SLEEP 1, then the CLS etc.

In the line FOR j=1TO m what happens if m is 0? Does it skip or result in an endless loop?  Online interpreters seem to go into an endless loop.

@styletron It works as expected (skips the loop) in QB64 and on archive.org. Other emulators I've tried (such as repl.it) are very incomplete, so I'm not surprised to hear that they're buggy.

Python 2, 131 129 127 bytes
from time import*
while[sleep(9)]:exec(strftime("a='%H';b=int('%M')"));print "\n"*30+a+" "+"-"*b+"\n"+`int(a)+1`+" "+"-"*(60-b)

saved a byte thanks to @TuukkaX

You don't need the newline and space after the while 1:

I started your code @19:55. At 20:01, I see 19 - \n 20 -----------------------------------------------------------. The hours aren't updating...

@steenbergh I tried it myself by setting the clock manually and it works for me.

@ovs aren't clock challenges fun :-). Anyway, probably something with repl.it then...

head-desk The Repl.it server is one hour behind to my local time... And it even says so at the very top of the console. I'll see myself out, thanks...

JavaScript (ES6), 162 bytes
Updates once per second

setInterval(c=>{c.clear(d=new Date,m=d.getMinutes(),h=d.getHours(),H=_=>`0${h++}`.slice(-2)),c.log(H()+` ${'-'.repeat(m)}
${H()} `+'-'.repeat(60-m))},1e3,console)

You can save quite a few bytes by restructuring the code so it is only one statement (it's possible to call console.clear() inside the console.log argument) and assigning in unused parentheses as much as possible. Version for 154B: setInterval(c=>c.log(H(h,c.clear(d=new Date))+\ ${'-'.repeat(m)}
${H(h+1)} `+'-'.repeat(60-m)),1e3,console,m=d.getMinutes(h=d.getHours(H=$=>$<9?'0'+$:$)))`.

You can save a bunch of byte by putting the hours and minutes into a single function m=>\0${h++} .slice(-3)+'-'.repeat(m)`.

C 251 267 251 bytes
 #include<time.h>f(){time_t t;struct tm *t1;h,m,i;while(1){time(&t);t1=localtime(&t);h=t1->tm_hour;m=t1->tm_min;printf("%d ",h);for(i=1;i<=m;i++)printf("-");puts("");printf("%d ",h+1);for(i=0;i<=59-m;i++)printf("-");puts("");sleep(1);system("clear");}}

Ungolfed version
#include<time.h>
void f()
{
 time_t t;
 struct tm *t1;
 int h,m,i;

 while(1)
 {
  time(&t);
  t1=localtime(&t);
  h=t1->tm_hour;
  m=t1->tm_min;

  printf("%d ",h);
  for(i=1;i<=m;i++)
   printf("-");

  puts("");
  printf("%d ",h+1);

  for(i=0;i<=59-m;i++)
   printf("-");

  puts("");

  sleep(1);
  system("clear");
 }
}

Gets the work done! Can definitely be shortened in some way.
Assume unistd.h file is included.
@Neil Thanks for the info.
@Seth Thanks, for saving 8 bytes.

IIRC you have to include everything necessary to get the code to compile (in this case, the definitions of time_t and struct tm) in your byte count.

Instead of printf("\n"); you can use puts("");

PHP, 104 105 bytes
<? for(;;sleep(6))printf("%'
99s%2d %'-".($m=date(i))."s
%2d %'-".(60-$m).s,"",$h=date(H),"",++$h%24,"");

showcase for printf´s custom padding characters:
"%'-Ns"=left pad string with - to N characters.
will print 99 newlines (every 6 seconds) instead of clearing the screen.
First newline must be a single character. So, on Windows, it must be replaced with \n.

First time golfing...
Powershell, 116 bytes (was 122)
while($d=date){$f="{0:D2}";$h=$d.Hour;$m=$d.Minute;cls;"$($f-f$h)$("-"*$m)`n$($f-f(++$h%24))$("-"*(60-$m))";Sleep 9}

Edit: From @AdmBorkBork's advice, changed Get-Date to date, and Clear to cls, for a saving of 6 bytes.

Welcome to PPCG, good answer

Welcome to PPCG! A couple easy golfs -- you can use cls instead of clear and (so long as you're on Windows) date instead of get-date. I'm also sure there's some easier way to output the formatting -- I'm playing with it and I'll let you know if I come up with anything.

Nice. Try this: 108 bytes while($d=date){cls;"{0,2} {2}``n{1,2} {3}"-f($h=$d.Hour),(++$h%24),('-'*($m=$d.Minute)),('-'*(60-$m));Sleep 9}. Use LF line break in your editor instead ``n`

Bash (3 and 4): 90 bytes
d=(`sed s/./-/g<$0`);let `date +h=%H,m=%M`;echo $h ${d:0:m}'
'$[++h%24] ${d:m}
sleep 5
$0

Due to the use of $0, this script must be put into a file, not pasted into an interactive bash shell.
The first command sets $d to 60 hyphens; it relies on the fact that the first line of this script is 60 characters long. This is three characters shorter than the next best thing I could come up with:
d=`printf %060d|tr 0 -`

If you don't want this to run your box out of PIDs or memory eventually, you can add eval to the beginning of the last line, which would make this 95 bytes.

Gives me the error let: h=09: value too great for base (error token is "09"). Problem is that leading zeros are interpreted as octal constants, so 09 is invalid.

Hrm, that means my script is broken in several ways. Thanks.

GameMaker Language, 134 bytes
s=" "while 1{s+="-"a=current_hour b=current_minute draw_text(0,0,string(a)+string_copy(s,1,b+1)+"#"+string(a+1)+string_copy(s,0,61-b)}

In the settings, you must be ignoring non-fatal errors in order for this to work. Also, in GML, # is equivalent to \n in most languages.

Raku (aka Perl 6), 104 bytes
DateTime.now.&{"\ec{.hour.fmt: '%2s'} {'-'x.minute}\n{(.hour+1).fmt: '%2s'} {'-'x 60-.minute}"}.say xx*

Needs to be run on a ANSI compatible terminal so that the control sequence for resetting the terminal works.
Pretty basic (because the more obfuscated approaches I tried turned out longer):

DateTime.now.&{"  "}.say xx*: Transform the current time into a string (see below) and say it, and repeat all of that an infinite number of times. The string is built like this:
\ec: ANSI control code <ESC>c for resetting the terminal, which clears the screen.
{.hour.fmt: '%2s'}: hour, right-aligned to 2 columns
 : space
{'-'x.minute}: dash repeated times the minute
\n: newline
{(.hour+1).fmt: '%2s'}: next hour, right-aligned to 2 columns
 : space
{'-'x 60-.minute}: dash repeated times 60 minus the minute

PHP, 112 120 bytes
for(;;sleep(9))echo($s=str_pad)($h=date(H),99,"\n",0).$s(" ",1+$m=date(i),"-")."\n".$s(++$h%24,2,0,0).$s(" ",61-$m,"-");

As there's no way to clear the screen (that I can find) I had to go with a pile of newlines. Also the question being updated to "at least" once a minute saves a byte with 9 instead of 60.
edit: @Titus noticed a bug in the padding of the second hour. Fixing it cost 8 bytes.

This displays warning text on stdout along with the correct output: Notice: Use of undefined constant str_pad - assumed 'str_pad' in C:\wamp64\www\my-site\a.php on line 2 - Notice: Use of undefined constant H - assumed 'H' in C:\wamp64\www\my-site\a.php on line 2 - Notice: Use of undefined constant i - assumed 'i' in C:\wamp64\www\my-site\a.php on line 2. Anything on Meta about that?

@steenbergh That´s a notice; it will not be displayed if you use default values (command line parameter -n or error_reporting(22519);

hours must be padded to length 2

Good point, the H setting for date goes from 00-23, but I forgot about it for the second hour.

Save two bytes with physical linebreaks.

... and 7 more with this: Remove 1+ and replace everything from ."\n" to the end with $p(date("-\ns ",++$h%24),65-$i,"-");.

Python 3.5, 127 120 117 bytes
from time import*
while[sleep(9)]:h,m=localtime()[3:5];print('\n'*88,*['%2d '%x+'-'*y+'\n'for x,y in[(h,m),(h+1,60-m)]])

Can you not just print('\n'*50) instead  of os.system('cls') so it works on both *nix and Windows? Would save a couple of bytes as you can lose the os import and OP says that this is allowed.

Oh, I didn't read it properly then. Thanks a lot man.

Just for info, most people tend to use  around their old byte count and then put the new byte count after it because it is interesting to see the progress as an answer is improved :-) Must try 3.5 some time. I'm still working with Python 2.

@ElPedro Yea I forgot to do it. I'll edit now.

Python, 115 113 bytes
saved a couple of bytes thanks to @kundor and @Phlarx
import time
while 1:h,m=time.localtime()[3:5];print("\x1b[0;H{:02} {}\n{:02} {} ".format(h,"-"*m,h+1,"-"*(60-m)))

At least on my system, this doesn't erase underlying characters, so that the number of dashes on the second line doesn't go down as time passes. Also: you can save three bytes by putting your while loop on one line, and two bytes by changing the :02 formats to just :2.

You can fix the issue described by @kundor in 1 byte by adding a space after the corresponding {}.

@kundor fixed! Thanks. I kept the :02 format to right-pad one digit hours with zeroes.

@kundor *left-pad one digit hours with zeroes.

@dfernan: Well, :2 left-pads with spaces, which the challenge says is OK.

AWK, 190 bytes
#!/bin/awk -f
func p(x,y,c){printf("%2s ",x)
for(j=0;j<y;j++)printf(c)
print}BEGIN{for(;;){split(strftime("%H %M"),t)
m=t[2]
if(o!=m){p(a,30,"\n")
p(t[1],m,"-")
p((t[1]+1)%24,60-m,"-")}o=m}}

Since AWK doesn't have a built-in sleep function, I simply have it continually check the clock to see if the minute has changed yet. The key thing is that it works... right? :)

BASH, 165 141 155 bytes
while :
do
clear
m=`date +%-M`
a=`printf %${m}s`
b=`printf %$((60-m))s`
h=`date +%H`
echo $h ${a// /-}
printf "%02d %s" $((10#$h+1)) ${b// /-}
sleep 9
done

I could save another 8 bytes removing the sleep, but I'm not comfortable with an indefinite while loop running on my computer without a sleep ;-)

Some optimizations: move sleep 9 to the condition of the while loop; remove the - in front of M in the format string on line 4. You also don't need to use $ in front of variable names in arithmetic expressions, so $((60-$m)) can be $((60-m))

I'm not sure whether your math on line 9 is accurate: h=23; echo $((10#$h+1)) prints 24 for me.

Whats wrong with 24?

I need the -M because $((60-08)) gives an error.

If I put sleep in the condition, which saves me 2 bytes, I would need to wait 9 seconds for the clock to appear ...
$((60-m)) saves me 1 byte though. Thanks !

C# Interactive (138 Bytes)
while(true){var d=DateTime.Now;Console.WriteLine($"{d.Hour:00} {new string('-',d.Minute)}\n{d.Hour+1:00} {new string('-',60-d.Minute)}");}

Can you golf this down by 1) naming the date var d instead of dt? and 2) use sleep(1e3) or 999 instead of 1000?

@steenbergh see update

A few things... This is just a snippet not a method or program (not sure if it's valid in C# Interactive though), it is essentially a golfed version of my code, and if it is should have been commented as improvements not a separate solution (though this is speculation) and there are lots of small improvements you can make here, and do you even need the sleep?

@TheLethalCoder I specifically put C# Interactive because this works in the interactive console ONLY. This would not work as a standard C# program.

Also note that this won't work when the hour is 23 and when the minute is 0

Golfing tips: true=>1>0, WriteLine=>Write, set d.Hour and d.Minute to variables etc... Also I don't know C# Interactive but you probably have to include using System; into the byte count

@TheLethalCoder if you have VS2015+ you can try this out in interactive yourself...it comes shipped with VS, but thanks for the tips

Also this solution is invalid (assuming consecutive calls to Console.WriteLine don't clear the console in interactive) as each call is placed on top of the other and not clearing the console as required

Prolog (SWI), 154 bytes
S+N:-get_time(A),format_time(atom(O),S,A),atom_number(O,N).
:-repeat,"%H"+H,"%M"+M,format("~t~d~2+ ~|~45t~*+
~|~t~d~2+ ~|~45t~*+
",[H,H,M,M]),\+sleep(60).

Try it online!
Welp, what a mess.

Guile, 146, 143 bytes
(while(sleep 9)(let*((t(gmtime(current-time)))(h(tm:hour t))(m(tm:min t)))(format #t "~d ~v,,'-t~%~d ~v,,'-t~%" h m(modulo(1+ h)24)(- 60 m))))

Shaved off three bytes thanks to ceilingcat.

C, 239 bytes
#include<time.h>
#include<unistd.h>
#define F printf(
void d(n,p){for(;n--;F"%c",p));}int main(){time_t*t;for(;;){d(30,10);time(t);int*m=localtime(t);F"%2d ",m[2]);d(m[1],45);F"\n%2d ",(m[2]+1)%24);d(60-m[1],45);F"\n");sleep(1);}return 0;}

Inspired by Seth's and Abel's entries, this will output 0 instead of 24 for the next hour, as required, and will use 30 lines to clear the screen.

Gura, 138 bytes
k(a,b)={if(a<10){a="0"+a;}println(a," ","-"*b)};repeat{t=datetime.now();k(t.hour,t.min);k(t.hour+1,60-t.min);os.sleep(60);print("\n"*30);}

Pretty short and straightforward :)

Wow ... That's fast. Any tips on running Gura? Just downloaded the binaries, but running Gura.exe and pasting in this code gives me a syntax error symbol k is not defined.

Forgot a semicolon ! You can try to run it again :)

Does this update every minute? The console seems to run this code just once...

Woops, did not saw that part, should be working now !

When it updates, it should either clear the screen or add 30 newlines. Man, I'm on your case...

I rushed, I should have been more attentive :/

SmileBASIC, 55 bytes
TMREAD OUT H,M,
CLS?H,"-"*M?(H+1)MOD 24,"-"*(60-M)EXEC.

Explanation:
TMREAD OUT HOUR,MINUTE,
CLS
PRINT HOUR,"-"*MINUTE
PRINT (HOUR+1) MOD 24,"-"*(60-MINUTE)
EXEC 0 'runs the code stored in slot 0 (the default)

Note: SmileBASIC only has 50 columns of text, so it won't look good...

Ok, haven't done a code golf in a while, so here goes my sad attempt :)
Unix Korn Shell: 177 171 170 bytes
while :
do
clear
h=`date +%H`
m=`date +%M`
d=-----
d=$d$d$d$d
d=$d$d$d
a=`echo $d|cut -b-$m`
let m=60-$m
b=`echo $d|cut -b-$m`
let i=h+1
echo "$h $a\n$i $b"
sleep 9
done

spliced the 2 echos into 1, saved a few bytes ... (sleep 9 instead of sleep 10 saves 1 byte :P )  lol

Processing, 204 200 198 197 bytes
5 bytes saved thanks to @L. Serné by using smarter ternaries
void draw(){int i;String s=((i=hour())>9?i:" "+i)+" ";for(i=0;i<minute();i++)s+="-";s+="\n"+((i=hour()+1)>9?i>23?" 0":i:" "+i)+" ";for(i=0;i<60-minute();i++)s+="-";print(s);for(;i++<99;)println();}

This outputs 30+ newlines for each update (which takes place when the frame gets updated)
Ungolfed
void draw(){
  int i;
  String s=((i=hour())>9?i:" "+i)+" ";
  for(i=0;i<minute();i++)
    s+="-";
  s+="\n"+((i=hour()+1)>9?i>23?" 0":i:" "+i)+" ";
  for(i=0;i<60-minute();i++)
    s+="-";print(s);
  for(;i++<99;)
    println();
}

Changing ((i=hour())<10?" ":"")+i into ((i=hour())>9?i:" "+i) would save 2B twice... Good luck with further golfing!

@L.Serne thanks for the tip :)

Another improvement that might work: ((i=hour()+1)>24?i=0:i)>9 becomes (i=hour()+1)>9, since hour outputs a number in the range 0-23, and even with 1 added to that, it'll never be greater than 24. Also, you should move the increment of i inside the condition in the for loop like you did in the very last loop. Should save 13B in total.

@L.Serné For the first point, I still have to include the ternary because 23+1 in a 24-hour clock becomes 0 (or at least I think). Next, if I move the increment of i inside the condition of the for-loop, i will start as 1 instead of 0 and I need to add one more byte i++<=minute() and the bytecount will still be the same. But nonetheless, thanks for helping me golf 1 more bytes :)

Mathematica, 235 bytes
d=UpdateInterval;e=Dynamic;f=Refresh;g=AbsoluteTime;Grid[Partition[Riffle[e[f[Floor@Mod[g[]/3600+#,24],d->1]]&/@{0,1},With[{t=#},e[f[""<>Array["-"&,If[t==60,60-#,#]]&@Setting@Floor@Mod[g[]/60+#,60],d->1]]]&/@{0,60}],2],Alignment->Left]

Python3.5 104 127 125 bytes.
    from time import*
    while[sleep(9)]:h,m=localtime()[3:5];print("{:02d} {}".format(h,m*'-'),end='\n'*30)
Riffing off Gurupad Mamadapur's answer above.
edit: xnor is right. This isn't a valid answer. - This misses the second line completely.
edit2: Instead, to at least have an answer that works:
    from time import*
    while[sleep(9)]:h,m=localtime()[3:5];print("{:02d} {}\n{:02d} {}".format(h,m*'-',h+1,(60-m)*'-'),end='\n'*30)
edit3: Saved two bytes by moving the \n*30 to the format instead of the end='\n'*30
from time import*
while[sleep(9)]:h,m=localtime()[3:5];print("{}{:02d} {}\n{:02d} {}".format('\n'*30,h,m*'-',h+1,(60-m)*'-'))

I don't think this does the right thing. The next hour needs to be printed with a dash for each remaining minute to it.

C#, 192 185 176 172 169 bytes
Saved 3 bytes thanks to @nurchi
using System;()=>{for(;;){Console.Clear();var t=DateTime.Now;int h=t.Hour,m=t.Minute;Console.Write($"{h:00} {new string('-',m)}\n{++h%24:00} {new string('-',60-m)}");}};

Uses C# 6 features which I don't have access to so cannot test it properly yet.
Full version showing how it works and is called including a Thread.Sleep so the input can actually be seen. Note that this version shows the use of Console.Writes overload to use String.Format and doesn't use string interpolation like the golfed version above.
using System;

class P
{
    static void Main()
    {
        Action a = () =>
        {
            for (;;)
            {
                Console.Clear();

                var t = DateTime.Now;
                int h = t.Hour,m=t.Minute;

                Console.Write("{0:00} {1}\n{2:00} {3}", h, new string('-', m), ++h % 24, new string('-', 60 - m));

                System.Threading.Thread.Sleep(500);
            }
        };

        a();
    }
}

Your line does not include the Sleep (which is included in the full code), so the output will flicker.

@nurchi the sleep is in the full code to view the output easier, as far as I am aware a smooth clock is not needed

TheLethalCoder, you are right if the output doesn't flicker too much (it has to be legible). And I just tested it, it barely flickers, but this may depend on the system. My answer below is 176 chars with Sleep (but I rely on the using System.Threading;. I do like your code though. To further shorten it, replace your while(1>0){...} with for(;;){...}

C# 181 176
for(;;){Console.Clear();var t=DateTime.Now;var h=t.Hour;var m=t.Minute;Console.Write("{0,2} {1}\n{2,2} {3}",h,"".PadLeft(m,'-'),++h%24,"".PadLeft(60-m,'-'));Thread.Sleep(100);}

This code assumes that the using System.Threading; line is included.
Full class:
class Program
{
    static void Main(string[] args)
    {
        Console.Title = string.Format("Started the app at: {0}", DateTime.Now.TimeOfDay);
        //new Timer((o) => { Console.Clear(); var t = DateTime.Now; var h = t.Hour; var m = t.Minute; Console.Write("{0,2} {1}\n{2,2} {3}", h, "".PadLeft(m, '-'), ++h % 24, "".PadLeft(60 - m, '-')); }, null, 0, 60000);

        for (; ; ) { Console.Clear(); var t = DateTime.Now; var h = t.Hour; var m = t.Minute; Console.Write("{0,2} {1}\n{2,2} {3}", h, "".PadLeft(m, '-'), ++h % 24, "".PadLeft(60 - m, '-')); Thread.Sleep(100); }

        Console.ReadKey(true);
    }
}

This solution has no way of exiting the loop (the original, commented, runs the code on a separate thread), so the Console.ReadKey statement is redundant. The only way to exit is to either close the console window or Ctrl+Break...

This is only a code snippet not a method or program, also the using System.Threading; needs to be included in the byte count if you are using it. Same with Using System;.

tcl, 164
while 1 {scan [clock f [clock se] -f %T] %d:%d h m
puts "[format %2s $h] [string repe - $m]\n[format %2s [expr ($h+1)%24]] [string repe - [expr 60-$m]]"
after 9999}

demo

This code can be golfed quite a bit. This is only 165 bytes. Also, it doesn't clear the screen (or add 30 newlines) between frames.

@steenbergh When I execute the code of your link I get errors.

Oh, now I see what happened. That environment just kept running your original code instead of running my modifications. Sorry about that...

Bash + Coreutils, 114 bytes
while sleep 9; do date +'%k %_M'|{ read h m;printf %02d:%${m}s\n$((h+1)):%$((60-m))s\n" $h|tr " :"  "- "; }; done

JavaScript (V8), 145 bytes
setInterval(c=>[m=(c.clear(),d=new Date()).getMinutes(),60-m].map((m,i)=>c.log(((d.getHours()+i)%24+' ').padStart(3)+'-'.repeat(m))),6e4,console)

Ungolfed
setInterval(console => {
  console.clear();
  const date = new Date();
  const hour = date.getHours();
  const min = date.getMinutes();
  [
    min,
    60 - min
  ].map((min, i) => console.log(
    ((hour + i) % 24 + ' ').padStart(3) +
    '-'.repeat(min)
  ));
}, 60 * 1000, console);


text:
Geohash Generator
XKCD Comic:

Goal:
Given a date, the current Dow Opening, and your current coordinates as a rounded integer, produce a "geohash."
Input:
Input through any reasonable means (STDIN, function argument, flag, etc.) the following:

The current date. This does necessarily have to be the date of the system's clock, so assume that the input is correct.
The most recent Dow Opening (must support at least 2 decimal places)
The floor of your current latitude and longitude.

To make input easier, you can input through any reasonable structured format. Here are some examples (you may create your own):
["2005","05","26","10458.68","37",-122"]
2005-05-26,10458.68,37,-122
05-26-05 10458.68 37 -122

Algorithm:
Given your arguments, you must perform the "geohash" algorithm illustrated in the comic. The algorithm is as follows.

Format the date and Dow Opening in this structure: YYYY-MM-DD-DOW. For example, it might look like 2005-05-26-10458.68.
Perform an md5 hash on the above. Remove any spacing or parsing characters, and split it in to two parts. For example, you might have these strings: db9318c2259923d0 and 8b672cb305440f97.
Append each string to 0. and convert to decimal. Using the above strings, we get the following: 0.db9318c2259923d0 and 0.8b672cb305440f97, which is converted to decimal as aproximately 0.8577132677070023444 and 0.5445430695592821056. You must truncate it down the the first 8 characters, producing 0.857713 and 0.544543.
Combine the coordinates given through input and the decimals we just produced: 37 + 0.857713 = 37.857713 and -122 + 0.544543 = -122.544543

Notes:

To prevent the code from being unbearably long, you may use a built-in for the md5 hash.
Standard loopholes (hardcoding, calling external resource) are forbidden.

May we take negative integers in the format _# instead of -#, i.e. _37 instead of -37?

Yes. As I stated, input and output can be flexible.

Shame about not using built-ins. Python3's module antigravity would have works well https://hg.python.org/cpython/file/tip/Lib/antigravity.py

@george Did you make that module?

@JulianLachniet Unfortunately not, never actually had a use for it though

@george Considering that module was created the day I posted the challenge, I'm a little bit suspicious.

@JulianLachniet That page was only updated on the 16th, not created luckily. I've know about the modules for a few years. https://www.explainxkcd.com/wiki/index.php/353:_Python suggests that is as old as 2.7.0, which was released in 2010. https://www.python.org/download/releases/2.7/

@JulianLachniet That module has been around for a while. I used it in this answer more than a year ago (just to be funny, though.)

Bash + Coreutils + md5, 98 bytes:
C=`md5 -q -s $1-$2`;C=${C^^};for i in 3 4;{ dc -e 16i[${!i}]n`cut -c1-7<<<.${C:$[16*(i>3)]:16}`p;}

Try It Online!
Uses the built-in md5 command on OSX to generate the MD5 hash. Takes 4 space separated command line arguments in the following format:
YYYY-MM-DD DOW LAT LONG

with negative numbers input and output with a leading underscore (i.e. _122 instead of -122).
Note: Depending on your system, you may need to substitute in echo -n $1-$2|md5sum for md5 -q -s $1-$2 in order for this to work. Doing so brings the byte count up to 103, and is indeed the case in the TIO link.

Python 2, 129 bytes
import md5
d,q,c=input()
h=md5.new(d+'-'+q).hexdigest()
print map(lambda p,o:o+'.'+`float.fromhex('.'+p)`[2:8],(h[:16],h[16:]),c)

Input is given in the form '2005-05-26','10458.68',('37','-122') (using the example).
Computes the MD5 hash with md5.new().hexdigest(), then performs the necessary transforms. I could save five bytes by using h instead of h[:16], but I'm not sure if that would affect the six most significant digits in the decimal conversion.
Ideone it! (substituting an eval() call for the input())

BTW in python3 geohash is in the stdlib:from antigravity import geohash

float.fromhex can be .0.fromhex

Groovy, 198 161 bytes
{d,o,l,L->m=""+MessageDigest.getInstance("MD5").digest((d+"-"+o).bytes).encodeHex()
h={(Double.valueOf("0x0."+it+"p0")+"")[1..7]}
[l+h(m[0..15]),L+h(m[16..31])]}

This is an unnamed closure.

Input
f("2005-05-26","10458.68","37","-122")

Output
[37.857713, -122.544543]

Try it here!
Ungolfed -
import java.security.*
{
    date,open,lat,lon ->
    md = "" + MessageDigest.getInstance("MD5").digest((date+"-"+open).bytes).encodeHex()
    decimal = {(Double.valueOf("0x0."+it+"p0")+"")[1..7]}
    [lat+decimal(md[0..15]),lon+decimal(md[16..31])]  //Implicity returns
}

https://tio.run/nexus/groovy btw ;).

Also,  as String is shorter than .toString() by one byte.

@carusocomputing Thanks saved a lot by using this instead ""+...

Oh jeez! I shoulda seen that as well, haha that took it even further, nice one ☺.

Javascript (Node, using built-in Crypto), 165 characters
(d,o,l)=>l.map((p,i)=>p+Math.sign(p)*[...require('crypto').createHash('md5').update(d+-o).digest`hex`.slice(z=i*16,z+16)]
.reduce((a,d,i)=>a+parseInt(d,16)*16**~i,0))

Such a verbose API!
JavaScript (using md5 library), 125 characters
(d,o,l)=>l.map((p,i)=>p+Math.sign(p)*[...require('md5')(d+-o).slice(z=i*16,z+16)]
.reduce((a,d,i)=>a+parseInt(d,16)*16**~i,0))

Nothing very golfy here.
In both cases:
f('2005-05-26', 10458.68, [144,-37])

=> [ 144.857713267707, -37.54454306955928 ]
```

Save 3 bytes with d+-o.

Oh, nice one :)

Python, 185 bytes
import hashlib as h
x,y,a,n=input().split(',')
b=h.md5((x+'-'+y).encode()).hexdigest()
q=list(map(str,map(float.fromhex,['0x.'+b[:15],'0x.'+b[16:]])))
print(a+q[0][1:8]+','+n+q[1][1:8])

Attempt This Online!
Hashlib stole my bytes, :P.

I can recover those bytes, but you’ll need to pay a £10.00 fee.

source: Stack Exchange

license: 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/

sort: votes


text:
Find the shortest representation of a number in Modular SNUSP
Background
Many esoteric programming languages don't have numbers built in at literals, so you have to calculate them at runtime; and in many of these cases, the number representation can be quite interesting. We've already had a challenge about representing numbers for Underload. This challenge is about representing numbers in Modular SNUSP. (Note that you don't need to learn SNUSP in order to complete this challenge – all the information you need is in the specification – but you might find the background interesting.)
The task
For the purpose of this challenge, a Modular SNUSP number is a string formed out of the characters @, +, and =, except that the last character is a #, and that the penultimate character must be + or = (it cannot be @). For example, valid numbers include @+#, ==#, and @@+@=#; examples of invalid numbers include +=, @@#, and +?+#.
The value of a Modular SNUSP number is calculated recursively as follows:

# has a value of 0 (this is the base case).
If the number has the form =x, for any string x, its value is equal to the value of x.
If the number has the form +x, for any string x, its value is equal to the value of x, plus 1.
If the number has the form @cx, for any single character c and any string x, its value is equal to the value of x, plus the value of cx.

For this challenge, you must write a program that takes a nonnegative integer as input, and outputs a string that's the shortest possible Modular SNUSP number that has a value equal to the input.
Clarifications

It's entirely possible that there will be more than one string with the same value, and in particular, for some integers there will be a tie for the shortest Modular SNUSP number with that value. In such a case, you may output any of the numbers involved wit the tie.
There's no restriction on the algorithm you use to find the number; for example, brute-forcing strings and evaluating them is a legal tactic, but so is doing something cleverer to reduce the search space.
As usual on PPCG, your submission may be either a full program or a function (pick whichever is more concise in your language).
This isn't a problem about handling input and output formats, so you can use any reasonable means to input a nonnegative integer and output a string. There's a full guide on meta, but the most commonly used legal methods include function arguments/returns, command line arguments, and standard input/standard output.

Test cases
Here are the shortest representations of the first few numbers:

0: #
1: +#
2: ++#
3: +++# or @++#
4: ++++# or +@++# or @=++#
5: @+++# or @@++#
6: +@+++# or +@@++# or @=+++# or @=@++# or @@=++#
7: @++++# or @+@++#
8: @@+++# or @@@++#
9: +@@+++# or +@@@++# or @+++++# or @++@++# or @+@=++# or @@=+++# or @@=@++#
10: @=@+++# or @=@@++# or @@@=++# (this is a fairly important test case to check, as all the possible answers include =)
11: @+@+++# or @+@@++# or @@++++# or @@+@++#
12: +@+@+++# or +@+@@++# or +@@++++# or +@@+@++# or @=+@+++# or @=+@@++# or @=@=+++# or @=@=@++# or @=@@=++# or @@=++++# or @@=+@++# or @@=@=++#
13: @@@+++# or @@@@++#
14: +@@@+++# or +@@@@++# or @=@++++# or @=@+@++# or @@+++++# or @@++@++# or @@+@=++#
15: @+@++++# or @+@+@++# or @@=@+++# or @@=@@++# or @@@=+++# or @@@=@++#

As a larger test case, the output from input 40 should be @@@=@@+++#, @@@=@@@++#, @@@@=@+++#, or @@@@=@@++#.
Victory condition
As a code-golf challenge, the winner is the shortest entry, measured in bytes.

= will optimally only occur as @=, right?

By the way, these kind of challenges are usually best posted as [tag:metagolf], as there hardly will be any interesting answer (just evaluate string and loop over all possible strings).

@orlp: I disagree, this challenge would be too easy as a metagolf, as finding an optimal answer is relatively easy, and metagolf doesn't place any other restrictions on the scoring. I'm expecting most of the answers here to be brute-force, but the specification is complex enough that brute force a) might not be shortest, and b) is likely to be interesting to golf in its own right. If you wanted a change in the victory condition, likely the only other interesting one is [tag:fastest-code], and that'd make more sense as a different challenge.

We have also had a number golf challenge for Brain-flak as well

Oracle SQL 11.2, 341 262 bytes
WITH e AS(SELECT DECODE(LEVEL,1,'=',2,'@','+')e FROM DUAL CONNECT BY LEVEL<4),n(s,v,p,c,i)AS(SELECT'#',0,0,e,1 FROM e UNION ALL SELECT c||s,DECODE(c,'+',1,'@',p,0)+v,v,e,i+1 FROM n,e WHERE i<11)CYCLE s SET y TO 1 DEFAULT 0 SELECT s FROM n WHERE:1=v AND rownum=1;

Old version
WITH e AS(SELECT DECODE(LEVEL,1,'=',2,'@','+')e FROM DUAL CONNECT BY LEVEL<4),n(s,v,p,c) AS(SELECT'#',0,0,e FROM e UNION ALL SELECT s||c,CASE c WHEN'+'THEN 1 WHEN'='THEN 0 WHEN'@'THEN p ELSE 0 END+v,v,e FROM n,e WHERE LENGTH(s)<10)CYCLE s SET y TO 1 DEFAULT 0 SELECT MIN(REVERSE(s))KEEP(DENSE_RANK FIRST ORDER BY LENGTH(s))FROM n WHERE v=:1;

:1 the number to represent in Modular SNUSP
Un-golfed :
WITH e AS (SELECT DECODE(LEVEL,1,'=',2,'@','+')e FROM DUAL CONNECT BY LEVEL<4),
n(s,v,p,c,i) AS
(
  SELECT '#',0,0,e,1 FROM e
  UNION ALL
  SELECT s||c
       , DECODE(c,'+',1,'@',p,0)+v
       , v
       , e
       , i+1
  FROM n,e
  WHERE i<11
) CYCLE s SET y TO 1 DEFAULT 0
SELECT s FROM n WHERE:1=v AND rownum=1;

First create a view with 3 lines, one for each symbol used to represent numbers, minus # which is only used at the end of the string :
SELECT DECODE(LEVEL,1,'=',2,'@','+')e FROM DUAL CONNECT BY LEVEL<4;

Then the recursive view n generates every string possible with those 3 symbols, concatenates them to # and evaluates them.
The parameters are :
s : the Modular SNUSP representation of the number being evaluated
  v : the decimal value of s computed by the previous iteration
  p : v computed by the i-2 iteration
  c : the next symbol to concatenate to s
  i : the length of s, only needed to get rid of two LENGTH() for golfing purpose
DECODE(c,'+',1,'@',p,0)+v

If the last symbol is + then add 1
If it is @ add the value of the i-2 iteration
Else the symbol is either # or =. v is initialised with 0 in the init part of the recursive view, so the new v is equal to the previous v in either case.
WHERE i<11

Every string possible with the 3 symbols is computed, this part insure that the request does not run until the big crunch.
CYCLE s SET y TO 1 DEFAULT 0

Since there is no rule to the construction of the strings, duplicates are bound to arise. Being in a recursive view Oracle interprets those duplicates as cycles and throw an error if the case is not explicitly taken care of.
SELECT s FROM n WHERE:1=v AND rownum=1;

Returns the first Modular SNUSP representation that evaluate to the decimal number entered as parameter :1
In my tests that first line is always one of the shortest representations.
In the case your database would not act in the same way, then that last clause should be replaced with
SELECT MIN(s)KEEP(DENSE_RANK FIRST ORDER BY i)FROM n WHERE:1=v

JavaScript (ES6), 100 bytes
n=>eval("for(a=[['#',0,0]];[[s,t,p],...a]=a,t-n;)a.push(['='+s,t,t],['+'+s,t+1,t],['@'+s,t+p,t]);s")

Simple brute-force breadth-first search algorithm.

For 40 it returns "@@@@@@=++#" which evaluates to 42

Even for 12 it gives "@@@+++#" which evaluates to 13

Hmm, I think changing t<n to t-n might work...

Pyth, 41 bytes
L?b+ytb@[yttb001)Chb0+hfqQyTs^L"+@="UhQ\#

Test suite
How it works:
There are two parts. A recursive function which calculates the value of a SNUSP expression without the trailing #, and a brute force routine.
Evalutaion:
L?b+ytb@[yttb001)Chb0
L                        Define the function y(b) as follows
 ?b                      If b is nonempty
   +ytb                  The sum of y(tail(b)) and   # tail(b) = b[1:]
   @[       )            The element in the list at location
   Chb                   Character values of the first character.
                         Modular indexing means that
                         + -> 3
                         @ -> 0
                         = -> 1
                         Index 2 is filler.
    [yttb001)            @ adds y(tail(tail(b)). Tail suppresses the error when
                         called on an empty list, so this treats @# as zero, but
                         this can't lead to problems because removing the @ will
                         always make the expression shorter.
                         + adds 1, = adds 0.
 0                       If b is the empty string, return 0

Brute force:
+hfqQyTs^L"+@="UhQ\#
               UhQ      0 ... Q     # Q is the input
        ^L"+@="         Map that list to all strings formed from the characters
                        "+@=", with that many characters.
       s                Concatenate
  fqQyT                 Filter for strings which evaluate to the input
 h                      Take the first success, which is the shortest due to
                        the order the strings were generated.
+                 \#    Add a '#' and output

CJam, 58
ri:M;'#0_]]{_{M&}#_)!}{;{~[2,+1$f+"@=+"\]z\f+\af.+~}%}w=0=

Brute force, with a little inspiration from Neil's answer. Try it online
Efficient version, 107
ri0"#"a{_{:B\:A={'=A0j+}{A(B={'+B0j+}{AB>{BAB-j_N={'@\+}|}N?}?}?}{;_(0j'+\+a\,1>_W%.{j}Na-'@\f++{,}$0=}?}2j

Try it online
This uses dynamic programming.

Haskell, 89 86 bytes
EDIT:

-3 bytes: zipping was shorter than indexing.

Another brute force solution which ended up with a lot of inspiration from Neil's answer. (Although it worked more like isaacg's Pyth before golfing introduced the l.)
f n=[s|(a,_,s)<-l,a==n]!!0
l=(0,0,"#"):[(a+c,a,d:s)|(a,b,s)<-l,(c,d)<-zip[0,1,b]"=+@"]

Try it online!

f is the main function, which takes an integer and returns a string.
l is an infinite list of tuples (a,b,s), shortest representations s first, together with their value a and the value b of the representation with the first char stripped. (as others have also noted/noticed, it's harmless to treat the latter as 0 for #.)
The elements of l other than the first one are generated recursively with a list comprehension. d is the character that is to be prepended to s to generate a new representation in the list, and 'c' is the corresponding increment to a.

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


text:
XOR two monochrome images
Challenge:
Take input of two black and white (monochrome) images and xor each pixel of the first, with each pixel of the second, add them to a new image and output the new image.
Some clarifications:
Size of pictures does not matter. Extension/Image format doesn't matter. You can make it take input any extension and output any extension, as long as the extension is used to store digital images. You can also use graphics to draw the output in eg: a picturebox if you wish. Otherwise, save the output as a file. Input can be taken  as a path to the image, or url.
One thing you can't do however, is I/O arrays, eg. of triplets(R,G,B).
Do NOT tamper with alpha. It should not be xored, it should be 255 (max value) for every pixel.
What do you mean xor each pixel?
You don't have to do it this way, but one way to xor two pixels is to take their RGB values and xor R1 with R2, G1 with G2, B1 with B2, and take the result, which is your new color
Since we have only two colors, obviously when the colors are the same the result would be (0,0,0) and when they are different (white is 255,255,255 and black is 0,0,0) in this case, the result would be 255,255,255.
Thus when two pixels are different, the result is a white pixel, else a black pixel
Example I/O:

Input 1:     Input 2:

Output:

This is code-golf so shortest code wins.

Can we take the input image as a URL?

@KritixiLithos yup, I edited it in the challenge for any further viewers.

Bonus challenge: http://i.imgur.com/a0M6o9e.png and http://i.imgur.com/bP1TsjQ.png.

May we read/write matrices of (R, G, B) triplets?

@orlp I got up to the qr code

@Lynn No, simply because it is tagged "image-processing" and graphical-output. You need to output an image, and take an image. Otherwise the challenge would be xor two arrays.

@P.Ktinos Then you need to explicitly state this in the challenge, as arrays of (R,G,B) triplets are an accepted I/O format by default for these challenges.

Is it okay if we output nothing instead of white?

Nothing as in a pixel with 0 alpha @KritixiLithos ? What would Nothing look like in the image?

@P.Ktinos http://i.stack.imgur.com/ShkoX.png

Not really @KritixiLithos . I guess it's kind of my fault for not specifying to not tamper with the alpha value. The alpha value should be at maximum for every pixel, and should not be xored, ill add to the question

Just to clarify, do we need to handle for all image sizes, or can we handle only specific image sizes? I was thinking it would be easier if I would handle images upto 400x400px

@KritixiLithos Since "Size of the images doesn't matter", do whatever you think will help you achieve shorter code. If only handling specific image sizes makes your code shorter (or vice versa with all image sizes), then go ahead.

@orlp Your QR links to http://codegolf.stackexchange.com/

The Fx Expression Language (ImageMagick), 8 4 bytes
EDITS

Simplified to u!=v, -4 bytes

As "Fx Expression Language" is apparently Turing complete, I've re-profiled my answer to it (was Unix Shell + Image Magick).
Golfed
u!=v

Fx does not support bitwise XOR nor bitwise NOT, so I've used != instead (which works just fine for the pure BW images).
u=> stands for "first image in list"
v=> "second image in list"

Input and output are implicit (controlled by the interpreter).
Usage
ImageMagick convert utility, serves as the "Fx Expression Language" interpreter, when invoked with -fx, as illustrated below:
convert $1 $2 -fx u!=v $3

The arguments are:

Input image A
Input image B
Output image O (A^B).

Sample output
convert a.png b.png -fx u!=v o.png

Mathematica, 37 34 15 bytes
Thanks to Ian Miller for cutting the number of bytes by more than half!
ImageDifference

In the end, there's always a builtin. This function takes two images as input and outputs an image; it does something more complicated for color images, but for black-and-white it's exactly XOR.
Previous submissions:
Thanks to JungHwan Min for saving 3 bytes!
Image[BitXor@@Chop[ImageData/@#]]&

Unnamed function that takes an ordered pair of images (of compatible dimensions) as input, and returns a displayed image. ImageData gets only the pixel data without all the wrappers/metadata; unfortunately it returns real numbers, so Chop is needed to help treat them as integers. BitXor does exactly what it says on the tin (and threads over nested lists), and Image turns the resulting RGB back into an image.
Original submission, which took an ordered pair of URLs or filenames a input:
Image[BitXor@@(#~Import~"Data"&/@#)]&

For binary images you can use  ImageDifference[#,#2]&

Java, 336 335 328 bytes
import static javax.imageio.ImageIO.*;import java.io.*;public class M{static void main(String[]y)throws Exception{java.awt.image.BufferedImage a=read(new File("a.png"));for(int i=0,j;i<a.getHeight();i++)for(j=0;j<a.getWidth();)a.setRGB(j,i,a.getRGB(j,i)^read(new File("b.png")).getRGB(j++,i));write(a,"png",new File("c.png"));}}

Ungolfed:
import static javax.imageio.ImageIO.*;

import java.io.*;

class M {
    public static void main(String[]y) throws Exception {
        java.awt.image.BufferedImage a = read(new File("a.png"));
        for (int i = 0, j; i < a.getHeight(); i++)
            for (j = 0; j < a.getWidth(); ) a.setRGB(j, i, a.getRGB(j, i) ^ read(new File("b.png")).getRGB(j++, i));
        write(a, "png", new File("c.png"));
    }
}

You can save a byte by removing the space between String[] y. Just a minor little golf.

Oh dang you're right. Haven't been golfing much lately, totally overlooked that one. Cheers.

You can remove the public from public class M to save 7 bytes

The file extension .png shouldn't be necessary

You can save a byte by doing ..."i++ < a.getHeight();)"

"Input can be taken as a path to the image" -- I gotta note y[0] (4 bytes) is fewer bytes than "a.png" (6 bytes)

for (j=0;j++<a.getWidth();a.setRGB(j, i, a.getRGB(j, i) ^ read(new File(y[1])).getRGB(j, i))) write(a, "png", new File(y[2])); -- Feels wrong, but you can move the command of the second loop into the for's terminator section and then just save every single iteration of the loop, thereby getting rid of one semicolon.

Also, this fails. It tamples with alpha. Needs to save to something without alpha.

Bunch of tricks to save 1 character, that coulda been more than saved by y[0] or any of the rest.
import static javax.imageio.ImageIO.;import java.io.;class Main{public static void main(String[]y)throws Exception{java.awt.image.BufferedImage a=read(new File(y[0])),b=read(new File(y[1]));for(int i=0,q=a.getWidth();i<q*a.getHeight();)a.setRGB(i%q,i/q,a.getRGB(i%q,i/q)^b.getRGB(i%q,i++/q));write(a,"jpg",new File(y[2]));}}

I'm not convinced that you need the throws Exception on main. Then again, I haven't done Java in a while.

That feeling you get when you golf in a verbose language

Python, 64 60 57 bytes
I'm new to golfing so have some mercy!
from cv2 import*
r=imread;lambda a,b:imshow('c',r(a)^r(b))

Thanks to @Blender and @FlipTack for saving me 7 bytes!

Using from cv2 import* should shave off 4 characters.

Here, unnamed lambdas are allowed for function answers, so you can drop the d= :) also, doing r=imread and then using r twice might be shorter

MATL, 10 bytes
YiiYiY~1YG

Explanation
This is basically the same answer, as the existing Octave solution: It takes the file names or URLs of both images as inputs and displays the result on the screen.
Yi    % Read first image from the URL or filename (implicit input)
i     % Get the second URL or filename as input
Yi    % Read that second image
Y~    % XOR the two images
1     % Push 1 (needed to make YG act as imagesc)
YG    % Display result using the MATLAB imagesc function

Usage
>> matl
 > YiiYiY~1YG
 >
> 'https://i.stack.imgur.com/UbbfM.png'
> 'https://i.stack.imgur.com/YyZG2.png'

This is 10 bytes.

Octave, 43 38 34 bytes
@(a,b)imshow(imread(a)~=imread(b))

Thanks to flawr saved me 5 bytes.
Thanks to Luis Mendo saved me 4 bytes suggested to use a~=b instead of xor(a,b).
A function that takes as input file name of the two input images a,b and shows the result.
Previous answer that writes to a file:
@(a,b,c)imwrite(imread(a)~=imread(b),c)

A function that takes as input file name of the two input images a,b and file name of the output image c.
Usage:
#two test images that used in the question
#https://i.stack.imgur.com/UbbfM.png
#https://i.stack.imgur.com/YyZG2.png
A = "UbbfM.png";
B = "YyZG2.png";
C = "out.png";
(@(a,b,c)imwrite(imread(a)~=imread(b),c))(A,B,C)

Result is saved in out.png

Couldn't you use imshow() instead of imwrite()?

@flawr Of course that will save some bytes:)

Can't you use imread(a)~=imread(b) (or +(imread(a)~=imread(b)) if logical input is not allowed by imshow) instead of xor(...)?

@LuisMendo Thanks, I always learn from your comments!

Processing, 124 118 117 bytes
void m(PImage a,PImage q){for(int i=0,j;i<400;i++)for(j=0;j<400;point(i,j++))stroke((a.get(i,j)^q.get(i,j))<9?0:-1);}

Usage:

Note: this code can support images up to 400px (with modifications can support upto 999 for the same bytecount). Any "leftover" space will be coloured black, so for best results, the image size should be the same size as the dimensions in the code (also the size() needs to be changed with the updated dimensions)

m(loadImage("http://i.imgur.com/a0M6o9e.png"),loadImage("http://i.imgur.com/bP1TsjQ.png"));

m(loadImage("https://i.stack.imgur.com/UbbfM.png"),loadImage("https://i.stack.imgur.com/YyZG2.png"));

Ungolfed
void Q106945(PImage a,PImage q){     // takes two images as input
  for(int i=0,j;i<400;i++)           // looping through the x-coordinates
    for(j=0;j<400;point(i,j++))      // looping through the y-coordinates
      stroke((a.get(i,j)^q.get(i,j))<9?0:-1);
/*
Here we have to colour the point according to the xor. So we do a simple
a.get(i,j)^q.get(i,j). But since the alpha gets xored, instead of outputting white, this
outputs a colour with alpha 0 (completely invisible). So to fix this I have a ternary that
checks the value and changes the colour accordingly. At the end of all this, the third
statement of the for-loop with j gets triggered since all this code is in this for-loop.
Now we draw a point over the coordinate with the colour we have chosen before.
*/
}

JavaScript (ES6), 253 bytes
- 12 20 bytes saved by Ismael Miguel
- 2 bytes saved by user2428118
Expects already loaded images, takes the last input's size as output size and returns a canvas element.
(i,j)=>(c=i=>{with(document.createElement(C='canvas')){({width,height}=i);return getContext`2d`}},g=i=>(x=c(i),x.drawImage(i,0,0),x.getImageData(0,0,1e4,1e4)),a=g(i),b=g(j).data,d=a.data,d.forEach((e,i)=>d[i]=i%4>2?e:e^b[i]),x.putImageData(a,0,0),x[C])

let func = (i,j)=>(c=i=>{with(document.createElement(C='canvas')){({width,height}=i);return getContext`2d`}},g=i=>(x=c(i),x.drawImage(i,0,0),x.getImageData(0,0,1e4,1e4)),a=g(i),b=g(j).data,d=a.data,d.forEach((e,i)=>d[i]=i%4>2?e:e^b[i]),x.putImageData(a,0,0),x[C])

window.onload =_=>{
  document.body.appendChild(func(img1, img2));
}

Ungolfed
(i, j) => (
  c = i => { // an helper to create a canvas object with the input's dimension
    with(document.createElement(C='canvas')) {
      ({width, height}=i); // set the canvas size
      return getContext`2d`
    }
  },
  g = i => ( // an helper to get an ImageData object from an Image
    x = c(i),
    x.drawImage(i, 0, 0),
    x.getImageData(0, 0, 1e4, 1e4) // 1e4 x 1e4 px should be big enough
                                   // (bigger might not be supported by the browser)
  ),
  a = g(i),
  b = g(j).data,
  d = a.data,
  d.forEach((e, i) => {    // loop through all rgba values
    d[i] = i % 4 > 2       // we need to special handle the alpha channel
      ? e :                // keep the alpha of the first input
      e ^ b[i]             // xor the rgb values
  }),
  x.putImageData(a, 0, 0), // put that back on the last context we created
  x[C]                     // return its canvas
}

Could be even further golfed (220 bytes) with a fixed 300*150px size (all remaining is transparent black) as in the Processing answer
(c=i=>document.createElement(C='canvas').getContext('2d'),g=i=>(x=c(i),x.drawImage(i,0,0),x.getImageData(0,0,1e4,1e4)),a=g(i),b=g(j).data,d=a.data,d.forEach((e,i)=>d[i]=i%4>2?e:e^b[i]),x.putImageData(a,0,0),x[C])

let func = (i,j)=>(c=i=>document.createElement(C='canvas').getContext('2d'),g=i=>(x=c(i),x.drawImage(i,0,0),x.getImageData(0,0,1e4,1e4)),a=g(i),b=g(j).data,d=a.data,d.forEach((e,i)=>d[i]=i%4>2?e:e^b[i]),x.putImageData(a,0,0),x[C])

window.onload =_=>{
  document.body.appendChild(func(img1, img2));
}

Replace the function c with c=i=>{with(document.createElement('canvas')){width=i.width,height=i.height;return getContext`2d`}} and you save 16 bytes.

Can you not xor a black rectangle over the xor of the two images to get back to 255 alpha?

@IsmaelMiguel, thanks, Not used to use with but seems quite good for golfing ;-) Also, forgot the template literal saves 2 bytes...

@Neil, I'm not sure, here we've got an 8bit array, maybe with a 32bits, that could do it, but it will take more chars...

Maybe if you start with a black canvas, then xor each of the two image on to it?

@Kaiido You're welcome. You can also change your g function to g=i=>{with(c(i)){drawImage(i,0,0);return getImageData(0,0,i.width,i.height)}}. This saves 1 byte. Also, remove those let. You don't need them. Nobody cares if it writes thash to the window.

@IsmaelMiguel, actually once let are removed, the with form is longer. (I've got a strange feeling going against my convictions while doing this...)

(i,j)=>{let c=i=>{with(document.createElement('canvas')){width=i.width,height=i.height;return getContext`2d`}},g=i=>{with(c(i)){drawImage(i,0,0);return getImageData(0,0,i.width,i.height)}},b=g(j).data,r=c(i);(d=(a=g(i)).data).forEach((e,i)=>{d[i]=i%4>2?255:e^=b[i]});r.putImageData(a,0,0);return r.canvas} <-- I wrote that piece of code with a let and it isn't longer.

@IsmaelMiguel, g=i=>{with(c(i)){drawImage(i,0,0);return getImageData(0,0,i.width,i.height)}} is 77 while g=i=>{x=c(i);x.drawImage(i,0,0);return x.getImageData(0,0,i.width,i.height)} is 76

Strange... Then I must have changed something because the code is shorter and still works... Also, you could use currying: i=>j=> which saves another byte.

Currying is allowed ? I mean the question asks for a program that takes two images as input, with currying it's not exactly the case, is it ? However, I can save one more byte by changing ^= to ^, which was hum... a brain-fart.

Saves 4 bytes: (i,j)=>{c=i=>{with(document.createElement(C='canvas')){width=i.width,height=i.height;return getContext`2d`}},g=i=>{x=c(i);x.drawImage(i,0,0);return x.getImageData(0,0,i.width,i.height)},a=g(i),b=g(j).data,d=a.data,r=c(i);d.forEach((e,i)=>{d[i]=i%4>2?255:e^b[i]});r.putImageData(a,0,0);return r[C]}

Perl, 260 bytes
251 bytes of code + 9 bytes for -MImager.
($i,$j)=map{new Imager(file,pop)}0,1;$p=getpixel;for$x(0..$i->getwidth()-1){$i->setpixel(x=>$x,y=>$_,color=>[map{($j->$p(%t)->rgba)[$c++%3]^$_?0:255}($i->$p(%t=(x=>$x,y=>$_,type=>'8bit'))->rgba)[0..2]])for 0..$i->getheight()-1}$i->write(file=>'a.png')

I'm not sure Perl is the best language for this challenge, but I wanted to know what was the image of @orlp's comment. And it makes me use a little bit of those graphic modules, that's a good thing. And I enjoyed coding it!
A more readable version:

use Imager;
$img1 = new Imager( file => $ARGV[1] );
$img2 = new Imager( file => $ARGV[0] );

for $x ( 0 .. $img1->getwidth()-1 ) {
    for $y ( 0 .. $img1->getheight()-1 ) {
    ($r1, $g1, $b1) = $img1->getpixel( x => $x, y => $y, type => "8bit" )->rgba();
    ($r2, $g2, $b2) = $img2->getpixel( x => $x, y => $y, type => "8bit" )->rgba();
    $r = $r1 ^ $r2 ? 0 : 255 ;
    $g = $g1 ^ $g2 ? 0 : 255 ;
    $b = $b1 ^ $b2 ? 0 : 255 ;
    $img1->setpixel( x => $x, y => $y , color => [ $r, $g, $b] );
    }
}
$img1->write( file => 'a.png' )

You'll need to install Imager if you want to try it, but it's quite simple: just run (echo y;echo) | perl -MCPAN -e 'install Imager' in your terminal.

LÖVE2D, 199 bytes
u,c=... i=love.image.newImageData a=math.abs X=i(u)Y=i(c)Z=i(X:getDimensions())Z:mapPixel(function(x,y)r,g,b=X:getPixel(x,y)R,G,B=Y:getPixel(x,y)return a(r-R),a(g-G),a(b-B)end)Z:encode("png","Z")

Simple enough, takes two image files on the command line, outputs a file called "Z" to the Love directory.
Also works for full colour images!

@MDXF https://love2d.org/

J, 54 bytes
load'bmp'
'o'writebmp~256#.255*~:&*&((3#256)#:readbmp)

Takes two arguments where each is the path to an input image in bmp format. Each image is read as a matrix of 24-bit RGB integers and parsed into a triplet of 8-bit RGB values, the sign of each is taken, and the two matrices are XOR'd together. The result is then scaled by 255, converted back from a triplet of base 256 numbers into an integer, and written to an output bmp file named o.

C#, 233 bytes
using System.Drawing;class C{static void Main(){Bitmap
a=new Bitmap("a"),b=new Bitmap("b");for(int
x=0,y=0;;)try{a.SetPixel(x,y,a.GetPixel(x,y)==b.GetPixel(x,y)?Color.Black:Color.White);x++;}catch{if(x<1)break;x=0;++y;}a.Save("c");}}

Thanks to Unknown6656 for the tip that command line arguments are not necessary. The program now reads from files "a" and "b" and writes to file "c" in the same format as "a". Off by one error fixed too.
It sets each pixel to black if the colour is the same, otherwise white.
To save bytes, it catches out of bounds exceptions, rather than checking the Width and Height properties of the Bitmaps. Each time x goes out of bounds it is reset to 0, and y is incremented. When y goes out of bounds, x is 0 and the loop breaks to save the image and quit.
Example compile using csc and run using mono:
csc xor.cs

mono xor.exe

You could drop the token (string[] v) inside the main-declaration, as C# does not explicitly needs it to run an application

C, 189 bytes
#include<stdio.h>
s,t[9];
#define o(f,p)int*f=fopen(p,"ab+");
#define f(p,q,r)o(a,p)o(b,q)o(c,r)fscanf(a,"%*s %*d %*d %n",&s);for(fwrite(t,1,fread(t,1,s,b),c);s=~getc(a);putc(~s^getc(b),c))

Operates on PBM images. Call f(a, b, out) with the names of both input files and the output file.
Assumptions:

Both input image headers are identical (whitespace included), and are less than 9 * sizeof(int) characters.
We're on a nice OS that flushes and closes leaked files.
EOF == -1

Ungolfed and explained: (backslashes omitted)
// Scratch variable and "big enough" buffer
s, t[9];

// Opens a file in read/append binary mode
#define o(f,p)int*f=fopen(p,"ab+");

#define f(p, q, r)

    // Open the three file pointers a, b, c from the paths p, q, r
    o(a, p)
    o(b, q)
    o(c, r)

    // Read from a to locate the end of the PBM header
    fscanf(a, "%*s %*d %*d %n", &s);

    for(
        // Read the header from b into the buffer,
        // then write it back from the buffer to c
        fwrite(t, 1, fread(t, 1, s, b), c);

        // Loop condition: get the next byte from a
        // and check for EOF with a bitwise-not
        // (Assumes that EOF == -1)
        s = ~getc(a);

        // Loop increment: get the next byte from b,
        // flip s back, xor and write to c
        putc(~s ^ getc(b), c)

    ) // Snatch the semicolon from the call syntax :)

C (spec-bending), 149 bytes
#include<stdio.h>
t[7];
#define o(f,p,u)int*f=fopen(p,"ab+");u(t,1,7,f);
#define f(p,q,r)o(a,p,fread)o(b,q,fread)o(c,r,fwrite)putc(getc(a)^getc(b),c)

Still uses PBM files, but now:

The image has to be one pixel high and 8 pixels wide or less, because PBM packs 8 pixels in a byte.
The header has to be 7 bytes (e.g. P4 8 1 with a trailing space).

Both files are seeked forwards while filling t with their header, then the last bytes are read, xor'd and written back. Takes advantage of fread and fwrite having similar parameter lists to factor all three operations on the header behind the same macro.

R, 45 bytes
p=png::readPNG;plot(as.raster(+(p(a)!=p(b))))

aand b represent the file names of the two image files.
Example:
a <- "YyZG2.png"
b <- "UbbfM.png"
p=png::readPNG;plot(as.raster(+(p(a)!=p(b))))

Output:

Processing, 82 bytes
void x(PImage a,PImage b){int x=b.width;b.blend(a,0,0,x,x,0,0,x,x,32);set(0,0,b);}

Abuses Processing's extensive drawing functions to avoid actually doing any XORing. Blends the two images together with DIFFERENCE mode and draws them to the screen.
Usage
x(loadImage("http://i.imgur.com/a0M6o9e.png"),loadImage("http://i.imgur.com/bP1TsjQ.png"));

Ungolfed
void xor(PImage a, PImage b) {
  int x = a.width;
  b.blend(a, 0, 0, x, x, 0, 0, x, x, DIFFERENCE);
  set(0, 0, b);
}

Nice golf! It's really smart that you used 32 instead of DIFFERENCE. This would be a nice tip for golfing: http://codegolf.stackexchange.com/questions/26809/tips-for-golfing-in-processing :)

Clojure, 300 bytes
(ns s(:import[java.io File][java.awt.image BufferedImage][javax.imageio ImageIO]))(defn -main[](let[a(ImageIO/read(File."a.png"))](doseq[i(range(.getHeight a))j(range(.getWidth a))](.setRGB a j i(bit-xor(.getRGB a j i)(.getRGB(ImageIO/read(File."b.png")) j i))))(ImageIO/write a"png"(File."c.png"))))

Blatant rip-off of the Java answer. I didn't know how to do the challenge, but was curious how well the Java solution translated into Clojure. It was pretty straightforward. The ungolfed code is actually kind of pretty.
This was the first code-golf challenge I've done that included imports. There's probably a way to optimize them to save some bytes.
Ungolfed:
(ns bits.golf.bit-or-picts
  (:import [java.io File]
           [java.awt.image BufferedImage]
           [javax.imageio ImageIO]))

(defn -main []
  (let [^BufferedImage a (ImageIO/read (File. "a.png"))
        ^BufferedImage b (ImageIO/read (File. "b.png"))]
    (doseq [i (range (.getHeight a))
            j (range (.getWidth a))]
      (.setRGB a j i
                (bit-xor (.getRGB a j i)
                         (.getRGB b j i))))
    (ImageIO/write a "png" (File. "c.png"))))

PHP, 246 243 bytes
I can probably golf this down more.
$o=imagecreatetruecolor($w=max(imagesx($a=($i=imagecreatefrompng)($argv[1])),imagesx($b=$i($argv[2]))),$h=max(imagesy($a),imagesy($b)));for(;$k<$w*$h;)imagesetpixel($o,$x=$k%$w,$y=$k++/$w,($t=imagecolorat)($a,$x,$y)^$t($b,$x,$y));imagepng($o);

Run it from the command line like this:
php -d error_reporting=0 -r "$o=imagecreatetruecolor($w=max(imagesx($a=($i=imagecreatefrompng)($argv[1])),imagesx($b=$i($argv[2]))),$h=max(imagesy($a),imagesy($b)));for(;$k<$w*$h;)imagesetpixel($o,$x=$k%$w,$y=$k++/$w,($t=imagecolorat)($a,$x,$y)^$t($b,$x,$y));imagepng($o);" "https://i.stack.imgur.com/UbbfM.png" "https://i.stack.imgur.com/YyZG2.png" > output.png

Defining the function name variables at their first occurence can help: $i=imagecreatefrompng;$a=$i($argv[1]) is one byte longer than $a=($i=imagecreatefrompng)($argv[1]). And you could try palette images with a two color palette.

I tried to define it at the first occurrence but I kept getting a fatal error. I'll try again later when I have time. Maybe I didn't do it correctly.

($f=func)(params) requires PHP 7.

@Titus ah ok thanks. That took me down 3 bytes.

Here are 7 more bytes: Replace for(;$k<$w*$h;) with for(;$y<$h;$y+=1/$w), $x=$k%$w, $y=$k++/$w  with $x, $y and the last $x with $x++. (assuming there are no rounding errors for any reasonable image sizes)

If that doesn´t work, try for(;$y<$h;$y+=!$x), $x%=$w for the first $x and the $x++. (-4 bytes instead of -7)

Node.js, 156 135 bytes
(a,b)=>(f=require('fs')).writeFile(a+b,((s=f.readFileSync)(a)+'').replace(/\d+$/,(c,d)=>[...c].map((e,f)=>+!(e^(s(b)+b)[f+d])).join``))

Input and output image files should be in the PBM (P1) format, where the first line is P1 [width] [height], and the second line is the b/w ascii values without spaces.
Here's a the input images followed by the xor output (32x32 pixels):


text:
Backspace-and-retype a list of words
Here’s how to backspace-and-retype from one string to another:

Start from the first string.
Remove characters at the end until the result is a prefix of the second string. (This may take 0 steps.)
Add characters at the end until the result equals the second string. (This may take 0 steps, too.)

For example, the path from fooabc to fooxyz looks like:
fooabc
fooab
fooa
foo
foox
fooxy
fooxyz

Task
Given a list of words, write a program that backspace-and-retypes its way from the empty string, to all of the words in the list in succession, back to the empty string. Output all intermediate strings.
For example, given the input list ["abc", "abd", "aefg", "h"], the output should be:
a
ab
abc
ab
abd
ab
a
ae
aef
aefg
aef
ae
a

h

Rules
You may return or print a list of strings, or a single string with some delimiter of choice. You may optionally include the initial and final empty strings. The input is guaranteed to contain at least one word, and each word is guaranteed to contain only lowercase ASCII letters (a–z). Edit: consecutive strings in the input are guaranteed not to equal each other.
This is code-golf; shortest code in bytes wins.
A reference implementation in Python 3: Try it online!

I think a and ab should not be in the output of the second test case

@rahnema1 > write a program that backspace-and-retypes its way from the empty string

How would the output be for ["abc","abc"]?

Related

@Emigna Oops, this is exactly that but in a loop! So I’m gonna go ahead and say this is a duplicate of that.

@Lynn It's not exactly the same thing. That one doesn't include recognising the common prefixes, it always goes down to one character.

Oh, I misread the challenge Emigna linked. Maybe this is interesting enough, then!

@KritixiLithos I’ve added a restriction on input saying consecutive strings will always differ.

Test case: a,abc,abcde,abc,a,abc,abcde

Didn't expect to get this irrationally annoyed at this problem. I'll try again tomorrow, wow though... Implementing this with just prefixes() and suffixes() shouldn't be as hard as it is.

Pyth, 25 23 bytes
V+QkWxNk
=Pk)
M>._Nl~kN

Try it online.

Perl, 43 bytes
42 bytes of code + -n flags.
chop$@,say$@while!s/^$@//;s/./say$@.=$&/ge

To run it:
perl -nE 'chop$@,say$@while!s/^$@//;s/./say$@.=$&/ge' <<< "abc
abd
aefg
h"

this prints abc 3 times

@izabera There was a space after abc causing it to be printed 3 times (but actually, the first and third time it was without the space). I removed it.

Java 8, 144 bytes
This one is similar to the reference implementation but combines the two while loops. It's a lambda expression accepting a String[] parameter.
a->{String c="";int l=0,i;for(String w:a)while((i=w.indexOf(c))!=0||!c.equals(w))System.out.println(c=i!=0?c.substring(0,--l):c+w.charAt(l++));}

Ungolfed
a -> {
    String c = "";
    int l = 0, i;
    for (String w : a)
        while ((i = w.indexOf(c)) != 0 || !c.equals(w))
            System.out.println(c = i != 0 ? c.substring(0, --l) : c + w.charAt(l++));
}

Acknowledgments

-38 bytes thanks to CAD97's lambda suggestion

Isn't it cheaper to use class B instead of interface B? You can run from a package-private class. Also, consider using a lambda as you've already specified Java8.

@CAD97 interface B{static void main is shorter than class B{public static void main.

@CAD97 I couldn't think of a way to bring lambdas into this, but I only just learned about them yesterday. Any ideas?

Ah, I'm rusty. You should be able to do a->{/*your code*/}, which will assign to a variable of type java.util.function.Consumer<String[]>. I can't test at the moment, however.

@CAD97 Cool, I got that working. However, the runtime doesn't recognize that Consumer as an entry point to the program.

@JakobCornell By default PPCG allows full program or function submissions. For languages with anonymous functions (lambda), the anonymous function on its own is an acceptable answer (thus you don't have to include the variable to store it to). (Though in Java submissions it's courteous to provide the type of the lambda.)

Mathematica, 149 bytes
Reap[Fold[n=NestWhile;s=StringMatchQ;r=StringReplace;n[k=#2;Sow@r[k,#~~a_~~___:>#<>a]&,n[Sow@r[#,a___~~_:>a]&,#,!s[k,#~~___]&],k!=#&]&,"",#]][[2,1]]&

Retina, 39 bytes
Byte count assumes ISO 8859-1 encoding.
M!&r`.+
%)`\G.
¶$`$&
+`((.*).¶)\2¶\1
$1

Try it online!
Input and output are linefeed-separated lists. Output does include the leading and trailing empty string.

Jelly, 31 29 26 bytes
⁷œ|;\
ÇṚðfḢṭḟ;ḟ@ḊðÇ}
⁷;ç2\

Try it online!
How it works
⁷;ç2\           Main link. Argument: A (string array)

⁷;              Prepend a linefeed to A.
                This is cheaper than prepending an empty string.
  ç2\           Reduce all overlapping pairs by the second helper link.

ÇṚðfḢṭḟ;ḟ@ḊðÇ}  Second helper link. Arguments: s, t (strings)

Ç               Call the first helper link with argument s.
 Ṛ              Reverse the results.
            Ç}  Call the first helper link with argument t.
  ð        ð    Combine everything in between into a dyadic chain, and call it
                with the results to both sides as arguments.
                Let's call the arguments S and T.
   f            Filter; get the common strings of S and T.
    Ḣ           Head; select the first one.
      ḟ         Filterfalse; get the strings in S that do not appear in T.
     ṭ          Tack; append the left result to the right one.
        ḟ@      Filterfalse swap; get the strings in T that do not appear in S.
       ;        Concatenate the results to both sides.
          Ḋ     Dequeue; remove the first string.

⁷œ|;\           First helper link. Argument: s (string)

⁷œ|             Linefeed multiset union; prepend a linefeed to s unless it already
                has a linefeed in it (the first string does).
   ;\           Concatenate cumulative reduce; generate all prefixes of the result.

Haskell, 102 93 91 90 bytes
(?)=take.length
a!x@(b:c)|a==b=b!c|a/=a?b=a:init a!x|d<-'?':a=a:d?b!x
_!x=x
(""!).(++[""])

The last line is an anonymous function, which takes and returns a list of strings.
Try it online!
Explanation
My solution is recursive.
First, ? is a helper infix function: a?b gives the first length a characters of b, or the whole of b if a is longer.
Next I define an infix function !.
The idea is that a!x, where a is a string and x a list of strings, produces the path from a to the first string in x and recurses to the tail of x.
On the final line I define an anonymous function that appends the empty string, then applies ! to the empty string and the input.
Explanation of !:
a!x@(b:c)        -- a!x, where x has head b and tail c:
  |a==b          -- If a equals b,
    =b!c         -- recurse to x.
  |a/=a?b        -- If a is not a prefix of b,
    =a:          -- produce a and
    init a!x     -- continue with one shorter prefix of a.
  |              -- Otherwise a is a proper prefix of b.
   d<-'?':a      -- Let d be a with an extra dummy element,
    =a:          -- produce a and
    d?b!x        -- continue with one longer prefix of b.
_!x=x            -- If x is empty, return x.

Python 2, 118 107 103 97 93 92 bytes
s=''
for i in input()+[s]:
 while i.find(s):s=s[:-1];print s
 while i>s:s+=i[len(s)];print s

Input is given as ['abc', 'abcdef', 'abcfed'], or as ["abc", "abcdef", "abcfed"].
Revision 1: -11 bytes. Credit goes to @xnor for his post on Python golfing tips, and to @Lynn for finding the tip for me, and to me for being smart. Two changes were made: Instead of not s.startswith(i), I used s.find(i), and instead of i!=s I used i>s.
Revision 2: -4 bytes. Credit goes to me realizing I made a really dumb mistake. Instead of using single-tab and double-tab indentation, I used single-space and single-tab indentation.
Revision 3: -6 bytes. Credit goes to @mbomb007 for suggesting to put the whiles on a single line. I also fixed a bug by changing s.find(i) to i.find(s).
Revision 4: -4 bytes. Credit goes to @xnor for realizing that I didn't need to store the input in a variable.
Revision 5: -1 byte. Credit goes to me for realizing that [''] is the same thing as [s] when adding it to the input.

Put the whiles each on a single line. Also, you can use <1 instead of not.

Nice answer! There’s a nice tip by xnor on how to avoid startswith.

@Lynn Oh, thanks for the link! I found it really helpful!

@mbomb007 I'm sorry, I don't quite get what you mean by putting the whiles on a single line. Do you mean like while s.find(i):s=s[:-1];print s? Also, thanks for the suggestion about <1, but I've changed to something even shorter thanks to one of xnor's tips on the Python tips thread.

@AlexL. Yes, put the while's like that.

@mbomb007 Okay. Thanks, that saved 6 bytes!

Could you use s in i instead of i.find(s)?

@mbomb007 No, unfortunately that does not work.

You don't need to save x to a variable, the loop will only take input once.

@xnor Oh wow, how did I not see that? Thanks!

GNU M4, 228 or 232 bytes¹
(¹ depending on whether to end the file with dnl\n or not—I'm still new to both golfing and M4)
define(E,`ifelse(index($2,$1),0,`T($1,$2)',`$1
E(substr($1,0,decr(len($1))),$2)')')define(T,`ifelse($1,$2,,`$1
T(substr($2,0,incr(len($1))),$2)')')define(K,`ifelse($2,,$1,`E($1,$2)K(shift($@))')')define(M,`K(substr($1,0,1),$@)')

Additionally, 3 bytes could be saved by replacing the second argument for substr from 0 to the empty string, but that would produce a lot of warnings on stderr.
Ungolfed:
define(erase_til_prefix, `dnl arguments: src dst; prints src and chops one char off of it until src == dst, at which point it calls type_til_complete instead
ifelse(dnl
index($2, $1), 0, `type_til_complete($1, $2)',dnl
`$1
erase_til_prefix(substr($1, 0, decr(len($1))), $2)dnl
')')dnl
define(type_til_complete, `dnl arguments: src dst; types src, does not type `dst' itself
ifelse(dnl
$1, $2, ,dnl
`$1
type_til_complete(substr($2, 0, incr(len($1))), $2)'dnl
)')dnl
define(main_, `dnl
ifelse(dnl
$2, , $1, dnl no arguments left
`erase_til_prefix($1, $2)main_(shift($@))'dnl
)')dnl
define(main, `main_(substr($1, 0, 1), $@)')dnl

Usage:
$ m4 <<<"include(\`backspace-golfed.m4')M(abc, abd, aefg, abcdefg, h)"

Batch, 296 291 bytes
@echo off
set f=
set t=%1
:t
set f=%f%%t:~,1%
set t=%t:~1%
echo(%f%
if not "%t%"=="" goto t
shift
set t=%1
set s=%f%
set p=
:h
if %s:~,1%==%t:~,1% set p=%p%%t:~,1%&set s=%s:~1%&set t=%t:~1%&goto h
:b
set f=%f:~,-1%
echo(%f%
if not "%f%"=="%p%" goto b
if not "%1"=="" goto t

Computing the common prefix was cumbersome.

PHP, 116 111 101 83 bytes
Note: uses Windows-1252 encoding.
for(;$w=$argv[++$i];)for(;$c!=$w;)echo$c=($c^$c^$w)==$c?$c.ÿ&$w:substr($c,0,-1),~õ;

Run like this:
php -r 'for(;$w=$argv[++$i];)for(;$c!=$w;)echo$c=($c^$c^$w)==$c?$c.ÿ&$w:substr($c,0,-1),~õ;' -- abc abd aefg h 2>/dev/null
> a
> ab
> abc
> ab
> abd
> ab
> a
> ae
> aef
> aefg
> aef
> ae
> a
>
> h

Explanation
for(                       # Outer loop.
  ;
  $w=$argv[++$i];          # Loops over the input words.
)
  for(                     # Second inner loop.
    ;
    $c!=$w;                # Loop until the word was output.
  )
    echo $c=
      ($c^$c^$w)==$c?      # Check if last output string is a substring
                           # match with the next word to output.
        $c.ÿ&$w:           # ... If yes, suffix the string with the next
                           # char of the word, and output the result.
        substr($c,0,-1),   # ... If not, remove a char and output.
      ~õ;                  # Output newline.

Tweaks

Saved 5 bytes by using trim($c^$w,"\0") to check for substring match instead of $c&&strpos($w,$c)!==0.
Saved 2 bytes by using ~ÿ to yield a string with a NUL byte instead of "\0"
Saved 8 bytes by using $c=$c.ÿ&$w to suffix $c with the next char of $w
Saved a massive 18 bytes by combining the logic of the 2 inner loops in a single loop
Fixed a bug with a testcase from the comments, no change in byte count

Pip, 33 30 bytes
FsgAExTyQsYPyQs@<#y?y.s@#y;@<y

Try it online!
Explanation
                                g is list of cmdline args; x & y are "" (implicit)
Fs                              For each s in
  gAEx                          g with an empty string appended:
      TyQs                       Do this till y equals s:
              s@<                 Get the prefix of s
                 #y               having the same length as y
            yQ                    and check if it equals y
                   ?              If so (y is a prefix of s), calculate:
                    y.             y, concatenated with
                      s@           the character in s at index
                        #y         len(y)
                          ;       If not, calculate:
                           @<y     y without its last character
          YP                      Print that quantity and yank it back into y

PHP, 153 bytes
awfully long :(
for($s=$argv[$k=1];$t=$argv[++$k];){for(;$s>""&&strstr($t,$s)!=$t;$s=substr($s,0,-1))echo"$s
";for($i=strlen($s);$s<$t;$s.=$t[$i++])echo"$s
";echo"$s
";}

Run with php -nr '<ode>' <text1> <text2> ....

JavaScript (ES6), 135 bytes
Interesting challenge! Usage: g(["abc", "abd", "aefg", "h"]). I couldn't seem to save any bytes by writing this as one function, so it's two. Newlines not included in byte count.
f=a=>console.log(([,...z]=[x,y]=a)[0])||
y?f(a=(x==y.slice(0,-1))?z:([y.match(x)
?x+y[x.length]:x.slice(0,-1),...z])):1;
g=a=>f(['',...a])

I'm sure this can be reduced a lot more. Will add ungolfed version later.

Javascript, 98 bytes
a=>{c="",l=0;for(w of a)while((i=w.indexOf(c))!=0||c!=w)alert(c=i!=0?c.substring(0,--l):c+w[l++])}

Port of Jakob's Java answer


text:
The highest prime factor of neighboring numbers
I think it's easiest to explain this challenge in a sequential manner. Start with an input number \$N\$ and:

Find its highest prime factor
Check numbers above and below \$N\$ and see if the highest prime factor is higher (i.e. the highest prime factor of \$N-1\$ and/or \$N+1\$ is higher than the factor of \$N\$.
Continue to check higher and/or lower numbers neighboring \$N\$ in the directions where the highest factors are increasing (\$(N-2, N-3 ...)\$ and/or \$(N+2, N+3 ...)\$ and so on)
Once there aren't any prime factors in either direction that are higher than the ones we've already found we stop and output the highest prime factor we have encountered.

Let's look at an example:
245 has the prime factors 5, 7, 7. Its neighbors are:
244 -> 2,  2,  61
245 -> 5,  7,  7
246 -> 2,  3,  41

The highest prime factor is increasing in both direction, so we must look at the next neighbor:
243 -> 3,   3,  3,  3,  3
244 -> 2,   2,  2,  61
245 -> 5,   7,  7
246 -> 2,   3,  41
247 -> 13,  19

The highest prime factors are now decreasing in both direction, so the highest prime factor we've encountered is 61, and should therefore be returned.
Another example:
Let's look at 1024. Its prime factors are 2, 2, 2, 2, 2, 2, 2, 2, 2, 2.
The prime factors of its nearest neighbors are:
1023 -> 3, 11, 31
1024 -> 2,  2,  2,  2,  2,  2,  2,  2,  2,  2
1025 -> 5,  5, 41

The highest prime factor are increasing in both direction, from 2 to 31 or 41. Let's look at the neighbors:
1022 -> 2, 7,  73
1023 -> 3, 11, 31
1024 -> 2,  2,  2,  2,  2,  2,  2,  2,  2,  2
1025 -> 5,  5, 41
1026 -> 2,  3,  3, 19

The highest prime factor for 1022 is 73, and the highest prime factor for 1026 is 19. Since 19 is lower than 41 we're not interested in it. It's still increasing for numbers smaller than \$N\$, so we'll check the next one in that direction:
1021 -> 1021
1022 -> 2, 7,  73
1023 -> 3, 11, 31
1024 -> 2,  2,  2,  2,  2,  2,  2,  2,  2,  2
1025 -> 5,  5, 41
1026 -> 2,  3,  3, 19

1021 is a prime, and the highest prime we've encountered, so it should be returned.
Rules:

You will only get positive \$N\$ larger than \$1\$ and smaller than \$2^{31}-2\$.
Input and output formats are optional, but the numbers must be in base 10.
You should continue searching for higher primes as long as the highest value is increasing in that direction. The directions are independent of each other.

Test cases:
Format: N, highest_factor
2, 3
3, 3
6, 7
8, 11
24, 23
1000, 997
736709, 5417
8469038, 9431

Let's say we get a highest prime factor of2 for N. We then get 5 for N-1 and 61 for N+1. Then we get 19 for N-2 and 67 for N+2. Should we keep trying lower numbers, since 19>5 or stop, since 5<61? I.e. are the maxima kept per-side? (I'm not sure if the example is mathematically possible.)

@Pietu1998, is the question more clear now?

N=2 actually seems to be an edge case since 1 has no prime factors, so no maximum prime factor with which we may compare in order to decide whether we should continue.

Mathematica, 82 74 bytes
Thanks to Martin Ender for saving 8 bytes!
Max@@(±n_:=#//.x_/;l[t=x+n]>l@x:>t;l=FactorInteger[#][[-1,1]]&)/@{±-1,±1}&

Unnamed function taking an integer input and returning an integer.
±n_:=#//.x_/;l[t=x+n]>l@x:>t defines a unary function ± which keeps increasing the global function's integer input by n as long as the largest prime factor is increasing. (The largest-prime-factor function is defined with l=FactorInteger[#][[-1,1]]&.) {±-1,±1} therefore applies that function twice to the input integer, with increment -1 and again with increment 1. Then, Max@@(...l...)/@... takes the larger of the two largest-prime-factors thus found.
Previous submission:
Max@@(l=FactorInteger[#][[-1,1]]&)/@(#//.x_/;l[t=x+#2]>l[x]:>t&@@@{{#,-1},{#,1}})&

Saved a few bytes by avoiding the @@@ (and you can use l@x there): Max@@(±n_:=#//.x_/;l[t=x+n]>l@x:>t;l=FactorInteger[#][[-1,1]]&)/@{±-1,±1}&

Perl, 137 bytes
122 bytes of code + 15 bytes for -p and -Mntheory=:all.
sub f{$t=(factor$_+pop)[-1]}$i=$j=1;while($i|$j){f++$c;($i&=$t>$h)&&($h=$t);f-$c;($j&=$t>$l)&&($l=$t)}$_=$h>$l?$h:$l?$l:$_

To run it:
perl -pMntheory=:all -e 'sub f{$t=(factor$_+pop)[-1]}$i=$j=1;while($i|$j){f++$c;($i&=$t>$h)&&($h=$t);f-$c;($j&=$t>$l)&&($l=$t)}$_=$h>$l?$h:$l?$l:$_' <<< 736709

If you don't have ntheory installed, you can install it by typing (echo y;echo) | perl -MCPAN -e 'install ntheory' in your terminal.

Ruby, 99 bytes
->n{f=->n{i=2;n%i<1?n/=i:i+=1while i<n;n};g=->s,z{s+=z while f[s+z]>b=f[s];b};[g[n,1],g[n,-1]].max}

Explanation:

f() is the highest prime factor
g() is the function searching neighbors in one direction
apply g to (n,-1) and to (n,+1) to search in both directions

Jelly, 24 bytes
;‘ÆfṀ€>/
ÇÐḟṖ‘,Ç1#Ṫ€ÆfFṀ

Try it online!
Bleh
How it works
;‘ÆfṀ€>/ - Helper link. Takes n on the left
 ‘       - Yield n+1
;        - Pair; [n, n+1]
  Æf     - Prime factors of each
    Ṁ€   - Maximum of each
      >/ - Is max(pf(n)) > max(pf(n+1))?

ÇÐḟṖ‘,Ç1#Ṫ€ÆfFṀ - Main link. Takes N on the left
ÇÐḟ             - Remove all integers 1 ≤ k ≤ N which return true under the helper link
   Ṗ            - Remove the last one (N)
    ‘           - Increment all
      Ç1#       - Find the first integer ≥ N which the helper link returns true
     ,          - Pair
         Ṫ€     - Get the last element of each
                   This returns [x, y] where
                    x is the lower neighbour with the highest prime factor,
                    y is the upper neighbour with the highest prime factor
           Æf   - Prime factors of each
             FṀ - Flatten and get the maximum

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