rbx.cp 0.5.39__py3-none-any.whl → 0.5.42__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. rbx/box/builder.py +6 -6
  2. rbx/box/checkers.py +105 -26
  3. rbx/box/cli.py +860 -0
  4. rbx/box/code.py +199 -84
  5. rbx/box/contest/statements.py +4 -2
  6. rbx/box/generators.py +55 -49
  7. rbx/box/generators_test.py +7 -7
  8. rbx/box/main.py +1 -852
  9. rbx/box/package.py +42 -1
  10. rbx/box/packaging/boca/packager.py +2 -1
  11. rbx/box/packaging/main.py +24 -7
  12. rbx/box/packaging/moj/packager.py +164 -0
  13. rbx/box/retries.py +5 -5
  14. rbx/box/schema.py +86 -4
  15. rbx/box/solutions.py +46 -108
  16. rbx/box/solutions_test.py +5 -6
  17. rbx/box/statements/build_statements.py +4 -2
  18. rbx/box/stresses.py +23 -12
  19. rbx/box/tasks.py +258 -0
  20. rbx/box/testcase_extractors.py +21 -21
  21. rbx/box/testcases/main.py +19 -14
  22. rbx/box/unit.py +116 -0
  23. rbx/box/validators.py +27 -18
  24. rbx/box/validators_test.py +3 -3
  25. rbx/grading/judge/sandbox.py +8 -0
  26. rbx/grading/judge/sandboxes/stupid_sandbox.py +12 -7
  27. rbx/grading/judge/sandboxes/timeit.py +8 -2
  28. rbx/grading/steps.py +76 -2
  29. rbx/grading/steps_with_caching.py +45 -3
  30. rbx/grading/steps_with_caching_run_test.py +51 -49
  31. rbx/resources/packagers/moj/scripts/compare.sh +101 -0
  32. rbx/test.py +6 -4
  33. rbx/testdata/interactive/checker.cpp +21 -0
  34. rbx/testdata/interactive/gen.cpp +11 -0
  35. rbx/testdata/interactive/interactor.cpp +63 -0
  36. rbx/testdata/interactive/problem.rbx.yml +40 -0
  37. rbx/testdata/interactive/sols/af_ac_pe.cpp +75 -0
  38. rbx/testdata/interactive/sols/af_ac_re.cpp +76 -0
  39. rbx/testdata/interactive/sols/af_ac_too_many_iter.cpp +72 -0
  40. rbx/testdata/interactive/sols/af_inf_cout_with_flush.cpp +79 -0
  41. rbx/testdata/interactive/sols/af_inf_cout_without_flush.cpp +78 -0
  42. rbx/testdata/interactive/sols/af_ml.cpp +78 -0
  43. rbx/testdata/interactive/sols/af_tl_after_ans.cpp +74 -0
  44. rbx/testdata/interactive/sols/af_wa.cpp +74 -0
  45. rbx/testdata/interactive/sols/interactive-binary-search_mm_naive_cin.cpp +17 -0
  46. rbx/testdata/interactive/sols/main.cpp +26 -0
  47. rbx/testdata/interactive/testplan.txt +6 -0
  48. rbx/testdata/interactive/validator.cpp +16 -0
  49. {rbx_cp-0.5.39.dist-info → rbx_cp-0.5.42.dist-info}/METADATA +2 -1
  50. {rbx_cp-0.5.39.dist-info → rbx_cp-0.5.42.dist-info}/RECORD +53 -32
  51. {rbx_cp-0.5.39.dist-info → rbx_cp-0.5.42.dist-info}/LICENSE +0 -0
  52. {rbx_cp-0.5.39.dist-info → rbx_cp-0.5.42.dist-info}/WHEEL +0 -0
  53. {rbx_cp-0.5.39.dist-info → rbx_cp-0.5.42.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,101 @@
1
+ #!/bin/bash
2
+ # ////////////////////////////////////////////////////////////////////////////////
3
+ # //BOCA Online Contest Administrator
4
+ # // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
5
+ # //
6
+ # // This program is free software: you can redistribute it and/or modify
7
+ # // it under the terms of the GNU General Public License as published by
8
+ # // the Free Software Foundation, either version 3 of the License, or
9
+ # // (at your option) any later version.
10
+ # //
11
+ # // This program is distributed in the hope that it will be useful,
12
+ # // but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # // GNU General Public License for more details.
15
+ # // You should have received a copy of the GNU General Public License
16
+ # // along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ # ////////////////////////////////////////////////////////////////////////////////
18
+ # // Last modified 21/jul/2012 by cassio@ime.usp.br
19
+ #
20
+ # This script receives:
21
+ # $1 team_output
22
+ # $2 sol_output
23
+ # $3 problem_input (might be used by some specific checkers, here it is not)
24
+ #
25
+ # BOCA reads the last line of the standard output
26
+ # and pass it to judges
27
+ #
28
+ if [ ! -r "$1" -o ! -r "$2" ]; then
29
+ echo "Parameter problem"
30
+ exit 43
31
+ fi
32
+
33
+ CHECKERSOURCE=$(dirname "$0")/checker.cpp
34
+
35
+ if [ ! -r "$CHECKERSOURCE" ]; then
36
+ echo "Checker source not found"
37
+ exit 47
38
+ fi
39
+
40
+ WORKDIR=$(dirname "$1")
41
+ CHECKERHASH={{checkerHash}}
42
+ CHECKERPATH=$WORKDIR/$CHECKERHASH
43
+
44
+ lock() {
45
+ MAX_ATTEMPTS=100
46
+ ATTEMPTS=0
47
+ while ! ln -s $CHECKERSOURCE $CHECKERPATH.lock; do
48
+ sleep 1
49
+ ATTEMPTS=$((ATTEMPTS + 1))
50
+ if [ $ATTEMPTS -ge $MAX_ATTEMPTS ]; then
51
+ echo "Failed to retrieve checker lock"
52
+ exit 47
53
+ fi
54
+ done
55
+ }
56
+
57
+ unlock() {
58
+ rm -rf $CHECKERPATH.lock
59
+ }
60
+
61
+ compile_checker() {
62
+ cc=$(which g++)
63
+ [ -x "$cc" ] || cc=/usr/bin/g++
64
+ if [ ! -x "$cc" ]; then
65
+ echo "$cc not found or it's not executable"
66
+ exit 47
67
+ fi
68
+
69
+ lock
70
+ if [ ! -x "$CHECKERPATH" ]; then
71
+ $cc {{rbxFlags}} $CHECKERSOURCE -o $CHECKERPATH
72
+ chmod 0755 "$CHECKERPATH"
73
+ fi
74
+ unlock
75
+ }
76
+
77
+ if [ ! -x "$CHECKERPATH" ]; then
78
+ compile_checker
79
+ fi
80
+
81
+ # Next lines of this script just compares team_output and sol_output,
82
+ # although it is possible to change them to more complex evaluations.
83
+ output=$($CHECKERPATH $3 $1 $2 2>&1 >/dev/null)
84
+ EC=$?
85
+
86
+ echo "checker exitcode = $EC"
87
+ echo "$output"
88
+
89
+ if [ $EC -eq 0 ]; then
90
+ echo "checker found no differences"
91
+ exit 4
92
+ elif [ $EC -eq 1 ]; then
93
+ echo "checker found differences"
94
+ exit 6
95
+ elif [ $EC -eq 2 ]; then
96
+ echo "checker failed"
97
+ exit 5
98
+ elif [ $EC -ne 3 ]; then
99
+ echo "unkown compare error $EC"
100
+ exit 43
101
+ fi
rbx/test.py CHANGED
@@ -3,6 +3,7 @@ import pathlib
3
3
  import tempfile
4
4
  from typing import Dict, List, Optional
5
5
 
6
+ import syncer
6
7
  from rich.columns import Columns
7
8
  from rich.panel import Panel
8
9
  from rich.progress import MofNCompleteColumn, Progress, SpinnerColumn
@@ -46,7 +47,7 @@ def get_testcases_io(
46
47
  return sorted(testcases_per_index.values(), key=lambda x: x.index)
47
48
 
48
49
 
49
- def _run_testcases(
50
+ async def _run_testcases(
50
51
  problem: Problem,
51
52
  lang: Language,
52
53
  lang_name: Optional[str],
@@ -73,7 +74,7 @@ def _run_testcases(
73
74
  artifacts = grading_utils.build_run_grading_artifacts(
74
75
  testcase, persist_root
75
76
  )
76
- run_log = steps.run(
77
+ run_log = await steps.run(
77
78
  lang.exec,
78
79
  params,
79
80
  sandbox,
@@ -234,7 +235,8 @@ def pretty_print_evaluation_results(
234
235
  _pretty_print_evaluation_result(problem, eval, interactive=interactive)
235
236
 
236
237
 
237
- def main(
238
+ @syncer.sync
239
+ async def main(
238
240
  problem: annotations.Problem,
239
241
  language: annotations.LanguageWithDefault = None,
240
242
  keep_sandbox: bool = False,
@@ -322,7 +324,7 @@ def main(
322
324
  )
323
325
  return
324
326
 
325
- testcase_logs = _run_testcases(
327
+ testcase_logs = await _run_testcases(
326
328
  dumped_problem, lang, language, box, testcases, persist_root
327
329
  )
328
330
 
@@ -0,0 +1,21 @@
1
+ #include "testlib.h"
2
+
3
+ int main(int argc, char *argv[]) {
4
+ registerTestlibCmd(argc, argv);
5
+
6
+ int oufq = ouf.readInt();
7
+ int ansq = ans.readInt();
8
+
9
+ if (ansq > 25)
10
+ quitf(_fail, "Limit is %d, but main solution have made %d queries", 25,
11
+ ansq);
12
+
13
+ if (oufq > 25)
14
+ quitf(_wa, "Limit is %d, but solution have made %d queries", 25, oufq);
15
+
16
+ int n = inf.readInt();
17
+ int m = inf.readInt();
18
+ quitf(_ok,
19
+ "Number %d is guessed successfully (range [1..%d]) with %d queries", n,
20
+ m, oufq);
21
+ }
@@ -0,0 +1,11 @@
1
+ #include "testlib.h"
2
+ #include <bits/stdc++.h>
3
+
4
+ using namespace std;
5
+
6
+ int main(int argc, char *argv[]) {
7
+ registerGen(argc, argv, 1);
8
+ int n = atoi(argv[1]);
9
+ int t = atoi(argv[2]);
10
+ cout << rnd.wnext(1, n, t) << ' ' << n << endl;
11
+ }
@@ -0,0 +1,63 @@
1
+ #include "testlib.h"
2
+ #include <bits/stdc++.h>
3
+
4
+ using namespace std;
5
+
6
+ void upd(int &lf, int &rg, int x, int y) {
7
+ if (x > y)
8
+ return;
9
+ lf = max(lf, x);
10
+ rg = min(rg, y);
11
+ }
12
+
13
+ void send(string x) {
14
+ cout << x << endl;
15
+ fflush(stdout);
16
+ }
17
+
18
+ const int INF = 1000'000'000;
19
+
20
+ int main(int argc, char *argv[]) {
21
+ registerInteraction(argc, argv);
22
+
23
+ int x = inf.readInt();
24
+ int n = inf.readInt();
25
+ cout << n << endl << flush;
26
+ int lf = 1, rg = n;
27
+
28
+ int queries = 0;
29
+ while (true) {
30
+ bool is_answer = false;
31
+ string cur = ouf.readToken("!|[1-9][0-9]{0,8}");
32
+ int last;
33
+ if (cur != "!") {
34
+ InStream tmp(ouf, cur);
35
+ last = tmp.readInt(-INF, INF);
36
+ queries++;
37
+ } else {
38
+ is_answer = true;
39
+ last = ouf.readInt(-INF, INF);
40
+ }
41
+
42
+ if (last < 1 || last > n)
43
+ quitf(_pe, "number %d from stdin is out of range [%d, %d]", last, 1, n);
44
+
45
+ if (is_answer) {
46
+ if (last == x && lf == rg) {
47
+ tout << queries << endl;
48
+ quitf(_ok, "number is guessed.");
49
+ } else if (last == x && lf != rg)
50
+ quitf(_wa, "number is but it was made in a random way");
51
+ else
52
+ quitf(_wa, "guessed number is incorrect");
53
+ }
54
+
55
+ if (x < last) {
56
+ send("<");
57
+ upd(lf, rg, 1, last - 1);
58
+ } else {
59
+ send(">=");
60
+ upd(lf, rg, last, n);
61
+ }
62
+ }
63
+ }
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: "test-problem"
3
+ type: communication
4
+ timeLimit: 1000
5
+ memoryLimit: 256
6
+ outputLimit: 100 # 100 kb
7
+ checker:
8
+ path: "checker.cpp"
9
+ interactor:
10
+ path: "interactor.cpp"
11
+ generators:
12
+ - name: "gen"
13
+ path: "gen.cpp"
14
+ validator:
15
+ path: "validator.cpp"
16
+ testcases:
17
+ - name: "tests"
18
+ generatorScript:
19
+ path: "testplan.txt"
20
+ solutions:
21
+ - path: "sols/main.cpp"
22
+ outcome: AC
23
+ - path: "sols/interactive-binary-search_mm_naive_cin.cpp"
24
+ outcome: INCORRECT
25
+ - path: "sols/af_tl_after_ans.cpp"
26
+ outcome: TLE
27
+ - path: "sols/af_wa.cpp"
28
+ outcome: WA
29
+ - path: "sols/af_ac_pe.cpp"
30
+ outcome: WA
31
+ - path: "sols/af_ac_re.cpp"
32
+ outcome: RE
33
+ - path: "sols/af_ml.cpp"
34
+ outcome: ML
35
+ - path: "sols/af_inf_cout_without_flush.cpp"
36
+ outcome: TLE
37
+ - path: "sols/af_inf_cout_with_flush.cpp"
38
+ outcome: TLE
39
+ - path: "sols/af_ac_too_many_iter.cpp"
40
+ outcome: INCORRECT
@@ -0,0 +1,75 @@
1
+ #include <algorithm>
2
+ #include <cassert>
3
+ #include <cmath>
4
+ #include <cstdio>
5
+ #include <cstring>
6
+ #include <ctime>
7
+ #include <iomanip>
8
+ #include <iostream>
9
+ #include <map>
10
+ #include <queue>
11
+ #include <set>
12
+ #include <sstream>
13
+ #include <string>
14
+ #include <vector>
15
+
16
+ #define forn(i, n) for (int i = 0; i < n; ++i)
17
+ #define fore(i, l, r) for (int i = int(l); i <= int(r); ++i)
18
+ #define sz(v) int(v.size())
19
+ #define all(v) v.begin(), v.end()
20
+ #define pb push_back
21
+ #define mp make_pair
22
+ #define x first
23
+ #define y1 ________y1
24
+ #define y second
25
+ #define ft first
26
+ #define sc second
27
+ #define pt pair<int, int>
28
+
29
+ template <typename X> inline X abs(const X &a) { return a < 0 ? -a : a; }
30
+ template <typename X> inline X sqr(const X &a) { return a * a; }
31
+
32
+ typedef long long li;
33
+ typedef long double ld;
34
+
35
+ using namespace std;
36
+
37
+ const int INF = 1000 * 1000 * 1000;
38
+ const ld EPS = 1e-9;
39
+ const ld PI = acos(-1.0);
40
+
41
+ int n;
42
+ int lf, rg;
43
+
44
+ bool read() {
45
+ cin >> n;
46
+ return true;
47
+ }
48
+
49
+ void solve() {
50
+ lf = 1, rg = n;
51
+ int it = 0;
52
+ while (lf != rg) {
53
+ it++;
54
+ int mid = (lf + rg + 1) / 2;
55
+ cout << mid << endl;
56
+ fflush(stdout);
57
+ string s;
58
+ cin >> s;
59
+ if (s == "<")
60
+ rg = mid - 1;
61
+ else
62
+ lf = mid;
63
+ }
64
+ if (it > 15)
65
+ cout << "!!";
66
+ cout << "! " << lf << endl;
67
+ }
68
+
69
+ int main() {
70
+ srand(time(NULL));
71
+ cerr << setprecision(10) << fixed;
72
+ assert(read());
73
+ solve();
74
+ return 0;
75
+ }
@@ -0,0 +1,76 @@
1
+ #include <algorithm>
2
+ #include <cassert>
3
+ #include <cmath>
4
+ #include <cstdio>
5
+ #include <cstring>
6
+ #include <ctime>
7
+ #include <iomanip>
8
+ #include <iostream>
9
+ #include <map>
10
+ #include <queue>
11
+ #include <set>
12
+ #include <sstream>
13
+ #include <string>
14
+ #include <vector>
15
+
16
+ #define forn(i, n) for (int i = 0; i < n; ++i)
17
+ #define fore(i, l, r) for (int i = int(l); i <= int(r); ++i)
18
+ #define sz(v) int(v.size())
19
+ #define all(v) v.begin(), v.end()
20
+ #define pb push_back
21
+ #define mp make_pair
22
+ #define x first
23
+ #define y1 ________y1
24
+ #define y second
25
+ #define ft first
26
+ #define sc second
27
+ #define pt pair<int, int>
28
+
29
+ template <typename X> inline X abs(const X &a) { return a < 0 ? -a : a; }
30
+ template <typename X> inline X sqr(const X &a) { return a * a; }
31
+
32
+ typedef long long li;
33
+ typedef long double ld;
34
+
35
+ using namespace std;
36
+
37
+ const int INF = 1000 * 1000 * 1000;
38
+ const ld EPS = 1e-9;
39
+ const ld PI = acos(-1.0);
40
+
41
+ int n;
42
+ int lf, rg;
43
+
44
+ bool read() {
45
+ cin >> n;
46
+ return true;
47
+ }
48
+
49
+ void solve() {
50
+ lf = 1, rg = n;
51
+ int it = 0;
52
+ while (lf != rg) {
53
+ it++;
54
+ int mid = (lf + rg + 1) / 2;
55
+ cout << mid << endl;
56
+ fflush(stdout);
57
+ string s;
58
+ cin >> s;
59
+ if (s == "<")
60
+ rg = mid - 1;
61
+ else
62
+ lf = mid;
63
+ if (it > 15)
64
+ assert(false);
65
+ }
66
+
67
+ cout << "! " << lf << endl;
68
+ }
69
+
70
+ int main() {
71
+ srand(time(NULL));
72
+ cerr << setprecision(10) << fixed;
73
+ assert(read());
74
+ solve();
75
+ return 0;
76
+ }
@@ -0,0 +1,72 @@
1
+ #include <algorithm>
2
+ #include <cassert>
3
+ #include <cmath>
4
+ #include <cstdio>
5
+ #include <cstring>
6
+ #include <ctime>
7
+ #include <iomanip>
8
+ #include <iostream>
9
+ #include <map>
10
+ #include <queue>
11
+ #include <set>
12
+ #include <sstream>
13
+ #include <string>
14
+ #include <vector>
15
+
16
+ #define forn(i, n) for (int i = 0; i < n; ++i)
17
+ #define fore(i, l, r) for (int i = int(l); i <= int(r); ++i)
18
+ #define sz(v) int(v.size())
19
+ #define all(v) v.begin(), v.end()
20
+ #define pb push_back
21
+ #define mp make_pair
22
+ #define x first
23
+ #define y1 ________y1
24
+ #define y second
25
+ #define ft first
26
+ #define sc second
27
+ #define pt pair<int, int>
28
+
29
+ template <typename X> inline X abs(const X &a) { return a < 0 ? -a : a; }
30
+ template <typename X> inline X sqr(const X &a) { return a * a; }
31
+
32
+ typedef long long li;
33
+ typedef long double ld;
34
+
35
+ using namespace std;
36
+
37
+ const int INF = 1000 * 1000 * 1000;
38
+ const ld EPS = 1e-9;
39
+ const ld PI = acos(-1.0);
40
+
41
+ int n;
42
+ int lf, rg;
43
+
44
+ bool read() {
45
+ cin >> n;
46
+ return true;
47
+ }
48
+
49
+ void solve() {
50
+ lf = 1, rg = n;
51
+ while (lf != rg) {
52
+ int mid = (lf + rg + 1) / 2;
53
+ cout << mid << endl;
54
+ fflush(stdout);
55
+ string s;
56
+ cin >> s;
57
+ if (s == "<")
58
+ rg--;
59
+ else
60
+ lf = mid;
61
+ }
62
+
63
+ cout << "! " << lf << endl;
64
+ }
65
+
66
+ int main() {
67
+ srand(time(NULL));
68
+ cerr << setprecision(10) << fixed;
69
+ assert(read());
70
+ solve();
71
+ return 0;
72
+ }
@@ -0,0 +1,79 @@
1
+ #include <algorithm>
2
+ #include <cassert>
3
+ #include <cmath>
4
+ #include <cstdio>
5
+ #include <cstring>
6
+ #include <ctime>
7
+ #include <iomanip>
8
+ #include <iostream>
9
+ #include <map>
10
+ #include <queue>
11
+ #include <set>
12
+ #include <sstream>
13
+ #include <string>
14
+ #include <vector>
15
+
16
+ #define forn(i, n) for (int i = 0; i < n; ++i)
17
+ #define fore(i, l, r) for (int i = int(l); i <= int(r); ++i)
18
+ #define sz(v) int(v.size())
19
+ #define all(v) v.begin(), v.end()
20
+ #define pb push_back
21
+ #define mp make_pair
22
+ #define x first
23
+ #define y1 ________y1
24
+ #define y second
25
+ #define ft first
26
+ #define sc second
27
+ #define pt pair<int, int>
28
+
29
+ template <typename X> inline X abs(const X &a) { return a < 0 ? -a : a; }
30
+ template <typename X> inline X sqr(const X &a) { return a * a; }
31
+
32
+ typedef long long li;
33
+ typedef long double ld;
34
+
35
+ using namespace std;
36
+
37
+ const int INF = 1000 * 1000 * 1000;
38
+ const ld EPS = 1e-9;
39
+ const ld PI = acos(-1.0);
40
+
41
+ int n;
42
+ int lf, rg;
43
+
44
+ bool read() {
45
+ cin >> n;
46
+ return true;
47
+ }
48
+
49
+ void solve() {
50
+ lf = 1, rg = n;
51
+ int it = 0;
52
+ while (rg - lf > 0) {
53
+ it++;
54
+ int mid = (lf + rg + 1) / 2;
55
+ cout << mid << endl;
56
+ fflush(stdout);
57
+ string s;
58
+ cin >> s;
59
+ if (s == "<")
60
+ rg = mid - 1;
61
+ else
62
+ lf = mid;
63
+ if (it > 5) {
64
+ while (true) {
65
+ cout << rand() % n + 1;
66
+ fflush(stdout);
67
+ }
68
+ }
69
+ }
70
+ cout << "! " << lf << endl;
71
+ }
72
+
73
+ int main() {
74
+ srand(time(NULL));
75
+ cerr << setprecision(10) << fixed;
76
+ assert(read());
77
+ solve();
78
+ return 0;
79
+ }
@@ -0,0 +1,78 @@
1
+ #include <algorithm>
2
+ #include <cassert>
3
+ #include <cmath>
4
+ #include <cstdio>
5
+ #include <cstring>
6
+ #include <ctime>
7
+ #include <iomanip>
8
+ #include <iostream>
9
+ #include <map>
10
+ #include <queue>
11
+ #include <set>
12
+ #include <sstream>
13
+ #include <string>
14
+ #include <vector>
15
+
16
+ #define forn(i, n) for (int i = 0; i < n; ++i)
17
+ #define fore(i, l, r) for (int i = int(l); i <= int(r); ++i)
18
+ #define sz(v) int(v.size())
19
+ #define all(v) v.begin(), v.end()
20
+ #define pb push_back
21
+ #define mp make_pair
22
+ #define x first
23
+ #define y1 ________y1
24
+ #define y second
25
+ #define ft first
26
+ #define sc second
27
+ #define pt pair<int, int>
28
+
29
+ template <typename X> inline X abs(const X &a) { return a < 0 ? -a : a; }
30
+ template <typename X> inline X sqr(const X &a) { return a * a; }
31
+
32
+ typedef long long li;
33
+ typedef long double ld;
34
+
35
+ using namespace std;
36
+
37
+ const int INF = 1000 * 1000 * 1000;
38
+ const ld EPS = 1e-9;
39
+ const ld PI = acos(-1.0);
40
+
41
+ int n;
42
+ int lf, rg;
43
+
44
+ bool read() {
45
+ cin >> n;
46
+ return true;
47
+ }
48
+
49
+ void solve() {
50
+ lf = 1, rg = n;
51
+ int it = 0;
52
+ while (rg - lf > 0) {
53
+ it++;
54
+ int mid = (lf + rg + 1) / 2;
55
+ cout << mid << endl;
56
+ fflush(stdout);
57
+ string s;
58
+ cin >> s;
59
+ if (s == "<")
60
+ rg = mid - 1;
61
+ else
62
+ lf = mid;
63
+ if (it > 5) {
64
+ while (true) {
65
+ cout << rand() % n + 1;
66
+ }
67
+ }
68
+ }
69
+ cout << "! " << lf << endl;
70
+ }
71
+
72
+ int main() {
73
+ srand(time(NULL));
74
+ cerr << setprecision(10) << fixed;
75
+ assert(read());
76
+ solve();
77
+ return 0;
78
+ }