aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xboca-1.5.0/doc/problemexamples/abacaxi/compare/c (renamed from boca-1.5.0/doc/problemtemplate/compare/c)0
-rwxr-xr-xboca-1.5.0/doc/problemexamples/abacaxi/compare/cpp (renamed from boca-1.5.0/doc/problemtemplate/compare/cpp)0
-rwxr-xr-xboca-1.5.0/doc/problemexamples/abacaxi/compare/java (renamed from boca-1.5.0/doc/problemtemplate/compare/java)0
-rw-r--r--boca-1.5.0/doc/problemexamples/abacaxi/compile/c (renamed from boca-1.5.0/doc/problemtemplate/compile/c)0
-rw-r--r--boca-1.5.0/doc/problemexamples/abacaxi/compile/cpp (renamed from boca-1.5.0/doc/problemtemplate/compile/cpp)0
-rw-r--r--boca-1.5.0/doc/problemexamples/abacaxi/compile/java (renamed from boca-1.5.0/doc/problemtemplate/compile/java)0
-rw-r--r--boca-1.5.0/doc/problemexamples/abacaxi/description/abacaxi.txt (renamed from boca-1.5.0/doc/problemtemplate/description/bits.txt)0
-rw-r--r--boca-1.5.0/doc/problemexamples/abacaxi/description/problem.info3
-rw-r--r--boca-1.5.0/doc/problemexamples/abacaxi/input/abacaxi25
-rw-r--r--boca-1.5.0/doc/problemexamples/abacaxi/limits/c (renamed from boca-1.5.0/doc/problemtemplate/limits/c)0
-rw-r--r--boca-1.5.0/doc/problemexamples/abacaxi/limits/cpp (renamed from boca-1.5.0/doc/problemtemplate/limits/cpp)0
-rw-r--r--boca-1.5.0/doc/problemexamples/abacaxi/limits/java (renamed from boca-1.5.0/doc/problemtemplate/limits/java)0
-rw-r--r--boca-1.5.0/doc/problemexamples/abacaxi/output/abacaxi24
-rwxr-xr-xboca-1.5.0/doc/problemexamples/abacaxi/run/c (renamed from boca-1.5.0/doc/problemtemplate/run/c)0
-rwxr-xr-xboca-1.5.0/doc/problemexamples/abacaxi/run/cpp (renamed from boca-1.5.0/doc/problemtemplate/run/cpp)0
-rwxr-xr-xboca-1.5.0/doc/problemexamples/abacaxi/run/java (renamed from boca-1.5.0/doc/problemtemplate/run/java)0
-rwxr-xr-xboca-1.5.0/doc/problemexamples/abacaxi/tests/c (renamed from boca-1.5.0/doc/problemtemplate/tests/c)0
-rwxr-xr-xboca-1.5.0/doc/problemexamples/bits/compare/c97
-rwxr-xr-xboca-1.5.0/doc/problemexamples/bits/compare/cpp97
-rwxr-xr-xboca-1.5.0/doc/problemexamples/bits/compare/java97
-rw-r--r--boca-1.5.0/doc/problemexamples/bits/compile/c159
-rw-r--r--boca-1.5.0/doc/problemexamples/bits/compile/cpp159
-rw-r--r--boca-1.5.0/doc/problemexamples/bits/compile/java176
-rw-r--r--boca-1.5.0/doc/problemexamples/bits/description/bits.txt1
-rw-r--r--boca-1.5.0/doc/problemexamples/bits/description/problem.info (renamed from boca-1.5.0/doc/problemtemplate/description/problem.info)0
-rw-r--r--boca-1.5.0/doc/problemexamples/bits/input/bits (renamed from boca-1.5.0/doc/problemtemplate/input/bits)0
-rw-r--r--boca-1.5.0/doc/problemexamples/bits/limits/c13
-rw-r--r--boca-1.5.0/doc/problemexamples/bits/limits/cpp13
-rw-r--r--boca-1.5.0/doc/problemexamples/bits/limits/java13
-rw-r--r--boca-1.5.0/doc/problemexamples/bits/output/bits (renamed from boca-1.5.0/doc/problemtemplate/output/bits)0
-rwxr-xr-xboca-1.5.0/doc/problemexamples/bits/run/c124
-rwxr-xr-xboca-1.5.0/doc/problemexamples/bits/run/cpp123
-rwxr-xr-xboca-1.5.0/doc/problemexamples/bits/run/java163
-rwxr-xr-xboca-1.5.0/doc/problemexamples/bits/tests/c24
-rwxr-xr-xboca-1.5.0/doc/problemexamples/formiga/compare/c97
-rwxr-xr-xboca-1.5.0/doc/problemexamples/formiga/compare/cpp97
-rwxr-xr-xboca-1.5.0/doc/problemexamples/formiga/compare/java97
-rw-r--r--boca-1.5.0/doc/problemexamples/formiga/compile/c159
-rw-r--r--boca-1.5.0/doc/problemexamples/formiga/compile/cpp159
-rw-r--r--boca-1.5.0/doc/problemexamples/formiga/compile/java176
-rw-r--r--boca-1.5.0/doc/problemexamples/formiga/description/formiga.txt1
-rw-r--r--boca-1.5.0/doc/problemexamples/formiga/description/problem.info3
-rw-r--r--boca-1.5.0/doc/problemexamples/formiga/input/formiga15
-rw-r--r--boca-1.5.0/doc/problemexamples/formiga/limits/c13
-rw-r--r--boca-1.5.0/doc/problemexamples/formiga/limits/cpp13
-rw-r--r--boca-1.5.0/doc/problemexamples/formiga/limits/java13
-rw-r--r--boca-1.5.0/doc/problemexamples/formiga/output/formiga14
-rwxr-xr-xboca-1.5.0/doc/problemexamples/formiga/run/c124
-rwxr-xr-xboca-1.5.0/doc/problemexamples/formiga/run/cpp123
-rwxr-xr-xboca-1.5.0/doc/problemexamples/formiga/run/java163
-rwxr-xr-xboca-1.5.0/doc/problemexamples/formiga/tests/c24
-rwxr-xr-xboca-1.5.0/doc/problemexamples/multas/compare/c97
-rwxr-xr-xboca-1.5.0/doc/problemexamples/multas/compare/cpp97
-rwxr-xr-xboca-1.5.0/doc/problemexamples/multas/compare/java97
-rw-r--r--boca-1.5.0/doc/problemexamples/multas/compile/c159
-rw-r--r--boca-1.5.0/doc/problemexamples/multas/compile/cpp159
-rw-r--r--boca-1.5.0/doc/problemexamples/multas/compile/java176
-rw-r--r--boca-1.5.0/doc/problemexamples/multas/description/m.txt1
-rw-r--r--boca-1.5.0/doc/problemexamples/multas/description/problem.info3
-rw-r--r--boca-1.5.0/doc/problemexamples/multas/input/file518
-rw-r--r--boca-1.5.0/doc/problemexamples/multas/limits/c13
-rw-r--r--boca-1.5.0/doc/problemexamples/multas/limits/cpp13
-rw-r--r--boca-1.5.0/doc/problemexamples/multas/limits/java13
-rw-r--r--boca-1.5.0/doc/problemexamples/multas/output/file466
-rwxr-xr-xboca-1.5.0/doc/problemexamples/multas/run/c124
-rwxr-xr-xboca-1.5.0/doc/problemexamples/multas/run/cpp123
-rwxr-xr-xboca-1.5.0/doc/problemexamples/multas/run/java163
-rwxr-xr-xboca-1.5.0/doc/problemexamples/multas/tests/c24
-rwxr-xr-xboca-1.5.0/doc/problemexamples/problemtemplate/compare/c97
-rwxr-xr-xboca-1.5.0/doc/problemexamples/problemtemplate/compare/cpp97
-rwxr-xr-xboca-1.5.0/doc/problemexamples/problemtemplate/compare/java97
-rw-r--r--boca-1.5.0/doc/problemexamples/problemtemplate/compile/c159
-rw-r--r--boca-1.5.0/doc/problemexamples/problemtemplate/compile/cpp159
-rw-r--r--boca-1.5.0/doc/problemexamples/problemtemplate/compile/java176
-rw-r--r--boca-1.5.0/doc/problemexamples/problemtemplate/description/desc.txt1
-rw-r--r--boca-1.5.0/doc/problemexamples/problemtemplate/description/problem.info3
-rw-r--r--boca-1.5.0/doc/problemexamples/problemtemplate/input/file11
-rw-r--r--boca-1.5.0/doc/problemexamples/problemtemplate/limits/c13
-rw-r--r--boca-1.5.0/doc/problemexamples/problemtemplate/limits/cpp13
-rw-r--r--boca-1.5.0/doc/problemexamples/problemtemplate/limits/java13
-rw-r--r--boca-1.5.0/doc/problemexamples/problemtemplate/output/file11
-rwxr-xr-xboca-1.5.0/doc/problemexamples/problemtemplate/run/c124
-rwxr-xr-xboca-1.5.0/doc/problemexamples/problemtemplate/run/cpp123
-rwxr-xr-xboca-1.5.0/doc/problemexamples/problemtemplate/run/java163
-rwxr-xr-xboca-1.5.0/doc/problemexamples/problemtemplate/tests/c27
-rw-r--r--boca-1.5.0/src/admin/problem.php2
-rw-r--r--boca-1.5.0/src/fcontest.php7
-rw-r--r--boca-1.5.0/src/fproblem.php39
-rw-r--r--boca-1.5.0/src/team/problem.php2
-rwxr-xr-xboca-1.5.0/tools/etc/icpc/becomeserver.sh2
-rw-r--r--boca-1.5.0/tools/icpc.etc.tgzbin8632 -> 8634 bytes
-rwxr-xr-xboca-1.5.0/tools/installv2.sh1
92 files changed, 6145 insertions, 23 deletions
diff --git a/boca-1.5.0/doc/problemtemplate/compare/c b/boca-1.5.0/doc/problemexamples/abacaxi/compare/c
index 4998be3..4998be3 100755
--- a/boca-1.5.0/doc/problemtemplate/compare/c
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/compare/c
diff --git a/boca-1.5.0/doc/problemtemplate/compare/cpp b/boca-1.5.0/doc/problemexamples/abacaxi/compare/cpp
index 4998be3..4998be3 100755
--- a/boca-1.5.0/doc/problemtemplate/compare/cpp
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/compare/cpp
diff --git a/boca-1.5.0/doc/problemtemplate/compare/java b/boca-1.5.0/doc/problemexamples/abacaxi/compare/java
index 4998be3..4998be3 100755
--- a/boca-1.5.0/doc/problemtemplate/compare/java
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/compare/java
diff --git a/boca-1.5.0/doc/problemtemplate/compile/c b/boca-1.5.0/doc/problemexamples/abacaxi/compile/c
index 04a08e9..04a08e9 100644
--- a/boca-1.5.0/doc/problemtemplate/compile/c
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/compile/c
diff --git a/boca-1.5.0/doc/problemtemplate/compile/cpp b/boca-1.5.0/doc/problemexamples/abacaxi/compile/cpp
index 2ec55ac..2ec55ac 100644
--- a/boca-1.5.0/doc/problemtemplate/compile/cpp
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/compile/cpp
diff --git a/boca-1.5.0/doc/problemtemplate/compile/java b/boca-1.5.0/doc/problemexamples/abacaxi/compile/java
index dae050e..dae050e 100644
--- a/boca-1.5.0/doc/problemtemplate/compile/java
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/compile/java
diff --git a/boca-1.5.0/doc/problemtemplate/description/bits.txt b/boca-1.5.0/doc/problemexamples/abacaxi/description/abacaxi.txt
index 4cd89f0..4cd89f0 100644
--- a/boca-1.5.0/doc/problemtemplate/description/bits.txt
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/description/abacaxi.txt
diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/description/problem.info b/boca-1.5.0/doc/problemexamples/abacaxi/description/problem.info
new file mode 100644
index 0000000..b4b6af8
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/description/problem.info
@@ -0,0 +1,3 @@
+basename=abacaxi
+fullname=The abacaxi problem
+descfile=abacaxi.txt
diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/input/abacaxi b/boca-1.5.0/doc/problemexamples/abacaxi/input/abacaxi
new file mode 100644
index 0000000..26d3afe
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/input/abacaxi
@@ -0,0 +1,25 @@
+5
+32 37 82 46 32
+13 40 75 62 19
+8
+14 22 29 41 72 25 68 90
+22 19 21 45 70 46 66 80
+3
+2 4 5
+8 8 8
+8
+12 1 0 8 5 0 9 4
+0 0 13 0 0 13 0 0
+8
+8 8 8 8 8 8 8 8
+7 9 5 8 9 5 9 7
+1
+0
+0
+999
+1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+999
+ 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0
diff --git a/boca-1.5.0/doc/problemtemplate/limits/c b/boca-1.5.0/doc/problemexamples/abacaxi/limits/c
index b48a3b7..b48a3b7 100644
--- a/boca-1.5.0/doc/problemtemplate/limits/c
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/limits/c
diff --git a/boca-1.5.0/doc/problemtemplate/limits/cpp b/boca-1.5.0/doc/problemexamples/abacaxi/limits/cpp
index b48a3b7..b48a3b7 100644
--- a/boca-1.5.0/doc/problemtemplate/limits/cpp
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/limits/cpp
diff --git a/boca-1.5.0/doc/problemtemplate/limits/java b/boca-1.5.0/doc/problemexamples/abacaxi/limits/java
index b48a3b7..b48a3b7 100644
--- a/boca-1.5.0/doc/problemtemplate/limits/java
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/limits/java
diff --git a/boca-1.5.0/doc/problemexamples/abacaxi/output/abacaxi b/boca-1.5.0/doc/problemexamples/abacaxi/output/abacaxi
new file mode 100644
index 0000000..2e9fd8b
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/output/abacaxi
@@ -0,0 +1,24 @@
+Fazenda 1
+Inicio 1 Fim 3
+
+Fazenda 2
+Inicio 7 Fim 8
+
+Fazenda 3
+O produtor so teve prejuizo nesta fazenda
+
+Fazenda 4
+Inicio 1 Fim 2
+
+Fazenda 5
+Inicio 1 Fim 6
+
+Fazenda 6
+Inicio 1 Fim 1
+
+Fazenda 7
+Inicio 1 Fim 999
+
+Fazenda 8
+Inicio 1 Fim 999
+
diff --git a/boca-1.5.0/doc/problemtemplate/run/c b/boca-1.5.0/doc/problemexamples/abacaxi/run/c
index d65ed58..d65ed58 100755
--- a/boca-1.5.0/doc/problemtemplate/run/c
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/run/c
diff --git a/boca-1.5.0/doc/problemtemplate/run/cpp b/boca-1.5.0/doc/problemexamples/abacaxi/run/cpp
index 9b2d092..9b2d092 100755
--- a/boca-1.5.0/doc/problemtemplate/run/cpp
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/run/cpp
diff --git a/boca-1.5.0/doc/problemtemplate/run/java b/boca-1.5.0/doc/problemexamples/abacaxi/run/java
index 945f15d..945f15d 100755
--- a/boca-1.5.0/doc/problemtemplate/run/java
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/run/java
diff --git a/boca-1.5.0/doc/problemtemplate/tests/c b/boca-1.5.0/doc/problemexamples/abacaxi/tests/c
index 1a0ca95..1a0ca95 100755
--- a/boca-1.5.0/doc/problemtemplate/tests/c
+++ b/boca-1.5.0/doc/problemexamples/abacaxi/tests/c
diff --git a/boca-1.5.0/doc/problemexamples/bits/compare/c b/boca-1.5.0/doc/problemexamples/bits/compare/c
new file mode 100755
index 0000000..4998be3
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/bits/compare/c
@@ -0,0 +1,97 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+# // Last modified 21/jul/2012 by cassio@ime.usp.br
+#
+# This script receives:
+# $1 team_output
+# $2 sol_output
+# $3 problem_input (might be used by some specific checkers, here it is not)
+#
+# BOCA reads the last line of the standard output
+# and pass it to judges
+#
+if [ ! -r "$1" -o ! -r "$2" ]; then
+ echo "Parameter problem"
+ exit 43
+fi
+
+# Next lines of this script just compares team_output and sol_output,
+# although it is possible to change them to more complex evaluations.
+
+diff -q "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff \"$1\" \"$2\" # files match"
+ echo "Files match exactly"
+ exit 4
+fi
+diff -q -b "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b \"$1\" \"$2\" # files match"
+ echo -e "diff -c \"$1\" \"$2\" # files dont match - see output"
+ diff -c "$1" "$2"
+ echo "Files match with differences in the amount of white spaces"
+ exit 5
+fi
+diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b "$1" "$2"
+ echo "Files match with differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B "$1" "$2"
+ echo "Files match if we ignore case and differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B "$1" "$2"
+ echo "Files match if we discard all white spaces"
+ exit 5
+fi
+diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B -w "$1" "$2"
+ echo "Files match if we ignore case and discard all white spaces"
+ exit 5
+fi
+wd=`which wdiff`
+if [ "$wd" != "" ]; then
+ wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null
+ if [ "$?" == "0" ]; then
+ echo -e "wdiff \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B -w "$1" "$2"
+ echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff"
+ echo "diff has a bug that, if a line contains a single space, this is not discarded by -w"
+ exit 5
+ fi
+fi
+echo -e "### files dont match - see output"
+diff -c -i -b -B -w "$1" "$2"
+echo "Differences found"
+exit 6
diff --git a/boca-1.5.0/doc/problemexamples/bits/compare/cpp b/boca-1.5.0/doc/problemexamples/bits/compare/cpp
new file mode 100755
index 0000000..4998be3
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/bits/compare/cpp
@@ -0,0 +1,97 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+# // Last modified 21/jul/2012 by cassio@ime.usp.br
+#
+# This script receives:
+# $1 team_output
+# $2 sol_output
+# $3 problem_input (might be used by some specific checkers, here it is not)
+#
+# BOCA reads the last line of the standard output
+# and pass it to judges
+#
+if [ ! -r "$1" -o ! -r "$2" ]; then
+ echo "Parameter problem"
+ exit 43
+fi
+
+# Next lines of this script just compares team_output and sol_output,
+# although it is possible to change them to more complex evaluations.
+
+diff -q "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff \"$1\" \"$2\" # files match"
+ echo "Files match exactly"
+ exit 4
+fi
+diff -q -b "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b \"$1\" \"$2\" # files match"
+ echo -e "diff -c \"$1\" \"$2\" # files dont match - see output"
+ diff -c "$1" "$2"
+ echo "Files match with differences in the amount of white spaces"
+ exit 5
+fi
+diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b "$1" "$2"
+ echo "Files match with differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B "$1" "$2"
+ echo "Files match if we ignore case and differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B "$1" "$2"
+ echo "Files match if we discard all white spaces"
+ exit 5
+fi
+diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B -w "$1" "$2"
+ echo "Files match if we ignore case and discard all white spaces"
+ exit 5
+fi
+wd=`which wdiff`
+if [ "$wd" != "" ]; then
+ wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null
+ if [ "$?" == "0" ]; then
+ echo -e "wdiff \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B -w "$1" "$2"
+ echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff"
+ echo "diff has a bug that, if a line contains a single space, this is not discarded by -w"
+ exit 5
+ fi
+fi
+echo -e "### files dont match - see output"
+diff -c -i -b -B -w "$1" "$2"
+echo "Differences found"
+exit 6
diff --git a/boca-1.5.0/doc/problemexamples/bits/compare/java b/boca-1.5.0/doc/problemexamples/bits/compare/java
new file mode 100755
index 0000000..4998be3
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/bits/compare/java
@@ -0,0 +1,97 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+# // Last modified 21/jul/2012 by cassio@ime.usp.br
+#
+# This script receives:
+# $1 team_output
+# $2 sol_output
+# $3 problem_input (might be used by some specific checkers, here it is not)
+#
+# BOCA reads the last line of the standard output
+# and pass it to judges
+#
+if [ ! -r "$1" -o ! -r "$2" ]; then
+ echo "Parameter problem"
+ exit 43
+fi
+
+# Next lines of this script just compares team_output and sol_output,
+# although it is possible to change them to more complex evaluations.
+
+diff -q "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff \"$1\" \"$2\" # files match"
+ echo "Files match exactly"
+ exit 4
+fi
+diff -q -b "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b \"$1\" \"$2\" # files match"
+ echo -e "diff -c \"$1\" \"$2\" # files dont match - see output"
+ diff -c "$1" "$2"
+ echo "Files match with differences in the amount of white spaces"
+ exit 5
+fi
+diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b "$1" "$2"
+ echo "Files match with differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B "$1" "$2"
+ echo "Files match if we ignore case and differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B "$1" "$2"
+ echo "Files match if we discard all white spaces"
+ exit 5
+fi
+diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B -w "$1" "$2"
+ echo "Files match if we ignore case and discard all white spaces"
+ exit 5
+fi
+wd=`which wdiff`
+if [ "$wd" != "" ]; then
+ wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null
+ if [ "$?" == "0" ]; then
+ echo -e "wdiff \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B -w "$1" "$2"
+ echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff"
+ echo "diff has a bug that, if a line contains a single space, this is not discarded by -w"
+ exit 5
+ fi
+fi
+echo -e "### files dont match - see output"
+diff -c -i -b -B -w "$1" "$2"
+echo "Differences found"
+exit 6
diff --git a/boca-1.5.0/doc/problemexamples/bits/compile/c b/boca-1.5.0/doc/problemexamples/bits/compile/c
new file mode 100644
index 0000000..04a08e9
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/bits/compile/c
@@ -0,0 +1,159 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 source_file
+# $2 exe_file (default run.exe)
+# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition)
+# $4 maximum allowed memory (in MBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+
+if [ "$1" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+name="$1"
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+mkdir -p src
+if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then
+ unzip "$name" -d src
+ name="*.c"
+else
+ mv $name src
+fi
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+maxm=512000
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+maxm=${4}000
+fi
+
+# setting up the timelimit according to the problem
+if [ "$3" == "" ]; then
+time=5
+else
+time=$3
+fi
+let ttime=$time+30
+
+if [ "$2" == "" ]; then
+ exe=run.exe
+else
+ exe=$2
+fi
+
+rm -f ../$exe 2>/dev/null
+cat <<EOF > compileit.sh
+#!/bin/bash
+cc=\`which gcc\`
+[ -x "\$cc" ] || cc=/usr/bin/gcc
+if [ ! -x "\$cc" ]; then
+ echo "\$cc not found or it's not executable"
+ exit 47
+fi
+cd src
+"\$cc" -static -O2 -lm -o ../$exe "$name"
+echo \$? > compileit.retcode
+exit 0
+EOF
+chmod 755 compileit.sh
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ cat <<EOF > runit.sh
+#!/bin/bash
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+echo \$? > runit.retcode
+/bin/umount /proc 2>/dev/null
+#/bin/umount /dev
+/bin/umount /sys 2>/dev/null
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail "$cdir/runit.sh"
+ ret=`cat runit.retcode`
+else
+ echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING"
+ $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+ ret=$?
+fi
+rm -rf src/
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ exit $ret
+fi
+ret=`cat compileit.retcode`
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ ret=1
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/bits/compile/cpp b/boca-1.5.0/doc/problemexamples/bits/compile/cpp
new file mode 100644
index 0000000..2ec55ac
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/bits/compile/cpp
@@ -0,0 +1,159 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 source_file
+# $2 exe_file (default run.exe)
+# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition)
+# $4 maximum allowed memory (in MBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+
+if [ "$1" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+name="$1"
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+mkdir -p src
+if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then
+ unzip "$name" -d src
+ name="*.c"
+else
+ mv $name src
+fi
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+maxm=512000
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+maxm=${4}000
+fi
+
+# setting up the timelimit according to the problem
+if [ "$3" == "" ]; then
+time=5
+else
+time=$3
+fi
+let ttime=$time+30
+
+if [ "$2" == "" ]; then
+ exe=run.exe
+else
+ exe=$2
+fi
+
+rm -f ../$exe 2>/dev/null
+cat <<EOF > compileit.sh
+#!/bin/bash
+cc=\`which g++\`
+[ -x "\$cc" ] || cc=/usr/bin/g++
+if [ ! -x "\$cc" ]; then
+ echo "\$cc not found or it's not executable"
+ exit 47
+fi
+cd src
+"\$cc" -static -O2 -lm -o ../$exe "$name"
+echo \$? > compileit.retcode
+exit 0
+EOF
+chmod 755 compileit.sh
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ cat <<EOF > runit.sh
+#!/bin/bash
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+echo \$? > runit.retcode
+/bin/umount /proc 2>/dev/null
+#/bin/umount /dev
+/bin/umount /sys 2>/dev/null
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail "$cdir/runit.sh"
+ ret=`cat runit.retcode`
+else
+ echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING"
+ $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+ ret=$?
+fi
+rm -rf src/
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ exit $ret
+fi
+ret=`cat compileit.retcode`
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ ret=1
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/bits/compile/java b/boca-1.5.0/doc/problemexamples/bits/compile/java
new file mode 100644
index 0000000..dae050e
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/bits/compile/java
@@ -0,0 +1,176 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 source_file
+# $2 exe_file (default run.jar)
+# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition)
+# $4 maximum allowed memory (in MBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+if [ "$1" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+name="$1"
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+mkdir -p src
+if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then
+ unzip "$name" -d src
+ if [ "${name##*.}" == "zip" ]; then
+ name=`basename $name .zip`
+ else
+ name=`basename $name .ZIP`
+ fi
+else
+ mv $name src
+fi
+
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$4
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+maxm=512
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+maxm=$4
+fi
+
+if [ "$2" == "" ]; then
+ jarfile=run.jar
+else
+ jarfile=$2
+fi
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+
+cat <<EOF > compileit.sh
+#!/bin/bash
+javac=`which javac`
+[ -x "\$javac" ] || javac=/usr/bin/javac
+if [ ! -x \$javac ]; then
+ echo "\$javac not found or it's not executable"
+ exit 47
+fi
+jar=`which jar`
+[ -x "\$jar" ] || jar=/usr/bin/jar
+if [ ! -x \$jar ]; then
+ echo "\$jar not found or it's not executable"
+ exit 47
+fi
+export CLASSPATH=.:\$CLASSPATH
+cd src
+if [ -r "$name" ]; then
+ \$javac -Xmx${maxm}M -Xms${maxm}M "$name"
+ echo \$? > compileit.retcode
+fi
+find . -name "*.java" | while read lin; do
+ \$javac -Xmx${maxm}M -Xms${maxm}M "\$lin"
+ echo \$? > compileit.retcode
+done
+rm -f ../$jarfile
+\$jar cvf ../$jarfile *
+EOF
+chmod 755 compileit.sh
+
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ cat <<EOF > runit.sh
+#!/bin/bash
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+
+$sf -r1 -t$time -T$ttime -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 ./compileit.sh
+
+/bin/umount /proc 2>/dev/null
+#/bin/umount /dev
+/bin/umount /sys 2>/dev/null
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail "$cdir/runit.sh"
+ ret=`cat runit.retcode`
+else
+ echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING"
+# $javac "$name"
+ $sf -r1 -t$time -T$ttime -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 ./compileit.sh
+ ret=$?
+fi
+rm -rf src/
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ exit $ret
+fi
+ret=`cat compileit.retcode`
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ ret=1
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/bits/description/bits.txt b/boca-1.5.0/doc/problemexamples/bits/description/bits.txt
new file mode 100644
index 0000000..4cd89f0
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/bits/description/bits.txt
@@ -0,0 +1 @@
+THIS IS THE FILE DESCRIBING THE PROBLEM! IT CAN BE A PDF OR ANY OTHER FORMAT...
diff --git a/boca-1.5.0/doc/problemtemplate/description/problem.info b/boca-1.5.0/doc/problemexamples/bits/description/problem.info
index e1bc487..e1bc487 100644
--- a/boca-1.5.0/doc/problemtemplate/description/problem.info
+++ b/boca-1.5.0/doc/problemexamples/bits/description/problem.info
diff --git a/boca-1.5.0/doc/problemtemplate/input/bits b/boca-1.5.0/doc/problemexamples/bits/input/bits
index ef548be..ef548be 100644
--- a/boca-1.5.0/doc/problemtemplate/input/bits
+++ b/boca-1.5.0/doc/problemexamples/bits/input/bits
diff --git a/boca-1.5.0/doc/problemexamples/bits/limits/c b/boca-1.5.0/doc/problemexamples/bits/limits/c
new file mode 100644
index 0000000..b48a3b7
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/bits/limits/c
@@ -0,0 +1,13 @@
+#!/bin/bash
+# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename
+echo 4
+# and the number of repetitions to run within the given timelimit in the second line
+echo 10
+# and the maximum amount of memory per repetition in the third line (in Mbytes)
+echo 512
+# and shall return zero to indicate no failure
+exit 0
+# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be
+# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is
+# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs
+# the value.
diff --git a/boca-1.5.0/doc/problemexamples/bits/limits/cpp b/boca-1.5.0/doc/problemexamples/bits/limits/cpp
new file mode 100644
index 0000000..b48a3b7
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/bits/limits/cpp
@@ -0,0 +1,13 @@
+#!/bin/bash
+# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename
+echo 4
+# and the number of repetitions to run within the given timelimit in the second line
+echo 10
+# and the maximum amount of memory per repetition in the third line (in Mbytes)
+echo 512
+# and shall return zero to indicate no failure
+exit 0
+# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be
+# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is
+# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs
+# the value.
diff --git a/boca-1.5.0/doc/problemexamples/bits/limits/java b/boca-1.5.0/doc/problemexamples/bits/limits/java
new file mode 100644
index 0000000..b48a3b7
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/bits/limits/java
@@ -0,0 +1,13 @@
+#!/bin/bash
+# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename
+echo 4
+# and the number of repetitions to run within the given timelimit in the second line
+echo 10
+# and the maximum amount of memory per repetition in the third line (in Mbytes)
+echo 512
+# and shall return zero to indicate no failure
+exit 0
+# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be
+# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is
+# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs
+# the value.
diff --git a/boca-1.5.0/doc/problemtemplate/output/bits b/boca-1.5.0/doc/problemexamples/bits/output/bits
index 7749442..7749442 100644
--- a/boca-1.5.0/doc/problemtemplate/output/bits
+++ b/boca-1.5.0/doc/problemexamples/bits/output/bits
diff --git a/boca-1.5.0/doc/problemexamples/bits/run/c b/boca-1.5.0/doc/problemexamples/bits/run/c
new file mode 100755
index 0000000..d65ed58
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/bits/run/c
@@ -0,0 +1,124 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 exe_file
+# $2 input_file
+# $3 timelimit (limit to run all the repetitions, by default only one repetition)
+# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
+# $5 maximum allowed memory (in KBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+
+if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+name=`basename "$1"`
+if [ ! -x "$name" ]; then
+ echo "$1 not found (or is not in the current dir) or it's not executable"
+ exit 44
+fi
+if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then
+ echo "WARNING: executable file extension is not .exe"
+fi
+input=`basename "$2"`
+if [ ! -r "$input" ]; then
+ echo "$2 not found (or is not in the current dir) or it's not readable"
+ exit 45
+fi
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$3
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+nruns=1
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+nruns=$4
+fi
+maxm=512000
+if [ "$5" != "" -a "$5" -gt "0" ]; then
+maxm=${5}000
+fi
+
+rm -f stdin0 2>/dev/null
+mv "$input" stdin0
+
+rm -f run.exe 2>/dev/null
+mv "$name" run.exe
+file run.exe | grep -iq "statically linked"
+if [ "$?" != "0" ]; then
+ echo "Aborting because $name is not statically linked"
+ exit 47
+fi
+
+cdir=`pwd`
+echo "Current directory is $cdir -- chrooting on it" >&2
+$sf -F10 -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe
+ret=$?
+if [ $ret -gt 10 ]; then
+ ret=0
+fi
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/bits/run/cpp b/boca-1.5.0/doc/problemexamples/bits/run/cpp
new file mode 100755
index 0000000..9b2d092
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/bits/run/cpp
@@ -0,0 +1,123 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 exe_file
+# $2 input_file
+# $3 timelimit (limit to run all the repetitions, by default only one repetition)
+# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
+# $5 maximum allowed memory (in KBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+
+if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -x "$1" ]; then
+ echo "$1 not found or it's not executable"
+ exit 44
+fi
+name="$1"
+if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then
+ echo "WARNING: executable file extension is not .exe"
+fi
+if [ ! -r "$2" ]; then
+ echo "$2 not found or it's not readable"
+ exit 45
+fi
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$3
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+nruns=1
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+nruns=$4
+fi
+maxm=512000
+if [ "$5" != "" -a "$5" -gt "0" ]; then
+maxm=${5}000
+fi
+
+rm -f stdin0 2>/dev/null
+mv "$2" stdin0
+
+rm -f run.exe 2>/dev/null
+mv "$name" run.exe
+file run.exe | grep -iq "statically linked"
+if [ "$?" != "0" ]; then
+ echo "Aborting because $name is not statically linked"
+ exit 47
+fi
+
+cdir=`pwd`
+echo "Current directory is $cdir -- chrooting on it" >&2
+$sf -F10 -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe
+ret=$?
+if [ $ret -gt 10 ]; then
+ ret=0
+fi
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/bits/run/java b/boca-1.5.0/doc/problemexamples/bits/run/java
new file mode 100755
index 0000000..945f15d
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/bits/run/java
@@ -0,0 +1,163 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 main_class
+# $2 input_file
+# $3 timelimit (limit to run all the repetitions, by default only one repetition)
+# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
+# $5 maximum allowed memory (in KBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+
+if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -r run.jar ]; then
+ echo "ERROR: file run.jar not found - possible error during compilation"
+ exit 1
+fi
+name="$1"
+if [ "${name##*.}" == "class" -a "${name##*.}" == "CLASS" ]; then
+ echo "WARNING: removing .class file extension"
+fi
+if [ "${name##*.}" == "class" ]; then
+ name=`basename "$1" .class`
+fi
+if [ "${name##*.}" == "CLASS" ]; then
+ name=`basename "$1" .CLASS`
+fi
+input=`basename "$2"`
+if [ ! -r "$input" ]; then
+ echo "$2 not found (or is not in the current dir) or it's not readable"
+ exit 45
+fi
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$3
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+nruns=1
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+nruns=$4
+fi
+maxm=512
+if [ "$5" != "" -a "$5" -gt "0" ]; then
+maxm=${5}
+fi
+
+rm -f stdin0 2>/dev/null
+mv "$input" stdin0
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ cat <<EOF > runit.sh
+#!/bin/bash
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+java=`which java`
+[ -x "$java" ] || java=/usr/bin/java
+if [ ! -x $java ]; then
+ echo "$java not found or it's not executable"
+ exit 47
+fi
+export CLASSPATH=.:./run.jar:$CLASSPATH
+cd $cdir
+$sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 -- $java -Xmx${maxm}M -Xms${maxm}M "$name"
+echo \$? > runit.retcode
+/bin/umount /proc 2>/dev/null
+#/bin/umount /dev
+/bin/umount /sys 2>/dev/null
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail $cdir/runit.sh
+ ret=`cat runit.retcode`
+ if [ "$ret" == "" ]; then
+ echo "Execution error - check autojudging"
+ exit 49
+ fi
+ if [ $ret -gt 10 ]; then
+ echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <"
+ exit 9
+ fi
+ else
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
+# $java "$name" < stdin0
+ $sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 -- $java -cp run.jar -Xmx${maxm}M -Xms${maxm}M "$name"
+ ret=$?
+ fi
+ if [ $ret -gt 10 ]; then
+ echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <"
+ ret=9
+ fi
+fi
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/bits/tests/c b/boca-1.5.0/doc/problemexamples/bits/tests/c
new file mode 100755
index 0000000..1a0ca95
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/bits/tests/c
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+cat > test.c <<EOF
+int main() {
+ char s[100];
+ scanf("%s", s);
+ printf("%s\n",s);
+ return 0;
+}
+EOF
+cat > test.in <<EOF
+inputdata
+EOF
+
+TL=2
+REP=10
+../compile/c test.c test.exe TL
+../run/c test.exe test.in TL REP
+output=`cat stdout0`
+if [ "$output" != "inputdata" ]; then
+ echo "ERROR"
+ exit 1
+fi
+exit 0
diff --git a/boca-1.5.0/doc/problemexamples/formiga/compare/c b/boca-1.5.0/doc/problemexamples/formiga/compare/c
new file mode 100755
index 0000000..4998be3
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/compare/c
@@ -0,0 +1,97 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+# // Last modified 21/jul/2012 by cassio@ime.usp.br
+#
+# This script receives:
+# $1 team_output
+# $2 sol_output
+# $3 problem_input (might be used by some specific checkers, here it is not)
+#
+# BOCA reads the last line of the standard output
+# and pass it to judges
+#
+if [ ! -r "$1" -o ! -r "$2" ]; then
+ echo "Parameter problem"
+ exit 43
+fi
+
+# Next lines of this script just compares team_output and sol_output,
+# although it is possible to change them to more complex evaluations.
+
+diff -q "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff \"$1\" \"$2\" # files match"
+ echo "Files match exactly"
+ exit 4
+fi
+diff -q -b "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b \"$1\" \"$2\" # files match"
+ echo -e "diff -c \"$1\" \"$2\" # files dont match - see output"
+ diff -c "$1" "$2"
+ echo "Files match with differences in the amount of white spaces"
+ exit 5
+fi
+diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b "$1" "$2"
+ echo "Files match with differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B "$1" "$2"
+ echo "Files match if we ignore case and differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B "$1" "$2"
+ echo "Files match if we discard all white spaces"
+ exit 5
+fi
+diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B -w "$1" "$2"
+ echo "Files match if we ignore case and discard all white spaces"
+ exit 5
+fi
+wd=`which wdiff`
+if [ "$wd" != "" ]; then
+ wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null
+ if [ "$?" == "0" ]; then
+ echo -e "wdiff \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B -w "$1" "$2"
+ echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff"
+ echo "diff has a bug that, if a line contains a single space, this is not discarded by -w"
+ exit 5
+ fi
+fi
+echo -e "### files dont match - see output"
+diff -c -i -b -B -w "$1" "$2"
+echo "Differences found"
+exit 6
diff --git a/boca-1.5.0/doc/problemexamples/formiga/compare/cpp b/boca-1.5.0/doc/problemexamples/formiga/compare/cpp
new file mode 100755
index 0000000..4998be3
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/compare/cpp
@@ -0,0 +1,97 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+# // Last modified 21/jul/2012 by cassio@ime.usp.br
+#
+# This script receives:
+# $1 team_output
+# $2 sol_output
+# $3 problem_input (might be used by some specific checkers, here it is not)
+#
+# BOCA reads the last line of the standard output
+# and pass it to judges
+#
+if [ ! -r "$1" -o ! -r "$2" ]; then
+ echo "Parameter problem"
+ exit 43
+fi
+
+# Next lines of this script just compares team_output and sol_output,
+# although it is possible to change them to more complex evaluations.
+
+diff -q "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff \"$1\" \"$2\" # files match"
+ echo "Files match exactly"
+ exit 4
+fi
+diff -q -b "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b \"$1\" \"$2\" # files match"
+ echo -e "diff -c \"$1\" \"$2\" # files dont match - see output"
+ diff -c "$1" "$2"
+ echo "Files match with differences in the amount of white spaces"
+ exit 5
+fi
+diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b "$1" "$2"
+ echo "Files match with differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B "$1" "$2"
+ echo "Files match if we ignore case and differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B "$1" "$2"
+ echo "Files match if we discard all white spaces"
+ exit 5
+fi
+diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B -w "$1" "$2"
+ echo "Files match if we ignore case and discard all white spaces"
+ exit 5
+fi
+wd=`which wdiff`
+if [ "$wd" != "" ]; then
+ wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null
+ if [ "$?" == "0" ]; then
+ echo -e "wdiff \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B -w "$1" "$2"
+ echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff"
+ echo "diff has a bug that, if a line contains a single space, this is not discarded by -w"
+ exit 5
+ fi
+fi
+echo -e "### files dont match - see output"
+diff -c -i -b -B -w "$1" "$2"
+echo "Differences found"
+exit 6
diff --git a/boca-1.5.0/doc/problemexamples/formiga/compare/java b/boca-1.5.0/doc/problemexamples/formiga/compare/java
new file mode 100755
index 0000000..4998be3
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/compare/java
@@ -0,0 +1,97 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+# // Last modified 21/jul/2012 by cassio@ime.usp.br
+#
+# This script receives:
+# $1 team_output
+# $2 sol_output
+# $3 problem_input (might be used by some specific checkers, here it is not)
+#
+# BOCA reads the last line of the standard output
+# and pass it to judges
+#
+if [ ! -r "$1" -o ! -r "$2" ]; then
+ echo "Parameter problem"
+ exit 43
+fi
+
+# Next lines of this script just compares team_output and sol_output,
+# although it is possible to change them to more complex evaluations.
+
+diff -q "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff \"$1\" \"$2\" # files match"
+ echo "Files match exactly"
+ exit 4
+fi
+diff -q -b "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b \"$1\" \"$2\" # files match"
+ echo -e "diff -c \"$1\" \"$2\" # files dont match - see output"
+ diff -c "$1" "$2"
+ echo "Files match with differences in the amount of white spaces"
+ exit 5
+fi
+diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b "$1" "$2"
+ echo "Files match with differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B "$1" "$2"
+ echo "Files match if we ignore case and differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B "$1" "$2"
+ echo "Files match if we discard all white spaces"
+ exit 5
+fi
+diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B -w "$1" "$2"
+ echo "Files match if we ignore case and discard all white spaces"
+ exit 5
+fi
+wd=`which wdiff`
+if [ "$wd" != "" ]; then
+ wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null
+ if [ "$?" == "0" ]; then
+ echo -e "wdiff \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B -w "$1" "$2"
+ echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff"
+ echo "diff has a bug that, if a line contains a single space, this is not discarded by -w"
+ exit 5
+ fi
+fi
+echo -e "### files dont match - see output"
+diff -c -i -b -B -w "$1" "$2"
+echo "Differences found"
+exit 6
diff --git a/boca-1.5.0/doc/problemexamples/formiga/compile/c b/boca-1.5.0/doc/problemexamples/formiga/compile/c
new file mode 100644
index 0000000..04a08e9
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/compile/c
@@ -0,0 +1,159 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 source_file
+# $2 exe_file (default run.exe)
+# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition)
+# $4 maximum allowed memory (in MBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+
+if [ "$1" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+name="$1"
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+mkdir -p src
+if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then
+ unzip "$name" -d src
+ name="*.c"
+else
+ mv $name src
+fi
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+maxm=512000
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+maxm=${4}000
+fi
+
+# setting up the timelimit according to the problem
+if [ "$3" == "" ]; then
+time=5
+else
+time=$3
+fi
+let ttime=$time+30
+
+if [ "$2" == "" ]; then
+ exe=run.exe
+else
+ exe=$2
+fi
+
+rm -f ../$exe 2>/dev/null
+cat <<EOF > compileit.sh
+#!/bin/bash
+cc=\`which gcc\`
+[ -x "\$cc" ] || cc=/usr/bin/gcc
+if [ ! -x "\$cc" ]; then
+ echo "\$cc not found or it's not executable"
+ exit 47
+fi
+cd src
+"\$cc" -static -O2 -lm -o ../$exe "$name"
+echo \$? > compileit.retcode
+exit 0
+EOF
+chmod 755 compileit.sh
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ cat <<EOF > runit.sh
+#!/bin/bash
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+echo \$? > runit.retcode
+/bin/umount /proc 2>/dev/null
+#/bin/umount /dev
+/bin/umount /sys 2>/dev/null
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail "$cdir/runit.sh"
+ ret=`cat runit.retcode`
+else
+ echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING"
+ $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+ ret=$?
+fi
+rm -rf src/
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ exit $ret
+fi
+ret=`cat compileit.retcode`
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ ret=1
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/formiga/compile/cpp b/boca-1.5.0/doc/problemexamples/formiga/compile/cpp
new file mode 100644
index 0000000..2ec55ac
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/compile/cpp
@@ -0,0 +1,159 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 source_file
+# $2 exe_file (default run.exe)
+# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition)
+# $4 maximum allowed memory (in MBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+
+if [ "$1" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+name="$1"
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+mkdir -p src
+if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then
+ unzip "$name" -d src
+ name="*.c"
+else
+ mv $name src
+fi
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+maxm=512000
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+maxm=${4}000
+fi
+
+# setting up the timelimit according to the problem
+if [ "$3" == "" ]; then
+time=5
+else
+time=$3
+fi
+let ttime=$time+30
+
+if [ "$2" == "" ]; then
+ exe=run.exe
+else
+ exe=$2
+fi
+
+rm -f ../$exe 2>/dev/null
+cat <<EOF > compileit.sh
+#!/bin/bash
+cc=\`which g++\`
+[ -x "\$cc" ] || cc=/usr/bin/g++
+if [ ! -x "\$cc" ]; then
+ echo "\$cc not found or it's not executable"
+ exit 47
+fi
+cd src
+"\$cc" -static -O2 -lm -o ../$exe "$name"
+echo \$? > compileit.retcode
+exit 0
+EOF
+chmod 755 compileit.sh
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ cat <<EOF > runit.sh
+#!/bin/bash
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+echo \$? > runit.retcode
+/bin/umount /proc 2>/dev/null
+#/bin/umount /dev
+/bin/umount /sys 2>/dev/null
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail "$cdir/runit.sh"
+ ret=`cat runit.retcode`
+else
+ echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING"
+ $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+ ret=$?
+fi
+rm -rf src/
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ exit $ret
+fi
+ret=`cat compileit.retcode`
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ ret=1
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/formiga/compile/java b/boca-1.5.0/doc/problemexamples/formiga/compile/java
new file mode 100644
index 0000000..dae050e
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/compile/java
@@ -0,0 +1,176 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 source_file
+# $2 exe_file (default run.jar)
+# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition)
+# $4 maximum allowed memory (in MBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+if [ "$1" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+name="$1"
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+mkdir -p src
+if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then
+ unzip "$name" -d src
+ if [ "${name##*.}" == "zip" ]; then
+ name=`basename $name .zip`
+ else
+ name=`basename $name .ZIP`
+ fi
+else
+ mv $name src
+fi
+
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$4
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+maxm=512
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+maxm=$4
+fi
+
+if [ "$2" == "" ]; then
+ jarfile=run.jar
+else
+ jarfile=$2
+fi
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+
+cat <<EOF > compileit.sh
+#!/bin/bash
+javac=`which javac`
+[ -x "\$javac" ] || javac=/usr/bin/javac
+if [ ! -x \$javac ]; then
+ echo "\$javac not found or it's not executable"
+ exit 47
+fi
+jar=`which jar`
+[ -x "\$jar" ] || jar=/usr/bin/jar
+if [ ! -x \$jar ]; then
+ echo "\$jar not found or it's not executable"
+ exit 47
+fi
+export CLASSPATH=.:\$CLASSPATH
+cd src
+if [ -r "$name" ]; then
+ \$javac -Xmx${maxm}M -Xms${maxm}M "$name"
+ echo \$? > compileit.retcode
+fi
+find . -name "*.java" | while read lin; do
+ \$javac -Xmx${maxm}M -Xms${maxm}M "\$lin"
+ echo \$? > compileit.retcode
+done
+rm -f ../$jarfile
+\$jar cvf ../$jarfile *
+EOF
+chmod 755 compileit.sh
+
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ cat <<EOF > runit.sh
+#!/bin/bash
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+
+$sf -r1 -t$time -T$ttime -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 ./compileit.sh
+
+/bin/umount /proc 2>/dev/null
+#/bin/umount /dev
+/bin/umount /sys 2>/dev/null
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail "$cdir/runit.sh"
+ ret=`cat runit.retcode`
+else
+ echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING"
+# $javac "$name"
+ $sf -r1 -t$time -T$ttime -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 ./compileit.sh
+ ret=$?
+fi
+rm -rf src/
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ exit $ret
+fi
+ret=`cat compileit.retcode`
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ ret=1
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/formiga/description/formiga.txt b/boca-1.5.0/doc/problemexamples/formiga/description/formiga.txt
new file mode 100644
index 0000000..4cd89f0
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/description/formiga.txt
@@ -0,0 +1 @@
+THIS IS THE FILE DESCRIBING THE PROBLEM! IT CAN BE A PDF OR ANY OTHER FORMAT...
diff --git a/boca-1.5.0/doc/problemexamples/formiga/description/problem.info b/boca-1.5.0/doc/problemexamples/formiga/description/problem.info
new file mode 100644
index 0000000..0bd73c3
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/description/problem.info
@@ -0,0 +1,3 @@
+basename=formiga
+fullname=The formiga test problem
+descfile=formiga.txt
diff --git a/boca-1.5.0/doc/problemexamples/formiga/input/formiga b/boca-1.5.0/doc/problemexamples/formiga/input/formiga
new file mode 100644
index 0000000..c9a59b2
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/input/formiga
@@ -0,0 +1,15 @@
+1 1 Norte
+4 8 Norte
+3 2 Sul
+100000 100000 Oeste
+6 6 Sul
+4 13 Oeste
+4 14 Sul
+4 13 Leste
+640 648 Norte
+45 99998 Leste
+45 99995 Oeste
+99999 99998 Norte
+99999 99996 Oeste
+445 1157 Sul
+100000 0 Qqlixo
diff --git a/boca-1.5.0/doc/problemexamples/formiga/limits/c b/boca-1.5.0/doc/problemexamples/formiga/limits/c
new file mode 100644
index 0000000..b48a3b7
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/limits/c
@@ -0,0 +1,13 @@
+#!/bin/bash
+# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename
+echo 4
+# and the number of repetitions to run within the given timelimit in the second line
+echo 10
+# and the maximum amount of memory per repetition in the third line (in Mbytes)
+echo 512
+# and shall return zero to indicate no failure
+exit 0
+# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be
+# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is
+# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs
+# the value.
diff --git a/boca-1.5.0/doc/problemexamples/formiga/limits/cpp b/boca-1.5.0/doc/problemexamples/formiga/limits/cpp
new file mode 100644
index 0000000..b48a3b7
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/limits/cpp
@@ -0,0 +1,13 @@
+#!/bin/bash
+# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename
+echo 4
+# and the number of repetitions to run within the given timelimit in the second line
+echo 10
+# and the maximum amount of memory per repetition in the third line (in Mbytes)
+echo 512
+# and shall return zero to indicate no failure
+exit 0
+# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be
+# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is
+# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs
+# the value.
diff --git a/boca-1.5.0/doc/problemexamples/formiga/limits/java b/boca-1.5.0/doc/problemexamples/formiga/limits/java
new file mode 100644
index 0000000..b48a3b7
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/limits/java
@@ -0,0 +1,13 @@
+#!/bin/bash
+# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename
+echo 4
+# and the number of repetitions to run within the given timelimit in the second line
+echo 10
+# and the maximum amount of memory per repetition in the third line (in Mbytes)
+echo 512
+# and shall return zero to indicate no failure
+exit 0
+# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be
+# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is
+# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs
+# the value.
diff --git a/boca-1.5.0/doc/problemexamples/formiga/output/formiga b/boca-1.5.0/doc/problemexamples/formiga/output/formiga
new file mode 100644
index 0000000..499641c
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/output/formiga
@@ -0,0 +1,14 @@
+100% 0 Sul
+ 25% 1 Leste
+100% 3 Oeste
+ 0% 0 Leste
+ 17% 0 Norte
+100% 15 Norte
+ 50% 7 Leste
+100% 15 Sul
+ 12% 159 Oeste
+100% 100041 Norte
+ 20% 20006 Leste
+100% 199995 Leste
+ 33% 66663 Sul
+ 1% 16 Norte
diff --git a/boca-1.5.0/doc/problemexamples/formiga/run/c b/boca-1.5.0/doc/problemexamples/formiga/run/c
new file mode 100755
index 0000000..d65ed58
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/run/c
@@ -0,0 +1,124 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 exe_file
+# $2 input_file
+# $3 timelimit (limit to run all the repetitions, by default only one repetition)
+# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
+# $5 maximum allowed memory (in KBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+
+if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+name=`basename "$1"`
+if [ ! -x "$name" ]; then
+ echo "$1 not found (or is not in the current dir) or it's not executable"
+ exit 44
+fi
+if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then
+ echo "WARNING: executable file extension is not .exe"
+fi
+input=`basename "$2"`
+if [ ! -r "$input" ]; then
+ echo "$2 not found (or is not in the current dir) or it's not readable"
+ exit 45
+fi
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$3
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+nruns=1
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+nruns=$4
+fi
+maxm=512000
+if [ "$5" != "" -a "$5" -gt "0" ]; then
+maxm=${5}000
+fi
+
+rm -f stdin0 2>/dev/null
+mv "$input" stdin0
+
+rm -f run.exe 2>/dev/null
+mv "$name" run.exe
+file run.exe | grep -iq "statically linked"
+if [ "$?" != "0" ]; then
+ echo "Aborting because $name is not statically linked"
+ exit 47
+fi
+
+cdir=`pwd`
+echo "Current directory is $cdir -- chrooting on it" >&2
+$sf -F10 -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe
+ret=$?
+if [ $ret -gt 10 ]; then
+ ret=0
+fi
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/formiga/run/cpp b/boca-1.5.0/doc/problemexamples/formiga/run/cpp
new file mode 100755
index 0000000..9b2d092
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/run/cpp
@@ -0,0 +1,123 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 exe_file
+# $2 input_file
+# $3 timelimit (limit to run all the repetitions, by default only one repetition)
+# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
+# $5 maximum allowed memory (in KBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+
+if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -x "$1" ]; then
+ echo "$1 not found or it's not executable"
+ exit 44
+fi
+name="$1"
+if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then
+ echo "WARNING: executable file extension is not .exe"
+fi
+if [ ! -r "$2" ]; then
+ echo "$2 not found or it's not readable"
+ exit 45
+fi
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$3
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+nruns=1
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+nruns=$4
+fi
+maxm=512000
+if [ "$5" != "" -a "$5" -gt "0" ]; then
+maxm=${5}000
+fi
+
+rm -f stdin0 2>/dev/null
+mv "$2" stdin0
+
+rm -f run.exe 2>/dev/null
+mv "$name" run.exe
+file run.exe | grep -iq "statically linked"
+if [ "$?" != "0" ]; then
+ echo "Aborting because $name is not statically linked"
+ exit 47
+fi
+
+cdir=`pwd`
+echo "Current directory is $cdir -- chrooting on it" >&2
+$sf -F10 -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe
+ret=$?
+if [ $ret -gt 10 ]; then
+ ret=0
+fi
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/formiga/run/java b/boca-1.5.0/doc/problemexamples/formiga/run/java
new file mode 100755
index 0000000..945f15d
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/run/java
@@ -0,0 +1,163 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 main_class
+# $2 input_file
+# $3 timelimit (limit to run all the repetitions, by default only one repetition)
+# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
+# $5 maximum allowed memory (in KBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+
+if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -r run.jar ]; then
+ echo "ERROR: file run.jar not found - possible error during compilation"
+ exit 1
+fi
+name="$1"
+if [ "${name##*.}" == "class" -a "${name##*.}" == "CLASS" ]; then
+ echo "WARNING: removing .class file extension"
+fi
+if [ "${name##*.}" == "class" ]; then
+ name=`basename "$1" .class`
+fi
+if [ "${name##*.}" == "CLASS" ]; then
+ name=`basename "$1" .CLASS`
+fi
+input=`basename "$2"`
+if [ ! -r "$input" ]; then
+ echo "$2 not found (or is not in the current dir) or it's not readable"
+ exit 45
+fi
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$3
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+nruns=1
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+nruns=$4
+fi
+maxm=512
+if [ "$5" != "" -a "$5" -gt "0" ]; then
+maxm=${5}
+fi
+
+rm -f stdin0 2>/dev/null
+mv "$input" stdin0
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ cat <<EOF > runit.sh
+#!/bin/bash
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+java=`which java`
+[ -x "$java" ] || java=/usr/bin/java
+if [ ! -x $java ]; then
+ echo "$java not found or it's not executable"
+ exit 47
+fi
+export CLASSPATH=.:./run.jar:$CLASSPATH
+cd $cdir
+$sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 -- $java -Xmx${maxm}M -Xms${maxm}M "$name"
+echo \$? > runit.retcode
+/bin/umount /proc 2>/dev/null
+#/bin/umount /dev
+/bin/umount /sys 2>/dev/null
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail $cdir/runit.sh
+ ret=`cat runit.retcode`
+ if [ "$ret" == "" ]; then
+ echo "Execution error - check autojudging"
+ exit 49
+ fi
+ if [ $ret -gt 10 ]; then
+ echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <"
+ exit 9
+ fi
+ else
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
+# $java "$name" < stdin0
+ $sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 -- $java -cp run.jar -Xmx${maxm}M -Xms${maxm}M "$name"
+ ret=$?
+ fi
+ if [ $ret -gt 10 ]; then
+ echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <"
+ ret=9
+ fi
+fi
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/formiga/tests/c b/boca-1.5.0/doc/problemexamples/formiga/tests/c
new file mode 100755
index 0000000..1a0ca95
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/formiga/tests/c
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+cat > test.c <<EOF
+int main() {
+ char s[100];
+ scanf("%s", s);
+ printf("%s\n",s);
+ return 0;
+}
+EOF
+cat > test.in <<EOF
+inputdata
+EOF
+
+TL=2
+REP=10
+../compile/c test.c test.exe TL
+../run/c test.exe test.in TL REP
+output=`cat stdout0`
+if [ "$output" != "inputdata" ]; then
+ echo "ERROR"
+ exit 1
+fi
+exit 0
diff --git a/boca-1.5.0/doc/problemexamples/multas/compare/c b/boca-1.5.0/doc/problemexamples/multas/compare/c
new file mode 100755
index 0000000..4998be3
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/compare/c
@@ -0,0 +1,97 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+# // Last modified 21/jul/2012 by cassio@ime.usp.br
+#
+# This script receives:
+# $1 team_output
+# $2 sol_output
+# $3 problem_input (might be used by some specific checkers, here it is not)
+#
+# BOCA reads the last line of the standard output
+# and pass it to judges
+#
+if [ ! -r "$1" -o ! -r "$2" ]; then
+ echo "Parameter problem"
+ exit 43
+fi
+
+# Next lines of this script just compares team_output and sol_output,
+# although it is possible to change them to more complex evaluations.
+
+diff -q "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff \"$1\" \"$2\" # files match"
+ echo "Files match exactly"
+ exit 4
+fi
+diff -q -b "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b \"$1\" \"$2\" # files match"
+ echo -e "diff -c \"$1\" \"$2\" # files dont match - see output"
+ diff -c "$1" "$2"
+ echo "Files match with differences in the amount of white spaces"
+ exit 5
+fi
+diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b "$1" "$2"
+ echo "Files match with differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B "$1" "$2"
+ echo "Files match if we ignore case and differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B "$1" "$2"
+ echo "Files match if we discard all white spaces"
+ exit 5
+fi
+diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B -w "$1" "$2"
+ echo "Files match if we ignore case and discard all white spaces"
+ exit 5
+fi
+wd=`which wdiff`
+if [ "$wd" != "" ]; then
+ wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null
+ if [ "$?" == "0" ]; then
+ echo -e "wdiff \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B -w "$1" "$2"
+ echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff"
+ echo "diff has a bug that, if a line contains a single space, this is not discarded by -w"
+ exit 5
+ fi
+fi
+echo -e "### files dont match - see output"
+diff -c -i -b -B -w "$1" "$2"
+echo "Differences found"
+exit 6
diff --git a/boca-1.5.0/doc/problemexamples/multas/compare/cpp b/boca-1.5.0/doc/problemexamples/multas/compare/cpp
new file mode 100755
index 0000000..4998be3
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/compare/cpp
@@ -0,0 +1,97 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+# // Last modified 21/jul/2012 by cassio@ime.usp.br
+#
+# This script receives:
+# $1 team_output
+# $2 sol_output
+# $3 problem_input (might be used by some specific checkers, here it is not)
+#
+# BOCA reads the last line of the standard output
+# and pass it to judges
+#
+if [ ! -r "$1" -o ! -r "$2" ]; then
+ echo "Parameter problem"
+ exit 43
+fi
+
+# Next lines of this script just compares team_output and sol_output,
+# although it is possible to change them to more complex evaluations.
+
+diff -q "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff \"$1\" \"$2\" # files match"
+ echo "Files match exactly"
+ exit 4
+fi
+diff -q -b "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b \"$1\" \"$2\" # files match"
+ echo -e "diff -c \"$1\" \"$2\" # files dont match - see output"
+ diff -c "$1" "$2"
+ echo "Files match with differences in the amount of white spaces"
+ exit 5
+fi
+diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b "$1" "$2"
+ echo "Files match with differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B "$1" "$2"
+ echo "Files match if we ignore case and differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B "$1" "$2"
+ echo "Files match if we discard all white spaces"
+ exit 5
+fi
+diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B -w "$1" "$2"
+ echo "Files match if we ignore case and discard all white spaces"
+ exit 5
+fi
+wd=`which wdiff`
+if [ "$wd" != "" ]; then
+ wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null
+ if [ "$?" == "0" ]; then
+ echo -e "wdiff \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B -w "$1" "$2"
+ echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff"
+ echo "diff has a bug that, if a line contains a single space, this is not discarded by -w"
+ exit 5
+ fi
+fi
+echo -e "### files dont match - see output"
+diff -c -i -b -B -w "$1" "$2"
+echo "Differences found"
+exit 6
diff --git a/boca-1.5.0/doc/problemexamples/multas/compare/java b/boca-1.5.0/doc/problemexamples/multas/compare/java
new file mode 100755
index 0000000..4998be3
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/compare/java
@@ -0,0 +1,97 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+# // Last modified 21/jul/2012 by cassio@ime.usp.br
+#
+# This script receives:
+# $1 team_output
+# $2 sol_output
+# $3 problem_input (might be used by some specific checkers, here it is not)
+#
+# BOCA reads the last line of the standard output
+# and pass it to judges
+#
+if [ ! -r "$1" -o ! -r "$2" ]; then
+ echo "Parameter problem"
+ exit 43
+fi
+
+# Next lines of this script just compares team_output and sol_output,
+# although it is possible to change them to more complex evaluations.
+
+diff -q "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff \"$1\" \"$2\" # files match"
+ echo "Files match exactly"
+ exit 4
+fi
+diff -q -b "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b \"$1\" \"$2\" # files match"
+ echo -e "diff -c \"$1\" \"$2\" # files dont match - see output"
+ diff -c "$1" "$2"
+ echo "Files match with differences in the amount of white spaces"
+ exit 5
+fi
+diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b "$1" "$2"
+ echo "Files match with differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B "$1" "$2"
+ echo "Files match if we ignore case and differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B "$1" "$2"
+ echo "Files match if we discard all white spaces"
+ exit 5
+fi
+diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B -w "$1" "$2"
+ echo "Files match if we ignore case and discard all white spaces"
+ exit 5
+fi
+wd=`which wdiff`
+if [ "$wd" != "" ]; then
+ wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null
+ if [ "$?" == "0" ]; then
+ echo -e "wdiff \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B -w "$1" "$2"
+ echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff"
+ echo "diff has a bug that, if a line contains a single space, this is not discarded by -w"
+ exit 5
+ fi
+fi
+echo -e "### files dont match - see output"
+diff -c -i -b -B -w "$1" "$2"
+echo "Differences found"
+exit 6
diff --git a/boca-1.5.0/doc/problemexamples/multas/compile/c b/boca-1.5.0/doc/problemexamples/multas/compile/c
new file mode 100644
index 0000000..04a08e9
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/compile/c
@@ -0,0 +1,159 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 source_file
+# $2 exe_file (default run.exe)
+# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition)
+# $4 maximum allowed memory (in MBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+
+if [ "$1" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+name="$1"
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+mkdir -p src
+if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then
+ unzip "$name" -d src
+ name="*.c"
+else
+ mv $name src
+fi
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+maxm=512000
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+maxm=${4}000
+fi
+
+# setting up the timelimit according to the problem
+if [ "$3" == "" ]; then
+time=5
+else
+time=$3
+fi
+let ttime=$time+30
+
+if [ "$2" == "" ]; then
+ exe=run.exe
+else
+ exe=$2
+fi
+
+rm -f ../$exe 2>/dev/null
+cat <<EOF > compileit.sh
+#!/bin/bash
+cc=\`which gcc\`
+[ -x "\$cc" ] || cc=/usr/bin/gcc
+if [ ! -x "\$cc" ]; then
+ echo "\$cc not found or it's not executable"
+ exit 47
+fi
+cd src
+"\$cc" -static -O2 -lm -o ../$exe "$name"
+echo \$? > compileit.retcode
+exit 0
+EOF
+chmod 755 compileit.sh
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ cat <<EOF > runit.sh
+#!/bin/bash
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+echo \$? > runit.retcode
+/bin/umount /proc 2>/dev/null
+#/bin/umount /dev
+/bin/umount /sys 2>/dev/null
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail "$cdir/runit.sh"
+ ret=`cat runit.retcode`
+else
+ echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING"
+ $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+ ret=$?
+fi
+rm -rf src/
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ exit $ret
+fi
+ret=`cat compileit.retcode`
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ ret=1
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/multas/compile/cpp b/boca-1.5.0/doc/problemexamples/multas/compile/cpp
new file mode 100644
index 0000000..2ec55ac
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/compile/cpp
@@ -0,0 +1,159 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 source_file
+# $2 exe_file (default run.exe)
+# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition)
+# $4 maximum allowed memory (in MBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+
+if [ "$1" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+name="$1"
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+mkdir -p src
+if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then
+ unzip "$name" -d src
+ name="*.c"
+else
+ mv $name src
+fi
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+maxm=512000
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+maxm=${4}000
+fi
+
+# setting up the timelimit according to the problem
+if [ "$3" == "" ]; then
+time=5
+else
+time=$3
+fi
+let ttime=$time+30
+
+if [ "$2" == "" ]; then
+ exe=run.exe
+else
+ exe=$2
+fi
+
+rm -f ../$exe 2>/dev/null
+cat <<EOF > compileit.sh
+#!/bin/bash
+cc=\`which g++\`
+[ -x "\$cc" ] || cc=/usr/bin/g++
+if [ ! -x "\$cc" ]; then
+ echo "\$cc not found or it's not executable"
+ exit 47
+fi
+cd src
+"\$cc" -static -O2 -lm -o ../$exe "$name"
+echo \$? > compileit.retcode
+exit 0
+EOF
+chmod 755 compileit.sh
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ cat <<EOF > runit.sh
+#!/bin/bash
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+echo \$? > runit.retcode
+/bin/umount /proc 2>/dev/null
+#/bin/umount /dev
+/bin/umount /sys 2>/dev/null
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail "$cdir/runit.sh"
+ ret=`cat runit.retcode`
+else
+ echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING"
+ $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+ ret=$?
+fi
+rm -rf src/
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ exit $ret
+fi
+ret=`cat compileit.retcode`
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ ret=1
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/multas/compile/java b/boca-1.5.0/doc/problemexamples/multas/compile/java
new file mode 100644
index 0000000..dae050e
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/compile/java
@@ -0,0 +1,176 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 source_file
+# $2 exe_file (default run.jar)
+# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition)
+# $4 maximum allowed memory (in MBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+if [ "$1" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+name="$1"
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+mkdir -p src
+if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then
+ unzip "$name" -d src
+ if [ "${name##*.}" == "zip" ]; then
+ name=`basename $name .zip`
+ else
+ name=`basename $name .ZIP`
+ fi
+else
+ mv $name src
+fi
+
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$4
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+maxm=512
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+maxm=$4
+fi
+
+if [ "$2" == "" ]; then
+ jarfile=run.jar
+else
+ jarfile=$2
+fi
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+
+cat <<EOF > compileit.sh
+#!/bin/bash
+javac=`which javac`
+[ -x "\$javac" ] || javac=/usr/bin/javac
+if [ ! -x \$javac ]; then
+ echo "\$javac not found or it's not executable"
+ exit 47
+fi
+jar=`which jar`
+[ -x "\$jar" ] || jar=/usr/bin/jar
+if [ ! -x \$jar ]; then
+ echo "\$jar not found or it's not executable"
+ exit 47
+fi
+export CLASSPATH=.:\$CLASSPATH
+cd src
+if [ -r "$name" ]; then
+ \$javac -Xmx${maxm}M -Xms${maxm}M "$name"
+ echo \$? > compileit.retcode
+fi
+find . -name "*.java" | while read lin; do
+ \$javac -Xmx${maxm}M -Xms${maxm}M "\$lin"
+ echo \$? > compileit.retcode
+done
+rm -f ../$jarfile
+\$jar cvf ../$jarfile *
+EOF
+chmod 755 compileit.sh
+
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ cat <<EOF > runit.sh
+#!/bin/bash
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+
+$sf -r1 -t$time -T$ttime -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 ./compileit.sh
+
+/bin/umount /proc 2>/dev/null
+#/bin/umount /dev
+/bin/umount /sys 2>/dev/null
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail "$cdir/runit.sh"
+ ret=`cat runit.retcode`
+else
+ echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING"
+# $javac "$name"
+ $sf -r1 -t$time -T$ttime -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 ./compileit.sh
+ ret=$?
+fi
+rm -rf src/
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ exit $ret
+fi
+ret=`cat compileit.retcode`
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ ret=1
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/multas/description/m.txt b/boca-1.5.0/doc/problemexamples/multas/description/m.txt
new file mode 100644
index 0000000..4cd89f0
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/description/m.txt
@@ -0,0 +1 @@
+THIS IS THE FILE DESCRIBING THE PROBLEM! IT CAN BE A PDF OR ANY OTHER FORMAT...
diff --git a/boca-1.5.0/doc/problemexamples/multas/description/problem.info b/boca-1.5.0/doc/problemexamples/multas/description/problem.info
new file mode 100644
index 0000000..45944fc
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/description/problem.info
@@ -0,0 +1,3 @@
+basename=multas
+fullname=The Poblem of multas
+descfile=m.txt
diff --git a/boca-1.5.0/doc/problemexamples/multas/input/file b/boca-1.5.0/doc/problemexamples/multas/input/file
new file mode 100644
index 0000000..bb947cd
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/input/file
@@ -0,0 +1,518 @@
+5
+john
+mary
+bob
+rick
+donna
+4
+4
+5
+7
+7
+7
+-2
+3
+paul
+irene
+charlie
+5
+5
+5
+5
+5
+4
+7
+7
+4
+4
+4
+4
+-3
+19
+Zzzzzzzzzzzzzzzzzzzs
+zzzzzzzzzzzzzzzzzzzr
+zzzzzzzzzzzzzzzzzzzq
+zzzzzzzzzzzzzzzzzzzpzzzzzzzzzzzzzzzzzzzpzzzzzzzzzzzzzzzzzzzpzzzzzzzzzzzzzzzzzzzp
+zzzzzzzzzzzzzzzzzzzo
+zzzzzzzzzzzzzzzzzzzn
+zzzzzzzzzzzzzzzzzzzm
+zzzzzzzzzzzzzzzzzzzl
+zzzzzzzzzzzzzzzzzzzk
+zzzzzzzzzzzzzzzzzzzj
+zzzzzzzzzzzzzzzzzzzi
+zzzzzzzzzzzzzzzzzzzh
+zzzzzzzzzzzzzzzzzzzg
+zzzzzzzzzzzzzzzzzzzf
+zzzzzzzzzzzzzzzzzzze
+zzzzzzzzzzzzzzzzzzzd
+zzzzzzzzzzzzzzzzzzzc
+zzzzzzzzzzzzzzzzzzzb
+Zzzzzzzzzzzzzzzzzzza
+250
+250
+250
+250
+250
+250
+250
+250
+250
+250
+250
+250
+250
+250
+250
+250
+250
+250
+250
+-50
+19
+Zzzzzzzzzzzzzzzzzzzs
+zzzzzzzzzzzzzzzzzzzr
+zzzzzzzzzzzzzzzzzzzq
+zzzzzzzzzzzzzzzzzzzp
+zzzzzzzzzzzzzzzzzzzo
+zzzzzzzzzzzzzzzzzzzn
+zzzzzzzzzzzzzzzzzzzm
+zzzzzzzzzzzzzzzzzzzl
+zzzzzzzzzzzzzzzzzzzk
+zzzzzzzzzzzzzzzzzzzj
+zzzzzzzzzzzzzzzzzzzi
+zzzzzzzzzzzzzzzzzzzh
+zzzzzzzzzzzzzzzzzzzg
+zzzzzzzzzzzzzzzzzzzf
+zzzzzzzzzzzzzzzzzzze
+zzzzzzzzzzzzzzzzzzzd
+zzzzzzzzzzzzzzzzzzzc
+zzzzzzzzzzzzzzzzzzzb
+Zzzzzzzzzzzzzzzzzzza
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+-50
+5
+a
+b
+c
+d
+e
+5
+4
+3
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+-3
+0
diff --git a/boca-1.5.0/doc/problemexamples/multas/limits/c b/boca-1.5.0/doc/problemexamples/multas/limits/c
new file mode 100644
index 0000000..b48a3b7
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/limits/c
@@ -0,0 +1,13 @@
+#!/bin/bash
+# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename
+echo 4
+# and the number of repetitions to run within the given timelimit in the second line
+echo 10
+# and the maximum amount of memory per repetition in the third line (in Mbytes)
+echo 512
+# and shall return zero to indicate no failure
+exit 0
+# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be
+# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is
+# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs
+# the value.
diff --git a/boca-1.5.0/doc/problemexamples/multas/limits/cpp b/boca-1.5.0/doc/problemexamples/multas/limits/cpp
new file mode 100644
index 0000000..b48a3b7
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/limits/cpp
@@ -0,0 +1,13 @@
+#!/bin/bash
+# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename
+echo 4
+# and the number of repetitions to run within the given timelimit in the second line
+echo 10
+# and the maximum amount of memory per repetition in the third line (in Mbytes)
+echo 512
+# and shall return zero to indicate no failure
+exit 0
+# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be
+# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is
+# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs
+# the value.
diff --git a/boca-1.5.0/doc/problemexamples/multas/limits/java b/boca-1.5.0/doc/problemexamples/multas/limits/java
new file mode 100644
index 0000000..b48a3b7
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/limits/java
@@ -0,0 +1,13 @@
+#!/bin/bash
+# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename
+echo 4
+# and the number of repetitions to run within the given timelimit in the second line
+echo 10
+# and the maximum amount of memory per repetition in the third line (in Mbytes)
+echo 512
+# and shall return zero to indicate no failure
+exit 0
+# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be
+# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is
+# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs
+# the value.
diff --git a/boca-1.5.0/doc/problemexamples/multas/output/file b/boca-1.5.0/doc/problemexamples/multas/output/file
new file mode 100644
index 0000000..5855c90
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/output/file
@@ -0,0 +1,466 @@
+Familia 1
+Multa 1 bob
+Multa 2 donna
+Multa 3 john
+Multa 4 mary
+Multa 5 rick
+Multa 6 bob
+
+Familia 2
+Multa 1 charlie
+Multa 2 irene
+Multa 3 paul
+Multa 4 charlie
+Multa 5 irene
+Multa 6 paul
+Multa 7 paul
+Multa 8 charlie
+Multa 9 irene
+Multa 10 irene
+Multa 11 paul
+Multa 12 charlie carteira suspensa
+
+Familia 3
+Multa 1 Zzzzzzzzzzzzzzzzzzza carteira suspensa
+Multa 2 zzzzzzzzzzzzzzzzzzzb carteira suspensa
+Multa 3 zzzzzzzzzzzzzzzzzzzc carteira suspensa
+Multa 4 zzzzzzzzzzzzzzzzzzzd carteira suspensa
+Multa 5 zzzzzzzzzzzzzzzzzzze carteira suspensa
+Multa 6 zzzzzzzzzzzzzzzzzzzf carteira suspensa
+Multa 7 zzzzzzzzzzzzzzzzzzzg carteira suspensa
+Multa 8 zzzzzzzzzzzzzzzzzzzh carteira suspensa
+Multa 9 zzzzzzzzzzzzzzzzzzzi carteira suspensa
+Multa 10 zzzzzzzzzzzzzzzzzzzj carteira suspensa
+Multa 11 zzzzzzzzzzzzzzzzzzzk carteira suspensa
+Multa 12 zzzzzzzzzzzzzzzzzzzl carteira suspensa
+Multa 13 zzzzzzzzzzzzzzzzzzzm carteira suspensa
+Multa 14 zzzzzzzzzzzzzzzzzzzn carteira suspensa
+Multa 15 zzzzzzzzzzzzzzzzzzzo carteira suspensa
+Multa 16 zzzzzzzzzzzzzzzzzzzpzzzzzzzzzzzzzzzzzzzpzzzzzzzzzzzzzzzzzzzpzzzzzzzzzzzzzzzzzzzp carteira suspensa
+Multa 17 zzzzzzzzzzzzzzzzzzzq carteira suspensa
+Multa 18 zzzzzzzzzzzzzzzzzzzr carteira suspensa
+Multa 19 Zzzzzzzzzzzzzzzzzzzs carteira suspensa
+
+Familia 4
+Multa 1 Zzzzzzzzzzzzzzzzzzza
+Multa 2 zzzzzzzzzzzzzzzzzzzb
+Multa 3 zzzzzzzzzzzzzzzzzzzc
+Multa 4 zzzzzzzzzzzzzzzzzzzd
+Multa 5 zzzzzzzzzzzzzzzzzzze
+Multa 6 zzzzzzzzzzzzzzzzzzzf
+Multa 7 zzzzzzzzzzzzzzzzzzzg
+Multa 8 zzzzzzzzzzzzzzzzzzzh
+Multa 9 zzzzzzzzzzzzzzzzzzzi
+Multa 10 zzzzzzzzzzzzzzzzzzzj
+Multa 11 zzzzzzzzzzzzzzzzzzzk
+Multa 12 zzzzzzzzzzzzzzzzzzzl
+Multa 13 zzzzzzzzzzzzzzzzzzzm
+Multa 14 zzzzzzzzzzzzzzzzzzzn
+Multa 15 zzzzzzzzzzzzzzzzzzzo
+Multa 16 zzzzzzzzzzzzzzzzzzzp
+Multa 17 zzzzzzzzzzzzzzzzzzzq
+Multa 18 zzzzzzzzzzzzzzzzzzzr
+Multa 19 Zzzzzzzzzzzzzzzzzzzs
+Multa 20 Zzzzzzzzzzzzzzzzzzza
+Multa 21 zzzzzzzzzzzzzzzzzzzb
+Multa 22 zzzzzzzzzzzzzzzzzzzc
+Multa 23 zzzzzzzzzzzzzzzzzzzd
+Multa 24 zzzzzzzzzzzzzzzzzzze
+Multa 25 zzzzzzzzzzzzzzzzzzzf
+Multa 26 zzzzzzzzzzzzzzzzzzzg
+Multa 27 zzzzzzzzzzzzzzzzzzzh
+Multa 28 zzzzzzzzzzzzzzzzzzzi
+Multa 29 zzzzzzzzzzzzzzzzzzzj
+Multa 30 zzzzzzzzzzzzzzzzzzzk
+Multa 31 zzzzzzzzzzzzzzzzzzzl
+Multa 32 zzzzzzzzzzzzzzzzzzzm
+Multa 33 zzzzzzzzzzzzzzzzzzzn
+Multa 34 zzzzzzzzzzzzzzzzzzzo
+Multa 35 zzzzzzzzzzzzzzzzzzzp
+Multa 36 zzzzzzzzzzzzzzzzzzzq
+Multa 37 zzzzzzzzzzzzzzzzzzzr
+Multa 38 Zzzzzzzzzzzzzzzzzzzs
+Multa 39 Zzzzzzzzzzzzzzzzzzza
+Multa 40 zzzzzzzzzzzzzzzzzzzb
+Multa 41 zzzzzzzzzzzzzzzzzzzc
+Multa 42 zzzzzzzzzzzzzzzzzzzd
+Multa 43 zzzzzzzzzzzzzzzzzzze
+Multa 44 zzzzzzzzzzzzzzzzzzzf
+Multa 45 zzzzzzzzzzzzzzzzzzzg
+Multa 46 zzzzzzzzzzzzzzzzzzzh
+Multa 47 zzzzzzzzzzzzzzzzzzzi
+Multa 48 zzzzzzzzzzzzzzzzzzzj
+Multa 49 zzzzzzzzzzzzzzzzzzzk
+Multa 50 zzzzzzzzzzzzzzzzzzzl
+Multa 51 zzzzzzzzzzzzzzzzzzzm
+Multa 52 zzzzzzzzzzzzzzzzzzzn
+Multa 53 zzzzzzzzzzzzzzzzzzzo
+Multa 54 zzzzzzzzzzzzzzzzzzzp
+Multa 55 zzzzzzzzzzzzzzzzzzzq
+Multa 56 zzzzzzzzzzzzzzzzzzzr
+Multa 57 Zzzzzzzzzzzzzzzzzzzs
+Multa 58 Zzzzzzzzzzzzzzzzzzza
+Multa 59 zzzzzzzzzzzzzzzzzzzb
+Multa 60 zzzzzzzzzzzzzzzzzzzc
+Multa 61 zzzzzzzzzzzzzzzzzzzd
+Multa 62 zzzzzzzzzzzzzzzzzzze
+Multa 63 zzzzzzzzzzzzzzzzzzzf
+Multa 64 zzzzzzzzzzzzzzzzzzzg
+Multa 65 zzzzzzzzzzzzzzzzzzzh
+Multa 66 zzzzzzzzzzzzzzzzzzzi
+Multa 67 zzzzzzzzzzzzzzzzzzzj
+Multa 68 zzzzzzzzzzzzzzzzzzzk
+Multa 69 zzzzzzzzzzzzzzzzzzzl
+Multa 70 zzzzzzzzzzzzzzzzzzzm
+Multa 71 zzzzzzzzzzzzzzzzzzzn
+Multa 72 zzzzzzzzzzzzzzzzzzzo
+Multa 73 zzzzzzzzzzzzzzzzzzzp
+Multa 74 zzzzzzzzzzzzzzzzzzzq
+Multa 75 zzzzzzzzzzzzzzzzzzzr
+Multa 76 Zzzzzzzzzzzzzzzzzzzs
+Multa 77 Zzzzzzzzzzzzzzzzzzza
+Multa 78 zzzzzzzzzzzzzzzzzzzb
+Multa 79 zzzzzzzzzzzzzzzzzzzc
+Multa 80 zzzzzzzzzzzzzzzzzzzd
+Multa 81 zzzzzzzzzzzzzzzzzzze
+Multa 82 zzzzzzzzzzzzzzzzzzzf
+Multa 83 zzzzzzzzzzzzzzzzzzzg
+Multa 84 zzzzzzzzzzzzzzzzzzzh
+Multa 85 zzzzzzzzzzzzzzzzzzzi
+Multa 86 zzzzzzzzzzzzzzzzzzzj
+Multa 87 zzzzzzzzzzzzzzzzzzzk
+Multa 88 zzzzzzzzzzzzzzzzzzzl
+Multa 89 zzzzzzzzzzzzzzzzzzzm
+Multa 90 zzzzzzzzzzzzzzzzzzzn
+Multa 91 zzzzzzzzzzzzzzzzzzzo
+Multa 92 zzzzzzzzzzzzzzzzzzzp
+Multa 93 zzzzzzzzzzzzzzzzzzzq
+Multa 94 zzzzzzzzzzzzzzzzzzzr
+Multa 95 Zzzzzzzzzzzzzzzzzzzs
+Multa 96 Zzzzzzzzzzzzzzzzzzza
+Multa 97 zzzzzzzzzzzzzzzzzzzb
+Multa 98 zzzzzzzzzzzzzzzzzzzc
+Multa 99 zzzzzzzzzzzzzzzzzzzd
+Multa 100 zzzzzzzzzzzzzzzzzzze
+Multa 101 zzzzzzzzzzzzzzzzzzzf
+Multa 102 zzzzzzzzzzzzzzzzzzzg
+Multa 103 zzzzzzzzzzzzzzzzzzzh
+Multa 104 zzzzzzzzzzzzzzzzzzzi
+Multa 105 zzzzzzzzzzzzzzzzzzzj
+Multa 106 zzzzzzzzzzzzzzzzzzzk
+Multa 107 zzzzzzzzzzzzzzzzzzzl
+Multa 108 zzzzzzzzzzzzzzzzzzzm
+Multa 109 zzzzzzzzzzzzzzzzzzzn
+Multa 110 zzzzzzzzzzzzzzzzzzzo
+Multa 111 zzzzzzzzzzzzzzzzzzzp
+Multa 112 zzzzzzzzzzzzzzzzzzzq
+Multa 113 zzzzzzzzzzzzzzzzzzzr
+Multa 114 Zzzzzzzzzzzzzzzzzzzs
+Multa 115 Zzzzzzzzzzzzzzzzzzza
+Multa 116 zzzzzzzzzzzzzzzzzzzb
+Multa 117 zzzzzzzzzzzzzzzzzzzc
+Multa 118 zzzzzzzzzzzzzzzzzzzd
+Multa 119 zzzzzzzzzzzzzzzzzzze
+Multa 120 zzzzzzzzzzzzzzzzzzzf
+Multa 121 zzzzzzzzzzzzzzzzzzzg
+Multa 122 zzzzzzzzzzzzzzzzzzzh
+Multa 123 zzzzzzzzzzzzzzzzzzzi
+Multa 124 zzzzzzzzzzzzzzzzzzzj
+Multa 125 zzzzzzzzzzzzzzzzzzzk
+Multa 126 zzzzzzzzzzzzzzzzzzzl
+Multa 127 zzzzzzzzzzzzzzzzzzzm
+Multa 128 zzzzzzzzzzzzzzzzzzzn
+Multa 129 zzzzzzzzzzzzzzzzzzzo
+Multa 130 zzzzzzzzzzzzzzzzzzzp
+Multa 131 zzzzzzzzzzzzzzzzzzzq
+Multa 132 zzzzzzzzzzzzzzzzzzzr
+Multa 133 Zzzzzzzzzzzzzzzzzzzs
+Multa 134 Zzzzzzzzzzzzzzzzzzza
+Multa 135 zzzzzzzzzzzzzzzzzzzb
+Multa 136 zzzzzzzzzzzzzzzzzzzc
+Multa 137 zzzzzzzzzzzzzzzzzzzd
+Multa 138 zzzzzzzzzzzzzzzzzzze
+Multa 139 zzzzzzzzzzzzzzzzzzzf
+Multa 140 zzzzzzzzzzzzzzzzzzzg
+Multa 141 zzzzzzzzzzzzzzzzzzzh
+Multa 142 zzzzzzzzzzzzzzzzzzzi
+Multa 143 zzzzzzzzzzzzzzzzzzzj
+Multa 144 zzzzzzzzzzzzzzzzzzzk
+Multa 145 zzzzzzzzzzzzzzzzzzzl
+Multa 146 zzzzzzzzzzzzzzzzzzzm
+Multa 147 zzzzzzzzzzzzzzzzzzzn
+Multa 148 zzzzzzzzzzzzzzzzzzzo
+Multa 149 zzzzzzzzzzzzzzzzzzzp
+Multa 150 zzzzzzzzzzzzzzzzzzzq
+Multa 151 zzzzzzzzzzzzzzzzzzzr
+Multa 152 Zzzzzzzzzzzzzzzzzzzs
+Multa 153 Zzzzzzzzzzzzzzzzzzza
+Multa 154 zzzzzzzzzzzzzzzzzzzb
+Multa 155 zzzzzzzzzzzzzzzzzzzc
+Multa 156 zzzzzzzzzzzzzzzzzzzd
+Multa 157 zzzzzzzzzzzzzzzzzzze
+Multa 158 zzzzzzzzzzzzzzzzzzzf
+Multa 159 zzzzzzzzzzzzzzzzzzzg
+Multa 160 zzzzzzzzzzzzzzzzzzzh
+Multa 161 zzzzzzzzzzzzzzzzzzzi
+Multa 162 zzzzzzzzzzzzzzzzzzzj
+Multa 163 zzzzzzzzzzzzzzzzzzzk
+Multa 164 zzzzzzzzzzzzzzzzzzzl
+Multa 165 zzzzzzzzzzzzzzzzzzzm
+Multa 166 zzzzzzzzzzzzzzzzzzzn
+Multa 167 zzzzzzzzzzzzzzzzzzzo
+Multa 168 zzzzzzzzzzzzzzzzzzzp
+Multa 169 zzzzzzzzzzzzzzzzzzzq
+Multa 170 zzzzzzzzzzzzzzzzzzzr
+Multa 171 Zzzzzzzzzzzzzzzzzzzs
+Multa 172 Zzzzzzzzzzzzzzzzzzza
+Multa 173 zzzzzzzzzzzzzzzzzzzb
+Multa 174 zzzzzzzzzzzzzzzzzzzc
+Multa 175 zzzzzzzzzzzzzzzzzzzd
+Multa 176 zzzzzzzzzzzzzzzzzzze
+Multa 177 zzzzzzzzzzzzzzzzzzzf
+Multa 178 zzzzzzzzzzzzzzzzzzzg
+Multa 179 zzzzzzzzzzzzzzzzzzzh
+Multa 180 zzzzzzzzzzzzzzzzzzzi
+Multa 181 zzzzzzzzzzzzzzzzzzzj
+Multa 182 zzzzzzzzzzzzzzzzzzzk
+Multa 183 zzzzzzzzzzzzzzzzzzzl
+Multa 184 zzzzzzzzzzzzzzzzzzzm
+Multa 185 zzzzzzzzzzzzzzzzzzzn
+Multa 186 zzzzzzzzzzzzzzzzzzzo
+Multa 187 zzzzzzzzzzzzzzzzzzzp
+Multa 188 zzzzzzzzzzzzzzzzzzzq
+Multa 189 zzzzzzzzzzzzzzzzzzzr
+Multa 190 Zzzzzzzzzzzzzzzzzzzs
+Multa 191 Zzzzzzzzzzzzzzzzzzza
+Multa 192 zzzzzzzzzzzzzzzzzzzb
+Multa 193 zzzzzzzzzzzzzzzzzzzc
+Multa 194 zzzzzzzzzzzzzzzzzzzd
+Multa 195 zzzzzzzzzzzzzzzzzzze
+Multa 196 zzzzzzzzzzzzzzzzzzzf
+Multa 197 zzzzzzzzzzzzzzzzzzzg
+Multa 198 zzzzzzzzzzzzzzzzzzzh
+Multa 199 zzzzzzzzzzzzzzzzzzzi
+Multa 200 zzzzzzzzzzzzzzzzzzzj
+Multa 201 zzzzzzzzzzzzzzzzzzzk
+Multa 202 zzzzzzzzzzzzzzzzzzzl
+Multa 203 zzzzzzzzzzzzzzzzzzzm
+Multa 204 zzzzzzzzzzzzzzzzzzzn
+Multa 205 zzzzzzzzzzzzzzzzzzzo
+Multa 206 zzzzzzzzzzzzzzzzzzzp
+Multa 207 zzzzzzzzzzzzzzzzzzzq
+Multa 208 zzzzzzzzzzzzzzzzzzzr
+Multa 209 Zzzzzzzzzzzzzzzzzzzs
+Multa 210 Zzzzzzzzzzzzzzzzzzza
+Multa 211 zzzzzzzzzzzzzzzzzzzb
+Multa 212 zzzzzzzzzzzzzzzzzzzc
+Multa 213 zzzzzzzzzzzzzzzzzzzd
+Multa 214 zzzzzzzzzzzzzzzzzzze
+Multa 215 zzzzzzzzzzzzzzzzzzzf
+Multa 216 zzzzzzzzzzzzzzzzzzzg
+Multa 217 zzzzzzzzzzzzzzzzzzzh
+Multa 218 zzzzzzzzzzzzzzzzzzzi
+Multa 219 zzzzzzzzzzzzzzzzzzzj
+Multa 220 zzzzzzzzzzzzzzzzzzzk
+Multa 221 zzzzzzzzzzzzzzzzzzzl
+Multa 222 zzzzzzzzzzzzzzzzzzzm
+Multa 223 zzzzzzzzzzzzzzzzzzzn
+Multa 224 zzzzzzzzzzzzzzzzzzzo
+Multa 225 zzzzzzzzzzzzzzzzzzzp
+Multa 226 zzzzzzzzzzzzzzzzzzzq
+Multa 227 zzzzzzzzzzzzzzzzzzzr
+Multa 228 Zzzzzzzzzzzzzzzzzzzs
+Multa 229 Zzzzzzzzzzzzzzzzzzza
+Multa 230 zzzzzzzzzzzzzzzzzzzb
+Multa 231 zzzzzzzzzzzzzzzzzzzc
+Multa 232 zzzzzzzzzzzzzzzzzzzd
+Multa 233 zzzzzzzzzzzzzzzzzzze
+Multa 234 zzzzzzzzzzzzzzzzzzzf
+Multa 235 zzzzzzzzzzzzzzzzzzzg
+Multa 236 zzzzzzzzzzzzzzzzzzzh
+Multa 237 zzzzzzzzzzzzzzzzzzzi
+Multa 238 zzzzzzzzzzzzzzzzzzzj
+Multa 239 zzzzzzzzzzzzzzzzzzzk
+Multa 240 zzzzzzzzzzzzzzzzzzzl
+Multa 241 zzzzzzzzzzzzzzzzzzzm
+Multa 242 zzzzzzzzzzzzzzzzzzzn
+Multa 243 zzzzzzzzzzzzzzzzzzzo
+Multa 244 zzzzzzzzzzzzzzzzzzzp
+Multa 245 zzzzzzzzzzzzzzzzzzzq
+Multa 246 zzzzzzzzzzzzzzzzzzzr
+Multa 247 Zzzzzzzzzzzzzzzzzzzs
+Multa 248 Zzzzzzzzzzzzzzzzzzza
+Multa 249 zzzzzzzzzzzzzzzzzzzb
+Multa 250 zzzzzzzzzzzzzzzzzzzc
+Multa 251 zzzzzzzzzzzzzzzzzzzd
+Multa 252 zzzzzzzzzzzzzzzzzzze
+Multa 253 zzzzzzzzzzzzzzzzzzzf
+Multa 254 zzzzzzzzzzzzzzzzzzzg
+Multa 255 zzzzzzzzzzzzzzzzzzzh
+Multa 256 zzzzzzzzzzzzzzzzzzzi
+Multa 257 zzzzzzzzzzzzzzzzzzzj
+Multa 258 zzzzzzzzzzzzzzzzzzzk
+Multa 259 zzzzzzzzzzzzzzzzzzzl
+Multa 260 zzzzzzzzzzzzzzzzzzzm
+Multa 261 zzzzzzzzzzzzzzzzzzzn
+Multa 262 zzzzzzzzzzzzzzzzzzzo
+Multa 263 zzzzzzzzzzzzzzzzzzzp
+Multa 264 zzzzzzzzzzzzzzzzzzzq
+Multa 265 zzzzzzzzzzzzzzzzzzzr
+Multa 266 Zzzzzzzzzzzzzzzzzzzs
+Multa 267 Zzzzzzzzzzzzzzzzzzza
+Multa 268 zzzzzzzzzzzzzzzzzzzb
+Multa 269 zzzzzzzzzzzzzzzzzzzc
+Multa 270 zzzzzzzzzzzzzzzzzzzd
+Multa 271 zzzzzzzzzzzzzzzzzzze
+Multa 272 zzzzzzzzzzzzzzzzzzzf
+Multa 273 zzzzzzzzzzzzzzzzzzzg
+Multa 274 zzzzzzzzzzzzzzzzzzzh
+Multa 275 zzzzzzzzzzzzzzzzzzzi
+Multa 276 zzzzzzzzzzzzzzzzzzzj
+Multa 277 zzzzzzzzzzzzzzzzzzzk
+Multa 278 zzzzzzzzzzzzzzzzzzzl
+Multa 279 zzzzzzzzzzzzzzzzzzzm
+Multa 280 zzzzzzzzzzzzzzzzzzzn
+Multa 281 zzzzzzzzzzzzzzzzzzzo
+Multa 282 zzzzzzzzzzzzzzzzzzzp
+Multa 283 zzzzzzzzzzzzzzzzzzzq
+Multa 284 zzzzzzzzzzzzzzzzzzzr
+Multa 285 Zzzzzzzzzzzzzzzzzzzs
+Multa 286 Zzzzzzzzzzzzzzzzzzza
+Multa 287 zzzzzzzzzzzzzzzzzzzb
+Multa 288 zzzzzzzzzzzzzzzzzzzc
+Multa 289 zzzzzzzzzzzzzzzzzzzd
+Multa 290 zzzzzzzzzzzzzzzzzzze
+Multa 291 zzzzzzzzzzzzzzzzzzzf
+Multa 292 zzzzzzzzzzzzzzzzzzzg
+Multa 293 zzzzzzzzzzzzzzzzzzzh
+Multa 294 zzzzzzzzzzzzzzzzzzzi
+Multa 295 zzzzzzzzzzzzzzzzzzzj
+Multa 296 zzzzzzzzzzzzzzzzzzzk
+Multa 297 zzzzzzzzzzzzzzzzzzzl
+Multa 298 zzzzzzzzzzzzzzzzzzzm
+Multa 299 zzzzzzzzzzzzzzzzzzzn
+Multa 300 zzzzzzzzzzzzzzzzzzzo
+Multa 301 zzzzzzzzzzzzzzzzzzzp
+Multa 302 zzzzzzzzzzzzzzzzzzzq
+Multa 303 zzzzzzzzzzzzzzzzzzzr
+Multa 304 Zzzzzzzzzzzzzzzzzzzs
+Multa 305 Zzzzzzzzzzzzzzzzzzza
+Multa 306 zzzzzzzzzzzzzzzzzzzb
+Multa 307 zzzzzzzzzzzzzzzzzzzc
+Multa 308 zzzzzzzzzzzzzzzzzzzd
+Multa 309 zzzzzzzzzzzzzzzzzzze
+Multa 310 zzzzzzzzzzzzzzzzzzzf
+Multa 311 zzzzzzzzzzzzzzzzzzzg
+Multa 312 zzzzzzzzzzzzzzzzzzzh
+Multa 313 zzzzzzzzzzzzzzzzzzzi
+Multa 314 zzzzzzzzzzzzzzzzzzzj
+Multa 315 zzzzzzzzzzzzzzzzzzzk
+Multa 316 zzzzzzzzzzzzzzzzzzzl
+Multa 317 zzzzzzzzzzzzzzzzzzzm
+Multa 318 zzzzzzzzzzzzzzzzzzzn
+Multa 319 zzzzzzzzzzzzzzzzzzzo
+Multa 320 zzzzzzzzzzzzzzzzzzzp
+Multa 321 zzzzzzzzzzzzzzzzzzzq
+Multa 322 zzzzzzzzzzzzzzzzzzzr
+Multa 323 Zzzzzzzzzzzzzzzzzzzs
+Multa 324 Zzzzzzzzzzzzzzzzzzza
+Multa 325 zzzzzzzzzzzzzzzzzzzb
+Multa 326 zzzzzzzzzzzzzzzzzzzc
+Multa 327 zzzzzzzzzzzzzzzzzzzd
+Multa 328 zzzzzzzzzzzzzzzzzzze
+Multa 329 zzzzzzzzzzzzzzzzzzzf
+Multa 330 zzzzzzzzzzzzzzzzzzzg
+Multa 331 zzzzzzzzzzzzzzzzzzzh
+Multa 332 zzzzzzzzzzzzzzzzzzzi
+Multa 333 zzzzzzzzzzzzzzzzzzzj
+Multa 334 zzzzzzzzzzzzzzzzzzzk
+Multa 335 zzzzzzzzzzzzzzzzzzzl
+Multa 336 zzzzzzzzzzzzzzzzzzzm
+Multa 337 zzzzzzzzzzzzzzzzzzzn
+Multa 338 zzzzzzzzzzzzzzzzzzzo
+Multa 339 zzzzzzzzzzzzzzzzzzzp
+Multa 340 zzzzzzzzzzzzzzzzzzzq
+Multa 341 zzzzzzzzzzzzzzzzzzzr
+Multa 342 Zzzzzzzzzzzzzzzzzzzs
+Multa 343 Zzzzzzzzzzzzzzzzzzza
+Multa 344 zzzzzzzzzzzzzzzzzzzb
+Multa 345 zzzzzzzzzzzzzzzzzzzc
+Multa 346 zzzzzzzzzzzzzzzzzzzd
+Multa 347 zzzzzzzzzzzzzzzzzzze
+Multa 348 zzzzzzzzzzzzzzzzzzzf
+Multa 349 zzzzzzzzzzzzzzzzzzzg
+Multa 350 zzzzzzzzzzzzzzzzzzzh
+Multa 351 zzzzzzzzzzzzzzzzzzzi
+Multa 352 zzzzzzzzzzzzzzzzzzzj
+Multa 353 zzzzzzzzzzzzzzzzzzzk
+Multa 354 zzzzzzzzzzzzzzzzzzzl
+Multa 355 zzzzzzzzzzzzzzzzzzzm
+Multa 356 zzzzzzzzzzzzzzzzzzzn
+Multa 357 zzzzzzzzzzzzzzzzzzzo
+Multa 358 zzzzzzzzzzzzzzzzzzzp
+Multa 359 zzzzzzzzzzzzzzzzzzzq
+Multa 360 zzzzzzzzzzzzzzzzzzzr
+Multa 361 Zzzzzzzzzzzzzzzzzzzs
+Multa 362 Zzzzzzzzzzzzzzzzzzza
+Multa 363 zzzzzzzzzzzzzzzzzzzb
+Multa 364 zzzzzzzzzzzzzzzzzzzc
+Multa 365 zzzzzzzzzzzzzzzzzzzd
+Multa 366 zzzzzzzzzzzzzzzzzzze
+Multa 367 zzzzzzzzzzzzzzzzzzzf
+Multa 368 zzzzzzzzzzzzzzzzzzzg
+Multa 369 zzzzzzzzzzzzzzzzzzzh
+Multa 370 zzzzzzzzzzzzzzzzzzzi
+Multa 371 zzzzzzzzzzzzzzzzzzzj
+Multa 372 zzzzzzzzzzzzzzzzzzzk
+Multa 373 zzzzzzzzzzzzzzzzzzzl
+Multa 374 zzzzzzzzzzzzzzzzzzzm
+Multa 375 zzzzzzzzzzzzzzzzzzzn
+Multa 376 zzzzzzzzzzzzzzzzzzzo
+Multa 377 zzzzzzzzzzzzzzzzzzzp
+Multa 378 zzzzzzzzzzzzzzzzzzzq
+Multa 379 zzzzzzzzzzzzzzzzzzzr
+Multa 380 Zzzzzzzzzzzzzzzzzzzs
+Multa 381 Zzzzzzzzzzzzzzzzzzza carteira suspensa
+Multa 382 zzzzzzzzzzzzzzzzzzzb carteira suspensa
+Multa 383 zzzzzzzzzzzzzzzzzzzc carteira suspensa
+Multa 384 zzzzzzzzzzzzzzzzzzzd carteira suspensa
+Multa 385 zzzzzzzzzzzzzzzzzzze carteira suspensa
+Multa 386 zzzzzzzzzzzzzzzzzzzf carteira suspensa
+Multa 387 zzzzzzzzzzzzzzzzzzzg carteira suspensa
+Multa 388 zzzzzzzzzzzzzzzzzzzh carteira suspensa
+Multa 389 zzzzzzzzzzzzzzzzzzzi carteira suspensa
+Multa 390 zzzzzzzzzzzzzzzzzzzj carteira suspensa
+Multa 391 zzzzzzzzzzzzzzzzzzzk carteira suspensa
+Multa 392 zzzzzzzzzzzzzzzzzzzl carteira suspensa
+Multa 393 zzzzzzzzzzzzzzzzzzzm carteira suspensa
+Multa 394 zzzzzzzzzzzzzzzzzzzn carteira suspensa
+Multa 395 zzzzzzzzzzzzzzzzzzzo carteira suspensa
+Multa 396 zzzzzzzzzzzzzzzzzzzp carteira suspensa
+Multa 397 zzzzzzzzzzzzzzzzzzzq carteira suspensa
+Multa 398 zzzzzzzzzzzzzzzzzzzr carteira suspensa
+Multa 399 Zzzzzzzzzzzzzzzzzzzs carteira suspensa
+
+Familia 5
+Multa 1 a
+Multa 2 b
+Multa 3 c
+Multa 4 d
+Multa 5 e
+Multa 6 e
+Multa 7 d
+Multa 8 e
+Multa 9 c
+Multa 10 d
+Multa 11 e
+Multa 12 b
+Multa 13 c
+Multa 14 d
+Multa 15 e
+Multa 16 a
+Multa 17 b
+Multa 18 c
+Multa 19 d
+Multa 20 e
+
diff --git a/boca-1.5.0/doc/problemexamples/multas/run/c b/boca-1.5.0/doc/problemexamples/multas/run/c
new file mode 100755
index 0000000..d65ed58
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/run/c
@@ -0,0 +1,124 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 exe_file
+# $2 input_file
+# $3 timelimit (limit to run all the repetitions, by default only one repetition)
+# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
+# $5 maximum allowed memory (in KBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+
+if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+name=`basename "$1"`
+if [ ! -x "$name" ]; then
+ echo "$1 not found (or is not in the current dir) or it's not executable"
+ exit 44
+fi
+if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then
+ echo "WARNING: executable file extension is not .exe"
+fi
+input=`basename "$2"`
+if [ ! -r "$input" ]; then
+ echo "$2 not found (or is not in the current dir) or it's not readable"
+ exit 45
+fi
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$3
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+nruns=1
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+nruns=$4
+fi
+maxm=512000
+if [ "$5" != "" -a "$5" -gt "0" ]; then
+maxm=${5}000
+fi
+
+rm -f stdin0 2>/dev/null
+mv "$input" stdin0
+
+rm -f run.exe 2>/dev/null
+mv "$name" run.exe
+file run.exe | grep -iq "statically linked"
+if [ "$?" != "0" ]; then
+ echo "Aborting because $name is not statically linked"
+ exit 47
+fi
+
+cdir=`pwd`
+echo "Current directory is $cdir -- chrooting on it" >&2
+$sf -F10 -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe
+ret=$?
+if [ $ret -gt 10 ]; then
+ ret=0
+fi
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/multas/run/cpp b/boca-1.5.0/doc/problemexamples/multas/run/cpp
new file mode 100755
index 0000000..9b2d092
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/run/cpp
@@ -0,0 +1,123 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 exe_file
+# $2 input_file
+# $3 timelimit (limit to run all the repetitions, by default only one repetition)
+# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
+# $5 maximum allowed memory (in KBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+
+if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -x "$1" ]; then
+ echo "$1 not found or it's not executable"
+ exit 44
+fi
+name="$1"
+if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then
+ echo "WARNING: executable file extension is not .exe"
+fi
+if [ ! -r "$2" ]; then
+ echo "$2 not found or it's not readable"
+ exit 45
+fi
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$3
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+nruns=1
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+nruns=$4
+fi
+maxm=512000
+if [ "$5" != "" -a "$5" -gt "0" ]; then
+maxm=${5}000
+fi
+
+rm -f stdin0 2>/dev/null
+mv "$2" stdin0
+
+rm -f run.exe 2>/dev/null
+mv "$name" run.exe
+file run.exe | grep -iq "statically linked"
+if [ "$?" != "0" ]; then
+ echo "Aborting because $name is not statically linked"
+ exit 47
+fi
+
+cdir=`pwd`
+echo "Current directory is $cdir -- chrooting on it" >&2
+$sf -F10 -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe
+ret=$?
+if [ $ret -gt 10 ]; then
+ ret=0
+fi
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/multas/run/java b/boca-1.5.0/doc/problemexamples/multas/run/java
new file mode 100755
index 0000000..945f15d
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/run/java
@@ -0,0 +1,163 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 main_class
+# $2 input_file
+# $3 timelimit (limit to run all the repetitions, by default only one repetition)
+# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
+# $5 maximum allowed memory (in KBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+
+if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -r run.jar ]; then
+ echo "ERROR: file run.jar not found - possible error during compilation"
+ exit 1
+fi
+name="$1"
+if [ "${name##*.}" == "class" -a "${name##*.}" == "CLASS" ]; then
+ echo "WARNING: removing .class file extension"
+fi
+if [ "${name##*.}" == "class" ]; then
+ name=`basename "$1" .class`
+fi
+if [ "${name##*.}" == "CLASS" ]; then
+ name=`basename "$1" .CLASS`
+fi
+input=`basename "$2"`
+if [ ! -r "$input" ]; then
+ echo "$2 not found (or is not in the current dir) or it's not readable"
+ exit 45
+fi
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$3
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+nruns=1
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+nruns=$4
+fi
+maxm=512
+if [ "$5" != "" -a "$5" -gt "0" ]; then
+maxm=${5}
+fi
+
+rm -f stdin0 2>/dev/null
+mv "$input" stdin0
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ cat <<EOF > runit.sh
+#!/bin/bash
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+java=`which java`
+[ -x "$java" ] || java=/usr/bin/java
+if [ ! -x $java ]; then
+ echo "$java not found or it's not executable"
+ exit 47
+fi
+export CLASSPATH=.:./run.jar:$CLASSPATH
+cd $cdir
+$sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 -- $java -Xmx${maxm}M -Xms${maxm}M "$name"
+echo \$? > runit.retcode
+/bin/umount /proc 2>/dev/null
+#/bin/umount /dev
+/bin/umount /sys 2>/dev/null
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail $cdir/runit.sh
+ ret=`cat runit.retcode`
+ if [ "$ret" == "" ]; then
+ echo "Execution error - check autojudging"
+ exit 49
+ fi
+ if [ $ret -gt 10 ]; then
+ echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <"
+ exit 9
+ fi
+ else
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
+# $java "$name" < stdin0
+ $sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 -- $java -cp run.jar -Xmx${maxm}M -Xms${maxm}M "$name"
+ ret=$?
+ fi
+ if [ $ret -gt 10 ]; then
+ echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <"
+ ret=9
+ fi
+fi
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/multas/tests/c b/boca-1.5.0/doc/problemexamples/multas/tests/c
new file mode 100755
index 0000000..1a0ca95
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/multas/tests/c
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+cat > test.c <<EOF
+int main() {
+ char s[100];
+ scanf("%s", s);
+ printf("%s\n",s);
+ return 0;
+}
+EOF
+cat > test.in <<EOF
+inputdata
+EOF
+
+TL=2
+REP=10
+../compile/c test.c test.exe TL
+../run/c test.exe test.in TL REP
+output=`cat stdout0`
+if [ "$output" != "inputdata" ]; then
+ echo "ERROR"
+ exit 1
+fi
+exit 0
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/compare/c b/boca-1.5.0/doc/problemexamples/problemtemplate/compare/c
new file mode 100755
index 0000000..4998be3
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/compare/c
@@ -0,0 +1,97 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+# // Last modified 21/jul/2012 by cassio@ime.usp.br
+#
+# This script receives:
+# $1 team_output
+# $2 sol_output
+# $3 problem_input (might be used by some specific checkers, here it is not)
+#
+# BOCA reads the last line of the standard output
+# and pass it to judges
+#
+if [ ! -r "$1" -o ! -r "$2" ]; then
+ echo "Parameter problem"
+ exit 43
+fi
+
+# Next lines of this script just compares team_output and sol_output,
+# although it is possible to change them to more complex evaluations.
+
+diff -q "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff \"$1\" \"$2\" # files match"
+ echo "Files match exactly"
+ exit 4
+fi
+diff -q -b "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b \"$1\" \"$2\" # files match"
+ echo -e "diff -c \"$1\" \"$2\" # files dont match - see output"
+ diff -c "$1" "$2"
+ echo "Files match with differences in the amount of white spaces"
+ exit 5
+fi
+diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b "$1" "$2"
+ echo "Files match with differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B "$1" "$2"
+ echo "Files match if we ignore case and differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B "$1" "$2"
+ echo "Files match if we discard all white spaces"
+ exit 5
+fi
+diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B -w "$1" "$2"
+ echo "Files match if we ignore case and discard all white spaces"
+ exit 5
+fi
+wd=`which wdiff`
+if [ "$wd" != "" ]; then
+ wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null
+ if [ "$?" == "0" ]; then
+ echo -e "wdiff \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B -w "$1" "$2"
+ echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff"
+ echo "diff has a bug that, if a line contains a single space, this is not discarded by -w"
+ exit 5
+ fi
+fi
+echo -e "### files dont match - see output"
+diff -c -i -b -B -w "$1" "$2"
+echo "Differences found"
+exit 6
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/compare/cpp b/boca-1.5.0/doc/problemexamples/problemtemplate/compare/cpp
new file mode 100755
index 0000000..4998be3
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/compare/cpp
@@ -0,0 +1,97 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+# // Last modified 21/jul/2012 by cassio@ime.usp.br
+#
+# This script receives:
+# $1 team_output
+# $2 sol_output
+# $3 problem_input (might be used by some specific checkers, here it is not)
+#
+# BOCA reads the last line of the standard output
+# and pass it to judges
+#
+if [ ! -r "$1" -o ! -r "$2" ]; then
+ echo "Parameter problem"
+ exit 43
+fi
+
+# Next lines of this script just compares team_output and sol_output,
+# although it is possible to change them to more complex evaluations.
+
+diff -q "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff \"$1\" \"$2\" # files match"
+ echo "Files match exactly"
+ exit 4
+fi
+diff -q -b "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b \"$1\" \"$2\" # files match"
+ echo -e "diff -c \"$1\" \"$2\" # files dont match - see output"
+ diff -c "$1" "$2"
+ echo "Files match with differences in the amount of white spaces"
+ exit 5
+fi
+diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b "$1" "$2"
+ echo "Files match with differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B "$1" "$2"
+ echo "Files match if we ignore case and differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B "$1" "$2"
+ echo "Files match if we discard all white spaces"
+ exit 5
+fi
+diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B -w "$1" "$2"
+ echo "Files match if we ignore case and discard all white spaces"
+ exit 5
+fi
+wd=`which wdiff`
+if [ "$wd" != "" ]; then
+ wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null
+ if [ "$?" == "0" ]; then
+ echo -e "wdiff \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B -w "$1" "$2"
+ echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff"
+ echo "diff has a bug that, if a line contains a single space, this is not discarded by -w"
+ exit 5
+ fi
+fi
+echo -e "### files dont match - see output"
+diff -c -i -b -B -w "$1" "$2"
+echo "Differences found"
+exit 6
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/compare/java b/boca-1.5.0/doc/problemexamples/problemtemplate/compare/java
new file mode 100755
index 0000000..4998be3
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/compare/java
@@ -0,0 +1,97 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+# // Last modified 21/jul/2012 by cassio@ime.usp.br
+#
+# This script receives:
+# $1 team_output
+# $2 sol_output
+# $3 problem_input (might be used by some specific checkers, here it is not)
+#
+# BOCA reads the last line of the standard output
+# and pass it to judges
+#
+if [ ! -r "$1" -o ! -r "$2" ]; then
+ echo "Parameter problem"
+ exit 43
+fi
+
+# Next lines of this script just compares team_output and sol_output,
+# although it is possible to change them to more complex evaluations.
+
+diff -q "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff \"$1\" \"$2\" # files match"
+ echo "Files match exactly"
+ exit 4
+fi
+diff -q -b "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b \"$1\" \"$2\" # files match"
+ echo -e "diff -c \"$1\" \"$2\" # files dont match - see output"
+ diff -c "$1" "$2"
+ echo "Files match with differences in the amount of white spaces"
+ exit 5
+fi
+diff -q -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b "$1" "$2"
+ echo "Files match with differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -i -b -B "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B "$1" "$2"
+ echo "Files match if we ignore case and differences in the amount of white spaces and blank lines"
+ exit 5
+fi
+diff -q -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B "$1" "$2"
+ echo "Files match if we discard all white spaces"
+ exit 5
+fi
+diff -q -i -b -B -w "$1" "$2" >/dev/null 2>/dev/null
+if [ "$?" == "0" ]; then
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files match"
+ echo -e "diff -c -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -b -B -w "$1" "$2"
+ echo "Files match if we ignore case and discard all white spaces"
+ exit 5
+fi
+wd=`which wdiff`
+if [ "$wd" != "" ]; then
+ wdiff \"$1\" \"$2\" >/dev/null 2>/dev/null
+ if [ "$?" == "0" ]; then
+ echo -e "wdiff \"$1\" \"$2\" # files match"
+ echo -e "diff -c -i -b -B -w \"$1\" \"$2\" # files dont match - see output"
+ diff -c -i -b -B -w "$1" "$2"
+ echo "BUT Files match if we compare word by word, ignoring everything else, using wdiff"
+ echo "diff has a bug that, if a line contains a single space, this is not discarded by -w"
+ exit 5
+ fi
+fi
+echo -e "### files dont match - see output"
+diff -c -i -b -B -w "$1" "$2"
+echo "Differences found"
+exit 6
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/compile/c b/boca-1.5.0/doc/problemexamples/problemtemplate/compile/c
new file mode 100644
index 0000000..04a08e9
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/compile/c
@@ -0,0 +1,159 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 source_file
+# $2 exe_file (default run.exe)
+# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition)
+# $4 maximum allowed memory (in MBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+
+if [ "$1" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+name="$1"
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+mkdir -p src
+if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then
+ unzip "$name" -d src
+ name="*.c"
+else
+ mv $name src
+fi
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+maxm=512000
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+maxm=${4}000
+fi
+
+# setting up the timelimit according to the problem
+if [ "$3" == "" ]; then
+time=5
+else
+time=$3
+fi
+let ttime=$time+30
+
+if [ "$2" == "" ]; then
+ exe=run.exe
+else
+ exe=$2
+fi
+
+rm -f ../$exe 2>/dev/null
+cat <<EOF > compileit.sh
+#!/bin/bash
+cc=\`which gcc\`
+[ -x "\$cc" ] || cc=/usr/bin/gcc
+if [ ! -x "\$cc" ]; then
+ echo "\$cc not found or it's not executable"
+ exit 47
+fi
+cd src
+"\$cc" -static -O2 -lm -o ../$exe "$name"
+echo \$? > compileit.retcode
+exit 0
+EOF
+chmod 755 compileit.sh
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ cat <<EOF > runit.sh
+#!/bin/bash
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+echo \$? > runit.retcode
+/bin/umount /proc 2>/dev/null
+#/bin/umount /dev
+/bin/umount /sys 2>/dev/null
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail "$cdir/runit.sh"
+ ret=`cat runit.retcode`
+else
+ echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING"
+ $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+ ret=$?
+fi
+rm -rf src/
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ exit $ret
+fi
+ret=`cat compileit.retcode`
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ ret=1
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/compile/cpp b/boca-1.5.0/doc/problemexamples/problemtemplate/compile/cpp
new file mode 100644
index 0000000..2ec55ac
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/compile/cpp
@@ -0,0 +1,159 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 source_file
+# $2 exe_file (default run.exe)
+# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition)
+# $4 maximum allowed memory (in MBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+
+if [ "$1" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+name="$1"
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+mkdir -p src
+if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then
+ unzip "$name" -d src
+ name="*.c"
+else
+ mv $name src
+fi
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+maxm=512000
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+maxm=${4}000
+fi
+
+# setting up the timelimit according to the problem
+if [ "$3" == "" ]; then
+time=5
+else
+time=$3
+fi
+let ttime=$time+30
+
+if [ "$2" == "" ]; then
+ exe=run.exe
+else
+ exe=$2
+fi
+
+rm -f ../$exe 2>/dev/null
+cat <<EOF > compileit.sh
+#!/bin/bash
+cc=\`which g++\`
+[ -x "\$cc" ] || cc=/usr/bin/g++
+if [ ! -x "\$cc" ]; then
+ echo "\$cc not found or it's not executable"
+ exit 47
+fi
+cd src
+"\$cc" -static -O2 -lm -o ../$exe "$name"
+echo \$? > compileit.retcode
+exit 0
+EOF
+chmod 755 compileit.sh
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ cat <<EOF > runit.sh
+#!/bin/bash
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+$sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+echo \$? > runit.retcode
+/bin/umount /proc 2>/dev/null
+#/bin/umount /dev
+/bin/umount /sys 2>/dev/null
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail "$cdir/runit.sh"
+ ret=`cat runit.retcode`
+else
+ echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING"
+ $sf -r1 -F1000 -n0 -U$bocau -G$bocag -C. -ostdout0 -estderr0 -d$maxm -m$maxm -f20000 -t$ttime -T$ttime ./compileit.sh
+ ret=$?
+fi
+rm -rf src/
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ exit $ret
+fi
+ret=`cat compileit.retcode`
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ ret=1
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/compile/java b/boca-1.5.0/doc/problemexamples/problemtemplate/compile/java
new file mode 100644
index 0000000..dae050e
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/compile/java
@@ -0,0 +1,176 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 source_file
+# $2 exe_file (default run.jar)
+# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition)
+# $4 maximum allowed memory (in MBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+if [ "$1" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+name="$1"
+if [ ! -r "$1" ]; then
+ echo "$1 not found or it's not readable"
+ exit 44
+fi
+mkdir -p src
+if [ "${name##*.}" == "zip" -a "${name##*.}" == "ZIP" ]; then
+ unzip "$name" -d src
+ if [ "${name##*.}" == "zip" ]; then
+ name=`basename $name .zip`
+ else
+ name=`basename $name .ZIP`
+ fi
+else
+ mv $name src
+fi
+
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$4
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+maxm=512
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+maxm=$4
+fi
+
+if [ "$2" == "" ]; then
+ jarfile=run.jar
+else
+ jarfile=$2
+fi
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+
+cat <<EOF > compileit.sh
+#!/bin/bash
+javac=`which javac`
+[ -x "\$javac" ] || javac=/usr/bin/javac
+if [ ! -x \$javac ]; then
+ echo "\$javac not found or it's not executable"
+ exit 47
+fi
+jar=`which jar`
+[ -x "\$jar" ] || jar=/usr/bin/jar
+if [ ! -x \$jar ]; then
+ echo "\$jar not found or it's not executable"
+ exit 47
+fi
+export CLASSPATH=.:\$CLASSPATH
+cd src
+if [ -r "$name" ]; then
+ \$javac -Xmx${maxm}M -Xms${maxm}M "$name"
+ echo \$? > compileit.retcode
+fi
+find . -name "*.java" | while read lin; do
+ \$javac -Xmx${maxm}M -Xms${maxm}M "\$lin"
+ echo \$? > compileit.retcode
+done
+rm -f ../$jarfile
+\$jar cvf ../$jarfile *
+EOF
+chmod 755 compileit.sh
+
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ cat <<EOF > runit.sh
+#!/bin/bash
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+
+$sf -r1 -t$time -T$ttime -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 ./compileit.sh
+
+/bin/umount /proc 2>/dev/null
+#/bin/umount /dev
+/bin/umount /sys 2>/dev/null
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail "$cdir/runit.sh"
+ ret=`cat runit.retcode`
+else
+ echo "COMPILATION IS NOT BEING CHROOTED -- THIS IS NOT AN IDEAL SETTING"
+# $javac "$name"
+ $sf -r1 -t$time -T$ttime -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 ./compileit.sh
+ ret=$?
+fi
+rm -rf src/
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ exit $ret
+fi
+ret=`cat compileit.retcode`
+if [ "$ret" != "0" ]; then
+ echo "Compilation Error: $ret"
+ ret=1
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/description/desc.txt b/boca-1.5.0/doc/problemexamples/problemtemplate/description/desc.txt
new file mode 100644
index 0000000..4cd89f0
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/description/desc.txt
@@ -0,0 +1 @@
+THIS IS THE FILE DESCRIBING THE PROBLEM! IT CAN BE A PDF OR ANY OTHER FORMAT...
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/description/problem.info b/boca-1.5.0/doc/problemexamples/problemtemplate/description/problem.info
new file mode 100644
index 0000000..785e648
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/description/problem.info
@@ -0,0 +1,3 @@
+basename=shortfilename
+fullname=This is the problem full name
+descfile=desc.txt
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/input/file1 b/boca-1.5.0/doc/problemexamples/problemtemplate/input/file1
new file mode 100644
index 0000000..79ecf36
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/input/file1
@@ -0,0 +1 @@
+FILE WITH THE INPUT TO BE GIVEN TO THE PROGRAM. NOTE THAT THE CORRESPONDING OUTPUT FILE HAS TO HAVE THE SAME NAME AS THIS FILE!
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/limits/c b/boca-1.5.0/doc/problemexamples/problemtemplate/limits/c
new file mode 100644
index 0000000..b48a3b7
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/limits/c
@@ -0,0 +1,13 @@
+#!/bin/bash
+# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename
+echo 4
+# and the number of repetitions to run within the given timelimit in the second line
+echo 10
+# and the maximum amount of memory per repetition in the third line (in Mbytes)
+echo 512
+# and shall return zero to indicate no failure
+exit 0
+# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be
+# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is
+# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs
+# the value.
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/limits/cpp b/boca-1.5.0/doc/problemexamples/problemtemplate/limits/cpp
new file mode 100644
index 0000000..b48a3b7
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/limits/cpp
@@ -0,0 +1,13 @@
+#!/bin/bash
+# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename
+echo 4
+# and the number of repetitions to run within the given timelimit in the second line
+echo 10
+# and the maximum amount of memory per repetition in the third line (in Mbytes)
+echo 512
+# and shall return zero to indicate no failure
+exit 0
+# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be
+# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is
+# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs
+# the value.
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/limits/java b/boca-1.5.0/doc/problemexamples/problemtemplate/limits/java
new file mode 100644
index 0000000..b48a3b7
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/limits/java
@@ -0,0 +1,13 @@
+#!/bin/bash
+# this executable shall output the number of second of timelimit in the first line, for the given problem and with language according to this filename
+echo 4
+# and the number of repetitions to run within the given timelimit in the second line
+echo 10
+# and the maximum amount of memory per repetition in the third line (in Mbytes)
+echo 512
+# and shall return zero to indicate no failure
+exit 0
+# the idea is that this file will be executed by the autojudge in the first time the autojudge downloads a problem, so as it will be
+# able to decide the proper time limit for the machine where it is running. If one wants to fix a predefined time limit, then it is
+# enough to write a script like this one with the desired value. Otherwise, one can build any more sophisticated program that outputs
+# the value.
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/output/file1 b/boca-1.5.0/doc/problemexamples/problemtemplate/output/file1
new file mode 100644
index 0000000..16a2f69
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/output/file1
@@ -0,0 +1 @@
+FILE WITH THE OUTPUT THAT SHOULD HAVE BEEN GENERATED BY THE PROGRAM FOR THE INPUT WITH THE SAME NAME
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/run/c b/boca-1.5.0/doc/problemexamples/problemtemplate/run/c
new file mode 100755
index 0000000..d65ed58
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/run/c
@@ -0,0 +1,124 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 exe_file
+# $2 input_file
+# $3 timelimit (limit to run all the repetitions, by default only one repetition)
+# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
+# $5 maximum allowed memory (in KBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+
+if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+name=`basename "$1"`
+if [ ! -x "$name" ]; then
+ echo "$1 not found (or is not in the current dir) or it's not executable"
+ exit 44
+fi
+if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then
+ echo "WARNING: executable file extension is not .exe"
+fi
+input=`basename "$2"`
+if [ ! -r "$input" ]; then
+ echo "$2 not found (or is not in the current dir) or it's not readable"
+ exit 45
+fi
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$3
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+nruns=1
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+nruns=$4
+fi
+maxm=512000
+if [ "$5" != "" -a "$5" -gt "0" ]; then
+maxm=${5}000
+fi
+
+rm -f stdin0 2>/dev/null
+mv "$input" stdin0
+
+rm -f run.exe 2>/dev/null
+mv "$name" run.exe
+file run.exe | grep -iq "statically linked"
+if [ "$?" != "0" ]; then
+ echo "Aborting because $name is not statically linked"
+ exit 47
+fi
+
+cdir=`pwd`
+echo "Current directory is $cdir -- chrooting on it" >&2
+$sf -F10 -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe
+ret=$?
+if [ $ret -gt 10 ]; then
+ ret=0
+fi
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/run/cpp b/boca-1.5.0/doc/problemexamples/problemtemplate/run/cpp
new file mode 100755
index 0000000..9b2d092
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/run/cpp
@@ -0,0 +1,123 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 exe_file
+# $2 input_file
+# $3 timelimit (limit to run all the repetitions, by default only one repetition)
+# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
+# $5 maximum allowed memory (in KBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+
+if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -x "$1" ]; then
+ echo "$1 not found or it's not executable"
+ exit 44
+fi
+name="$1"
+if [ "${name##*.}" != "exe" -a "${name##*.}" != "EXE" ]; then
+ echo "WARNING: executable file extension is not .exe"
+fi
+if [ ! -r "$2" ]; then
+ echo "$2 not found or it's not readable"
+ exit 45
+fi
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$3
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+nruns=1
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+nruns=$4
+fi
+maxm=512000
+if [ "$5" != "" -a "$5" -gt "0" ]; then
+maxm=${5}000
+fi
+
+rm -f stdin0 2>/dev/null
+mv "$2" stdin0
+
+rm -f run.exe 2>/dev/null
+mv "$name" run.exe
+file run.exe | grep -iq "statically linked"
+if [ "$?" != "0" ]; then
+ echo "Aborting because $name is not statically linked"
+ exit 47
+fi
+
+cdir=`pwd`
+echo "Current directory is $cdir -- chrooting on it" >&2
+$sf -F10 -r$nruns -n1 -R$cdir -C. -U$bocau -G$bocag -ostdout0 -estderr0 -d$maxm -m$maxm -t$time -T$ttime -istdin0 ./run.exe
+ret=$?
+if [ $ret -gt 10 ]; then
+ ret=0
+fi
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/run/java b/boca-1.5.0/doc/problemexamples/problemtemplate/run/java
new file mode 100755
index 0000000..945f15d
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/run/java
@@ -0,0 +1,163 @@
+#!/bin/bash
+# ////////////////////////////////////////////////////////////////////////////////
+# //BOCA Online Contest Administrator
+# // Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+# //
+# // This program is free software: you can redistribute it and/or modify
+# // it under the terms of the GNU General Public License as published by
+# // the Free Software Foundation, either version 3 of the License, or
+# // (at your option) any later version.
+# //
+# // This program is distributed in the hope that it will be useful,
+# // but WITHOUT ANY WARRANTY; without even the implied warranty of
+# // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# // GNU General Public License for more details.
+# // You should have received a copy of the GNU General Public License
+# // along with this program. If not, see <http://www.gnu.org/licenses/>.
+# ////////////////////////////////////////////////////////////////////////////////
+#Last modified: 21/july/2012 by cassio@ime.usp.br
+#
+# parameters are:
+# $1 main_class
+# $2 input_file
+# $3 timelimit (limit to run all the repetitions, by default only one repetition)
+# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
+# $5 maximum allowed memory (in KBytes)
+#
+# the output of the submission should be directed to the standard output
+#
+# the return code show what happened (according to safeexec):
+# 0 ok
+# 1 compile error
+# 2 runtime error
+# 3 timelimit exceeded
+# 4 internal error
+# 5 parameter error
+# 6 internal error
+# 7 memory limit exceeded
+# 8 security threat
+# 9 runtime error
+# other_codes are unknown to boca: in this case BOCA will present the
+# last line of standard output to the judge
+
+umask 0022
+id -u bocajail >/dev/null 2>/dev/null
+if [ $? == 0 ]; then
+ bocau=`id -u bocajail`
+ bocag=`id -g bocajail`
+ chown bocajail.nogroup .
+else
+ bocau=`id -u nobody`
+ bocag=`id -g nobody`
+ chown nobody.nogroup .
+fi
+if [ "$bocau" == "" -o "$bocag" == "" ]; then
+ echo "error finding user to run script"
+ exit 43
+fi
+
+# this script makes use of safeexec to execute the code with less privilegies
+# make sure that directories below are correct.
+sf=`which safeexec`
+[ -x "$sf" ] || sf=/usr/bin/safeexec
+
+if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
+ echo "parameter problem"
+ exit 43
+fi
+if [ ! -r run.jar ]; then
+ echo "ERROR: file run.jar not found - possible error during compilation"
+ exit 1
+fi
+name="$1"
+if [ "${name##*.}" == "class" -a "${name##*.}" == "CLASS" ]; then
+ echo "WARNING: removing .class file extension"
+fi
+if [ "${name##*.}" == "class" ]; then
+ name=`basename "$1" .class`
+fi
+if [ "${name##*.}" == "CLASS" ]; then
+ name=`basename "$1" .CLASS`
+fi
+input=`basename "$2"`
+if [ ! -r "$input" ]; then
+ echo "$2 not found (or is not in the current dir) or it's not readable"
+ exit 45
+fi
+if [ ! -x $sf ]; then
+ echo "$sf not found or it's not executable"
+ exit 46
+fi
+
+time=$3
+if [ "$time" -gt "0" ]; then
+ let "ttime = $time + 30"
+else
+ time=1
+ ttime=30
+fi
+
+nruns=1
+if [ "$4" != "" -a "$4" -gt "0" ]; then
+nruns=$4
+fi
+maxm=512
+if [ "$5" != "" -a "$5" -gt "0" ]; then
+maxm=${5}
+fi
+
+rm -f stdin0 2>/dev/null
+mv "$input" stdin0
+
+cdir=`pwd`
+echo "Current directory is $cdir" >&2
+echo $cdir | grep -q "/bocajail"
+if [ $? == 0 ]; then
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
+ cat <<EOF > runit.sh
+#!/bin/bash
+[ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
+#/bin/mount --bind /dev /dev
+[ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
+java=`which java`
+[ -x "$java" ] || java=/usr/bin/java
+if [ ! -x $java ]; then
+ echo "$java not found or it's not executable"
+ exit 47
+fi
+export CLASSPATH=.:./run.jar:$CLASSPATH
+cd $cdir
+$sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 -- $java -Xmx${maxm}M -Xms${maxm}M "$name"
+echo \$? > runit.retcode
+/bin/umount /proc 2>/dev/null
+#/bin/umount /dev
+/bin/umount /sys 2>/dev/null
+EOF
+ chmod 755 runit.sh
+ chroot /bocajail $cdir/runit.sh
+ ret=`cat runit.retcode`
+ if [ "$ret" == "" ]; then
+ echo "Execution error - check autojudging"
+ exit 49
+ fi
+ if [ $ret -gt 10 ]; then
+ echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <"
+ exit 9
+ fi
+ else
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
+# $java "$name" < stdin0
+ $sf -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 -- $java -cp run.jar -Xmx${maxm}M -Xms${maxm}M "$name"
+ ret=$?
+ fi
+ if [ $ret -gt 10 ]; then
+ echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <"
+ ret=9
+ fi
+fi
+if [ -f stdout0 ]; then
+ cat stdout0
+fi
+exit $ret
diff --git a/boca-1.5.0/doc/problemexamples/problemtemplate/tests/c b/boca-1.5.0/doc/problemexamples/problemtemplate/tests/c
new file mode 100755
index 0000000..d7d0411
--- /dev/null
+++ b/boca-1.5.0/doc/problemexamples/problemtemplate/tests/c
@@ -0,0 +1,27 @@
+#!/bin/bash
+#
+# This file performs a test of the autojudge system. It can run whatever you feel important to test the autojudge
+# and the script files that are included in the problem package
+
+cat > test.c <<EOF
+int main() {
+ char s[100];
+ scanf("%s", s);
+ printf("%s\n",s);
+ return 0;
+}
+EOF
+cat > test.in <<EOF
+inputdata
+EOF
+
+TL=2
+REP=10
+../compile/c test.c test.exe TL
+../run/c test.exe test.in TL REP
+output=`cat stdout0`
+if [ "$output" != "inputdata" ]; then
+ echo "ERROR"
+ exit 1
+fi
+exit 0
diff --git a/boca-1.5.0/src/admin/problem.php b/boca-1.5.0/src/admin/problem.php
index d55ff63..d52c429 100644
--- a/boca-1.5.0/src/admin/problem.php
+++ b/boca-1.5.0/src/admin/problem.php
@@ -98,7 +98,7 @@ for ($i=0; $i<count($prob); $i++) {
echo " <td nowrap>" . $prob[$i]["name"] . "</td>\n";
echo " <td nowrap>" . $prob[$i]["fullname"] . "&nbsp;</td>\n";
echo " <td nowrap>" . $prob[$i]["basefilename"] . "&nbsp;</td>\n";
- if (isset($prob[$i]["descoid"]) && $prob[$i]["descoid"] != null) {
+ if (isset($prob[$i]["descoid"]) && $prob[$i]["descoid"] != null && isset($prob[$i]["descfilename"])) {
echo " <td nowrap><a href=\"../filedownload.php?" . filedownload($prob[$i]["descoid"], $prob[$i]["descfilename"]) . "\">" .
basename($prob[$i]["descfilename"]) . "</td>\n";
}
diff --git a/boca-1.5.0/src/fcontest.php b/boca-1.5.0/src/fcontest.php
index 8771291..077b4ec 100644
--- a/boca-1.5.0/src/fcontest.php
+++ b/boca-1.5.0/src/fcontest.php
@@ -151,6 +151,7 @@ CREATE TABLE \"usertable\" (
\"usersessionextra\" varchar(50) DEFAULT '', -- (sessao do usuario)
\"userlastlogout\" int4, -- (data em seg desde epoch do ult logout)
\"userpermitip\" varchar(300), -- (ip permitido para acesso)
+ \"userinfo\" varchar(300) DEFAULT '',
\"updatetime\" int4 DEFAULT EXTRACT(EPOCH FROM now()) NOT NULL, -- (indica a ultima atualizacao no registro)
-- (esta tabela contem uma linha para cada usuario, seja ele administrador, juiz ou time. )
\"usericpcid\" varchar(50) DEFAULT '', -- (compatibilidade com dados do ICPC)
@@ -921,11 +922,7 @@ function DBNewContest ($param=array(), $c=null) {
insertanswers($n,$c);
insertlanguages($n,$c);
-
- DBExec($c, "insert into problemtable (contestnumber, problemnumber, problemname, problemfullname, ".
- "problembasefilename, problemdescfilename, problemdescfile, probleminputfilename, probleminputfile, ".
- "problemsolfilename, problemsolfile, fake) values ($n, 0, 'General', 'General', NULL, NULL, ".
- "NULL, NULL, NULL, NULL, NULL, 't')", "DBNewContest(insert problem)");
+ DBinsertfakeproblem($n,$c);
if($cw) {
DBExec($c, "commit work", "DBNewContest(commit)");
diff --git a/boca-1.5.0/src/fproblem.php b/boca-1.5.0/src/fproblem.php
index dc8ed16..6a05836 100644
--- a/boca-1.5.0/src/fproblem.php
+++ b/boca-1.5.0/src/fproblem.php
@@ -54,6 +54,12 @@ CONSTRAINT \"contest_fk\" FOREIGN KEY (\"contestnumber\") REFERENCES \"contestta
"(\"contestnumber\" int4_ops, \"problemname\" varchar_ops)", "DBCreateProblemTable(create problem_index2)");
}
+function DBinsertfakeproblem($n,$c) {
+ DBExec($c, "insert into problemtable (contestnumber, problemnumber, problemname, problemfullname, ".
+ "problembasefilename, probleminputfilename, probleminputfile, fake) values ($n, 0, 'General', 'General', NULL, NULL, ".
+ "NULL, 't')", "DBNewContest(insert problem)");
+}
+
//////////////////////funcoes de problemas//////////////////////////////////////////////////////////////
//recebe um numero de contest e numero de problema
//devolve todos os dados relativos ao problema em cada linha do array, sendo que cada linha representa o fato
@@ -61,7 +67,7 @@ CONSTRAINT \"contest_fk\" FOREIGN KEY (\"contestnumber\") REFERENCES \"contestta
function DBGetProblemData($contestnumber, $problemnumber) {
$c = DBConnect();
$r = DBExec($c, "select p.problemname as problemname, p.problemfullname as fullname, p.problembasefilename " .
- "as basefilename, p.problemtimelimit as timelimit, " .
+ "as basefilename, " .
"p.problemcolor as color, p.problemcolorname as colorname, " .
"p.probleminputfilename as inputfilename, p.probleminputfile as inputoid, p.probleminputfilehash as inputhash " .
" from problemtable as p where p.contestnumber=$contestnumber and p.problemnumber=$problemnumber and p.fake!='t'",
@@ -80,8 +86,9 @@ function DBGetProblemData($contestnumber, $problemnumber) {
if($ds=="") $ds = "/";
$ptmp = $_SESSION["locr"] . $ds . "private" . $ds . "problemtmp" . $ds . "problem" . $a[$i]['number'] . "-contest" . $contestnumber;
if(is_readable($ptmp . ".name")) {
- $a[$i]['descfilename']=$ptmp . $ds . file_get_contents($ptmp . ".name");
- $a[$i]['descoid']=-1;
+ $a[$i]['descfilename']=trim(file_get_contents($ptmp . ".name"));
+ if($a[$i]['descfilename'] != '')
+ $a[$i]['descoid']=-1;
}
}
return $a;
@@ -90,7 +97,7 @@ function DBGetFullProblemData($contestnumber,$freeproblems=false) {
$c = DBConnect();
DBExec($c, "begin work", "GetFullProblemData");
$r = DBExec($c, "select p.problemnumber as number, p.problemname as name, p.problemfullname as fullname, " .
- "p.problembasefilename as basefilename, p.fake as fake, p.problemtimelimit as timelimit, " .
+ "p.problembasefilename as basefilename, p.fake as fake, " .
"p.problemcolor as color, p.problemcolorname as colorname, " .
"p.probleminputfilename as inputfilename, p.probleminputfile as inputoid, p.probleminputfilehash as inputhash " .
" from problemtable as p " .
@@ -110,8 +117,9 @@ function DBGetFullProblemData($contestnumber,$freeproblems=false) {
if($ds=="") $ds = "/";
$ptmp = $_SESSION["locr"] . $ds . "private" . $ds . "problemtmp" . $ds . "problem" . $nn . "-contest" . $contestnumber;
if(is_readable($ptmp . ".name")) {
- $a[$i]['descfilename']=$ptmp . $ds . file_get_contents($ptmp . ".name");
- $a[$i]['descoid']=-1;
+ $a[$i]['descfilename']=trim(file_get_contents($ptmp . ".name"));
+ if($a[$i]['descfilename'] != '')
+ $a[$i]['descoid']=-1;
} else {
$randnum = session_id() . "_" . rand();
$dir = $ptmp . '-' . $randnum;
@@ -145,19 +153,21 @@ function DBGetFullProblemData($contestnumber,$freeproblems=false) {
$fullname=trim(sanitizeText($aa[1]));
}
}
- if($descfile=='' || $basename=='' || $fullname=='')
+ if($basename=='' || $fullname=='')
$failed=3;
}
} else $failed=4;
if(!$failed) {
@mkdir($ptmp);
- if(file_put_contents($ptmp . $ds . $descfile, encryptData(file_get_contents($dir . $ds . "description" . $ds . $descfile),$cf['key']),LOCK_EX)===FALSE)
- $failed=5;
+ if($descfile != '')
+ if(file_put_contents($ptmp . $ds . $descfile, encryptData(file_get_contents($dir . $ds . "description" . $ds . $descfile),$cf['key']),LOCK_EX)===FALSE)
+ $failed=5;
if(!$failed) {
- file_put_contents($ptmp . ".name",$descfile);
+ file_put_contents($ptmp . ".name",$ptmp . $ds . $descfile);
if(is_readable($ptmp . ".name")) {
- $a[$i]['descfilename']=$ptmp . $ds . $descfile;
- $a[$i]['descoid']=-1;
+ $a[$i]['descfilename']=trim(file_get_contents($ptmp . ".name"));
+ if($a[$i]['descfilename'] != '')
+ $a[$i]['descoid']=-1;
}
DBExec($c,"update problemtable set problemfullname='$fullname', problembasefilename='$basename' where problemnumber=$nn and contestnumber=$contestnumber",
"DBGetFullProblemData(free problem)");
@@ -410,8 +420,9 @@ function DBGetProblems($contest,$showanyway=false) {
if($ds=="") $ds = "/";
$ptmp = $_SESSION["locr"] . $ds . "private" . $ds . "problemtmp" . $ds . "problem" . $a[$i]['number'] . "-contest" . $contestnumber;
if(is_readable($ptmp . ".name")) {
- $a[$i]['descfilename']=$ptmp . $ds . file_get_contents($ptmp . ".name");
- $a[$i]['descoid']=-1;
+ $a[$i]['descfilename']=trim(file_get_contents($ptmp . ".name"));
+ if($a[$i]['descfilename'] != '')
+ $a[$i]['descoid']=-1;
}
}
return $a;
diff --git a/boca-1.5.0/src/team/problem.php b/boca-1.5.0/src/team/problem.php
index c5bc8cb..2627990 100644
--- a/boca-1.5.0/src/team/problem.php
+++ b/boca-1.5.0/src/team/problem.php
@@ -42,7 +42,7 @@ for ($i=0; $i<count($prob); $i++) {
echo "</td>\n";
echo " <td nowrap>" . $prob[$i]["basefilename"] . "&nbsp;</td>\n";
echo " <td nowrap>" . $prob[$i]["fullname"] . "&nbsp;</td>\n";
- if (isset($prob[$i]["descoid"]) && $prob[$i]["descoid"] != null) {
+ if (isset($prob[$i]["descoid"]) && $prob[$i]["descoid"] != null && isset($prob[$i]["descfilename"])) {
echo " <td nowrap><a href=\"../filedownload.php?" . filedownload($prob[$i]["descoid"], $prob[$i]["descfilename"]) .
"\">" . basename($prob[$i]["descfilename"]) . "</td>\n";
}
diff --git a/boca-1.5.0/tools/etc/icpc/becomeserver.sh b/boca-1.5.0/tools/etc/icpc/becomeserver.sh
index 31db6db..07caccf 100755
--- a/boca-1.5.0/tools/etc/icpc/becomeserver.sh
+++ b/boca-1.5.0/tools/etc/icpc/becomeserver.sh
@@ -190,7 +190,7 @@ fi
if [ "$OK" == "y" ]; then
cd $bocadir/src
php private/createdb.php
-cd -
+cd - >/dev/null 2>/dev/null
echo "database renewed. Data on bocadb has been lost"
else
echo "*** database not erased. Check if BOCA is compatible. You can always erase the database and"
diff --git a/boca-1.5.0/tools/icpc.etc.tgz b/boca-1.5.0/tools/icpc.etc.tgz
index ed8306a..d3b7025 100644
--- a/boca-1.5.0/tools/icpc.etc.tgz
+++ b/boca-1.5.0/tools/icpc.etc.tgz
Binary files differ
diff --git a/boca-1.5.0/tools/installv2.sh b/boca-1.5.0/tools/installv2.sh
index 5552aa9..03cbd29 100755
--- a/boca-1.5.0/tools/installv2.sh
+++ b/boca-1.5.0/tools/installv2.sh
@@ -20,7 +20,6 @@
echo "#############################################################"
echo "### installv2.sh of 06/Aug/2012 (A) by cassio@ime.usp.br ###"
echo "#############################################################"
-# checked with ubuntu 10.04 and 10.10 and 11.04 and 12.04
for i in id chown chmod cut awk tail grep cat sed mkdir rm mv sleep apt-get add-apt-repository update-alternatives; do
p=`which $i`