ODOMETER FUN

When's the next time all the numbers on your odometer will be different???

******* HERE IT IS - THE HALLOWEEN PROGRAMMER OF THE MONTH (POTM) *******
	(this one is easy (ha!) so I expect EVERYONE to enter!!!)

   ******* THE ODOMETER CHALLENGE - deadline 10/31/93 at 23:59EST *******

My dashboard (vintage 1986 Oldsmobile Custom Cruiser wood-grained wagon)
	has two mile-measuring thingys on it:

A) an odometer that measures how many miles my car has traveled 
	since it was born;

                [_][_][_][_][_][_]       <-- this is A

B) a "trip" odometer that measures how many miles the car has
	traveled since I last set it to zero by pushing a button.

                      [_][_][_][_]  *    <-- this is B  (* is the button!)

   But the button is broken, and I can no longer reset it to 0000 !

Well, I often look at my dashboard, and the other day it looked like:

                 9  0  5  8  7  4
                       1  3  6  2  *

 The numbers were all different.  I was truly amazed.  I wondered how far
 I would have to travel before this happened again.  When it wasn't obvious
 how to figure this out ... I thought this might be worthy of the POTM crew!

========= IF YOU'RE INTERESTED ... READ ON FOR THE GORY DETAILS.  IF NOT,
========= MAYBE WE'LL GET YOU INTERESTED IN THE NEXT POTM !!!!

    Ahhhh ... reading on are we????    GREAT!

1.  You must write a program that will take a file path as the input argument.

2.  The input file will contain (at most) 1000 lines.

3.  Each line of the input file contains two numbers as follows:
		ABCDEF GHIJ
    Where ABCDEF represents the odometer, and GHIJ represents the trip odometer,
	they are separated by a space and the line ends with a C/R.

4.  Your program must output a single line of output for each input line
	which tells me how many miles I have to go before my odometers
	(together) display all 10 digits!

5.  The winner is the program that finds the 1000 correct (smallest) 
	solutions to the 1000 situations described in a final test file.
	
	Ties will be decided based on speed and on size of the source code.

There.  Wasn't that much easier than the LAST POTM???  No excuse not to enter
this one is there???  Why, you can practically see your name on the coveted
Programmer Of The Month trophy can't you????

==========  The fine print ....

1.  You can write in any language you want, using any tools you want, as
	long as I can get it to compile on my machine ... homxb (an Amdahl).
	(But if I think you're cheating ... I'll simply disqualify you!!!)

2.  ABCDEF and GHIJ will all be chosen from [0-9] .... there will be a single
	space between the two strings.  Leading zeroes will be given.

3.  About my odometers:

	a) forget about tenths of miles ... assume everything is miles
		("012345 0000" implies 12,345 miles ... it's just easier ...
		  no decimal points ... this is the POTM, not the real world!)
	b) they work like the ones in your car ... if you go a "mile", both
		of them increment by a "mile"
	c) both the odometer and "trip" odometer "roll over" as expected,
		from 999999 to 000000 and from 9999 to 0000
	d) don't even consider what happens when the odometers are "in the
		middle" of changing, with half numbers showing.  Just don't.
	e) no resets, no fiddling, no cheating, no mechanical messing,
		no going backwards, no fixing the reset, etc.

4.  The "correct answers" must be output as one of the following:

	a) a number >0 indicating how far you have to travel before 
		10 different digits are displayed.
	b) "0" (a lone zero) if the input already displays all 10 digits.
	c) -1 if it is not possible to EVER get to a display that shows
		all ten digits - no matter HOW far I travel.

5.  A perfect score is 1000 points.  Where a point is awarded if the program
	correctly output a "0" or a "-1", or if it output the smallest
	possible solution to the presented problem.

6.  In the event of ties (which I suspect will be likely), I will add together
	two program attributes as follows to resolve them:

	T = hundredths of seconds sys+user time to solve the 1000 problems
		(as measured by timex on my machine)

	S = ls -l of your source code (or shell/awk/etc.)

	Smallest T+S wins the tiebreaker.  Further (unlikely) ties will be
		awarded to the earliest entry!  (Note: since timex may vary
		from run-to-run, a (T+S) difference <= 3 will be considered
		a tie and the earliest entry rule applied.  The date of
		an entry is the date the FINAL entry arrives on homxb.)

7. Some examples perhaps, for any of you who may still be confused ....

		ABCDEF GHIJ		Correct answer:

		123455 7889			 1
		012333 6777			12
		167834 2590			 0 (already a winner!)
		000000 0000			-1 (no possible solution)
		788040 7906		     38007
		899934 2333		    223536

   For the tiebreaker, let's say "ls -l xxx.c" yields 500 characters, and
   timex shows you used 22.11 sec.(S+U) to solve the 1000 final problems.
   Your tiebreaker score is thus 500 + 2211 = 2711.

8. Source code must be in a single file.  Standard include files may be used
   but no "personal" include files are allowed.  Putting your entire program
   in the makefile is called CHEATING, as will any other tricks people have
   used to make their program source abnormally small.  I decide!!!  Standard
   libraries are OK provided I have access to them on homxb.

=================  TO ENTER ....

Simply uuto me a copy of your source code at homxb!fah (or email to me
  at homxb!fah or attmail!hicinbothem or fah@homxb.att.com) 
Then send me some email telling me how to compile it. 
  (shell scripts, awks, etc. are also welcome!)

I must have the entry on my machine by the last minute of October, 1993.

SUBMIT EARLY - you can then resolve any compilation difficulties, AND,
	you will get weekly leaderboard results of my system tests.

	I will run your program through a system test consisting of 100
	(rather than 1000) random odometer settings and tell you how you did!
	(Note that the finals will NOT be random - I will pick them!)

	You may submit as often as you like, but only the LAST one will count.
	One entry per email address please.  Thanks!!

HEY!   Hope to see your entry real soon .... 

=Fred		homxb!fah	attmail!hicinbothem	fah@homxb.att.com