<commit_before># sim [![Build Status](https://travis-ci.org/krzyk240/sim.svg?branch=master)](https://travis-ci.org/krzyk240/sim) [![Coverity Scan Build Status](https://scan.coverity.com/projects/6466/badge.svg)](https://scan.coverity.com/projects/krzyk240-sim) [![Gitter chat](https://badges.gitter.im/krzyk240/sim.png)](https://gitter.im/krzyk240/sim)

SIM is an open source platform for carrying out algorithmic contests

<div align="center">
  <img src="http://krzyk240.github.io/img/sim.png"/>
</div>


## Installation

### Dependencies:

- gcc/g++ (32 bit version) with C++11 support
- MySQL (Debian packages: _mysql-server_)
- [MySQL Connector/C++](http://dev.mysql.com/downloads/connector/cpp/) (Debian package: _libmysqlcppconn-dev_)
- MySQL client library (Debian packages: libmysqlclient-dev)
- GNU/Make
- zip + unzip

#### Ubuntu / Debian

  ```sh
  sudo apt-get install g++-multilib mysql-server libmysqlcppconn-dev make zip unzip
  ```

### Instructions

1. First of all clone the SIM repository and all its submodules

  ```sh
  git clone --recursive https://github.com/krzyk240/sim
  cd sim
  ```

2. Build

  ```sh
  make -j 4
  ```

3. Make sure that you have created MySQL account and database for SIM, use command below to create user sim@localhost (password: sim) and database sim:

  ```sh
  mysql -e "CREATE USER sim@localhost IDENTIFIED BY 'sim'; CREATE DATABASE sim; GRANT ALL ON sim.* TO 'sim'@'localhost';" -u root -p
  ```

4. Install

  ```sh
  make install
  ```
  It will ask for MySQL credentials

  If you want to install SIM in other location that build/ type

  ```sh
  make install DESTDIR=where-you-want-SIM-to-install
  ```

5. Run sim-server and judge-machine

  ```sh
  make run
  ```

  If you have not installed SIM in default location use command:

  ```sh
  make run DESTDIR=where-you-installed-SIM
  ```

  You can combine building, installation and running commands into:
  ```sh
  make install run
  ```

6. Enter http://127.7.7.7:8080 via your web browser, by default there was created SIM root account
  ```
  username: sim
  password: <PASSWORD>
  ```

  Remember to change the password later (or now) if you want to make SIM site public. Do not make hacker's life easier!

7. Well done! You have just installed SIM. There is a sim-server configuration file `where-you-installed-SIM/server.conf` in which are server parameters like ADDRESS etc. There are also log files `log/*.log` which you would find useful if something did not work.

8. Feel free to report bugs and irregularities.

### Upgrading
Just type (be aware of incompatible database (and other inner) changes)
```sh
git pull
git submodule update
make -j4 install run
```

### Task packages
You can find some example task packages in problems/ folder.
<commit_msg>Fixed combined build and install commands in README.md<commit_after># sim [![Build Status](https://travis-ci.org/krzyk240/sim.svg?branch=master)](https://travis-ci.org/krzyk240/sim) [![Coverity Scan Build Status](https://scan.coverity.com/projects/6466/badge.svg)](https://scan.coverity.com/projects/krzyk240-sim) [![Gitter chat](https://badges.gitter.im/krzyk240/sim.png)](https://gitter.im/krzyk240/sim)

SIM is an open source platform for carrying out algorithmic contests

<div align="center">
  <img src="http://krzyk240.github.io/img/sim.png"/>
</div>


## Installation

### Dependencies:

- gcc/g++ (32 bit version) with C++11 support
- MySQL (Debian packages: _mysql-server_)
- [MySQL Connector/C++](http://dev.mysql.com/downloads/connector/cpp/) (Debian package: _libmysqlcppconn-dev_)
- MySQL client library (Debian packages: libmysqlclient-dev)
- GNU/Make
- zip + unzip

#### Ubuntu / Debian

  ```sh
  sudo apt-get install g++-multilib mysql-server libmysqlcppconn-dev make zip unzip
  ```

### Instructions

1. First of all clone the SIM repository and all its submodules

  ```sh
  git clone --recursive https://github.com/krzyk240/sim
  cd sim
  ```

2. Build

  ```sh
  make -j 4
  ```

3. Make sure that you have created MySQL account and database for SIM, use command below to create user sim@localhost (password: <PASSWORD>) and database sim:

  ```sh
  mysql -e "CREATE USER sim@localhost IDENTIFIED BY 'sim'; CREATE DATABASE sim; GRANT ALL ON sim.* TO 'sim'@'localhost';" -u root -p
  ```

4. Install

  ```sh
  make install
  ```
  It will ask for MySQL credentials

  If you want to install SIM in other location that build/ type

  ```sh
  make install DESTDIR=where-you-want-SIM-to-install
  ```

5. Run sim-server and judge-machine

  ```sh
  make run
  ```

  If you have not installed SIM in default location use command:

  ```sh
  make run DESTDIR=where-you-installed-SIM
  ```

  You can combine building, installation and running commands into:
  ```sh
  make src install run
  ```

6. Enter http://127.7.7.7:8080 via your web browser, by default there was created SIM root account
  ```
  username: sim
  password: <PASSWORD>
  ```

  Remember to change the password later (or now) if you want to make SIM site public. Do not make hacker's life easier!

7. Well done! You have just installed SIM. There is a sim-server configuration file `where-you-installed-SIM/server.conf` in which are server parameters like ADDRESS etc. There are also log files `log/*.log` which you would find useful if something did not work.

8. Feel free to report bugs and irregularities.

### Upgrading
Just type (be aware of incompatible database (and other inner) changes)
```sh
git pull
git submodule update
make -j4 src install run
```

### Task packages
You can find some example task packages in problems/ folder.

{'fraction_non_alphanumeric': 0.12004994648590796, 'fraction_numerical': 0.017481270067784518, 'mean_word_length': 3.788215200683177, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2575949', 'n_tokens_mistral': 1885, 'n_tokens_neox': 1714, 'n_words': 653}