# Rules

## General information

This is the official prizing ruleset for all of the available CodeFu competitions. It will always be up to date, so please use it as a single source of truth when it comes to prize eligibility and how they're going to be handled. In case there is a change in the rules you will be notified via e-mail adequately. Additional less/more restrictive rules can be applied per competition/round.

## Fair use

We strongly inquire of our participants to adapt to all of our fair use guidelines:

- Cheating and reusing other people's code
**is not allowed**(keep in mind that we do test for duplication and terminating this will result in an instant disqualification from the round of both parties) - Discussion between competitors during a round is
**strongly discouraged** - Fair behaviour between all competitors is a must

## Eligibility to use

The system is open to everyone - whether it is to improve your skills or just want to look at other people's solutions.

## Eligibility to compete

In order to be eligible to compete in the Competition of the CodeFu, competitors must be a registered CodeFu members.

There is no limit to the number of registrants for the tournament, however each individual may only register once. Those who participated in any of the previous CodeFu events will be registered to participate in all events to come.

This **excludes** the final round, where the eligibility to compete depends on whether you're qualified or not and whether you're eligible to win a prize or not (a competitor ineligible to win a prize will **not** be able to compete in the final round).

## Prize eligibility

- Have to be an active highschool student, university student, alumni or postgraduate or having graduated or postgraduated in year of competing
- Macedonian citizen who is a active highschool student, university student, alumni or postgraduate at a Macedonian or foreign university or highschool
- Foreign citizen who is a active highschool student, university student, alumni or postgraduate at a Macedonian university or highschool

Employees of CodeFu and Netcetera DOOEL or entities directly associated with the tournament and members of their immediate families (parent, child, sibling, and spouse of each) and/or persons living in the same household as such persons, are ineligible to compete on the final event and are ineligible to receive any prizes from any of the competitionss, however they are free to compete in all other events (rating changes will still apply).

Any non-eligible person can compete on all online rounds (except for the final one of course), but he/she is not eligible for any prizes.

## Prizes

For all current types of rounds that contain prizes, the following rules apply:

- Each round will have prizes for the first (1) position score wise
- The prize will be valued at 500 EUR (please note that this
**excludes**the final round as it has different prizes, which will be detailed in a separate rule page) - Shortest Solution rounds do
**not**contain prizes

## Competition Round Structure

There will be 5 problems, each with a different scale of difficulty and a different score factor.

The problems will bring 100, 200, 300, 400 and 500 points.

The order of solving the problems is not important.

Each problem consists of:

- A problem description
- Test cases with their correct solutions (up to 10 test cases)

The problems are submitted during the contest. For each problem, several basic test cases will be shown, with their correct solutions.

After the programming part is finished (after 2 hours), all the submitted problems will be tested.

## Scoring

### Regular competitions

Each problem will be tested with 100 test cases.

The scoring will be according to the following algorithm:

- 50% - 89% cases correct - 25% of the problem points
- 90% - 99% cases correct - 50% of the problem points
- 100% cases correct - 100% of the problem points

The final score of the competitor is the sum of all submitted problem scores.

### Shortest solution competitions

The shortest solution competition is scoring the number of non blank characters used to correctly solve the problem.

Only solutions with are 100% correct will receive points.

Solutions are rated according the non blank characters.

Blanks, tabs, newline characters are not counted.

The number of characters of the correct solution are substracted from 500 to get the score.

E.g. If a solution has 192 non blank characters, the solution gets 500-192=308 points.

The solution gets the points only if it passes ALL 100 test cases.

Please note that Shortest Solution Competitions do **not** contain prizes. They're purely there for fun.

## Random prize generation

In order to be transparent with the choice, the following algorithm will be used:

- 5 numbers will be taken from the Euro Millions Lottery of a day that is going to be announced in advance
- The results of the lottery can be found here
- Those 5 numbers will be sorted
- Then multiplied with the following factors: 2 for the smallest number, 5, 8, 11 and 13 for the biggest number, and then a total sum calculated
- Note: The factors: 2, 5, 8, 11, 13 are chosen so that there is a smallest deviation among all possibilities, i.e. all positions have the same (or very close) possibility for being a winner
- Let us denote the number of competitors to be 74
- The total sum will be cut modulo 71 and then added 4 (to get a range of 4-74, these are the competitors eligible for the prize)
- If the selected competitor is not eligible for a prize (is not a student), the process will be repeated with the same lucky numbers but with that particular contestant removed from the list until an eligible contestant is selected
**Example**

Lottery numbers from a previous draw were 4, 13, 30, 34, 47

11 * 2 + 14 * 5 + 15 * 8 + 27 * 11 + 44 * 13 = 1081

1081 % 71 + 5 = 20 This means the person with number 20 (this is still an**example**) would receive the first voucher

Keep in mind that whenever executing this algorithm, we first remove all of the people who received prizes while **preserving the order of the list** (sorted by score in descending order). Meaning, the first time a random winner is chosen the first 3 places of the list are going to be removed and the second time around the first random winner will be removed from the lists.

## Contact

If any of these rules do not make any general sense or you are unsure of the way they apply, feel free to contact judges@codefu.mk at any time for clarification.