buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
change_count
int64
0
100
#include <iostream> using namespace std; int main() { int H, R; cin >> H >> R; //各、太陽の位置の比較をする if (H - R == 0) cout << 0 << endl; //日の入り、日の出 else if (H - R > 0) cout << 1 << endl; //昼間 else cout << -1 << endl; //夜間 return 0; }
#include <iostream> using namespace std; int main() { int H, R; cin >> H >> R; //各、太陽の位置の比較をする if (H + R == 0) cout << 0 << endl; //日の入り、日の出 else if (H + R > 0) cout << 1 << endl; //昼間 else cout << -1 << endl; //夜間 return 0; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72]]
1
66
4
#include <bits/stdc++.h> using namespace std; #define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) (a).begin(), (a).end() int main(void) { int h, r; cin >> h >> r; if (r + h == 0) cout << 0 << endl; else if (h - r >= 0) cout << 1 << endl; else if (h - r <= 0) cout << -1 << endl; }
#include <bits/stdc++.h> using namespace std; #define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) (a).begin(), (a).end() int main(void) { int h, r; cin >> h >> r; if (r + h == 0) cout << 0 << endl; else if (h + r >= 0) cout << 1 << endl; else if (h + r <= 0) cout << -1 << endl; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72]]
1
92
4
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int h, r; scanf("%d%d", &h, &r); if (h > 0) puts("1"); else if (-h == r) puts("0"); else puts("-1"); }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int h, r; scanf("%d%d", &h, &r); if (h + r > 0) puts("1"); else if (h + r == 0) puts("0"); else puts("-1"); }
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 91, 17, 33], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 12, 13]]
1
74
7
#include <iostream> using namespace std; int main() { int n, r; cin >> n >> r; if (n + r == 0) cout << 1 << endl; else if (n + r > 0) cout << 0 << endl; else cout << -1 << endl; return 0; }
#include <iostream> using namespace std; int main() { int n, r; cin >> n >> r; if (n + r == 0) cout << 0 << endl; else if (n + r > 0) cout << 1 << endl; else cout << -1 << endl; return 0; }
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13]]
1
62
4
#include <stdio.h> int main(void) { int r, h, x; scanf("%d %d", &h, &r); if (r <= h) printf("1\n"); else if (-r > h) printf("-1\n"); else printf("0\n"); return 0; }
#include <stdio.h> int main(void) { int r, h, x; scanf("%d %d", &h, &r); if (-r == h) printf("0\n"); else if (-r > h) printf("-1\n"); else printf("1\n"); return 0; }
[["+", 0, 57, 15, 339, 51, 16, 31, 91, 17, 33], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
71
7
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <typeinfo> #include <vector> #define syosu(x) fixed << setprecision(x) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; typedef pair<double, double> pdd; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<char> vc; typedef vector<vc> vvc; typedef vector<string> vs; typedef vector<bool> vb; typedef vector<vb> vvb; typedef vector<P> vp; typedef vector<vp> vvp; typedef vector<pll> vpll; typedef pair<P, int> pip; typedef vector<pip> vip; const int inf = 1 << 29; const ll INF = 1ll << 60; const double pi = acos(-1); const double eps = 1e-7; const ll mod = 1e9 + 7; const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; int h, r; int main() { cin >> h >> r; if (-h == r) cout << 0 << endl; else if (h > 0) cout << 1 << endl; else cout << -1 << endl; }
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <typeinfo> #include <vector> #define syosu(x) fixed << setprecision(x) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; typedef pair<double, double> pdd; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<char> vc; typedef vector<vc> vvc; typedef vector<string> vs; typedef vector<bool> vb; typedef vector<vb> vvb; typedef vector<P> vp; typedef vector<vp> vvp; typedef vector<pll> vpll; typedef pair<P, int> pip; typedef vector<pip> vip; const int inf = 1 << 29; const ll INF = 1ll << 60; const double pi = acos(-1); const double eps = 1e-7; const ll mod = 1e9 + 7; const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; int h, r; int main() { cin >> h >> r; if (-h == r) cout << 0 << endl; else if (h + r > 0) cout << 1 << endl; else cout << -1 << endl; }
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22]]
1
317
2
#include <iostream> #include <stdio.h> using namespace std; int main(void) { int h = 0, r = 0; cin >> h >> r; if (h + r == 0) { cout << "0" << endl; } else if (h - r >= 0) { cout << "1" << endl; } else { cout << "-1" << endl; } return 0; }
#include <iostream> #include <stdio.h> using namespace std; int main(void) { int h = 0, r = 0; cin >> h >> r; if (h + r == 0) { cout << "0" << endl; } else if (h + r >= 0) { cout << "1" << endl; } else { cout << "-1" << endl; } return 0; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72]]
1
81
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define rep(i, a) for (int i = 0; i < a; i++) #define mp make_pair #define pb push_back #define P pair<int, int> #define ll __int64 int h, r; int main() { cin >> h >> r; if (h - r >= 0) cout << 1; else if (h + r <= 0) cout << -1; else cout << 0; cout << endl; return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define rep(i, a) for (int i = 0; i < a; i++) #define mp make_pair #define pb push_back #define P pair<int, int> #define ll __int64 int h, r; int main() { cin >> h >> r; if (h + r > 0) cout << 1; else if (h + r < 0) cout << -1; else cout << 0; cout << endl; return 0; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18]]
1
102
6
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b; if (-a == b) c = 0; else if (a > 0) c = 1; else c = -1; cout << c << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b; if (-a == b) c = 0; else if (-a <= b || a > 0) c = 1; else c = -1; cout << c << endl; return 0; }
[["+", 15, 339, 51, 16, 31, 16, 31, 91, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]]
1
61
5
#include <iostream> using namespace std; int main() { int h, r; cin >> h >> r; if (h + r < 0) cout << -1 << endl; else if (h + r == 0) cout << 0 << endl; else if (h - r >= 0) cout << 1 << endl; return 0; }
#include <iostream> using namespace std; int main() { int h, r; cin >> h >> r; if (h + r < 0) cout << -1 << endl; else if (h + r == 0) cout << 0 << endl; else if (h + r > 0) cout << 1 << endl; return 0; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47]]
1
70
4
#include <bits/stdc++.h> using namespace std; int main() { int H, R; cin >> H >> R; if (R + H == 0) cout << "0" << endl; if (H + R < 0) cout << "-1" << endl; if (H - R > 0) cout << "1" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int H, R; cin >> H >> R; if (R + H == 0) cout << "0" << endl; if (R + H < 0) cout << "-1" << endl; if (H + R > 0) cout << "1" << endl; return 0; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33]]
1
74
6
#include <bits/stdc++.h> using namespace std; int main() { int H, R; cin >> H >> R; if (H + R == 0) cout << 0 << endl; if (H + R < 0) cout << 1 << endl; if (H + R > 0) cout << -1 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int H, R; cin >> H >> R; if (H + R == 0) cout << 0 << endl; if (H + R > 0) cout << 1 << endl; if (H + R < 0) cout << -1 << endl; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
68
4
#include <bits/stdc++.h> using namespace std; int main() { int h, r; cin >> h >> r; if (h >= r) cout << "1" << endl; if (-h - r > 0) cout << "-1" << endl; if (h + r == 0) cout << "0" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int h, r; cin >> h >> r; if (-h - r < 0) cout << "1" << endl; if (-h - r > 0) cout << "-1" << endl; if (h + r == 0) cout << "0" << endl; return 0; }
[["+", 15, 339, 51, 16, 31, 16, 31, 91, 17, 33], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
73
5
h, r = list(map(int, input().split())) print(int((h+r)/abs(h+r)))
h, r = list(map(int, input().split())) print(int((h+r>0)-(h+r<0)))
[["+", 3, 4, 0, 657, 31, 23, 0, 666, 667, 47], ["+", 3, 4, 0, 657, 31, 23, 0, 666, 0, 612], ["-", 3, 4, 0, 652, 3, 4, 0, 657, 17, 85], ["-", 0, 652, 3, 4, 0, 657, 12, 652, 63, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 3, 4, 0, 657, 12, 23, 0, 666, 667, 18], ["+", 3, 4, 0, 657, 12, 23, 0, 666, 0, 612]]
5
37
7
h, r = map(int, input().split()) if h + r < 0:print(-1) else:print(0 if h == r else 1)
h, r = map(int, input().split()) if h + r < 0:print(-1) else:print(0 if h + r == 0 else 1)
[["-", 0, 652, 3, 4, 0, 41, 0, 666, 667, 60], ["+", 3, 4, 0, 41, 0, 666, 0, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 60], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 0, 612]]
5
40
4
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int E = s.nextInt(); int Y = s.nextInt(); if (E == 0) { if (Y <= 1911) { System.out.print("M"); System.out.println(Y - 1867); } else if (Y <= 1925) { System.out.print("T"); System.out.println(Y - 1911); } else if (Y <= 1988) { System.out.print("S"); System.out.println(Y - 1925); } else { System.out.print("H"); System.out.println(Y - 19880); } } else if (E == 1) { System.out.println(1867 + Y); } else if (E == 2) { System.out.println(1911 + Y); } else if (E == 3) { System.out.println(1925 + Y); } else { System.out.println(1988 + Y); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int E = s.nextInt(); int Y = s.nextInt(); if (E == 0) { if (Y <= 1911) { System.out.print("M"); System.out.println(Y - 1867); } else if (Y <= 1925) { System.out.print("T"); System.out.println(Y - 1911); } else if (Y <= 1988) { System.out.print("S"); System.out.println(Y - 1925); } else { System.out.print("H"); System.out.println(Y - 1988); } } else if (E == 1) { System.out.println(1867 + Y); } else if (E == 2) { System.out.println(1911 + Y); } else if (E == 3) { System.out.println(1925 + Y); } else { System.out.println(1988 + Y); } } }
[["-", 0, 1, 0, 492, 3, 4, 0, 16, 12, 499], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 12, 499]]
3
252
2
#include <stdio.h> int main() { int e, y; scanf("%d%d", &e, &y); if (e == 0) { if (y <= 1911) { printf("M%d\n", y - 1867); } else if (y <= 1925) { printf("T%d\n", y - 1911); } else if (y <= 1988) { printf("S%d\n", y - 1925); } else { printf("H%d\n", y - 1988); } } if (e == 1) { printf("%d\n", y + 1967); } if (e == 2) { printf("%d\n", y + 1911); } if (e == 3) { printf("%d\n", y + 1925); } else { printf("%d\n", y + 1988); } return 0; }
#include <stdio.h> int main() { int e, y; scanf("%d%d", &e, &y); if (e == 0) { if (y <= 1911) { printf("M%d\n", y - 1867); } else if (y <= 1925) { printf("T%d\n", y - 1911); } else if (y <= 1988) { printf("S%d\n", y - 1925); } else { printf("H%d\n", y - 1988); } } else { if (e == 1) { printf("%d\n", y + 1867); } else if (e == 2) { printf("%d\n", y + 1911); } else if (e == 3) { printf("%d\n", y + 1925); } else { printf("%d\n", y + 1988); } } return 0; }
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95], ["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 46]]
0
189
7
#include <iostream> using namespace std; int main() { int E, Y; cin >> E >> Y; switch (E) { case 0: if (Y > 1988) cout << "H" << Y - 1988 << endl; else if (Y > 1925) cout << "S" << Y - 1925 << endl; else if (Y > 1911) cout << "T" << Y - 1911 << endl; else cout << "M" << Y - 1967 << endl; break; case 1: cout << Y + 1967 << endl; break; case 2: cout << Y + 1911 << endl; break; case 3: cout << Y + 1925 << endl; break; case 4: cout << Y + 1988 << endl; break; } return 0; }
#include <iostream> using namespace std; int main() { int E, Y; cin >> E >> Y; switch (E) { case 0: if (Y > 1988) cout << "H" << Y - 1988 << endl; else if (Y > 1925) cout << "S" << Y - 1925 << endl; else if (Y > 1911) cout << "T" << Y - 1911 << endl; else cout << "M" << Y - 1867 << endl; break; case 1: cout << Y + 1867 << endl; break; case 2: cout << Y + 1911 << endl; break; case 3: cout << Y + 1925 << endl; break; case 4: cout << Y + 1988 << endl; break; } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
158
4
#include <iostream> using namespace std; int main() { int E, Y, AD; int wareki[5] = {0, 1865, 1911, 1925, 1988}; cin >> E >> Y; AD = Y + wareki[E]; if (E != 0) cout << AD << endl; else { if (AD > wareki[4]) cout << "H" << Y - wareki[4] << endl; else if (AD > wareki[3]) cout << "S" << Y - wareki[3] << endl; else if (AD > wareki[2]) cout << "T" << Y - wareki[2] << endl; else cout << "M" << Y - wareki[1] << endl; } return 0; }
#include <iostream> using namespace std; int main() { int E, Y, AD; int wareki[5] = {0, 1867, 1911, 1925, 1988}; cin >> E >> Y; AD = Y + wareki[E]; if (E != 0) cout << AD << endl; else { if (AD > wareki[4]) cout << "H" << Y - wareki[4] << endl; else if (AD > wareki[3]) cout << "S" << Y - wareki[3] << endl; else if (AD > wareki[2]) cout << "T" << Y - wareki[2] << endl; else cout << "M" << Y - wareki[1] << endl; } return 0; }
[["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13]]
1
160
2
#include <iostream> using namespace std; int main() { int e, y; cin >> e >> y; if (e == 0) { if (y < 1912) cout << "M" << y - 1967; else if (y < 1926) cout << "T" << y - 1911; else if (y < 1989) cout << "S" << y - 1925; else cout << "H" << y - 1988; cout << endl; } else if (e == 1) cout << y + 1867 << endl; else if (e == 2) cout << y + 1911 << endl; else if (e == 3) cout << y + 1925 << endl; else if (e == 4) cout << y + 1988 << endl; return 0; }
#include <iostream> using namespace std; int main() { int e, y; cin >> e >> y; if (e == 0) { if (y < 1912) cout << "M" << y - 1867; else if (y < 1926) cout << "T" << y - 1911; else if (y < 1989) cout << "S" << y - 1925; else cout << "H" << y - 1988; cout << endl; } else if (e == 1) cout << y + 1867 << endl; else if (e == 2) cout << y + 1911 << endl; else if (e == 3) cout << y + 1925 << endl; else if (e == 4) cout << y + 1988 << endl; return 0; }
[["-", 0, 57, 64, 1, 0, 16, 12, 16, 12, 13], ["+", 0, 57, 64, 1, 0, 16, 12, 16, 12, 13]]
1
159
2
#include <bits/stdc++.h> using namespace std; #define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) (a).begin(), (a).end() int main(void) { int e, y; cin >> y >> e; if (y == 0) { if (e <= 1911) cout << 'M' << e - 1867 << endl; else if (e <= 1925) cout << 'T' << e - 1911 << endl; else if (e <= 1988) cout << "S" << e - 1925 << endl; else cout << 'H' << e - 1988 << endl; } else { if (y == 1) { cout << 1823 + e << endl; } if (y == 2) { cout << 1911 + e << endl; } if (y == 3) { cout << 1925 + e << endl; } if (y == 4) { cout << 1988 + e << endl; } } }
#include <bits/stdc++.h> using namespace std; #define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) (a).begin(), (a).end() int main(void) { int e, y; cin >> y >> e; if (y == 0) { if (e <= 1911) cout << 'M' << e - 1867 << endl; else if (e <= 1925) cout << 'T' << e - 1911 << endl; else if (e <= 1988) cout << "S" << e - 1925 << endl; else cout << 'H' << e - 1988 << endl; } else { if (y == 1) { cout << 1867 + e << endl; } if (y == 2) { cout << 1911 + e << endl; } if (y == 3) { cout << 1925 + e << endl; } if (y == 4) { cout << 1988 + e << endl; } } }
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13]]
1
192
2
#include <bits/stdc++.h> #define int long long #define double long double #define INF 1e18 using namespace std; template <class T> inline bool chmin(T &a, T b) { if (a > b) a = b; return a > b; } template <class T> inline bool chmax(T &a, T b) { if (a < b) a = b; return a < b; } signed main() { int E, Y; cin >> E >> Y; int a[4] = {1989, 1926, 1912, 1868}; char b[4] = {'H', 'S', 'T', 'M'}; if (E == 0) { for (int i = 0; i < 4; i++) { if (Y - a[i] + 1 > 0) { cout << b[i] << Y - a[i] + 1 << endl; break; } } } else { cout << Y + a[4 - E] << endl; } }
#include <bits/stdc++.h> #define int long long #define double long double #define INF 1e18 using namespace std; template <class T> inline bool chmin(T &a, T b) { if (a > b) a = b; return a > b; } template <class T> inline bool chmax(T &a, T b) { if (a < b) a = b; return a < b; } signed main() { int E, Y; cin >> E >> Y; int a[4] = {1989, 1926, 1912, 1868}; char b[4] = {'H', 'S', 'T', 'M'}; if (E == 0) { for (int i = 0; i < 4; i++) { if (Y - a[i] + 1 > 0) { cout << b[i] << Y - a[i] + 1 << endl; break; } } } else { cout << Y + a[4 - E] - 1 << endl; } }
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
213
2
#include <bits/stdc++.h> using namespace std; int main() { int E, Y; cin >> E >> Y; if (E == 0 && 1868 <= Y && Y <= 1911) { cout << "M" << Y - 1967 << endl; } else if (E == 0 && Y >= 1912 && Y <= 1925) { cout << "T" << Y - 1911 << endl; } else if (E == 0 && Y >= 1926 && Y <= 1988) { cout << "S" << Y - 1925 << endl; } else if (E == 0 && Y >= 1989 && Y <= 2016) { cout << "H" << Y - 1988 << endl; } else if (E == 1) { cout << Y + 1867 << endl; } else if (E == 2) { cout << Y + 1911 << endl; } else if (E == 3) { cout << Y + 1925 << endl; } else if (E == 4) { cout << Y + 1988 << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int E, Y; cin >> E >> Y; if (E == 0 && 1868 <= Y && Y <= 1911) { cout << "M" << Y - 1867 << endl; } else if (E == 0 && Y >= 1912 && Y <= 1925) { cout << "T" << Y - 1911 << endl; } else if (E == 0 && Y >= 1926 && Y <= 1988) { cout << "S" << Y - 1925 << endl; } else if (E == 0 && Y >= 1989 && Y <= 2016) { cout << "H" << Y - 1988 << endl; } else if (E == 1) { cout << Y + 1867 << endl; } else if (E == 2) { cout << Y + 1911 << endl; } else if (E == 3) { cout << Y + 1925 << endl; } else if (E == 4) { cout << Y + 1988 << endl; } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
209
2
#include <bits/stdc++.h> using namespace std; int main() { int E, Y; cin >> E >> Y; if (E = 0) { if (1868 <= Y && Y <= 1911) { cout << "M" << Y - 1867 << endl; } else if (1912 <= Y && Y <= 1925) { cout << "T" << Y - 1911 << endl; } else if (1926 <= Y && Y <= 1988) { cout << "S" << Y - 1925 << endl; } else { cout << "H" << Y - 1988 << endl; } } else if (E == 1) { cout << 1967 + Y << endl; } else if (E == 2) { cout << 1911 + Y << endl; } else if (E == 3) { cout << 1925 + Y << endl; } else if (E == 4) { cout << 1988 + Y << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int E, Y; cin >> E >> Y; if (E == 0) { if (1868 <= Y && Y <= 1911) { cout << "M" << Y - 1867 << endl; } else if (1912 <= Y && Y <= 1925) { cout << "T" << Y - 1911 << endl; } else if (1926 <= Y && Y <= 1988) { cout << "S" << Y - 1925 << endl; } else { cout << "H" << Y - 1988 << endl; } } else if (E == 1) { cout << 1867 + Y << endl; } else if (E == 2) { cout << 1911 + Y << endl; } else if (E == 3) { cout << 1925 + Y << endl; } else if (E == 4) { cout << 1988 + Y << endl; } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13]]
1
191
4
#include <bits/stdc++.h> using namespace std; int main() { int E, Y; cin >> E >> Y; if (E == 0) { if (Y <= 1911) { cout << "M" << Y - 1867 << endl; } else if (1912 <= Y && Y <= 1925) { cout << "T" << Y - 1911 << endl; } else if (1926 <= Y && Y <= 1988) { cout << "S" << Y - 1925 << endl; } else { cout << "H" << Y - 1988 << endl; } } else if (E == 1) { cout << Y + 1817 << endl; } else if (E == 2) { cout << Y + 1911 << endl; } else if (E == 3) { cout << Y + 1925 << endl; } else if (E == 4) { cout << Y + 1988 << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int E, Y; cin >> E >> Y; if (E == 0) { if (Y <= 1911) { cout << "M" << Y - 1867 << endl; } else if (1912 <= Y && Y <= 1925) { cout << "T" << Y - 1911 << endl; } else if (1926 <= Y && Y <= 1988) { cout << "S" << Y - 1925 << endl; } else { cout << "H" << Y - 1988 << endl; } } else if (E == 1) { cout << Y + 1867 << endl; } else if (E == 2) { cout << Y + 1911 << endl; } else if (E == 3) { cout << Y + 1925 << endl; } else if (E == 4) { cout << Y + 1988 << endl; } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
187
2
#include <bits/stdc++.h> using namespace std; int main() { int e, y, a, b, c; cin >> e >> y; if (e == 0) { a = y - 1868; if (a <= 43) { cout << "M" << a << endl; } else if (44 <= a && a <= 57) { b = a - 43; cout << "T" << b << endl; } else if (58 <= a && a <= 120) { b = a - 57; cout << "S" << b << endl; } else { b = a - 120; cout << "H" << b << endl; } } else if (e == 1) { c = y + 1867; cout << c << endl; } else if (e == 2) { c = y + 1911; cout << c << endl; } else if (e == 3) { c = y + 1925; cout << c << endl; } else { c = y + 1988; cout << c << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int e, y, a, b, c; cin >> e >> y; if (e == 0) { a = y - 1868; if (a <= 43) { cout << "M" << a + 1 << endl; } else if (44 <= a && a <= 57) { b = a - 43; cout << "T" << b << endl; } else if (58 <= a && a <= 120) { b = a - 57; cout << "S" << b << endl; } else { b = a - 120; cout << "H" << b << endl; } } else if (e == 1) { c = y + 1867; cout << c << endl; } else if (e == 2) { c = y + 1911; cout << c << endl; } else if (e == 3) { c = y + 1925; cout << c << endl; } else { c = y + 1988; cout << c << endl; } }
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
216
2
// AOJ0337.cpp #include <iostream> using namespace std; int main() { int E, Y; cin >> E >> Y; switch (E) { case 0: if (1868 <= Y && Y <= 1991) { cout << 'M' << Y - 1867 << endl; } else if (1912 <= Y && Y <= 1925) { cout << 'T' << Y - 1911 << endl; } else if (1926 <= Y && Y <= 1988) { cout << 'S' << Y - 1925 << endl; } else if (1989 <= Y && Y <= 2016) { cout << 'H' << Y - 1988 << endl; } break; case 1: cout << Y + 1867 << endl; break; case 2: cout << Y + 1911 << endl; break; case 3: cout << Y + 1925 << endl; break; case 4: cout << Y + 1988 << endl; break; } return 0; }
// AOJ0337.cpp #include <iostream> using namespace std; int main() { int E, Y; cin >> E >> Y; switch (E) { case 0: if (1868 <= Y && Y <= 1911) { cout << 'M' << Y - 1867 << endl; } else if (1912 <= Y && Y <= 1925) { cout << 'T' << Y - 1911 << endl; } else if (1926 <= Y && Y <= 1988) { cout << 'S' << Y - 1925 << endl; } else if (1989 <= Y && Y <= 2016) { cout << 'H' << Y - 1988 << endl; } break; case 1: cout << Y + 1867 << endl; break; case 2: cout << Y + 1911 << endl; break; case 3: cout << Y + 1925 << endl; break; case 4: cout << Y + 1988 << endl; break; } return 0; }
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
189
2
#include <iostream> using namespace std; int main() { int E, Y; cin >> E >> Y; if (E == 0) { if (Y >= 1989) cout << "H" << 28 - (2016 - Y) << endl; else if (Y >= 1926) cout << "S" << 63 - (1988 - Y) << endl; else if (Y >= 1912) cout << "T" << 14 - (1925 - Y) << endl; else if (Y >= 1868) cout << "M" << 44 - (1911 - Y) << endl; } else if (E == 1) cout << Y + 1868 << endl; else if (E == 2) cout << Y + 1912 << endl; else if (E == 3) cout << Y + 1926 << endl; else if (E == 4) cout << Y + 1989 << endl; return 0; }
#include <iostream> using namespace std; int main() { int E, Y; cin >> E >> Y; if (E == 0) { if (Y >= 1989) cout << "H" << 28 - (2016 - Y) << endl; else if (Y >= 1926) cout << "S" << 63 - (1988 - Y) << endl; else if (Y >= 1912) cout << "T" << 14 - (1925 - Y) << endl; else if (Y >= 1868) cout << "M" << 44 - (1911 - Y) << endl; } else if (E == 1) cout << Y + 1867 << endl; else if (E == 2) cout << Y + 1911 << endl; else if (E == 3) cout << Y + 1925 << endl; else if (E == 4) cout << Y + 1988 << endl; return 0; }
[["-", 64, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 64, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
185
8
#include <cstdio> #include <iostream> using namespace std; int main(void) { int e, y; cin >> e >> y; if (e == 0) { if (1868 <= y && y <= 1911) cout << 'M' << y - 1868 << endl; if (1912 <= y && y <= 1925) cout << 'T' << y - 1911 << endl; if (1926 <= y && y <= 1988) cout << 'S' << y - 1925 << endl; if (1989 <= y && y <= 2016) cout << 'H' << y - 1988 << endl; } if (e == 1) cout << 1867 + y << endl; if (e == 2) cout << 1911 + y << endl; if (e == 3) cout << 1925 + y << endl; if (e == 4) cout << 1988 + y << endl; return 0; }
#include <cstdio> #include <iostream> using namespace std; int main(void) { int e, y; cin >> e >> y; if (e == 0) { if (1868 <= y && y <= 1911) cout << 'M' << y - 1867 << endl; if (1912 <= y && y <= 1925) cout << 'T' << y - 1911 << endl; if (1926 <= y && y <= 1988) cout << 'S' << y - 1925 << endl; if (1989 <= y && y <= 2016) cout << 'H' << y - 1988 << endl; } if (e == 1) cout << 1867 + y << endl; if (e == 2) cout << 1911 + y << endl; if (e == 3) cout << 1925 + y << endl; if (e == 4) cout << 1988 + y << endl; return 0; }
[["-", 64, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 64, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
181
2
#include <stdio.h> int main() { int e, y; scanf("%d %d", &e, &y); switch (e) { case 0: if (y < 1912) { printf("M%d\n", y - 1867); } else if (y < 1926) { printf("H%d\n", y - 1911); } else if (y < 1989) { printf("S%d\n", y - 1925); } else { printf("H%d\n", y - 1988); } break; case 1: printf("%d\n", 1867 + y); break; case 2: printf("%d\n", 1911 + y); break; case 3: printf("%d\n", 1925 + y); break; default: printf("%d\n", 1988 + y); } return 0; }
#include <stdio.h> int main() { int e, y; scanf("%d %d", &e, &y); switch (e) { case 0: if (y < 1912) { printf("M%d\n", y - 1867); } else if (y < 1926) { printf("T%d\n", y - 1911); } else if (y < 1989) { printf("S%d\n", y - 1925); } else { printf("H%d\n", y - 1988); } break; case 1: printf("%d\n", 1867 + y); break; case 2: printf("%d\n", 1911 + y); break; case 3: printf("%d\n", 1925 + y); break; default: printf("%d\n", 1988 + y); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
182
2
#include <bits/stdc++.h> #define LL long long int using namespace std; int main(void) { int e, y; cin >> e >> y; if (e == 0) { if (1868 >= y && y <= 1911) cout << "M" << (y - 1868) + 1 << endl; else if (1925 >= y) cout << "T" << (y - 1912) + 1 << endl; else if (1988 >= y) cout << "S" << (y - 1926) + 1 << endl; else cout << "H" << (y - 1989) + 1 << endl; } else { if (e == 1) cout << (1868 + y) - 1 << endl; else if (e == 2) cout << (1912 + y) - 1 << endl; else if (e == 3) cout << (1926 + y) - 1 << endl; else cout << (1989 + y) - 1 << endl; } }
#include <bits/stdc++.h> #define LL long long int using namespace std; int main(void) { int e, y; cin >> e >> y; if (e == 0) { if (1911 >= y) cout << "M" << (y - 1868) + 1 << endl; else if (1925 >= y) cout << "T" << (y - 1912) + 1 << endl; else if (1988 >= y) cout << "S" << (y - 1926) + 1 << endl; else cout << "H" << (y - 1989) + 1 << endl; } else { if (e == 1) cout << (1868 + y) - 1 << endl; else if (e == 2) cout << (1912 + y) - 1 << endl; else if (e == 3) cout << (1926 + y) - 1 << endl; else cout << (1989 + y) - 1 << endl; } }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
196
6
#include <bits/stdc++.h> using namespace std; //#define int long long #define FOR(i, j, k) for (int i = j; i < (int)k; ++i) #define rep(i, j) FOR(i, 0, j) #define INF (1 << 30) typedef unsigned long long ull; typedef pair<int, int> P; typedef pair<P, int> Pi; const int MOD = 1e9 + 7; const int dy[] = {0, 0, 1, -1}; const int dx[] = {1, -1, 0, 0}; template <class T> void chmin(T &a, const T &b) { a = min(a, b); } template <class T> void chmax(T &a, const T &b) { a = max(a, b); } template <typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); } template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } signed main() { cin.tie(0); ios::sync_with_stdio(false); int e, y; cin >> e >> y; if (e == 0) { if (1989 <= y && y <= 2016) cout << "H" << y - 1988 << endl; else if (1926 <= y && y <= 1988) cout << "S" << y - 1925 << endl; else if (1912 <= y && y <= 1925) cout << "T" << y - 1911 << endl; else cout << "M" << y - 1867 << endl; } else if (e == 1) { cout << y + 1867 << endl; } else if (e == 2) { cout << y + 1911 << endl; } else if (e == 3) { cout << y + 1925 << endl; } else { cout << y + 1988002 << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; //#define int long long #define FOR(i, j, k) for (int i = j; i < (int)k; ++i) #define rep(i, j) FOR(i, 0, j) #define INF (1 << 30) typedef unsigned long long ull; typedef pair<int, int> P; typedef pair<P, int> Pi; const int MOD = 1e9 + 7; const int dy[] = {0, 0, 1, -1}; const int dx[] = {1, -1, 0, 0}; template <class T> void chmin(T &a, const T &b) { a = min(a, b); } template <class T> void chmax(T &a, const T &b) { a = max(a, b); } template <typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); } template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } signed main() { cin.tie(0); ios::sync_with_stdio(false); int e, y; cin >> e >> y; if (e == 0) { if (1989 <= y && y <= 2016) cout << "H" << y - 1988 << endl; else if (1926 <= y && y <= 1988) cout << "S" << y - 1925 << endl; else if (1912 <= y && y <= 1925) cout << "T" << y - 1911 << endl; else cout << "M" << y - 1867 << endl; } else if (e == 1) { cout << y + 1867 << endl; } else if (e == 2) { cout << y + 1911 << endl; } else if (e == 3) { cout << y + 1925 << endl; } else { cout << y + 1988 << endl; } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
395
2
//============================================================================ // Name : AOJ.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <algorithm> #include <iostream> using namespace std; int w, h, n; int d[100001] = {}; int main() { int E, Y; cin >> E >> Y; if (E == 0) { if (Y >= 1868 && Y <= 1911) cout << "M" << Y - 1867 << endl; if (Y >= 1912 && Y <= 1925) cout << "T" << Y - 1911 << endl; if (Y >= 1926 && Y <= 1988) cout << "S" << Y - 1925 << endl; if (Y >= 1889 && Y <= 2016) cout << "H" << Y - 1988 << endl; } else if (E == 1) { cout << Y + 1867 << endl; } else if (E == 2) { cout << Y + 1911 << endl; } else if (E == 3) { cout << Y + 1925 << endl; } else if (E == 4) { cout << Y + 1988 << endl; } return 0; }
//============================================================================ // Name : AOJ.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <algorithm> #include <iostream> using namespace std; int w, h, n; int d[100001] = {}; int main() { int E, Y; cin >> E >> Y; if (E == 0) { if (Y >= 1868 && Y <= 1911) cout << "M" << Y - 1867 << endl; if (Y >= 1912 && Y <= 1925) cout << "T" << Y - 1911 << endl; if (Y >= 1926 && Y <= 1988) cout << "S" << Y - 1925 << endl; if (Y >= 1989 && Y <= 2016) cout << "H" << Y - 1988 << endl; } else if (E == 1) { cout << Y + 1867 << endl; } else if (E == 2) { cout << Y + 1911 << endl; } else if (E == 3) { cout << Y + 1925 << endl; } else if (E == 4) { cout << Y + 1988 << endl; } return 0; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
215
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define rep(i, a) for (int i = 0; i < a; i++) #define mp make_pair #define pb push_back #define P pair<int, int> #define ll __int64 int e, y; char g[4] = {'M', 'T', 'S', 'H'}; int h[4] = {1868, 1912, 1926, 1989}; int main() { cin >> e >> y; int num = -1; for (int i = 0; i < 3; i++) { if (y - h[i + 1] < 0) { num = i; break; } } if (num == -1) num = 3; if (e == 0) { cout << g[num] << " " << y - h[num] + 1 << endl; } else { cout << h[e - 1] + y - 1 << endl; } return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define rep(i, a) for (int i = 0; i < a; i++) #define mp make_pair #define pb push_back #define P pair<int, int> #define ll __int64 int e, y; char g[4] = {'M', 'T', 'S', 'H'}; int h[4] = {1868, 1912, 1926, 1989}; int main() { cin >> e >> y; int num = -1; for (int i = 0; i < 3; i++) { if (y - h[i + 1] < 0) { num = i; break; } } if (num == -1) num = 3; if (e == 0) { cout << g[num] << y - h[num] + 1 << endl; } else { cout << h[e - 1] + y - 1 << endl; } return 0; }
[["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 17, 151]]
1
208
4
#include <iostream> using namespace std; int main() { int e, y; cin >> e >> y; if (e == 0) { if (y <= 1911) { cout << "M" << y - 1867 << endl; } else if (y <= 1925) { cout << "T" << y - 1911 << endl; } else if (y <= 1988) { cout << "S" << y - 1925 << endl; } else { cout << "H" << y - 1988 << endl; } } else if (e == 1) { cout << 1967 + y << endl; } else if (e == 2) { cout << 1911 + y << endl; } else if (e == 3) { cout << 1925 + y << endl; } else { cout << 1988 + y << endl; } return 0; }
#include <iostream> using namespace std; int main() { int e, y; cin >> e >> y; if (e == 0) { if (y <= 1911) { cout << "M" << y - 1867 << endl; } else if (y <= 1925) { cout << "T" << y - 1911 << endl; } else if (y <= 1988) { cout << "S" << y - 1925 << endl; } else { cout << "H" << y - 1988 << endl; } } else if (e == 1) { cout << 1867 + y << endl; } else if (e == 2) { cout << 1911 + y << endl; } else if (e == 3) { cout << 1925 + y << endl; } else { cout << 1988 + y << endl; } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13]]
1
173
2
#include <iostream> using namespace std; int main() { int E, Y; cin >> E >> Y; if (E == 0) { if (1989 <= Y) { cout << "H" << Y - 1988 << endl; } if (1926 <= Y && Y < 1989) { cout << "S" << Y - 1925 << endl; } if (1912 <= Y && Y < 1926) { cout << "T" << Y - 1911 << endl; } if (1868 >= Y && Y < 1912) { cout << "M" << Y - 1967 << endl; } } if (E == 1) { cout << Y + 1867 << endl; } if (E == 2) { cout << Y + 1911 << endl; } if (E == 3) { cout << Y + 1925 << endl; } if (E == 4) { cout << Y + 1988 << endl; } return 0; }
#include <iostream> using namespace std; int main() { int E, Y; cin >> E >> Y; if (E == 0) { if (1989 <= Y) { cout << "H" << Y - 1988 << endl; } if (1926 <= Y && Y < 1989) { cout << "S" << Y - 1925 << endl; } if (1912 <= Y && Y < 1926) { cout << "T" << Y - 1911 << endl; } if (1868 <= Y && Y < 1912) { cout << "M" << Y - 1867 << endl; } } if (E == 1) { cout << Y + 1867 << endl; } if (E == 2) { cout << Y + 1911 << endl; } if (E == 3) { cout << Y + 1925 << endl; } if (E == 4) { cout << Y + 1988 << endl; } return 0; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
190
4
#include <bits/stdc++.h> using namespace std; int main() { int E, Y; cin >> E >> Y; if (E == 0) { if (Y >= 1989 && Y <= 2016) cout << "H" << Y - 1988 << endl; if (Y >= 1926 && Y <= 1988) cout << "S" << Y - 1925 << endl; if (Y >= 1912 && Y <= 1925) cout << "T" << Y - 1911 << endl; if (Y >= 1868 && Y <= 1911) cout << "M" << Y - 1867 << endl; } else { if (E = 1) cout << Y + 1867 << endl; if (E = 2) cout << Y + 1911 << endl; if (E = 3) cout << Y + 1925 << endl; if (E = 4) cout << Y + 1988 << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int E, Y; cin >> E >> Y; if (E == 0) { if (Y >= 1989 && Y <= 2016) cout << "H" << Y - 1988 << endl; if (Y >= 1926 && Y <= 1988) cout << "S" << Y - 1925 << endl; if (Y >= 1912 && Y <= 1925) cout << "T" << Y - 1911 << endl; if (Y >= 1868 && Y <= 1911) cout << "M" << Y - 1867 << endl; } else { if (E == 1) cout << Y + 1867 << endl; if (E == 2) cout << Y + 1911 << endl; if (E == 3) cout << Y + 1925 << endl; if (E == 4) cout << Y + 1988 << endl; } return 0; }
[["-", 0, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
181
8
#include <bits/stdc++.h> using namespace std; int main() { int E, Y, Y2; cin >> E >> Y; if (E == 0) { if (1868 <= Y && Y <= 1911) { Y2 = Y - 1867; cout << "M" << Y2 << endl; } if (1912 <= Y && Y <= 1925) { Y2 = Y - 1911; cout << "T" << Y2 << endl; } if (1926 <= Y && Y <= 1988) { Y2 = Y - 1925; cout << "S" << Y2 << endl; } if (1989 <= Y && Y <= 2016) { Y2 = Y - 1988; cout << "H" << Y2 << endl; } } if (E == 1) { Y2 = 1866 + Y; cout << Y2 << endl; } if (E == 2) { Y2 = 1910 + Y; cout << Y2 << endl; } if (E == 3) { Y2 = 1924 + Y; cout << Y2 << endl; } if (E == 4) { Y2 = 1988 + Y; cout << Y2 << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int E, Y, Y2; cin >> E >> Y; if (E == 0) { if (1868 <= Y && Y <= 1911) { Y2 = Y - 1867; cout << "M" << Y2 << endl; } if (1912 <= Y && Y <= 1925) { Y2 = Y - 1911; cout << "T" << Y2 << endl; } if (1926 <= Y && Y <= 1988) { Y2 = Y - 1925; cout << "S" << Y2 << endl; } if (1989 <= Y && Y <= 2016) { Y2 = Y - 1988; cout << "H" << Y2 << endl; } } if (E == 1) { Y2 = 1867 + Y; cout << Y2 << endl; } if (E == 2) { Y2 = 1911 + Y; cout << Y2 << endl; } if (E == 3) { Y2 = 1925 + Y; cout << Y2 << endl; } if (E == 4) { Y2 = 1988 + Y; cout << Y2 << endl; } }
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 31, 13], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 13]]
1
225
6
#include <bits/stdc++.h> using namespace std; int main() { int E, Y; cin >> E >> Y; if (E == 0) { if (1868 <= Y && Y <= 1911) cout << "M" << (Y - 1867) << endl; if (1912 <= Y && Y <= 1925) cout << "T" << (Y - 1911) << endl; if (1926 <= Y && Y <= 1988) cout << "S" << (Y - 1925) << endl; if (1989 <= Y && Y <= 2016) cout << "H" << (Y - 1989) << endl; } if (E == 1) cout << (Y + 1867) << endl; if (E == 2) cout << (Y + 1911) << endl; if (E == 3) cout << (Y + 1925) << endl; if (E == 4) cout << (Y + 1988) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int E, Y; cin >> E >> Y; if (E == 0) { if (1868 <= Y && Y <= 1911) cout << "M" << (Y - 1867) << endl; if (1912 <= Y && Y <= 1925) cout << "T" << (Y - 1911) << endl; if (1926 <= Y && Y <= 1988) cout << "S" << (Y - 1925) << endl; if (1989 <= Y && Y <= 2016) cout << "H" << (Y - 1988) << endl; } if (E == 1) cout << (Y + 1867) << endl; if (E == 2) cout << (Y + 1911) << endl; if (E == 3) cout << (Y + 1925) << endl; if (E == 4) cout << (Y + 1988) << endl; return 0; }
[["-", 0, 16, 31, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 16, 31, 16, 12, 23, 0, 16, 12, 13]]
1
194
2
def main(): E,Y = map(int,input().split()) if E == 0: if Y <= 1911: print("S"+str(Y-1867)) elif Y <= 1925: print("T"+str(Y-1911)) elif Y<= 1988: print("S"+str(Y-1925)) else: print("H"+str(Y-1988)) elif E == 1: print(str(1867+Y)) elif E == 2: print(str(1911+Y)) elif E == 3: print(str(1925+Y)) else: print(str(1988+Y)) if __name__ == "__main__": main()
def main(): E,Y = map(int,input().split()) if E == 0: if Y <= 1911: print("M"+str(Y-1867)) elif Y <= 1925: print("T"+str(Y-1911)) elif Y<= 1988: print("S"+str(Y-1925)) else: print("H"+str(Y-1988)) elif E == 1: print(str(1867+Y)) elif E == 2: print(str(1911+Y)) elif E == 3: print(str(1925+Y)) else: print(str(1988+Y)) if __name__ == "__main__": main()
[["-", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6]]
5
158
2
#include <stdio.h> int main(void) { int w, h, c, i, j; scanf("%d%d%d", &w, &h, &c); for (i = 1; i < h || i < w; i++) { if (w % i == 0 && h % i == 0) { j = (w / i) * (h / i); } } printf("%d\n", j * c); return 0; }
#include <stdio.h> int main(void) { int w, h, c, i, j; scanf("%d%d%d", &w, &h, &c); for (i = 1; i <= h || i <= w; i++) { if (w % i == 0 && h % i == 0) { j = (w / i) * (h / i); } } printf("%d\n", j * c); return 0; }
[["-", 8, 9, 0, 7, 15, 16, 31, 16, 17, 18], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 17, 19], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 18], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 19]]
0
100
4
#include <iostream> using namespace std; int gcd(int a, int b) { if (b == 0) return a; return (b, a % b); } int main() { int W, H, C; cin >> W >> H >> C; int GCD = gcd(W, H); cout << ((W / GCD) * (H / GCD) * C) << endl; return 0; }
#include <iostream> using namespace std; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { int W, H, C; cin >> W >> H >> C; int GCD = gcd(W, H); cout << ((W / GCD) * (H / GCD) * C) << endl; return 0; }
[["+", 0, 14, 8, 9, 0, 37, 0, 2, 63, 22]]
1
89
1
#include <iostream> using namespace std; int gcd(int m, int n) { if (n == 0) { return 0; } return gcd(n, m % n); } int main() { int W, H, C; cin >> W >> H >> C; int g = gcd(W, H); cout << W / g * H / g * C << endl; return 0; }
#include <iostream> using namespace std; int gcd(int m, int n) { if (n == 0) { return m; } return gcd(n, m % n); } int main() { int W, H, C; cin >> W >> H >> C; int g = gcd(W, H); cout << W / g * H / g * C << endl; return 0; }
[["-", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 22]]
1
86
2
#include <iostream> using namespace std; int gcd(int a, int b) { if (b == 0) return a * a; return gcd(b, a % b); } int main() { int w, h, c; cin >> w >> h >> c; cout << w / gcd(w, h) * h * c << endl; return 0; }
#include <iostream> using namespace std; int gcd(int a, int b) { if (b == 0) return a * a; return gcd(b, a % b); } int main() { int w, h, c; cin >> w >> h >> c; cout << w * h / gcd(w, h) * c << endl; return 0; }
[["+", 31, 16, 12, 16, 31, 16, 31, 16, 17, 48], ["+", 31, 16, 12, 16, 31, 16, 31, 16, 12, 22], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 48], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 12, 22]]
1
79
4
import math A, B, C = [int(k) for k in raw_input().split(' ')] print(C * ((A * B)/ (math.gcd(A, B) ** 2 )))
import math A, B, C = [int(k) for k in input().split(' ')] print((C * ((A * B)/ (math.gcd(A, B) ** 2 ))))
[["-", 0, 659, 12, 652, 63, 319, 500, 652, 63, 22], ["+", 0, 659, 12, 652, 63, 319, 500, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 657, 12, 23, 0, 657, 12, 23, 0, 25]]
5
52
4
#include "bits/stdc++.h" using namespace std; #define int long long constexpr int INF = 1LL << 60; constexpr int MAXN = 100005; struct UF { int n, par[MAXN], bukatsu[MAXN]; void Init(int pn) { n = pn; for (int i = 1; i <= pn; ++i) { par[i] = i; } } int Find(int x) { if (par[x] == x) return x; return par[x] = Find(par[x]); } int FindBukatsu(int x) { return bukatsu[Find(x)]; } void Unite(int x, int y) { x = Find(x); y = Find(y); if (x == y) return; par[x] = y; if (bukatsu[y]) return; bukatsu[y] = bukatsu[x]; } void SetBukatsu(int x, int b) { x = Find(x); bukatsu[x] = b; } }; int n, m, k; UF uf; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> m >> k; uf.Init(n); for (int i = 1; i <= k; ++i) { int t; cin >> t; if (t == 1) { int a, b; cin >> a >> b; int bukaa = uf.FindBukatsu(a), bukab = uf.FindBukatsu(b); if (bukaa && bukab && bukaa == bukab) { cout << i << endl; return 0; } uf.Unite(a, b); } else { int c, x; cin >> c >> x; int buka = uf.FindBukatsu(c); if (buka && buka != x) { cout << i << endl; return 0; } uf.SetBukatsu(c, x); } } cout << 0 << endl; }
#include "bits/stdc++.h" using namespace std; #define int long long constexpr int INF = 1LL << 60; constexpr int MAXN = 100005; struct UF { int n, par[MAXN], bukatsu[MAXN]; void Init(int pn) { n = pn; for (int i = 1; i <= pn; ++i) { par[i] = i; } } int Find(int x) { if (par[x] == x) return x; return par[x] = Find(par[x]); } int FindBukatsu(int x) { return bukatsu[Find(x)]; } void Unite(int x, int y) { x = Find(x); y = Find(y); if (x == y) return; par[x] = y; if (bukatsu[y]) return; bukatsu[y] = bukatsu[x]; } void SetBukatsu(int x, int b) { x = Find(x); bukatsu[x] = b; } }; int n, m, k; UF uf; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> m >> k; uf.Init(n); for (int i = 1; i <= k; ++i) { int t; cin >> t; if (t == 1) { int a, b; cin >> a >> b; int bukaa = uf.FindBukatsu(a), bukab = uf.FindBukatsu(b); if (bukaa && bukab && bukaa != bukab) { cout << i << endl; return 0; } uf.Unite(a, b); } else { int c, x; cin >> c >> x; int buka = uf.FindBukatsu(c); if (buka && buka != x) { cout << i << endl; return 0; } uf.SetBukatsu(c, x); } } cout << 0 << endl; }
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79]]
1
407
2
#include <cstdio> #include <vector> using namespace std; class union_find { int *parent, *rank, n; public: int root(int a) { return parent[a] == a ? a : (parent[a] = root(parent[a])); } union_find(int _n) { n = _n; parent = new int[n]; rank = new int[n]; for (int i = 0; i < n; i++) parent[i] = i, rank[i] = 0; } ~union_find() { delete[] parent; delete[] rank; } int unite(int a, int b) { int x = root(a), y = root(b); if (x == y) return 0; if (rank[x] < rank[y]) { parent[x] = y; } else { parent[y] = x; if (rank[x] == rank[y]) rank[x]++; } return 1; } }; int main() { int N, K; scanf("%d%d%d", &N, &K, &K); union_find uf(N + 1); vector<int> v(N + 1); for (int i = 1; i <= K; i++) { int c, a, b; scanf("%d%d%d", &c, &a, &b); if (c == 1) { if (v[uf.root(a)] && v[uf.root(a)] && v[uf.root(a)] != v[uf.root(b)]) { printf("%d\n", i); return 0; } if (!v[uf.root(a)]) v[uf.root(a)] = v[uf.root(b)]; if (!v[uf.root(b)]) v[uf.root(b)] = v[uf.root(a)]; uf.unite(a, b); } else { if (v[uf.root(a)] && v[uf.root(a)] != b) { printf("%d\n", i); return 0; } v[uf.root(a)] = b; } } puts("0"); }
#include <cstdio> #include <vector> using namespace std; class union_find { int *parent, *rank, n; public: int root(int a) { return parent[a] == a ? a : (parent[a] = root(parent[a])); } union_find(int _n) { n = _n; parent = new int[n]; rank = new int[n]; for (int i = 0; i < n; i++) parent[i] = i, rank[i] = 0; } ~union_find() { delete[] parent; delete[] rank; } int unite(int a, int b) { int x = root(a), y = root(b); if (x == y) return 0; if (rank[x] < rank[y]) { parent[x] = y; } else { parent[y] = x; if (rank[x] == rank[y]) rank[x]++; } return 1; } }; int main() { int N, K; scanf("%d%d%d", &N, &K, &K); union_find uf(N + 1); vector<int> v(N + 1); for (int i = 1; i <= K; i++) { int c, a, b; scanf("%d%d%d", &c, &a, &b); if (c == 1) { if (v[uf.root(a)] && v[uf.root(b)] && v[uf.root(a)] != v[uf.root(b)]) { printf("%d\n", i); return 0; } if (!v[uf.root(a)]) v[uf.root(a)] = v[uf.root(b)]; if (!v[uf.root(b)]) v[uf.root(b)] = v[uf.root(a)]; uf.unite(a, b); } else { if (v[uf.root(a)] && v[uf.root(a)] != b) { printf("%d\n", i); return 0; } v[uf.root(a)] = b; } } puts("0"); }
[["-", 12, 69, 341, 342, 0, 2, 3, 4, 0, 22], ["+", 12, 69, 341, 342, 0, 2, 3, 4, 0, 22]]
1
501
2
#include <algorithm> #include <iostream> #define f first #define s second using namespace std; int main() { pair<int, int> a[6]; for (int i = 0, c, b; i < 6 && cin >> c >> b; i++, a[i] = make_pair(c, b)) if (c > b) swap(c, b); sort(a, a + 6); int r = 0; for (int i = 0; i < 3; i++) if (a[i * 2] != a[i * 2 + 1]) r++; if (!r && a[0].f == a[2].f && a[2].s == a[4].s && a[0].s == a[4].f) cout << "yes" << endl; else cout << "no" << endl; return 0; }
#include <algorithm> #include <iostream> #define f first #define s second using namespace std; int main() { pair<int, int> a[6]; for (int i = 0, c, b; i < 6 && cin >> c >> b; a[i++] = make_pair(c, b)) if (c > b) swap(c, b); sort(a, a + 6); int r = 0; for (int i = 0; i < 3; i++) if (a[i * 2] != a[i * 2 + 1]) r++; if (!r && a[0].f == a[2].f && a[2].s == a[4].s && a[0].s == a[4].f) cout << "yes" << endl; else cout << "no" << endl; return 0; }
[["-", 8, 9, 0, 7, 26, 34, 31, 27, 28, 22], ["-", 8, 9, 0, 7, 26, 34, 31, 27, 17, 29], ["-", 0, 14, 8, 9, 0, 7, 26, 34, 0, 21], ["+", 26, 11, 31, 69, 341, 342, 0, 27, 17, 29]]
1
197
4
a = [] for _ in range(6):a.append(sorted(list(map(int, input().split())))) a.sort(key = lambda x:x[1]) a.sort(key = lambda x:x[0]) print("yes" if a[0] == a[1] and a[2] == a[3] and a[4] == a[5] and a[0][0] == a[2][0] and a[0][1] == a[3][0] and a[2][1] == a[3][1] else "no")
a = [] for _ in range(6):a.append(sorted(list(map(int, input().split())))) a.sort(key = lambda x:x[1]) a.sort(key = lambda x:x[0]) print("yes" if a[0] == a[1] and a[2] == a[3] and a[4] == a[5] and a[0][0] == a[2][0] and a[0][1] == a[4][0] and a[2][1] == a[4][1] else "no")
[["-", 31, 679, 12, 666, 0, 206, 51, 206, 206, 612], ["+", 31, 679, 12, 666, 0, 206, 51, 206, 206, 612], ["-", 0, 679, 12, 666, 0, 206, 51, 206, 206, 612], ["+", 0, 679, 12, 666, 0, 206, 51, 206, 206, 612]]
5
151
4
#define __USE_MINGW_ANSI_STDIO 0 #include <bits/stdc++.h> using namespace std; using ll = long long; // #define int ll using VI = vector<int>; using VVI = vector<VI>; using PII = pair<ll, ll>; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() #define PB push_back const ll LLINF = (1LL << 60); const int INF = (1LL << 30); const int MOD = 1000000007; template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); } template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); } template <typename T> bool IN(T a, T b, T x) { return a <= x && x < b; } template <typename T> T ceil(T a, T b) { return a / b + !!(a % b); } template <class S, class T> ostream &operator<<(ostream &out, const pair<S, T> &a) { out << '(' << a.first << ',' << a.second << ')'; return out; } template <class T> ostream &operator<<(ostream &out, const vector<T> &a) { out << '['; REP(i, a.size()) { out << a[i]; if (i != a.size() - 1) out << ','; } out << ']'; return out; } int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tag_and_trait.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using btree = tree<PII, null_type, greater<PII>, rb_tree_tag, tree_order_statistics_node_update>; ll sc[100010]; signed main(void) { cin.tie(0); ios::sync_with_stdio(false); int n, c; cin >> n >> c; btree tr; FOR(i, 1, n) tr.insert({0, -i}); REP(i, c) { int type; cin >> type; if (type == 0) { ll t, p; cin >> t >> p; tr.erase({sc[t], -t}); sc[t] += p; tr.insert({sc[t], -t}); } else { ll m; cin >> m; m--; cout << -tr.find_by_order(m)->second << " " << tr.find_by_order(m)->first << endl; } } return 0; }
#define __USE_MINGW_ANSI_STDIO 0 #include <bits/stdc++.h> using namespace std; using ll = long long; // #define int ll using VI = vector<int>; using VVI = vector<VI>; using PII = pair<ll, ll>; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() #define PB push_back const ll LLINF = (1LL << 60); const int INF = (1LL << 30); const int MOD = 1000000007; template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); } template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); } template <typename T> bool IN(T a, T b, T x) { return a <= x && x < b; } template <typename T> T ceil(T a, T b) { return a / b + !!(a % b); } template <class S, class T> ostream &operator<<(ostream &out, const pair<S, T> &a) { out << '(' << a.first << ',' << a.second << ')'; return out; } template <class T> ostream &operator<<(ostream &out, const vector<T> &a) { out << '['; REP(i, a.size()) { out << a[i]; if (i != a.size() - 1) out << ','; } out << ']'; return out; } int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tag_and_trait.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using btree = tree<PII, null_type, greater<PII>, rb_tree_tag, tree_order_statistics_node_update>; ll sc[100010]; signed main(void) { cin.tie(0); ios::sync_with_stdio(false); int n, c; cin >> n >> c; btree tr; FOR(i, 1, n + 1) tr.insert({0, -i}); REP(i, c) { int type; cin >> type; if (type == 0) { ll t, p; cin >> t >> p; tr.erase({sc[t], -t}); sc[t] += p; tr.insert({sc[t], -t}); } else { ll m; cin >> m; m--; cout << -tr.find_by_order(m)->second << " " << tr.find_by_order(m)->first << endl; } } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
577
2
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner stdin = new Scanner(System.in); int a = stdin.nextInt(); int b = stdin.nextInt(); int c = stdin.nextInt(); int d = stdin.nextInt(); if (a == b && c == d) { System.out.println("Yes"); } else if (a == c && b == d) { System.out.println("Yes"); } else if (a == d && b == c) { System.out.println("yes"); } else { System.out.println("no"); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner stdin = new Scanner(System.in); int a = stdin.nextInt(); int b = stdin.nextInt(); int c = stdin.nextInt(); int d = stdin.nextInt(); if (a == b && c == d) { System.out.println("yes"); } else if (a == c && b == d) { System.out.println("yes"); } else if (a == d && b == c) { System.out.println("yes"); } else { System.out.println("no"); } } }
[["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491]]
3
156
4
#include <stdio.h> int main(void) { int e1, e2, e3, e4; scanf("%d %d %d %d", &e1, &e2, &e3, &e4); if ((e1 == e2 && e3 == e4) || (e1 == e3 && e2 == e4) || (e1 == e4 && e2 == e3)) printf("Yes\n"); else printf("No\n"); return 0; }
#include <stdio.h> int main(void) { int e1, e2, e3, e4; scanf("%d %d %d %d", &e1, &e2, &e3, &e4); if ((e1 == e2 && e3 == e4) || (e1 == e3 && e2 == e4) || (e1 == e4 && e2 == e3)) printf("yes\n"); else printf("no\n"); return 0; }
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
89
4
#include <iostream> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (a == b || c == d) { cout << "yes" << endl; } else if (a == c || b == d) { cout << "yes" << endl; } else if (a == d || b == c) { cout << "yes" << endl; } else cout << "no" << endl; cin >> c; }
#include <iostream> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (a == b && c == d) { cout << "yes" << endl; } else if (a == c && b == d) { cout << "yes" << endl; } else if (a == d && b == c) { cout << "yes" << endl; } else cout << "no" << endl; cin >> c; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98]]
1
106
6
#include <stdio.h> int main() { int e1, e2, e3, e4; scanf("%d%d%d%d", &e1, &e2, &e3, &e4); if (e1 == e2 && e3 == e4) printf("Yes\n"); else if (e1 == e3 && e2 == e4) printf("Yes\n"); else if (e1 == e4 && e2 == e3) printf("Yes\n"); else if (e1 == e2 == e3 == e4) printf("Yes\n"); else printf("No\n"); return 0; }
#include <stdio.h> int main() { int e1, e2, e3, e4; scanf("%d%d%d%d", &e1, &e2, &e3, &e4); if (e1 == e2 && e3 == e4) printf("yes\n"); else if (e1 == e3 && e2 == e4) printf("yes\n"); else if (e1 == e4 && e2 == e3) printf("yes\n"); else if (e1 == e2 == e3 == e4) printf("yes\n"); else printf("no\n"); return 0; }
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
123
10
#include <algorithm> #include <iostream> using namespace std; int main() { int a[4]; int i, j; for (i = 0; i < 4; i++) { cin >> a[i]; } for (i = 0; i < 4; i++) { for (j = 3; j > i; j--) { if (a[i] > a[i]) { swap(a[i], a[j]); } } } if (a[0] == a[1] && a[2] == a[3]) { cout << "yes" << endl; } else { cout << "no" << endl; } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int a[4]; int i, j; for (i = 0; i < 4; i++) { cin >> a[i]; } for (i = 0; i < 4; i++) { for (j = 3; j > i; j--) { if (a[i] > a[j]) { swap(a[i], a[j]); } } } if (a[0] == a[1] && a[2] == a[3]) { cout << "yes" << endl; } else { cout << "no" << endl; } return 0; }
[["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22]]
1
150
2
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (a == b) { if (c == d) { cout << "yes" << endl; } else { cout << "no" << endl; } } else if (a == c) { if (b == d) { cout << "yes" << endl; } else { cout << "no" << endl; } } else if (a == d) { if (c == d) { cout << "yes" << endl; } else { cout << "no" << endl; } } else { cout << "no" << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (a == b) { if (c == d) { cout << "yes" << endl; } else { cout << "no" << endl; } } else if (a == c) { if (b == d) { cout << "yes" << endl; } else { cout << "no" << endl; } } else if (a == d) { if (b == c) { cout << "yes" << endl; } else { cout << "no" << endl; } } else { cout << "no" << endl; } }
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
149
4
#include <bits/stdc++.h> #define mk make_pair using namespace std; int main() { set<pair<pair<int, int>, int>> t; int n, a[3], sum = 0; cin >> n; while (n--) { cin >> a[0] >> a[1] >> a[2]; sort(a, a + 3); if (!t.count(mk(mk(a[0], a[1]), a[2]))) sum++; t.insert(mk(mk(a[0], a[1]), a[2])); } cout << sum << endl; }
#include <bits/stdc++.h> #define mk make_pair using namespace std; int main() { set<pair<pair<int, int>, int>> t; int n, a[3], sum = 0; cin >> n; while (n--) { cin >> a[0] >> a[1] >> a[2]; sort(a, a + 3); if (t.count(mk(mk(a[0], a[1]), a[2]))) sum++; t.insert(mk(mk(a[0], a[1]), a[2])); } cout << sum << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111]]
1
144
1
#include <algorithm> #include <iostream> #include <map> using namespace std; int main() { map<int, bool> memo; int N; cin >> N; int cnt = 0; for (int i = 0; i < N; i++) { int p[3]; cin >> p[0] >> p[1] >> p[2]; sort(p, p + 3); int k = ((p[0] - 1) * 1000 + (p[1] - 1) * 1000 + (p[2] - 1)); if (memo.find(k) != memo.end()) { cnt++; } else { memo[k] = true; } } cout << cnt << endl; return 0; }
#include <algorithm> #include <iostream> #include <map> using namespace std; int main() { map<int, bool> memo; int N; cin >> N; int cnt = 0; for (int i = 0; i < N; i++) { int p[3]; cin >> p[0] >> p[1] >> p[2]; sort(p, p + 3); int k = ((p[0] - 1) * 1000 + (p[1] - 1)) * 1000 + (p[2] - 1); if (memo.find(k) != memo.end()) { cnt++; } else { memo[k] = true; } } cout << cnt << endl; return 0; }
[["+", 49, 50, 51, 16, 31, 16, 31, 23, 0, 25], ["-", 49, 50, 51, 23, 0, 16, 12, 23, 0, 25]]
1
159
2
#include <algorithm> #include <iostream> using namespace std; int main() { int N; cin >> N; int p[N][3]; for (int i = 0; i < N; i++) { int ii[3]; for (int j = 0; j < 3; j++) { cin >> ii[j]; } sort(ii, ii + 3); for (int j = 0; j < 3; j++) { p[i][j] = ii[j]; } } bool er[N]; for (int i = 0; i < N; i++) { er[i] = false; } int sum = 0; for (int i = 0; i < N; i++) { if (er[i]) continue; for (int j = i + 1; j < N; j++) { bool ers = true; if (er[j]) break; for (int k = 0; k < 3; k++) { if (p[i][k] != p[j][k]) { ers = false; break; } } if (ers) { er[j] = true; sum++; } } } cout << sum << endl; }
#include <algorithm> #include <iostream> using namespace std; int main() { int N; cin >> N; int p[N][3]; for (int i = 0; i < N; i++) { int ii[3]; for (int j = 0; j < 3; j++) { cin >> ii[j]; } sort(ii, ii + 3); for (int j = 0; j < 3; j++) { p[i][j] = ii[j]; } } bool er[N]; for (int i = 0; i < N; i++) { er[i] = false; } int sum = 0; for (int i = 0; i < N; i++) { if (er[i]) continue; for (int j = i + 1; j < N; j++) { bool ers = true; if (er[j]) continue; for (int k = 0; k < 3; k++) { if (p[i][k] != p[j][k]) { ers = false; break; } } if (ers) { er[j] = true; sum++; } } } cout << sum << endl; }
[["-", 0, 7, 8, 9, 0, 57, 64, 93, 0, 94], ["+", 0, 7, 8, 9, 0, 57, 64, 116, 0, 117]]
1
268
2
#include "bits/stdc++.h" using namespace std; int main() { int N; cin >> N; set<vector<int>> points; for (int i = 0; i < N; ++i) { vector<int> v(3); for (int i = 0; i < 3; ++i) cin >> v[i]; sort(v.begin(), v.end()); points.emplace(v); } cout << points.size() << endl; return 0; }
#include "bits/stdc++.h" using namespace std; int main() { int N; cin >> N; set<vector<int>> points; for (int i = 0; i < N; ++i) { vector<int> v(3); for (int i = 0; i < 3; ++i) cin >> v[i]; sort(v.begin(), v.end()); points.emplace(v); } cout << N - points.size() << endl; return 0; }
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]]
1
111
2
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define rep(i, j, k) for (int i = (int)j; i < (int)k; i++) #define itrep(i, x) for (auto i = (x).begin(); i != (x).end(); i++) #define Sort(x) sort((x).begin(), (x).end()) #define all(x) (x).begin(), (x).end() #define fi first #define se second #define vec vector #define INF (int)1e9 #define INFL 1e18 #define MOD 1000000007 #define pb push_back #define MP make_pair #define PI 3.1415926535 typedef long long int ll; typedef std::pair<int, int> P; int D = 1; int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0}; using namespace std; int main() { int n; cin >> n; set<int> st; rep(i, 0, n) { int a, b, c; cin >> a >> b >> c; st.insert(a * a + b * b + c * c); } cout << n - st.size() << endl; return 0; }
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define rep(i, j, k) for (int i = (int)j; i < (int)k; i++) #define itrep(i, x) for (auto i = (x).begin(); i != (x).end(); i++) #define Sort(x) sort((x).begin(), (x).end()) #define all(x) (x).begin(), (x).end() #define fi first #define se second #define vec vector #define INF (int)1e9 #define INFL 1e18 #define MOD 1000000007 #define pb push_back #define MP make_pair #define PI 3.1415926535 typedef long long int ll; typedef std::pair<int, int> P; int D = 1; int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0}; using namespace std; int main() { int n; cin >> n; set<int> st; rep(i, 0, n) { int a, b, c; cin >> a >> b >> c; st.insert(a * a * a + b * b * b + c * c * c); } cout << n - st.size() << endl; return 0; }
[["+", 3, 4, 0, 16, 31, 16, 31, 16, 17, 48], ["+", 3, 4, 0, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 31, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 17, 48], ["+", 3, 4, 0, 16, 12, 16, 31, 16, 31, 22], ["+", 3, 4, 0, 16, 12, 16, 31, 16, 17, 48]]
1
213
6
# encoding: 'utf-8' N = int(input()) ls = list() for _ in range(N): e = sorted([int(x) for x in split(input())]) if e in ls: continue else: ls.append(e) print(N - len(ls))
# encoding: 'utf-8' N = int(input()) ls = list() for _ in range(N): e = sorted([int(x) for x in input().split()]) if e in ls: continue else: ls.append(e) print(N - len(ls))
[["-", 3, 4, 0, 658, 0, 659, 12, 652, 63, 22], ["-", 0, 658, 0, 659, 12, 652, 3, 4, 0, 24], ["+", 0, 658, 0, 659, 12, 652, 63, 319, 0, 131], ["+", 0, 658, 0, 659, 12, 652, 63, 319, 319, 22], ["+", 0, 658, 0, 659, 12, 652, 3, 4, 0, 24]]
5
65
5
#include <bits/stdc++.h> using namespace std; using i64 = long long; #define rep(i, s, e) for (int(i) = (s); (i) <= (e); (i)++) #define all(x) x.begin(), x.end() int N; vector<int> p; int calc() { int cnt = 0; vector<int> P = p; for (int i = 0; i < N - 1; i++) { cnt += P[i]; P[i + 1] = max(0, P[i + 1] - P[i]); } return cnt * 2 + P[N - 1]; } int main() { cin >> N; p.resize(N); rep(i, 0, N - 1) cin >> p[i]; int ans = calc(); int before = p[0]; rep(i, 0, p[0]) { p[0] = i; ans = min(ans, calc() + before - i); } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; using i64 = long long; #define rep(i, s, e) for (int(i) = (s); (i) <= (e); (i)++) #define all(x) x.begin(), x.end() int N; vector<int> p; int calc() { int cnt = 0; vector<int> P = p; for (int i = 0; i < N - 1; i++) { cnt += P[i]; P[i + 1] = max(0, P[i + 1] - P[i]); } return cnt * 2 + P[N - 1]; } int main() { cin >> N; p.resize(N); rep(i, 0, N - 1) cin >> p[i]; int ans = calc(); int before = p[0]; rep(i, 0, before) { p[0] = i; ans = min(ans, calc() + before - i); } cout << ans << endl; }
[["-", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
209
5
#include <bits/stdc++.h> using namespace std; #define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) (a).begin(), (a).end() int main(void) { int n; cin >> n; vector<int> p(n); REP(i, n) cin >> p[i]; if (n == 1) { cout << p[0] << endl; return 0; } if (n == 2) { cout << max(p[0], p[1]) * 2 << endl; return 0; } int cnt[4] = {0}; // 単独3 vector<int> tmp = p; cnt[0] += 3; FOR(i, 1, n - 1) { while (tmp[i] > 0) { tmp[i]--; tmp[i + 1]--; cnt[0] += 2; } } if (tmp[n - 1] > 0) { tmp[n - 1]--; cnt[0]++; } // 単独2 tmp = p; tmp[0] -= 2; cnt[1] += 2; REP(i, n - 1) { while (tmp[i] > 0) { tmp[i]--; tmp[i + 1]--; cnt[1] += 2; } } if (tmp[n - 1] > 0) { tmp[n - 1]--; cnt[1]++; } // 単独1 tmp = p; tmp[0]--; cnt[2]++; REP(i, n - 1) { while (tmp[i] > 0) { tmp[i]--; tmp[i + 1]--; cnt[2] += 2; } } if (tmp[n - 1] > 0) { tmp[n - 1]--; cnt[2]++; } // 単独0 tmp = p; REP(i, n - 1) { while (tmp[i] > 0) { tmp[i]--; tmp[i + 1]--; cnt[3] += 2; } } if (tmp[n - 1] > 0) { tmp[n - 1]--; cnt[3]++; } cout << min(min(cnt[0], cnt[1]), min(cnt[2], cnt[3])) << endl; }
#include <bits/stdc++.h> using namespace std; #define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) (a).begin(), (a).end() int main(void) { int n; cin >> n; vector<int> p(n); REP(i, n) cin >> p[i]; if (n == 1) { cout << p[0] << endl; return 0; } if (n == 2) { cout << max(p[0], p[1]) * 2 << endl; return 0; } int cnt[4] = {0}; // 単独3 vector<int> tmp = p; cnt[0] += 3; FOR(i, 1, n - 1) { while (tmp[i] > 0) { tmp[i]--; tmp[i + 1]--; cnt[0] += 2; } } while (tmp[n - 1] > 0) { tmp[n - 1]--; cnt[0]++; } // 単独2 tmp = p; tmp[0] -= 2; cnt[1] += 2; REP(i, n - 1) { while (tmp[i] > 0) { tmp[i]--; tmp[i + 1]--; cnt[1] += 2; } } while (tmp[n - 1] > 0) { tmp[n - 1]--; cnt[1]++; } // 単独1 tmp = p; tmp[0]--; cnt[2]++; REP(i, n - 1) { while (tmp[i] > 0) { tmp[i]--; tmp[i + 1]--; cnt[2] += 2; } } while (tmp[n - 1] > 0) { tmp[n - 1]--; cnt[2]++; } // 単独0 tmp = p; REP(i, n - 1) { while (tmp[i] > 0) { tmp[i]--; tmp[i + 1]--; cnt[3] += 2; } } while (tmp[n - 1] > 0) { tmp[n - 1]--; cnt[3]++; } cout << min(min(cnt[0], cnt[1]), min(cnt[2], cnt[3])) << endl; }
[["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89]]
1
499
8
#include <bits/stdc++.h> using namespace std; int solve(vector<int> a) { int size = a.size(); int cnt = 0; for (int i = 0; i + 1 < size; i++) { cnt += a[i] * 2; a[i + 1] = max(0, a[i + 1] - a[i]); } return cnt + a[size - 1]; } int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int ans = 1e9; for (int i = 0; i <= a[0]; i++) { ans = min(ans, solve(a) + i); a[0] = max(0, a[0] - 1); } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int solve(vector<int> a) { int size = a.size(); int cnt = 0; for (int i = 0; i + 1 < size; i++) { cnt += a[i] * 2; a[i + 1] = max(0, a[i + 1] - a[i]); } return cnt + a[size - 1]; } int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int ans = 1e9; for (int i = 0; i <= 3; i++) { ans = min(ans, solve(a) + i); a[0] = max(0, a[0] - 1); } cout << ans << endl; return 0; }
[["-", 8, 9, 0, 7, 15, 16, 12, 69, 28, 22], ["-", 0, 7, 15, 16, 12, 69, 341, 342, 0, 70], ["-", 0, 7, 15, 16, 12, 69, 341, 342, 0, 13], ["-", 0, 7, 15, 16, 12, 69, 341, 342, 0, 73], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
201
5
#include <iostream> using namespace std; int main() { int n, p[5000], now[5000], i, result = 0, log = 0; cin >> n; for (i = 0; i < n; i++) cin >> p[i]; for (i = 0; i <= now[0]; i++) { log = 0; for (int j = 0; j < n; j++) now[j] = p[j]; now[0] -= i; log += i; for (int j = 0; j < n - 1; j++) { log += now[j] * 2; now[j + 1] -= now[j]; now[j] = 0; if (now[j + 1] < 0) now[j + 1] = 0; } log += now[n - 1]; result = max(result, log); } cout << result << endl; return 0; }
#include <iostream> using namespace std; int main() { int n, p[5000], now[5000], i, result = 10000000, log = 0; cin >> n; for (i = 0; i < n; i++) cin >> p[i]; for (i = 0; i <= p[0]; i++) { log = 0; for (int j = 0; j < n; j++) now[j] = p[j]; now[0] -= i; log += i; for (int j = 0; j < n - 1; j++) { log += now[j] * 2; now[j + 1] -= now[j]; now[j] = 0; if (now[j + 1] < 0) now[j + 1] = 0; } log += now[n - 1]; result = min(result, log); } cout << result << endl; return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 69, 28, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 69, 28, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22]]
1
209
6
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int n, ans = 1e9; cin >> n; int a[n], b[n]; r(i, n) cin >> a[i]; r(i, n) b[i] = a[i]; r(j, 4) { int s1 = 0; r(i, n) a[i] = b[i]; a[0]--; for (int i = 0; i < n - 1; i++) { if (a[i] <= 0) continue; s1 += a[i] * 2; a[i + 1] -= a[i]; } if (a[n - 1] < 0) a[n - 1] = 0; ans = min(ans, s1 + a[n - 1] + j); } cout << ans << endl; }
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int n, ans = 1e9; cin >> n; int a[n], b[n]; r(i, n) cin >> a[i]; r(i, n) b[i] = a[i]; r(j, 4) { int s1 = 0; r(i, n) a[i] = b[i]; a[0] -= j; for (int i = 0; i < n - 1; i++) { if (a[i] <= 0) continue; s1 += a[i] * 2; a[i + 1] -= a[i]; } if (a[n - 1] < 0) a[n - 1] = 0; ans = min(ans, s1 + a[n - 1] + j); } cout << ans << endl; }
[["-", 8, 9, 0, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 17, 110], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 12, 22]]
1
202
3
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; // math //------------------------------------------- template <class T> inline T sqr(T x) { return x * x; } // typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long ll; // container util //------------------------------------------ #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define UNIQUE(a) (a).erase(unique((a).begin(), (a).end()), (a).end()) #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); ++i) #define EXIST(s, e) ((s).find(e) != (s).end()) #define SORT(c) sort((c).begin(), (c).end()) // repetition //------------------------------------------ #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) // clear memory #define CLR(a) memset((a), 0, sizeof(a)) // debug #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) \ cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \ << " " << __FILE__ << endl; int n, a[5000], b[5000]; // O(N log N) int main() { cin >> n; REP(i, n) cin >> b[i]; int ans = 1e6; REP(i, a[0] + 1) { memcpy(a, b, sizeof(b)); a[0] -= i; int t = i; REP(j, n - 1) { if (a[j] < 1) continue; t += a[j] * 2; a[j + 1] -= a[j]; } t += max(0, a[n - 1]); ans = min(ans, t); } cout << ans << endl; return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; // math //------------------------------------------- template <class T> inline T sqr(T x) { return x * x; } // typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long ll; // container util //------------------------------------------ #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define UNIQUE(a) (a).erase(unique((a).begin(), (a).end()), (a).end()) #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); ++i) #define EXIST(s, e) ((s).find(e) != (s).end()) #define SORT(c) sort((c).begin(), (c).end()) // repetition //------------------------------------------ #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) // clear memory #define CLR(a) memset((a), 0, sizeof(a)) // debug #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) \ cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \ << " " << __FILE__ << endl; int n, a[5000], b[5000]; // O(N log N) int main() { cin >> n; REP(i, n) cin >> b[i]; int ans = 1e6; REP(i, b[0] + 1) { memcpy(a, b, sizeof(b)); a[0] -= i; int t = i; REP(j, n - 1) { if (a[j] < 1) continue; t += a[j] * 2; a[j + 1] -= a[j]; } t += max(0, a[n - 1]); ans = min(ans, t); } cout << ans << endl; return 0; }
[["-", 0, 2, 3, 4, 0, 16, 31, 69, 28, 22], ["+", 0, 2, 3, 4, 0, 16, 31, 69, 28, 22]]
1
334
2
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; int p[5000]; for (int i = 0; i < n; i++) { cin >> p[i]; } int min_sum = 20000; for (int i = 0; i <= p[0]; i++) { int q[5000]; for (int j = 0; j < n; j++) { q[j] = p[j]; } int sum = i; q[0] -= i; for (int j = 0; j <= n - 2; j++) { if (q[j] <= 0) continue; sum += q[i] * 2; q[j + 1] -= q[j]; } if (q[n - 1] > 0) { sum += q[n - 1]; } min_sum = min(min_sum, sum); } cout << min_sum << endl; return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; int p[5000]; for (int i = 0; i < n; i++) { cin >> p[i]; } int min_sum = 20000; for (int i = 0; i <= p[0]; i++) { int q[5000]; for (int j = 0; j < n; j++) { q[j] = p[j]; } int sum = i; q[0] -= i; for (int j = 0; j <= n - 2; j++) { if (q[j] <= 0) continue; sum += q[j] * 2; q[j + 1] -= q[j]; } if (q[n - 1] > 0) { sum += q[n - 1]; } min_sum = min(min_sum, sum); } cout << min_sum << endl; return 0; }
[["-", 0, 11, 12, 16, 31, 69, 341, 342, 0, 22], ["+", 0, 11, 12, 16, 31, 69, 341, 342, 0, 22]]
1
208
2
#include <algorithm> #include <cstdio> #include <functional> #define M 2000000000 using namespace std; int main(void) { int n, i, j, sum, p[5000], a[5000], mn; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &p[i]); mn = M; for (i = 0; i <= p[0]; i++) { for (j = 0; j < n; j++) a[j] = p[j]; a[0] = a[0] - i; sum = i; for (j = 0; j < n - 1; j++) { if (a[j] > 0) { a[j + 1] -= a[j]; sum += a[j] * 2; a[j] = 0; } } if (a[n - 1] > 0) sum += a[n - 1]; mn = min(mn, sum); } printf("%D\n", mn); return 0; }
#include <algorithm> #include <cstdio> #include <functional> #define M 2000000000 using namespace std; int main(void) { int n, i, j, sum, p[5000], a[5000], mn; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &p[i]); mn = M; for (i = 0; i <= p[0]; i++) { for (j = 0; j < n; j++) a[j] = p[j]; a[0] = a[0] - i; sum = i; for (j = 0; j < n - 1; j++) { if (a[j] > 0) { a[j + 1] -= a[j]; sum += a[j] * 2; a[j] = 0; } } if (a[n - 1] > 0) sum += a[n - 1]; mn = min(mn, sum); } printf("%d\n", mn); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
236
2
#include <bits/stdc++.h> using namespace std; //#define int long long #define FOR(i, j, k) for (int i = j; i < (int)k; ++i) #define rep(i, j) FOR(i, 0, j) #define INF (1 << 30) typedef unsigned long long ull; typedef pair<int, int> P; typedef pair<P, int> Pi; const int MOD = 1e9 + 7; const int dy[] = {0, 0, 1, -1}; const int dx[] = {1, -1, 0, 0}; template <class T> void chmin(T &a, const T &b) { a = min(a, b); } template <class T> void chmax(T &a, const T &b) { a = max(a, b); } template <typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); } template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } int p[5000]; int tmp[5000]; signed main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; rep(i, n) cin >> p[i]; int res = INF; rep(i, p[0] + 1) { int cnt = i; memset(tmp, 0, sizeof(tmp)); tmp[0] = i; FOR(j, 1, n) { cnt += (p[j - 1] - tmp[j - 1]) * 2; tmp[j] += p[j - 1] - tmp[j - 1]; chmin(tmp[i], p[i]); } cnt += p[n - 1] - tmp[n - 1]; chmin(res, cnt); } cout << res << endl; return 0; }
#include <bits/stdc++.h> using namespace std; //#define int long long #define FOR(i, j, k) for (int i = j; i < (int)k; ++i) #define rep(i, j) FOR(i, 0, j) #define INF (1 << 30) typedef unsigned long long ull; typedef pair<int, int> P; typedef pair<P, int> Pi; const int MOD = 1e9 + 7; const int dy[] = {0, 0, 1, -1}; const int dx[] = {1, -1, 0, 0}; template <class T> void chmin(T &a, const T &b) { a = min(a, b); } template <class T> void chmax(T &a, const T &b) { a = max(a, b); } template <typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); } template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } int p[5000]; int tmp[5000]; signed main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; rep(i, n) cin >> p[i]; int res = INF; rep(i, p[0] + 1) { int cnt = i; memset(tmp, 0, sizeof(tmp)); tmp[0] = i; FOR(j, 1, n) { cnt += (p[j - 1] - tmp[j - 1]) * 2; tmp[j] += p[j - 1] - tmp[j - 1]; chmin(tmp[j], p[j]); } cnt += p[n - 1] - tmp[n - 1]; chmin(res, cnt); } cout << res << endl; return 0; }
[["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 22]]
1
401
4
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define pb push_back #define rep(i, a, n) for (int i = (a); i < (n); i++) #define dep(i, a, n) for (int i = (a); i >= (n); i--) #define mod 1e9 + 7 __attribute__((constructor)) void initial() { cin.tie(0); ios::sync_with_stdio(false); } int n; int solve(int p[]) { int ans = 0; int sum = 0; rep(i, 0, n) { if (i == n - 1) { if (p[i] > 0) ans += p[i] - sum; break; } if (p[i] > 0) { ans += (p[i] - sum) * 2; sum = p[i] - sum; } else sum = 0; } return ans; } int main() { int p[5000] = {}; cin >> n; rep(i, 0, n) cin >> p[i]; int ans = INT_MAX; int k = p[0] + 1; rep(i, 0, k) { ans = min(ans, solve(p) + i); p[0]--; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define pb push_back #define rep(i, a, n) for (int i = (a); i < (n); i++) #define dep(i, a, n) for (int i = (a); i >= (n); i--) #define mod 1e9 + 7 __attribute__((constructor)) void initial() { cin.tie(0); ios::sync_with_stdio(false); } int n; int solve(int p[]) { int ans = 0; int sum = 0; rep(i, 0, n) { if (i == n - 1) { if (p[i] - sum > 0) ans += p[i] - sum; break; } if (p[i] - sum > 0) { ans += (p[i] - sum) * 2; sum = p[i] - sum; } else sum = 0; } return ans; } int main() { int p[5000] = {}; cin >> n; rep(i, 0, n) cin >> p[i]; int ans = INT_MAX; int k = p[0] + 1; rep(i, 0, k) { ans = min(ans, solve(p) + i); p[0]--; } cout << ans << endl; }
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22]]
1
264
4
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <typeinfo> #include <vector> #define syosu(x) fixed << setprecision(x) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; typedef pair<double, double> pdd; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<char> vc; typedef vector<vc> vvc; typedef vector<string> vs; typedef vector<bool> vb; typedef vector<vb> vvb; typedef vector<P> vp; typedef vector<vp> vvp; typedef vector<pll> vpll; typedef pair<int, P> pip; typedef vector<pip> vip; const int inf = 1 << 29; const ll INF = 1ll << 60; const double pi = acos(-1); const double eps = 1e-7; const ll mod = 1e9 + 7; const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; int n; vi a; int f(int x) { int res = x; vi b = a; b[0] = max(b[0] - x, 0); for (int i = 1; i < n; i++) { res += 2 * b[i - 1]; b[i] = max(b[i] - b[i - 1], 0); } return res + b[n - 1]; } int main() { cin >> n; a = vi(n); for (int i = 0; i < n; i++) cin >> a[i]; cout << min({f(0), f(1), f(2)}) << endl; }
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <typeinfo> #include <vector> #define syosu(x) fixed << setprecision(x) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; typedef pair<double, double> pdd; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<char> vc; typedef vector<vc> vvc; typedef vector<string> vs; typedef vector<bool> vb; typedef vector<vb> vvb; typedef vector<P> vp; typedef vector<vp> vvp; typedef vector<pll> vpll; typedef pair<int, P> pip; typedef vector<pip> vip; const int inf = 1 << 29; const ll INF = 1ll << 60; const double pi = acos(-1); const double eps = 1e-7; const ll mod = 1e9 + 7; const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; int n; vi a; int f(int x) { int res = x; vi b = a; b[0] = max(b[0] - x, 0); for (int i = 1; i < n; i++) { res += 2 * b[i - 1]; b[i] = max(b[i] - b[i - 1], 0); } return res + b[n - 1]; } int main() { cin >> n; a = vi(n); for (int i = 0; i < n; i++) cin >> a[i]; cout << min({f(0), f(1), f(2), f(3)}) << endl; }
[["+", 31, 16, 12, 2, 3, 4, 0, 83, 0, 21], ["+", 12, 2, 3, 4, 0, 83, 0, 2, 63, 22], ["+", 3, 4, 0, 83, 0, 2, 3, 4, 0, 24], ["+", 3, 4, 0, 83, 0, 2, 3, 4, 0, 13], ["+", 3, 4, 0, 83, 0, 2, 3, 4, 0, 25]]
1
429
5
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define pb push_back #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, a, n) for (int i = a; i < (n); i++) #define mod (ll)(1e9 + 7) #define int ll #define INF 100000000 __attribute__((constructor)) void initial() { cin.tie(0); ios::sync_with_stdio(false); } signed main() { ll n, result = INF, sum = 0; ll p[5005], q[5005]; cin >> n; rep(i, n) cin >> p[i]; rep(i, p[0] + 1) { rep(j, n) q[j] = p[j]; q[0] -= i; ll b = i; rep(j, n - 1) { if (q[j] > 0) { q[j + 1] -= q[j]; sum += q[j] * 2; q[j] = 0; } } if (q[n - 1] > 0) sum += q[n - 1]; result = min(result, sum); } cout << result << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define pb push_back #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, a, n) for (int i = a; i < (n); i++) #define mod (ll)(1e9 + 7) #define int ll #define INF 100000000 __attribute__((constructor)) void initial() { cin.tie(0); ios::sync_with_stdio(false); } signed main() { ll n, result = INF; ll p[5005], q[5005]; cin >> n; rep(i, n) cin >> p[i]; rep(i, p[0] + 1) { rep(j, n) q[j] = p[j]; q[0] -= i; ll sum = i; rep(j, n - 1) { if (q[j] > 0) { q[j + 1] -= q[j]; sum += q[j] * 2; q[j] = 0; } } if (q[n - 1] > 0) sum += q[n - 1]; result = min(result, sum); } cout << result << endl; return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 9, 0, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 9, 0, 43, 49, 50, 49, 22]]
1
252
6
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int A, B; string a, b; cin >> a >> b; A = a.size(); B = b.size(); vector<vector<ll>> dp(B, vector<ll>(A)); constexpr ll MOD = ((1e9) + 7); for (int i = 0; i < B; i++) { for (int j = 0; j < A; j++) { if (i > 0) dp[i][j + 1] += dp[i][j]; if (b[i] == a[j]) { dp[i + 1][j + 1] += (dp[i][j] + (i == 0)); dp[i + 1][j + 1] %= MOD; } } } ll res = 0; for (int i = 0; i <= A; i++) { res += dp[B][i]; res %= MOD; } cout << res << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int A, B; string a, b; cin >> a >> b; A = a.size(); B = b.size(); vector<vector<ll>> dp(B + 1, vector<ll>(A + 1)); constexpr ll MOD = ((1e9) + 7); for (int i = 0; i < B; i++) { for (int j = 0; j < A; j++) { if (i > 0) dp[i][j + 1] += dp[i][j]; if (b[i] == a[j]) { dp[i + 1][j + 1] += (dp[i][j] + (i == 0)); dp[i + 1][j + 1] %= MOD; } } } ll res = 0; for (int i = 0; i <= A; i++) { res += dp[B][i]; res %= MOD; } cout << res << endl; return 0; }
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 51, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 51, 4, 0, 2, 3, 4, 0, 16, 12, 13]]
1
238
4
#include <iostream> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) int dp[1001]; int main() { string s, t; cin >> s >> t; dp[0] = 1; REP(i, s.size()) REP(_j, t.size()) { int j = t.size() - _j; // reverse j if (s[i] == t[j]) { dp[j + 1] += dp[j]; dp[j + 1] %= int(1e9) + 7; } } cout << dp[t.size()] << endl; return 0; }
#include <iostream> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) int dp[1001]; int main() { string s, t; cin >> s >> t; dp[0] = 1; REP(i, s.size()) REP(_j, t.size()) { int j = t.size() - 1 - _j; // j?????????????????? if (s[i] == t[j]) { dp[j + 1] += dp[j]; dp[j + 1] %= int(1e9) + 7; } } cout << dp[t.size()] << endl; return 0; }
[["+", 0, 43, 49, 50, 51, 16, 31, 16, 12, 13], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 17, 33]]
1
146
2
a,b = map(int,input()) print((a+b)//2)
a,b = map(int,input().split()) print((a+b)//2)
[["+", 12, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 12, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
22
4
print(sum(map(int,input().split()))/2)
print(int(sum(map(int,input().split()))/2))
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
20
3
a,b=map(int,input().split()) print((a+b)/2)
a,b=map(int,input().split()) print((a+b)//2)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 85], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 676]]
5
26
2
# coding=utf-8 a, b = map(int, input().split()) print((a+b)/2)
# coding=utf-8 a, b = map(int, input().split()) print((a+b)//2)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 85], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 676]]
5
27
2
#include <stdio.h> int main(void) { int m, f, b, kari; scanf("%d %d %d", &m, &f, &b); if (m >= b) { printf("0\n"); } else if (m + f <= b) { printf("NA\n"); } else { kari = b - m; printf("%d\n", kari); } return 0; }
#include <stdio.h> int main(void) { int m, f, b, kari; scanf("%d %d %d", &m, &f, &b); if (m >= b) { printf("0\n"); } else if (m + f < b) { printf("NA\n"); } else { kari = b - m; printf("%d\n", kari); } return 0; }
[["-", 75, 76, 0, 57, 15, 23, 0, 16, 17, 19], ["+", 75, 76, 0, 57, 15, 23, 0, 16, 17, 18]]
0
91
2
#include <stdio.h> int main(void) { int m, f, b; int sum; scanf("%d %d %d", &m, &f, &b); sum = b - m; if (m > b) { printf("0\n"); } else if (sum >= f) { printf("NA\n"); } else if (sum < f) { printf("%d\n", sum); } return 0; }
#include <stdio.h> int main(void) { int m, f, b; int sum; scanf("%d %d %d", &m, &f, &b); sum = b - m; if (m > b) { printf("0\n"); } else if (sum > f) { printf("NA\n"); } else if (sum <= f) { printf("%d\n", sum); } return 0; }
[["-", 75, 76, 0, 57, 15, 23, 0, 16, 17, 20], ["+", 75, 76, 0, 57, 15, 23, 0, 16, 17, 47], ["-", 75, 76, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 23, 0, 16, 17, 19]]
0
96
4
a, b, c, d = sorted(map(int, input().split())) print("YES" if a == b and c == d else "NO")
a, b, c, d = sorted(map(int, input().split())) print("yes" if a == b and c == d else "no")
[["-", 0, 652, 3, 4, 0, 41, 0, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 41, 0, 557, 0, 6]]
5
41
4
lst=list(input().split()) if lst[0]==lst[1] and lst[2]==lst[3]: print('yes') else: print('no')
lst=list(input().split()) lst.sort() if lst[0]==lst[1] and lst[2]==lst[3]: print('yes') else: print('no')
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
47
5
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var arr = input.trim().split(" ").map(Number); arr.sort(function(a, b) { return a < b; }); var sum = 0; if (arr[0] == arr[1] && arr[1] == arr[2] && arr[2] == arr[3]) sum++; if (arr[0 + 4] == arr[1 + 4] && arr[1 + 4] == arr[2 + 4] && arr[2 + 4] == arr[3 + 4]) sum++; if (arr[0 + 8] == arr[1 + 8] && arr[1 + 8] == arr[2 + 8] && arr[2 + 8] == arr[3 + 8]) sum++; console.log((sum == 3) ? "yes" : "no");
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var arr = input.trim().split(" ").map(Number); arr.sort(function(a, b) { return a - b; }); var sum = 0; if (arr[0] == arr[1] && arr[1] == arr[2] && arr[2] == arr[3]) sum++; if (arr[0 + 4] == arr[1 + 4] && arr[1 + 4] == arr[2 + 4] && arr[2 + 4] == arr[3 + 4]) sum++; if (arr[0 + 8] == arr[1 + 8] && arr[1 + 8] == arr[2 + 8] && arr[2 + 8] == arr[3 + 8]) sum++; console.log((sum == 3) ? "yes" : "no");
[["-", 0, 63, 8, 556, 0, 37, 0, 16, 17, 18], ["+", 0, 63, 8, 556, 0, 37, 0, 16, 17, 33]]
2
214
2
#include <stdio.h> int main(void) { int i, e[128] = {0}, r = 0, m; for (i = 1; i <= 12; i++) { scanf("%d", &m); e[m]++; } for (i = 1; i <= 100; i++) { if (e[m] % 4 == 0) { r += (e[m] / 4); } } if (r == 3) { printf("yes\n"); } else { printf("no\n"); } return 0; }
#include <stdio.h> int main(void) { int i, e[128] = {0}, r = 0, m; for (i = 1; i <= 12; i++) { scanf("%d", &m); e[m]++; } for (i = 1; i <= 100; i++) { if (e[i] % 4 == 0) { r += (e[i] / 4); } } if (r == 3) { printf("yes\n"); } else { printf("no\n"); } return 0; }
[["-", 15, 23, 0, 16, 31, 16, 31, 69, 71, 22], ["+", 15, 23, 0, 16, 31, 16, 31, 69, 71, 22], ["-", 0, 11, 12, 23, 0, 16, 31, 69, 71, 22], ["+", 0, 11, 12, 23, 0, 16, 31, 69, 71, 22]]
0
127
4
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { map<int, int> mp; rep(i, 4) { int e; cin >> e; mp[e]++; } for (auto p : mp) { if (p.second < 4) { puts("no"); return 0; } } puts("yes"); }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { map<int, int> mp; rep(i, 12) { int e; cin >> e; mp[e]++; } for (auto p : mp) { if (p.second < 4) { puts("no"); return 0; } } puts("yes"); }
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
86
2
e = list(map(int, input().split())) print("yes" if len(set(e[:4])) == len(set(e[4:8])) == len(set(e[8:])) == 1 else "no")
e = sorted(map(int, input().split())) print("yes" if len(set(e[:4])) == len(set(e[4:8])) == len(set(e[8:])) == 1 else "no")
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
66
2
/* AOJ #0347 title: @kankichi573 */ #include <float.h> #include <stdio.h> #include <stdlib.h> double max(double x, double y) { if (x > y) return (x); else return (y); } int n, ar[1000]; int comp(const void *a, const void *b) { if (*(int *)a < *(int *)b) { return -1; } else if (*(int *)a == *(int *)b) { return 0; } return 1; } int main() { int i, m2; double ret; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &ar[i]); qsort(ar, n, sizeof(int), comp); ret = 0.0; m2 = ar[n - 2] + ar[n - 1]; for (i = 0; i < n - 2; i++) ret = max(ret, (double)m2 / (ar[i + 1] - ar[i])); ret = max(ret, (ar[n - 1] + ar[n - 4]) / (ar[n - 2] - ar[n - 3])); ret = max(ret, (ar[n - 3] + ar[n - 4]) / (ar[n - 2] - ar[n - 1])); printf("%lf\n", ret); return (0); }
/* AOJ #0347 title: @kankichi573 */ #include <float.h> #include <stdio.h> #include <stdlib.h> double max(double x, double y) { if (x > y) return (x); else return (y); } int n, ar[1000]; int comp(const void *a, const void *b) { if (*(int *)a < *(int *)b) { return -1; } else if (*(int *)a == *(int *)b) { return 0; } return 1; } int main() { int i, m2; double ret; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &ar[i]); qsort(ar, n, sizeof(int), comp); ret = 0.0; m2 = ar[n - 2] + ar[n - 1]; for (i = 0; i < n - 3; i++) ret = max(ret, (double)m2 / (ar[i + 1] - ar[i])); ret = max(ret, (ar[n - 1] + ar[n - 4]) / (ar[n - 2] - ar[n - 3])); ret = max(ret, (ar[n - 3] + ar[n - 4]) / (ar[n - 1] - ar[n - 2])); printf("%lf\n", ret); return (0); }
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 12, 23, 0, 16, 31, 69, 71, 16, 12, 13], ["+", 12, 23, 0, 16, 31, 69, 71, 16, 12, 13], ["-", 12, 23, 0, 16, 12, 69, 71, 16, 12, 13], ["+", 12, 23, 0, 16, 12, 69, 71, 16, 12, 13]]
0
322
6
#include <bits/stdc++.h> using namespace std; long long a[1001], i, ma = 100000, p, n; long double m1, m2; int main() { cin >> n; for (; i < n; i++) cin >> a[i]; sort(a, a + n); m1 = (double)(a[n - 1] + a[n - 2]) / (a[1] - a[0]); for (i = n - 1; i > 0; i--) if (a[i] - a[i - 1] <= ma) { ma = a[i] - a[i - 1]; p = i; cout << ma; } for (i = n - 1; i > 0; i -= 2) if (i != p) { m2 = (double)(a[i - 1] + a[i]) / (a[p] - a[p - 1]); break; } m1 = max(m1, m2); printf("%.9Lf\n", m1); }
#include <bits/stdc++.h> using namespace std; long long a[1001], i, ma = 100000, p, n; long double m1, m2; int main() { cin >> n; for (; i < n; i++) cin >> a[i]; sort(a, a + n); m1 = (double)(a[n - 1] + a[n - 2]) / (a[1] - a[0]); for (i = n - 1; i > 0; i--) if (a[i] - a[i - 1] <= ma) { ma = a[i] - a[i - 1]; p = i; } for (i = n - 1; i > 0; i -= 2) if (i != p) { m2 = (double)(a[i - 1] + a[i]) / (a[p] - a[p - 1]); break; } m1 = max(m1, m2); printf("%.9Lf\n", m1); }
[["-", 8, 57, 64, 9, 0, 1, 0, 16, 31, 22], ["-", 8, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["-", 8, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["-", 0, 7, 8, 57, 64, 9, 0, 1, 0, 35]]
1
231
4
#include <algorithm> #include <functional> #include <stdio.h> #include <utility> using namespace std; int main(void) { int i, j, k, l, n; double ans = 0; scanf("%d", &n); int a[n]; pair<int, int> d[n]; for (i = 0; i < n; ++i) scanf("%d", &a[i]); sort(a, a + n, greater<int>()); for (i = 0; i < n - 1; ++i) d[i].first = a[i] - a[i + 1], d[i].second = i; sort(d, d + n - 1); if (d[0].second && d[0].second != 1) ans = (double)(a[0] + a[1]) / d[n - 2].first; else { for (i = 0; i < 4; ++i) for (j = 0; j < 4; ++j) for (k = 0; k < 4; ++k) for (l = 0; l < 4; ++l) if (i != j && j != k && k != l && l != i && i != k && j != l) if (ans < (double)(a[i] + a[j]) / (a[k] - a[l])) ans = (double)(a[i] + a[j]) / (a[k] - a[l]); if (d[1].second && d[1].second != 1) { if (ans < (double)(a[0] + a[1]) / d[1].first) ans = (double)(a[0] + a[1]) / d[1].first; } else { if (ans < (double)(a[0] + a[1]) / d[2].first) ans = (double)(a[0] + a[1]) / d[2].first; } } printf("%f\n", ans); return 0; }
#include <algorithm> #include <functional> #include <stdio.h> #include <utility> using namespace std; int main(void) { int i, j, k, l, n; double ans = 0; scanf("%d", &n); int a[n]; pair<int, int> d[n]; for (i = 0; i < n; ++i) scanf("%d", &a[i]); sort(a, a + n, greater<int>()); for (i = 0; i < n - 1; ++i) d[i].first = a[i] - a[i + 1], d[i].second = i; sort(d, d + n - 1); if (d[0].second && d[0].second != 1) ans = (double)(a[0] + a[1]) / d[0].first; else { for (i = 0; i < 4; ++i) for (j = 0; j < 4; ++j) for (k = 0; k < 4; ++k) for (l = 0; l < 4; ++l) if (i != j && j != k && k != l && l != i && i != k && j != l) if (ans < (double)(a[i] + a[j]) / (a[k] - a[l])) ans = (double)(a[i] + a[j]) / (a[k] - a[l]); if (d[1].second && d[1].second != 1) { if (ans < (double)(a[0] + a[1]) / d[1].first) ans = (double)(a[0] + a[1]) / d[1].first; } else { if (ans < (double)(a[0] + a[1]) / d[2].first) ans = (double)(a[0] + a[1]) / d[2].first; } } printf("%f\n", ans); return 0; }
[["-", 12, 118, 28, 69, 341, 342, 0, 16, 31, 22], ["-", 12, 118, 28, 69, 341, 342, 0, 16, 17, 33], ["-", 12, 118, 28, 69, 341, 342, 0, 16, 12, 13], ["+", 12, 16, 12, 118, 28, 69, 341, 342, 0, 13]]
1
479
4
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int X = scan.nextInt(); if (X % 7 == 0) { System.out.println("sat"); } else if (X % 7 == 1) { System.out.println("fri"); } else if (X % 7 == 2) { System.out.println("thu"); } else if (X % 7 == 3) { System.out.println("wed"); } else if (X % 7 == 4) { System.out.println("tue"); } else if (X % 7 == 5) { System.out.println("mon"); } else if (X % 7 == 6) { System.out.println("sun"); } } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int X = scan.nextInt(); if (X % 7 == 0) { System.out.println("thu"); } else if (X % 7 == 1) { System.out.println("fri"); } else if (X % 7 == 2) { System.out.println("sat"); } else if (X % 7 == 3) { System.out.println("sun"); } else if (X % 7 == 4) { System.out.println("mon"); } else if (X % 7 == 5) { System.out.println("tue"); } else if (X % 7 == 6) { System.out.println("wed"); } } }
[["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491]]
3
196
12
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String day[] = {"sat", "sun", "mon", "tue", "wed", "thu", "fri"}; System.out.println(day[in.nextInt() % 7]); } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String day[] = {"sat", "sun", "mon", "tue", "wed", "thu", "fri"}; System.out.println(day[(in.nextInt() + 5) % 7]); } }
[["+", 3, 4, 0, 504, 71, 16, 31, 23, 0, 24], ["+", 31, 23, 0, 16, 31, 492, 3, 4, 0, 25], ["+", 0, 504, 71, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 504, 71, 16, 31, 23, 0, 16, 12, 499]]
3
88
4
#include <stdio.h> int main() { int x; scanf("%d", &x); if (x % 7 == 2) printf("sat\n"); if (x % 7 == 3) printf("sun\n"); if (x % 7 == 4) printf("mon\n"); if (x % 7 == 5) printf("tue\n"); if (x % 7 == 6) printf("wed\n"); if (x % 7 == 0) printf("thu\n"); if (x % 7 == 2) printf("fri\n"); return 0; }
#include <stdio.h> int main() { int x; scanf("%d", &x); if (x % 7 == 2) printf("sat\n"); if (x % 7 == 3) printf("sun\n"); if (x % 7 == 4) printf("mon\n"); if (x % 7 == 5) printf("tue\n"); if (x % 7 == 6) printf("wed\n"); if (x % 7 == 0) printf("thu\n"); if (x % 7 == 1) printf("fri\n"); return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]]
0
136
2
#include <bits/stdc++.h> using namespace std; int main() { int x; vector<string> v{"thu", "fri", "sat", "sun", "mon", "tue", "wed"}; cout << v[x % 7] << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int x; cin >> x; vector<string> v{"thu", "fri", "sat", "sun", "mon", "tue", "wed"}; cout << v[x % 7] << endl; }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
61
4
#include <iostream> using namespace std; int main() { int x; cin >> x; switch (x) { case 2: cout << "sat\n"; break; case 3: cout << "sun\n"; break; case 4: cout << "mon\n"; break; case 5: cout << "tue\n"; break; case 6: cout << "wed\n"; break; case 0: cout << "thu\n"; break; case 1: cout << "fri\n"; default: break; } }
#include <iostream> using namespace std; int main() { int x; cin >> x; switch (x % 7) { case 2: cout << "sat\n"; break; case 3: cout << "sun\n"; break; case 4: cout << "mon\n"; break; case 5: cout << "tue\n"; break; case 6: cout << "wed\n"; break; case 0: cout << "thu\n"; break; case 1: cout << "fri\n"; break; default: break; } }
[["+", 8, 9, 0, 99, 15, 339, 51, 16, 17, 109], ["+", 8, 9, 0, 99, 15, 339, 51, 16, 12, 13], ["+", 0, 99, 8, 9, 0, 100, 0, 1, 0, 35], ["+", 0, 99, 8, 9, 0, 100, 0, 93, 0, 94]]
1
111
4
#include <iostream> #include <stdio.h> using namespace std; #include <math.h> int main() { int x; cin >> x; if (x == 4 || x == 11 || x == 18 || x == 25) cout << "mon" << endl; if (x == 5 || x == 12 || x == 19 || x == 26) cout << "tue" << endl; if (x == 6 || x == 13 || x == 20 || x == 27) cout << "" << endl; if (x == 7 || x == 14 || x == 21 || x == 28) cout << "" << endl; if (x == 1 || x == 8 || x == 15 || x == 22 || x == 29) cout << "" << endl; if (x == 2 || x == 9 || x == 16 || x == 23 || x == 30) cout << "" << endl; if (x == 3 || x == 10 || x == 17 || x == 24) cout << "" << endl; return 0; }
#include <iostream> #include <stdio.h> using namespace std; #include <math.h> int main() { int x; cin >> x; if (x == 4 || x == 11 || x == 18 || x == 25) cout << "mon" << endl; if (x == 5 || x == 12 || x == 19 || x == 26) cout << "tue" << endl; if (x == 6 || x == 13 || x == 20 || x == 27) cout << "wed" << endl; if (x == 7 || x == 14 || x == 21 || x == 28) cout << "thu" << endl; if (x == 1 || x == 8 || x == 15 || x == 22 || x == 29) cout << "fri" << endl; if (x == 2 || x == 9 || x == 16 || x == 23 || x == 30) cout << "sat" << endl; if (x == 3 || x == 10 || x == 17 || x == 24) cout << "sun" << endl; return 0; }
[["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
211
5
inputs = $stdin.read.split("\n") count = inputs.first.to_i samples = inputs.last.split(' ').map(&:to_f).sort samples_1 = samples samples_2 = samples - [samples.min] distance = 9999999999999999999999 min_dis_index = 0 samples_2.each_with_index do |v, i| if (v - samples_1[i]) < distance distance = v - samples_1[i] min_dis_index = i end end d = samples_1[min_dis_index] c = samples_2[min_dis_index] a = (samples - [d, c]).max samples = (samples - [d, c]) - [a] b = samples.max samples = samples - [b] result_1 = ((a + b) / (c - d)).round(5) # puts result_1 # puts "A:#{a}, B:#{b},C:#{c}, D:#{d}" a = samples.max samples = samples - [a] b = samples.max samples = samples - [b] samples = inputs.last.split(' ').map(&:to_f).sort a = samples.max samples = samples - [a] b = samples.max samples = samples - [b] samples_1 = samples samples_2 = samples - [samples.min] distance = 9999999999999999999999 min_dis_index = 0 samples_2.each_with_index do |v, i| if (v - samples_1[i]) < distance distance = v - samples_1[i] min_dis_index = i end end d = samples_1[min_dis_index] c = samples_2[min_dis_index] result_2 = ((a + b) / (c - d)).round(5) # puts result_2 # puts "A:#{a}, B:#{b},C:#{c}, D:#{d}" puts [result_1, result_2].min
inputs = $stdin.read.split("\n") count = inputs.first.to_i samples = inputs.last.split(' ').map(&:to_f).sort samples_1 = samples samples_2 = samples - [samples.min] distance = 9999999999999999999999 min_dis_index = 0 samples_2.each_with_index do |v, i| if (v - samples_1[i]) < distance distance = v - samples_1[i] min_dis_index = i end end d = samples_1[min_dis_index] c = samples_2[min_dis_index] a = (samples - [d, c]).max samples = (samples - [d, c]) - [a] b = samples.max samples = samples - [b] result_1 = ((a + b) / (c - d)).round(5) # puts result_1 # puts "A:#{a}, B:#{b},C:#{c}, D:#{d}" a = samples.max samples = samples - [a] b = samples.max samples = samples - [b] samples = inputs.last.split(' ').map(&:to_f).sort a = samples.max samples = samples - [a] b = samples.max samples = samples - [b] samples_1 = samples samples_2 = samples - [samples.min] distance = 9999999999999999999999 min_dis_index = 0 samples_2.each_with_index do |v, i| if (v - samples_1[i]) < distance distance = v - samples_1[i] min_dis_index = i end end d = samples_1[min_dis_index] c = samples_2[min_dis_index] result_2 = ((a + b) / (c - d)).round(5) # puts result_2 # puts "A:#{a}, B:#{b},C:#{c}, D:#{d}" puts [result_1, result_2].max
[["-", 0, 493, 0, 652, 3, 4, 0, 652, 735, 22], ["+", 0, 493, 0, 652, 3, 4, 0, 652, 735, 22]]
4
325
2
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = a; i <= (int)b; ++i) #define FOD(i, a, b) for (int i = a; i >= b; --i) using namespace std; int TTest, vs[15], num[3], f[1 << 13][2]; void init() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); // freopen("main.inp","r",stdin); // freopen("main.out","w",stdout); } int BIT(int x, int t) { return (x >> (t - 1)) & 1; } bool move_able(int x, int t) { return !BIT(x, t) && ((t > 1 && BIT(x, t - 1)) || (t < 13 && BIT(x, t + 1))); } void prf(int x) { FOR(i, 1, 13) cerr << BIT(x, i) << ' '; cerr << '\n'; } int get(int mask, int p) { int &shc = f[mask][p]; if (shc > -1) return shc; int last = 0; FOR(i, 1, 13) if (vs[i] == p && !BIT(mask, i))++ last; if (last == 0) return shc = true; bool foo = false; FOR(i, 1, 13) if (vs[i] == p && move_able(mask, i)) { foo = true; if (!get(mask + (1 << (i - 1)), 3 - p)) return shc = true; } if (!foo) return shc = !get(mask, 3 - p); else return shc = false; } void solve() { cin >> TTest; while (TTest--) { FOR(i, 1, 13) vs[i] = 2; FOR(i, 1, 6) { int x; cin >> x, vs[x] = 1; } memset(f, -1, sizeof f); cout << (get(64, 1) ? "yes\n" : "no\n"); } } main() { init(); solve(); }
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = a; i <= (int)b; ++i) #define FOD(i, a, b) for (int i = a; i >= b; --i) using namespace std; int TTest, vs[15], num[3], f[(1 << 13) + 3][2]; void init() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); // freopen("main.inp","r",stdin); // freopen("main.out","w",stdout); } int BIT(int x, int t) { return (x >> (t - 1)) & 1; } bool move_able(int x, int t) { return !BIT(x, t) && ((t > 1 && BIT(x, t - 1)) || (t < 13 && BIT(x, t + 1))); } void prf(int x) { FOR(i, 1, 13) cerr << BIT(x, i) << ' '; cerr << '\n'; } int get(int mask, int p) { int &shc = f[mask][p]; if (shc > -1) return shc; int last = 0; FOR(i, 1, 13) if (vs[i] == p && !BIT(mask, i))++ last; if (last == 0) return shc = true; bool foo = false; FOR(i, 1, 13) if (vs[i] == p && move_able(mask, i)) { foo = true; if (!get(mask + (1 << (i - 1)), 3 - p)) return shc = true; } if (!foo) return shc = !get(mask, 3 - p); else return shc = false; } void solve() { cin >> TTest; while (TTest--) { FOR(i, 1, 13) vs[i] = 2; FOR(i, 1, 6) { int x; cin >> x, vs[x] = 1; } memset(f, -1, sizeof f); cout << (get(64, 1) ? "yes\n" : "no\n"); } } main() { init(); solve(); }
[["+", 49, 80, 49, 80, 81, 16, 31, 23, 0, 24], ["+", 49, 80, 49, 80, 81, 16, 31, 23, 0, 25], ["+", 0, 43, 49, 80, 49, 80, 81, 16, 17, 72], ["+", 0, 43, 49, 80, 49, 80, 81, 16, 12, 13]]
1
454
4
#include <bits/stdc++.h> using namespace std; bool read(int &x) { return (scanf("%d", &x) != EOF); } int q; main() { // freopen("4.inp", "r", stdin); // freopen("4.out", "w", stdout); cin >> q; while (q--) { int mark[15] = {}; memset(mark, 0, sizeof mark); for (int i = 1; i <= 6; i++) { int x; cin >> x; mark[x] = 1; } for (int i = 1; i <= 13; i++) if (i == 7 || mark[i] == 1) continue; else mark[i] = 2; if (mark[1] == mark[13]) { if (mark[1] == 1) cout << "yes\n"; else cout << "no\n"; continue; } int L = 7, R = L; int numL = 6, numR = 6, turn = 1; while (1) { if (!numL) { cout << "yes\n"; break; } if (!numR) { cout << "no\n"; break; } if (turn == 1) { if (mark[L - 1] == 1 && mark[1] == 1) numL--, mark[--L] = -1; else if (mark[R + 1] == 1 && mark[13] == 1) numL--, mark[++R] = -1; else if (mark[L - 1] == 1) numL--, mark[--L] = -1; else if (mark[R + 1] == 1) numL--, mark[++R] = -1; } else { if (mark[L - 1] == 2 && mark[1] == 2) numR--, mark[--L] = -1; else if (mark[R + 1] == 2 && mark[13] == 2) numR--, mark[++R] = -1; else if (mark[L - 1] == 2) numR--, mark[--L] = -1; else if (mark[R + 1] == 2) numR--, mark[++R] = -1; } turn = 3 - turn; } } }
#include <bits/stdc++.h> using namespace std; bool read(int &x) { return (scanf("%d", &x) != EOF); } int q; main() { // freopen("4.inp", "r", stdin); // freopen("4.out", "w", stdout); cin >> q; while (q--) { int mark[15] = {}; memset(mark, 0, sizeof mark); for (int i = 1; i <= 6; i++) { int x; cin >> x; mark[x] = 1; } for (int i = 1; i <= 13; i++) if (i == 7 || mark[i] == 1) continue; else mark[i] = 2; if (mark[1] == mark[13]) { if (mark[1] == 1) cout << "no\n"; else cout << "yes\n"; continue; } int L = 7, R = L; int numL = 6, numR = 6, turn = 1; while (1) { if (!numL) { cout << "yes\n"; break; } if (!numR) { cout << "no\n"; break; } if (turn == 1) { if (mark[L - 1] == 1 && mark[1] == 1) numL--, mark[--L] = -1; else if (mark[R + 1] == 1 && mark[13] == 1) numL--, mark[++R] = -1; else if (mark[L - 1] == 1) numL--, mark[--L] = -1; else if (mark[R + 1] == 1) numL--, mark[++R] = -1; } else { if (mark[L - 1] == 2 && mark[1] == 2) numR--, mark[--L] = -1; else if (mark[R + 1] == 2 && mark[13] == 2) numR--, mark[++R] = -1; else if (mark[L - 1] == 2) numR--, mark[--L] = -1; else if (mark[R + 1] == 2) numR--, mark[++R] = -1; } turn = 3 - turn; } } }
[["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]]
1
464
4