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
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { run(); } static void run() { new Main().solver(); } long MOD = 1_000_000_000 + 7; void solver() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] c = new int[n]; f...
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { run(); } static void run() { new Main().solver(); } long MOD = 1_000_000_000 + 7; void solver() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] c = new int[n]; f...
[["-", 64, 196, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 64, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
584
2
#include "bits/stdc++.h" using namespace std; using ld = long double; const ld eps = 1e-9; typedef long long Weight; struct Edge { int src, dest; int cap, rev; Weight weight; bool operator<(const Edge &rhs) const { return weight > rhs.weight; } }; const int V = 4000; typedef vector<Edge> Edges; typedef vector...
#include "bits/stdc++.h" using namespace std; using ld = long double; const ld eps = 1e-9; typedef long long Weight; struct Edge { int src, dest; int cap, rev; Weight weight; bool operator<(const Edge &rhs) const { return weight > rhs.weight; } }; const int V = 4000; typedef vector<Edge> Edges; typedef vector...
[["-", 64, 1, 0, 11, 12, 69, 28, 69, 28, 22], ["+", 64, 1, 0, 11, 12, 69, 28, 69, 28, 22]]
1
1,315
2
#include <bits/stdc++.h> using namespace std; #define MAX_V 500 #define INF 1 << 28 typedef pair<int, int> P; struct edge { int to, cap, cost, rev; edge() {} edge(int to, int cap, int cost, int rev) : to(to), cap(cap), cost(cost), rev(rev) {} }; int V; vector<edge> G[MAX_V]; int h[MAX_V]; int dist[MAX_V]; ...
#include <bits/stdc++.h> using namespace std; #define MAX_V 500 #define INF 1 << 28 typedef pair<int, int> P; struct edge { int to, cap, cost, rev; edge() {} edge(int to, int cap, int cost, int rev) : to(to), cap(cap), cost(cost), rev(rev) {} }; int V; vector<edge> G[MAX_V]; int h[MAX_V]; int dist[MAX_V]; ...
[["-", 3, 4, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 31, 22]]
1
1,213
8
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <tuple> #include <vector> using namespace std; typedef pair<int, int> P; // cap,cost typedef tuple<int, int, string> T; // R,C,w/e map<int, P> G[100 * 100 + 200 + 2]; int main() { int n; cin >> n; int W[n][n]; for (int i...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <tuple> #include <vector> using namespace std; typedef pair<int, int> P; // cap,cost typedef tuple<int, int, string> T; // R,C,w/e map<int, P> G[100 * 100 + 200 + 2]; int main() { int n; cin >> n; int W[n][n]; for (int i...
[["+", 31, 16, 31, 16, 31, 16, 12, 16, 17, 72], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13]]
1
1,153
4
#include <iostream> #include <vector> #define inf 1000000000 using namespace std; struct edge { int to, cap, cost, rev; edge() {} edge(int a, int b, int c, int d) { to = a, cap = b, cost = c, rev = d; } }; struct ope { int i, j, type; ope(int a, int b, int c) { i = a, j = b, type = c; } }; int n; int W[10...
#include <iostream> #include <vector> #define inf 1000000000 using namespace std; struct edge { int to, cap, cost, rev; edge() {} edge(int a, int b, int c, int d) { to = a, cap = b, cost = c, rev = d; } }; struct ope { int i, j, type; ope(int a, int b, int c) { i = a, j = b, type = c; } }; int n; int W[10...
[["-", 64, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 64, 1, 0, 11, 12, 69, 341, 342, 0, 22]]
1
1,217
4
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <tuple> #include <typeinfo> #include <vector> using namespace std; typedef long long ll; const int MAX_V = 110; co...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <tuple> #include <typeinfo> #include <vector> using namespace std; typedef long long ll; const int MAX_V = 110; co...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
1,388
2
#include <bits/stdc++.h> using namespace std; #define for_(i, a, b) for (int i = (a); i < (b); ++i) #define for_rev(i, a, b) for (int i = (a); i >= (b); --i) typedef long long lint; template <typename DATA> class SegmentTree { private: int size__; vector<DATA> data; inline int left_t(int k) { return (k << 1) ...
#include <bits/stdc++.h> using namespace std; #define for_(i, a, b) for (int i = (a); i < (b); ++i) #define for_rev(i, a, b) for (int i = (a); i >= (b); --i) typedef long long lint; template <typename DATA> class SegmentTree { private: int size__; vector<DATA> data; inline int left_t(int k) { return (k << 1) ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
471
6
#include <algorithm> #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; #define reps(i, f, n) for (int i = f; i < int(n); i++) #define rep(i, n) reps(i, 0, n) typedef long long ll; const int N = 100010; class BIT { static const int N = 100010; public: ll t[N]; voi...
#include <algorithm> #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; #define reps(i, f, n) for (int i = f; i < int(n); i++) #define rep(i, n) reps(i, 0, n) typedef long long ll; const int N = 100010; class BIT { static const int N = 100010; public: ll t[N]; voi...
[["-", 12, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["-", 12, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
386
2
#include <bits/stdc++.h> using namespace std; #define int long long using vint = vector<int>; const int inf = 1LL << 55; int V, E, K; vector<vint> A; vector<vint> calc(int m) { vector<vint> B = A; vector<vint> res(V, vint(V, -inf)); for (int i = 0; i < V; ++i) res[i][i] = 0; while (m > 0) { if (m ...
#include <bits/stdc++.h> using namespace std; #define int long long using vint = vector<int>; const int inf = 1LL << 55; int V, E, K; vector<vint> A; vector<vint> calc(int m) { vector<vint> B = A; vector<vint> res(V, vint(V, -inf)); for (int i = 0; i < V; ++i) res[i][i] = 0; while (m > 0) { if (m ...
[["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 47], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 17, 20]]
1
939
2
#include <algorithm> #include <cfloat> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <utility> #include <vector> using namespace std; #define EPS 1e-7 typedef complex<double> P; typedef const P &rP; typedef vector<P> vP; typedef vector<int> vint; struct segment { P a, b; segme...
#include <algorithm> #include <cfloat> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <utility> #include <vector> using namespace std; #define EPS 1e-9 typedef complex<double> P; typedef const P &rP; typedef vector<P> vP; typedef vector<int> vint; struct segment { P a, b; segme...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 12, 2, 63, 118, 28, 69, 341, 342, 0, 22], ["+", 12, 2, 63, 118, 28, 69, 341, 342, 0, 22]]
1
2,823
4
// AOJ 2434: Audition // 2017.12.30 bal4u@uu #include <stdio.h> #define A 0.66666666666666666666666666666667 int n, m; int vi[2002], da[2002], vo[2002]; double s[2002], e[3][2002]; double dp[4][2002]; char mk[4][2002]; char buf[25], *p; int in() { int n = 0; while (*p >= '0') n = 10 * n + (*p++ & 0xf); p+...
// AOJ 2434: Audition // 2017.12.30 bal4u@uu #include <stdio.h> #define A 0.66666666666666666666666666666667 int n, m; int vi[2002], da[2002], vo[2002]; double s[2002], e[3][2002]; double dp[4][2002]; char mk[4][2002]; char buf[25], *p; int in() { int n = 0; while (*p >= '0') n = 10 * n + (*p++ & 0xf); p+...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
0
717
2
// g++ -std=c++11 a.cpp #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <typeinfo> #incl...
// g++ -std=c++11 a.cpp #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <typeinfo> #incl...
[["+", 341, 342, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 341, 342, 0, 2, 3, 4, 0, 16, 12, 13]]
1
767
2
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <memory.h> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; #define rep(i, n) for (in...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <memory.h> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; #define rep(i, n) for (in...
[["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 72], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13]]
1
748
2
import static java.lang.Integer.parseInt; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.ArithmeticException; import java.util.*; /** * Zero Division Checker */ public class Main { public static void main(String[] args) throws IOException { Buffe...
import static java.lang.Integer.parseInt; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.ArithmeticException; import java.util.*; /** * Zero Division Checker */ public class Main { public static void main(String[] args) throws IOException { Buffe...
[["+", 0, 57, 64, 196, 0, 526, 8, 527, 0, 46], ["-", 0, 57, 64, 196, 0, 526, 8, 527, 0, 46]]
3
919
2
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; int main() { int n, m, mod = 256; cin >> n; map<string, P> ma; for (int i = 0; i < n; i++) { string s; P p; cin >> s >> p.first >> p.second; ma[s] = p; } queue<vector<int>> que; cin >> m; for (int i = 0; i < m; i++) ...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; int main() { int n, m, mod = 256; cin >> n; map<string, P> ma; for (int i = 0; i < n; i++) { string s; P p; cin >> s >> p.first >> p.second; ma[s] = p; } queue<vector<int>> que; cin >> m; for (int i = 0; i < m; i++) ...
[["+", 341, 342, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 341, 342, 0, 16, 31, 23, 0, 16, 12, 22]]
1
588
2
#include <bits/stdc++.h> using namespace std; map<string, set<int>> mp; string random2() { string w; for (int i = 0; i < 100; i++) w += rand() % 26 + 'a'; return w; } string itos(int n) { stringstream ss; ss << n; return ss.str(); } bool inte(string s) { return '0' <= s[0] && s[0] <= '9'; } bool ope(...
#include <bits/stdc++.h> using namespace std; map<string, set<int>> mp; string random2() { string w; for (int i = 0; i < 100; i++) w += rand() % 26 + 'a'; return w; } string itos(int n) { stringstream ss; ss << n; return ss.str(); } bool inte(string s) { return '0' <= s[0] && s[0] <= '9'; } bool ope(...
[["-", 0, 7, 8, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 7, 8, 1, 0, 2, 3, 4, 0, 22]]
1
850
2
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #inclu...
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #inclu...
[["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
314
2
#define _USE_MATH_DEFINES #define INF 0x3f3f3f3f #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #in...
#define _USE_MATH_DEFINES #define INF 0x3f3f3f3f #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #in...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
285
2
#include <iostream> #include <vector> using namespace std; int main() { int n; string str; vector<string> v; cin >> n; for (int i = 0; i < n; i++) { cin >> str; v.push_back(str); } cin >> n; int st = 0; // 0 Closed , 1 Opened for (int i = 0; i < n; i++) { int flg = 0; cin >> str; ...
#include <iostream> #include <vector> using namespace std; int main() { int n; string str; vector<string> v; cin >> n; for (int i = 0; i < n; i++) { cin >> str; v.push_back(str); } cin >> n; int st = 0; // 0 Closed , 1 Opened for (int i = 0; i < n; i++) { int flg = 0; cin >> str; ...
[["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6]]
1
185
2
#include <iostream> #include <set> #include <string> using namespace std; #define rep(i, b) for (int i = 0; i < b; i++) int main() { set<string> ids; int n; cin >> n; rep(i, n) { string id; cin >> id; ids.insert(id); } int m; cin >> m; bool open = true; string s[2] = {"Opened by", "Clos...
#include <iostream> #include <set> #include <string> using namespace std; #define rep(i, b) for (int i = 0; i < b; i++) int main() { set<string> ids; int n; cin >> n; rep(i, n) { string id; cin >> id; ids.insert(id); } int m; cin >> m; bool open = true; string s[2] = {"Opened by ", "Clo...
[["-", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6]]
1
153
4
n = int(input()) id_set = set() key_status = True for i in range(n): id_set.add(input()) m = int(input()) for i in range(m): ic_id = input() if ic_id in id_set: key_status = not key_status print("Closed" if key_status else "Opend", "by", ic_id) else : print("Unknown", ic_id)
n = int(input()) id_set = set() key_status = True for i in range(n): id_set.add(input()) m = int(input()) for i in range(m): ic_id = input() if ic_id in id_set: key_status = not key_status print("Closed" if key_status else "Opened", "by", ic_id) else : print("Unknown", ic_id)
[["-", 0, 652, 3, 4, 0, 41, 0, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 41, 0, 557, 0, 6]]
5
90
2
#! /usr/bin/python # -*- coding: utf-8 -*- n = int(input()) ID=[] for i in range(n): ID.append(input()) m = int(input()) door = 1 for i in range(m): per = input() if per in ID: if door == 1: print("Opend by", per) else: print("Closed by", per) door *= -1 ...
#! /usr/bin/python # -*- coding: utf-8 -*- n = int(input()) ID=[] for i in range(n): ID.append(input()) m = int(input()) door = 1 for i in range(m): per = input() if per in ID: if door == 1: print("Opened by", per) else: print("Closed by", per) door *= -1 ...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
96
2
n = int(input()) l1 = [input() for i in range(n)] m = int(input()) c = 0 l = ["Opend","Closed"] for i in range(m): s = input() if s in l1: print(l[c%2]+" by "+ s) c += 1 else: print("Unknown "+ s)
n = int(input()) l1 = [input() for i in range(n)] m = int(input()) c = 0 l = ["Opened","Closed"] for i in range(m): s = input() if s in l1: print(l[c%2]+" by "+ s) c += 1 else: print("Unknown "+ s)
[["-", 0, 1, 0, 662, 12, 634, 0, 557, 0, 6], ["+", 0, 1, 0, 662, 12, 634, 0, 557, 0, 6]]
5
90
2
now=False lst=[] N=int(input()) for k in range(N): lst=lst.append(input()) M=int(input()) for t in range(M): ID=input() if ID in lst: now=not(now) if now: print("Opened by",ID) else: print("Closed by",ID) else: print("Unknown",ID)
now=False lst=[] N=int(input()) for k in range(N):lst.append(input()) M=int(input()) for t in range(M): ID=input() if ID in lst: now=not(now) if now: print("Opened by",ID) else: print("Closed by",ID) else: print("Unknown",ID)
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22]]
5
96
2
k=[input() for _ in range(int(input()))] a=1 for _ in range(int(input())): b=input() if b in k:print(('Opend' if a>0 else 'Closed')+' by '+b);a=~a else:print('Unknown '+b)
k=[input() for _ in range(int(input()))] a=1 for _ in range(int(input())): b=input() if b in k:print(('Opened' if a>0 else 'Closed')+' by '+b);a=~a else:print('Unknown '+b)
[["-", 31, 657, 31, 23, 0, 41, 0, 557, 0, 6], ["+", 31, 657, 31, 23, 0, 41, 0, 557, 0, 6]]
5
82
2
if __name__ == '__main__': n = int(input()) reg = [] for _ in range(n): reg.append(input()) m = int(input()) state = 0 for _ in range(m): p = input() if p in reg and not state: print("Opened by %s" % (p)) state = 1 elif p in reg and state:...
if __name__ == '__main__': n = int(input()) reg = [] for _ in range(n): reg.append(input()) m = int(input()) state = 0 for _ in range(m): p = input() if p in reg and not state: print("Opened by %s" % (p)) state = 1 elif p in reg and state:...
[["-", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6]]
5
112
2
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**3 eps = 1.0 / 10**10 mod = 10**9+7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF():...
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**3 eps = 1.0 / 10**10 mod = 10**9+7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF():...
[["-", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6]]
5
341
4
u = [input() for i in range(eval(input()))] t = [input() for i in range(eval(input()))] s = 0 for id in t: if id in u: print(("Opened" if s else "Closed") + " by " + id) s = 1 - s else: print("Unknown",id)
u = [input() for i in range(eval(input()))] t = [input() for i in range(eval(input()))] s = 1 for id in t: if id in u: print(("Opened" if s else "Closed") + " by " + id) s = 1 - s else: print("Unknown",id)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
86
2
// Aizu 2441: FizzBuzz // 2017.9.26 bal4u@uu #include <stdio.h> #include <string.h> char ans[500]; long long calc(long long a) { int j; long long l, r, p, ans; ans = (a / 3 + a / 5) << 2; for (j = 0, p = 1; p <= a; p *= 10) { j++; r = p * 10; if (r > a) r = a; l = p - 1; ans += ((r...
// Aizu 2441: FizzBuzz // 2017.9.26 bal4u@uu #include <stdio.h> #include <string.h> char ans[500]; long long calc(long long a) { int j; long long l, r, p, ans; ans = (a / 3 + a / 5) << 2; for (j = 0, p = 1; p <= a; p *= 10) { j++; r = p * 10; if (r > a) r = a; l = p - 1; ans += ((r...
[["-", 0, 34, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 34, 31, 2, 3, 4, 0, 5, 0, 6]]
0
371
2
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2441 #include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <numeric> #include <vector> #define ALL(v) (v).begin(), (v).end() #define REP(i, p, n) for (int i = p; i < (int)(n)...
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2441 #include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <numeric> #include <vector> #define ALL(v) (v).begin(), (v).end() #define REP(i, p, n) for (int i = p; i < (int)(n)...
[["-", 15, 339, 51, 16, 12, 16, 31, 16, 31, 22], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 31, 22]]
1
513
2
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; ll C(ll n) { ll T = 1; int D = 0; while (T <= n) T *= 10, D++; ll ret = 0; for (int d = 0; d < D; d++) { ll all = n - T / 10 + 1; ll fizz = n / 3 - (T / 10) / 3; ll buzz = n ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; ll C(ll n) { ll T = 1; int D = 0; while (T <= n) T *= 10, D++; ll ret = 0; for (int d = 0; d < D; d++) { ll all = n - T / 10 + 1; ll fizz = n / 3 - (T / 10) / 3; ll buzz = n ...
[["-", 0, 11, 31, 23, 0, 41, 15, 16, 17, 19], ["+", 0, 11, 31, 23, 0, 41, 15, 16, 17, 18], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
369
4
#include <algorithm> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using na...
#include <algorithm> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using na...
[["-", 0, 14, 8, 9, 0, 1, 0, 27, 28, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 27, 17, 29], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 31, 16, 12, 2, 3, 4, 0, 27, 17, 29]]
1
669
4
#include <bits/stdc++.h> #define REP(i, n, N) for (ll i = (n); i < (ll)(N); i++) #define p(s) cout << (s) << endl; typedef long long ll; using namespace std; ll calc(ll k, ll l, ll r) { ll F = (r - 1) / 3 - (l - 1) / 3; ll B = (r - 1) / 5 - (l - 1) / 5; ll FB = (r - 1) / 15 - (l - 1) / 15; ll ret = k * ((r - l...
#include <bits/stdc++.h> #define REP(i, n, N) for (ll i = (n); i < (ll)(N); i++) #define p(s) cout << (s) << endl; typedef long long ll; using namespace std; ll calc(ll k, ll l, ll r) { ll F = (r - 1) / 3 - (l - 1) / 3; ll B = (r - 1) / 5 - (l - 1) / 5; ll FB = (r - 1) / 15 - (l - 1) / 15; ll ret = k * ((r - l...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
389
4
#include <bits/stdc++.h> using namespace std; using P = pair<int, int>; const int M = 1000000007; long long cnt(long long n) { return n - n / 3 - n / 5 + n / 15; } long long len(long long n) { long long ret = (n / 3 + n / 5) * 4; long long l = 0, r = 9, t = 1; while (l < n) { ret += (cnt(r) - cnt(l)) * t; ...
#include <bits/stdc++.h> using namespace std; using P = pair<int, int>; const int M = 1000000007; long long cnt(long long n) { return n - n / 3 - n / 5 + n / 15; } long long len(long long n) { long long ret = (n / 3 + n / 5) * 4; long long l = 0, r = min(9LL, n), t = 1; while (l < n) { ret += (cnt(r) - cnt(...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 13], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 25]]
1
307
7
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FOREQ(i, a, b) for...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FOREQ(i, a, b) for...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
433
2
#include <bits/stdc++.h> using namespace std; #define EPS 1e-10 #define equals(a, b) (fabs((a) - (b)) < EPS) // c++ 11,14 #define COUNTER_CLOCKWISE 1 #define CLOCKWISE -1 #define ONLINE_BACK 2 #define ONLINE_FRONT -2 #define ON_SEGMENT 0 typedef struct point { double x, y; point(){}; point(double x, double y) : ...
#include <bits/stdc++.h> using namespace std; #define EPS 1e-10 #define equals(a, b) (fabs((a) - (b)) < EPS) // c++ 11,14 #define COUNTER_CLOCKWISE 1 #define CLOCKWISE -1 #define ONLINE_BACK 2 #define ONLINE_FRONT -2 #define ON_SEGMENT 0 typedef struct point { double x, y; point(){}; point(double x, double y) : ...
[["-", 31, 23, 0, 16, 31, 16, 12, 16, 31, 22], ["-", 31, 23, 0, 16, 31, 16, 12, 16, 17, 85], ["-", 31, 23, 0, 16, 31, 16, 12, 16, 12, 13], ["-", 341, 342, 0, 16, 31, 23, 0, 16, 17, 72]]
1
2,519
4
#ifndef ___STD_GEOMETRY #define ___STD_GEOMETRY #include <cmath> #define EPS 1e-13L #endif #ifndef ___Class_Point #define ___Class_Point class Point { public: // ------ Variable ------ // long double x, y; // ------ Constructor ------ // Point() : x(0), y(0) {} explicit Point(long double x, long doub...
#ifndef ___STD_GEOMETRY #define ___STD_GEOMETRY #include <cmath> #define EPS 1e-13L #endif #ifndef ___Class_Point #define ___Class_Point class Point { public: // ------ Variable ------ // long double x, y; // ------ Constructor ------ // Point() : x(0), y(0) {} explicit Point(long double x, long doub...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
1,336
2
#include <bits/stdc++.h> using namespace std; using ld = long double; int main() { int N; cin >> N; vector<int> X(N), Y(N); for (int i = 0; i < N; i++) { cin >> X[i] >> Y[i]; } if (N & 1) { puts("NA"); return 0; } int posX = X[0] + X[N / 2], posY = Y[0] + Y[N / 2]; bool ng = false; for ...
#include <bits/stdc++.h> using namespace std; using ld = long double; int main() { int N; cin >> N; vector<int> X(N), Y(N); for (int i = 0; i < N; i++) { cin >> X[i] >> Y[i]; } if (N & 1) { puts("NA"); return 0; } int posX = X[0] + X[N / 2], posY = Y[0] + Y[N / 2]; bool ng = false; for ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 79], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79]]
1
230
6
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; typedef vector<int> vi; typedef map<vi, int> ma; vi a, b; int N; ma bfs(vi vec) { ma tem; queue<vi> que; que.push(vec); tem[vec] = 0; while (!que.empty()) { vi v = que.front(); que.pop()...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; typedef vector<int> vi; typedef map<vi, int> ma; vi a, b; int N; ma bfs(vi vec) { ma tem; queue<vi> que; que.push(vec); tem[vec] = 0; while (!que.empty()) { vi v = que.front(); que.pop()...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 8, ...
1
407
8
#include <algorithm> #include <iostream> #include <queue> #include <unordered_set> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, int> pli; #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) int main() { int N; cin >> N; vector<int>...
#include <algorithm> #include <iostream> #include <queue> #include <unordered_set> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, int> pli; #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) int main() { int N; cin >> N; vector<int>...
[["-", 12, 118, 28, 69, 28, 69, 341, 342, 0, 13], ["+", 12, 118, 28, 69, 28, 69, 341, 342, 0, 13]]
1
527
2
#include <bits/stdc++.h> using namespace std; #define int long long int n; int po[11], a[11]; void print(int x) { for (int i = 0; i < n; i++) cout << x % 11 << " ", x /= 11; cout << endl; } void sw(int &x, int i, int j) { int s = (x % po[i + 1]) / po[i] * (po[j] - po[i]); int t = (x % po[j + 1]) / po[j] * (...
#include <bits/stdc++.h> using namespace std; #define int long long int n; int po[11], a[11]; void print(int x) { for (int i = 0; i < n; i++) cout << x % 11 << " ", x /= 11; cout << endl; } void sw(int &x, int i, int j) { int s = (x % po[i + 1]) / po[i] * (po[j] - po[i]); int t = (x % po[j + 1]) / po[j] * (...
[["+", 15, 339, 51, 16, 12, 16, 31, 23, 0, 24], ["-", 15, 339, 51, 16, 12, 16, 31, 16, 17, 85], ["-", 15, 339, 51, 16, 12, 16, 31, 16, 12, 13], ["+", 15, 339, 51, 16, 12, 16, 31, 23, 0, 25], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
718
6
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; string rev(const string &s, int i, int j) { string ret = s; for (int k = i; k <= j; ++k) ret[k] = s[j - k + i]; return ret; } int main() { int N; cin >> N; string A(N, '0'); ...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; string rev(const string &s, int i, int j) { string ret = s; for (int k = i; k <= j; ++k) ret[k] = s[j - k + i]; return ret; } int main() { int N; cin >> N; string A(N, '0'); ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
520
2
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <memory.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using nam...
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <memory.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using nam...
[["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 22]]
1
574
2
import static java.lang.Integer.parseInt; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Set; /** * Substring */ public class Main { static final long B = 37; static final long Binv = 2437684141L; public static void mai...
import static java.lang.Integer.parseInt; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Set; /** * Substring */ public class Main { static final long B = 37; static final long Binv = 1495681951922396077L; public static...
[["-", 0, 235, 8, 498, 0, 124, 49, 200, 51, 499], ["+", 0, 235, 8, 498, 0, 124, 49, 200, 51, 499]]
3
404
2
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #i...
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #i...
[["-", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6], ["+", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6]]
1
407
2
#include <iostream> #include <string> #include <vector> using namespace std; const vector<char> ss = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', ...
#include <iostream> #include <string> #include <vector> using namespace std; const vector<char> ss = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', ...
[["-", 0, 43, 49, 50, 51, 83, 0, 103, 0, 125], ["+", 0, 43, 49, 50, 51, 83, 0, 103, 0, 125]]
1
363
2
// Header {{{ // includes {{{ #include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <numer...
// Header {{{ // includes {{{ #include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <numer...
[["-", 75, 76, 0, 9, 0, 37, 0, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 37, 0, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
1,377
6
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdlib.h> #include <string> #include <time.h> #include <utility> ...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdlib.h> #include <string> #include <time.h> #include <utility> ...
[["-", 0, 52, 8, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 52, 8, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
669
4
#include <iostream> #include <string> using namespace std; char V[53] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", T[105]; int t[999], n, i, j; int main() { string S, U; while (true) { U = ""; cin >> n; if (n == 0) { break; } for (i = 0; i < n; i++) { cin >> t[i]; } ...
#include <iostream> #include <string> using namespace std; char T[53] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; int t[999], n, i, j; int main() { string S, U; while (true) { U = ""; cin >> n; if (n == 0) { break; } for (i = 0; i < n; i++) { cin >> t[i]; } cin ...
[["-", 0, 30, 0, 43, 49, 50, 49, 80, 49, 22], ["+", 0, 30, 0, 43, 49, 50, 49, 80, 49, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 49, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 70], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 73]]
1
171
7
#include <iostream> #include <string> #pragma warning(disable : 4996) using namespace std; int n, k, r[100]; string S; const string T = "abcdefghijklmnpoqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi" "jklmnpoqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; int main() { while (true) { scanf("%d", &n); ...
#include <iostream> #include <string> #pragma warning(disable : 4996) using namespace std; int n, k, r[100]; string S; const string T = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi" "jklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; int main() { while (true) { scanf("%d", &n); ...
[["-", 0, 43, 49, 50, 51, 61, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 61, 0, 5, 0, 6]]
1
181
4
#include <algorithm> #include <cstdio> using namespace std; int main(void) { char list[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; while (true) { int n, k[200]; char s[150] = {}; scanf("%d", &n); if (!n) break; for (int i = 0; i < n; i++) scanf("%d", &k[i]); ...
#include <algorithm> #include <cstdio> using namespace std; int main(void) { char list[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; while (true) { int n, k[200]; char s[150] = {}; scanf("%d", &n); if (!n) break; for (int i = 0; i < n; i++) scanf("%d", &k[i]); ...
[["+", 341, 342, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 341, 342, 0, 16, 31, 23, 0, 16, 12, 13]]
1
166
2
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vec...
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vec...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
221
2
#include <iostream> #include <string> using namespace std; #define KEY_NUM 100 char process_key(char c, int key) { int num = 0; // cout << "[" << c << "," << key << "," << num << "]"; if ('a' <= c && c <= 'z') { num = 25 - (int)('z' - c); } if ('A' <= c && c <= 'Z') { num = 51 - (int)('Z' - c); }...
#include <iostream> #include <string> using namespace std; #define KEY_NUM 100 char process_key(char c, int key) { int num = 0; // cout << "[" << c << "," << key << "," << num << "]"; if ('a' <= c && c <= 'z') { num = 25 - (int)('z' - c); } if ('A' <= c && c <= 'Z') { num = 51 - (int)('Z' - c); }...
[["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13]]
1
248
2
#include <iostream> #include <queue> #include <string> using namespace std; int main() { int a, b, c; string s, h = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; queue<int> q; while (1) { cin >> a; if (a == 0) break; while (q.size() != 0) q.pop(); for (int i = 0; i < a; i+...
#include <iostream> #include <queue> #include <string> using namespace std; int main() { int a, b, c; string s, h = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; queue<int> q; while (1) { cin >> a; if (a == 0) break; while (q.size() != 0) q.pop(); for (int i = 0; i < a; i+...
[["-", 64, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 72], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 12, 13]]
1
247
4
#define _USE_MATH_DEFINES #include <algorithm> #include <cctype> #include <cfloat> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #i...
#define _USE_MATH_DEFINES #include <algorithm> #include <cctype> #include <cfloat> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #i...
[["-", 0, 1, 0, 11, 12, 16, 31, 103, 0, 125], ["+", 0, 1, 0, 11, 12, 16, 31, 103, 0, 125]]
1
944
2
#include <bits/stdc++.h> using namespace std; int main() { string str = "abcdefghijklmnopqrstuvwxyzABCDEFFGHIJKLMNOPQRSTUVWXYZ"; str = str + str + str; while (1) { int n; cin >> n; if (!n) break; vector<int> key(n); for (int i = 0; i < n; i++) { cin >> key[i]; } string ...
#include <bits/stdc++.h> using namespace std; int main() { string str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; str = str + str + str; /*for(int i = 0; str[i] != '\0'; i++){ cout << i << ":" << str[i] << endl; }*/ while (1) { int n; cin >> n; if (!n) break; vector...
[["-", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6], ["+", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6]]
1
186
2
#include <bits/stdc++.h> inline char shift(char c, int x) { int d; char nc; if (c >= 'a' && c <= 'z') { nc = (char)(c - x); if (nc >= 'a' && nc <= 'z') { return nc; } d = 'a' - nc; return shift('Z', d + 1); } else { nc = (char)(c - x); if (nc >= 'A' && nc <= 'Z') { retur...
#include <bits/stdc++.h> inline char shift(char c, int x) { int d; char nc; if (c >= 'a' && c <= 'z') { nc = (char)(c - x); if (nc >= 'a' && nc <= 'z') { return nc; } d = 'a' - nc; return shift('Z', d - 1); } else { nc = (char)(c - x); if (nc >= 'A' && nc <= 'Z') { retur...
[["-", 0, 37, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 37, 0, 2, 3, 4, 0, 16, 17, 33]]
1
263
4
#include <bits/stdc++.h> using namespace std; #define lp(i, n) for (int i = 0; i < n; i++) int main() { while (1) { int n; cin >> n; if (n == 0) break; int a[100]; lp(i, n) { cin >> a[i]; } int count = 0; char x; scanf("%c", &x); while (1) { scanf("%c", &x); if (...
#include <bits/stdc++.h> using namespace std; #define lp(i, n) for (int i = 0; i < n; i++) int main() { while (1) { int n; cin >> n; if (n == 0) break; int a[100]; lp(i, n) { cin >> a[i]; } int count = 0; char x; scanf("%c", &x); while (1) { scanf("%c", &x); if (...
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 17, 60], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32]]
1
173
2
#include <complex> #include <iostream> #include <map> #include <math.h> #include <string> using namespace std; char decode(char s, int k) { // cout<<s<<endl; for (int i = 0; i < k; i++) { if (s == 'a') s = 'Z'; else if (s == 'A') s = 'z'; else s = s - 1; // cout<<s<<endl; } ...
#include <complex> #include <iostream> #include <map> #include <math.h> #include <string> using namespace std; char decode(char s, int k) { // cout<<s<<endl; for (int i = 0; i < k; i++) { if (s == 'a') s = 'Z'; else if (s == 'A') s = 'z'; else s = s - 1; // cout<<s<<endl; } ...
[["+", 0, 52, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
177
4
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #incl...
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #incl...
[["-", 0, 57, 64, 1, 0, 11, 12, 103, 0, 125], ["+", 0, 57, 64, 1, 0, 11, 12, 103, 0, 125]]
1
1,170
4
while 1: n=int(input()) if n==0:break a=list(map(int,input().split())) s=list(input()) for i in range(len(s)): for j in range(a[i%n]): if s[i]=='A':s[i]='a' elif s[i]=='a':s[i]='Z' else:s[i]=s[i]=chr(ord(s[i])-1) print(*s,sep='')
while 1: n=int(input()) if n==0:break a=list(map(int,input().split())) s=list(input()) for i in range(len(s)): for j in range(a[i%n]): if s[i]=='A':s[i]='z' elif s[i]=='a':s[i]='Z' else:s[i]=s[i]=chr(ord(s[i])-1) print(*s,sep='')
[["-", 64, 196, 0, 1, 0, 662, 12, 557, 0, 6], ["+", 64, 196, 0, 1, 0, 662, 12, 557, 0, 6]]
5
136
2
char W[9], V[9]; Z[2 * 4], S, N, T, P, M; main() { int i, j, k, l, r, d; for (; scanf("%d%d%d%s%s%d%d", &S, &N, &T, W, V, &P, &M), S; printf("%.10f\n", 1 - pow(1 - 1.0 / P, N * r))) { memset(Z, 0, sizeof(Z)); l = *W == 'A' ? 2 : 1; d = 24 * 60 * (*W == 'A' ? 1 : 7); if (*V == 'A') for (...
char W[9], V[9]; Z[2 * 4], S, N, T, P, M; main() { int i, j, k, l, r, d; for (; scanf("%d%d%d%s%s%d%d", &S, &N, &T, W, V, &P, &M), S; printf("%.10f\n", 1 - pow(1 - 1.0 / P, N * r))) { memset(Z, 0, sizeof(Z)); l = *W == 'A' ? 2 : 1; d = 24 * 60 * (*W == 'A' ? 1 : 7); if (*V == 'A') for (...
[["-", 0, 11, 12, 11, 31, 69, 71, 16, 12, 13], ["+", 0, 11, 12, 11, 31, 69, 71, 16, 12, 13], ["-", 12, 11, 12, 11, 31, 69, 71, 16, 12, 13], ["+", 12, 11, 12, 11, 31, 69, 71, 16, 12, 13]]
0
386
42
#include <bits/stdc++.h> using namespace std; int s, n, t, m, p; bool minutes[7 * 24 * 60]; int wbits, tbits; double ck(int start) { int cnt = 0; for (int i = 0; i < m; i++, start += t) { bool flag = true; for (int j = 0; j <= s; j++) { if (!minutes[(start + j) % (7 * 24 * 60)]) { flag = f...
#include <bits/stdc++.h> using namespace std; int s, n, t, m, p; bool minutes[7 * 24 * 60]; int wbits, tbits; double ck(int start) { int cnt = 0; for (int i = 0; i < m; i++, start += t) { bool flag = true; for (int j = 0; j <= s; j++) { if (!minutes[(start + j) % (7 * 24 * 60)]) { flag = f...
[["-", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["-", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["-", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["-", 31, 16, 31, 23, 0, 16, 31, 16, 31, 13], ["+", 31, 16, 31, 23, 0, 16, 31, 16, 31, 22], ["-", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25]]
1
386
6
count = 0 ok = true gets.to_i.times do p, x = gets.chomp.split case p when "(" count += x.to_i else count -= x.to_i end ok = false if count < 0 end ok = false if count != 0 puts ok ? "Yes" : "No"
count = 0 ok = true gets.to_i.times do p, x = gets.chomp.split case p when "(" count += x.to_i else count -= x.to_i end ok = false if count < 0 end ok = false if count != 0 puts ok ? "YES" : "NO"
[["-", 0, 652, 3, 4, 0, 754, 64, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 754, 64, 557, 0, 6], ["-", 0, 652, 3, 4, 0, 754, 75, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 754, 75, 557, 0, 6]]
4
64
4
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <list> #include <map> #include <sstream> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; pair<bool...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <list> #include <map> #include <sstream> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; pair<bool...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
452
4
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <vector> using namespace std; double f(double a, double p, double q, double x) { return a * (x - p) * (x - p) + q; } double f(double a, double p, double x) { return sqrt(1.0 + 4.0 * a * a * x * x - 8.0 * a * a * p * x + ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <vector> using namespace std; double f(double a, double p, double q, double x) { return a * (x - p) * (x - p) + q; } double f(double a, double p, double x) { return sqrt(1.0 + 4.0 * a * a * x * x - 8.0 * a * a * p * x + ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
984
4
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <vector> using namespace std; #define double long double double EPS = 1e-12; double g(double x, double A, double B, double C) { return A * x * x + B * x + C; } double f(double x, double A, double ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <vector> using namespace std; #define double long double double EPS = 1e-12; double g(double x, double A, double B, double C) { return A * x * x + B * x + C; } double f(double x, double A, double ...
[["-", 31, 2, 3, 4, 0, 16, 12, 16, 12, 13], ["+", 31, 2, 3, 4, 0, 16, 12, 16, 12, 13]]
1
815
2
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (i...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (i...
[["+", 0, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 0, 57, 15, 339, 51, 91, 28, 23, 0, 24], ["+", 0, 57, 15, 339, 51, 91, 28, 23, 0, 25], ["+", 8, 9, 0, 9, 0, 57, 15, 339, 0, 24]]
1
1,170
6
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #incl...
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #incl...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22]]
1
1,298
2
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int n, a[4]; int main() { int maxn = 199999; cin >> n >> a[0] >> a[1] >> a[2] >> a[3]; for (int i = 1; i <= n; i++) { int x[4], y[4]; for (int j = 0; j < 4; j++) { x[j] = (a[j] - 1) % n; y[j] = (a[j] - 1) / n; }...
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int n, a[4]; int main() { int maxn = 199999; cin >> n >> a[0] >> a[1] >> a[2] >> a[3]; for (int i = 1; i <= n; i++) { int x[4], y[4]; for (int j = 0; j < 4; j++) { x[j] = (a[j] - 1) % i; y[j] = (a[j] - 1) / i; }...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["-", 51, 16, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 51, 16, 12, 2, 3, 4, 0, 16, 17, 33]]
1
206
6
n, *is = $<.read.split(/\s+/).map(&:to_i) min = n (1..n).each{|w| a = is.map{|i| [(i-1) % w, (i-1) / w]} p sum = (0..3).map{|i| (a[i&2][i%2] - a[1+(i&2)][i%2]).abs}.inject(&:+) min = [min, sum].min } puts min
n, *is = $<.read.split(/\s+/).map(&:to_i) min = n (1..n).each{|w| a = is.map{|i| [(i-1) % w, (i-1) / w]} sum = (0..3).map{|i| (a[i&2][i%2] - a[1+(i&2)][i%2]).abs}.inject(&:+) min = [min, sum].min } puts min
[["-", 0, 652, 196, 196, 8, 734, 0, 652, 735, 22]]
4
127
1
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main(void) { int n, m; cin >> n; vector<int> s(n), l(n), p(n); for (int i = 0; i < n; i++) { cin >> s[i] >> l[i] >> p[i]; } cin >> m; vector<int> w(m); for (int i = 0; i < m; i++) cin >> w[i]; int dp[4...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main(void) { int n, m; cin >> n; vector<int> s(n), l(n), p(n); for (int i = 0; i < n; i++) { cin >> s[i] >> l[i] >> p[i]; } cin >> m; vector<int> w(m); for (int i = 0; i < m; i++) cin >> w[i]; int dp[4...
[["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 73]]
1
291
2
#include <cstring> #include <iostream> #include <vector> using namespace std; const int MAX_N = 400; int memo[MAX_N]; typedef struct { int to, cost; } edge; edge makeEdge(int to, int cost) { edge e = {to, cost}; return e; } vector<edge> graph[MAX_N]; int dfs(int p) { if (memo[p] != -1) { return memo[p]...
#include <cstring> #include <iostream> #include <vector> using namespace std; const int MAX_N = 400; int memo[MAX_N]; typedef struct { int to, cost; } edge; edge makeEdge(int to, int cost) { edge e = {to, cost}; return e; } vector<edge> graph[MAX_N]; int dfs(int p) { if (memo[p] != -1) { return memo[p]...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
241
2
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int i, j, k; int a, b; char c[101]; int key[101]; while (1) { scanf("%d", &a); if (a == 0) { break; } for (i = 0; i < a; i++) { scanf("%d", &key[i]); } gets(c); i = 0; int flag = 0; while ...
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int i, j, k; int a, b; char c[101]; int key[101]; while (1) { scanf("%d", &a); if (a == 0) { break; } for (i = 0; i < a; i++) { scanf("%d\n", &key[i]); } gets(c); i = 0; int flag = 0; whil...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
242
1
#include <stdio.h> #include <string.h> int main() { int n, K[100], i, j; char S[100]; while (1) { scanf("%d", &n); if (n == 0) break; for (i = 0; i < n; i++) { scanf("%d", &K[i]); } scanf("%s", S); for (i = 0; i < strlen(S); i++) { for (j = 0; j < K[i % n]; j++) { ...
#include <stdio.h> #include <string.h> int main() { int n, K[100000], i, j; char S[100000]; while (1) { scanf("%d", &n); if (n == 0) break; for (i = 0; i < n; i++) { scanf("%d", &K[i]); } scanf("%s", S); for (i = 0; i < strlen(S); i++) { for (j = 0; j < K[i % n]; j++) { ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
188
5
#include <stdio.h> #include <stdlib.h> int comp(const void *b, const void *a) { return *(int *)a - *(int *)b; } void cal(int sub, int data[1000], int count, int i, int sum, int rest, int *halt, int *max) { // sum(i of data 1 or 0) // want to look at data[i] // if halt == 1 >>> return; // if sum == sub >...
#include <stdio.h> #include <stdlib.h> int comp(const void *b, const void *a) { return *(int *)a - *(int *)b; } void cal(int sub, int data[1000], int count, int i, int sum, int rest, int *halt, int *max) { // sum(i of data 1 or 0) // want to look at data[i] // if halt == 1 >>> return; // if sum == sub >...
[["-", 64, 9, 0, 57, 15, 23, 0, 11, 17, 32], ["+", 64, 9, 0, 57, 15, 23, 0, 16, 17, 60], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
742
4
#include <bits/stdc++.h> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) a.begin(), a.end() #define MS(m, v) memset(m, v, sizeof(m)) #define D10 fixed << setprecision(10) typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef...
#include <bits/stdc++.h> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) a.begin(), a.end() #define MS(m, v) memset(m, v, sizeof(m)) #define D10 fixed << setprecision(10) typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef...
[["-", 75, 76, 0, 9, 0, 43, 49, 50, 51, 13], ["+", 75, 76, 0, 9, 0, 43, 49, 50, 51, 13]]
1
458
2
#include <bits/stdc++.h> using namespace std; int n; int r[1010], w[1010]; int dp[1000010]; int main() { cin.tie(0); ios_base::sync_with_stdio(0); while (cin >> n && n) { int sum_r = 0, sum_w = 0, max_r = 0; for (int i = 0; i < n; ++i) { cin >> r[i] >> w[i]; if (r[max_r] < r[i]) { m...
#include <bits/stdc++.h> using namespace std; int n; int r[1010], w[1010]; int dp[1000010]; int main() { cin.tie(0); ios_base::sync_with_stdio(0); while (cin >> n && n) { int sum_r = 0, sum_w = 0, max_r = 0; for (int i = 0; i < n; ++i) { cin >> r[i] >> w[i]; if (r[max_r] < r[i]) { m...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 147], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
316
4
#define _GLIBCXX_DEBUG #include <algorithm> #include <bits/stdc++.h> //"geometry.cpp" #include <cmath> //"abs", "sqrt" #include <cstdio> #include <functional> //"greater<T>" Ex. sort(a,a+n,greater<int>()); #include <iomanip> //"cout<<fixed<<setprecision(n)<<sth<<endl;" #include <iostream> #include <map> #inc...
#define _GLIBCXX_DEBUG #include <algorithm> #include <bits/stdc++.h> //"geometry.cpp" #include <cmath> //"abs", "sqrt" #include <cstdio> #include <functional> //"greater<T>" Ex. sort(a,a+n,greater<int>()); #include <iomanip> //"cout<<fixed<<setprecision(n)<<sth<<endl;" #include <iostream> #include <map> #inc...
[["-", 75, 76, 0, 9, 0, 43, 49, 80, 81, 13], ["+", 75, 76, 0, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
364
4
#include <algorithm> #include <iostream> #include <utility> #include <vector> using namespace std; int main() { while (1) { int n; cin >> n; if (n == 0) break; vector<pair<int, int>> rw(n); int rsum = 0, wsum = 0; for (int i = 0; i < n; i++) { int r, w; cin >> r >> w; ...
#include <algorithm> #include <iostream> #include <utility> #include <vector> using namespace std; int main() { while (1) { int n; cin >> n; if (n == 0) break; vector<pair<int, int>> rw(n); int rsum = 0, wsum = 0; for (int i = 0; i < n; i++) { int r, w; cin >> r >> w; ...
[["-", 0, 57, 64, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 0, 1, 0, 16...
1
305
8
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (i...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (i...
[["-", 0, 16, 31, 16, 12, 16, 12, 69, 28, 22], ["+", 0, 16, 31, 16, 12, 16, 12, 69, 28, 22]]
1
547
2
#include <bits/stdc++.h> using namespace std; struct Edge { int from, to, cost; }; const int SIZE = 1000; class UnionFind { vector<int> par, rank; public: UnionFind(int n) : par(n), rank(n) { iota(par.begin(), par.end(), 0); } int find(int x) { if (par[x] == x) return x; else par[x] = fin...
#include <bits/stdc++.h> using namespace std; struct Edge { int from, to, cost; }; const int SIZE = 1000; class UnionFind { vector<int> par, rank; public: UnionFind(int n) : par(n), rank(n) { iota(par.begin(), par.end(), 0); } int find(int x) { if (par[x] == x) return x; else return par[x...
[["+", 8, 9, 0, 57, 75, 76, 0, 37, 0, 38]]
1
966
1
#include <bits/stdc++.h> using namespace std; #define FOR(i, k, n) for (int i = (int)(k); i < (int)(n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) a.begin(), a.end() #define MS(m, v) memset(m, v, sizeof(m)) typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<string> vs; typedef ...
#include <bits/stdc++.h> using namespace std; #define FOR(i, k, n) for (int i = (int)(k); i < (int)(n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) a.begin(), a.end() #define MS(m, v) memset(m, v, sizeof(m)) typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<string> vs; typedef ...
[["-", 0, 57, 64, 9, 0, 43, 49, 50, 51, 13], ["+", 64, 9, 0, 43, 49, 50, 51, 91, 17, 33], ["+", 64, 9, 0, 43, 49, 50, 51, 91, 28, 22], ["-", 75, 76, 0, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 9, 0, 43, 49, 50, 51, 91, 17, 33], ["+", 0, 9, 0, 43, 49, 50, 51, 91, 28, 22]]
1
1,386
6
#include <bits/stdc++.h> using namespace std; struct Bipartite_Matching { vector<vector<int>> graph; vector<int> match, alive, used; int timestamp = 0; Bipartite_Matching(int n) { graph.resize(n); alive.assign(n, 1); used.assign(n, 0); match.assign(n, -1); } void add_edge(int u, int v) {...
#include <bits/stdc++.h> using namespace std; struct Bipartite_Matching { vector<vector<int>> graph; vector<int> match, alive, used; int timestamp = 0; Bipartite_Matching(int n) { graph.resize(n); alive.assign(n, 1); used.assign(n, 0); match.assign(n, -1); } void add_edge(int u, int v) {...
[["-", 64, 1, 0, 11, 12, 2, 63, 118, 119, 120], ["+", 64, 1, 0, 11, 12, 2, 63, 118, 119, 120]]
1
1,729
2
#include <bits/stdc++.h> using namespace std; #define for_(i, a, b) for (int i = (a); i < (b); ++i) #define allof(a) (a).begin(), (a).end() typedef pair<int, int> pii; class BipartiteMatching { private: int V; vector<vector<int>> adj; vector<int> match; vector<bool> used; vector<bool> visible; bool dfs(i...
#include <bits/stdc++.h> using namespace std; #define for_(i, a, b) for (int i = (a); i < (b); ++i) #define allof(a) (a).begin(), (a).end() typedef pair<int, int> pii; class BipartiteMatching { private: int V; vector<vector<int>> adj; vector<int> match; vector<bool> used; vector<bool> visible; bool dfs(i...
[["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 22], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 12, 22], ["+", 3, 4, 0, 69, 341, 342, 0, 16, 17, 33], ["+", 3, 4, 0, 69, 341, 342, 0, 16, 12, 22]]
1
1,687
6
#include <algorithm> #include <iostream> #include <string> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) using namespace std; int main() { int n, t; cin >> n >> t; string name1, name2; string canstop[20]; int stoptime[20]; char c; int h, m, ah, am; int cnt = 0; ci...
#include <algorithm> #include <iostream> #include <string> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) using namespace std; int main() { int n, t; cin >> n >> t; string name1, name2; string canstop[20]; int stoptime[20]; char c; int h, m, ah, am; int cnt = 0; ci...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
202
3
n,m=gets.split n.to_i.times.map{gets.to_i}.reverse.uniq[0...m.to_i].map{|e|e.puts}
n,m=gets.split n.to_i.times.map{gets.to_i}.reverse.uniq[0...m.to_i].map{|e|puts e}
[["-", 0, 652, 196, 196, 8, 734, 0, 652, 486, 22], ["-", 0, 652, 196, 196, 8, 734, 0, 652, 17, 131], ["+", 196, 196, 8, 734, 0, 652, 3, 4, 0, 22]]
4
40
3
n,m=gets.split puts n.to_i.times.map{gets}.reverse.uniq[0...m.to_i].join "\n"
n,m=gets.split puts n.to_i.times.map{gets}.reverse.uniq[0...m.to_i].join
[["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 62], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 44]]
4
34
6
n,m=gets.split puts n.to_i.times.map{gets}.reverse.uniq[0...m.to_i].join "\n"
n,m=gets.split puts n.to_i.times.map{gets}.reverse.uniq[0,m.to_i].join
[["-", 3, 4, 0, 652, 486, 742, 0, 475, 17, 389], ["+", 0, 652, 3, 4, 0, 652, 486, 742, 0, 21], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 62], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 44]]
4
34
6
n,m=gets.split puts n.to_i.times.map{gets}.reverse.uniq[0...m.to_i].join "\n"
n,m=gets.split;puts n.to_i.times.map{gets}.reverse.uniq[0,m.to_i].join
[["+", 36, 36, 36, 36, 36, 36, 0, 493, 0, 35], ["-", 3, 4, 0, 652, 486, 742, 0, 475, 17, 389], ["+", 0, 652, 3, 4, 0, 652, 486, 742, 0, 21], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 62], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 44]]
4
34
6
N, M = list(map(int, input().split(' '))) q = [ int(eval(input())) for _ in range(N) ] poll = set() cnt = 0 for _ in reversed(q): if not _ in poll: print(_) cnt = cnt + 1 if cnt == M: break poll.append(_)
N, M = list(map(int, input().split(' '))) q = [ int(eval(input())) for _ in range(N) ] poll = set() cnt = 0 for _ in reversed(q): if not _ in poll: print(_) cnt = cnt + 1 if cnt == M: break poll.add(_)
[["-", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22]]
5
85
2
#include <bits/stdc++.h> using namespace std; int n; long long a[10009]; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); if (a[0] >= 2) { cout << 1 << endl; } else { long long sum = 1; bool flag = false; for (int i = 1; i < n; i++) { if (sum < a[i]) { ...
#include <bits/stdc++.h> using namespace std; int n; long long a[10009]; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); if (a[0] >= 2) { cout << 1 << endl; } else { long long sum = 1; bool flag = false; for (int i = 1; i < n; i++) { if (sum + 1 < a[i]...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
148
2
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, a[10000]; cin >> n; for (ll i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); ll ans = 1; for (ll i = 0; i < n; i++) if (ans >= a[i]) ans += a[i]; else { cout << ans << endl; break; } ret...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, a[10000]; cin >> n; for (ll i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); ll ans = 1; for (ll i = 0; i < n; i++) if (ans >= a[i]) ans += a[i]; else break; cout << ans << endl; return 0; }
[["-", 0, 7, 8, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 7, 8, 57, 75, 76, 0, 93, 0, 94], ["+", 0, 7, 8, 57, 75, 76, 0, 93, 0, 35], ["-", 8, 57, 75, 76, 0, 9, 0, 1, 0, 35], ["-", 8, 57, 75, 76, 0, 9, 0, 93, 0, 94], ["-", 0, 7, 8, 57, 75, 76, 0, 9, 0, 46]]
1
108
6
gets;gets.split.map(&:to_i).sort.reduce(1){|s,e|e>s ?(p s;exit):s+=e}
gets;p gets.split.map(&:to_i).sort.reduce(1){|s,e|e>s ?(p s;exit):s+=e}
[["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22]]
4
39
1
gets;s=1;gets.split.map(&:to_i).sort.all?{|e|e>s ?s+=e :nil};p s
gets;s=1;gets.split.map(&:to_i).sort.all?{|e|e>s ?nil:s+=e};p s
[["+", 196, 196, 8, 734, 0, 754, 64, 477, 0, 477], ["+", 0, 652, 196, 196, 8, 734, 0, 754, 0, 102], ["-", 0, 652, 196, 196, 8, 734, 0, 754, 0, 102], ["-", 196, 196, 8, 734, 0, 754, 75, 477, 0, 477]]
4
36
6
gets;s=1;gets.split.map(&:to_i).sort.all?{|e|e>s ?s+=e :nil};p s
gets;s=1;gets.split.map(&:to_i).sort.map{|e|e>s ?break: s+=e};p s
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 196, 196, 8, 734, 0, 754, 64, 94, 0, 94], ["+", 0, 652, 196, 196, 8, 734, 0, 754, 0, 102], ["-", 0, 652, 196, 196, 8, 734, 0, 754, 0, 102], ["-", 196, 196, 8, 734, 0, 754, 75, 477, 0, 477]]
4
36
6
gets;s=1;gets.split.map(&:to_i).sort.all?{|e|e>s&&s+=e};p s
gets;s=1;gets.split.map(&:to_i).sort.all?{|e|e<=s&&s+=e};p s
[["-", 196, 196, 8, 734, 0, 738, 31, 738, 17, 47], ["+", 196, 196, 8, 734, 0, 738, 31, 738, 17, 19]]
4
34
2
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; const double EPS = 1e-8; const int N_MAX = 3; bool Gauss_Jordan(int n, const double A[N_MAX][N_MAX], const double *b, double *x) { static double B[N_MAX...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; const double EPS = 1e-8; const int N_MAX = 3; bool Gauss_Jordan(int n, const double A[N_MAX][N_MAX], const double *b, double *x) { static double B[N_MAX...
[["-", 0, 43, 49, 50, 51, 83, 0, 83, 0, 13], ["+", 0, 43, 49, 50, 51, 83, 0, 83, 0, 22]]
1
565
2
// AOJ 2480 Blame Game // 2018.3.9 bal4u #include <stdio.h> #include <string.h> #define MAX 502 short hi[MAX], to[MAX][MAX]; char seen[MAX]; short match[MAX]; int bpm(int u) { int i, v; for (i = 0; i < hi[u]; i++) { v = to[u][i]; if (seen[v]) continue; seen[v] = 1; if (match[v] < 0 || bpm(...
// AOJ 2480 Blame Game // 2018.3.9 bal4u #include <stdio.h> #include <string.h> #define MAX 1005 short hi[MAX], to[MAX][MAX]; char seen[MAX]; short match[MAX]; int bpm(int u) { int i, v; for (i = 0; i < hi[u]; i++) { v = to[u][i]; if (seen[v]) continue; seen[v] = 1; if (match[v] < 0 || bpm...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72]]
0
332
4
#include <stdio.h> int rev(int n) { int out; // printf("(%d ", n); out = 0; while (n > 0) { out = out * 10 + (n % 10); n /= 10; } // printf("%d)", out); return (out); } int main(void) { int n; int i; scanf("%d", &n); i = 0; while (1) { if (n - i >= 0) { if (rev(n - i)...
#include <stdio.h> int rev(int n) { int out; // printf("(%d ", n); out = 0; while (n > 0) { out = out * 10 + (n % 10); n /= 10; } // printf("%d)", out); return (out); } int main(void) { int n; int i; scanf("%d", &n); i = 0; while (1) { if (n - i >= 0) { if (rev(n - i)...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72]]
0
157
2