# Internet Problem Solving Contest

## Problem B – Bottom Coder

Some of you may be familiar with the TopCoder (TM) contest. Its exact rules are not important for this problem, but know that the most important part of it is writing a program according to the given specification. Many times the contestant ends up with a program which would work perfectly – if only he could change a couple of characters (like, replacing "=" by "==" in C, etc.). Unfortunately, even the best programmers sometimes aren't able to spot these tiny but necessary changes until it's too late... and that's why we developed a brand-new BottomCoder training for them!

The idea is very simple – you're given a problem specification, a source code, and a list of permitted modifications. Your task is to find a modification which would cause the program to behave according to the specification.

### Easy problem

Specification: "Write a program which outputs EXACTLY 42 asterisks and NOTHING more (e.g. NO end-of-line markers, like "\n", ...)"

The input file contains the code you are supposed to modify.

As this is a really, really simple problem, you are only permitted to make exactly ONE of these modifications to the source: 1) Add one character to the source. 2) Delete one character from the source. 3) Replace one character in the source by a different one.

Moreover, it would be definitely too easy if we asked you to find just one solution, so you'll need to find TWO DIFFERENT solutions in order to obtain credit for this problem. (There are exactly three different solutions, so don't worry, it can be done!)

Your submission should consist of two parts. The first part should contain the first of your solutions. A single line with the letter "Q" follows. (Note that the letter Q is used as a separator. You will have to do without inserting the letter Q in at least one of your solutions :) After this line you should add your second solution.

You don't need to worry much about the exact formatting of your submission. The exact judging procedure will look as follows:

• The first occurrence of the letter Q is found, the input is split into two parts.
• Any whitespace in each of the parts is removed.
• It is checked whether the two submissions differ and whether each of them was obtained from the original program by an allowed change.
• Each of your two submissions is compared to each of the three correct solutions.

For example, a syntactically valid (but incorrect) submission might look like this:

```int i, n=42; main(
){ for(i=0; i<n; i--)   { printf("?"); } }
QQQ
int i, n=41; main() { for(i=0; i<n;i--) { printf("*"); } }
```

### Hard problem

Specification: "Write a program which outputs a short English text mentioning our partner competition – IPSC. The text must consist of one or more English sentences and each sentence has to contain one or more English words (sequences of only upper-case characters) separated by spaces. Additionally, you may use certain punctuaction characters – namely ".!?,'". Try to obfuscate the program as much as possible."

The input file contains the code you are supposed to modify. As you can see, the coder made almost everything according to the specification :)

You're only allowed to alter one number in the source code – namely the number 47 on line 98 (the argument of function "f10" called from "main"). You can replace it by any integer between 100`000`000 and 200`000`000 inclusive.

Your submission should consist of two lines. The first line should contain the value of the constant – an integer between 100`000`000 and 200`000`000 inclusive. The second line should contain the output produced by the program if it were compiled and executed with the correct value of the constant.

Example of a syntactically valid (but incorrect) submission:

```123456789
ARE YOU SOLVING IPSC PROBLEMS RIGHT NOW?
```

### Notes on C

Here are some additional notes for those of you who are not that familiar with the C language.

• "int x" declares the variable "x" to be of type "int", which is assumed to be a signed 32-bit integer.
• "x++" is an operator which increases the value of the variable "x" by one.
• "x--" is an operator of decrement, value of "x" is decreased by one.
• "for (S1; S2; S3) { C }" is a cycle-construct which works like this:
1. Execute statement S1.
2. Evaluate statement S2. If the result is zero, the cycle stops. If it is non-zero, nothing happens.
3. Execute statement C.
4. Execute statement S3.
5. Goto 2.
• "break" terminates the execution of a cycle immediately.
• "=" denotes assignment; "x=7" assigns value 7 to variable "x".
• "==" denotes comparison for equality; "x==7" is one if "x" is equal to 7, zero otherwise. In general, a result of a comparison (like x<7) is one if the (in)equality holds and zero otherwise.
• "!=" is the same as not-equal
• "!" is operation of logical negation – e.g. !(x<7) is the same as x>=7. (More precisely, if x is zero, !x is one, otherwise !x is zero.

Credits:
Problemsetter(s): g00ber, misof
Contest-related materials: g00ber, Bee