From MAILER-DAEMON Sat Feb 24 20:03:51 2001
Date: 24 Feb 2001 20:03:51 -0500
From: Mail System Internal Data <MAILER-DAEMON@east.isx.com>
Subject: DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA
X-IMAP: 0983063031 0000000000
Status: RO

This text is part of the internal format of your mail folder, and is not
a real message.  It is created automatically by the mail system software.
If deleted, important folder data will be lost, and it will be re-created
with the data reset to initial values.

From judge@east.isx.com Thu Feb 22 19:52:13 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id TAA10739
	for <judge@east.isx.com>; Thu, 22 Feb 2001 19:52:12 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id UAA05104
	for <judge@east.isx.com>; Thu, 22 Feb 2001 20:02:36 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id UAA19730
	for judge@east.isx.com; Thu, 22 Feb 2001 20:02:35 -0500 (EST)
Date: Thu, 22 Feb 2001 20:02:35 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: family
Message-ID: <20010222200234.A19700@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="LZvS9be/3tNcYl/X"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 1095


--LZvS9be/3tNcYl/X
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--LZvS9be/3tNcYl/X
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="family.java"

import java.io.*;
import java.util.*;

class family{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("family.in"));
		out = new PrintWriter(new FileWriter("family.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();

		while(line != null && !line.equals("#")) {
			boolean doubleletter = false;
			for(int i=0; i < line.length() - 1; i++) {
				if(line.charAt(i) == line.charAt(i+1)) {
					doubleletter = true;
				}
			}
			out.print(line);
			out.print(spaces.substring(0, 23 - line.length());
			if(doubleletter) out.print("yes");
			else out.print(" no");
			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}
}

--LZvS9be/3tNcYl/X--

From judge@east.isx.com Thu Feb 22 20:06:14 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id UAA11044
	for <judge@east.isx.com>; Thu, 22 Feb 2001 20:06:13 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id UAA06104
	for <judge@east.isx.com>; Thu, 22 Feb 2001 20:16:38 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id UAA20176
	for judge@east.isx.com; Thu, 22 Feb 2001 20:16:37 -0500 (EST)
Date: Thu, 22 Feb 2001 20:16:37 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: amicable
Message-ID: <20010222201637.B19700@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="gatW/ieO32f1wygP"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 1901


--gatW/ieO32f1wygP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--gatW/ieO32f1wygP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="amicable.java"

import java.io.*;
import java.util.*;

class  amicable
{
	public amicable() {
		try {
			BufferedReader in = new BufferedReader(new FileReader("amicable.in"));
			PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("amicable.out")));

			String line;
			StringTokenizer st;
			int n1, n2, sum1, sum2, i;

			while((line = in.readLine()) != null) {
				st = new StringTokenizer(line);

				if (st.hasMoreTokens()) {
					n1 = Integer.parseInt(st.nextToken());
				}
				else {
					throw new Exception("ex1");
				}

				if (st.hasMoreTokens()) {
					n2 = Integer.parseInt(st.nextToken());
				}
				else {
					throw new Exception("ex2");
				}

				if (n1 == 0 && n2 == 0)
				{
					break;
				}

				for (i = 1, sum1 = 0; i <= n1/2;i++)
				{
					if ((n1 % i) == 0)
					{
						sum1 += i;
					}
				}

				for (i = 1, sum2 = 0; i <= n2/2;i++)
				{
					if ((n2 % i) == 0)
					{
						sum2 += i;
					}
				}
				
				
				if (n1 < 1000)
				{
					out.print(" ");
				}
				if (n1 < 100)
				{
					out.print(" ");
				}
				if (n1 < 10)
				{
					out.print(" ");
				}
				out.print(" " + n1);
				if (n2 < 1000)
				{
					out.print(" ");
				}
				if (n2 < 100)
				{
					out.print(" ");
				}
				if (n2 < 10)
				{
					out.print(" ");
				}
				out.print(" " + n2 + " ");


				if (sum1 == n2 && sum2 == n1)
				{
					out.println("yes");
				}
				else {
					out.println("no");
				}
			}

			in.close();
			out.close();
		} catch(Exception e) {
			System.out.println("my exception");
			e.printStackTrace();
		}

	}




	public static void main(String[] args) 
	{
		new amicable();
	}
}

--gatW/ieO32f1wygP--

From judge@east.isx.com Thu Feb 22 20:07:55 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id UAA11070
	for <judge@east.isx.com>; Thu, 22 Feb 2001 20:07:54 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id UAA06260
	for <judge@east.isx.com>; Thu, 22 Feb 2001 20:18:20 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id UAA20259
	for judge@east.isx.com; Thu, 22 Feb 2001 20:18:19 -0500 (EST)
Date: Thu, 22 Feb 2001 20:18:19 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: family
Message-ID: <20010222201818.C19700@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="Y5rl02BVI9TCfPar"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 1098


--Y5rl02BVI9TCfPar
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--Y5rl02BVI9TCfPar
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="family.java"

import java.io.*;
import java.util.*;

class family{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("family.in"));
		out = new PrintWriter(new FileWriter("family.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();

		while(line != null && !line.equals("#")) {
			boolean doubleletter = false;
			for(int i=0; i < line.length() - 1; i++) {
				if(line.charAt(i) == line.charAt(i+1)) {
					doubleletter = true;
				}
			}
			out.print(line);
			out.print( spaces.substring(0, 23 - line.length()) );
			if(doubleletter) out.print("yes");
			else out.print(" no");
			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}
}

--Y5rl02BVI9TCfPar--

From judge@east.isx.com Thu Feb 22 20:30:08 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id UAA11912
	for <judge@east.isx.com>; Thu, 22 Feb 2001 20:30:04 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id UAA07758
	for <judge@east.isx.com>; Thu, 22 Feb 2001 20:40:30 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id UAA21027
	for judge@east.isx.com; Thu, 22 Feb 2001 20:40:29 -0500 (EST)
Date: Thu, 22 Feb 2001 20:40:29 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: family
Message-ID: <20010222204029.D19700@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="48TaNjbzBVislYPb"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 1102


--48TaNjbzBVislYPb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--48TaNjbzBVislYPb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="family.java"

import java.io.*;
import java.util.*;

class family{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("family.in"));
		out = new PrintWriter(new FileWriter("family.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();

		while(line != null && !line.equals("#")) {
			boolean doubleletter = false;
			for(int i=0; i < line.length() - 1; i++) {
				if(line.charAt(i) == line.charAt(i+1)) {
					doubleletter = true;
				}
			}
			out.print(line);
			out.print( spaces.substring(0, 23 - line.length()) );
			if(doubleletter) out.println("yes");
			else out.println(" no");
			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}
}

--48TaNjbzBVislYPb--

From judge@east.isx.com Thu Feb 22 20:33:55 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id UAA12142
	for <judge@east.isx.com>; Thu, 22 Feb 2001 20:33:54 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id UAA08067
	for <judge@east.isx.com>; Thu, 22 Feb 2001 20:44:19 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id UAA21201
	for judge@east.isx.com; Thu, 22 Feb 2001 20:44:17 -0500 (EST)
Date: Thu, 22 Feb 2001 20:44:17 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: grants
Message-ID: <20010222204417.E19700@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="nHwqXXcoX0o6fKCv"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 1731


--nHwqXXcoX0o6fKCv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--nHwqXXcoX0o6fKCv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="grants.java"

import java.io.*;
import java.util.*;

class grants{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("grants.in"));
		out = new PrintWriter(new FileWriter("grants.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();

		while(line != null && !line.equals("0 0")) {
			StringTokenizer foo = new StringTokenizer(line);
			int N = foo.nextToken();
			int k = foo.nextToken();
			int nextstore = 1;
			int studnum = 0;

			Vector students = new Vector;

			for(int i=0; i<N; i++) {
				students.add(new student(i));
			}

			while(students.size() != 0) {
				student currstudent = students.elementAt(studnum);
				if(store == 0) {
					store = nextstore % k;
					nextstore++;
				}
				
				if(40 - currstuden.sum >= store) { 
					currstudent.sum += store;
				} else {
					currstudent.sum = 40;
					store = store - (40 - currstudent.sum);
				}

				if(currstudent.sum == 40) {
					students.remove(currstudent);
					out.print( spaces.substring(0, 2 - ("" + currstudent.num).length()) +
						currstudent.num;
					);
				}
				
				else(studnum = (studnum + 1) % students.size());
			}
			out.println("");
			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}
}
class student
{
	int num;
	int sum=0;

	public student(int num) {
		this.num = num;
	}
};
--nHwqXXcoX0o6fKCv--

From judge@east.isx.com Thu Feb 22 20:40:19 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id UAA12336
	for <judge@east.isx.com>; Thu, 22 Feb 2001 20:40:17 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id UAA08652
	for <judge@east.isx.com>; Thu, 22 Feb 2001 20:50:43 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id UAA21382
	for judge@east.isx.com; Thu, 22 Feb 2001 20:50:42 -0500 (EST)
Date: Thu, 22 Feb 2001 20:50:42 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: grants
Message-ID: <20010222205041.F19700@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="qftxBdZWiueWNAVY"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 1758


--qftxBdZWiueWNAVY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--qftxBdZWiueWNAVY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="grants.java"

import java.io.*;
import java.util.*;

class grants{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("grants.in"));
		out = new PrintWriter(new FileWriter("grants.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();

		while(line != null && !line.equals("0 0")) {
			StringTokenizer foo = new StringTokenizer(line);
			int N = foo.nextToken();
			int k = foo.nextToken();
			int nextstore = 1;
			int studnum = 0;

			Vector students = new Vector();

			for(int i=0; i<N; i++) {
				students.add(new student(i));
			}

			while(students.size() != 0) {
				student currstudent = students.elementAt(studnum);
				if(store == 0) {
					store = nextstore % k;
					nextstore++;
				}
				
				if(40 - currstuden.sum >= store) { 
					currstudent.sum += store;
				} else {
					currstudent.sum = 40;
					store = store - (40 - currstudent.sum);
				}

				if(currstudent.sum == 40) {
					students.remove(currstudent);
					out.print( spaces.substring(0, 2 - ("" + currstudent.num).length()) +
						currstudent.num
					);
				}
				
				else{ 
					studnum++;  
					studnum = (studnum) % students.size();
				}
			}
			out.println("");
			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}
}
class student
{
	int num;
	int sum=0;

	public student(int num) {
		this.num = num;
	}
};
--qftxBdZWiueWNAVY--

From judge@east.isx.com Thu Feb 22 20:42:35 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id UAA12466
	for <judge@east.isx.com>; Thu, 22 Feb 2001 20:42:33 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id UAA08720
	for <judge@east.isx.com>; Thu, 22 Feb 2001 20:53:00 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id UAA21467
	for judge@east.isx.com; Thu, 22 Feb 2001 20:52:59 -0500 (EST)
Date: Thu, 22 Feb 2001 20:52:59 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: grants
Message-ID: <20010222205258.G19700@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="qoTlaiD+Y2fIM3Ll"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 1759


--qoTlaiD+Y2fIM3Ll
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--qoTlaiD+Y2fIM3Ll
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="grants.java"

import java.io.*;
import java.util.*;

class grants{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("grants.in"));
		out = new PrintWriter(new FileWriter("grants.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();

		while(line != null && !line.equals("0 0")) {
			StringTokenizer foo = new StringTokenizer(line);
			int N = foo.nextToken();
			int k = foo.nextToken();
			int nextstore = 1;
			int studnum = 0;

			Vector students = new Vector();

			for(int i=1; i<=N; i++) {
				students.add(new student(i));
			}

			while(students.size() != 0) {
				student currstudent = students.elementAt(studnum);
				if(store == 0) {
					store = nextstore % k;
					nextstore++;
				}
				
				if(40 - currstuden.sum >= store) { 
					currstudent.sum += store;
				} else {
					currstudent.sum = 40;
					store = store - (40 - currstudent.sum);
				}

				if(currstudent.sum == 40) {
					students.remove(currstudent);
					out.print( spaces.substring(0, 2 - ("" + currstudent.num).length()) +
						currstudent.num
					);
				}
				
				else{ 
					studnum++;  
					studnum = (studnum) % students.size();
				}
			}
			out.println("");
			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}
}
class student
{
	int num;
	int sum=0;

	public student(int num) {
		this.num = num;
	}
};
--qoTlaiD+Y2fIM3Ll--

From judge@east.isx.com Thu Feb 22 20:48:46 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id UAA12721
	for <judge@east.isx.com>; Thu, 22 Feb 2001 20:48:43 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id UAA09092
	for <judge@east.isx.com>; Thu, 22 Feb 2001 20:59:10 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id UAA21695
	for judge@east.isx.com; Thu, 22 Feb 2001 20:59:08 -0500 (EST)
Date: Thu, 22 Feb 2001 20:59:08 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: grants
Message-ID: <20010222205908.H19700@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="smOfPzt+Qjm5bNGJ"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 1822


--smOfPzt+Qjm5bNGJ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--smOfPzt+Qjm5bNGJ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="grants.java"

import java.io.*;
import java.util.*;

class grants{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("grants.in"));
		out = new PrintWriter(new FileWriter("grants.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();

		while(line != null && !line.equals("0 0")) {
			StringTokenizer foo = new StringTokenizer(line);
			int N = Integer.parseInt(foo.nextToken());
			int k = Integer.parseInt(foo.nextToken());
			int nextstore = 1;
			int studnum = 0;
			int store = 0;

			Vector students = new Vector();

			for(int i=1; i<=N; i++) {
				students.add(new student(i));
			}

			while(students.size() != 0) {
				student currstudent = (student)students.elementAt(studnum);
				if(store == 0) {
					store = nextstore % k;
					nextstore++;
				}
				
				if(40 - currstuden.sum >= store) { 
					currstudent.sum += store;
				} else {
					currstudent.sum = 40;
					store = store - (40 - currstudent.sum);
				}

				if(currstudent.sum == 40) {
					students.remove(currstudent);
					out.print( spaces.substring(0, 2 - ("" + currstudent.num).length()) +
						currstudent.num
					);
				}
				
				else{ 
					studnum++;  
					studnum = (studnum) % students.size();
				}
			}
			out.println("");
			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}
}
class student
{
	int num;
	int sum=0;

	public student(int num) {
		this.num = num;
	}
};
--smOfPzt+Qjm5bNGJ--

From judge@east.isx.com Thu Feb 22 21:00:07 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id VAA13031
	for <judge@east.isx.com>; Thu, 22 Feb 2001 21:00:06 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id VAA09846
	for <judge@east.isx.com>; Thu, 22 Feb 2001 21:10:27 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id VAA22151
	for judge@east.isx.com; Thu, 22 Feb 2001 21:10:26 -0500 (EST)
Date: Thu, 22 Feb 2001 21:10:26 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: grants
Message-ID: <20010222211025.A21726@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="IS0zKkzwUGydFO0o"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 1822


--IS0zKkzwUGydFO0o
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--IS0zKkzwUGydFO0o
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="grants.java"

import java.io.*;
import java.util.*;

class grants{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("grants.in"));
		out = new PrintWriter(new FileWriter("grants.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();

		while(line != null && !line.equals("0 0")) {
			StringTokenizer foo = new StringTokenizer(line);
			int N = Integer.parseInt(foo.nextToken());
			int k = Integer.parseInt(foo.nextToken());
			int nextstore = 1;
			int studnum = 0;
			int store = 0;

			Vector students = new Vector();

			for(int i=1; i<=N; i++) {
				students.add(new student(i));
			}

			while(students.size() != 0) {
				student currstudent = (student)students.elementAt(studnum);
				if(store == 0) {
					store = nextstore % k;
					nextstore++;
				}
				
				if(40 - currstuden.sum >= store) { 
					currstudent.sum += store;
				} else {
					currstudent.sum = 40;
					store = store - (40 - currstudent.sum);
				}

				if(currstudent.sum == 40) {
					students.remove(currstudent);
					out.print( spaces.substring(0, 2 - ("" + currstudent.num).length()) +
						currstudent.num
					);
				}
				
				else{ 
					studnum++;  
					studnum = (studnum) % students.size();
				}
			}
			out.println("");
			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}
}
class student
{
	int num;
	int sum=0;

	public student(int num) {
		this.num = num;
	}
};
--IS0zKkzwUGydFO0o--

From judge@east.isx.com Thu Feb 22 21:03:33 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id VAA13268
	for <judge@east.isx.com>; Thu, 22 Feb 2001 21:03:31 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id VAA10214
	for <judge@east.isx.com>; Thu, 22 Feb 2001 21:13:59 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id VAA22310
	for judge@east.isx.com; Thu, 22 Feb 2001 21:13:58 -0500 (EST)
Date: Thu, 22 Feb 2001 21:13:58 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: grants
Message-ID: <20010222211357.B21726@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="dTy3Mrz/UPE2dbVg"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 1823


--dTy3Mrz/UPE2dbVg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--dTy3Mrz/UPE2dbVg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="grants.java"

import java.io.*;
import java.util.*;

class grants{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("grants.in"));
		out = new PrintWriter(new FileWriter("grants.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();

		while(line != null && !line.equals("0 0")) {
			StringTokenizer foo = new StringTokenizer(line);
			int N = Integer.parseInt(foo.nextToken());
			int k = Integer.parseInt(foo.nextToken());
			int nextstore = 1;
			int studnum = 0;
			int store = 0;

			Vector students = new Vector();

			for(int i=1; i<=N; i++) {
				students.add(new student(i));
			}

			while(students.size() != 0) {
				student currstudent = (student)students.elementAt(studnum);
				if(store == 0) {
					store = nextstore % k;
					nextstore++;
				}
				
				if(40 - currstudent.sum >= store) { 
					currstudent.sum += store;
				} else {
					currstudent.sum = 40;
					store = store - (40 - currstudent.sum);
				}

				if(currstudent.sum == 40) {
					students.remove(currstudent);
					out.print( spaces.substring(0, 2 - ("" + currstudent.num).length()) +
						currstudent.num
					);
				}
				
				else{ 
					studnum++;  
					studnum = (studnum) % students.size();
				}
			}
			out.println("");
			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}
}
class student
{
	int num;
	int sum=0;

	public student(int num) {
		this.num = num;
	}
};
--dTy3Mrz/UPE2dbVg--

From judge@east.isx.com Thu Feb 22 21:26:24 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id VAA14125
	for <judge@east.isx.com>; Thu, 22 Feb 2001 21:26:23 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id VAA11786
	for <judge@east.isx.com>; Thu, 22 Feb 2001 21:36:51 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id VAA23057
	for judge@east.isx.com; Thu, 22 Feb 2001 21:36:50 -0500 (EST)
Date: Thu, 22 Feb 2001 21:36:50 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: grocer
Message-ID: <20010222213650.C21726@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="VywGB/WGlW4DM4P8"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 3567


--VywGB/WGlW4DM4P8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--VywGB/WGlW4DM4P8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="grocer.java"

import java.io.*;
import java.util.*;

class  grocer
{
	public grocer() {
		try
		{
			BufferedReader in = new BufferedReader(new FileReader("grocer.in"));
			PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("grocer.out")));

			String line;
			StringTokenizer st;
			item[] items = new item[100];
			int next = 0;

			while((line = in.readLine()) != null) {
				st = new StringTokenizer(line, " =");
				item cur = new item();

				if (st.hasMoreTokens()) {
					cur.name = st.nextToken();
				}
				else {
					throw new Exception ("e1");
				}

				if (st.hasMoreTokens()) {
					String tmp = st.nextToken();
					try
					{
						cur.value = Integer.parseInt(tmp);
					}
					catch (Exception f)
					{
						cur.from = tmp;
					}
				}
				else {
					throw new Exception("e2");
				}

				if (st.hasMoreTokens())
				{
					if (st.nextToken().compareTo("+") == 0)
					{
						cur.plus = true;
					}
					else {
						cur.plus = false;
					}

					if (st.hasMoreTokens())
					{
						tmp = st.nextToken();
						cur.change = Integer.parseInt(tmp);
					}
					else {
						throw new Exception("e3");
					}
				}

				items[next] = cur;
				next++;
			}

			int i, j;
			boolean found;

			for (i = 0; i < next; i++) {
				found = false;
				for (j = 0; j < next; j++) {
					// make sure change is computed
					if (items[j].from == null) {
						if (items[j].plus) {
							items[j].value += items[j].change;
						}
						else {
							items[j].value -= items[j].change;
						}
						items[j].change = 0;
					}

					if (items[i].from == null) {
						found = true;
						break;
					}
					else {
						if (items[i].from.compareTo(items[j].name) == 0) {
							if (items[j].from == null)
							{
								items[i].value = items[j].value;
								items[i].from = null;
								if (items[i].plus) {
									items[i].value += items[i].change;
								}
								else {
									items[i].value -= items[i].change;
								}
								items[i].change = 0;
							}
							else {
								items[i].from = items[j].from;
								j = 0;
							}
							found = true;
						}
					}


				}
				if (found == false) {
					// blank
					items[i].blank = true;
				}
			}

			for (i = 0; i < next; i ++)
			{
				for (j = i + 1; j < next; j++)
				{
					if (items[i].name.compareTo(items[j].name) > 0) {
						Item temp = items[i];
						items[i] = items[j];
						items[j] = temp;
					}
				}
			}

			String spaces = "                                       ";
			for (i = 0; i < next; i++)
			{
				out.print(items[i].name + spaces.substring(0, 11 - items[i].name.length) + "$");
				if (items[i].blank) {
					out.println("blank");
				}
				else {
					if (items[i].value + < 1000)
					{
						out.print(" ");
					}
					out.print(items[i].value / 100 + ".");
					int temp = items[i].value % 100;
					if (temp < 10)
					{
						out.print("0");
					}
					out.println(temp);
				}

			}

			in.close();
			out.close();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}

	public static void main(String[] args) 
	{
		new grocer();
	}
}

class item
{
	String name;
	int value;
	boolean plus;
	int change;
	String from;
	boolean blank;

	public item() {
		name = null;
		value = 0;
		plus = false;
		change = 0;
		from = null;
		blank = true;
	}

};

--VywGB/WGlW4DM4P8--

From judge@east.isx.com Thu Feb 22 21:40:21 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id VAA14558
	for <judge@east.isx.com>; Thu, 22 Feb 2001 21:40:19 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id VAA12819
	for <judge@east.isx.com>; Thu, 22 Feb 2001 21:50:48 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id VAA23463
	for judge@east.isx.com; Thu, 22 Feb 2001 21:50:46 -0500 (EST)
Date: Thu, 22 Feb 2001 21:50:46 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: grocer 2
Message-ID: <20010222215046.A23062@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="envbJBWh7q8WU6mo"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 4207


--envbJBWh7q8WU6mo
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--envbJBWh7q8WU6mo
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="grocer.java"

import java.io.*;
import java.util.*;

class  grocer
{
	public grocer() {
		try
		{
			BufferedReader in = new BufferedReader(new FileReader("grocer.in"));
			PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("grocer.out")));

			String line;
			StringTokenizer st;
			item[] items = new item[100];
			String[] right = new String[100];

			int next = 0, rhs = 0;

			while((line = in.readLine()) != null) {
				st = new StringTokenizer(line, " =");
				item cur = new item();

				if (st.hasMoreTokens()) {
					cur.name = st.nextToken();
				}
				else {
					throw new Exception ("e1");
				}

				if (st.hasMoreTokens()) {
					String tmp = st.nextToken();
					try
					{
						cur.value = Integer.parseInt(tmp);
					}
					catch (Exception f)
					{
						// name
						cur.from = tmp;
						int i;
						boolean found = false;
						for (i = 0; i < rhs; i++)
						{
							if (right[i].compareTo(found) == 0){
								found = true;
								break;
							}
						}
						if (!found)
						{
							right[rhs] = tmp;
							rhs++;
						}
					}
				}
				else {
					throw new Exception("e2");
				}

				if (st.hasMoreTokens())
				{
					if (st.nextToken().compareTo("+") == 0)
					{
						cur.plus = true;
					}
					else {
						cur.plus = false;
					}

					if (st.hasMoreTokens())
					{
						tmp = st.nextToken();
						cur.change = Integer.parseInt(tmp);
					}
					else {
						throw new Exception("e3");
					}
				}

				items[next] = cur;
				next++;
			}

			int i, j;
			boolean found;

			for (i = 0; i < rhs; i++)
			{
				found = false;
				for(j = 0; j < next; j++) {
					if(right[i].compareTo(items[j].name) == 0) {
						found = true;
						break;
					}
				}
				if (!found)
				{
					items[next] = new item();
					items[next].name = right[i];
					items[next].blank = true;
					next++;
				}
			}

			for (i = 0; i < next; i++) {
				found = false;
				for (j = 0; j < next; j++) {
					// make sure change is computed
					if (items[j].from == null) {
						if (items[j].plus) {
							items[j].value += items[j].change;
						}
						else {
							items[j].value -= items[j].change;
						}
						items[j].change = 0;
					}

					if (items[i].from == null) {
						found = true;
						break;
					}
					else {
						if (items[i].from.compareTo(items[j].name) == 0) {
							if (items[j].from == null)
							{
								items[i].value = items[j].value;
								items[i].from = null;
								if (items[i].plus) {
									items[i].value += items[i].change;
								}
								else {
									items[i].value -= items[i].change;
								}
								items[i].change = 0;
							}
							else {
								items[i].from = items[j].from;
								j = 0;
							}
							found = true;
						}
					}


				}
				if (found == false) {
					// blank
					items[i].blank = true;
				}
			}

			for (i = 0; i < next; i ++)
			{
				for (j = i + 1; j < next; j++)
				{
					if (items[i].name.compareTo(items[j].name) > 0) {
						Item temp = items[i];
						items[i] = items[j];
						items[j] = temp;
					}
				}
			}





			String spaces = "                                       ";
			for (i = 0; i < next; i++)
			{
				out.print(items[i].name + spaces.substring(0, 11 - items[i].name.length) + "$");
				if (items[i].blank) {
					out.println("blank");
				}
				else {
					if (items[i].value < 1000)
					{
						out.print(" ");
					}
					out.print(items[i].value / 100 + ".");
					int temp = items[i].value % 100;
					if (temp < 10)
					{
						out.print("0");
					}
					out.println(temp);
				}

			}

			in.close();
			out.close();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}

	public static void main(String[] args) 
	{
		new grocer();
	}
}

class item
{
	String name;
	int value;
	boolean plus;
	int change;
	String from;
	boolean blank;

	public item() {
		name = null;
		value = 0;
		plus = false;
		change = 0;
		from = null;
		blank = true;
	}

};

--envbJBWh7q8WU6mo--

From judge@east.isx.com Thu Feb 22 21:55:22 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id VAA14942
	for <judge@east.isx.com>; Thu, 22 Feb 2001 21:55:21 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id WAA13810
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:05:36 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id WAA23957
	for judge@east.isx.com; Thu, 22 Feb 2001 22:05:35 -0500 (EST)
Date: Thu, 22 Feb 2001 22:05:35 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: amazing
Message-ID: <20010222220535.B23062@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="UHN/qo2QbUvPLonB"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 2329


--UHN/qo2QbUvPLonB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--UHN/qo2QbUvPLonB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="amazing.java"

import java.io.*;
import java.util.*;

class grants{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("grants.in"));
		out = new PrintWriter(new FileWriter("grants.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();
		
		while(line != null && !line.equals("0 0")) {


			int dimx = Integer.parseInt(foo.nextToken());
			int dimy = Integer.parseInt(foo.nextToken());

			int[][] visited = new int[dimx][dimy];
			boolean[][] desc = new boolean[dimx][dimy];

			int dirx=1;
			int diry=0;

			int startx=0;
			int starty=dimy;
			
			int robotx = 0;
			int roboty = starty;

			for(int i=0; i < dimy; i++) {
				String line = in.readLine();
				for(int j=0; j < dimx; j++) {
					visited[j][i] = 0;
					if(line[j] == '1') desc[j][i] = true;
					else desc[j][i] = false;
				}
			}

			do
			{
				int nextx = robotx + dirx;
				int nexty = roboty + diry;
				if(desc[nextx][nexty] || (nextx > dimx || nextx < 0 || nexty > dimy || nexty < 0)) 
				{
					if(dirx == 1) {
						dirx = 0;
						diry = -1;
					}
					else if(dirx == -1) {
						dirx = 0;
						diry = 1;
					}

					else if(diry == 1) {
						dirx = 1;
						diry = 0;
					}
					else if(diry == -1) {
						dirx = -1;
						diry = 0;
					}
				}
				else {
					visited[robotx][roboty]++;
					robotx = nextx;
					roboty = nexty;
				}
			} while (robotx != startx && roboty != starty);
	
			for(int currx = 0; currx < dimx; currx++) {
				for(int curry = 0; curry < dimy; curry++) {
					if(!desc[currx][curry]) {
						timesvisited[visited[currx][curry]]++;
					}
				}
			}

			int[] timesvisited = new int[5];
			for(int i=0; i<5; i++) {
				timesvisited[i] = 0;
			}

			String strvisits="";
			for(int i=0; i<5; i++) {
				strvisits += spaces.substring(0, ("" + timesvisited[i]).length() ) + timesvisited[i];
			}
			out.println(strvisits);

		}

		out.flush();
		out.close();
		in.close();
	}
}

--UHN/qo2QbUvPLonB--

From judge@east.isx.com Thu Feb 22 21:57:15 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id VAA14980
	for <judge@east.isx.com>; Thu, 22 Feb 2001 21:57:14 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id WAA13924
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:07:43 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id WAA24031
	for judge@east.isx.com; Thu, 22 Feb 2001 22:07:42 -0500 (EST)
Date: Thu, 22 Feb 2001 22:07:42 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: grocer 3
Message-ID: <20010222220742.C23062@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="sHrvAb52M6C8blB9"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 4214


--sHrvAb52M6C8blB9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--sHrvAb52M6C8blB9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="grocer.java"

import java.io.*;
import java.util.*;

class  grocer
{
	public grocer() {
		try
		{
			BufferedReader in = new BufferedReader(new FileReader("grocer.in"));
			PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("grocer.out")));

			String line;
			StringTokenizer st;
			item[] items = new item[100];
			String[] right = new String[100];

			int next = 0, rhs = 0;

			while((line = in.readLine()) != null) {
				st = new StringTokenizer(line, " =");
				item cur = new item();

				if (st.hasMoreTokens()) {
					cur.name = st.nextToken();
				}
				else {
					throw new Exception ("e1");
				}

				if (st.hasMoreTokens()) {
					String tmp = st.nextToken();
					try
					{
						cur.value = Integer.parseInt(tmp);
					}
					catch (Exception f)
					{
						// name
						cur.from = tmp;
						int i;
						boolean found = false;
						for (i = 0; i < rhs; i++)
						{
							if (right[i].compareTo(tmp) == 0){
								found = true;
								break;
							}
						}
						if (!found)
						{
							right[rhs] = tmp;
							rhs++;
						}
					}
				}
				else {
					throw new Exception("e2");
				}

				if (st.hasMoreTokens())
				{
					if (st.nextToken().compareTo("+") == 0)
					{
						cur.plus = true;
					}
					else {
						cur.plus = false;
					}

					if (st.hasMoreTokens())
					{
						String tmp = st.nextToken();
						cur.change = Integer.parseInt(tmp);
					}
					else {
						throw new Exception("e3");
					}
				}

				items[next] = cur;
				next++;
			}

			int i, j;
			boolean found;

			for (i = 0; i < rhs; i++)
			{
				found = false;
				for(j = 0; j < next; j++) {
					if(right[i].compareTo(items[j].name) == 0) {
						found = true;
						break;
					}
				}
				if (!found)
				{
					items[next] = new item();
					items[next].name = right[i];
					items[next].blank = true;
					next++;
				}
			}

			for (i = 0; i < next; i++) {
				found = false;
				for (j = 0; j < next; j++) {
					// make sure change is computed
					if (items[j].from == null) {
						if (items[j].plus) {
							items[j].value += items[j].change;
						}
						else {
							items[j].value -= items[j].change;
						}
						items[j].change = 0;
					}

					if (items[i].from == null) {
						found = true;
						break;
					}
					else {
						if (items[i].from.compareTo(items[j].name) == 0) {
							if (items[j].from == null)
							{
								items[i].value = items[j].value;
								items[i].from = null;
								if (items[i].plus) {
									items[i].value += items[i].change;
								}
								else {
									items[i].value -= items[i].change;
								}
								items[i].change = 0;
							}
							else {
								items[i].from = items[j].from;
								j = 0;
							}
							found = true;
						}
					}


				}
				if (found == false) {
					// blank
					items[i].blank = true;
				}
			}

			for (i = 0; i < next; i ++)
			{
				for (j = i + 1; j < next; j++)
				{
					if (items[i].name.compareTo(items[j].name) > 0) {
						item temp = items[i];
						items[i] = items[j];
						items[j] = temp;
					}
				}
			}





			String spaces = "                                       ";
			for (i = 0; i < next; i++)
			{
				out.print(items[i].name + spaces.substring(0, 11 - items[i].name.length()) + "$");
				if (items[i].blank) {
					out.println("blank");
				}
				else {
					if (items[i].value < 1000)
					{
						out.print(" ");
					}
					out.print(items[i].value / 100 + ".");
					int temp = items[i].value % 100;
					if (temp < 10)
					{
						out.print("0");
					}
					out.println(temp);
				}

			}

			in.close();
			out.close();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}

	public static void main(String[] args) 
	{
		new grocer();
	}
}

class item
{
	String name;
	int value;
	boolean plus;
	int change;
	String from;
	boolean blank;

	public item() {
		name = null;
		value = 0;
		plus = false;
		change = 0;
		from = null;
		blank = true;
	}

};

--sHrvAb52M6C8blB9--

From judge@east.isx.com Thu Feb 22 22:00:11 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id WAA15072
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:00:09 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id WAA14094
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:10:37 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id WAA24141
	for judge@east.isx.com; Thu, 22 Feb 2001 22:10:36 -0500 (EST)
Date: Thu, 22 Feb 2001 22:10:36 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: amazing
Message-ID: <20010222221036.D23062@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="rqzD5py0kzyFAOWN"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 2407


--rqzD5py0kzyFAOWN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--rqzD5py0kzyFAOWN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="amazing.java"

import java.io.*;
import java.util.*;

class grants{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("grants.in"));
		out = new PrintWriter(new FileWriter("grants.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();
		
		while(line != null && !line.equals("0 0")) {

			StringTokenizer foo = new StringTokenizer(line);
			int dimx = Integer.parseInt(foo.nextToken());
			int dimy = Integer.parseInt(foo.nextToken());

			int[][] visited = new int[dimx][dimy];
			boolean[][] desc = new boolean[dimx][dimy];

			int dirx=1;
			int diry=0;

			int startx=0;
			int starty=dimy;
			
			int robotx = 0;
			int roboty = starty;

			for(int i=0; i < dimy; i++) {
				String myline = in.readLine();
				for(int j=0; j < dimx; j++) {
					visited[j][i] = 0;
					if(myline[j] == '1') desc[j][i] = true;
					else desc[j][i] = false;
				}
			}

			do
			{
				int nextx = robotx + dirx;
				int nexty = roboty + diry;
				if(desc[nextx][nexty] || (nextx > dimx || nextx < 0 || nexty > dimy || nexty < 0)) 
				{
					if(dirx == 1) {
						dirx = 0;
						diry = -1;
					}
					else if(dirx == -1) {
						dirx = 0;
						diry = 1;
					}

					else if(diry == 1) {
						dirx = 1;
						diry = 0;
					}
					else if(diry == -1) {
						dirx = -1;
						diry = 0;
					}
				}
				else {
					visited[robotx][roboty]++;
					robotx = nextx;
					roboty = nexty;
				}
			} while (robotx != startx && roboty != starty);

			int[] timesvisited = new int[5];
			for(int i=0; i<5; i++) {
				timesvisited[i] = 0;
			}

			for(int currx = 0; currx < dimx; currx++) {
				for(int curry = 0; curry < dimy; curry++) {
					if(!desc[currx][curry]) {
						timesvisited[visited[currx][curry]]++;
					}
				}
			}

			String strvisits="";
			for(int i=0; i<5; i++) {
				strvisits += spaces.substring(0, ("" + timesvisited[i]).length() ) + timesvisited[i];
			}
			out.println(strvisits);
			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}
}

--rqzD5py0kzyFAOWN--

From judge@east.isx.com Thu Feb 22 22:02:22 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id WAA15287
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:02:21 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id WAA14250
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:12:44 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id WAA24222
	for judge@east.isx.com; Thu, 22 Feb 2001 22:12:43 -0500 (EST)
Date: Thu, 22 Feb 2001 22:12:42 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: grocer 4
Message-ID: <20010222221242.E23062@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="6Vw0j8UKbyX0bfpA"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 4269


--6Vw0j8UKbyX0bfpA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--6Vw0j8UKbyX0bfpA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="grocer.java"

import java.io.*;
import java.util.*;

class  grocer
{
	public grocer() {
		try
		{
			BufferedReader in = new BufferedReader(new FileReader("grocer.in"));
			PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("grocer.out")));

			String line;
			StringTokenizer st;
			item[] items = new item[100];
			String[] right = new String[100];

			int next = 0, rhs = 0;

			while((line = in.readLine()) != null) {
				st = new StringTokenizer(line, " =");
				item cur = new item();

				if (line.compareTo("#") == 0) {
					break;
				}

				if (st.hasMoreTokens()) {
					cur.name = st.nextToken();
				}
				else {
					throw new Exception ("e1");
				}

				if (st.hasMoreTokens()) {
					String tmp = st.nextToken();
					try
					{
						cur.value = Integer.parseInt(tmp);
					}
					catch (Exception f)
					{
						// name
						cur.from = tmp;
						int i;
						boolean found = false;
						for (i = 0; i < rhs; i++)
						{
							if (right[i].compareTo(tmp) == 0){
								found = true;
								break;
							}
						}
						if (!found)
						{
							right[rhs] = tmp;
							rhs++;
						}
					}
				}
				else {
					throw new Exception("e2");
				}

				if (st.hasMoreTokens())
				{
					if (st.nextToken().compareTo("+") == 0)
					{
						cur.plus = true;
					}
					else {
						cur.plus = false;
					}

					if (st.hasMoreTokens())
					{
						String tmp = st.nextToken();
						cur.change = Integer.parseInt(tmp);
					}
					else {
						throw new Exception("e3");
					}
				}

				items[next] = cur;
				next++;
			}

			int i, j;
			boolean found;

			for (i = 0; i < rhs; i++)
			{
				found = false;
				for(j = 0; j < next; j++) {
					if(right[i].compareTo(items[j].name) == 0) {
						found = true;
						break;
					}
				}
				if (!found)
				{
					items[next] = new item();
					items[next].name = right[i];
					items[next].blank = true;
					next++;
				}
			}

			for (i = 0; i < next; i++) {
				found = false;
				for (j = 0; j < next; j++) {
					// make sure change is computed
					if (items[j].from == null) {
						if (items[j].plus) {
							items[j].value += items[j].change;
						}
						else {
							items[j].value -= items[j].change;
						}
						items[j].change = 0;
					}

					if (items[i].from == null) {
						found = true;
						break;
					}
					else {
						if (items[i].from.compareTo(items[j].name) == 0) {
							if (items[j].from == null)
							{
								items[i].value = items[j].value;
								items[i].from = null;
								if (items[i].plus) {
									items[i].value += items[i].change;
								}
								else {
									items[i].value -= items[i].change;
								}
								items[i].change = 0;
							}
							else {
								items[i].from = items[j].from;
								j = 0;
							}
							found = true;
						}
					}


				}
				if (found == false) {
					// blank
					items[i].blank = true;
				}
			}

			for (i = 0; i < next; i ++)
			{
				for (j = i + 1; j < next; j++)
				{
					if (items[i].name.compareTo(items[j].name) > 0) {
						item temp = items[i];
						items[i] = items[j];
						items[j] = temp;
					}
				}
			}





			String spaces = "                                       ";
			for (i = 0; i < next; i++)
			{
				out.print(items[i].name + spaces.substring(0, 11 - items[i].name.length()) + "$");
				if (items[i].blank) {
					out.println("blank");
				}
				else {
					if (items[i].value < 1000)
					{
						out.print(" ");
					}
					out.print(items[i].value / 100 + ".");
					int temp = items[i].value % 100;
					if (temp < 10)
					{
						out.print("0");
					}
					out.println(temp);
				}

			}

			in.close();
			out.close();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}

	public static void main(String[] args) 
	{
		new grocer();
	}
}

class item
{
	String name;
	int value;
	boolean plus;
	int change;
	String from;
	boolean blank;

	public item() {
		name = null;
		value = 0;
		plus = false;
		change = 0;
		from = null;
		blank = true;
	}

};

--6Vw0j8UKbyX0bfpA--

From judge@east.isx.com Thu Feb 22 22:05:56 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id WAA15357
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:05:54 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id WAA14584
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:16:24 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id WAA24436
	for judge@east.isx.com; Thu, 22 Feb 2001 22:16:23 -0500 (EST)
Date: Thu, 22 Feb 2001 22:16:23 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: amazing
Message-ID: <20010222221622.F23062@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="eNMatiwYGLtwo1cJ"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 2414


--eNMatiwYGLtwo1cJ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--eNMatiwYGLtwo1cJ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="amazing.java"

import java.io.*;
import java.util.*;

class grants{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("grants.in"));
		out = new PrintWriter(new FileWriter("grants.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();
		
		while(line != null && !line.equals("0 0")) {

			StringTokenizer foo = new StringTokenizer(line);
			int dimx = Integer.parseInt(foo.nextToken());
			int dimy = Integer.parseInt(foo.nextToken());

			int[][] visited = new int[dimx][dimy];
			boolean[][] desc = new boolean[dimx][dimy];

			int dirx=1;
			int diry=0;

			int startx=0;
			int starty=dimy;
			
			int robotx = 0;
			int roboty = starty;

			for(int i=0; i < dimy; i++) {
				String myline = in.readLine();
				for(int j=0; j < dimx; j++) {
					visited[j][i] = 0;
					if(myline.charAt(j) == '1') desc[j][i] = true;
					else desc[j][i] = false;
				}
			}

			do
			{
				int nextx = robotx + dirx;
				int nexty = roboty + diry;
				if(desc[nextx][nexty] || (nextx > dimx || nextx < 0 || nexty > dimy || nexty < 0)) 
				{
					if(dirx == 1) {
						dirx = 0;
						diry = -1;
					}
					else if(dirx == -1) {
						dirx = 0;
						diry = 1;
					}

					else if(diry == 1) {
						dirx = 1;
						diry = 0;
					}
					else if(diry == -1) {
						dirx = -1;
						diry = 0;
					}
				}
				else {
					visited[robotx][roboty]++;
					robotx = nextx;
					roboty = nexty;
				}
			} while (robotx != startx && roboty != starty);

			int[] timesvisited = new int[5];
			for(int i=0; i<5; i++) {
				timesvisited[i] = 0;
			}

			for(int currx = 0; currx < dimx; currx++) {
				for(int curry = 0; curry < dimy; curry++) {
					if(!desc[currx][curry]) {
						timesvisited[visited[currx][curry]]++;
					}
				}
			}

			String strvisits="";
			for(int i=0; i<5; i++) {
				strvisits += spaces.substring(0, ("" + timesvisited[i]).length() ) + timesvisited[i];
			}
			out.println(strvisits);
			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}
}

--eNMatiwYGLtwo1cJ--

From judge@east.isx.com Thu Feb 22 22:10:38 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id WAA15638
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:10:37 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id WAA14849
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:21:06 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id WAA24660
	for judge@east.isx.com; Thu, 22 Feb 2001 22:21:05 -0500 (EST)
Date: Thu, 22 Feb 2001 22:21:04 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: amazing
Message-ID: <20010222222104.G23062@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="+1TulI7fc0PCHNy3"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 2417


--+1TulI7fc0PCHNy3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--+1TulI7fc0PCHNy3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="amazing.java"

import java.io.*;
import java.util.*;

class amazing{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("amazing.in"));
		out = new PrintWriter(new FileWriter("amazing.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();
		
		while(line != null && !line.equals("0 0")) {

			StringTokenizer foo = new StringTokenizer(line);
			int dimx = Integer.parseInt(foo.nextToken());
			int dimy = Integer.parseInt(foo.nextToken());

			int[][] visited = new int[dimx][dimy];
			boolean[][] desc = new boolean[dimx][dimy];

			int dirx=1;
			int diry=0;

			int startx=0;
			int starty=dimy;
			
			int robotx = 0;
			int roboty = starty;

			for(int i=0; i < dimy; i++) {
				String myline = in.readLine();
				for(int j=0; j < dimx; j++) {
					visited[j][i] = 0;
					if(myline.charAt(j) == '1') desc[j][i] = true;
					else desc[j][i] = false;
				}
			}

			do
			{
				int nextx = robotx + dirx;
				int nexty = roboty + diry;
				if(desc[nextx][nexty] || (nextx > dimx || nextx < 0 || nexty > dimy || nexty < 0)) 
				{
					if(dirx == 1) {
						dirx = 0;
						diry = -1;
					}
					else if(dirx == -1) {
						dirx = 0;
						diry = 1;
					}

					else if(diry == 1) {
						dirx = 1;
						diry = 0;
					}
					else if(diry == -1) {
						dirx = -1;
						diry = 0;
					}
				}
				else {
					visited[robotx][roboty]++;
					robotx = nextx;
					roboty = nexty;
				}
			} while (robotx != startx && roboty != starty);

			int[] timesvisited = new int[5];
			for(int i=0; i<5; i++) {
				timesvisited[i] = 0;
			}

			for(int currx = 0; currx < dimx; currx++) {
				for(int curry = 0; curry < dimy; curry++) {
					if(!desc[currx][curry]) {
						timesvisited[visited[currx][curry]]++;
					}
				}
			}

			String strvisits="";
			for(int i=0; i<5; i++) {
				strvisits += spaces.substring(0, ("" + timesvisited[i]).length() ) + timesvisited[i];
			}
			out.println(strvisits);
			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}
}

--+1TulI7fc0PCHNy3--

From judge@east.isx.com Thu Feb 22 22:19:57 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id WAA15931
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:19:55 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id WAA15363
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:30:20 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id WAA24964
	for judge@east.isx.com; Thu, 22 Feb 2001 22:30:19 -0500 (EST)
Date: Thu, 22 Feb 2001 22:30:18 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: amazing
Message-ID: <20010222223018.H23062@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="gTtJ75FAzB1T2CN6"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 2450


--gTtJ75FAzB1T2CN6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--gTtJ75FAzB1T2CN6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="amazing.java"

import java.io.*;
import java.util.*;

class amazing{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("amazing.in"));
		out = new PrintWriter(new FileWriter("amazing.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();
		
		while(line != null && !line.equals("0 0")) {

			StringTokenizer foo = new StringTokenizer(line);
			int dimx = Integer.parseInt(foo.nextToken());
			int dimy = Integer.parseInt(foo.nextToken());

			int[][] visited = new int[dimx][dimy];
			boolean[][] desc = new boolean[dimx][dimy];

			int dirx=1;
			int diry=0;

			int startx=0;
			int starty=dimy;
			
			int robotx = 0;
			int roboty = starty;

			for(int i=0; i < dimy; i++) {
				String myline = in.readLine();
				for(int j=0; j < dimx; j++) {
					visited[j][i] = 0;
					if(myline.charAt(j) == '1') desc[j][i] = true;
					else desc[j][i] = false;
				}
			}

			do
			{
				int nextx = robotx + dirx;
				int nexty = roboty + diry;
				if(desc[nextx][nexty] || (nextx > dimx || nextx < 0 || nexty > dimy || nexty < 0)) 
				{
					if(dirx == 1) {
						dirx = 0;
						diry = -1;
					}
					else if(dirx == -1) {
						dirx = 0;
						diry = 1;
					}

					else if(diry == 1) {
						dirx = 1;
						diry = 0;
					}
					else if(diry == -1) {
						dirx = -1;
						diry = 0;
					}
				}
				else {
					visited[robotx][roboty]++;
					robotx = nextx;
					roboty = nexty;
				}
			} while (robotx != startx && roboty != starty);

			int[] timesvisited = new int[5];
			for(int i=0; i<5; i++) {
				timesvisited[i] = 0;
			}

			for(int currx = 0; currx < dimx; currx++) {
				for(int curry = 0; curry < dimy; curry++) {
					if(!desc[currx][curry] && (visited[currx][curry] < 5) ) {

						timesvisited[visited[currx][curry]]++;
					}
				}
			}

			String strvisits="";
			for(int i=0; i<5; i++) {
				strvisits += spaces.substring(0, ("" + timesvisited[i]).length() ) + timesvisited[i];
			}
			out.println(strvisits);
			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}
}

--gTtJ75FAzB1T2CN6--

From judge@east.isx.com Thu Feb 22 22:29:15 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id WAA16284
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:29:13 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id WAA15911
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:39:43 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id WAA25427
	for judge@east.isx.com; Thu, 22 Feb 2001 22:39:43 -0500 (EST)
Date: Thu, 22 Feb 2001 22:39:42 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: amazing
Message-ID: <20010222223941.I23062@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="qLni7iB6Dl8qUSwk"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 2452


--qLni7iB6Dl8qUSwk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--qLni7iB6Dl8qUSwk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="amazing.java"

import java.io.*;
import java.util.*;

class amazing{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("amazing.in"));
		out = new PrintWriter(new FileWriter("amazing.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();
		
		while(line != null && !line.equals("0 0")) {

			StringTokenizer foo = new StringTokenizer(line);
			int dimx = Integer.parseInt(foo.nextToken());
			int dimy = Integer.parseInt(foo.nextToken());

			int[][] visited = new int[dimx][dimy];
			boolean[][] desc = new boolean[dimx][dimy];

			int dirx=1;
			int diry=0;

			int startx=0;
			int starty=dimy;
			
			int robotx = 0;
			int roboty = starty;

			for(int i=0; i < dimy; i++) {
				String myline = in.readLine();
				for(int j=0; j < dimx; j++) {
					visited[j][i] = 0;
					if(myline.charAt(j) == '1') desc[j][i] = true;
					else desc[j][i] = false;
				}
			}

			do
			{
				int nextx = robotx + dirx;
				int nexty = roboty + diry;
				if(desc[nextx][nexty] || (nextx >= dimx || nextx < 0 || nexty >= dimy || nexty < 0)) 
				{
					if(dirx == 1) {
						dirx = 0;
						diry = -1;
					}
					else if(dirx == -1) {
						dirx = 0;
						diry = 1;
					}

					else if(diry == 1) {
						dirx = 1;
						diry = 0;
					}
					else if(diry == -1) {
						dirx = -1;
						diry = 0;
					}
				}
				else {
					visited[robotx][roboty]++;
					robotx = nextx;
					roboty = nexty;
				}
			} while (robotx != startx && roboty != starty);

			int[] timesvisited = new int[5];
			for(int i=0; i<5; i++) {
				timesvisited[i] = 0;
			}

			for(int currx = 0; currx < dimx; currx++) {
				for(int curry = 0; curry < dimy; curry++) {
					if(!desc[currx][curry] && (visited[currx][curry] < 5) ) {

						timesvisited[visited[currx][curry]]++;
					}
				}
			}

			String strvisits="";
			for(int i=0; i<5; i++) {
				strvisits += spaces.substring(0, ("" + timesvisited[i]).length() ) + timesvisited[i];
			}
			out.println(strvisits);
			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}
}

--qLni7iB6Dl8qUSwk--

From judge@east.isx.com Thu Feb 22 22:30:04 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id WAA16329
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:30:02 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id WAA15964
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:40:32 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id WAA25456
	for judge@east.isx.com; Thu, 22 Feb 2001 22:40:31 -0500 (EST)
Date: Thu, 22 Feb 2001 22:40:31 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: tickets
Message-ID: <20010222224031.J23062@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="liqSWPDvh3eyfZ9k"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 1580


--liqSWPDvh3eyfZ9k
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--liqSWPDvh3eyfZ9k
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tickets.java"

import java.io.*;
import java.util.*;

class tickets 
{
	public tickets() {
		try {
			BufferedReader in = new BufferedReader(new FileReader("tickets.in"));
			PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("tickets.out")));

			String line;
			StringTokenizer st;
			float curprice, curoh, dprice, doh, bestprice, bestprofit, curprofit;
			int curnum, dnum;

			while ((line = in.readLine()) != null)
			{
				st = new StringTokenizer(line);

				if (st.countTokens() != 6)
				{
					break;
				}

				if ((curprice = Float.parseFloat(st.nextToken)) == 0) {
					break;
				}
				curnum = Integer.parseInt(st.nextToken);
				curoh = Float.parseFloat(st.nextToken);
				dprice = Float.parseFloat(st.nextToken);
				dnum = Integer.parseInt(st.nextToken);
				doh = Float.parseFloat(st.nextToken);

				bestprice = 0; bestprofit = 0;
				for (; curprice > 0; curprice -= dprice, curnum += dnum, curoh += doh)
				{
					curprofit = (curprice - curoh) * curnum;
					if (curprofit >= bestprofit)
					{
						bestprofit = curprofit;
						bestprice = curprice;
					}
				}

				out.println(bestprice + " " + bestprofit);
			}


			in.close();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) 
	{
		new tickets();
	}
}

--liqSWPDvh3eyfZ9k--

From judge@east.isx.com Thu Feb 22 22:33:49 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id WAA16577
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:33:47 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id WAA16174
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:44:17 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id WAA25572
	for judge@east.isx.com; Thu, 22 Feb 2001 22:44:16 -0500 (EST)
Date: Thu, 22 Feb 2001 22:44:16 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: tickets
Message-ID: <20010222224416.K23062@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="08ATZu8fEq0x2T3M"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 1594


--08ATZu8fEq0x2T3M
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--08ATZu8fEq0x2T3M
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tickets.java"

import java.io.*;
import java.util.*;

class tickets 
{
	public tickets() {
		try {
			BufferedReader in = new BufferedReader(new FileReader("tickets.in"));
			PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("tickets.out")));

			String line;
			StringTokenizer st;
			float curprice, curoh, dprice, doh, bestprice, bestprofit, curprofit;
			int curnum, dnum;

			while ((line = in.readLine()) != null)
			{
				st = new StringTokenizer(line);

				if (st.countTokens() != 6)
				{
					break;
				}

				if ( (curprice = Float.parseFloat(st.nextToken()) ) == 0) {
					break;
				}
				curnum = Integer.parseInt(st.nextToken());
				curoh = Float.parseFloat(st.nextToken());
				dprice = Float.parseFloat(st.nextToken());
				dnum = Integer.parseInt(st.nextToken());
				doh = Float.parseFloat(st.nextToken());

				bestprice = 0; bestprofit = 0;
				for (; curprice > 0; curprice -= dprice, curnum += dnum, curoh += doh)
				{
					curprofit = (curprice - curoh) * curnum;
					if (curprofit >= bestprofit)
					{
						bestprofit = curprofit;
						bestprice = curprice;
					}
				}

				out.println(bestprice + " " + bestprofit);
			}


			in.close();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) 
	{
		new tickets();
	}
}

--08ATZu8fEq0x2T3M--

From judge@east.isx.com Thu Feb 22 22:50:25 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id WAA17073
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:50:24 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id XAA17216
	for <judge@east.isx.com>; Thu, 22 Feb 2001 23:00:54 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id XAA26217
	for judge@east.isx.com; Thu, 22 Feb 2001 23:00:53 -0500 (EST)
Date: Thu, 22 Feb 2001 23:00:53 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: cards
Message-ID: <20010222230052.L23062@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="hdW7zL/qDS6RXdAL"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 2026


--hdW7zL/qDS6RXdAL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--hdW7zL/qDS6RXdAL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="cards.java"

import java.io.*;
import java.util.*;

class cards{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("cards.in"));
		out = new PrintWriter(new FileWriter("cards.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();
		
		while(line != null && !line.equals("#")) {
			String deck = line + in.readLine();

			char currsuit;
			int currnum;
			
			int currflush = 0;
			int maxflush = 0;
			int currrun = 0;
			int maxrun = 0;

			char lastsuit = deck.charAt(0);
			int lastnum  = getnum(deck.charAt(1));

			for(int i = 2; i<=52; i++) {
				currsuit = deck.charAt((i-1) * 2));
				currnum  = getnum(deck.charAt((i-1) * 2 + 1));

				if(lastsuit == currsuit) {currflush++;}
				else {currflush = 0;}

				if( ((lastnum + 1) % 13) == (currnum % 13) ) { currrun++; }
				else { currrun = 0; }

				if(currflush > maxflush) { maxflush = currflush; }
				if(currrun > maxrun) { maxrun = currrun; }
			}
			
			out.println( spaces.substring(0, 6 - ("" + maxflush).length()) + maxflush +
						 spaces.substring(0, 6 - ("" + maxrun).length())   + maxrun );

			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}

	public static int getnum(char foo) {
		select(foo) {
			case 'A':
				return 1;
			case '2':
				return 2;
			case '3':
				return 3;
			case '4':
				return 4;
			case '5':
				return 5;
			case '6':
				return 6;
			case '7':
				return 7;
			case '8':
				return 8;
			case '9':
				return 9;
			case 'T':
				return 10;
			case 'J':
				return 11;
			case 'Q':
				return 12;
			case 'K':
				return 13;
			default:
				return -42;

		}	
	}
}

--hdW7zL/qDS6RXdAL--

From judge@east.isx.com Thu Feb 22 22:55:44 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id WAA17142
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:55:43 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id XAA17517
	for <judge@east.isx.com>; Thu, 22 Feb 2001 23:06:13 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id XAA26494
	for judge@east.isx.com; Thu, 22 Feb 2001 23:06:12 -0500 (EST)
Date: Thu, 22 Feb 2001 23:06:12 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: cards
Message-ID: <20010222230612.M23062@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="QqzFzR/RUlLahzby"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 2025


--QqzFzR/RUlLahzby
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--QqzFzR/RUlLahzby
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="cards.java"

import java.io.*;
import java.util.*;

class cards{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("cards.in"));
		out = new PrintWriter(new FileWriter("cards.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();
		
		while(line != null && !line.equals("#")) {
			String deck = line + in.readLine();

			char currsuit;
			int currnum;
			
			int currflush = 1;
			int maxflush = 1;
			int currrun = 1;
			int maxrun = 1;

			char lastsuit = deck.charAt(0);
			int lastnum  = getnum(deck.charAt(1));

			for(int i = 2; i<=52; i++) {
				currsuit = deck.charAt((i-1) * 2);
				currnum  = getnum(deck.charAt((i-1) * 2 + 1));

				if(lastsuit == currsuit) {currflush++;}
				else {currflush = 1;}

				if( ((lastnum + 1) % 13) == (currnum % 13) ) { currrun++; }
				else { currrun = 1; }

				if(currflush > maxflush) { maxflush = currflush; }
				if(currrun > maxrun) { maxrun = currrun; }
			}
			
			out.println( spaces.substring(0, 6 - ("" + maxflush).length()) + maxflush +
						 spaces.substring(0, 6 - ("" + maxrun).length())   + maxrun );

			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}

	public static int getnum(char foo) {
		switch(foo) {
			case 'A':
				return 1;
			case '2':
				return 2;
			case '3':
				return 3;
			case '4':
				return 4;
			case '5':
				return 5;
			case '6':
				return 6;
			case '7':
				return 7;
			case '8':
				return 8;
			case '9':
				return 9;
			case 'T':
				return 10;
			case 'J':
				return 11;
			case 'Q':
				return 12;
			case 'K':
				return 13;
			default:
				return -42;

		}	
	}
}

--QqzFzR/RUlLahzby--

From judge@east.isx.com Thu Feb 22 22:57:42 2001 -0500
Status: R
X-Status: A
X-Keywords:
Received: from burdell.cc.gatech.edu (burdell.cc.gatech.edu [130.207.3.207])
	by east.isx.com (8.9.3+Sun/8.9.3) with ESMTP id WAA17178
	for <judge@east.isx.com>; Thu, 22 Feb 2001 22:57:41 -0500 (EST)
Received: from felix.cc.gatech.edu (felix.cc.gatech.edu [130.207.107.11])
	by burdell.cc.gatech.edu (8.9.1/8.9.3) with ESMTP id XAA17690
	for <judge@east.isx.com>; Thu, 22 Feb 2001 23:08:07 -0500 (EST)
Received: (from kirill@localhost)
	by felix.cc.gatech.edu (8.9.3+Sun/8.9.1) id XAA26625
	for judge@east.isx.com; Thu, 22 Feb 2001 23:07:59 -0500 (EST)
Date: Thu, 22 Feb 2001 23:07:59 -0500
From: Kirill Mechitov <kirill@cc.gatech.edu>
To: judge@east.isx.com
Subject: cards
Message-ID: <20010222230758.N23062@cc.gatech.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="IoFIGPN1N3g1Ryqz"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Content-Length: 2074


--IoFIGPN1N3g1Ryqz
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
kirill mechitov
kirill@cc.gatech.edu

--IoFIGPN1N3g1Ryqz
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="cards.java"

import java.io.*;
import java.util.*;

class cards{
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new FileReader("cards.in"));
		out = new PrintWriter(new FileWriter("cards.out"));

		String line;
		String spaces = "                                           ";
		line = in.readLine();
		
		while(line != null && !line.equals("#")) {
			String deck = line + in.readLine();

			char currsuit;
			int currnum;
			
			int currflush = 1;
			int maxflush = 1;
			int currrun = 1;
			int maxrun = 1;

			char lastsuit = deck.charAt(0);
			int lastnum  = getnum(deck.charAt(1));

			for(int i = 2; i<=52; i++) {
				currsuit = deck.charAt((i-1) * 2);
				currnum  = getnum(deck.charAt((i-1) * 2 + 1));

				if(lastsuit == currsuit) {currflush++;}
				else {currflush = 1;}

				if( ((lastnum + 1) % 13) == (currnum % 13) ) { currrun++; }
				else { currrun = 1; }

				if(currflush > maxflush) { maxflush = currflush; }
				if(currrun > maxrun) { maxrun = currrun; }

				lastsuit = currsuit;
				lastnum = currnum;
			}
			
			out.println( spaces.substring(0, 6 - ("" + maxflush).length()) + maxflush +
						 spaces.substring(0, 6 - ("" + maxrun).length())   + maxrun );

			line = in.readLine();
		}

		out.flush();
		out.close();
		in.close();
	}

	public static int getnum(char foo) {
		switch(foo) {
			case 'A':
				return 1;
			case '2':
				return 2;
			case '3':
				return 3;
			case '4':
				return 4;
			case '5':
				return 5;
			case '6':
				return 6;
			case '7':
				return 7;
			case '8':
				return 8;
			case '9':
				return 9;
			case 'T':
				return 10;
			case 'J':
				return 11;
			case 'Q':
				return 12;
			case 'K':
				return 13;
			default:
				return -42;

		}	
	}
}

--IoFIGPN1N3g1Ryqz--

